|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.SoftWoehr.JTOpenContrib.connectionmgr.Mgr
Simple manager for multiple shared AS400 connections. Clients of class
ServiceClient make a request for a server and service. The server is
an AS400. The service is one of the services AS400.FILE etc. A service
record is returned, which is resubmitted by the client to relinquish
the service. The AS400 connection is a public data member of that
service record. The Mgr instance can also indicate to the ServiceClient
that its connection is about to become invalid by calling the client's
interface function ServiceClient.relinquish()
The URL for the service request is of the form:
mgr:serverName/SERVICEe.g., mgr:ANAS400/FILE A Mgr maintains one com.ibm.as400.access.AS400 object for each server. If you wish to have multiple instances of server objects, instance multiple Mgr's.
Inner Class Summary | |
class |
Mgr.InvalidServiceRecordException
Thrown if an invalid service record is returned by a client to the call freeService() . |
class |
Mgr.Locator
Class used to parse the requests made for service. |
class |
Mgr.UnknownProtocolException
This exception is thrown if the "url" submitted for a service request is unrecognized. |
class |
Mgr.UnknownServiceException
This is thrown if a request is made for an unknown or unsupported service. |
Constructor Summary | |
Mgr()
Creates new Mgr |
Method Summary | |
ServiceRecord |
createServiceRecord(java.lang.String serverName,
int service,
com.ibm.as400.access.AS400 as400,
ServiceClient client)
Create a new service record |
void |
freeService(ServiceRecord sr)
A ServiceClient uses this function to inform the Mgr that the service which was obtained is no longer needed by the client. |
com.ibm.as400.access.AS400 |
getServer(java.lang.String serverName,
java.lang.String hashName)
Find a server if we have already created it. |
ServiceRecord |
getService(java.lang.String representation,
ServiceClient client)
This function accepts a URL-like request from a ServiceClient for a
com.ibm.as400.access.AS400 service on a server. |
java.lang.String |
intToServiceName(int service)
Return a string representing an AS400 service from its integer value. |
static void |
main(java.lang.String[] argv)
Test Mgr. |
java.lang.String |
serversToString()
Return a string listing the servers active |
java.lang.String |
serviceRecordsToString()
Return a string illustrating all current service records. |
java.lang.String |
toProtocol(java.lang.String representation)
Extract protocol portion of the representation of a service request. |
java.lang.String |
toServerName(java.lang.String representation)
Extract server portion of the representation of a service request. |
int |
toService(java.lang.String representation)
Extract service portion of the representation of a service request and convert it to an AS400 service number. |
java.lang.String |
toServiceName(java.lang.String representation)
Extract service portion of the representation of a service request. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Mgr()
Method Detail |
public com.ibm.as400.access.AS400 getServer(java.lang.String serverName, java.lang.String hashName)
public ServiceRecord createServiceRecord(java.lang.String serverName, int service, com.ibm.as400.access.AS400 as400, ServiceClient client) throws Mgr.UnknownServiceException
public ServiceRecord getService(java.lang.String representation, ServiceClient client) throws Mgr.UnknownServiceException, Mgr.UnknownProtocolException
ServiceClient
for a
com.ibm.as400.access.AS400 service on a server. A service record is
returned which contains the reference to the server. The service record
is passed back to Mgr when the ServiceClient is done with the service.representation
- A string of the form mgr:server/service
where server is the name of the desired server and
service is one of the service names for the AS400
object, e.g., FILE PRINT etc.client
- The client must implement the interface ServiceClient
.freeServ
ice when the client is done with the serviceMgr.UnknownServiceException
- If the name of the service is not recoqnized.Mgr.UnknownProtocolException
- If the "protocol" portion of the URL is not mgr
.public void freeService(ServiceRecord sr) throws Mgr.InvalidServiceRecordException
sr
- The ServiceRecord obtained by a call to Mgr.getService()
Mgr.InvalidServiceRecordException
- If the service record isn't valid.public java.lang.String toProtocol(java.lang.String representation)
representation
- public java.lang.String toServerName(java.lang.String representation) throws Mgr.UnknownProtocolException
representation
- Mgr.UnknownProtocolException
- public java.lang.String toServiceName(java.lang.String representation) throws Mgr.UnknownProtocolException
representation
- Mgr.UnknownProtocolException
- public int toService(java.lang.String representation) throws Mgr.UnknownProtocolException
representation
- Mgr.UnknownProtocolException
- public java.lang.String intToServiceName(int service)
service
- Integer representing an AS400 service constant.public java.lang.String serviceRecordsToString()
server,service\n
... repeated
for as many service records as exist.public java.lang.String serversToString()
public static void main(java.lang.String[] argv)
argv
- Not used.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |