You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ha...@apache.org on 2002/11/29 22:22:08 UTC
cvs commit: jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/services/rmification RMIfication.java
hammant 2002/11/29 13:22:08
Modified: src/java/org/apache/avalon/cornerstone/blocks/rmification
DefaultRMIfication.java
src/java/org/apache/avalon/cornerstone/services/rmification
RMIfication.java
Log:
Extra RMIfication features from Mauro Talevi
Revision Changes Path
1.10 +38 -3 jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/rmification/DefaultRMIfication.java
Index: DefaultRMIfication.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/rmification/DefaultRMIfication.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DefaultRMIfication.java 21 Sep 2002 02:58:52 -0000 1.9
+++ DefaultRMIfication.java 29 Nov 2002 21:22:08 -0000 1.10
@@ -11,6 +11,7 @@
import java.rmi.NotBoundException;
import java.rmi.Remote;
import java.rmi.RemoteException;
+import java.rmi.RMISecurityManager;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
@@ -32,6 +33,7 @@
* @phoenix:service name="org.apache.avalon.cornerstone.services.rmification.RMIfication"
*
* @author <a href="mailto:colus@apache.org">Eung-ju Park</a>
+ * @author Mauro Talevi
* @version $Revision$
*/
public class DefaultRMIfication
@@ -56,6 +58,15 @@
throws Exception
{
m_remotes = new HashMap();
+ // check if SecurityManager is set
+ if ( System.getSecurityManager() == null ) {
+ System.setSecurityManager( new RMISecurityManager() );
+ if( getLogger().isInfoEnabled() )
+ {
+ final String message = "RMISecurityManager set";
+ getLogger().info( message );
+ }
+ }
if( m_createRegistry )
{
@@ -85,12 +96,36 @@
m_remotes = null;
}
+ public void export( final Remote remote )
+ throws RemoteException
+ {
+ UnicastRemoteObject.exportObject( remote );
+
+ if( getLogger().isDebugEnabled() )
+ {
+ final String message = "Exported Remote " + remote.toString();
+ getLogger().debug( message );
+ }
+ }
+
+ public void unexport( final Remote remote )
+ throws RemoteException
+ {
+ UnicastRemoteObject.unexportObject( remote, true );
+
+ if( getLogger().isDebugEnabled() )
+ {
+ final String message = "Unexported Remote " + remote.toString();
+ getLogger().debug( message );
+ }
+ }
+
public void publish( final Remote remote, final String publicationName )
throws RemoteException, MalformedURLException
{
synchronized( m_remotes )
{
- UnicastRemoteObject.exportObject( remote );
+ export( remote );
m_registry.rebind( publicationName, remote );
m_remotes.put( publicationName, remote );
@@ -111,7 +146,7 @@
final Remote remote = (Remote) m_remotes.get( publicationName );
m_registry.unbind( publicationName );
- UnicastRemoteObject.unexportObject( remote, true );
+ unexport( remote );
m_remotes.remove( publicationName );
}
1.6 +18 -1 jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/services/rmification/RMIfication.java
Index: RMIfication.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/services/rmification/RMIfication.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- RMIfication.java 17 Feb 2002 01:45:57 -0000 1.5
+++ RMIfication.java 29 Nov 2002 21:22:08 -0000 1.6
@@ -16,6 +16,7 @@
* This service provides a way to publish an <code>Remote<code> object via RMI.
*
* @author <a href="mailto:colus@apache.org">Eung-ju Park</a>
+ * @author Mauro Talevi
* @version $Revision$
*/
public interface RMIfication
@@ -23,6 +24,22 @@
String ROLE = RMIfication.class.getName();
/**
+ * Export a Remote object
+ *
+ * @param remote the remote object to export
+ */
+ void export( Remote remote )
+ throws RemoteException;
+
+ /**
+ * Unexport a Remote object
+ *
+ * @param remote the remote object to unexport
+ */
+ void unexport( Remote remote )
+ throws RemoteException;
+
+ /**
* Publish a set of interfaces
*
* @param remote the remote object to publish
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>