org.objectweb.carol.rmi.multi.MultiPRODelegate Maven / Gradle / Ivy
/**
* Copyright (C) 2002-2007 - INRIA (www.inria.fr)
*
* CAROL: Common Architecture for RMI ObjectWeb Layer
*
* This library is developed inside the OW2 Consortium,
* http://www.ow2.org
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* --------------------------------------------------------------------------
* $Id: MultiPRODelegate.java 1279 2007-09-19 13:10:56Z loris $
* --------------------------------------------------------------------------
*/
package org.objectweb.carol.rmi.multi;
import java.rmi.NoSuchObjectException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import javax.rmi.CORBA.PortableRemoteObjectDelegate;
/**
* Class MultiPRODelegate
* This is a proxy for multi orb portable remote object delegate reference this
* class with the systeme property : java
* -Djavax.rmi.CORBA.PortableRemoteObjectClass=org.objectweb.carol.rmi.multi.MultiPRODelegate
* ... for the moment this class is only for one orb
* @author Guillaume Riviere
* @author Florent Benoit (Refactoring : this class has no static methods,
* remove all static methods and init is done only once in constructor)
*/
@Deprecated
public class MultiPRODelegate implements PortableRemoteObjectDelegate {
private final org.ow2.carol.rmi.multi.MultiPRODelegate multiPRODelegate;
/**
* constructor for this PortableRemoteObjectDelegateProxy
*/
public MultiPRODelegate() {
multiPRODelegate = new org.ow2.carol.rmi.multi.MultiPRODelegate();
}
/**
* Makes a server object ready to receive remote calls. Note that subclasses
* of PortableRemoteObject do not need to call this method, as it is called
* by the constructor.
* @param obj the server object to export.
* @exception RemoteException if export fails.
*/
public void exportObject(final Remote obj) throws RemoteException {
multiPRODelegate.exportObject(obj);
}
/**
* 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(final Remote obj) throws NoSuchObjectException {
multiPRODelegate.unexportObject(obj);
}
/**
* Makes a Remote object ready for remote communication. This normally
* happens implicitly when the object is sent or received as an argument on
* a remote method call, but in some circumstances it is useful to perform
* this action by making an explicit call.
* @param target the object to connect.
* @param source a previously connected object.
* @throws RemoteException if source
is not connected or if
* target
is already connected to a different ORB
* than source
.
*/
public void connect(final Remote target, final Remote source) throws RemoteException {
multiPRODelegate.connect(target, source);
}
/**
* Checks to ensure that an object of a remote or abstract interface type
* can be cast to a desired type.
* @param narrowFrom the object to check.
* @param narrowTo the desired type.
* @return an object which can be cast to the desired type.
* @throws ClassCastException if narrowFrom cannot be cast to narrowTo.
*/
@SuppressWarnings("unchecked")
public Object narrow(final Object narrowFrom, final Class narrowTo) throws ClassCastException {
return multiPRODelegate.narrow(narrowFrom, narrowTo);
}
/**
* 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(final Remote obj) throws NoSuchObjectException {
return multiPRODelegate.toStub(obj);
}
}