public class FrameworkModule extends LicasModule implements ServiceDef
This class stores the minimal set of variables for a service reference, for behaviours and module plug-ins.
The full service extends this module with the Service
class, so this is an integrated info object in a
full service. If specific variables are not set in this class and the service
variable is used, then where variables
overlap, its values are returned instead.
This module is not typically added to another Service
as a child service, unless it also extends the
ServiceModule
class. These modules are more specifically framework components in the service itself.
Modifier and Type | Field and Description |
---|---|
protected PasswordHandler |
passwordHandler
This stores and compares all passwords used by this module.
|
protected Service |
service
Reference to a
Service object. |
protected java.lang.String |
serviceType
The functional service type
|
jarFile, syncOn, uuid
Constructor and Description |
---|
FrameworkModule()
Creates a new instance of FrameworkModule.
|
FrameworkModule(java.lang.String password,
java.lang.String adminKey)
Creates a new instance of FrameworkModule.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canAccess(java.lang.String thePassword)
Return true if the password allows the calling component to access this component.
|
boolean |
canAccessTemp(java.lang.String thePassword)
Return true if the password allows the calling component
to access this component by a temporary password.
|
protected PasswordHandler |
getPasswordHandler()
Get the password handler.
|
PasswordHandler |
getPasswordHandler(java.lang.String adminKey)
Get the password handler.
|
protected java.lang.String |
getServerPassword()
Get the local server password if it is stored.
|
java.lang.String |
getServicePassword(java.lang.String serviceUUID,
java.lang.String serverUrl)
Get or ask for the service password, making a remote call if necessary.
|
java.lang.String |
getServiceType()
Get the functional type for this service.
|
boolean |
isAdminKey(java.lang.String theAdminKey)
Return true if the key passed in is this service's admin key.
|
void |
setServiceDetails(Service service,
PasswordHandler passwordHandler)
Set the service reference for an external service, if not already set.
|
void |
setServiceType(java.lang.String thisServiceType)
Set the functional service type, but only if it is currently
null , otherwise
it is not changed. |
getJarFile, getUUID, loadObject, setJarFile, setUUID, threadAliveState
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getUUID, setJarFile, setUUID
protected java.lang.String serviceType
protected PasswordHandler passwordHandler
protected Service service
Service
object. This can be the service that the
module uses, or a parent service if the module is a derived Service
class.public FrameworkModule() throws java.lang.Exception
setServiceDetails
.java.lang.Exception
- any error.public FrameworkModule(java.lang.String password, java.lang.String adminKey) throws java.lang.Exception
setServiceDetails
.password
- password to initialise the password handler with.adminKey
- admin key to initialise the password handler with.java.lang.Exception
- any error.public void setServiceDetails(Service service, PasswordHandler passwordHandler) throws java.lang.Exception
service
- the external (not derived) service.passwordHandler
- the service's psssword handler.java.lang.Exception
- any error.public boolean canAccess(java.lang.String thePassword)
canAccess
in interface ServiceDef
thePassword
- the password to use.public boolean canAccessTemp(java.lang.String thePassword)
canAccessTemp
in interface ServiceDef
thePassword
- the password to use.public boolean isAdminKey(java.lang.String theAdminKey)
isAdminKey
in interface ServiceDef
theAdminKey
- the key to check.public java.lang.String getServicePassword(java.lang.String serviceUUID, java.lang.String serverUrl)
serviceUUID
- the uuid of the service.
This should only be the uuid and not the whole serviceUri path.serverUrl
- URL address of a remote server if it needs to be called.
Can be null for local server.protected java.lang.String getServerPassword() throws java.lang.Exception
java.lang.Exception
- any error.public void setServiceType(java.lang.String thisServiceType)
null
, otherwise
it is not changed. This method should probably not be called manually as the service type
is automatically set when the service is loaded as the service name.setServiceType
in interface ServiceDef
thisServiceType
- the service type.public java.lang.String getServiceType()
getServiceType
in interface ServiceDef
public PasswordHandler getPasswordHandler(java.lang.String adminKey)
adminKey
- the admin key for the service.null
otherwise.protected PasswordHandler getPasswordHandler()