|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jason.core.ServiceContext
Created Wed Mar 27 11:33:57 2002
Service context. This class is used by both
the ServiceContainer
and the Service classes.
ServiceContainer
,
Service
Constructor Summary | |
ServiceContext(ServiceContainer sc)
|
Method Summary | |
void |
addServiceContextListener(ServiceContextListener listener)
Add a listener for the context state |
void |
cleanWorkingDirectory(boolean depth)
Clean the working directory content. |
ServiceResponse |
fireRequestForType(ServiceType type,
ServiceRequest request)
Get all service for the type and return the response of the first one that can answer to the response. |
ServiceResponse |
fireRequestForType(ServiceType type,
ServiceRequest request,
int criteria)
Get all service for the type and return the response of the first one that can answer to the response. |
Cache |
getCache()
|
Domain |
getDomain()
|
MessageHandler |
getMessageHandler()
|
java.lang.String |
getName()
|
java.util.Enumeration |
getPropertiesName()
|
java.lang.Object |
getProperty(java.lang.String name)
|
ServiceContainer |
getServiceContainer()
|
Service[] |
getServiceForType(ServiceType type)
This method will return any service matching the good type even bad service |
Service[] |
getServiceForType(ServiceType type,
int criteria)
This method will return an array of service matching the good type sorting it with the criteria. |
Service[] |
getServices()
|
ThreadCapsule |
getThreadCapsule()
|
java.io.File |
getWorkingDirectory()
|
java.io.File |
getWorkingDirectoryFile(java.lang.String f)
|
java.io.FileInputStream |
getWorkingDirectoryFileInputStream(java.lang.String f)
|
java.io.FileOutputStream |
getWorkingDirectoryFileOutputStream(java.lang.String f)
|
java.io.FileReader |
getWorkingDirectoryFileReader(java.lang.String f)
|
java.io.FileWriter |
getWorkingDirectoryFileWriter(java.lang.String f)
|
boolean |
isEnabledCacheForRequestDispatch()
|
boolean |
isProcessable()
Check if the service can be handled in a new process |
boolean |
isTest()
Check if a starting test is enabled |
boolean |
isThreadable()
Check if the service can be handled in a new thread |
boolean |
isVerbose()
Check if verbose is enabled |
void |
notifyCriticalError(java.lang.Exception exc)
This method must be called for critical error |
void |
notifyInit()
Notify the service context that the Service is initialized |
void |
notifyRun()
Notify the service context that the Service is runned. |
void |
notifyStart()
Notify the service context that the Service is started |
void |
notifyStartTask()
Notify the service context that a Sub task is starting for a service |
void |
notifyStop()
Notify the service context that the Service is stopped |
void |
notifyStopTask()
Notify the service context that a Sub task is stopping for a service |
void |
notifyTask()
Notify the service context that the Service has managed a Task It should be called when a work is managed by the Service, this is used for benchmark |
void |
removeServiceContextListener(ServiceContextListener listener)
Remove a listener for the contexte state |
void |
sendCustomMessage(java.lang.String service,
int type,
java.lang.String content)
|
void |
sendErrorMessage(java.lang.String service,
java.lang.String content)
|
void |
sendInformationMessage(java.lang.String service,
java.lang.String content)
|
void |
sendInnerError(java.lang.Exception exc)
Support for inner class exception |
void |
sendWarningMessage(java.lang.String service,
java.lang.String content)
|
void |
setEnabledCacheForRequestDispatch(boolean ok)
Enable/Disable the inner cache for dispatching a request |
void |
setProperty(java.lang.String name,
java.lang.Object value)
Update a service property. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ServiceContext(ServiceContainer sc)
Method Detail |
public void addServiceContextListener(ServiceContextListener listener)
public void removeServiceContextListener(ServiceContextListener listener)
public java.io.File getWorkingDirectory()
public java.io.File getWorkingDirectoryFile(java.lang.String f)
public java.io.FileInputStream getWorkingDirectoryFileInputStream(java.lang.String f) throws java.io.IOException
java.io.IOException
public java.io.FileOutputStream getWorkingDirectoryFileOutputStream(java.lang.String f) throws java.io.IOException
java.io.IOException
public java.io.FileReader getWorkingDirectoryFileReader(java.lang.String f) throws java.io.IOException
java.io.IOException
public java.io.FileWriter getWorkingDirectoryFileWriter(java.lang.String f) throws java.io.IOException
java.io.IOException
public void cleanWorkingDirectory(boolean depth)
depth
- true
to clean all the directory content with all sub-directory, else
it cleans only the conctent at the first levelpublic boolean isVerbose()
public boolean isTest()
public boolean isThreadable()
public boolean isProcessable()
public ServiceContainer getServiceContainer()
public MessageHandler getMessageHandler()
public java.lang.String getName()
public Service[] getServices()
public Service[] getServiceForType(ServiceType type)
public Service[] getServiceForType(ServiceType type, int criteria)
SERVICE_NO_SKILL_CRITERIA
, SERVICE_HOST_SKILL_CRITERIA
, SERVICE_REQUEST_SKILL_CRITERIA
from the ServicesManager class.
public ServiceResponse fireRequestForType(ServiceType type, ServiceRequest request) throws ServiceException
type
- A Service typerequest
- a Service request
ServiceException
- for invalid service requestpublic void setEnabledCacheForRequestDispatch(boolean ok)
public boolean isEnabledCacheForRequestDispatch()
public ServiceResponse fireRequestForType(ServiceType type, ServiceRequest request, int criteria) throws ServiceException
SERVICE_NO_SKILL_CRITERIA
, SERVICE_HOST_SKILL_CRITERIA
, SERVICE_REQUEST_SKILL_CRITERIA
from the
ServicesManager class.
type
- A Service typerequest
- a Service requestcriteria
- SERVICE_NO_SKILL_CRITERIA, SERVICE_HOST_SKILL_CRITERIA, SERVICE_REQUEST_SKILL_CRITERIA
ServiceException
- for invalid service requestpublic java.util.Enumeration getPropertiesName()
public java.lang.Object getProperty(java.lang.String name)
public void setProperty(java.lang.String name, java.lang.Object value) throws ServiceException
ServiceException
public Domain getDomain()
public ThreadCapsule getThreadCapsule()
public Cache getCache()
BasicCacheImpl
public void sendErrorMessage(java.lang.String service, java.lang.String content)
public void sendInnerError(java.lang.Exception exc)
public void sendWarningMessage(java.lang.String service, java.lang.String content)
public void sendInformationMessage(java.lang.String service, java.lang.String content)
public void sendCustomMessage(java.lang.String service, int type, java.lang.String content)
public void notifyInit()
notifyInit
in interface ServiceContextListener
public void notifyStart()
notifyStart
in interface ServiceContextListener
public void notifyStop()
notifyStop
in interface ServiceContextListener
public void notifyRun()
public void notifyTask()
public void notifyStartTask()
public void notifyStopTask()
public void notifyCriticalError(java.lang.Exception exc)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |