|
|
@ -35,20 +35,33 @@ public class HttpWorkspaceConnector implements WorkspaceConnector { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean testConnection(WorkspaceConnectionInfo connectionInfo) throws Exception { |
|
|
|
public boolean testConnection(WorkspaceConnectionInfo connectionInfo) throws Exception { |
|
|
|
LoginResponseInfoBean bean = RemoteNetworkRepository.getInstance().login(createLoginBean(connectionInfo)); |
|
|
|
FineWorkspaceHttpClient client = FineWorkspaceHttpClient.create("Http-Client", connectionInfo); |
|
|
|
|
|
|
|
LoginResponseInfoBean bean; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
bean = RemoteNetworkRepository.getInstance().login(createLoginBean(connectionInfo)); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
client.closePool(); |
|
|
|
|
|
|
|
throw e; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return StringUtils.isNotEmpty(bean.getAccessToken()); |
|
|
|
return StringUtils.isNotEmpty(bean.getAccessToken()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public WorkspaceClient connect(WorkspaceConnectionInfo connectionInfo) throws Exception { |
|
|
|
public WorkspaceClient connect(WorkspaceConnectionInfo connectionInfo) throws Exception { |
|
|
|
FineWorkspaceHttpClient client = FineWorkspaceHttpClient.create("Http-Client", connectionInfo); |
|
|
|
FineWorkspaceHttpClient client = FineWorkspaceHttpClient.create("Http-Client", connectionInfo); |
|
|
|
LoginResponseInfoBean bean = RemoteNetworkRepository.getInstance().login(createLoginBean(connectionInfo)); |
|
|
|
try { |
|
|
|
WorkspaceConnection connection = new WorkspaceConnection( |
|
|
|
LoginResponseInfoBean bean = RemoteNetworkRepository.getInstance().login(createLoginBean(connectionInfo)); |
|
|
|
UUID.randomUUID().toString(), |
|
|
|
WorkspaceConnection connection = new WorkspaceConnection( |
|
|
|
connectionInfo.getUserName(), |
|
|
|
UUID.randomUUID().toString(), |
|
|
|
HttpConstants.AUTHORIZATION_PREFIX + bean.getAccessToken(), |
|
|
|
connectionInfo.getUserName(), |
|
|
|
InetAddress.getLocalHost().getHostAddress()); |
|
|
|
HttpConstants.AUTHORIZATION_PREFIX + bean.getAccessToken(), |
|
|
|
client.updateConnection(connection); |
|
|
|
InetAddress.getLocalHost().getHostAddress()); |
|
|
|
|
|
|
|
client.updateConnection(connection); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
client.closePool(); |
|
|
|
|
|
|
|
throw e; |
|
|
|
|
|
|
|
} |
|
|
|
client.startHeartBeat(); |
|
|
|
client.startHeartBeat(); |
|
|
|
CompatibleRegister.registerCompatibleEnv(); |
|
|
|
CompatibleRegister.registerCompatibleEnv(); |
|
|
|
return client; |
|
|
|
return client; |
|
|
|