Java Code Examples for javax.rmi.CORBA.Util
The following examples show how to use
javax.rmi.CORBA.Util. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: openjdk-jdk8u Source File: ORBUtility.java License: GNU General Public License v2.0 | 6 votes |
/** * Returns the maximum stream format version supported by our * ValueHandler. */ public static byte getMaxStreamFormatVersion() { ValueHandler vh; try { vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() { public ValueHandler run() throws Exception { return Util.createValueHandler(); } }); } catch (PrivilegedActionException e) { throw new InternalError(e.getMessage()); } if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat)) return ORBConstants.STREAM_FORMAT_VERSION_1; else return ((ValueHandlerMultiFormat)vh).getMaximumStreamFormatVersion(); }
Example 2
Source Project: openjdk-jdk8u-backup Source File: ORBUtility.java License: GNU General Public License v2.0 | 6 votes |
/** * Returns the maximum stream format version supported by our * ValueHandler. */ public static byte getMaxStreamFormatVersion() { ValueHandler vh; try { vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() { public ValueHandler run() throws Exception { return Util.createValueHandler(); } }); } catch (PrivilegedActionException e) { throw new InternalError(e.getMessage()); } if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat)) return ORBConstants.STREAM_FORMAT_VERSION_1; else return ((ValueHandlerMultiFormat)vh).getMaximumStreamFormatVersion(); }
Example 3
Source Project: TencentKona-8 Source File: PortableRemoteObject.java License: GNU General Public License v2.0 | 6 votes |
/** * Deregisters a server object from the runtime, allowing the object to become * available for garbage collection. * @param obj the object to unexport. * @exception NoSuchObjectException if the remote object is not * currently exported. */ public void unexportObject(Remote obj) throws NoSuchObjectException { if (obj == null) { throw new NullPointerException("invalid argument"); } if (StubAdapter.isStub(obj) || obj instanceof java.rmi.server.RemoteStub) { throw new NoSuchObjectException( "Can only unexport a server object."); } Tie theTie = Util.getTie(obj); if (theTie != null) { Util.unexportObject(obj); } else { if (Utility.loadTie(obj) == null) { UnicastRemoteObject.unexportObject(obj,true); } else { throw new NoSuchObjectException("Object not exported."); } } }
Example 4
Source Project: openjdk-8 Source File: PortableRemoteObject.java License: GNU General Public License v2.0 | 6 votes |
/** * Deregisters a server object from the runtime, allowing the object to become * available for garbage collection. * @param obj the object to unexport. * @exception NoSuchObjectException if the remote object is not * currently exported. */ public void unexportObject(Remote obj) throws NoSuchObjectException { if (obj == null) { throw new NullPointerException("invalid argument"); } if (StubAdapter.isStub(obj) || obj instanceof java.rmi.server.RemoteStub) { throw new NoSuchObjectException( "Can only unexport a server object."); } Tie theTie = Util.getTie(obj); if (theTie != null) { Util.unexportObject(obj); } else { if (Utility.loadTie(obj) == null) { UnicastRemoteObject.unexportObject(obj,true); } else { throw new NoSuchObjectException("Object not exported."); } } }
Example 5
Source Project: JDKSourceCode1.8 Source File: ORBUtility.java License: MIT License | 6 votes |
/** * Returns the maximum stream format version supported by our * ValueHandler. */ public static byte getMaxStreamFormatVersion() { ValueHandler vh; try { vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() { public ValueHandler run() throws Exception { return Util.createValueHandler(); } }); } catch (PrivilegedActionException e) { throw new InternalError(e.getMessage()); } if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat)) return ORBConstants.STREAM_FORMAT_VERSION_1; else return ((ValueHandlerMultiFormat)vh).getMaximumStreamFormatVersion(); }
Example 6
Source Project: TencentKona-8 Source File: ORBUtility.java License: GNU General Public License v2.0 | 6 votes |
/** * Returns the maximum stream format version supported by our * ValueHandler. */ public static byte getMaxStreamFormatVersion() { ValueHandler vh; try { vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() { public ValueHandler run() throws Exception { return Util.createValueHandler(); } }); } catch (PrivilegedActionException e) { throw new InternalError(e.getMessage()); } if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat)) return ORBConstants.STREAM_FORMAT_VERSION_1; else return ((ValueHandlerMultiFormat)vh).getMaximumStreamFormatVersion(); }
Example 7
Source Project: TencentKona-8 Source File: FVDCodeBaseImpl.java License: GNU General Public License v2.0 | 6 votes |
public String implementation (String x){ try{ // default to using the current ORB version in case the // vhandler is not set if (vhandler == null) { vhandler = ValueHandlerImpl.getInstance(false); } // Util.getCodebase may return null which would // cause a BAD_PARAM exception. String result = Util.getCodebase(vhandler.getClassFromType(x)); if (result == null) return ""; else return result; } catch(ClassNotFoundException cnfe){ throw wrapper.missingLocalValueImpl( CompletionStatus.COMPLETED_MAYBE, cnfe ) ; } }
Example 8
Source Project: openjdk-jdk8u-backup Source File: Utility.java License: GNU General Public License v2.0 | 5 votes |
/** * Get the helper for an IDLValue * * Throws MARSHAL exception if no helper found. */ public static BoxedValueHelper getHelper(Class clazz, String codebase, String repId) { String className = null; if (clazz != null) { className = clazz.getName(); if (codebase == null) codebase = Util.getCodebase(clazz); } else { if (repId != null) className = RepositoryId.cache.getId(repId).getClassName(); if (className == null) // no repId or unrecognized repId throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE); } try { ClassLoader clazzLoader = (clazz == null ? null : clazz.getClassLoader()); Class helperClass = loadClassForClass(className+"Helper", codebase, clazzLoader, clazz, clazzLoader); return (BoxedValueHelper)helperClass.newInstance(); } catch (ClassNotFoundException cnfe) { throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE, cnfe ); } catch (IllegalAccessException iae) { throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE, iae ); } catch (InstantiationException ie) { throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE, ie ); } catch (ClassCastException cce) { throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE, cce ); } }
Example 9
Source Project: jdk1.8-source-analysis Source File: PortableRemoteObject.java License: Apache License 2.0 | 5 votes |
/** * Returns a stub for the given server object. * @param obj the server object for which a stub is required. Must either be a subclass * of PortableRemoteObject or have been previously the target of a call to * {@link #exportObject}. * @return the most derived stub for the object. * @exception NoSuchObjectException if a stub cannot be located for the given server object. */ public Remote toStub (Remote obj) throws NoSuchObjectException { Remote result = null; if (obj == null) { throw new NullPointerException("invalid argument"); } // If the class is already an IIOP stub then return it. if (StubAdapter.isStub( obj )) { return obj; } // If the class is already a JRMP stub then return it. if (obj instanceof java.rmi.server.RemoteStub) { return obj; } // Has it been exported to IIOP? Tie theTie = Util.getTie(obj); if (theTie != null) { result = Utility.loadStub(theTie,null,null,true); } else { if (Utility.loadTie(obj) == null) { result = java.rmi.server.RemoteObject.toStub(obj); } } if (result == null) { throw new NoSuchObjectException("object not exported"); } return result; }
Example 10
Source Project: JDKSourceCode1.8 Source File: CDROutputStream_1_0.java License: MIT License | 5 votes |
private void writeClassBody(Class clz) { if (orb == null || ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { write_value(Util.getCodebase(clz)); write_value(repIdStrs.createForAnyType(clz)); } else { write_value(repIdStrs.createForAnyType(clz)); write_value(Util.getCodebase(clz)); } }
Example 11
Source Project: openjdk-8-source Source File: Utility.java License: GNU General Public License v2.0 | 5 votes |
public static Class loadClassForClass (String className, String remoteCodebase, ClassLoader loader, Class relatedType, ClassLoader relatedTypeClassLoader) throws ClassNotFoundException { if (relatedType == null) return Util.loadClass(className, remoteCodebase, loader); Class loadedClass = null; try { loadedClass = Util.loadClass(className, remoteCodebase, loader); } catch (ClassNotFoundException cnfe) { if (relatedType.getClassLoader() == null) throw cnfe; } // If no class was not loaded, or if the loaded class is not of the // correct type, make a further attempt to load the correct class // using the classloader of the related type. // _REVISIT_ Is this step necessary, or should the Util,loadClass // algorithm always produce a valid class if the setup is correct? // Does the OMG standard algorithm need to be changed to include // this step? if (loadedClass == null || (loadedClass.getClassLoader() != null && loadedClass.getClassLoader().loadClass(relatedType.getName()) != relatedType)) { if (relatedType.getClassLoader() != relatedTypeClassLoader) throw new IllegalArgumentException( "relatedTypeClassLoader not class loader of relatedType."); if (relatedTypeClassLoader != null) loadedClass = relatedTypeClassLoader.loadClass(className); } return loadedClass; }
Example 12
Source Project: openjdk-8 Source File: CDROutputStream_1_0.java License: GNU General Public License v2.0 | 5 votes |
private void writeClassBody(Class clz) { if (orb == null || ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { write_value(Util.getCodebase(clz)); write_value(repIdStrs.createForAnyType(clz)); } else { write_value(repIdStrs.createForAnyType(clz)); write_value(Util.getCodebase(clz)); } }
Example 13
Source Project: JDKSourceCode1.8 Source File: Utility.java License: MIT License | 5 votes |
/** * Get the helper for an IDLValue * * Throws MARSHAL exception if no helper found. */ public static BoxedValueHelper getHelper(Class clazz, String codebase, String repId) { String className = null; if (clazz != null) { className = clazz.getName(); if (codebase == null) codebase = Util.getCodebase(clazz); } else { if (repId != null) className = RepositoryId.cache.getId(repId).getClassName(); if (className == null) // no repId or unrecognized repId throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE); } try { ClassLoader clazzLoader = (clazz == null ? null : clazz.getClassLoader()); Class helperClass = loadClassForClass(className+"Helper", codebase, clazzLoader, clazz, clazzLoader); return (BoxedValueHelper)helperClass.newInstance(); } catch (ClassNotFoundException cnfe) { throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE, cnfe ); } catch (IllegalAccessException iae) { throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE, iae ); } catch (InstantiationException ie) { throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE, ie ); } catch (ClassCastException cce) { throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE, cce ); } }
Example 14
Source Project: JDKSourceCode1.8 Source File: CDROutputStream_1_0.java License: MIT License | 5 votes |
private void writeArray(Serializable array, Class clazz) { if (valueHandler == null) valueHandler = ORBUtility.createValueHandler(); //d11638 // Write value_tag int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz)); // Write repository ID write_repositoryId(repIdStrs.createSequenceRepID(clazz)); // Add indirection for object to indirection table updateIndirectionTable(indirection, array, array); // Write Value chunk if (mustChunk) { start_block(); end_flag--; chunkedValueNestingLevel--; } else end_flag--; if (valueHandler instanceof ValueHandlerMultiFormat) { ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler; vh.writeValue(parent, array, streamFormatVersion); } else valueHandler.writeValue(parent, array); if (mustChunk) end_block(); // Write end tag writeEndTag(mustChunk); }
Example 15
Source Project: JDKSourceCode1.8 Source File: DynamicMethodMarshallerImpl.java License: MIT License | 5 votes |
public Object copyResult( Object result, ORB orb ) throws RemoteException { if (needsResultCopy) return Util.copyObject( result, orb ) ; else return result ; }
Example 16
Source Project: jdk1.8-source-analysis Source File: CDROutputStream_1_0.java License: Apache License 2.0 | 5 votes |
private void writeClassBody(Class clz) { if (orb == null || ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { write_value(Util.getCodebase(clz)); write_value(repIdStrs.createForAnyType(clz)); } else { write_value(repIdStrs.createForAnyType(clz)); write_value(Util.getCodebase(clz)); } }
Example 17
Source Project: openjdk-jdk8u Source File: CDROutputStream_1_0.java License: GNU General Public License v2.0 | 5 votes |
private void writeValueBase(org.omg.CORBA.portable.ValueBase object, Class clazz) { // _REVISIT_ could check to see whether chunking really needed mustChunk = true; // Write value_tag int indirection = writeValueTag(true, true, Util.getCodebase(clazz)); // Get rep id String repId = ((ValueBase)object)._truncatable_ids()[0]; // Write rep id write_repositoryId(repId); // Add indirection for object to indirection table updateIndirectionTable(indirection, object, object); // Write Value chunk start_block(); end_flag--; chunkedValueNestingLevel--; writeIDLValue(object, repId); end_block(); // Write end tag writeEndTag(true); }
Example 18
Source Project: jdk1.8-source-analysis Source File: ORBImpl.java License: Apache License 2.0 | 5 votes |
/** This is the implementation of the public API used to connect * a servant-skeleton to the ORB. */ public synchronized void connect(org.omg.CORBA.Object servant) { checkShutdownState(); if (getTOAFactory() == null) throw wrapper.noToa() ; try { String codebase = javax.rmi.CORBA.Util.getCodebase( servant.getClass() ) ; getTOAFactory().getTOA( codebase ).connect( servant ) ; } catch ( Exception ex ) { throw wrapper.orbConnectError( ex ) ; } }
Example 19
Source Project: jdk1.8-source-analysis Source File: Utility.java License: Apache License 2.0 | 5 votes |
/** * Get the helper for an IDLValue * * Throws MARSHAL exception if no helper found. */ public static BoxedValueHelper getHelper(Class clazz, String codebase, String repId) { String className = null; if (clazz != null) { className = clazz.getName(); if (codebase == null) codebase = Util.getCodebase(clazz); } else { if (repId != null) className = RepositoryId.cache.getId(repId).getClassName(); if (className == null) // no repId or unrecognized repId throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE); } try { ClassLoader clazzLoader = (clazz == null ? null : clazz.getClassLoader()); Class helperClass = loadClassForClass(className+"Helper", codebase, clazzLoader, clazz, clazzLoader); return (BoxedValueHelper)helperClass.newInstance(); } catch (ClassNotFoundException cnfe) { throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE, cnfe ); } catch (IllegalAccessException iae) { throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE, iae ); } catch (InstantiationException ie) { throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE, ie ); } catch (ClassCastException cce) { throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE, cce ); } }
Example 20
Source Project: openjdk-jdk9 Source File: IIOPOutputStream.java License: GNU General Public License v2.0 | 5 votes |
/** * Override the actions of the final method "writeObject()" * in ObjectOutputStream. * @since JDK1.1.6 */ public final void writeObjectOverride(Object obj) throws IOException { writeObjectState.writeData(this); Util.writeAbstractObject((OutputStream)orbStream, obj); }
Example 21
Source Project: jdk1.8-source-analysis Source File: IIOPOutputStream.java License: Apache License 2.0 | 5 votes |
/** * Override the actions of the final method "writeObject()" * in ObjectOutputStream. * @since JDK1.1.6 */ public final void writeObjectOverride(Object obj) throws IOException { writeObjectState.writeData(this); Util.writeAbstractObject((OutputStream)orbStream, obj); }
Example 22
Source Project: openjdk-jdk8u Source File: ORBUtility.java License: GNU General Public License v2.0 | 5 votes |
/** * Return default ValueHandler */ public static ValueHandler createValueHandler() { ValueHandler vh; try { vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() { public ValueHandler run() throws Exception { return Util.createValueHandler(); } }); } catch (PrivilegedActionException e) { throw new InternalError(e.getMessage()); } return vh; }
Example 23
Source Project: hottub Source File: StubFactoryFactoryDynamicBase.java License: GNU General Public License v2.0 | 5 votes |
public PresentationManager.StubFactory createStubFactory( String className, boolean isIDLStub, String remoteCodeBase, Class expectedClass, ClassLoader classLoader) { Class cls = null ; try { cls = Util.loadClass( className, remoteCodeBase, classLoader ) ; } catch (ClassNotFoundException exc) { throw wrapper.classNotFound3( CompletionStatus.COMPLETED_MAYBE, exc, className ) ; } PresentationManager pm = ORB.getPresentationManager() ; if (IDLEntity.class.isAssignableFrom( cls ) && !Remote.class.isAssignableFrom( cls )) { // IDL stubs must always use static factories. PresentationManager.StubFactoryFactory sff = pm.getStubFactoryFactory( false ) ; PresentationManager.StubFactory sf = sff.createStubFactory( className, true, remoteCodeBase, expectedClass, classLoader ) ; return sf ; } else { PresentationManager.ClassData classData = pm.getClassData( cls ) ; return makeDynamicStubFactory( pm, classData, classLoader ) ; } }
Example 24
Source Project: JDKSourceCode1.8 Source File: RepositoryId.java License: MIT License | 5 votes |
public final Class getClassFromType() throws ClassNotFoundException { if (clazz != null) return clazz; Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); if (specialCase != null){ clazz = specialCase; return specialCase; } else { try{ return Util.loadClass(getClassName(), null, null); } catch(ClassNotFoundException cnfe){ if (defaultServerURL != null) { try{ return getClassFromType(defaultServerURL); } catch(MalformedURLException mue){ throw cnfe; } } else throw cnfe; } } }
Example 25
Source Project: TencentKona-8 Source File: CDROutputStream_1_0.java License: GNU General Public License v2.0 | 5 votes |
private void writeArray(Serializable array, Class clazz) { if (valueHandler == null) valueHandler = ORBUtility.createValueHandler(); //d11638 // Write value_tag int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz)); // Write repository ID write_repositoryId(repIdStrs.createSequenceRepID(clazz)); // Add indirection for object to indirection table updateIndirectionTable(indirection, array, array); // Write Value chunk if (mustChunk) { start_block(); end_flag--; chunkedValueNestingLevel--; } else end_flag--; if (valueHandler instanceof ValueHandlerMultiFormat) { ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler; vh.writeValue(parent, array, streamFormatVersion); } else valueHandler.writeValue(parent, array); if (mustChunk) end_block(); // Write end tag writeEndTag(mustChunk); }
Example 26
Source Project: TencentKona-8 Source File: CDROutputStream_1_0.java License: GNU General Public License v2.0 | 5 votes |
private void writeValueBase(org.omg.CORBA.portable.ValueBase object, Class clazz) { // _REVISIT_ could check to see whether chunking really needed mustChunk = true; // Write value_tag int indirection = writeValueTag(true, true, Util.getCodebase(clazz)); // Get rep id String repId = ((ValueBase)object)._truncatable_ids()[0]; // Write rep id write_repositoryId(repId); // Add indirection for object to indirection table updateIndirectionTable(indirection, object, object); // Write Value chunk start_block(); end_flag--; chunkedValueNestingLevel--; writeIDLValue(object, repId); end_block(); // Write end tag writeEndTag(true); }
Example 27
Source Project: JDKSourceCode1.8 Source File: CDROutputStream_1_0.java License: MIT License | 5 votes |
private void writeValueBase(org.omg.CORBA.portable.ValueBase object, Class clazz) { // _REVISIT_ could check to see whether chunking really needed mustChunk = true; // Write value_tag int indirection = writeValueTag(true, true, Util.getCodebase(clazz)); // Get rep id String repId = ((ValueBase)object)._truncatable_ids()[0]; // Write rep id write_repositoryId(repId); // Add indirection for object to indirection table updateIndirectionTable(indirection, object, object); // Write Value chunk start_block(); end_flag--; chunkedValueNestingLevel--; writeIDLValue(object, repId); end_block(); // Write end tag writeEndTag(true); }
Example 28
Source Project: openjdk-jdk8u Source File: CDROutputStream_1_0.java License: GNU General Public License v2.0 | 5 votes |
private void writeArray(Serializable array, Class clazz) { if (valueHandler == null) valueHandler = ORBUtility.createValueHandler(); //d11638 // Write value_tag int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz)); // Write repository ID write_repositoryId(repIdStrs.createSequenceRepID(clazz)); // Add indirection for object to indirection table updateIndirectionTable(indirection, array, array); // Write Value chunk if (mustChunk) { start_block(); end_flag--; chunkedValueNestingLevel--; } else end_flag--; if (valueHandler instanceof ValueHandlerMultiFormat) { ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler; vh.writeValue(parent, array, streamFormatVersion); } else valueHandler.writeValue(parent, array); if (mustChunk) end_block(); // Write end tag writeEndTag(mustChunk); }
Example 29
Source Project: openjdk-8-source Source File: DynamicMethodMarshallerImpl.java License: GNU General Public License v2.0 | 5 votes |
public Object[] copyArguments( Object[] args, ORB orb ) throws RemoteException { if (needsArgumentCopy) return Util.copyObjects( args, orb ) ; else return args ; }
Example 30
Source Project: openjdk-jdk9 Source File: PortableRemoteObject.java License: GNU General Public License v2.0 | 5 votes |
/** * Returns a stub for the given server object. * @param obj the server object for which a stub is required. Must either be a subclass * of PortableRemoteObject or have been previously the target of a call to * {@link #exportObject}. * @return the most derived stub for the object. * @exception NoSuchObjectException if a stub cannot be located for the given server object. */ public Remote toStub (Remote obj) throws NoSuchObjectException { Remote result = null; if (obj == null) { throw new NullPointerException("invalid argument"); } // If the class is already an IIOP stub then return it. if (StubAdapter.isStub( obj )) { return obj; } // If the class is already a JRMP stub then return it. if (obj instanceof java.rmi.server.RemoteStub) { return obj; } // Has it been exported to IIOP? Tie theTie = Util.getTie(obj); if (theTie != null) { result = Utility.loadStub(theTie,null,null,true); } else { if (Utility.loadTie(obj) == null) { result = java.rmi.server.RemoteObject.toStub(obj); } } if (result == null) { throw new NoSuchObjectException("object not exported"); } return result; }