Skip to content

Commit

Permalink
Refactor Out Remote Proxy Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
AvocadoMoon committed Jan 17, 2025
1 parent 0d2f7f3 commit 44f2470
Show file tree
Hide file tree
Showing 31 changed files with 63 additions and 76 deletions.
2 changes: 1 addition & 1 deletion vcell-api/src/main/java/org/vcell/rest/rpc/RpcRestlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public final class RpcRestlet extends Restlet {
private static Logger lg = LogManager.getLogger(RpcRestlet.class);
RestDatabaseService restDatabaseService;
private static final List<String> vcellguestAllowed;
//MUST keep sycnhronized with cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory
//MUST keep sycnhronized with org.vcell.api.messaging.RemoteProxyVCellConnectionFactory
static {
String[] temp = new String[] {
"getVCInfoContainer",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
*/

package org.vcell.api.server;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import org.vcell.util.DataAccessException;

import cbit.rmi.event.ExportEvent;
import cbit.vcell.export.server.ExportSpecs;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException;
import cbit.vcell.server.ExportController;
import cbit.vcell.simdata.OutputContext;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
import cbit.vcell.client.server.JobManager;
import cbit.vcell.client.server.SimStatusEvent;
import cbit.vcell.client.server.SimStatusListener;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.vcell.util.DataAccessException;

import cbit.vcell.export.server.ExportSpecs;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException;
import cbit.vcell.server.ExportJobStatus;
import cbit.vcell.server.SimulationStatus;
import cbit.vcell.simdata.OutputContext;
Expand Down Expand Up @@ -124,7 +124,7 @@ public SimulationStatus getServerSimulationStatus(VCSimulationIdentifier vcSimul
* Creation date: (1/4/01 1:38:14 PM)
* @param remoteProxyException RemoteProxyException
*/
private void handleRemoteProxyException(RemoteProxyException remoteProxyException) {
private void handleRemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyException remoteProxyException) {
lg.error(remoteProxyException);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import cbit.vcell.clientdb.DocumentManager;
import cbit.vcell.field.io.FieldDataFileOperationResults;
import cbit.vcell.field.io.FieldDataFileOperationSpec;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import org.vcell.api.messaging.RemoteProxyVCellConnectionFactory;
import cbit.vcell.model.common.VCellErrorMessages;
import cbit.vcell.resource.ErrorUtils;
import cbit.vcell.resource.PropertyLoader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import cbit.vcell.field.FieldDataIdentifierSpec;
import cbit.vcell.mapping.SimulationContext;
import cbit.vcell.mapping.SimulationContext.NetworkGenerationRequirements;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import cbit.vcell.messaging.server.SimulationTask;
import cbit.vcell.parser.ExpressionException;
import cbit.vcell.resource.ResourceUtil;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

package cbit.vcell.client;

import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import org.vcell.solver.nfsim.NFSimMolecularConfigurations;
import org.vcell.util.DataAccessException;
import org.vcell.util.document.TimeSeriesJobResults;
Expand All @@ -25,7 +26,6 @@
import cbit.vcell.export.server.ExportSpecs;
import cbit.vcell.field.io.FieldDataFileOperationResults;
import cbit.vcell.field.io.FieldDataFileOperationSpec;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException;
import cbit.vcell.server.DataSetController;
import cbit.vcell.server.DataSetControllerProvider;
import cbit.vcell.simdata.DataIdentifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
import cbit.vcell.client.desktop.NetworkProxyPreferences;
import cbit.vcell.client.server.ClientServerInfo;
import cbit.vcell.client.server.DynamicClientProperties;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory;
import org.vcell.api.messaging.RemoteProxyVCellConnectionFactory;
import cbit.vcell.mongodb.VCMongoMessage;
import cbit.vcell.resource.*;
import cbit.vcell.xml.XmlHelper;
import com.google.inject.Guice;
import com.google.inject.Injector;
import org.jdom.Document;
import org.vcell.dependency.client.VCellClientModule;
import org.vcell.util.document.UserLoginInfo;
import org.vcell.util.document.VCDocument;
import org.vcell.util.document.VCellSoftwareVersion;
import org.vcell.util.logging.ConsoleCapture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import javax.swing.JLabel;
import javax.swing.JPanel;

import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import org.vcell.solver.nfsim.NFSimMolecularConfigurations;
import org.vcell.util.DataAccessException;
import org.vcell.util.Extent;
Expand Down Expand Up @@ -40,10 +41,8 @@
import cbit.vcell.field.io.FieldDataFileOperationSpec;
import cbit.vcell.geometry.RegionImage;
import cbit.vcell.math.VariableType;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException;
import cbit.vcell.server.DataSetController;
import cbit.vcell.server.DataSetControllerProvider;
import cbit.vcell.server.SimulationStatus;
import cbit.vcell.simdata.ClientPDEDataContext;
import cbit.vcell.simdata.DataIdentifier;
import cbit.vcell.simdata.DataOperation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.google.inject.Key;
import com.google.inject.name.Names;
import org.vcell.DependencyConstants;
import org.vcell.api.messaging.RemoteProxyVCellConnectionFactory;
import org.vcell.api.server.ConnectionStatus;
import org.vcell.api.server.Reconnector;
import org.vcell.client.logicalwindow.LWTopFrame;
Expand Down Expand Up @@ -1477,6 +1478,10 @@ private void login(boolean asGuest) {
Hashtable<String, Object> hash = new Hashtable();
VCellConnectionFactory vcellConnectionFactory = VCellClientMain.injector.getInstance(VCellConnectionFactory.class);

if (!(vcellConnectionFactory instanceof RemoteProxyVCellConnectionFactory)){
throw new IllegalStateException("VCellConnectionFactory is not a RemoteProxyVCellConnectionFactory");
}

String host = VCellClientMain.injector.getInstance(Key.get(String.class, Names.named(DependencyConstants.VCELL_API_HOST)));
String port;
String pathPrefix;
Expand All @@ -1494,8 +1499,8 @@ private void login(boolean asGuest) {
ClientLogin.LoginOptions loginType = asGuest ?
ClientLogin.LoginOptions.GUEST_LOGIN : ClientLogin.LoginOptions.STANDARD_LOGIN;
AsynchClientTask task1a = ClientLogin.popupLogin(loginType);
AsynchClientTask task1b = ClientLogin.loginWithAuth0(vcellConnectionFactory.getAuth0ConnectionUtils());
AsynchClientTask task2 = ClientLogin.connectToServer(vcellConnectionFactory.getAuth0ConnectionUtils(),
AsynchClientTask task1b = ClientLogin.loginWithAuth0(((RemoteProxyVCellConnectionFactory)vcellConnectionFactory).getAuth0ConnectionUtils());
AsynchClientTask task2 = ClientLogin.connectToServer(((RemoteProxyVCellConnectionFactory)vcellConnectionFactory).getAuth0ConnectionUtils(),
ClientServerInfo.createRemoteServerInfo(host, Integer.parseInt(port), pathPrefix, null));

AsynchClientTask[] taskArray = new AsynchClientTask[]{task1a, task1b, task2};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.vcell.util.UtilCancelException;
import org.vcell.util.gui.DialogUtils;

import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory;
import org.vcell.api.messaging.RemoteProxyVCellConnectionFactory;
import cbit.vcell.resource.NetworkProxyUtils;
import cbit.vcell.resource.NetworkProxyUtils.RestartWarningProvider;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;

import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import org.vcell.util.DataAccessException;
import org.vcell.util.ProgressDialogListener;
import org.vcell.util.gui.ColorIcon;
Expand All @@ -59,7 +60,6 @@
import cbit.vcell.client.task.AsynchClientTask;
import cbit.vcell.client.task.ClientTaskDispatcher;
import cbit.vcell.clientdb.ClientDocumentManager;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException;
import cbit.vcell.server.SessionManager;
import cbit.vcell.server.SimpleJobStatus;
import cbit.vcell.server.SimpleJobStatusQuerySpec;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.vcell.dependency.client;

import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory;
import org.vcell.api.messaging.RemoteProxyVCellConnectionFactory;
import cbit.vcell.server.VCellConnectionFactory;
import cbit.vcell.simdata.ExternalDataIdentifierService;
import com.google.inject.AbstractModule;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.vcell.util.network;

import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import cbit.vcell.resource.PropertyLoader;
import org.vcell.api.client.VCellApiClient;
import org.vcell.api.utils.DTOOldAPI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import cbit.vcell.clientdb.DocumentManager;
import cbit.vcell.field.io.FieldDataFileOperationResults;
import cbit.vcell.field.io.FieldDataFileOperationSpec;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import cbit.vcell.server.DataSetControllerProvider;
import cbit.vcell.server.ExportController;
import cbit.vcell.server.SessionManager;
Expand All @@ -19,7 +19,7 @@ public interface ClientServerInterface extends SessionManager, DataSetController
void addPropertyChangeListener(java.beans.PropertyChangeListener listener);

public void cleanup();
public MessageEvent[] getMessageEvents() throws RemoteProxyVCellConnectionFactory.RemoteProxyException, IOException;
public MessageEvent[] getMessageEvents() throws RemoteProxyException, IOException;

public void connectNewServer(InteractiveClientServerContext requester, ClientServerInfo csi);
public void connect(InteractiveClientServerContext requester);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Iterator;
import java.util.Vector;

import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jdom.Element;
Expand Down Expand Up @@ -75,7 +76,6 @@
import cbit.vcell.math.MathDescription;
import cbit.vcell.math.MathException;
import cbit.vcell.mathmodel.MathModel;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException;
import cbit.vcell.model.DBFormalSpecies;
import cbit.vcell.model.DBSpecies;
import cbit.vcell.model.FormalSpeciesType;
Expand Down Expand Up @@ -1341,7 +1341,7 @@ public ReactionStepInfo[] getUserReactionStepInfos(KeyValue[] reactionStepKeys)
* Creation date: (11/14/00 5:24:29 PM)
* @param e RemoteProxyException
*/
private void handleRemoteProxyException(RemoteProxyException e) {
private void handleRemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyException e) {
lg.error("Handling RemoteProxyException", e);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package cbit.vcell.message.server.bootstrap.client;

public class RemoteProxyException extends Exception {
public RemoteProxyException(String message, Throwable cause) {
super(message, cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,6 @@ public MessageEvent[] getMessageEvents() throws IOException {
return messageEvents.toArray(new MessageEvent[0]);
}
}

@SuppressWarnings("serial")
public static class RemoteProxyException extends Exception {

public RemoteProxyException(String message, Exception e) {
super(message,e);
}

}

public RemoteProxyVCellConnectionFactory(
String apihost,
Expand Down
21 changes: 7 additions & 14 deletions vcell-core/src/main/java/cbit/vcell/server/DataSetController.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,20 @@

package cbit.vcell.server;

import org.vcell.solver.nfsim.NFSimMolecularConfigurations;
import org.vcell.util.DataAccessException;
import org.vcell.util.document.VCDataIdentifier;
import org.vcell.vis.io.VtuFileContainer;
import org.vcell.vis.io.VtuVarInfo;

import cbit.plot.PlotData;
import cbit.rmi.event.ExportEvent;
import cbit.vcell.export.server.ExportSpecs;
import cbit.vcell.field.io.FieldDataFileOperationResults;
import cbit.vcell.field.io.FieldDataFileOperationSpec;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException;
import cbit.vcell.simdata.DataIdentifier;
import cbit.vcell.simdata.DataOperation;
import cbit.vcell.simdata.DataOperationResults;
import cbit.vcell.simdata.DataSetMetadata;
import cbit.vcell.simdata.DataSetTimeSeries;
import cbit.vcell.simdata.OutputContext;
import cbit.vcell.simdata.SpatialSelection;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import cbit.vcell.simdata.*;
import cbit.vcell.solver.AnnotatedFunction;
import cbit.vcell.solvers.CartesianMesh;
import org.vcell.solver.nfsim.NFSimMolecularConfigurations;
import org.vcell.util.DataAccessException;
import org.vcell.util.document.VCDataIdentifier;
import org.vcell.vis.io.VtuFileContainer;
import org.vcell.vis.io.VtuVarInfo;
/**
* This interface was generated by a SmartGuide.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
package cbit.vcell.server;

import cbit.vcell.export.server.ExportSpecs;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import cbit.vcell.simdata.OutputContext;
/**
* Insert the type's description here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
*/

package cbit.vcell.server;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import org.vcell.util.DataAccessException;
import org.vcell.util.document.KeyValue;

import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException;
import cbit.vcell.solver.VCSimulationIdentifier;
/**
* This interface was generated by a SmartGuide.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
package cbit.vcell.server;
import java.util.TreeMap;

import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import org.vcell.util.BigString;
import org.vcell.util.DataAccessException;
import org.vcell.util.ObjectNotFoundException;
Expand All @@ -33,11 +34,9 @@
import cbit.vcell.field.FieldDataDBOperationSpec;
import cbit.vcell.geometry.GeometryInfo;
import cbit.vcell.mathmodel.MathModelMetaData;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException;
import cbit.vcell.model.DBFormalSpecies;
import cbit.vcell.model.DBSpecies;
import cbit.vcell.model.FormalSpeciesType;
import cbit.vcell.model.Model;
import cbit.vcell.model.ReactionDescription;
import cbit.vcell.model.ReactionQuerySpec;
import cbit.vcell.model.ReactionStepInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

package cbit.vcell.server;

import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import org.vcell.util.AuthenticationException;
import org.vcell.util.DataAccessException;
import org.vcell.util.UseridIDExistsException;
import org.vcell.util.document.UserInfo;
import org.vcell.util.document.UserLoginInfo;

import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException;
/**
* This interface was generated by a SmartGuide.
*
Expand Down
10 changes: 4 additions & 6 deletions vcell-core/src/main/java/cbit/vcell/server/VCellConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@

package cbit.vcell.server;

import java.io.IOException;
import java.io.Serializable;

import cbit.rmi.event.MessageEvent;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import org.vcell.util.DataAccessException;
import org.vcell.util.document.UserLoginInfo;

import cbit.rmi.event.MessageEvent;
import cbit.rmi.event.PerformanceMonitorEvent;
import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException;
import java.io.IOException;
import java.io.Serializable;
/**
* This interface was generated by a SmartGuide.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package cbit.vcell.server;

import cbit.vcell.message.server.bootstrap.client.RemoteProxyException;
import org.vcell.service.registration.RegistrationService;
import org.vcell.util.DataAccessException;
import org.vcell.util.UseridIDExistsException;
import org.vcell.util.document.KeyValue;
import org.vcell.util.document.UserInfo;

import cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException;

public class VCellConnectionRegistrationProvider implements RegistrationService {
private VCellConnection vcellConnection;
Expand Down
Loading

0 comments on commit 44f2470

Please sign in to comment.