|
Java AFS API v1.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openafs.jafs.Process
An abstract representation of an AFS process. It holds information about
the server, such as what its state is.
Constructing an instance of a Process
does not mean an actual
AFS process is created on a server -- usually a Process
object is a representation of an already existing AFS process. If,
however, the Process
is constructed with the name of a
process that does not exist in the server represented by the provided
Server
, a new process with that name can be
created on that server by calling one of the createSimple(String)
,
createFS(String)
, or createCron(String,String)
methods. If
such a process does already exist when one of these methods are called,
an exception will be thrown.
The following is a simple example of how to construct and use a
Process
object. This example obtains the list of all
Process
objects on a particular server and prints out the
name of each one along with its start time.
import org.openafs.jafs.Cell; import org.openafs.jafs.AFSException; import org.openafs.jafs.Process; import org.openafs.jafs.Server; ... public class ... { ... private Cell cell; private Server server; ... public static void main(String[] args) throws Exception { String username = arg[0]; String password = arg[1]; String cellName = arg[2]; String serverName = arg[3]; token = new Token(username, password, cellName); cell = new Cell(token); server = new Server(serverName, cell); System.out.println("Processes in Server " + server.getName() + ":"); Process[] processes = server.getProcesss(); for (int i = 0; i < processes.length; i++) { System.out.print("Process " + processes[i].getName()); System.out.print("was started: " + processes[i].getStartTimeDate().getTime() + "\n"); } } ... }
Field Summary | |
static int |
CRON_PROCESS
A process that should be restarted at a specific time either daily or weekly. |
static int |
FS_PROCESS
Combination of File Server, Volume Server, and Salvager processes |
static int |
RUNNING
Process execution state running |
static int |
SIMPLE_PROCESS
Any standard type of process except for fs (such as kaserver, upclientbin, etc.) |
static int |
STARTING
Process execution state starting |
static int |
STOPPED
Process execution state stopped |
static int |
STOPPING
Process execution state stopping |
Constructor Summary | |
Process(String name,
Server server)
Constructs a new Process object instance given the name
of the AFS process and the AFS server, represented by
server , to which it belongs. |
|
Process(String name,
Server server,
boolean preloadAllMembers)
Constructs a new Process object instance given the name
of the AFS process and the AFS server, represented by
server , to which it belongs. |
Method Summary | |
int |
compareTo(Object obj)
Comparable interface method. |
int |
compareTo(Process process)
Compares two Process objects respective to their names and does not factor any other attribute. |
void |
createCron(String executionPath,
String cronTime)
Creates this process as a cron process on the server. |
void |
createFS(String executionPath)
Creates this process as a file server process on the server. |
void |
createSimple(String executionPath)
Creates this process as a simple process on the server. |
void |
delete()
Removes this process from the bos server |
boolean |
equals(Process otherProcess)
Tests whether two Process objects are equal, based on their
names and hosting server. |
long |
getErrorCode()
Returns the error code of the process. |
long |
getErrorSignal()
Returns the error signal of the process. |
long |
getExitErrorTime()
Returns the most recent time this process exited with an error. |
GregorianCalendar |
getExitErrorTimeDate()
Returns the most recent time this process exited with an error. |
long |
getExitTime()
Returns the most recent exit time of this process. |
GregorianCalendar |
getExitTimeDate()
Returns the most recent exit time of this process. |
int |
getGoal()
Returns the process goal. |
String |
getName()
Returns the name of this process. |
long |
getNumberOfStarts()
Returns the number of starts of the process. |
Server |
getServer()
Returns the server hosting this process. |
long |
getStartTime()
Returns the most recent start time of this process. |
GregorianCalendar |
getStartTimeDate()
Returns the most recent start time of this process. |
int |
getState()
Returns the process execution state. |
boolean |
getStateBadFileAccess()
Returns whether or not the state of the process indicates bad file access. |
boolean |
getStateOk()
Returns whether or not the state of the process is ok. |
boolean |
getStateTooManyErrors()
Returns whether or not the state of the process indicates too many errors. |
int |
getType()
Returns the process type. |
void |
refresh()
Refreshes the properties of this Process object instance with values from the AFS process it represents. |
void |
restart()
Restarts this process |
void |
start()
Starts this process |
void |
stop()
Stops this process. |
String |
toString()
Returns the name of this Process |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int SIMPLE_PROCESS
public static final int FS_PROCESS
public static final int CRON_PROCESS
public static final int STOPPED
public static final int RUNNING
public static final int STOPPING
public static final int STARTING
Constructor Detail |
public Process(String name, Server server) throws AFSException
Process
object instance given the name
of the AFS process and the AFS server, represented by
server
, to which it belongs. This does not actually
create a new AFS process, it just represents one.
If name
is not an actual AFS process, exceptions
will be thrown during subsequent method invocations on this
object, unless one of the createSimple(String)
,
createFS(String)
, or createCron(String,String)
methods are explicitly called to create it.
name
- the name of the server to representserver
- the server on which the process resides
AFSException
- If an error occurs in the native codepublic Process(String name, Server server, boolean preloadAllMembers) throws AFSException
Process
object instance given the name
of the AFS process and the AFS server, represented by
server
, to which it belongs. This does not actually
create a new AFS process, it just represents one.
If name
is not an actual AFS process, exceptions
will be thrown during subsequent method invocations on this
object, unless one of the createSimple(String)
,
createFS(String)
, or createCron(String,String)
methods are explicitly called to create it. Note that if he process
doesn't exist and preloadAllMembers
is true, an exception
will be thrown.
This constructor is ideal for point-in-time representation and
transient applications. It ensures all data member values are set and
available without calling back to the filesystem at the first request
for them. Use the refresh()
method to address any coherency
concerns.
name
- the name of the process to representserver
- the server to which the process belongs.preloadAllMembers
- true will ensure all object members are
set upon construction; otherwise members will
be set upon access, which is the default
behavior.
AFSException
- If an error occurs in the native coderefresh()
Method Detail |
public void refresh() throws AFSException
Since in most environments administrative changes can be administered from an AFS command-line program or an alternate GUI application, this method provides a means to refresh the Java object representation and thereby ascertain any possible modifications that may have been made from such alternate administrative programs. Using this method before an associated instance accessor will ensure the highest level of representative accuracy, accommodating changes made external to the Java application space. If administrative changes to the underlying AFS system are only allowed via this API, then the use of this method is unnecessary.
AFSException
- If an error occurs in the native codepublic void createSimple(String executionPath) throws AFSException
executionPath
- the path to the process's executable
AFSException
- If an error occurs in the native codepublic void createFS(String executionPath) throws AFSException
executionPath
- the path to the process's executable
AFSException
- If an error occurs in the native codepublic void createCron(String executionPath, String cronTime) throws AFSException
executionPath
- the path to the process's executablecronTime
- a String representing the time a cron process is
to be run. Acceptable formats are:AFSException
- If an error occurs in the native codepublic void delete() throws AFSException
AFSException
- If an error occurs in the native codepublic void stop() throws AFSException
AFSException
- If an error occurs in the native codepublic void start() throws AFSException
AFSException
- If an error occurs in the native codepublic void restart() throws AFSException
AFSException
- If an error occurs in the native codepublic String getName()
public Server getServer()
public int getType() throws AFSException
AFSException
- If an error occurs in the native codepublic int getGoal() throws AFSException
refresh()
method is called and a more current
value is obtained.
AFSException
- If an error occurs in the native codepublic int getState() throws AFSException
refresh()
method is called and a more current
value is obtained.
AFSException
- If an error occurs in the native codepublic long getStartTime() throws AFSException
null
value
indicates no start time.
After this method is called once, it saves the value
and returns that value on subsequent calls,
until the refresh()
method is called and a more current
value is obtained.
AFSException
- If an error occurs in the native codepublic GregorianCalendar getStartTimeDate() throws AFSException
null
value indicates no start time.
After this method is called once, it saves the value
and returns that value on subsequent calls,
until the refresh()
method is called and a more current
value is obtained.
AFSException
- If an error occurs in the native codepublic long getNumberOfStarts() throws AFSException
refresh()
method is called and a more current
value is obtained.
AFSException
- If an error occurs in the native codepublic long getExitTime() throws AFSException
null
value indicates no exit time.
After this method is called once, it saves the value
and returns that value on subsequent calls,
until the refresh()
method is called and a more current
value is obtained.
AFSException
- If an error occurs in the native codepublic GregorianCalendar getExitTimeDate() throws AFSException
null
value indicates no exit time
After this method is called once, it saves the value
and returns that value on subsequent calls,
until the refresh()
method is called and a more current
value is obtained.
AFSException
- If an error occurs in the native codepublic long getExitErrorTime() throws AFSException
null
value indicates no exit w/ error time.
After this method is called once, it saves the value
and returns that value on subsequent calls,
until the refresh()
method is called and a more current
value is obtained.
AFSException
- If an error occurs in the native codepublic GregorianCalendar getExitErrorTimeDate() throws AFSException
refresh()
method is called and a more current
value is obtained.
AFSException
- If an error occurs in the native codepublic long getErrorCode() throws AFSException
refresh()
method is called and a more current
value is obtained.
AFSException
- If an error occurs in the native codepublic long getErrorSignal() throws AFSException
refresh()
method is called and a more current
value is obtained.
AFSException
- If an error occurs in the native codepublic boolean getStateOk() throws AFSException
false
indicates there has been a core dump.
After this method is called once, it saves the value
and returns that value on subsequent calls,
until the refresh()
method is called and a more current
value is obtained.
AFSException
- If an error occurs in the native codepublic boolean getStateTooManyErrors() throws AFSException
refresh()
method is called and a more current
value is obtained.
AFSException
- If an error occurs in the native codepublic boolean getStateBadFileAccess() throws AFSException
refresh()
method is called and a more current
value is obtained.
AFSException
- If an error occurs in the native codepublic int compareTo(Process process)
process
- The Process object to be compared to this Process
instance
public int compareTo(Object obj)
compareTo
in interface Comparable
compareTo(Process)
public boolean equals(Process otherProcess)
Process
objects are equal, based on their
names and hosting server.
otherProcess
- the Process to test
public String toString()
Process
toString
in class Object
Process
|
Java AFS API (jafs) for OpenAFS | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |