issrg.pba.management.manager
Class PManagement

java.lang.Object
  extended by issrg.pba.management.manager.PManagement
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
FilePManagement

public abstract class PManagement
extends java.lang.Object
implements java.lang.Runnable

PERMIS Management Model.

This model implements "MVC", and it runs a work thread which it uses to run tasks that may not complete quickly, this also allows the calling threads to carry on with there own tasks. The tasks are placed on the queue using the invokeLater method, and by convention any method that places the task on the queue does so by placing the implementation in another private method of the same name with the suffix "Impl".

Version:
0.1.2008.01.18
Author:
mfb4@kent.ac.uk

Nested Class Summary
 class PManagement.PMAgentReference
          PERMIS agemt reference.
 
Constructor Summary
PManagement(PMConfiguration configurationParam, java.util.Map<java.lang.String,java.lang.String> arguments)
          PERMIS Management constructor.
 
Method Summary
 PManagement.PMAgentReference addPMAgentReference()
          create a new agent reference.
 java.lang.String getIdentityStoreProvider()
          get the identity key store provider.
 java.lang.String getIdentityStoreService()
          get the identity key store service.
 PManagement.PMAgentReference[] getPMAgentReferenceArray()
          Get a list of agent references.
protected  PMConfiguration getPMConfiguration()
          return the configuration object.
 java.lang.String getSSLKeyManagerFactoryProvider()
          get the key manager factory provider.
 java.lang.String getSSLKeyManagerFactoryService()
          get the key manager factory service type.
 java.lang.String getSSLTrustManagerFactoryProvider()
          get the trust manager factory provider.
 java.lang.String getSSLTrustManagerFactoryService()
          get the trust manager factory service type.
 PMException getTrustException()
          get the exception generated in openTrustStore.
 java.lang.String getTrustStoreProvider()
          get the trust key store provider.
 java.lang.String getTrustStoreService()
          get the trust key store service (type).
protected  void informAll(PManagement.PMAgentReference agentReference)
          call informAllImpl in the work thread.
 void invokeLater(java.lang.Runnable runnable)
          hand over to the PERMIS-management work thread.
 boolean isConfigurationChanged()
          Change in configuration from the source.
 boolean isStopping()
          True when the application is closing down.
 boolean isTrusted()
          Returns true if the correct key and trust stores have been opened successfully.
 void openTrustStore(char[] passwordIdentityArrayParam, char[] passwordTrustArrayParam)
          Get the trust and identity information.
 void register(PManagementListener listener)
          register the listener to receive notification.
 void removePMAgentReference(PManagement.PMAgentReference agentReference)
          remove an agent reference.
 void run()
          The life cycle of the PERMIS management exists in this run method.
 void setIdentityStoreProvider(java.lang.String value)
          set the identity key store provider.
 void setIdentityStoreService(java.lang.String value)
          set the identity key store service (type).
 void setSSLKeyManagerFactoryProvider(java.lang.String value)
          set the key manager factory provider.
 void setSSLKeyManagerFactoryService(java.lang.String value)
          set the key manager factory service type.
 void setSSLTrustManagerFactoryProvider(java.lang.String value)
          set the trust manager factory provider.
 void setSSLTrustManagerFactoryService(java.lang.String value)
          set the trust manager factory service type.
 void setTrustStoreProvider(java.lang.String value)
          set the trust key store provider.
 void setTrustStoreService(java.lang.String value)
          set the trust key store service (type).
 int sizePMAgentReferenceList()
          the number of agent references.
 void stop()
          This method will stop the running loop, inside the run method.
 void stopping()
          stopping allows for a controlled shut down.
 void storeConfiguration()
          write out the PERMIS management permanent configuration.
protected  java.lang.String trimString(java.lang.String stringParam)
          all the configuration parameters can be null, but if they are not then leading and trailing spaces need to be removed.
 void unregister(PManagementListener listener)
          remove the listener from the list, that recieves notification.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PManagement

