|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.rmi.server.RemoteObject java.rmi.server.RemoteServer java.rmi.server.UnicastRemoteObject charly.server.resources.ChRsrcManagerImpl
Objects of this class manage the ressources available on a server.
The devices call assertAccess(String,String)
.
This manager does not check whether the resources
are really available! It only checks whether they are reserved for other
tasks or not.
Nested Class Summary | |
(package private) static class |
ChRsrcManagerImpl.ChClientTaskInfo
|
Field Summary | |
(package private) ChServerImpl |
server
|
(package private) int |
taskCounter
|
(package private) java.util.HashMap |
tasks
maps elems of type String (taskID) to elems of type ChClientTaskInfo |
(package private) java.util.HashMap |
tasksBook
maps elems of type ChClientTask to
elems of type String (taskID) |
Fields inherited from class java.rmi.server.UnicastRemoteObject |
|
Fields inherited from class java.rmi.server.RemoteServer |
|
Fields inherited from class java.rmi.server.RemoteObject |
ref |
Fields inherited from interface charly.server.resources.ChRsrcManager |
DELIMITERCHAR |
Constructor Summary | |
ChRsrcManagerImpl(ChServerImpl server)
|
Method Summary | |
void |
abortTask(java.lang.String taskID)
abnormal abort of a running task. this method is usually called by ChMonitor.abortTask(String) . |
void |
assertAccess(java.lang.String taskID,
java.lang.String rsrcName)
tests if task with taskID has access to ressource called rsrcName. |
protected void |
checkNextTaskAcceptance()
checks if one or more tasks can be accepted and accepts them. |
protected boolean |
checkTaskAcceptance(java.lang.String taskID)
checks if taskID can be accepted and accepts in case of success. |
protected java.lang.String |
createTaskID(java.lang.String taskName)
produces a String based on taskName and a counter. |
java.util.Set |
getTasks()
returns all known tasks. |
boolean |
isTaskStarted(java.lang.String taskID)
returns true if the given task has been started and not yet stopped or aborted. |
java.lang.String |
startTask(ChClientTask task,
java.lang.String taskName,
java.util.Set rsrcs)
sets task in state starting or if possible starts it already. |
void |
stopTask(ChClientTask task)
normal finish of a task. |
void |
stopTask(java.lang.String taskID)
normal finish of a task. |
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 |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
java.util.HashMap tasks
ChRsrcManagerImpl.ChClientTaskInfo
java.util.HashMap tasksBook
ChClientTask
to
elems of type String (taskID)
int taskCounter
createTaskID(String)
ChServerImpl server
Constructor Detail |
public ChRsrcManagerImpl(ChServerImpl server) throws java.rmi.RemoteException
Method Detail |
protected java.lang.String createTaskID(java.lang.String taskName)
taskCounter
public java.lang.String startTask(ChClientTask task, java.lang.String taskName, java.util.Set rsrcs) throws ChAlreadyStartingException, ChAlreadyStartedException
startTask
in interface ChRsrcManager
task
- the client-side task. Its taskStarted()-method is called.taskName
- the name of the task. The taskID is created on the base
of this name.rsrcs
- this is a Set
of String
describing each a resource on the server, e.g. "GPIB/7".
ChAlreadyStartingException
ChAlreadyStartedException
public void stopTask(ChClientTask task) throws ChTaskNotRunningException, java.rmi.RemoteException
ChTask.stop()
stopTask
in interface ChRsrcManager
ChTaskNotRunningException
java.rmi.RemoteException
stopTask(String)
public void stopTask(java.lang.String taskID) throws ChTaskNotRunningException, java.rmi.RemoteException
ChTask.stop()
stopTask
in interface ChRsrcManager
ChTaskNotRunningException
java.rmi.RemoteException
stopTask(ChClientTask)
,
abortTask(String taskID)
public void abortTask(java.lang.String taskID)
ChMonitor.abortTask(String)
.
abortTask
in interface ChRsrcManager
public java.util.Set getTasks()
getTasks
in interface ChRsrcManager
Set
of ChTaskInfo
protected boolean checkTaskAcceptance(java.lang.String taskID)
checkNextTaskAcceptance()
protected void checkNextTaskAcceptance()
checkTaskAcceptance(String)
public void assertAccess(java.lang.String taskID, java.lang.String rsrcName) throws ChTaskNotStartedException, ChAccessDeniedException
ChTaskNotStartedException
ChAccessDeniedException
public boolean isTaskStarted(java.lang.String taskID)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |