Java Code Examples for javax.rmi.CORBA.Util

The following are top voted examples for showing how to use javax.rmi.CORBA.Util. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: OpenJSharp   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * 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 2
Project: OpenJSharp   File: FVDCodeBaseImpl.java   View source code 6 votes vote down vote up
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 3
Project: openjdk-jdk10   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * 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
Project: openjdk-jdk10   File: ORBUtility.java   View source code 6 votes vote down vote up
/**
 * 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.getCause());
    }

    if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat))
        return ORBConstants.STREAM_FORMAT_VERSION_1;
    else
        return ((ValueHandlerMultiFormat)vh).getMaximumStreamFormatVersion();
}
 
Example 5
Project: openjdk-jdk10   File: FVDCodeBaseImpl.java   View source code 6 votes vote down vote up
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 6
Project: openjdk9   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * 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 7
Project: openjdk9   File: FVDCodeBaseImpl.java   View source code 6 votes vote down vote up
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
Project: lookaside_java-1.8.0-openjdk   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * 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 9
Project: lookaside_java-1.8.0-openjdk   File: ORBUtility.java   View source code 6 votes vote down vote up
/**
 * 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 10
Project: lookaside_java-1.8.0-openjdk   File: FVDCodeBaseImpl.java   View source code 6 votes vote down vote up
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 11
Project: jdk8u_corba   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * 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 12
Project: jdk8u_corba   File: ORBUtility.java   View source code 6 votes vote down vote up
/**
 * 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 13
Project: jdk8u_corba   File: FVDCodeBaseImpl.java   View source code 6 votes vote down vote up
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 14
Project: infobip-open-jdk-8   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * 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 15
Project: infobip-open-jdk-8   File: FVDCodeBaseImpl.java   View source code 6 votes vote down vote up
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 16
Project: openjdk-source-code-learn   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * 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 17
Project: openjdk-source-code-learn   File: ORBUtility.java   View source code 6 votes vote down vote up
/**
 * Creates the correct ValueHandler for the given ORB,
 * querying ORBVersion information.  If the ORB or
 * ORBVersion is null, gets the ValueHandler from
 * Util.createValueHandler.
 */
public static ValueHandler createValueHandler(ORB orb) {

    if (orb == null)
        return Util.createValueHandler();

    ORBVersion version = orb.getORBVersion();

    if (version == null)
        return Util.createValueHandler();

    if (version.equals(ORBVersionFactory.getOLD()))
        return new ValueHandlerImpl_1_3();
    if (version.equals(ORBVersionFactory.getNEW()))
        return new ValueHandlerImpl_1_3_1();

    return Util.createValueHandler();
}
 
