📄 sampleprintermanager.java
字号:
/* * The contents of this file are subject to the Dyade Public License, * as defined by the file DYADE_PUBLIC_LICENSE.TXT * * You may not use this file except in compliance with the License. You may * obtain a copy of the License on the Dyade web site (www.dyade.fr). * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * the specific terms governing rights and limitations under the License. * * The Original Code is CmisJava API, including the java package * fr.dyade.cmis, released September 5, 2000. * * The Initial Developer of the Original Code is Dyade. The Original Code and * portions created by Dyade are Copyright Bull and Copyright INRIA. * All Rights Reserved. *//* Copyright 1996-2000 by Institut National de Recherche en Informatique * et en Automatique (INRIA) * All rights reserved. See COPYRIGHT in top-level directory. * * Authors: Laurent Andrey, Olivier Festor */package fr.dyade.cmis.examples;import fr.dyade.cmis.api.CMISManagerStack;import fr.dyade.cmis.api.CMISException;import fr.dyade.cmis.api.BadStackRoleException;import fr.dyade.cmis.api.types.*;import fr.dyade.cmis.api.operation.*;import fr.dyade.cmis.api.operation.event.*;import java.util.Enumeration;// coj util & basic implementationimport fr.dyade.cmis.util.TraceManager;// ISM related packagesimport fr.dyade.cmis.rmi.*;import fr.dyade.cmis.rmi.operation.*;import fr.dyade.cmis.rmi.types.*;public class SamplePrinterManager { public static CMISManagerStack theStack; public static void main(String[] args) { // Construction de l'OID pour la classe ObjectIdentifier oid = new ObjectIdentifier("1.512.1"); // Construction de l'OID pour l'instance ObjectIdentifier oid1 = new ObjectIdentifier("1.512.1.1"); try { theStack = new RMIStack("AgentFestorPrinter"); ((RMIStack) theStack).bind(); } catch (Exception ef) { System.out.println("Error during Agent Bind"); System.out.println(ef); }; ASN1Integer pValue = new ASN1Integer(1); // construction de l'AVA Ava ava = new Ava(oid1,pValue); Ava avaTable[] = new Ava[1]; avaTable[0] = ava; // Construction du DN RelativeDistinguishedName RDN = new RelativeDistinguishedName(); RDN.setAvaTable(avaTable); DistinguishedName DN = new DistinguishedName(RDN); ObjectInstance oi = new ObjectInstance(); oi.setDistinguishedName(DN); GetRequest get = theStack.newGetRequest(); get.setBaseObjectClass(new ObjectClass(oid)); get.setBaseObject(oi); get.setScope(Scope.WHOLESUBTREE); MySamplePrinterGetRequestListener theListener = new MySamplePrinterGetRequestListener(); get.addGetRequestListener(theListener); try{ get.doIt(); get.waitForIdle(); } catch (RuntimeException ex){ System.out.println(ex.getMessage()); } catch (CMISException ce){ System.out.println(ce.getMessage()); } try { ((RMIStack) theStack).unbind(); } catch (RMIRemoteException ex2) { System.out.println("Unbind Exception"); } catch (BadStackRoleException ex3) { System.out.println("Unbind Exception (bad stack role)"); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -