Search in sources :

Example 1 with VCellConnectionFactory

use of cbit.vcell.server.VCellConnectionFactory in project vcell by virtualcell.

the class ClientServerManager method connectToServer.

/**
 * Insert the method's description here.
 * Creation date: (5/12/2004 4:48:13 PM)
 */
private VCellConnection connectToServer(InteractiveContext requester) {
    VCellThreadChecker.checkRemoteInvocation();
    VCellConnection newVCellConnection = null;
    VCellConnectionFactory vcConnFactory = null;
    String badConnStr = "";
    try {
        switch(getClientServerInfo().getServerType()) {
            case SERVER_REMOTE:
                {
                    String apihost = getClientServerInfo().getApihost();
                    Integer apiport = getClientServerInfo().getApiport();
                    try {
                        badConnStr += apihost + ":" + apiport;
                        vcConnFactory = new RemoteProxyVCellConnectionFactory(apihost, apiport, getClientServerInfo().getUserLoginInfo());
                        setConnectionStatus(new ClientConnectionStatus(getClientServerInfo().getUsername(), apihost, apiport, ConnectionStatus.INITIALIZING));
                        newVCellConnection = vcConnFactory.createVCellConnection();
                    } catch (AuthenticationException ex) {
                        throw ex;
                    }
                    break;
                }
            case SERVER_LOCAL:
                {
                    new PropertyLoader();
                    LocalVCellConnectionService localVCellConnectionService = VCellServiceHelper.getInstance().loadService(LocalVCellConnectionService.class);
                    vcConnFactory = localVCellConnectionService.getLocalVCellConnectionFactory(getClientServerInfo().getUserLoginInfo());
                    setConnectionStatus(new ClientConnectionStatus(getClientServerInfo().getUsername(), null, null, ConnectionStatus.INITIALIZING));
                    newVCellConnection = vcConnFactory.createVCellConnection();
                    break;
                }
        }
        requester.clearConnectWarning();
        reconnectStat = ReconnectStatus.NOT;
    } catch (AuthenticationException aexc) {
        aexc.printStackTrace(System.out);
        requester.showErrorDialog(aexc.getMessage());
    } catch (ConnectionException cexc) {
        String msg = badConnectMessage(badConnStr) + "\n" + cexc.getMessage();
        cexc.printStackTrace(System.out);
        ErrorUtils.sendRemoteLogMessage(getClientServerInfo().getUserLoginInfo(), msg);
        if (reconnectStat != ReconnectStatus.SUBSEQUENT) {
            requester.showConnectWarning(msg);
        }
    } catch (Exception exc) {
        exc.printStackTrace(System.out);
        String msg = badConnectMessage(badConnStr) + "\nException:\n" + exc.getMessage();
        ErrorUtils.sendRemoteLogMessage(getClientServerInfo().getUserLoginInfo(), msg);
        requester.showErrorDialog(msg);
    }
    return newVCellConnection;
}
Also used : VCellConnection(cbit.vcell.server.VCellConnection) RemoteProxyVCellConnectionFactory(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory) AuthenticationException(org.vcell.util.AuthenticationException) LocalVCellConnectionService(cbit.vcell.server.LocalVCellConnectionService) PropertyLoader(cbit.vcell.resource.PropertyLoader) VCellConnectionFactory(cbit.vcell.server.VCellConnectionFactory) RemoteProxyVCellConnectionFactory(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory) ConnectionException(cbit.vcell.server.ConnectionException) ConnectionException(cbit.vcell.server.ConnectionException) AuthenticationException(org.vcell.util.AuthenticationException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException) IOException(java.io.IOException) DataAccessException(org.vcell.util.DataAccessException)

Example 2 with VCellConnectionFactory

use of cbit.vcell.server.VCellConnectionFactory in project vcell by virtualcell.

the class ClientFactory method createRemoteVCellConnectionFactory.

public static VCellConnectionFactory createRemoteVCellConnectionFactory(String host, int port, String userid, String password) throws Exception {
    DigestedPassword digestedPassword = new DigestedPassword(password);
    org.vcell.util.document.UserLoginInfo userLoginInfo = new org.vcell.util.document.UserLoginInfo(userid, digestedPassword);
    VCellConnectionFactory vcConnFactory = new RemoteProxyVCellConnectionFactory(host, port, userLoginInfo);
    return vcConnFactory;
}
Also used : UserLoginInfo(org.vcell.util.document.UserLoginInfo) RemoteProxyVCellConnectionFactory(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory) DigestedPassword(org.vcell.util.document.UserLoginInfo.DigestedPassword) UserLoginInfo(org.vcell.util.document.UserLoginInfo) LocalVCellConnectionFactory(cbit.vcell.message.server.bootstrap.LocalVCellConnectionFactory) VCellConnectionFactory(cbit.vcell.server.VCellConnectionFactory) RemoteProxyVCellConnectionFactory(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory)

Aggregations

RemoteProxyVCellConnectionFactory (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory)2 VCellConnectionFactory (cbit.vcell.server.VCellConnectionFactory)2 LocalVCellConnectionFactory (cbit.vcell.message.server.bootstrap.LocalVCellConnectionFactory)1 RemoteProxyException (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)1 PropertyLoader (cbit.vcell.resource.PropertyLoader)1 ConnectionException (cbit.vcell.server.ConnectionException)1 LocalVCellConnectionService (cbit.vcell.server.LocalVCellConnectionService)1 VCellConnection (cbit.vcell.server.VCellConnection)1 IOException (java.io.IOException)1 AuthenticationException (org.vcell.util.AuthenticationException)1 DataAccessException (org.vcell.util.DataAccessException)1 UserLoginInfo (org.vcell.util.document.UserLoginInfo)1 DigestedPassword (org.vcell.util.document.UserLoginInfo.DigestedPassword)1