public class ServiceWrapperLegacy extends Service implements ServiceWrapperDef
legacy
object and a ServiceWrapper
stores a licas Service
object.
The autonomic manager is also an extension of ServiceWrapper
class.
This means that any object can actually be loaded and stored as a service. The wrapper
class extends either a FrameworkModule
or a full Service
, depending on
what additional functionality is required. This would mean that any object can be
used as part of the licas system and the object methods can be found and invoked.Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
legacyObj
The legacy object
|
protected Metrics |
metrics
Measurements of general message/transaction numbers
|
protected boolean |
setStructures
True if structures for enclosed service object already set
|
canAccessMeta, canAccessNested, dm, finalised, isRemoteCall, messageStore, serviceAdmin, serviceGrade, serviceInitialise, serviceLinks, serviceState, sm, toLoadScript
shutDown
passwordHandler, service, serviceType
jarFile, syncOn, uuid
Constructor and Description |
---|
ServiceWrapperLegacy(java.lang.Object theObj)
Creates a new instance of ServiceWrapperLegacy.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addCommunicationID(java.lang.String communicationID,
java.lang.Object clientUri)
Store the communicationID with the related client uri.
|
void |
addMetrics(MethodInfo messageObj,
java.lang.String theAdminKey)
Add some metrics values relating to the current message.
|
protected java.lang.String |
addTempPassword(boolean addPassword)
Add a new temporary password to the temp passwords list.
|
boolean |
canAccess(java.lang.String thePassword)
Return true if the wrapped object can be accessed by the password.
|
boolean |
canAccess(java.lang.String thePassword,
java.lang.reflect.Method theMethod)
Return true if the method on the wrapped object can be accessed by the password.
|
boolean |
canAccess(java.lang.String thePassword,
java.lang.String methodName)
Return true if the method on the wrapped object can be accessed by the password.
|
void |
copyFromService()
Reset the wrapper settings based on the wrapped object if a service.
|
void |
copyToService(java.lang.Object parent)
Copy and set certain settings between the service object and the wrapper.
|
ServiceMeta |
createMetaForRepos(java.lang.String theAdminKey)
Create a metadata description of this service for the server repository.
|
java.lang.Object |
execute(MethodInfo methodInfo,
boolean addTempPassword)
Execute the specified method and return the result.
|
Metrics |
getMetrics()
Get the default message/transaction metrics.
|
java.lang.Class |
getObjClass()
Get the class type of the stored object.
|
java.lang.Object |
getObjService(java.lang.String adminKey)
Get the stored object service.
|
java.lang.String |
getPassword(java.lang.String theAdminKey)
Get the password for this service.
|
java.lang.String |
getPassword(java.lang.String clientID,
Contract clientContract)
Get this service's password, depending on the calling component's contract description.
|
java.lang.String |
getPassword(java.lang.String serviceUuid,
java.lang.String theAdminKey)
Get the password for the specified service.
|
ServiceWrapperDef |
getService(java.lang.String serviceName,
java.lang.String thePassword)
Return the service for the related service name.
|
java.lang.Object |
getService(java.lang.String serviceName,
java.lang.String thePassword,
java.lang.String adminKey)
Return the service for the related service name.
|
WorkInfo |
getWorkInfo()
Get the work protocol details for the service.
|
boolean |
interrupt(java.lang.String adminKey)
You must call this method to interrupt the thread.
|
java.lang.Object |
invokeObj(java.lang.reflect.Method theMethod,
java.lang.Object[] params)
Invoke the method on the stored object with the specified parameters.
|
protected void |
removeTempPassword(java.lang.String tempPassword)
Remove the temporary password from the list if it exists.
|
void |
run()
This run method tries to start the run method on the embedded object.
|
void |
setObjService(java.lang.Object theObj)
Set the wrapped object that is typically derived from
Service ,
but can be a legacy object of any type. |
boolean |
storesLegacy()
Return true if the stored object is legacy code, false if a licas service.
|
java.lang.String |
threadAliveState()
Return the thread state of the embedded object.
|
addDefaultService, addDefaultService, addDefaultService, addDefaultService, addLinkFromService, addLinkToService, addMessageMetrics, addService, addService, addService, addService, addServiceAssociation, addServicePassword, allowAddService, canAccess, canAccess, canAccessMeta, canAccessNested, canAccessTemp, canRun, classNameOK, clearServiceLinks, clearServices, clearServices, close, createMetaFull, createPermanentLinkTo, createServiceWrapper, defaultAdminToRemove, dynamicLinkQuery, dynamicLinksToPermanent, dynamicLinksToXml, dynamicLinksToXml, finaliseInitialisation, finaliseInitialisation, finaliseModule, finaliseThisConfig, GET, getAllLinkToService, getAllowAddService, getAutonomicManagerConfig, getCommunicationClientURI, getData, getData, getDescription, getFullPath, getInstanceValue, getIsRemoteCall, getLinkFromService, getLinkToService, getLocalRemoteID, getParent, getParent, getPasswordHandler, getPrivateMethods, getPublicMethods, getPublicServiceClassname, getServerPassword, getServiceAdmin, getServiceClasses, getServiceGrade, getServiceLinks, getServiceNames, getServiceNames, getServiceNames, getServiceNumber, getServiceOrWrapper, getServiceState, getServiceType, getServiceTypes, handshake, hasCommunicationID, hasLinkTo, hasServerPassword, hasService, hasServiceType, isCorrectPassword, isPrivateMethod, isPublicMethod, isStarted, linksToXml, passwordsStateToXml, permanentLinksToXml, reflectionMethods, reflectionObject, removeAllLinksTo, removeAllServices, removeAllServices, removeCommunicationID, removeLinkFromService, removeLinkToService, removePermanentLinkTo, removeServiceAssociation, removeServiceID, removeServicePath, removeServicePath, serviceNegotiate, serviceToXml, serviceToXml, setAdminInfo, setCanAccessMeta, setCanAccessNested, setData, setDataModule, setDataModule, setDescription, setInstanceValues, setIsRemoteCall, setOtherMeta, setParent, setParent, setSerializeValues, setServerPassword, setServiceGrade, setServiceModule, setServiceState, startAllThreads, startThread, stopAllThreads, syncToAsync, syncToAsyncReply, syncToAsyncTransit, xmlToDynamicLinks, xmlToService
getShutDown, setShutDown, setShutDown
getPasswordHandler, getServicePassword, getServiceType, isAdminKey, setServiceDetails, setServiceType
getJarFile, getUUID, loadObject, setJarFile, setUUID
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, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDescription, getFullPath, getServiceGrade, reflectionMethods
canAccessTemp, getServiceType, getUUID, isAdminKey, setJarFile, setServiceType, setUUID
protected boolean setStructures
protected Metrics metrics
protected java.lang.Object legacyObj
public ServiceWrapperLegacy(java.lang.Object theObj) throws java.lang.Exception
theObj
- the object to wrap.java.lang.Exception
- any error.public boolean storesLegacy()
storesLegacy
in interface ServiceWrapperDef
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public boolean interrupt(java.lang.String adminKey)
public final void copyToService(java.lang.Object parent) throws java.lang.Exception
copyToService
in interface ServiceWrapperDef
parent
- the parent of the wrapper.java.lang.Exception
- any error.public final void copyFromService()
copyFromService
in interface ServiceWrapperDef
public void addMetrics(MethodInfo messageObj, java.lang.String theAdminKey)
addMetrics
in interface ServiceWrapperDef
messageObj
- the message object.theAdminKey
- the admin key for the parent service.public Metrics getMetrics()
getMetrics
in interface ServiceWrapperDef
public ServiceMeta createMetaForRepos(java.lang.String theAdminKey) throws java.lang.Exception
createMetaForRepos
in class Service
theAdminKey
- the unique service key for admin purposes.java.lang.Exception
- any error.public boolean addCommunicationID(java.lang.String communicationID, java.lang.Object clientUri) throws java.lang.Exception
addCommunicationID
in class Service
communicationID
- the communication id.clientUri
- the uri/reference for the calling client.java.lang.Exception
- any error.protected java.lang.String addTempPassword(boolean addPassword) throws java.lang.Exception
addTempPassword
in class Service
addPassword
- true if add a password.java.lang.Exception
- any error.protected void removeTempPassword(java.lang.String tempPassword)
removeTempPassword
in class Service
tempPassword
- the temporary password.public boolean canAccess(java.lang.String thePassword)
Service
then its canAccess
method is called,
otherwise true is automatically returned.canAccess
in interface ServiceDef
canAccess
in class FrameworkModule
thePassword
- the password to use.public boolean canAccess(java.lang.String thePassword, java.lang.String methodName) throws java.lang.Exception
Service
then its canAccess
method is called,
otherwise true is automatically returned.public boolean canAccess(java.lang.String thePassword, java.lang.reflect.Method theMethod) throws java.lang.Exception
Service
then its canAccess
method is called,
otherwise true is automatically returned.public java.lang.String getPassword(java.lang.String clientID, Contract clientContract) throws java.lang.Exception
getPassword
in class Service
clientID
- the clientID of the calling component.clientContract
- the description of the calling component's contract proposal.java.lang.Exception
- any error.public java.lang.String getPassword(java.lang.String theAdminKey)
getPassword
in class Service
theAdminKey
- the service key.public java.lang.String getPassword(java.lang.String serviceUuid, java.lang.String theAdminKey) throws java.lang.Exception
getPassword
in class Service
serviceUuid
- the id of the service to ask the password for.theAdminKey
- the service key.java.lang.Exception
- any error.public WorkInfo getWorkInfo()
serviceAdmin
is used.getWorkInfo
in interface ServiceWrapperDef
workInfo
details.public ServiceWrapperDef getService(java.lang.String serviceName, java.lang.String thePassword) throws ServiceException, java.lang.Exception
getService
in class Service
serviceName
- the name of the service.thePassword
- the password to access the service to retrieve.ServiceException
- is access to any nested services is blocked.java.lang.Exception
- any other error.public java.lang.Object getService(java.lang.String serviceName, java.lang.String thePassword, java.lang.String adminKey) throws ServiceException, java.lang.Exception
getService
in class Service
serviceName
- the name of the service.thePassword
- the password to access the service.adminKey
- the service key for this server.ServiceException
- for service specific error.java.lang.Exception
- any other error.public void setObjService(java.lang.Object theObj)
Service
,
but can be a legacy object of any type.setObjService
in interface ServiceWrapperDef
theObj
- the value of obj.public java.lang.Object getObjService(java.lang.String adminKey)
getObjService
in interface ServiceWrapperDef
adminKey
- the admin key for the object or wrapper.public java.lang.Class getObjClass()
getObjClass
in interface ServiceWrapperDef
public java.lang.Object execute(MethodInfo methodInfo, boolean addTempPassword) throws ServiceException, java.lang.Exception
execute
in class Service
methodInfo
- the method call description with all of the required information.addTempPassword
- if true add a temporary password to allow traversal
through this service. If the service is referenced directly as an object
then set this to false so that the caller must know this service's password.ServiceException
- any service specific error.java.lang.Exception
- any other error.public java.lang.Object invokeObj(java.lang.reflect.Method theMethod, java.lang.Object[] params) throws java.lang.Exception
invokeObj
in interface ServiceWrapperDef
theMethod
- the method to invoke.params
- the parameter list.java.lang.Exception
- any error.public java.lang.String threadAliveState()
threadAliveState
in class LicasModule