public PManagement(PMConfiguration configurationParam,
                   java.util.Map<java.lang.String,java.lang.String> arguments)
            throws PMException
PERMIS Management constructor. creates a configuration object and loads it up. then initialises the PMAgentReferences and starts the work thread.

Parameters:
configurationParam - - PERMIS agent configuration used to set up the MBean server and connector-server it must NOT be null
arguments - - command line arguments
Throws:
PMException - - if anything goes wrong with loading in the Permanent configuration.
Since:
0.1.2008.01.23
Method Detail

getPMConfiguration

protected PMConfiguration getPMConfiguration()
return the configuration object. that holds the permanent state. used by concrete sub classes.

Returns:
the configuration object.
Since:
0.5.2008.06.09

run

public void run()
The life cycle of the PERMIS management exists in this run method.

there is a lot of swapping between the PERMIS management work thread and the application that creates an instance of this PManagement model.

Specified by:
run in interface java.lang.Runnable
Since:
0.1.2008.01.23

stopping

public void stopping()
stopping allows for a controlled shut down. by calling stopping on all the PERMIS references, which allows for the connections to be closed.

Since:
0.6.2008.06.18

isStopping

public boolean isStopping()
True when the application is closing down.

this method can be use as a global "is the application still running flag" for example in loops.

Returns:
true when the model is stopping and when it is NOT running.
Since:
0.6.2008.06.18

stop

public void stop()
This method will stop the running loop, inside the run method.

It must follow a call to stopping, so if a call to stopping has not happened this method will call before the stop running is done.

Since:
0.6.2008.06.18

invokeLater

public void invokeLater(java.lang.Runnable runnable)
hand over to the PERMIS-management work thread.

normally called by the event-dispatching thread when it want's to pass something of to the PERMIS-management thread

Parameters:
runnable - the object that implements "Runnable" and is placed on the queue to be executed.
Since:
0.1.2008.01.27

register

public void register(PManagementListener listener)
register the listener to receive notification. when the state in this model changes.

Parameters:
listener - to be placed into the list
Since:
0.6.2008.06.18

unregister

public void unregister(PManagementListener listener)
remove the listener from the list, that recieves notification. when the state in this model changes.

Parameters:
listener - the listener to remove form the list.
Since:
0.6.2008.06.18

informAll

protected void informAll(PManagement.PMAgentReference agentReference)
call informAllImpl in the work thread.

Parameters:
agentReference - the inner PERMIS agent where the change happen, or null
Since:
0.6.2008.06.18

isTrusted

public boolean isTrusted()
Returns true if the correct key and trust stores have been opened successfully.

Returns:
true when key stores have been read in.
Since:
0.6.2008.06.19

openTrustStore

public void openTrustStore(char[] passwordIdentityArrayParam,
                           char[] passwordTrustArrayParam)
Get the trust and identity information. call the openTrustStoreImple method of inside the models work thread.

Parameters:
passwordIdentityArrayParam - password for the identity key store.
passwordTrustArrayParam - password for the trust key store.
Since:
0.5.2008.06.13

getTrustException

public PMException getTrustException()
get the exception generated in openTrustStore.

Returns:
an exception if any created in open TrustStore
Since:
0.6.2008.07.18

getIdentityStoreService

public java.lang.String getIdentityStoreService()
get the identity key store service. from the configuration object. i.e. the format / type of key store.

Returns:
the identity key store service identifier
Since:
0.6.2008.06.19

trimString

protected java.lang.String trimString(java.lang.String stringParam)
all the configuration parameters can be null, but if they are not then leading and trailing spaces need to be removed.

Parameters:
stringParam - with leading and or trailing spaces
Returns:
stringParam trimmed
Since:
0.6.2008.06.23

setIdentityStoreService

public void setIdentityStoreService(java.lang.String value)
set the identity key store service (type).

Parameters:
value - the identity key store service identifier
Since:
0.6.2008.06.19

getIdentityStoreProvider

public java.lang.String getIdentityStoreProvider()
get the identity key store provider.

Returns:
the identity key store provider identifier
Since:
0.6.2008.06.19

setIdentityStoreProvider

public void setIdentityStoreProvider(java.lang.String value)
set the identity key store provider.

Parameters:
value - the identity key store provider identifier
Since:
0.6.2008.06.19

getTrustStoreService

public java.lang.String getTrustStoreService()
get the trust key store service (type).

Returns:
the identity key store service identifier
Since:
0.6.2008.06.19

setTrustStoreService

public void setTrustStoreService(java.lang.String value)
set the trust key store service (type).

Parameters:
value - the trust key store service identifier
Since:
0.6.2008.06.19

getTrustStoreProvider

public java.lang.String getTrustStoreProvider()
get the trust key store provider.

Returns:
the trust key store provider
Since:
0.6.2008.06.19

setTrustStoreProvider

public void setTrustStoreProvider(java.lang.String value)
set the trust key store provider.

Parameters:
value - the trust key store provider
Since:
0.6.2008.06.19

getSSLKeyManagerFactoryService

public java.lang.String getSSLKeyManagerFactoryService()
get the key manager factory service type.

Returns:
the key manager factory service identifier
Since:
0.6.2008.06.19

setSSLKeyManagerFactoryService

public void setSSLKeyManagerFactoryService(java.lang.String value)
set the key manager factory service type.

Parameters:
value - the key manager factory service identifier
Since:
0.6.2008.06.19

getSSLKeyManagerFactoryProvider

public java.lang.String getSSLKeyManagerFactoryProvider()
get the key manager factory provider.

Returns:
the key manager factory service identifier
Since:
0.6.2008.06.19

setSSLKeyManagerFactoryProvider

public void setSSLKeyManagerFactoryProvider(java.lang.String value)
set the key manager factory provider.

Parameters:
value - the key manager factory provider identifier
Since:
0.6.2008.06.19

getSSLTrustManagerFactoryService

public java.lang.String getSSLTrustManagerFactoryService()
get the trust manager factory service type.

Returns:
the trust manager factory service identifier
Since:
0.6.2008.06.19

setSSLTrustManagerFactoryService

public void setSSLTrustManagerFactoryService(java.lang.String value)
set the trust manager factory service type.

Parameters:
value - the trust manager factory service identifier
Since:
0.6.2008.06.19

getSSLTrustManagerFactoryProvider

public java.lang.String getSSLTrustManagerFactoryProvider()
get the trust manager factory provider.

Returns:
the trust manager factory provider
Since:
0.6.2008.06.19

setSSLTrustManagerFactoryProvider

public void setSSLTrustManagerFactoryProvider(java.lang.String value)
set the trust manager factory provider.

Parameters:
value - the trust manager factory provider identifier
Since:
0.6.2008.06.19

isConfigurationChanged

public boolean isConfigurationChanged()
Change in configuration from the source.

Returns true if the configuration has been altered and needs writing out to permanent storage (the configuration file).

Returns:
true if the permanent configuration has changed.
Since:
0.6.2008.06.19

storeConfiguration

public void storeConfiguration()
                        throws PMException
write out the PERMIS management permanent configuration.

Throws:
PMException - if the permanent configuration failed to be stored to it's permanent location
Since:
0.6.2008.06.19

addPMAgentReference

public PManagement.PMAgentReference addPMAgentReference()
create a new agent reference.

Returns:
a new agent reference
Since:
0.6.2008.06.20

removePMAgentReference

public void removePMAgentReference(PManagement.PMAgentReference agentReference)
remove an agent reference.

Parameters:
agentReference - agent reference to remove
Since:
0.6.2008.06.20

getPMAgentReferenceArray

public PManagement.PMAgentReference[] getPMAgentReferenceArray()
Get a list of agent references.

Returns:
an array list of all the PMAgentReferences.
Since:
0.6.2008.06.20

sizePMAgentReferenceList

public int sizePMAgentReferenceList()
the number of agent references.

Returns:
the number of agent references.
Since:
0.6.2008.06.20