OOP Protector Version 1.0

com.oopreserch.mercury.protector
Class ProtectorFactory

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--com.oopreserch.mercury.protector.ProtectorFactory

public class ProtectorFactory
extends java.rmi.server.UnicastRemoteObject
implements ProtectorFactoryInterface

Create the new instance of Protector and return it. This class depends on Mercury API.

Author:
Jun Inamori
See Also:
ProtectorInterface, Mercury API Documentation, KeyPairBox, Serialized Form

Inner Class Summary
 class ProtectorFactory.ProtectorConfig
           
 
Constructor Summary
ProtectorFactory(java.lang.String jndi, int port, java.rmi.server.RMIClientSocketFactory csf, java.rmi.server.RMIServerSocketFactory ssf, java.lang.String path)
          Constructor with the path to the XML file, which may contain the default KeyPairBox file and the user-password pairs.
ProtectorFactory(java.lang.String jndi, int port, java.lang.String path)
          Constructor with the path to the XML file, which may contain the default KeyPairBox file and the user-password pairs.
ProtectorFactory(java.lang.String jndi, java.lang.String path)
          Constructor with the path to the XML file, which may contain the default KeyPairBox file and the user-password pairs.
 
Method Summary
 ProtectorInterface getProtector(java.io.Serializable box)
          The member of ProtectorFactoryInterface interface.
 ProtectorInterface getProtector(java.lang.String usr, java.lang.String pss)
          The member of ProtectorFactoryInterface interface.
 ProtectorInterface getProtector(java.lang.String usr, java.lang.String pss, java.lang.String alias)
          The member of ProtectorFactoryInterface interface.
 void setURL(java.lang.String url)
          Set JNDI URL
 void unbindProtector(java.lang.String usr, java.lang.String pss)
          The member of ProtectorFactoryInterface interface.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProtectorFactory

public ProtectorFactory(java.lang.String jndi,
                        java.lang.String path)
                 throws java.rmi.RemoteException,
                        java.lang.Exception
Constructor with the path to the XML file, which may contain the default KeyPairBox file and the user-password pairs.

Create and export a new UnicastRemoteObject object using an anonymous port.
The information retrieved from the XML file is used by getProtector(String usr,String pss) and getProtector(String usr,String pss,String alias).
Parameters:
jndi - The JNDI name by which this instance bound to the Context.
path - The local path to XML file for configuration.
Throws:
java.lang.Exception -  
See Also:
getProtector(String,String), getProtector(String,String,String)

ProtectorFactory

public ProtectorFactory(java.lang.String jndi,
                        int port,
                        java.lang.String path)
                 throws java.rmi.RemoteException,
                        java.lang.Exception
Constructor with the path to the XML file, which may contain the default KeyPairBox file and the user-password pairs.

Create and export a new UnicastRemoteObject object using the particular supplied port.
The information retrieved from the XML file is used by getProtector(String usr,String pss) and getProtector(String usr,String pss,String alias).
Parameters:
jndi - The JNDI name by which this instance bound to the Context.
port - The port number to which this object is exported.
path - The local path to XML file for configuration.
Throws:
java.lang.Exception -  
See Also:
getProtector(String,String), getProtector(String,String,String)

ProtectorFactory

public ProtectorFactory(java.lang.String jndi,
                        int port,
                        java.rmi.server.RMIClientSocketFactory csf,
                        java.rmi.server.RMIServerSocketFactory ssf,
                        java.lang.String path)
                 throws java.rmi.RemoteException,
                        java.lang.Exception
Constructor with the path to the XML file, which may contain the default KeyPairBox file and the user-password pairs.

Create and export a new UnicastRemoteObject object using the particular supplied port and socket factories
The information retrieved from the XML file is used by getProtector(String usr,String pss) and getProtector(String usr,String pss,String alias).
Parameters:
jndi - The JNDI name by which this instance bound to the Context.
port - The port number to which this object is exported.
csf - the client-side socket factory for making calls to the remote object
ssf - the server-side socket factory for receiving remote calls
path - The local path to XML file for configuration.
Throws:
java.lang.Exception -  
See Also:
getProtector(String,String), getProtector(String,String,String)
Method Detail

getProtector

public ProtectorInterface getProtector(java.lang.String usr,
                                       java.lang.String pss)
                                throws java.rmi.RemoteException,
                                       com.oopreserch.util.SimpleException,
                                       com.oopreserch.util.NestedException
The member of ProtectorFactoryInterface interface. Create the new instance of Protector based on the default KeyPairBox instance and return it.

The default KeyPairBox is read from the local file, whose path is specified by the configuration XML file.
Specified by:
getProtector in interface ProtectorFactoryInterface
Parameters:
usr - The user name for the default KeyPairBox.
pss - The password for the default KeyPairBox.
Returns:
ProtectorInterface
Throws:
java.rmi.RemoteException -  
com.oopreserch.util.SimpleException -  
com.oopreserch.util.NestedException -  
See Also:
ProtectorInterface, KeyPairBox

getProtector

public ProtectorInterface getProtector(java.lang.String usr,
                                       java.lang.String pss,
                                       java.lang.String alias)
                                throws java.rmi.RemoteException,
                                       com.oopreserch.util.SimpleException,
                                       com.oopreserch.util.NestedException
The member of ProtectorFactoryInterface interface. Create the new instance of Protector based on the default KeyPairBox instance and return it. The public keys other than the one specified by the alias are removed.

The default KeyPairBox is read from the local file, whose path is specified by the configuration XML file. Because only the public key with the specified alias is contained in the KeyPairBox instance, the data signed and encrypted by the other private keys fails to be decrypted and verified.
Specified by:
getProtector in interface ProtectorFactoryInterface
Parameters:
usr - The user name for the default KeyPairBox.
pss - The password for the default KeyPairBox.
alias - The name of the public key used to decrypt and verify. Other public keys are removed from the instance of KeyPairBox, which means the data signed and encrypted by the other private keys fails to be decrypted and verified.
Returns:
ProtectorInterface
Throws:
java.rmi.RemoteException -  
com.oopreserch.util.SimpleException -  
com.oopreserch.util.NestedException -  
See Also:
ProtectorInterface, KeyPairBox

getProtector

public ProtectorInterface getProtector(java.io.Serializable box)
                                throws java.rmi.RemoteException,
                                       com.oopreserch.util.NestedException
The member of ProtectorFactoryInterface interface. Create the new instance of Protector based on the specified KeyPairBox instance and return it.

The KeyPairBox is specified as the argument, whose implementation class is Serializable.
Specified by:
getProtector in interface ProtectorFactoryInterface
Parameters:
box - The serializable KeyPairBox instance.
Returns:
ProtectorInterface
Throws:
java.rmi.RemoteException -  
com.oopreserch.util.NestedException -  
See Also:
ProtectorInterface, KeyPairBox

unbindProtector

public void unbindProtector(java.lang.String usr,
                            java.lang.String pss)
                     throws java.rmi.RemoteException,
                            java.lang.Exception
The member of ProtectorFactoryInterface interface. Can be invoked only by the administrator.

This method invokes Context.unbind().
Specified by:
unbindProtector in interface ProtectorFactoryInterface
Parameters:
usr - The user name for administrator.
pss - The password for administrator.
Throws:
java.rmi.RemoteException -  
java.lang.Exception -  

setURL

public void setURL(java.lang.String url)
Set JNDI URL

OOP Protector Version 1.0

ALL CONTENTS COPYRIGHT 2000, Jun Inamori. All rights reserved.
Any questions and comments are welcome to Jun Inamori.