I am trying to interact with SAS server using Java Client. I am able to establish the connection using Java Connection Factory. Once the connection is established, I need to resuse the same session or IWorkspace object created for consecutive calls to SAS server and close the session whenever I need. The session must be active till I close the session.
Below is the code I use to establish the connection:
// identify the IOM server
String classID = Server.CLSID_SAS;
String host = "rnd.fyi.sas.com";
int port = 5310;
Server server = new BridgeServer(classID,host,port);
// make a connection factory configuration with the server
ConnectionFactoryConfiguration cxfConfig =
new ManualConnectionFactoryConfiguration(server);
// get a connection factory manager
ConnectionFactoryManager cxfManager = new ConnectionFactoryManager();
// get a connection factory that matches the configuration
ConnectionFactoryInterface cxf = cxfManager.getFactory(cxfConfig);
// get the administrator interface
ConnectionFactoryAdminInterface admin = cxf.getAdminInterface();
// get a connection
String userName = "abcserv";
String password = "abcpass";
ConnectionInterface cx = cxf.getConnection(userName,password);
org.omg.CORBA.Object obj = cx.getObject();
IWorkspace iWorkspace = IWorkspaceHelper.narrow(obj);
I need to somehow persist the IWorkspace object or some way to get the same IWorspace object and reuse the same object for all the consecutive calls. Please let me know, how this can be achived.
When I use WorkspaceConnector to create the IWorkspace Object, there is a way to get the Iworkspace object by using below code:
WorkspaceConnector connector = WorkspaceFactory.getWorkspaceConnectorByUUID(UniqueIdentifier);
IWorkspace iworkspace = connector.getWorkspace();
where UniqueIdentifier is the identifier for getting workspace created previously. Is there any similar way to get Iworkspace object when I use Java Connection Factory?
Thanks,
Abhilash