Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
package org.vcell.standalone;

import cbit.vcell.field.db.LocalExternalDataIdentifierServiceImpl;
import cbit.vcell.message.VCMessagingService;
import cbit.vcell.message.jms.activeMQ.VCMessagingServiceActiveMQ;
import cbit.vcell.message.server.bootstrap.LocalVCellConnectionFactory;
import cbit.vcell.message.server.bootstrap.LocalVCellConnectionServiceImpl;
import cbit.vcell.server.LocalVCellConnectionService;
import cbit.vcell.server.VCellConnectionFactory;
import cbit.vcell.simdata.ExternalDataIdentifierService;
import com.google.inject.AbstractModule;
import org.vcell.api.utils.Auth0ConnectionUtils;
import org.vcell.service.registration.RegistrationService;
import org.vcell.service.registration.localdb.LocaldbRegistrationService;

public class VCellStandaloneModule extends AbstractModule {
@Override
Expand All @@ -22,6 +18,5 @@ protected void configure() {
bind(Auth0ConnectionUtils.class).toInstance(new Auth0ConnectionUtils());
bind(VCellConnectionFactory.class).to(LocalVCellConnectionFactory.class).asEagerSingleton();

bind(RegistrationService.class).toInstance(new LocaldbRegistrationService());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,7 @@ public String handleResponse(HttpResponse response) throws HttpResponseException
}

public VCellApiClient(String host, int port, String pathPrefix_v0) throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException {
this(host, port, pathPrefix_v0, false, false);
}

public VCellApiClient(String host, int port, String pathPrefix_v0, boolean bIgnoreCertProblems, boolean bIgnoreHostMismatch) throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException{
this(host, port, pathPrefix_v0, false, bIgnoreCertProblems, bIgnoreHostMismatch);
this(host, port, pathPrefix_v0, false, false, false);
}

public VCellApiClient(String host, int port, String pathPrefix_v0, boolean bSkipSSL, boolean bIgnoreCertProblems, boolean bIgnoreHostMismatch) throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
Expand Down Expand Up @@ -363,22 +359,6 @@ public String handleResponse(final HttpResponse response) throws ClientProtocolE
message = reader.lines().collect(Collectors.joining());
}
return message;
// HttpEntity entity = response.getEntity();
// if (lg.isInfoEnabled()) {
// try (BufferedReader reader = new BufferedReader(new InputStreamReader(entity.getContent()));){
// lg.info("optimizationId = "+reader.readLine());
// }
// }
// final Header locationHeader = response.getFirstHeader("location");
// if (locationHeader == null) {
// // got a redirect response, but no location header
// throw new ClientProtocolException(
// "Received redirect response " + response.getStatusLine()
// + " but no location header");
// }
// final String location = locationHeader.getValue();
// URI uri = createLocationURI(location);
// return uri.toString();
} else {
HttpEntity entity = response.getEntity();
String message = null;
Expand All @@ -398,8 +378,6 @@ public String handleResponse(final HttpResponse response) throws ClientProtocolE
}

return responseUri;
// String optimizationId = responseUri.substring(responseUri.lastIndexOf('/') + 1);
// return optimizationId;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import cbit.vcell.simdata.VCDataManager;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.vcell.api.client.VCellApiClient;
import org.vcell.api.messaging.RemoteProxyVCellConnectionFactory;
import org.vcell.api.utils.Auth0ConnectionUtils;
import org.vcell.service.registration.RegistrationService;
import org.vcell.util.Compare;
import org.vcell.util.DataAccessException;
import org.vcell.util.VCellThreadChecker;
Expand Down Expand Up @@ -823,7 +823,11 @@ void setDisconnected() {
setConnectionStatus(new ClientConnectionStatus(getClientServerInfo().getUsername(), getClientServerInfo().getApihost(), getClientServerInfo().getApiport(), ConnectionStatus.DISCONNECTED));
}