Example 18
Project: openjdk-source-code-learn   File: FVDCodeBaseImpl.java   View source code 6 votes vote down vote up
public String implementation (String x){
    try{
        // default to using the current ORB version in case the
        // vhandler is not set
        if (vhandler == null) {
            vhandler = new ValueHandlerImpl(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 19
Project: OLD-OpenJDK8   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * 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 20
Project: OLD-OpenJDK8   File: FVDCodeBaseImpl.java   View source code 6 votes vote down vote up
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 21
Project: openjdk-orb   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * 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 22
Project: openjdk-orb   File: ORBUtility.java   View source code 6 votes vote down vote up
/**
 * 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 23
Project: openjdk-orb   File: FVDCodeBaseImpl.java   View source code 6 votes vote down vote up
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 24
Project: GraMi   File: RightMostExtension.java   View source code 6 votes vote down vote up
/**
 * includes the found extension to the corresponding fragment
 * 
 * @param gEdge
 * @param emb
 * @param code
 * @param edge
 * @param nodeB
 */
protected void add(final GSpanEdge<NodeType, EdgeType> gEdge,
		final DFSCode<NodeType, EdgeType> code,int type) {
	// search corresponding extension
	GSpanExtension<NodeType, EdgeType> ext = children.get(gEdge);
	//~

	if (ext == null) {
		// create new extension
		 HPMutableGraph<NodeType, EdgeType> ng = (HPMutableGraph<NodeType, EdgeType>) code.getHPlistGraph().clone();
		// TODO: avoid clone??
		gEdge.addTo(ng);  //reformulate the form of the new extended fragment!!
		ext = new GSpanExtension<NodeType, EdgeType>();
		ext.edge=gEdge;
		ext.frag=new DFSCode<NodeType, EdgeType>(code.getSortedFreqLabels(), code.getSingleGraph(),utilities.Util.clone(code.getNonCandidates())).set((HPListGraph<NodeType, EdgeType>)ng,code.getFirst() , code.getLast(),code.getParents());
		ext.frag = (DFSCode<NodeType, EdgeType>) code.extend(ext); //PUT THE STRING HERE
		children.put(gEdge, ext);   //TODO push into Children !!!
	} else {
		gEdge.release();
	}
}
 
Example 25
Project: GraMi   File: RightMostExtension.java   View source code 6 votes vote down vote up
/**
 * includes the found extension to the corresponding fragment
 * 
 * @param gEdge
 * @param emb
 * @param code
 * @param edge
 * @param nodeB
 */
protected void add(final GSpanEdge<NodeType, EdgeType> gEdge,
		final DFSCode<NodeType, EdgeType> code,int type) {
	// search corresponding extension
	GSpanExtension<NodeType, EdgeType> ext = children.get(gEdge);
	//~

	if (ext == null) {
		// create new extension
		 HPMutableGraph<NodeType, EdgeType> ng = (HPMutableGraph<NodeType, EdgeType>) code.getHPlistGraph().clone();
		// TODO: avoid clone??
		gEdge.addTo(ng);  //reformulate the form of the new extended fragment!!
		
		ext = new GSpanExtension<NodeType, EdgeType>();
		ext.edge=gEdge;
		ext.frag=new DFSCode<NodeType, EdgeType>(code.getSortedFreqLabels(), code.getSingleGraph(),utilities.Util.clone(code.getNonCandidates())).set((HPListGraph<NodeType, EdgeType>)ng,code.getFirst() , code.getLast(),code.getParents());
		
		ext.frag = (DFSCode<NodeType, EdgeType>) code.extend(ext); //PUT THE STRING HERE
		
		children.put(gEdge, ext);   //TODO push into Children !!!
	} else {
		gEdge.release();
	}
}
 
Example 26
Project: GraMi   File: RightMostExtension.java   View source code 6 votes vote down vote up
/**
 * includes the found extension to the corresponding fragment
 * 
 * @param gEdge
 * @param emb
 * @param code
 * @param edge
 * @param nodeB
 */
protected void add(final GSpanEdge<NodeType, EdgeType> gEdge,
		final DFSCode<NodeType, EdgeType> code,int type) {
	// search corresponding extension
	GSpanExtension<NodeType, EdgeType> ext = children.get(gEdge);
	//~

	if (ext == null) {
		// create new extension
		 HPMutableGraph<NodeType, EdgeType> ng = (HPMutableGraph<NodeType, EdgeType>) code.getHPlistGraph().clone();
		// TODO: avoid clone??
		gEdge.addTo(ng);  //reformulate the form of the new extended fragment!!
		ext = new GSpanExtension<NodeType, EdgeType>();
		ext.edge=gEdge;
		ext.frag=new DFSCode<NodeType, EdgeType>(code.getSortedFreqLabels(), code.getSingleGraph(),utilities.Util.clone(code.getNonCandidates())).set((HPListGraph<NodeType, EdgeType>)ng,code.getFirst() , code.getLast(),code.getParents());
		ext.frag = (DFSCode<NodeType, EdgeType>) code.extend(ext); //PUT THE STRING HERE

		children.put(gEdge, ext);   //TODO push into Children !!!
	} else {
		gEdge.release();
	}
}
 
Example 27
Project: openjdk-icedtea7   File: PortableRemoteObject.java   View source code 6 votes vote down vote up
/**
 * 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 28
Project: openjdk-icedtea7   File: FVDCodeBaseImpl.java   View source code 6 votes vote down vote up
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 29
Project: kuzoff   File: IIOPServerManager.java   View source code 6 votes vote down vote up
public void start(String[] args) throws Exception {
    Properties p = System.getProperties();
    p.put("org.omg.CORBA.ORBClass", "com.sun.corba.se.internal.POA.POAORB");
    p.put("org.omg.CORBA.ORBSingletonClass", "com.sun.corba.se.internal.corba.ORBSingleton");
    
    ORB orb = ORB.init(args, p);
    
    POA rootPOA = (POA) orb.resolve_initial_references("RootPOA");
    
    Policy[] tpolicy = new Policy[3];
    tpolicy[0] = rootPOA.create_lifespan_policy(LifespanPolicyValue.TRANSIENT);
    tpolicy[1] = rootPOA.create_request_processing_policy(RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY);
    tpolicy[2] = rootPOA.create_servant_retention_policy(ServantRetentionPolicyValue.RETAIN);
    POA tPOA = rootPOA.create_POA("MyTransientPOA", null, tpolicy);
    
    tPOA.the_POAManager().activate();
    Tie tie = (Tie) Util.getTie(remoteDatabaseManager);
    byte[] id = "db".getBytes();
    tPOA.activate_object_with_id(id, (Servant) tie);
        
    Context initialNamingContext = new InitialContext();
    initialNamingContext.rebind("DatabaseService", tPOA.create_reference_with_id(id, ((Servant) tie)._all_interfaces(tPOA, id)[0]));
    System.out.println("Database Server: Ready...");
    
    orb.run();
}
 
Example 30
Project: OpenJSharp   File: PortableRemoteObject.java   View source code 5 votes vote down vote up
/**
 * 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 31
Project: OpenJSharp   File: StubFactoryFactoryDynamicBase.java   View source code 5 votes vote down vote up
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 32
Project: OpenJSharp   File: DynamicMethodMarshallerImpl.java   View source code 5 votes vote down vote up
public Object[] copyArguments( Object[] args,
    ORB orb ) throws RemoteException
{
    if (needsArgumentCopy)
        return Util.copyObjects( args, orb ) ;
    else
        return args ;
}
 
Example 33
Project: OpenJSharp   File: DynamicMethodMarshallerImpl.java   View source code 5 votes vote down vote up
public Object copyResult( Object result, ORB orb ) throws RemoteException
{
    if (needsResultCopy)
        return Util.copyObject( result, orb ) ;
    else
        return result ;
}
 
Example 34
Project: OpenJSharp   File: CDROutputStream_1_0.java   View source code 5 votes vote down vote up
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 35
Project: OpenJSharp   File: CDROutputStream_1_0.java   View source code 5 votes vote down vote up
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 36
Project: OpenJSharp   File: CDROutputStream_1_0.java   View source code 5 votes vote down vote up
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 37
Project: OpenJSharp   File: ORBUtility.java   View source code 5 votes vote down vote up
/**
 * Returns the maximum stream format version supported by our
 * ValueHandler.
 */
public static byte getMaxStreamFormatVersion() {
    ValueHandler vh = Util.createValueHandler();

    if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat))
        return ORBConstants.STREAM_FORMAT_VERSION_1;
    else
        return ((ValueHandlerMultiFormat)vh).getMaximumStreamFormatVersion();
}
 
Example 38
Project: OpenJSharp   File: ORBImpl.java   View source code 5 votes vote down vote up
/** 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 39
Project: OpenJSharp   File: Utility.java   View source code 5 votes vote down vote up
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 40
Project: OpenJSharp   File: Utility.java   View source code 5 votes vote down vote up
/**
 * 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 );
    }
}