public RegistrationService getRegistrationProvider() {
return new VCellConnectionRegistrationProvider(this.vcellConnection);
}
public VCellApiClient getVCellApiClient(){
if (vcellConnectionFactory instanceof RemoteProxyVCellConnectionFactory remoteProxyVCellConnectionFactory){
return remoteProxyVCellConnectionFactory.getVCellApiClient();
}
throw new UnsupportedOperationException("This function should only be called with RemoteProxyVCellConnectionFactory");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2833,7 +2833,7 @@ public AsynchMessageManager getAsynchMessageManager() {
return getClientServerManager().getAsynchMessageManager();
}

private ClientServerManager getClientServerManager() {
public ClientServerManager getClientServerManager() {
// shorthand
return getVcellClient().getClientServerManager();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import cbit.vcell.server.VCellConnectionFactory;
import com.google.inject.Inject;
import com.install4j.api.launcher.ApplicationLauncher;
import org.vcell.api.client.VCellApiClient;
import org.vcell.api.messaging.RemoteProxyVCellConnectionFactory;
import org.vcell.api.server.ClientServerManager;
import org.vcell.api.server.ClientServerManager.InteractiveContextDefaultProvider;
Expand All @@ -47,7 +48,7 @@ public class VCellClient {

private static VCellClient instance = null;

public static void setInstance(VCellClient instance) {
private static void setInstance(VCellClient instance) {
VCellClient.instance = instance;
}
public static VCellClient getInstance() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package copasi;

import cbit.vcell.client.ClientRequestManager;
import cbit.vcell.client.RequestManager;
import cbit.vcell.client.VCellClient;
import cbit.vcell.client.server.ClientServerInfo;
import cbit.vcell.modelopt.ParameterEstimationTask;
import cbit.vcell.opt.OptimizationException;
Expand All @@ -25,20 +28,13 @@ public static OptimizationResultSet solveRemoteApi(
ParameterEstimationTask parameterEstimationTask,
CopasiOptSolverCallbacks optSolverCallbacks,
ClientTaskStatusSupport clientTaskStatusSupport,
ClientServerInfo clientServerInfo) {
ClientRequestManager requestManager) {

// return solveLocalPython(parameterEstimationTask);

try {
boolean bIgnoreCertProblems = PropertyLoader.getBooleanProperty(PropertyLoader.sslIgnoreCertProblems, false);
boolean bIgnoreHostMismatch = PropertyLoader.getBooleanProperty(PropertyLoader.sslIgnoreHostMismatch, false);

String host = clientServerInfo.getApihost();
int port = clientServerInfo.getApiport();
String pathPrefixV0 = clientServerInfo.getPathPrefix_v0();
// e.g. vcell.serverhost=vcellapi.cam.uchc.edu:443
VCellApiClient apiClient = new VCellApiClient(host, port, pathPrefixV0, bIgnoreCertProblems, bIgnoreHostMismatch);
apiClient.authenticate(bIgnoreCertProblems);
VCellApiClient apiClient = requestManager.getClientServerManager().getVCellApiClient();

OptProblem optProblem = CopasiUtils.paramTaskToOptProblem(parameterEstimationTask);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package org.vcell.dependency.client;

import org.vcell.api.messaging.RemoteProxyVCellConnectionFactory;
import cbit.vcell.server.VCellConnectionFactory;
import cbit.vcell.simdata.ExternalDataIdentifierService;
import com.google.inject.AbstractModule;
import com.google.inject.name.Names;
import org.vcell.DependencyConstants;
import org.vcell.service.registration.RegistrationService;
import org.vcell.util.network.RemoteRegistrationService;
import org.vcell.api.messaging.RemoteProxyVCellConnectionFactory;
import org.vcell.util.document.ExternalDataIdentifier;
import org.vcell.util.document.User;

Expand Down Expand Up @@ -49,8 +47,6 @@ protected void configure() {

bind(VCellConnectionFactory.class).to(RemoteProxyVCellConnectionFactory.class).asEagerSingleton();

// RegistrationService interface is not clean - mixes new registration with updates - is there another way?
bind(RegistrationService.class).toInstance(new RemoteRegistrationService()); // used on remote client.

bind(String.class).annotatedWith(Names.named(DependencyConstants.VCELL_API_HOST)).toInstance(apiHost);
bind(Integer.class).annotatedWith(Names.named(DependencyConstants.VCELL_API_PORT)).toInstance(apiPort);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import cbit.plot.PlotData;
import cbit.plot.gui.Plot2DPanel;
import cbit.vcell.client.ClientRequestManager;
import cbit.vcell.client.RequestManager;
import cbit.vcell.client.TopLevelWindowManager;
import cbit.vcell.client.VCellLookAndFeel;
import cbit.vcell.client.constants.GuiConstants;
Expand Down Expand Up @@ -1162,14 +1163,18 @@ public void run(Hashtable<String, Object> hashTable) throws Exception {
};
taskList.add(task1);

AsynchClientTask task2 = new AsynchClientTask("Starting param esitmation job...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
AsynchClientTask task2 = new AsynchClientTask("Starting param estimation job...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
// OptimizationResultSet optResultSet = CopasiOptimizationSolver.solveLocalPython(parameterEstimationTask);
ClientServerInfo clientServerInfo = TopLevelWindowManager.activeManager().getRequestManager().getClientServerInfo();
optSolverCallbacks.setProgressReport(new OptProgressReport());
OptimizationResultSet optResultSet = CopasiOptimizationSolverRemote.solveRemoteApi(parameterEstimationTask, optSolverCallbacks, getClientTaskStatusSupport(), clientServerInfo);
hashTable.put(ORS_KEY, optResultSet);
RequestManager requestManager = TopLevelWindowManager.activeManager().getRequestManager();
if (requestManager instanceof ClientRequestManager clientRequestManager){
OptimizationResultSet optResultSet = CopasiOptimizationSolverRemote.solveRemoteApi(parameterEstimationTask, optSolverCallbacks, getClientTaskStatusSupport(), clientRequestManager);
hashTable.put(ORS_KEY, optResultSet);
} else {
throw new UnsupportedOperationException("Requires remote connection to do parameter estimation.");
}
}

};
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import cbit.vcell.server.SessionManager;
import cbit.vcell.server.VCellConnection;
import cbit.vcell.simdata.VCDataManager;
import org.vcell.service.registration.RegistrationService;

import java.io.IOException;

Expand Down Expand Up @@ -39,5 +38,4 @@ public interface ClientServerInterface extends SessionManager, DataSetController
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener);
public void sendErrorReport(Throwable exception );
public void sendErrorReport(Throwable exception, VCellConnection.ExtraContext extraContext);
public RegistrationService getRegistrationProvider();
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import cbit.vcell.server.LocalVCellConnectionService;
import cbit.vcell.server.VCellConnectionFactory;
import cbit.vcell.simdata.ExternalDataIdentifierService;
import org.vcell.service.registration.RegistrationService;
import org.vcell.service.registration.localdb.LocaldbRegistrationService;

public class VCellServerModule extends com.google.inject.AbstractModule {
@Override
Expand All @@ -21,11 +19,6 @@ protected void configure() {
bind(LocalVCellConnectionService.class).toInstance(new LocalVCellConnectionServiceImpl());
bind(VCellConnectionFactory.class).to(LocalVCellConnectionFactory.class).asEagerSingleton();

// server-side implementation (talk directly to database)
// RegistrationService interface is not clean - mixes new registration with updates - is there another way?
bind(RegistrationService.class).toInstance(new LocaldbRegistrationService());
//bind(RegistrationService.class).toInstance(new RemoteRegistrationService()); // used on remote client.

bind(VCMessagingService.class).toInstance(new VCMessagingServiceActiveMQ());
//bind(VCMessagingService.class).toInstance(new VCMessagingServiceEmbedded()); // used for testing.

Expand Down
Loading