From 74e5ba773c55cdeefa2cb3accabbcba4d1afc3f8 Mon Sep 17 00:00:00 2001 From: Ryan Doherty Date: Sat, 16 Apr 2022 22:13:18 -0400 Subject: [PATCH 1/5] Move WSF into WDK --- Model/pom.xml | 18 +- WSF/README.md | 6 + WSF/pom.xml | 65 ++++ .../wsf/client/ClientModelException.java | 31 ++ .../org/gusdb/wsf/client/ClientRequest.java | 66 ++++ .../gusdb/wsf/client/ClientUserException.java | 30 ++ .../java/org/gusdb/wsf/client/WsfClient.java | 11 + .../gusdb/wsf/client/WsfClientFactory.java | 10 + .../wsf/client/WsfClientFactoryImpl.java | 20 ++ .../org/gusdb/wsf/client/WsfLocalClient.java | 76 +++++ .../org/gusdb/wsf/client/WsfRemoteClient.java | 141 +++++++++ .../gusdb/wsf/client/WsfResponseListener.java | 12 + .../gusdb/wsf/common/ResponseAttachment.java | 31 ++ .../org/gusdb/wsf/common/ResponseMessage.java | 22 ++ .../org/gusdb/wsf/common/ResponseRow.java | 22 ++ .../org/gusdb/wsf/common/ResponseStatus.java | 43 +++ .../java/org/gusdb/wsf/common/WsfRequest.java | 38 +++ .../org/gusdb/wsf/plugin/AbstractPlugin.java | 292 ++++++++++++++++++ .../wsf/plugin/DelayedResultException.java | 5 + .../java/org/gusdb/wsf/plugin/Plugin.java | 52 ++++ .../org/gusdb/wsf/plugin/PluginExecutor.java | 88 ++++++ .../wsf/plugin/PluginModelException.java | 31 ++ .../org/gusdb/wsf/plugin/PluginRequest.java | 216 +++++++++++++ .../org/gusdb/wsf/plugin/PluginResponse.java | 11 + .../wsf/plugin/PluginTimeoutException.java | 34 ++ .../gusdb/wsf/plugin/PluginUserException.java | 30 ++ .../wsf/service/ServiceModelException.java | 27 ++ .../org/gusdb/wsf/service/ServiceRequest.java | 60 ++++ .../wsf/service/StreamingPluginResponse.java | 67 ++++ .../org/gusdb/wsf/service/WsfService.java | 101 ++++++ .../wsf/service/WsfServiceApplication.java | 17 + build.xml | 20 +- pom.xml | 35 +-- psu.xml | 257 --------------- 34 files changed, 1676 insertions(+), 309 deletions(-) create mode 100644 WSF/README.md create mode 100644 WSF/pom.xml create mode 100644 WSF/src/main/java/org/gusdb/wsf/client/ClientModelException.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/client/ClientRequest.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/client/ClientUserException.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/client/WsfClient.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/client/WsfClientFactory.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/client/WsfClientFactoryImpl.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/client/WsfLocalClient.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/client/WsfRemoteClient.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/client/WsfResponseListener.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/common/ResponseAttachment.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/common/ResponseMessage.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/common/ResponseRow.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/common/ResponseStatus.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/common/WsfRequest.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/plugin/AbstractPlugin.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/plugin/DelayedResultException.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/plugin/Plugin.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/plugin/PluginExecutor.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/plugin/PluginModelException.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/plugin/PluginRequest.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/plugin/PluginResponse.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/plugin/PluginTimeoutException.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/plugin/PluginUserException.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/service/ServiceModelException.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/service/ServiceRequest.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/service/StreamingPluginResponse.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/service/WsfService.java create mode 100644 WSF/src/main/java/org/gusdb/wsf/service/WsfServiceApplication.java delete mode 100755 psu.xml diff --git a/Model/pom.xml b/Model/pom.xml index a843cabd8c..6565a81d7c 100644 --- a/Model/pom.xml +++ b/Model/pom.xml @@ -16,23 +16,7 @@ org.gusdb - wsf-client - - - javax.servlet - javax.servlet-api - - - - - - org.gusdb - wsf-common - - - - org.gusdb - wsf-plugin + wdk-wsf diff --git a/WSF/README.md b/WSF/README.md new file mode 100644 index 0000000000..acf162d462 --- /dev/null +++ b/WSF/README.md @@ -0,0 +1,6 @@ +# WSF +The [WDK](https://github.com/VEuPathDB/WDK) Web Services Framework: web service architecture to support WDK searches that run a process rather than issue an RDBMS query. + +Defines a [plugin API](Plugin/src/main/java/org/gusdb/wsf/plugin/Plugin.java) so that process-based searches can be plugged into the WDK search engine. + +This repo will be retired soon, when the plugin functionality will be folded into the WDK directly. diff --git a/WSF/pom.xml b/WSF/pom.xml new file mode 100644 index 0000000000..2f7526b0c1 --- /dev/null +++ b/WSF/pom.xml @@ -0,0 +1,65 @@ + + 4.0.0 + + + org.gusdb + wdk + 1.0.0 + + + Web Development Kit - WSF + wdk-wsf + jar + + + + + org.gusdb + fgputil-core + + + + org.gusdb + fgputil-db + + + + org.gusdb + fgputil-json + + + + org.glassfish.jersey.core + jersey-client + + + + org.json + json + + + + javax.servlet + servlet-api + provided + + + + org.apache.logging.log4j + log4j-core + + + org.apache.logging.log4j + log4j-1.2-api + + + + junit + junit + test + + + + + diff --git a/WSF/src/main/java/org/gusdb/wsf/client/ClientModelException.java b/WSF/src/main/java/org/gusdb/wsf/client/ClientModelException.java new file mode 100644 index 0000000000..0c44b61c55 --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/client/ClientModelException.java @@ -0,0 +1,31 @@ +package org.gusdb.wsf.client; + + +/** + * @author Jerric + */ +public class ClientModelException extends Exception { + + private static final long serialVersionUID = 2L; + + public ClientModelException() { + super(); + } + + public ClientModelException(String message) { + super(message); + } + + public ClientModelException(Throwable cause) { + super(cause); + } + + public ClientModelException(String message, Throwable cause) { + super(message, cause); + } + + public ClientModelException(String message, Throwable cause, boolean enableSuppression, + boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff --git a/WSF/src/main/java/org/gusdb/wsf/client/ClientRequest.java b/WSF/src/main/java/org/gusdb/wsf/client/ClientRequest.java new file mode 100644 index 0000000000..dd630ed1de --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/client/ClientRequest.java @@ -0,0 +1,66 @@ +package org.gusdb.wsf.client; + +import org.gusdb.wsf.plugin.PluginRequest; +import org.json.JSONException; +import org.json.JSONObject; + +/** + * @author jerric + */ +@SuppressWarnings("hiding") +public class ClientRequest extends PluginRequest { + + public static final String PLUGIN_KEY = "plugin"; + public static final String PROJECT_KEY = PluginRequest.PROJECT_KEY; + public static final String COLUMNS_ARRAY_KEY = PluginRequest.COLUMNS_ARRAY_KEY; + public static final String PARAMETER_MAP_KEY = PluginRequest.PARAMETER_MAP_KEY; + public static final String CONTEXT_MAP_KEY = PluginRequest.CONTEXT_MAP_KEY; + + private String pluginClass; + + public ClientRequest() { + super(); + } + + public ClientRequest(ClientRequest request) { + super(request); + this.pluginClass = request.pluginClass; + } + + public ClientRequest(String jsonString) throws ClientModelException { + try { + JSONObject jsRequest = new JSONObject(jsonString); + parseJSON(jsRequest); + this.pluginClass = jsRequest.getString(PLUGIN_KEY); + } + catch (JSONException ex) { + throw new ClientModelException(ex); + } + } + + /** + * the full class name of the WSF plugin. The service will instantiate a plugin instance from this class + * name, and invoke it. + * + * @return the pluginClass + */ + public String getPluginClass() { + return pluginClass; + } + + /** + * @param pluginClass + * the pluginClass to set + */ + public void setPluginClass(String pluginClass) { + this.pluginClass = pluginClass; + } + + @Override + protected JSONObject getJSON() throws JSONException { + JSONObject jsRequest = super.getJSON(); + jsRequest.put(PLUGIN_KEY, pluginClass); + return jsRequest; + } + +} diff --git a/WSF/src/main/java/org/gusdb/wsf/client/ClientUserException.java b/WSF/src/main/java/org/gusdb/wsf/client/ClientUserException.java new file mode 100644 index 0000000000..846f9a9b75 --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/client/ClientUserException.java @@ -0,0 +1,30 @@ +package org.gusdb.wsf.client; + +/** + * @author Jerric + */ +public class ClientUserException extends Exception { + + private static final long serialVersionUID = 2L; + + public ClientUserException() { + super(); + } + + public ClientUserException(String message) { + super(message); + } + + public ClientUserException(Throwable cause) { + super(cause); + } + + public ClientUserException(String message, Throwable cause) { + super(message, cause); + } + + public ClientUserException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff --git a/WSF/src/main/java/org/gusdb/wsf/client/WsfClient.java b/WSF/src/main/java/org/gusdb/wsf/client/WsfClient.java new file mode 100644 index 0000000000..09724a10a0 --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/client/WsfClient.java @@ -0,0 +1,11 @@ +package org.gusdb.wsf.client; + +import org.gusdb.wsf.plugin.DelayedResultException; + +public interface WsfClient { + + void setResponseListener(WsfResponseListener listener); + + int invoke(ClientRequest request) throws ClientModelException, ClientUserException, DelayedResultException; + +} diff --git a/WSF/src/main/java/org/gusdb/wsf/client/WsfClientFactory.java b/WSF/src/main/java/org/gusdb/wsf/client/WsfClientFactory.java new file mode 100644 index 0000000000..477a41aade --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/client/WsfClientFactory.java @@ -0,0 +1,10 @@ +package org.gusdb.wsf.client; + +import java.net.URI; + +public interface WsfClientFactory { + + WsfClient newClient(WsfResponseListener listener); + + WsfClient newClient(WsfResponseListener listener, URI serviceURI); +} diff --git a/WSF/src/main/java/org/gusdb/wsf/client/WsfClientFactoryImpl.java b/WSF/src/main/java/org/gusdb/wsf/client/WsfClientFactoryImpl.java new file mode 100644 index 0000000000..6a3d7432af --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/client/WsfClientFactoryImpl.java @@ -0,0 +1,20 @@ +package org.gusdb.wsf.client; + +import java.net.URI; + +public final class WsfClientFactoryImpl implements WsfClientFactory { + + @Override + public WsfClient newClient(WsfResponseListener listener) { + WsfClient client = new WsfLocalClient(); + client.setResponseListener(listener); + return client; + } + + @Override + public WsfClient newClient(WsfResponseListener listener, URI serviceURI) { + WsfClient client = new WsfRemoteClient(serviceURI); + client.setResponseListener(listener); + return client; + } +} diff --git a/WSF/src/main/java/org/gusdb/wsf/client/WsfLocalClient.java b/WSF/src/main/java/org/gusdb/wsf/client/WsfLocalClient.java new file mode 100644 index 0000000000..f506cd44ad --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/client/WsfLocalClient.java @@ -0,0 +1,76 @@ +package org.gusdb.wsf.client; + +import org.gusdb.wsf.plugin.DelayedResultException; +import org.gusdb.wsf.plugin.PluginExecutor; +import org.gusdb.wsf.plugin.PluginModelException; +import org.gusdb.wsf.plugin.PluginResponse; +import org.gusdb.wsf.plugin.PluginUserException; + +/** + * @author Jerric + */ +public class WsfLocalClient implements WsfClient, PluginResponse { + + private WsfResponseListener listener; + + protected WsfLocalClient() {} + + @Override + public void addRow(String[] row) throws PluginModelException, PluginUserException { + try { + listener.onRowReceived(row); + } + catch (ClientModelException ex) { + throw new PluginModelException(ex); + } + catch (ClientUserException ex) { + throw new PluginUserException(ex); + } + } + + @Override + public void addAttachment(String key, String attachment) throws PluginModelException, PluginUserException { + try { + listener.onAttachmentReceived(key, attachment); + } + catch (ClientModelException ex) { + throw new PluginModelException(ex); + } + catch (ClientUserException ex) { + throw new PluginUserException(ex); + } + } + + @Override + public void setMessage(String message) throws PluginModelException, PluginUserException { + try { + listener.onMessageReceived(message); + } + catch (ClientModelException ex) { + throw new PluginModelException(ex); + } + catch (ClientUserException ex) { + throw new PluginUserException(ex); + } + } + + @Override + public void setResponseListener(WsfResponseListener listener) { + this.listener = listener; + } + + @Override + public int invoke(ClientRequest request) throws ClientModelException, ClientUserException, DelayedResultException { + PluginExecutor executor = new PluginExecutor(); + String pluginClassName = request.getPluginClass(); + try { + return executor.execute(pluginClassName, request, this); + } + catch (PluginModelException ex) { + throw new ClientModelException(ex); + } + catch (PluginUserException ex) { + throw new ClientUserException(ex); + } + } +} diff --git a/WSF/src/main/java/org/gusdb/wsf/client/WsfRemoteClient.java b/WSF/src/main/java/org/gusdb/wsf/client/WsfRemoteClient.java new file mode 100644 index 0000000000..cf8311e70f --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/client/WsfRemoteClient.java @@ -0,0 +1,141 @@ +package org.gusdb.wsf.client; + +import java.io.IOException; +import java.io.InputStream; +import java.io.ObjectInputStream; +import java.net.URI; +import java.util.HashMap; +import java.util.Map; + +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Entity; +import javax.ws.rs.core.Form; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.apache.log4j.Logger; +import org.glassfish.jersey.client.ClientProperties; +import org.gusdb.wsf.common.ResponseAttachment; +import org.gusdb.wsf.common.ResponseMessage; +import org.gusdb.wsf.common.ResponseRow; +import org.gusdb.wsf.common.ResponseStatus; +import org.gusdb.wsf.common.WsfRequest; +import org.gusdb.wsf.plugin.DelayedResultException; +import org.gusdb.wsf.plugin.PluginUserException; + +public class WsfRemoteClient implements WsfClient { + + private static final Logger LOG = Logger.getLogger(WsfRemoteClient.class); + + private final URI serviceURI; + + private WsfResponseListener listener; + + protected WsfRemoteClient(URI serviceURI) { + this.serviceURI = serviceURI; + } + + @Override + public void setResponseListener(WsfResponseListener listener) { + this.listener = listener; + } + + @Override + public int invoke(ClientRequest request) throws ClientModelException, ClientUserException, DelayedResultException { + Client client = ClientBuilder.newClient(); + int checksum = request.getChecksum(); + LOG.debug("WSF Remote: checksum=" + checksum + ", url=" + serviceURI + "\n" + request); + + // prepare the form + Form form = new Form(); + form.param(WsfRequest.PARAM_REQUEST, request.toString()); + + // invoke service + Response response = client.target(serviceURI).property(ClientProperties.FOLLOW_REDIRECTS, Boolean.TRUE).request( + MediaType.APPLICATION_OCTET_STREAM_TYPE).post( + Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE)); + int status = response.getStatus(); + if (status >= 400) + throw new ClientModelException("Request failed with status code: " + status); + + InputStream inStream = null; + int signal; + Map stats = new HashMap<>(); + stats.put("rows", 0); + stats.put("attachments", 0); + try { + inStream = response.readEntity(InputStream.class); + signal = readStream(inStream, stats); + } + catch (ClassNotFoundException | IOException ex) { + throw new ClientModelException(ex); + } + finally { + if (inStream != null) { + try { + inStream.close(); + } + catch (IOException ex) { + throw new ClientModelException(ex); + } + finally { + response.close(); + } + } + LOG.debug("WSF Remote finished: checksum=" + checksum + ", status " + status + ", #rows=" + + stats.get("rows") + ", #attch=" + stats.get("attachments") + ", url=" + serviceURI); + } + return signal; + } + + private int readStream(InputStream inStream, Map stats) throws ClientUserException, + ClientModelException, IOException, ClassNotFoundException, DelayedResultException { + ObjectInputStream objectStream = new ObjectInputStream(inStream); + while (true) { + Object object = objectStream.readUnshared(); + if (object instanceof ResponseStatus) { + // received a status object, which should be the last object to receive + ResponseStatus status = (ResponseStatus) object; + + // check if an exception is present + Exception exception = status.getException(); + if (exception != null) { + if (exception instanceof PluginUserException) { + throw new ClientUserException(exception); + } + else if (exception instanceof DelayedResultException) { + throw (DelayedResultException) exception; + } + else if (exception instanceof RuntimeException) { + throw (RuntimeException) exception; + } + else { + throw new ClientModelException(exception); + } + } + + // return the signal + return status.getSignal(); + } + else if (object instanceof ResponseRow) { // received a new row from the service + ResponseRow row = (ResponseRow) object; + listener.onRowReceived(row.getRow()); + stats.put("rows", stats.get("rows") + 1); + } + else if (object instanceof ResponseAttachment) { // received a new attachment + ResponseAttachment attachment = (ResponseAttachment) object; + listener.onAttachmentReceived(attachment.getKey(), attachment.getContent()); + stats.put("rows", stats.get("attachments") + 1); + } + else if (object instanceof ResponseMessage) { // received message + ResponseMessage message = (ResponseMessage) object; + listener.onMessageReceived(message.getMessage()); + } + else { + throw new ClientModelException("Unknown object type received: [" + object.getClass().getName() + + "] - " + object); + } + } + } +} diff --git a/WSF/src/main/java/org/gusdb/wsf/client/WsfResponseListener.java b/WSF/src/main/java/org/gusdb/wsf/client/WsfResponseListener.java new file mode 100644 index 0000000000..dd7b8d92ed --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/client/WsfResponseListener.java @@ -0,0 +1,12 @@ +package org.gusdb.wsf.client; + + + +public interface WsfResponseListener { + + void onRowReceived(String[] row) throws ClientModelException, ClientUserException; + + void onAttachmentReceived(String key, String content) throws ClientModelException, ClientUserException; + + void onMessageReceived(String message) throws ClientModelException, ClientUserException; +} diff --git a/WSF/src/main/java/org/gusdb/wsf/common/ResponseAttachment.java b/WSF/src/main/java/org/gusdb/wsf/common/ResponseAttachment.java new file mode 100644 index 0000000000..9e6013fddd --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/common/ResponseAttachment.java @@ -0,0 +1,31 @@ +package org.gusdb.wsf.common; + +import java.io.Serializable; + +public class ResponseAttachment implements Serializable { + + private static final long serialVersionUID = 1L; + + private final String key; + private final String content; + + public ResponseAttachment(String key, String content) { + this.key = key; + this.content = content; + } + + /** + * @return the key + */ + public String getKey() { + return key; + } + + /** + * @return the content + */ + public String getContent() { + return content; + } + +} diff --git a/WSF/src/main/java/org/gusdb/wsf/common/ResponseMessage.java b/WSF/src/main/java/org/gusdb/wsf/common/ResponseMessage.java new file mode 100644 index 0000000000..2aac187cce --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/common/ResponseMessage.java @@ -0,0 +1,22 @@ +package org.gusdb.wsf.common; + +import java.io.Serializable; + +public class ResponseMessage implements Serializable { + + private static final long serialVersionUID = 1L; + + private final String message; + + public ResponseMessage(String message) { + this.message = message; + } + + /** + * @return the message + */ + public String getMessage() { + return message; + } + +} diff --git a/WSF/src/main/java/org/gusdb/wsf/common/ResponseRow.java b/WSF/src/main/java/org/gusdb/wsf/common/ResponseRow.java new file mode 100644 index 0000000000..a0b3bdd088 --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/common/ResponseRow.java @@ -0,0 +1,22 @@ +package org.gusdb.wsf.common; + +import java.io.Serializable; + +public class ResponseRow implements Serializable { + + private static final long serialVersionUID = 1L; + + private final String[] row; + + public ResponseRow(String[] row) { + this.row = row; + } + + /** + * @return the row + */ + public String[] getRow() { + return row; + } + +} diff --git a/WSF/src/main/java/org/gusdb/wsf/common/ResponseStatus.java b/WSF/src/main/java/org/gusdb/wsf/common/ResponseStatus.java new file mode 100644 index 0000000000..6d5c66834f --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/common/ResponseStatus.java @@ -0,0 +1,43 @@ +package org.gusdb.wsf.common; + +import java.io.Serializable; + +public class ResponseStatus implements Serializable { + + private static final long serialVersionUID = 1L; + + private int signal; + + private Exception exception; + + public void setSignal(int signal) { + this.signal = signal; + } + + /** + * @return the signal + */ + public int getSignal() { + return signal; + } + + /** + * @return the exception + */ + public Exception getException() { + return exception; + } + + /** + * @param exception + * the exception to set + */ + public void setException(Exception exception) { + this.exception = exception; + } + + @Override + public String toString() { + return "signal=" + signal + ", exception=" + exception; + } +} diff --git a/WSF/src/main/java/org/gusdb/wsf/common/WsfRequest.java b/WSF/src/main/java/org/gusdb/wsf/common/WsfRequest.java new file mode 100644 index 0000000000..5bbff28840 --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/common/WsfRequest.java @@ -0,0 +1,38 @@ +package org.gusdb.wsf.common; + +import java.util.Map; + +public interface WsfRequest { + + String PARAM_REQUEST = "request"; + + /** + * @return the projectId + */ + String getProjectId(); + + /** + * @return the params + */ + Map getParams(); + + /** + * @return the orderedColumns + */ + String[] getOrderedColumns(); + + /** + * @return a map of ordered columns, where the key is the column name, and the + * value is the zero-based order of that column. + */ + Map getColumnMap(); + + /** + * The context can be used to hold additional information, such as user id, + * calling query name, etc, which can be used by plugins. + * + * @return the context + */ + Map getContext(); + +} diff --git a/WSF/src/main/java/org/gusdb/wsf/plugin/AbstractPlugin.java b/WSF/src/main/java/org/gusdb/wsf/plugin/AbstractPlugin.java new file mode 100644 index 0000000000..faec20b190 --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/plugin/AbstractPlugin.java @@ -0,0 +1,292 @@ +package org.gusdb.wsf.plugin; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.util.InvalidPropertiesFormatException; +import java.util.List; +import java.util.Optional; +import java.util.Properties; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import javax.sql.DataSource; + +import org.apache.log4j.Logger; +import org.gusdb.fgputil.FormatUtil; +import org.gusdb.fgputil.db.stream.ResultSets; +import org.gusdb.fgputil.runtime.GusHome; + +/** + * An abstract super class for all WSF plugins. This class is a SINGLETON. + * Instance variables apply to all calls of the plugin. + * + * @author Jerric + * @since Feb 9, 2006 + */ +public abstract class AbstractPlugin implements Plugin { + + protected abstract int execute(PluginRequest request, PluginResponse response) throws PluginModelException, + PluginUserException, DelayedResultException; + + /** + * The logger for this plugin. It is a recommended way to record standard + * output and error messages. + */ + private static final Logger LOG = Logger.getLogger(AbstractPlugin.class); + + /** + * It stores the properties defined in the configuration file. If the plugin + * doesn't use a configuration file, this map is empty. + */ + protected Properties properties; + + private String propertyFile; + + /** + * Initialize a plugin with empty properties + */ + public AbstractPlugin() { + properties = new Properties(); + } + + /** + * Initialize a plugin and assign a property file to it + * + * @param propertyFile + * the name of the property file. The base class will resolve the path to + * this file, which should be under the WEB-INF of axis' webapps. + */ + public AbstractPlugin(String propertyFile) { + this(); + this.propertyFile = propertyFile; + } + + @Override + public void initialize(PluginRequest request) throws PluginModelException { + // load the properties + if (propertyFile != null) { + try { + loadConfiguration(); + } + catch (IOException ex) { + LOG.error(ex); + throw new PluginModelException(ex); + } + } + } + + @Override + public int invoke(PluginRequest request, PluginResponse response) throws PluginModelException, + PluginUserException, DelayedResultException { + try { + return execute(request, response); + } + catch (PluginModelException ex) { + throw ex; + } + } + + private void loadConfiguration() throws InvalidPropertiesFormatException, IOException, PluginModelException { + String configDir = null; + String filePath; + + String gusHome = GusHome.getGusHome(); + if (gusHome != null) + configDir = gusHome + "/config/"; + + // if config is null, try loading the resource from class path root. + if (configDir == null) { + URL url = this.getClass().getResource("/" + propertyFile); + if (url == null) + throw new PluginModelException("property file cannot be found " + "in the class path: " + + propertyFile); + + filePath = url.toString(); + } + else { + if (!configDir.endsWith("/")) + configDir += "/"; + String path = configDir + propertyFile; + File file = new File(path); + if (!file.exists() || !file.isFile()) + throw new PluginModelException("property file cannot be found " + " in the configuration path: " + + path); + + filePath = path; + } + LOG.debug("WSF Plugin prop file: " + filePath); + + InputStream in = new FileInputStream(filePath); + properties.loadFromXML(in); + in.close(); + } + + protected String getProperty(String propertyName) { + return properties.getProperty(propertyName); + } + + protected boolean hasProperty(String propertyName) { + return properties.containsKey(propertyName); + } + + protected int invokeCommand(String[] command, StringBuffer result, long timeout) + throws PluginUserException, PluginModelException { + return invokeCommand(command, result, timeout, null); + } + + /** + * @param command + * the command array. If you have param values with spaces in it, put the + * value into one cell to avoid the value to be splitted. + * @param timeout + * the maximum allowed time for the command to run, in seconds + * @param result + * Contains raw output of the command. + * @param env + * a string including env variables, as expected by exec. Useful to pass in + * a PATH + * + * @return the exit code of the invoked command + * + * @throws PluginUserException + * if user input is invalid + * @throws PluginModelException + * if something goes wrong during execution + */ + protected int invokeCommand(String[] command, StringBuffer result, long timeout, String[] env) + throws PluginUserException, PluginModelException { + LOG.info("WsfPlugin.invokeCommand: " + FormatUtil.printArray(command)); + // invoke the command + Process process; + try { + process = Runtime.getRuntime().exec(command, env); + } + catch (IOException ex) { + throw new PluginModelException(ex); + } + + StringBuffer sbErr = new StringBuffer(); + StringBuffer sbOut = new StringBuffer(); + + // any error message? + StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), "ERROR", sbErr); + // any output? + StreamGobbler outputGobbler = new StreamGobbler(process.getInputStream(), "OUTPUT", sbOut); + LOG.info("kicking off the stderr and stdout stream gobbling threads..."); + errorGobbler.start(); + outputGobbler.start(); + + long start = System.currentTimeMillis(); + long limit = timeout * 1000; + // check the exit value of the process; if the process is not + // finished yet, an IllegalThreadStateException is thrown out + int signal = -1; + while (true) { + //LOG.debug("waiting for 1 second ..."); + try { + Thread.sleep(1000); + } + catch (InterruptedException ex) { + // do nothing, keep looping + } + + try { + signal = process.exitValue(); // throws IllegalThreadStateException if the process is still running. + + // process is stopped. + result.append((signal == 0) ? sbOut : sbErr); + break; + } + catch (IllegalThreadStateException ex) { + // if the timeout is set to <= 0, keep waiting till the process + // is finished + if (timeout <= 0) + continue; + + // otherwise, check if time's up + long time = System.currentTimeMillis() - start; + if (time > limit) { + // convert string array to string + StringBuilder buffer = new StringBuilder(); + for (String piece : command) { + if (buffer.length() > 0) + buffer.append(" "); + buffer.append(piece); + } + LOG.warn("Time out, the command is cancelled: " + buffer); + outputGobbler.close(); + errorGobbler.close(); + process.destroy(); + throw new PluginTimeoutException("Time out, " + timeout/60 + " minutes, the command is cancelled. We suggest you review the input parameters and try again.\n"); + } + } + } + return signal; + } + + class StreamGobbler extends Thread { + + InputStream is; + String type; + StringBuffer sb; + + StreamGobbler(InputStream is, String type, StringBuffer sb) { + this.is = is; + this.type = type; + this.sb = sb; + } + + @Override + public void run() { + try { + BufferedReader br = new BufferedReader(new InputStreamReader(is)); + String line; + while ((line = br.readLine()) != null) { + // sb.append(type + ">" + line); + sb.append(line + FormatUtil.NL); + } + } + catch (IOException ex) { + ex.printStackTrace(); + } + finally { + try { + is.close(); + } + catch (IOException ex) { + ex.printStackTrace(); + } + } + } + + public void close() { + try { + is.close(); + } + catch (IOException ex) { + ex.printStackTrace(); + } + } + } + + /** + * Run an sql select statement to acquire a list value to use as a parameter. + * + * @return a list comprised of the values found in the first column of the sql + * result + */ + protected List getParamValueFromSql(String sql, String queryDescrip, DataSource dataSource) throws PluginModelException { + try(Stream values = ResultSets.openStream(dataSource, sql, queryDescrip, + rs -> Optional.of(rs.getString(1)))) { + return values.collect(Collectors.toList()); + } + catch (Exception ex) { + throw new PluginModelException(ex); + } + } +} diff --git a/WSF/src/main/java/org/gusdb/wsf/plugin/DelayedResultException.java b/WSF/src/main/java/org/gusdb/wsf/plugin/DelayedResultException.java new file mode 100644 index 0000000000..7e88103b4e --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/plugin/DelayedResultException.java @@ -0,0 +1,5 @@ +package org.gusdb.wsf.plugin; + +public class DelayedResultException extends Exception { + +} diff --git a/WSF/src/main/java/org/gusdb/wsf/plugin/Plugin.java b/WSF/src/main/java/org/gusdb/wsf/plugin/Plugin.java new file mode 100644 index 0000000000..c0d817533e --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/plugin/Plugin.java @@ -0,0 +1,52 @@ +package org.gusdb.wsf.plugin; + +/** + * @author Jerric + * @since Feb 10, 2006 + */ +public interface Plugin { + + /** + * Invoke a plugin, using the parameters in the request, and save the result + * into response. + * + * @return the signal set by the plugin + */ + int invoke(PluginRequest request, PluginResponse response) + throws PluginModelException, PluginUserException, DelayedResultException; + + /** + * The Plugin needs to provide a list of required parameter names; the base + * class will use this template method in the input validation process. + * + * @return returns an array the names of the required parameters + */ + String[] getRequiredParameterNames(); + + /** + * The Plugin needs to provides a list of the columns expected in the result; + * the base class will use this template method in the input validation + * process. + * @param request + * + * @return returns an array the columns expected in the result + * @throws PluginModelException + */ + String[] getColumns(PluginRequest request) throws PluginModelException; + + /** + * Initialize the plugin instance. + * + * @param request that spurred creation of this plugin + */ + void initialize(PluginRequest request) throws PluginModelException; + + /** + * Validate the parameters passed by the service. This validation confirms + * that the service (the wdk model) has parameter options that agree with this + * plugin's API. + */ + void validateParameters(PluginRequest request) + throws PluginModelException, PluginUserException; + +} diff --git a/WSF/src/main/java/org/gusdb/wsf/plugin/PluginExecutor.java b/WSF/src/main/java/org/gusdb/wsf/plugin/PluginExecutor.java new file mode 100644 index 0000000000..d7a205a43f --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/plugin/PluginExecutor.java @@ -0,0 +1,88 @@ +package org.gusdb.wsf.plugin; + +import java.lang.reflect.InvocationTargetException; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.apache.log4j.Logger; + +public class PluginExecutor { + + private static final Logger LOG = Logger.getLogger(PluginExecutor.class); + + public int execute(String pluginClassName, PluginRequest request, PluginResponse response) + throws PluginModelException, PluginUserException, DelayedResultException { + LOG.info("Invoking: " + pluginClassName + ", projectId: " + request.getProjectId()); + LOG.debug("request: " + request.toString()); + + // use reflection to load the plugin object + LOG.debug("Loading object " + pluginClassName); + + LOG.info("Creating plugin " + pluginClassName); + + try { + Class pluginClass = Class.forName(pluginClassName).asSubclass(Plugin.class); + Plugin plugin = pluginClass.getDeclaredConstructor().newInstance(); + + // initialize plugin + plugin.initialize(request); + + // invoke the plugin + LOG.debug("Invoking Plugin " + pluginClassName); + return invokePlugin(plugin, request, response); + } + catch (ClassNotFoundException | InstantiationException | IllegalAccessException | + IllegalArgumentException | InvocationTargetException | + NoSuchMethodException | SecurityException ex) { + throw new PluginModelException(ex); + } + } + + private int invokePlugin(Plugin plugin, PluginRequest request, PluginResponse response) + throws PluginModelException, PluginUserException, DelayedResultException { + // validate required parameters + LOG.debug("validing required params..."); + validateRequiredParameters(plugin, request); + + // validate columns + LOG.debug("validating columns..."); + validateColumns(plugin, request); + + // validate parameters + LOG.debug("validating params..."); + plugin.validateParameters(request); + + // execute the main function, and obtain result + LOG.debug("invoking plugin..."); + return plugin.invoke(request, response); + } + + private void validateRequiredParameters(Plugin plugin, PluginRequest request) throws PluginUserException { + String[] reqParams = plugin.getRequiredParameterNames(); + + // validate parameters + Map params = request.getParams(); + for (String param : reqParams) { + if (!params.containsKey(param)) { + throw new PluginUserException("The required parameter is missing: " + param); + } + } + } + + private void validateColumns(Plugin plugin, PluginRequest request) throws PluginUserException, PluginModelException { + String[] expectedColumns = request.getOrderedColumns(); + String[] requiredColumns = plugin.getColumns(request); + + Set colSet = new HashSet(); + for (String col : expectedColumns) { + colSet.add(col); + } + for (String col : requiredColumns) { + if (!colSet.contains(col)) { + throw new PluginUserException("The required column is missing: " + col); + } + } + } + +} diff --git a/WSF/src/main/java/org/gusdb/wsf/plugin/PluginModelException.java b/WSF/src/main/java/org/gusdb/wsf/plugin/PluginModelException.java new file mode 100644 index 0000000000..82097ac4a9 --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/plugin/PluginModelException.java @@ -0,0 +1,31 @@ +package org.gusdb.wsf.plugin; + +/** + * @author Jerric + */ +public class PluginModelException extends Exception { + + private static final long serialVersionUID = 2; + + public PluginModelException() { + super(); + } + + public PluginModelException(String message) { + super(message); + } + + public PluginModelException(String message, Throwable cause) { + super(message, cause); + } + + public PluginModelException(Throwable cause) { + super(cause.getMessage(), cause); + } + + public PluginModelException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } + +} diff --git a/WSF/src/main/java/org/gusdb/wsf/plugin/PluginRequest.java b/WSF/src/main/java/org/gusdb/wsf/plugin/PluginRequest.java new file mode 100644 index 0000000000..9925683658 --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/plugin/PluginRequest.java @@ -0,0 +1,216 @@ +package org.gusdb.wsf.plugin; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.gusdb.fgputil.json.JsonUtil; +import org.gusdb.wsf.common.WsfRequest; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +/** + * @author jerric + */ +public class PluginRequest implements WsfRequest { + + public static final String PROJECT_KEY = "project"; + public static final String COLUMNS_ARRAY_KEY = "ordered-columns"; + public static final String PARAMETER_MAP_KEY = "parameters"; + public static final String CONTEXT_MAP_KEY = "context"; + + private String _projectId; + private Map _params; + private List _orderedColumns; + private Map _context = new HashMap<>(); + + public PluginRequest() { + this._params = new HashMap<>(); + this._orderedColumns = new ArrayList<>(); + this._context = new HashMap<>(); + } + + public PluginRequest(PluginRequest request) { + this._projectId = request.getProjectId(); + this._params = new HashMap<>(request.getParams()); + this._orderedColumns = new ArrayList<>(Arrays.asList(request.getOrderedColumns())); + this._context = new HashMap<>(request.getContext()); + } + + public PluginRequest(String jsonString) throws PluginModelException { + try { + parseJSON(new JSONObject(jsonString)); + } + catch (JSONException ex) { + throw new PluginModelException(ex); + } + } + + public int getChecksum() { + String content = toString(); + int checksum = 0; + for (int i = 0; i < content.length(); i++) { + checksum ^= content.charAt(i); + } + return checksum; + } + + protected JSONObject getJSON() throws JSONException { + JSONObject jsRequest = new JSONObject(); + jsRequest.put(PROJECT_KEY, getProjectId()); + + // output columns + JSONArray jsColumns = new JSONArray(); + for (String column : getOrderedColumns()) { + jsColumns.put(column); + } + jsRequest.put(COLUMNS_ARRAY_KEY, jsColumns); + + // output params + JSONObject jsParams = new JSONObject(); + Map params = getParams(); + for (String paramName : params.keySet()) { + jsParams.put(paramName, params.get(paramName)); + } + jsRequest.put(PARAMETER_MAP_KEY, jsParams); + + // output request context + JSONObject jsContext = new JSONObject(); + Map context = getContext(); + for (String contextKey : context.keySet()) { + jsContext.put(contextKey, context.get(contextKey)); + } + jsRequest.put(CONTEXT_MAP_KEY, jsContext); + return jsRequest; + } + + @Override + public String toString() { + try { + return getJSON().toString(); + } + catch (JSONException ex) { + throw new RuntimeException(ex); + } + } + + protected void parseJSON(JSONObject jsRequest) throws JSONException { + if (jsRequest.has(PROJECT_KEY)) + setProjectId(jsRequest.getString(PROJECT_KEY)); + + JSONArray jsColumns = jsRequest.getJSONArray(COLUMNS_ARRAY_KEY); + List columns = new ArrayList<>(); + for (int i = 0; i < jsColumns.length(); i++) { + columns.add(jsColumns.getString(i)); + } + setOrderedColumns(columns.toArray(new String[0])); + + Map params = new LinkedHashMap<>(); + addToMap(params, jsRequest.getJSONObject(PARAMETER_MAP_KEY)); + setParams(params); + + Map context = new LinkedHashMap<>(); + addToMap(context, jsRequest.getJSONObject(CONTEXT_MAP_KEY)); + setContext(context); + } + + private static void addToMap(Map map, JSONObject newValues) throws JSONException { + for (String key : JsonUtil.getKeys(newValues)) { + map.put(key, newValues.getString(key)); + } + } + + /** + * @return the projectId + */ + @Override + public String getProjectId() { + return _projectId; + } + + /** + * @param projectId + * the projectId to set + */ + public void setProjectId(String projectId) { + this._projectId = projectId; + } + + /** + * @return the params + */ + @Override + public Map getParams() { + return new HashMap<>(_params); + } + + /** + * @param params + * the params to set + */ + public void setParams(Map params) { + this._params = new HashMap<>(params); + } + + public void putParam(String name, String value) { + this._params.put(name, value); + } + + /** + * @return the orderedColumns + */ + @Override + public String[] getOrderedColumns() { + String[] array = new String[_orderedColumns.size()]; + _orderedColumns.toArray(array); + return array; + } + + /** + * @return a map of ordered columns, where the key is the column name, and the + * value is the zero-based order of that column. + */ + @Override + public Map getColumnMap() { + Map map = new LinkedHashMap<>(); + for (int i = 0; i < _orderedColumns.size(); i++) { + map.put(_orderedColumns.get(i), i); + } + return map; + } + + /** + * @param orderedColumns + * the orderedColumns to set + */ + public void setOrderedColumns(String[] orderedColumns) { + this._orderedColumns = new ArrayList<>(orderedColumns.length); + for (String column : orderedColumns) { + this._orderedColumns.add(column); + } + } + + /** + * The context can be used to hold additional information, such as user id, + * calling query name, etc, which can be used by plugins. + * + * @return the context + */ + @Override + public Map getContext() { + return new HashMap<>(_context); + } + + /** + * @param context + * the context to set + */ + public void setContext(Map context) { + this._context = new HashMap<>(context); + } + +} diff --git a/WSF/src/main/java/org/gusdb/wsf/plugin/PluginResponse.java b/WSF/src/main/java/org/gusdb/wsf/plugin/PluginResponse.java new file mode 100644 index 0000000000..365ebcd453 --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/plugin/PluginResponse.java @@ -0,0 +1,11 @@ +package org.gusdb.wsf.plugin; + + +public interface PluginResponse { + + void addRow(String[] row) throws PluginModelException, PluginUserException; + + void addAttachment(String key, String content) throws PluginModelException, PluginUserException; + + void setMessage(String message) throws PluginModelException, PluginUserException; +} diff --git a/WSF/src/main/java/org/gusdb/wsf/plugin/PluginTimeoutException.java b/WSF/src/main/java/org/gusdb/wsf/plugin/PluginTimeoutException.java new file mode 100644 index 0000000000..194151ac03 --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/plugin/PluginTimeoutException.java @@ -0,0 +1,34 @@ +package org.gusdb.wsf.plugin; + + + +/** + * @author Cristina + * @since Feb 21, 2017 + */ +public class PluginTimeoutException extends PluginModelException { + + private static final long serialVersionUID = 2; + + public PluginTimeoutException() { + super(); + } + + public PluginTimeoutException(String message) { + super(message); + } + + public PluginTimeoutException(String message, Throwable cause) { + super(message, cause); + } + + public PluginTimeoutException(Throwable cause) { + super(cause.getMessage(), cause); + } + + public PluginTimeoutException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } + +} diff --git a/WSF/src/main/java/org/gusdb/wsf/plugin/PluginUserException.java b/WSF/src/main/java/org/gusdb/wsf/plugin/PluginUserException.java new file mode 100644 index 0000000000..6fcb2f80f5 --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/plugin/PluginUserException.java @@ -0,0 +1,30 @@ +package org.gusdb.wsf.plugin; + +/** + * @author Jerric + */ +public class PluginUserException extends Exception { + + private static final long serialVersionUID = 2; + + public PluginUserException() { + } + + public PluginUserException(String message) { + super(message); + } + + public PluginUserException(Throwable cause) { + super(cause); + } + + public PluginUserException(String message, Throwable cause) { + super(message, cause); + } + + public PluginUserException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } + +} diff --git a/WSF/src/main/java/org/gusdb/wsf/service/ServiceModelException.java b/WSF/src/main/java/org/gusdb/wsf/service/ServiceModelException.java new file mode 100644 index 0000000000..4bcc154b53 --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/service/ServiceModelException.java @@ -0,0 +1,27 @@ +package org.gusdb.wsf.service; + +public class ServiceModelException extends Exception { + + private static final long serialVersionUID = -9161875379915097906L; + + public ServiceModelException() { + } + + public ServiceModelException(String message) { + super(message); + } + + public ServiceModelException(Throwable cause) { + super(cause); + } + + public ServiceModelException(String message, Throwable cause) { + super(message, cause); + } + + public ServiceModelException(String message, Throwable cause, + boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } + +} diff --git a/WSF/src/main/java/org/gusdb/wsf/service/ServiceRequest.java b/WSF/src/main/java/org/gusdb/wsf/service/ServiceRequest.java new file mode 100644 index 0000000000..40b89fc627 --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/service/ServiceRequest.java @@ -0,0 +1,60 @@ +package org.gusdb.wsf.service; + +import org.gusdb.wsf.plugin.PluginRequest; +import org.json.JSONException; +import org.json.JSONObject; + +/** + * @author jerric + */ +public class ServiceRequest extends PluginRequest { + + private static final String PLUGIN_KEY = "plugin"; + + private String pluginClass; + + public ServiceRequest() { + super(); + } + + public ServiceRequest(ServiceRequest request) { + super(request); + this.pluginClass = request.pluginClass; + } + + public ServiceRequest(String jsonString) throws ServiceModelException { + try { + JSONObject jsRequest = new JSONObject(jsonString); + parseJSON(jsRequest); + this.pluginClass = jsRequest.getString(PLUGIN_KEY); + } + catch (JSONException ex) { + throw new ServiceModelException(ex); + } + } + + /** + * the full class name of the WSF plugin. The service will instantiate a + * plugin instance from this class name, and invoke it. + * + * @return the pluginClass + */ + public String getPluginClass() { + return pluginClass; + } + + /** + * @param pluginClass + * the pluginClass to set + */ + public void setPluginClass(String pluginClass) { + this.pluginClass = pluginClass; + } + + @Override + protected JSONObject getJSON() throws JSONException { + JSONObject jsRequest = super.getJSON(); + jsRequest.put(PLUGIN_KEY, pluginClass); + return jsRequest; + } +} diff --git a/WSF/src/main/java/org/gusdb/wsf/service/StreamingPluginResponse.java b/WSF/src/main/java/org/gusdb/wsf/service/StreamingPluginResponse.java new file mode 100644 index 0000000000..54289368a3 --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/service/StreamingPluginResponse.java @@ -0,0 +1,67 @@ +package org.gusdb.wsf.service; + +import java.io.IOException; +import java.io.ObjectOutputStream; + +import org.gusdb.wsf.common.ResponseAttachment; +import org.gusdb.wsf.common.ResponseMessage; +import org.gusdb.wsf.common.ResponseRow; +import org.gusdb.wsf.plugin.PluginModelException; +import org.gusdb.wsf.plugin.PluginResponse; + +public class StreamingPluginResponse implements PluginResponse { + + private final ObjectOutputStream outStream; + + private int rowCount; + private int attachmentCount; + + public StreamingPluginResponse(ObjectOutputStream outStream) { + this.outStream = outStream; + } + + public int getRowCount() { + return rowCount; + } + + public int getAttachmentCount() { + return attachmentCount; + } + + @Override + public void addRow(String[] row) throws PluginModelException { + ResponseRow responseRow = new ResponseRow(row); + try { + outStream.writeObject(responseRow); + rowCount++; + } + catch (IOException ex) { + throw new PluginModelException(ex); + } + } + + @Override + public void addAttachment(String key, String content) + throws PluginModelException { + ResponseAttachment attachment = new ResponseAttachment(key, content); + try { + outStream.writeObject(attachment); + attachmentCount++; + } + catch (IOException ex) { + throw new PluginModelException(ex); + } + } + + @Override + public void setMessage(String message) throws PluginModelException { + ResponseMessage responseMessage = new ResponseMessage(message); + try { + outStream.writeObject(responseMessage); + } + catch (IOException ex) { + throw new PluginModelException(ex); + } + } + +} diff --git a/WSF/src/main/java/org/gusdb/wsf/service/WsfService.java b/WSF/src/main/java/org/gusdb/wsf/service/WsfService.java new file mode 100644 index 0000000000..73a240031f --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/service/WsfService.java @@ -0,0 +1,101 @@ +package org.gusdb.wsf.service; + +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.io.OutputStream; + +import javax.ws.rs.Consumes; +import javax.ws.rs.FormParam; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.StreamingOutput; + +import org.apache.log4j.Logger; +import org.gusdb.wsf.common.ResponseStatus; +import org.gusdb.wsf.common.WsfRequest; +import org.gusdb.wsf.plugin.PluginExecutor; + +/** + * The WSF Web service entry point. + * + * @author Jerric + * @since Nov 2, 2005 + */ +@Path("/") +public class WsfService { + + public static final String VERSION = "3.0.0"; + + private static final Logger LOG = Logger.getLogger(WsfService.class); + + public WsfService() { + // set up the config dir + // String gusHome = System.getProperty("GUS_HOME"); + // if (gusHome != null) { + // String configPath = gusHome + "/config/"; + // STATIC_CONTEXT.put(Plugin.CTX_CONFIG_PATH, configPath); + // } + LOG.debug("WsfService initialized"); + } + + @POST + @Consumes(MediaType.APPLICATION_FORM_URLENCODED) + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public Response invoke(@FormParam(WsfRequest.PARAM_REQUEST) final String jsonRequest) { + long start = System.currentTimeMillis(); + + // open a StreamingOutput + StreamingOutput output = new StreamingOutput() { + + @Override + public void write(OutputStream outStream) throws IOException { + // prepare to run the plugin + PluginExecutor executor = new PluginExecutor(); + ResponseStatus status = new ResponseStatus(); + + // prepare response + ObjectOutputStream objectStream = new ObjectOutputStream(outStream); + StreamingPluginResponse pluginResponse = new StreamingPluginResponse(objectStream); + int checksum = 0; + try { + ServiceRequest request = new ServiceRequest(jsonRequest); + checksum = request.getChecksum(); + LOG.debug("Invoking WSF: checksum=" + checksum + "\n" + jsonRequest); + + // invoke plugin + int signal = executor.execute(request.getPluginClass(), request, pluginResponse); + status.setSignal(signal); + } + catch (Exception ex) { + status.setSignal(-1); + status.setException(ex); + } + finally { + // send signal back + objectStream.writeObject(status); + objectStream.flush(); + objectStream.close(); + + LOG.debug("WSF Service finished: checksum=" + checksum + ", status=" + status + ", #rows=" + + pluginResponse.getRowCount() + ", #attch=" + pluginResponse.getAttachmentCount()); + } + } + }; + + // get the response + Response response = Response.ok(output).build(); + long end = System.currentTimeMillis(); + LOG.info("WsfService call finished in " + ((end - start) / 1000D) + " seconds"); + return response; + } + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String getInfo() { + return this.getClass().getSimpleName() + " version " + VERSION; + } +} diff --git a/WSF/src/main/java/org/gusdb/wsf/service/WsfServiceApplication.java b/WSF/src/main/java/org/gusdb/wsf/service/WsfServiceApplication.java new file mode 100644 index 0000000000..77f566321e --- /dev/null +++ b/WSF/src/main/java/org/gusdb/wsf/service/WsfServiceApplication.java @@ -0,0 +1,17 @@ +package org.gusdb.wsf.service; + +import java.util.HashSet; +import java.util.Set; + +import javax.ws.rs.core.Application; + +public class WsfServiceApplication extends Application { + + @Override + public Set> getClasses() { + Set> classes = new HashSet<>(); + classes.add(WsfService.class); + return classes; + } + +} diff --git a/build.xml b/build.xml index cadd2edd55..36961131e0 100755 --- a/build.xml +++ b/build.xml @@ -4,15 +4,13 @@ - - - + - @@ -43,7 +41,14 @@ - + + + + + + + + @@ -86,8 +91,7 @@ - + 4.0.0 Web Development Kit @@ -8,6 +10,7 @@ pom + WSF Model Service @@ -21,17 +24,7 @@ org.gusdb - wsf-common - ${project.version} - - - org.gusdb - wsf-plugin - ${project.version} - - - org.gusdb - wsf-client + wdk-wsf ${project.version} @@ -39,21 +32,9 @@ org.gusdb - base-pom + shared-project-pom 1.0.0 - ../FgpUtil/Dependencies/org/gusdb/base-pom/1.0.0/base-pom-1.0.0.pom + ../install/pom.xml - - - eupathdb - EuPathDB Project Dependencies - default - https://raw.githubusercontent.com/EuPathDB/FgpUtil/master/Dependencies/ - - false - - - - diff --git a/psu.xml b/psu.xml deleted file mode 100755 index f06a347eee..0000000000 --- a/psu.xml +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 42799b08dc24a4407a96a863b4fc121995e3026b Mon Sep 17 00:00:00 2001 From: Ryan Doherty Date: Sun, 17 Apr 2022 18:08:42 -0400 Subject: [PATCH 2/5] Fix JavaDoc errors (leave warnings for now) --- .../filter/HttpHeaderLoggerFilter.java | 16 ++++++------ .../controller/filter/MDCServletFilter.java | 20 +++++++------- .../java/org/gusdb/wdk/jmx/mbeans/Cache.java | 2 +- .../org/gusdb/wdk/jmx/mbeans/ModelConfig.java | 4 +-- .../wdk/jmx/mbeans/dbms/AbstractDbInfo.java | 2 +- .../wdk/jmx/mbeans/dbms/DbInfoFactory.java | 6 ++--- .../main/java/org/gusdb/wdk/model/Group.java | 8 +++--- .../java/org/gusdb/wdk/model/GroupSet.java | 7 +---- .../org/gusdb/wdk/model/ModelXmlParser.java | 14 +++++----- .../java/org/gusdb/wdk/model/WdkModel.java | 2 +- .../org/gusdb/wdk/model/WdkModelName.java | 6 +---- .../gusdb/wdk/model/WdkSqlScriptRunner.java | 2 +- .../org/gusdb/wdk/model/WdkUserException.java | 1 - .../java/org/gusdb/wdk/model/WdkView.java | 4 +-- .../wdk/model/answer/SummaryViewHandler.java | 5 ++-- .../spec/ParamsAndFiltersDbColumnFormat.java | 2 +- .../answer/stream/RecordStreamFactory.java | 2 +- .../wdk/model/columntool/ColumnReporter.java | 2 +- .../gusdb/wdk/model/config/ModelConfig.java | 1 - .../wdk/model/config/ModelConfigAppDB.java | 2 +- .../wdk/model/config/ModelConfigBuilder.java | 7 +++-- .../wdk/model/config/ModelConfigUserDB.java | 10 +++---- .../gusdb/wdk/model/config/QueryMonitor.java | 7 ++--- .../org/gusdb/wdk/model/filter/Filter.java | 26 ++++++++----------- .../wdk/model/filter/StrategyFilter.java | 7 ++--- .../wdk/model/fix/EmailListsGenerator.java | 15 ++--------- .../wdk/model/fix/InvalidStepReporter.java | 8 +++--- .../wdk/model/fix/SharedStepsResolver.java | 11 -------- .../wdk/model/fix/StepParamExpander.java | 1 - .../gusdb/wdk/model/fix/StepValidator.java | 10 +++---- .../gusdb/wdk/model/fix/StrategyFixer.java | 22 ++++------------ .../model/fix/table/TableRowInterfaces.java | 2 +- .../wdk/model/migrate/Migrator1_12To1_13.java | 14 ---------- .../wdk/model/migrate/MigratorController.java | 11 +++----- .../gusdb/wdk/model/ontology/Ontology.java | 2 +- .../model/ontology/OntologyFactoryImpl.java | 8 ++---- .../model/ontology/OntologyFactoryPlugin.java | 5 +++- .../gusdb/wdk/model/query/BooleanQuery.java | 1 - .../gusdb/wdk/model/query/ProcessQuery.java | 2 +- .../query/param/AbstractDependentParam.java | 2 +- .../wdk/model/query/param/DateParam.java | 3 --- .../gusdb/wdk/model/query/param/EnumItem.java | 2 +- .../wdk/model/query/param/FilterParamNew.java | 2 +- .../query/param/FilterParamNewHandler.java | 2 +- .../model/query/param/ParamConfiguration.java | 7 +---- .../wdk/model/query/param/ParamReference.java | 3 +-- .../wdk/model/question/AttributeList.java | 18 +------------ .../model/question/QuestionSuggestion.java | 12 ++------- .../wdk/model/question/SearchCategory.java | 7 +++-- .../model/record/AttributeQueryReference.java | 7 +++-- .../record/ResultSizeQueryReference.java | 14 +++------- .../gusdb/wdk/model/record/TableValue.java | 3 +-- .../attribute/ColumnAttributeValue.java | 4 +-- .../record/attribute/LinkAttributeField.java | 6 ++--- .../record/attribute/TextAttributeValue.java | 2 +- .../model/report/util/RecordFormatter.java | 2 +- .../model/report/util/ReporterFactory.java | 2 +- .../org/gusdb/wdk/model/test/CacheCLI.java | 1 - .../gusdb/wdk/model/test/CommandHelper.java | 4 --- .../model/test/QuestionSummaryReporter.java | 1 - .../wdk/model/test/RecordSummaryReporter.java | 11 -------- .../test/stress/InvalidStatusException.java | 23 ++++------------ .../model/test/stress/StressTestAnalyzer.java | 9 +------ .../model/test/stress/StressTestRunner.java | 6 +---- .../wdk/model/test/stress/StressTestTask.java | 10 +------ .../wdk/model/test/stress/StressTester.java | 6 +---- .../gusdb/wdk/model/test/stress/UrlItem.java | 19 ++------------ .../gusdb/wdk/model/user/BasketFactory.java | 3 ++- .../wdk/model/user/FavoriteReference.java | 7 +++-- .../org/gusdb/wdk/model/user/StepFactory.java | 4 +-- .../org/gusdb/wdk/model/user/UserFactory.java | 6 ++--- .../analysis/StepAnalysisFactoryImpl.java | 3 +-- .../InstalledUserDatasetDBActions.java | 1 + .../datastore/UserDatasetEventDBActions.java | 1 + .../datastore/UserDatasetOwnerDBActions.java | 1 + .../datastore/UserDatasetShareDBActions.java | 1 + .../gusdb/wdk/model/xml/XmlAnswerValue.java | 4 --- .../wdk/model/xml/XmlAttributeField.java | 1 - .../wdk/model/xml/XmlAttributeValue.java | 4 --- .../gusdb/wdk/model/xml/XmlDataLoader.java | 1 - .../org/gusdb/wdk/model/xml/XmlQuestion.java | 5 ++-- .../gusdb/wdk/model/xml/XmlQuestionSet.java | 1 - .../gusdb/wdk/model/xml/XmlRecordClass.java | 1 - .../wdk/model/xml/XmlRecordClassSet.java | 1 - .../wdk/model/xml/XmlRecordInstance.java | 1 - .../org/gusdb/wdk/model/xml/XmlRowValue.java | 4 --- .../gusdb/wdk/model/xml/XmlTableField.java | 1 - .../gusdb/wdk/model/xml/XmlTableValue.java | 4 --- .../wdk/service/WdkServiceApplication.java | 2 +- .../wdk/service/annotation/InSchema.java | 8 +++--- .../wdk/service/annotation/OutSchema.java | 9 +++---- .../service/formatter/ProjectFormatter.java | 2 +- .../wdk/service/formatter/StepFormatter.java | 2 +- .../filter/ColumnFilterServiceFormat.java | 4 +-- .../request/strategy/StrategyRequest.java | 2 +- .../service/request/user/BasketRequests.java | 1 - .../request/user/FavoriteRequests.java | 3 +-- .../service/service/AbstractWdkService.java | 4 +-- .../wdk/service/service/AnswerService.java | 12 ++++----- .../wdk/service/service/QuestionService.java | 2 +- .../service/search/ColumnFilterService.java | 2 +- .../service/search/ColumnReporterService.java | 4 +-- .../service/service/user/DatasetService.java | 4 +-- .../service/user/PreferenceService.java | 14 +++++----- .../service/user/StepAnalysisFormService.java | 2 +- .../user/StepAnalysisInstanceService.java | 4 +-- .../wdk/service/service/user/UserService.java | 3 +-- 107 files changed, 193 insertions(+), 411 deletions(-) diff --git a/Model/src/main/java/org/gusdb/wdk/controller/filter/HttpHeaderLoggerFilter.java b/Model/src/main/java/org/gusdb/wdk/controller/filter/HttpHeaderLoggerFilter.java index 73df62e510..9e7025ecc8 100644 --- a/Model/src/main/java/org/gusdb/wdk/controller/filter/HttpHeaderLoggerFilter.java +++ b/Model/src/main/java/org/gusdb/wdk/controller/filter/HttpHeaderLoggerFilter.java @@ -24,14 +24,14 @@ * the definition of the servlet. For example:

* *
- * 
- *   httpHeaderLogger
- *   org.gusdb.wdk.controller.filter.HttpHeaderLoggerFilter
- * 
- * 
- *   httpHeaderLogger
- *   *.do
- * 
+ * <filter>
+ *   <filter-name>httpHeaderLogger</filter-name>
+ *   <filter-class>org.gusdb.wdk.controller.filter.HttpHeaderLoggerFilter</filter-class>
+ * </filter>
+ * <filter-mapping>
+ *   <filter-name>httpHeaderLogger</filter-name>
+ *   <url-pattern>*.do</url-pattern>
+ * </filter-mapping>
  * 
* * @author rdoherty diff --git a/Model/src/main/java/org/gusdb/wdk/controller/filter/MDCServletFilter.java b/Model/src/main/java/org/gusdb/wdk/controller/filter/MDCServletFilter.java index 8bf28bf8b5..90cb2df84c 100644 --- a/Model/src/main/java/org/gusdb/wdk/controller/filter/MDCServletFilter.java +++ b/Model/src/main/java/org/gusdb/wdk/controller/filter/MDCServletFilter.java @@ -24,15 +24,17 @@ * * To use this filter, add the following to web.xml: * - * - * MDCServletFilter - * org.gusdb.wdk.controller.filter.MDCServletFilter - * - * - * MDCServletFilter - * /* - * - * + *
+ *   <filter>
+ *     <filter-name>MDCServletFilter</filter-name>
+ *     <filter-class>org.gusdb.wdk.controller.filter.MDCServletFilter</filter-class>
+ *   </filter>
+ *   <filter-mapping>
+ *     <filter-name>MDCServletFilter</filter-name>
+ *     <url-pattern>/*</url-pattern>
+ *   </filter-mapping>
+ * 
+ * * Then use the above properties as %X{param} in your log4j configuration. For * example, in log4j.properties: * diff --git a/Model/src/main/java/org/gusdb/wdk/jmx/mbeans/Cache.java b/Model/src/main/java/org/gusdb/wdk/jmx/mbeans/Cache.java index de82a0c77f..0dc58f6107 100644 --- a/Model/src/main/java/org/gusdb/wdk/jmx/mbeans/Cache.java +++ b/Model/src/main/java/org/gusdb/wdk/jmx/mbeans/Cache.java @@ -137,7 +137,7 @@ public boolean getWdkIsCaching() { * Disabling the caching can be useful when benchmarking * database and system tunings. * - * @see org.gusdb.wdk.model.config.ModelConfig#setCaching + * @see org.gusdb.wdk.model.config.ModelConfig#isCaching */ @Override public void toggleWdkIsCaching() { diff --git a/Model/src/main/java/org/gusdb/wdk/jmx/mbeans/ModelConfig.java b/Model/src/main/java/org/gusdb/wdk/jmx/mbeans/ModelConfig.java index d95898c5e3..d4ce7a0a72 100644 --- a/Model/src/main/java/org/gusdb/wdk/jmx/mbeans/ModelConfig.java +++ b/Model/src/main/java/org/gusdb/wdk/jmx/mbeans/ModelConfig.java @@ -7,8 +7,8 @@ * that the WDK may have added or removed or even changed some values * relative to the state on the filesystem. * - * @see org.gusdb.wdk.jmx.mbeans.AbstractConfig#setValuesFromGetters - * @see org.gusdb.wdk.model.ModelConfig + * @see org.gusdb.wdk.jmx.mbeans.AbstractAttributesBean#setValuesFromGetters + * @see org.gusdb.wdk.model.config.ModelConfig * @see org.gusdb.wdk.model.config.ModelConfigUserDB * @see org.gusdb.wdk.model.config.ModelConfigAppDB */ diff --git a/Model/src/main/java/org/gusdb/wdk/jmx/mbeans/dbms/AbstractDbInfo.java b/Model/src/main/java/org/gusdb/wdk/jmx/mbeans/dbms/AbstractDbInfo.java index 7bedf501fa..bfd5967c98 100644 --- a/Model/src/main/java/org/gusdb/wdk/jmx/mbeans/dbms/AbstractDbInfo.java +++ b/Model/src/main/java/org/gusdb/wdk/jmx/mbeans/dbms/AbstractDbInfo.java @@ -206,7 +206,7 @@ public void populateDbfSizeOnDisk(HashMap dbfSizeOnDiskMap) { * add an 'isValid' column with one of the follow values: * * 0 if the link is valid. More precisely, the query - * 'select 1 from dual@' returns a row. + * 'select 1 from dual[@dblink]' returns a row. * * 1 if the link is invalid. More precisely, if the link test throws an SqlException, as * is typical for bad username/password or when the host name could not be resolved. diff --git a/Model/src/main/java/org/gusdb/wdk/jmx/mbeans/dbms/DbInfoFactory.java b/Model/src/main/java/org/gusdb/wdk/jmx/mbeans/dbms/DbInfoFactory.java index cf072f5887..3d6e3987c5 100644 --- a/Model/src/main/java/org/gusdb/wdk/jmx/mbeans/dbms/DbInfoFactory.java +++ b/Model/src/main/java/org/gusdb/wdk/jmx/mbeans/dbms/DbInfoFactory.java @@ -5,11 +5,11 @@ public class DbInfoFactory { /** - * Returns an implementation of DBInfo appropriate for the given platform + * Returns an implementation of DBInfo appropriate for the given db * - * @param platform platform for which DBInfo is desired + * @param db instance for which info should be extracted * @return appropriate implementation of DBInfo - * @throws IllegalArgumentException if no DBInfo exists for the given platform + * @throws IllegalArgumentException if no DBInfo exists for the given db */ public static DbInfo getDbInfo(DatabaseInstance db) { switch (db.getConfig().getPlatformEnum()) { diff --git a/Model/src/main/java/org/gusdb/wdk/model/Group.java b/Model/src/main/java/org/gusdb/wdk/model/Group.java index 5ab7582e60..4b8c97b225 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/Group.java +++ b/Model/src/main/java/org/gusdb/wdk/model/Group.java @@ -5,16 +5,14 @@ /** *

- * Currently, a group is only used to group {@link Param}s together in the + * Currently, a group is only used to group {@link org.gusdb.wdk.model.query.param.Param}s together in the * question page for display/layout purpose. *

* - *

If a {@link Param} is not assigned to any group, it will be assigned to the + *

If a {@link org.gusdb.wdk.model.query.param.Param} is not assigned to any group, it will be assigned to the * default {@link Group#Empty} group.

* - * @author: xingao - * @created: Mar 1, 2007 - * @updated: Mar 1, 2007 + * @author xingao */ public class Group extends WdkModelBase { diff --git a/Model/src/main/java/org/gusdb/wdk/model/GroupSet.java b/Model/src/main/java/org/gusdb/wdk/model/GroupSet.java index 6660ced4f9..567eeb82ec 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/GroupSet.java +++ b/Model/src/main/java/org/gusdb/wdk/model/GroupSet.java @@ -1,6 +1,3 @@ -/** - * - */ package org.gusdb.wdk.model; import java.util.ArrayList; @@ -11,9 +8,7 @@ /** * A model set used to contain {@code } tags. * - * @author: Jerric - * @created: Mar 1, 2007 - * @updated: Mar 1, 2007 + * @author Jerric */ public class GroupSet extends WdkModelBase implements ModelSetI { diff --git a/Model/src/main/java/org/gusdb/wdk/model/ModelXmlParser.java b/Model/src/main/java/org/gusdb/wdk/model/ModelXmlParser.java index 8dfd27deab..97b5d353c4 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/ModelXmlParser.java +++ b/Model/src/main/java/org/gusdb/wdk/model/ModelXmlParser.java @@ -136,8 +136,8 @@ * *

* First, the parser will start from the top level model file, and get sub-model files from the - * {@code } tag. currently, we only support {@code } in the top level model file, and - * sub-model file cannot have {@code } to other sub-models. + * {@code <import>} tag. currently, we only support {@code <import>} in the top level model file, and + * sub-model file cannot have {@code <import>} to other sub-models. *

* *

@@ -159,12 +159,12 @@ * *

* Next, a DOM will be created for each top level and sub-model, and DOM of sub-model will be injected into - * top level model. the {@code } root tag in each sub-model will be ignored, but all its child - * elements will be inserted into the {@code } in the top level DOM. + * top level model. the {@code <wdkModel>} root tag in each sub-model will be ignored, but all its child + * elements will be inserted into the {@code <wdkModel>} in the top level DOM. *

* *

- * Next, the DOM will be streamed into Apache {@link org.apache.commons.digester.Digester}, and a + * Next, the DOM will be streamed into Apache {@link org.apache.commons.digester3.Digester}, and a * {@link WdkModel} object will be created. *

* @@ -178,9 +178,9 @@ *

* Lastly, {@link WdkModel#resolveReferences} will be called and object references will be resolved, for * example, a {@link Question} object will have a reference to {@link RecordClass} object. In certain cases, a - * clone will be created, such as a {@link Question will have a copy of the ID {@link Query}, and a + * clone will be created, such as a {@link Question} will have a copy of the ID {@link Query}, and a * {@link Query} will have a local copy of all the {@link Param}s because the properties of a {@link Param} - * can be overriden in the {@code } inside of {@code , , and }. + * can be overriden in the {@code <paramRef>} inside of {@code <question>, <sqlQuery>, and <processQuery>}. *

* * @author jerric diff --git a/Model/src/main/java/org/gusdb/wdk/model/WdkModel.java b/Model/src/main/java/org/gusdb/wdk/model/WdkModel.java index 2a9526f253..dc202f02e7 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/WdkModel.java +++ b/Model/src/main/java/org/gusdb/wdk/model/WdkModel.java @@ -536,7 +536,7 @@ public void setResources() throws WdkModelException { /** * This method should happen after the resolveReferences, since projectId is set by this method from - * modelConfig <- I am a horrible comment, explore later (resolveReferences is called in this method) + * modelConfig <-- I am a horrible comment, explore later (resolveReferences is called in this method) */ public void configure(ModelConfig modelConfig) throws WdkModelException { diff --git a/Model/src/main/java/org/gusdb/wdk/model/WdkModelName.java b/Model/src/main/java/org/gusdb/wdk/model/WdkModelName.java index 1b4a237ec4..c2cacc729d 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/WdkModelName.java +++ b/Model/src/main/java/org/gusdb/wdk/model/WdkModelName.java @@ -1,14 +1,10 @@ -/** - * - */ package org.gusdb.wdk.model; /** - * An object representation of the tag in the WDK model file. it + * An object representation of the <modelName> tag in the WDK model file. it * defines the project name, version, and other release information. * * @author Jerric - * */ public class WdkModelName extends WdkModelBase { diff --git a/Model/src/main/java/org/gusdb/wdk/model/WdkSqlScriptRunner.java b/Model/src/main/java/org/gusdb/wdk/model/WdkSqlScriptRunner.java index a8146f5aae..fc37486c44 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/WdkSqlScriptRunner.java +++ b/Model/src/main/java/org/gusdb/wdk/model/WdkSqlScriptRunner.java @@ -16,7 +16,7 @@ /** * Runs an SQL script against a WDK app, user, or account database. Simply run: * - * > fgpJava org.gusdb.wdk.model.WdkSqlScriptRunner <...args> + * > fgpJava org.gusdb.wdk.model.WdkSqlScriptRunner (...args) * * @author rdoherty */ diff --git a/Model/src/main/java/org/gusdb/wdk/model/WdkUserException.java b/Model/src/main/java/org/gusdb/wdk/model/WdkUserException.java index 0b4c4525d0..4cdfe8c452 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/WdkUserException.java +++ b/Model/src/main/java/org/gusdb/wdk/model/WdkUserException.java @@ -11,7 +11,6 @@ * etc. * * @author Jerric - * @modified Jan 6, 2006 */ public class WdkUserException extends WdkException { diff --git a/Model/src/main/java/org/gusdb/wdk/model/WdkView.java b/Model/src/main/java/org/gusdb/wdk/model/WdkView.java index e3f580a260..facc11148f 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/WdkView.java +++ b/Model/src/main/java/org/gusdb/wdk/model/WdkView.java @@ -55,8 +55,8 @@ public boolean isDefault() { } /** - * @param _default - * the _default to set + * @param defaultValue + * the default to set */ public void setDefault(boolean defaultValue) { _default = defaultValue; diff --git a/Model/src/main/java/org/gusdb/wdk/model/answer/SummaryViewHandler.java b/Model/src/main/java/org/gusdb/wdk/model/answer/SummaryViewHandler.java index 2eff7e7100..a23642d86e 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/answer/SummaryViewHandler.java +++ b/Model/src/main/java/org/gusdb/wdk/model/answer/SummaryViewHandler.java @@ -14,6 +14,7 @@ * * @author jerric */ +@Deprecated public interface SummaryViewHandler { /** @@ -22,8 +23,7 @@ public interface SummaryViewHandler { * @param answerSpec answer spec for which to provide a model * @param parameters parameters passed to configure this view * @param user current user - * @param wdkModel WDK model - * @return model + * @return model for JSP to display this summary view * @throws WdkModelException if system exception occurs * @throws WdkUserException if input parameters are invalid */ @@ -37,7 +37,6 @@ Map process(RunnableObj answerSpec, Map *
  • If answerValue is a SingleRecordAnswerValue, a * SingleRecordStream is returned - *
  • If result size of answerValue is <= passed + *
  • If result size of answerValue is <= passed * maxPageSize, then the answerValue's paging is set to that a single * (first) page of that size and a PageAnswerRecordStream is returned *
  • Otherwise, a FileBasedRecordStream is returned diff --git a/Model/src/main/java/org/gusdb/wdk/model/columntool/ColumnReporter.java b/Model/src/main/java/org/gusdb/wdk/model/columntool/ColumnReporter.java index a6ae9a6092..09eb7a47e9 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/columntool/ColumnReporter.java +++ b/Model/src/main/java/org/gusdb/wdk/model/columntool/ColumnReporter.java @@ -24,7 +24,7 @@ public interface ColumnReporter extends ColumnToolElement, Repor * Another way to set properties on this reporter (added to * comply with the Reporter interface). By default, immediately * gets the properties from the provider and sets them using - * setProperties(Map). + * setProperties(Map<String,String>). */ @Override default Reporter setProperties(PropertiesProvider props) { diff --git a/Model/src/main/java/org/gusdb/wdk/model/config/ModelConfig.java b/Model/src/main/java/org/gusdb/wdk/model/config/ModelConfig.java index f8d886b095..7d70842d8b 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/config/ModelConfig.java +++ b/Model/src/main/java/org/gusdb/wdk/model/config/ModelConfig.java @@ -17,7 +17,6 @@ * for the WDK system. * * @author Jerric - * @modified Jan 6, 2006 - Jerric add a property for the name of query history table */ public class ModelConfig implements OAuthConfig { diff --git a/Model/src/main/java/org/gusdb/wdk/model/config/ModelConfigAppDB.java b/Model/src/main/java/org/gusdb/wdk/model/config/ModelConfigAppDB.java index a7071264d0..169db6d7ea 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/config/ModelConfigAppDB.java +++ b/Model/src/main/java/org/gusdb/wdk/model/config/ModelConfigAppDB.java @@ -2,7 +2,7 @@ /** *

    - * An object representation of the {@code } tag in the + * An object representation of the {@code <appDB>} tag in the * {@code model-config.xml}. The information defined in this tag is about how to * connect to the database which contains application data. *

    diff --git a/Model/src/main/java/org/gusdb/wdk/model/config/ModelConfigBuilder.java b/Model/src/main/java/org/gusdb/wdk/model/config/ModelConfigBuilder.java index 2e6a0a8fe9..a94f09e3ba 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/config/ModelConfigBuilder.java +++ b/Model/src/main/java/org/gusdb/wdk/model/config/ModelConfigBuilder.java @@ -281,7 +281,7 @@ public void setOauthUrl(String oauthUrl) { } /** - * @param _oauthUrl OAuth2 client ID to use for authentication + * @param oauthClientId OAuth2 client ID to use for authentication * (used only if authentication method is OAUTH2) */ public void setOauthClientId(String oauthClientId) { @@ -289,7 +289,7 @@ public void setOauthClientId(String oauthClientId) { } /** - * @param _oauthUrl OAuth2 client secret to use for authentication + * @param oauthClientSecret OAuth2 client secret to use for authentication * (used only if authentication method is OAUTH2) */ public void setOauthClientSecret(String oauthClientSecret) { @@ -321,8 +321,7 @@ public void setKeyStorePassPhrase(String keyStorePassPhrase) { } /** - * @param _secretKeyFile - * the secretKeyFile to set + * @param useWeights whether to use weights */ public void setUseWeights(boolean useWeights) { _useWeights = useWeights; diff --git a/Model/src/main/java/org/gusdb/wdk/model/config/ModelConfigUserDB.java b/Model/src/main/java/org/gusdb/wdk/model/config/ModelConfigUserDB.java index 74022e6ae3..a92ac2bd49 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/config/ModelConfigUserDB.java +++ b/Model/src/main/java/org/gusdb/wdk/model/config/ModelConfigUserDB.java @@ -13,13 +13,11 @@ import org.gusdb.wdk.model.WdkModelException; /** - * An object representation of the {@code } tag in the {@code model-config.xml}. Two schema are used - * for host wdk tables, and the {@link ModelConfigUserDB#userSchema} has the tables used to user specific - * data, while the {@link ModelConfigUserDB#wdkEngineSchema} has the tables used to store the data shared - * between users. - * + * An object representation of the {@code <userDB>} tag in the {@code model-config.xml}. + * The {@link ModelConfigUserDB#userSchema} contains the tables used to store user-specific + * data. + * * @author xingao - * */ public class ModelConfigUserDB extends ModelConfigDB { diff --git a/Model/src/main/java/org/gusdb/wdk/model/config/QueryMonitor.java b/Model/src/main/java/org/gusdb/wdk/model/config/QueryMonitor.java index 7d188ccb3e..d5bd0f00b2 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/config/QueryMonitor.java +++ b/Model/src/main/java/org/gusdb/wdk/model/config/QueryMonitor.java @@ -1,6 +1,3 @@ -/** - * - */ package org.gusdb.wdk.model.config; import java.util.LinkedHashSet; @@ -10,8 +7,8 @@ import org.gusdb.fgputil.db.slowquery.QueryLogConfig; /** - * An object representation of the tag in the model-config.xml. - * it controls the logging of slow queries & broken queries. + * An object representation of the <queryMonitor> tag in the model-config.xml. + * it controls the logging of slow queries and broken queries. * * When an SQL statement runs longer than broken threshold, it doesn't really mean the SQL * is failed, it's just extremely slow, and need to be fixed. If such a super diff --git a/Model/src/main/java/org/gusdb/wdk/model/filter/Filter.java b/Model/src/main/java/org/gusdb/wdk/model/filter/Filter.java index 38044b3e71..8a71b11e2e 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/filter/Filter.java +++ b/Model/src/main/java/org/gusdb/wdk/model/filter/Filter.java @@ -3,7 +3,6 @@ import org.gusdb.fgputil.validation.ValidationBundle; import org.gusdb.fgputil.validation.ValidationLevel; import org.gusdb.wdk.model.WdkModelException; -import org.gusdb.wdk.model.WdkUserException; import org.gusdb.wdk.model.answer.AnswerValue; import org.gusdb.wdk.model.answer.spec.SimpleAnswerSpec; import org.gusdb.wdk.model.question.Question; @@ -59,31 +58,20 @@ public boolean containerSupports(FilterType filterType) { void setView(String view); /** - * @returns false if this filter should affect the actual result; true if it only affects the results view + * @return false if this filter should affect the actual result; true if it only affects the results view */ FilterType getFilterType(); void setIsViewOnly(boolean isViewOnly); /** - * @returns true if this filter will always be applied to steps whose questions include it, false if it + * @return true if this filter will always be applied to steps whose questions include it, false if it * can be removed from those steps */ boolean getIsAlwaysApplied(); void setIsAlwaysApplied(boolean isAlwaysApplied); - /** - * get the display value of the filter. The value will be displayed on the applied filter list. - * - * @param answer - * the answerValue on which the filter has been applied. - * @param jsValue - * the actual value that has been applied to the current filter. - * @return - * @throws WdkModelException - * @throws WdkUserException - */ void setDefaultValue(JSONObject defaultValue); /** @@ -94,6 +82,15 @@ public boolean containerSupports(FilterType filterType) { */ JSONObject getDefaultValue(SimpleAnswerSpec simpleSpec); + /** + * get the display value of the filter. The value will be displayed on the applied filter list. + * + * @param answer + * the answerValue on which the filter has been applied. + * @param jsValue + * the actual value that has been applied to the current filter. + * @return + */ String getDisplayValue(AnswerValue answer, JSONObject jsValue) throws WdkModelException; /** @@ -102,7 +99,6 @@ public boolean containerSupports(FilterType filterType) { * @param idSql * @return * @throws WdkModelException - * @throws WdkUserException */ JSONObject getSummaryJson(AnswerValue answer, String idSql) throws WdkModelException; diff --git a/Model/src/main/java/org/gusdb/wdk/model/filter/StrategyFilter.java b/Model/src/main/java/org/gusdb/wdk/model/filter/StrategyFilter.java index 4a6e290a51..ffa9a7c06e 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/filter/StrategyFilter.java +++ b/Model/src/main/java/org/gusdb/wdk/model/filter/StrategyFilter.java @@ -64,10 +64,11 @@ private JSONObject getStrategiesJson(List strategies) { } /** - * the options contains the id of the strategy chosen as the filter. - * @throws WdkModelException + * the options contains the id of the strategy chosen as the filter * - * @see org.gusdb.wdk.model.filter.Filter#getSql(org.gusdb.wdk.model.answer.AnswerValue, java.lang.String, java.lang.String) + * @throws WdkModelException + * + * @see org.gusdb.wdk.model.filter.Filter#getSql */ @Override public String getSql(AnswerValue answer, String idSql, JSONObject jsValue) throws WdkModelException { diff --git a/Model/src/main/java/org/gusdb/wdk/model/fix/EmailListsGenerator.java b/Model/src/main/java/org/gusdb/wdk/model/fix/EmailListsGenerator.java index ed593dc225..dc870647cc 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/fix/EmailListsGenerator.java +++ b/Model/src/main/java/org/gusdb/wdk/model/fix/EmailListsGenerator.java @@ -18,9 +18,9 @@ /** + * Generate email lists to notify releases + * * @author xingao - * - * generate email lists to notify releases */ public class EmailListsGenerator extends BaseCLI { @@ -42,17 +42,11 @@ public static void main(String[] args) { /** * @param command - * @param description */ public EmailListsGenerator(String command) { super((command != null) ? command : "wdkGenerateEmailLists", "generate text files with emails lists for each project"); } - /* - * (non-Javadoc) - * - * @see org.gusdb.fgputil.BaseCLI#declareOptions() - */ @Override protected void declareOptions() { addSingleValueOption(ARG_PROJECT_ID, true, null, "A comma-separated" @@ -60,11 +54,6 @@ protected void declareOptions() { + " under $GUS_HOME, where model-config.xml is stored."); } - /* - * (non-Javadoc) - * - * @see org.gusdb.fgputil.BaseCLI#execute() - */ @Override protected void execute() throws Exception { String gusHome = System.getProperty(Utilities.SYSTEM_PROPERTY_GUS_HOME); diff --git a/Model/src/main/java/org/gusdb/wdk/model/fix/InvalidStepReporter.java b/Model/src/main/java/org/gusdb/wdk/model/fix/InvalidStepReporter.java index 51e5498306..7e929e5a7e 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/fix/InvalidStepReporter.java +++ b/Model/src/main/java/org/gusdb/wdk/model/fix/InvalidStepReporter.java @@ -18,11 +18,11 @@ import org.gusdb.wdk.model.config.ModelConfigUserDB; /** + * This script needs to be run after the model expander and step expander. + * + * Prints a report of invalid steps + * * @author steve fischer - * - * this script needs to be run after the model expander & step expander. - * - * prints a report of invalid steps */ public class InvalidStepReporter extends BaseCLI { diff --git a/Model/src/main/java/org/gusdb/wdk/model/fix/SharedStepsResolver.java b/Model/src/main/java/org/gusdb/wdk/model/fix/SharedStepsResolver.java index 4e94688c74..87840d222e 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/fix/SharedStepsResolver.java +++ b/Model/src/main/java/org/gusdb/wdk/model/fix/SharedStepsResolver.java @@ -57,7 +57,6 @@ public static void main(String[] args) { /** * @param command - * @param description */ public SharedStepsResolver(String command) { super((command != null) ? command : "wdkSharedStepsResolver", @@ -66,22 +65,12 @@ public SharedStepsResolver(String command) { + " strategies or other steps, etc."); } - /* - * (non-Javadoc) - * - * @see org.gusdb.fgputil.BaseCLI#declareOptions() - */ @Override protected void declareOptions() { addSingleValueOption(ARG_PROJECT_ID, true, null, "A project Id, which should match the directory name" + " under $GUS_HOME/config/, where model-config.xml is stored."); } - /* - * (non-Javadoc) - * - * @see org.gusdb.fgputil.BaseCLI#execute() - */ @Override protected void execute() throws Exception { diff --git a/Model/src/main/java/org/gusdb/wdk/model/fix/StepParamExpander.java b/Model/src/main/java/org/gusdb/wdk/model/fix/StepParamExpander.java index 826f811e12..52f1b0e950 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/fix/StepParamExpander.java +++ b/Model/src/main/java/org/gusdb/wdk/model/fix/StepParamExpander.java @@ -64,7 +64,6 @@ public static void main(String[] args) { /** * @param command - * @param description */ protected StepParamExpander(String command) { super((command != null) ? command : "stepParamExpander", diff --git a/Model/src/main/java/org/gusdb/wdk/model/fix/StepValidator.java b/Model/src/main/java/org/gusdb/wdk/model/fix/StepValidator.java index 29c8c5730e..2b585bb6fb 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/fix/StepValidator.java +++ b/Model/src/main/java/org/gusdb/wdk/model/fix/StepValidator.java @@ -27,12 +27,12 @@ import org.gusdb.wdk.model.config.ModelConfigUserDB; /** - * @author xingao - * - * this script needs to be run after the model expender & step expender. + * This script needs to be run after the model expender and step expender. * - * just accept one model. the model is only used to provide the access to user db, the result of this - * program will affect all projects in that user db. + * Just accept one model. the model is only used to provide the access to user db, the result of this + * program will affect all projects in that user db. + * + * @author xingao */ public class StepValidator extends BaseCLI { diff --git a/Model/src/main/java/org/gusdb/wdk/model/fix/StrategyFixer.java b/Model/src/main/java/org/gusdb/wdk/model/fix/StrategyFixer.java index 41efa2d592..7ebc55a0a7 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/fix/StrategyFixer.java +++ b/Model/src/main/java/org/gusdb/wdk/model/fix/StrategyFixer.java @@ -13,13 +13,12 @@ import org.gusdb.wdk.model.WdkModel; /** - * @author xingao - * - * This code is revived to fill in the strategy id on the steps; - * - * The original code generates the signature for the strategy (the old system doesn't create the - * signature automatically, but the new one does. Therefore, this code is considered deprecated. + * This code is revived to fill in the strategy id on the steps; * + * The original code generates the signature for the strategy (the old system doesn't create the + * signature automatically, but the new one does. Therefore, this code is considered deprecated. + * + * @author xingao */ public class StrategyFixer extends BaseCLI { @@ -42,18 +41,12 @@ public static void main(String[] args) { /** * @param command - * @param description */ protected StrategyFixer(String command) { super((command == null) ? command : "strategyFixer", "Fill in the strategy id on the steps. " + "The original code generate unique strategy signature, and is commented out."); } - /* - * (non-Javadoc) - * - * @see org.gusdb.fgputil.BaseCLI#declareOptions() - */ @Override protected void declareOptions() { addSingleValueOption(ARG_PROJECT_ID, true, null, "A project id, which should match the directory name " @@ -61,11 +54,6 @@ protected void declareOptions() { " access to apicomm instance, and all the steps from all projects will be patched."); } - /* - * (non-Javadoc) - * - * @see org.gusdb.fgputil.BaseCLI#execute() - */ @Override protected void execute() throws Exception { String gusHome = System.getProperty(Utilities.SYSTEM_PROPERTY_GUS_HOME); diff --git a/Model/src/main/java/org/gusdb/wdk/model/fix/table/TableRowInterfaces.java b/Model/src/main/java/org/gusdb/wdk/model/fix/table/TableRowInterfaces.java index 26f4798314..642406ba69 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/fix/table/TableRowInterfaces.java +++ b/Model/src/main/java/org/gusdb/wdk/model/fix/table/TableRowInterfaces.java @@ -54,7 +54,7 @@ public interface TableRowUpdaterPlugin { * be calling it synchronously with different row objects. * * @param nextRow object representing a row in the DB - * @return result of processing- essentially a tuple of + * @return result of processing- essentially a tuple of <whether_object_should_be_written, updated_object> * @throws Exception if error occurs while processing row */ RowResult processRecord(T nextRow) throws Exception; diff --git a/Model/src/main/java/org/gusdb/wdk/model/migrate/Migrator1_12To1_13.java b/Model/src/main/java/org/gusdb/wdk/model/migrate/Migrator1_12To1_13.java index c22e3d222f..620bf5437f 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/migrate/Migrator1_12To1_13.java +++ b/Model/src/main/java/org/gusdb/wdk/model/migrate/Migrator1_12To1_13.java @@ -1,9 +1,5 @@ -/** - * @description - */ package org.gusdb.wdk.model.migrate; -import java.security.NoSuchAlgorithmException; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -23,8 +19,6 @@ /** * @author Jerric - * @created May 22, 2007 - * @modified May 22, 2007 */ public class Migrator1_12To1_13 implements Migrator { @@ -113,14 +107,6 @@ void setUserId(int userId) { } - /** - * (non-Javadoc) - * - * @throws SQLException - * @throws NoSuchAlgorithmException - * - * @see org.gusdb.wdk.model.migrate.Migrator#migrate() - */ @Override public void migrate(WdkModel wdkModel, CommandLine commandLine) throws WdkModelException, SQLException { diff --git a/Model/src/main/java/org/gusdb/wdk/model/migrate/MigratorController.java b/Model/src/main/java/org/gusdb/wdk/model/migrate/MigratorController.java index ac8de545d1..4ada9a973f 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/migrate/MigratorController.java +++ b/Model/src/main/java/org/gusdb/wdk/model/migrate/MigratorController.java @@ -1,6 +1,3 @@ -/** - * @description - */ package org.gusdb.wdk.model.migrate; import java.lang.reflect.InvocationTargetException; @@ -23,8 +20,6 @@ /** * @author Jerric - * @created May 22, 2007 - * @modified May 22, 2007 */ public class MigratorController { @@ -39,12 +34,12 @@ public class MigratorController { * * The arguments for the command are: * - * -model : the name of the model to be used + * -model <model_name>: the name of the model to be used * - * -version : the version of the model to be migrated from; the + * -version <old_ver>: the version of the model to be migrated from; the * version is used to determine which migration code to be executed; * - * -schema : the old user login schema, where the user data + * -schema <old_user_schema>: the old user login schema, where the user data * is migrated from * * @param args diff --git a/Model/src/main/java/org/gusdb/wdk/model/ontology/Ontology.java b/Model/src/main/java/org/gusdb/wdk/model/ontology/Ontology.java index acfd2082de..0e2ef104f8 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/ontology/Ontology.java +++ b/Model/src/main/java/org/gusdb/wdk/model/ontology/Ontology.java @@ -13,7 +13,7 @@ import org.gusdb.wdk.model.WdkUserException; /** - * A special case of TreeNode that represents the root of an + * A special case of TreeNode<OntologyNode> that represents the root of an * ontology tree. * * @author rdoherty diff --git a/Model/src/main/java/org/gusdb/wdk/model/ontology/OntologyFactoryImpl.java b/Model/src/main/java/org/gusdb/wdk/model/ontology/OntologyFactoryImpl.java index eaab52be92..9b4888da31 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/ontology/OntologyFactoryImpl.java +++ b/Model/src/main/java/org/gusdb/wdk/model/ontology/OntologyFactoryImpl.java @@ -6,16 +6,12 @@ import java.util.List; import java.util.Map; - - - //import org.apache.log4j.Logger; import org.gusdb.fgputil.functional.TreeNode; +import org.gusdb.wdk.model.WdkModel; import org.gusdb.wdk.model.WdkModelBase; import org.gusdb.wdk.model.WdkModelException; import org.gusdb.wdk.model.WdkModelText; -import org.gusdb.wdk.model.WdkModel; -import org.gusdb.wdk.model.WdkUserException; public class OntologyFactoryImpl extends WdkModelBase implements OntologyFactory { @@ -67,7 +63,7 @@ public Ontology getOntology(WdkModel wdkModel) throws WdkModelException { /** * Get the ontology tree. Throw a WdkUserException if the tree contains circular paths (TODO). * @return - * @throws WdkUserException + * @throws WdkModelException */ @Override public Ontology getValidatedOntology(WdkModel wdkModel) throws WdkModelException { diff --git a/Model/src/main/java/org/gusdb/wdk/model/ontology/OntologyFactoryPlugin.java b/Model/src/main/java/org/gusdb/wdk/model/ontology/OntologyFactoryPlugin.java index 58bcce9184..8a9ec06e1f 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/ontology/OntologyFactoryPlugin.java +++ b/Model/src/main/java/org/gusdb/wdk/model/ontology/OntologyFactoryPlugin.java @@ -10,9 +10,11 @@ public interface OntologyFactoryPlugin { /** * Create the ontology tree. This method reads the provided parameters, such as the name of an .owl file. It then - * creates the ontology, in the form of a tree of TreeNodes. Each TreeNode has as its contents a Map>. In other words, + * creates the ontology, in the form of a tree of TreeNodes. Each TreeNode has as its contents a Map<String, List<String>>. In other words, * a set of properties, where each one has as a value a set of strings. * @param parameters + * @param ontologyName + * @param wdkModel * @return */ public TreeNode getTree(Map parameters, String ontologyName, WdkModel wdkModel) throws WdkModelException; @@ -20,6 +22,7 @@ public interface OntologyFactoryPlugin { /** * Validate the parameters that will be provided to the plugin. This is called by the WDK when it creates its model. * @param parameters + * @param ontologyName */ public void validateParameters(Map parameters, String ontologyName) throws WdkModelException; } diff --git a/Model/src/main/java/org/gusdb/wdk/model/query/BooleanQuery.java b/Model/src/main/java/org/gusdb/wdk/model/query/BooleanQuery.java index cfa38b325e..71f8b04f9a 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/query/BooleanQuery.java +++ b/Model/src/main/java/org/gusdb/wdk/model/query/BooleanQuery.java @@ -234,7 +234,6 @@ public boolean isBoolean() { * @param specBuilder * @param stepId optional step ID used to add information when logging a problem * @return - * @throws WdkModelException */ public static BooleanOperator getOperator(QueryInstanceSpecBuilder specBuilder, Optional stepId) { return getOperator(specBuilder.get(BooleanQuery.OPERATOR_PARAM), stepId); diff --git a/Model/src/main/java/org/gusdb/wdk/model/query/ProcessQuery.java b/Model/src/main/java/org/gusdb/wdk/model/query/ProcessQuery.java index 4300a04ca2..f33b78ae63 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/query/ProcessQuery.java +++ b/Model/src/main/java/org/gusdb/wdk/model/query/ProcessQuery.java @@ -18,7 +18,7 @@ * defined, otherwise the default of type and width will be used; if your actual * result is larger than that, the value will be truncated. *

    - * If you don't specify an web service URL in the tag, the + * If you don't specify an web service URL in the <processQuery> tag, the * default web service url in model-config.xml will be used. *

    * If the local flag is true, WDK assumes that the WSF service is installed in diff --git a/Model/src/main/java/org/gusdb/wdk/model/query/param/AbstractDependentParam.java b/Model/src/main/java/org/gusdb/wdk/model/query/param/AbstractDependentParam.java index 0f09d013e3..8a574d8b15 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/query/param/AbstractDependentParam.java +++ b/Model/src/main/java/org/gusdb/wdk/model/query/param/AbstractDependentParam.java @@ -48,7 +48,7 @@ public abstract String getSanityDefault(User user, Map contextPa SelectMode sanitySelectMode) throws WdkModelException; /** - * A list of the objects used by this parameter. + * A list of the <query> objects used by this parameter. */ public abstract Set getContainedQueryFullNames(); diff --git a/Model/src/main/java/org/gusdb/wdk/model/query/param/DateParam.java b/Model/src/main/java/org/gusdb/wdk/model/query/param/DateParam.java index 4f7edc89c0..d2f40d86d4 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/query/param/DateParam.java +++ b/Model/src/main/java/org/gusdb/wdk/model/query/param/DateParam.java @@ -132,9 +132,6 @@ public Param clone() { return new DateParam(this); } - /** - * @inheritDoc - */ @Override protected ParamValidity validateValue(PartiallyValidatedStableValues contextParamValues, ValidationLevel level) { diff --git a/Model/src/main/java/org/gusdb/wdk/model/query/param/EnumItem.java b/Model/src/main/java/org/gusdb/wdk/model/query/param/EnumItem.java index 0fc0e2af31..4988cf4800 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/query/param/EnumItem.java +++ b/Model/src/main/java/org/gusdb/wdk/model/query/param/EnumItem.java @@ -168,7 +168,7 @@ public String getDependedExpression() { * check if the given list of depended values are included in the declared * depended values. * - * @param dependedValues + * @param dependedParamValues * @return */ public boolean isValidFor(Map dependedParamValues) diff --git a/Model/src/main/java/org/gusdb/wdk/model/query/param/FilterParamNew.java b/Model/src/main/java/org/gusdb/wdk/model/query/param/FilterParamNew.java index 72415a8760..3b2097338b 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/query/param/FilterParamNew.java +++ b/Model/src/main/java/org/gusdb/wdk/model/query/param/FilterParamNew.java @@ -421,7 +421,7 @@ public void resolveReferences(WdkModel model) throws WdkModelException { * We cache this because typically ontologies are sensitive only to the * grossest dependent param (e.g. dataset), so will be reused across users. * - * @return > + * @return Map of <propertyName, <infoKey, infoValue>> */ public Map getOntology(User user, Map paramValues) throws WdkModelException { diff --git a/Model/src/main/java/org/gusdb/wdk/model/query/param/FilterParamNewHandler.java b/Model/src/main/java/org/gusdb/wdk/model/query/param/FilterParamNewHandler.java index 5799089d75..c76242921f 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/query/param/FilterParamNewHandler.java +++ b/Model/src/main/java/org/gusdb/wdk/model/query/param/FilterParamNewHandler.java @@ -46,7 +46,7 @@ public String toStableValue(User user, Object rawValue) { FROM (${metadata_qc}) mf WHERE mf.ontology_term_id = 'age' AND mf.numeric_value >= 66 - AND mf.numeric_value <= 80 + AND mf.numeric_value <= 80 INTERSECT SELECT mf.internal FROM mf.${metadata_qc} mf diff --git a/Model/src/main/java/org/gusdb/wdk/model/query/param/ParamConfiguration.java b/Model/src/main/java/org/gusdb/wdk/model/query/param/ParamConfiguration.java index 0975efe286..86376e86aa 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/query/param/ParamConfiguration.java +++ b/Model/src/main/java/org/gusdb/wdk/model/query/param/ParamConfiguration.java @@ -1,6 +1,3 @@ -/** - * @description - */ package org.gusdb.wdk.model.query.param; import org.gusdb.wdk.model.WdkModel; @@ -9,11 +6,9 @@ /** * The param configuration represents a tag with boolean property named "value". - * Currently, it is only used to map tag into a object model. + * Currently, it is only used to map <noTranslation> tag into a object model. * * @author Jerric - * @created Jul 5, 2007 - * @modified Jul 5, 2007 */ public class ParamConfiguration extends WdkModelBase { diff --git a/Model/src/main/java/org/gusdb/wdk/model/query/param/ParamReference.java b/Model/src/main/java/org/gusdb/wdk/model/query/param/ParamReference.java index 8c86e1b811..95b9c310fe 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/query/param/ParamReference.java +++ b/Model/src/main/java/org/gusdb/wdk/model/query/param/ParamReference.java @@ -12,11 +12,10 @@ import org.gusdb.wdk.model.query.param.AbstractEnumParam.SelectMode; /** - * An object representation of a tag, It is used in query and + * An object representation of a <paramRef> tag, It is used in query and * question tag to reference a param, and provide customization to the param. * * @author Jerric - * @created Feb 16, 2006 */ public class ParamReference extends Reference { diff --git a/Model/src/main/java/org/gusdb/wdk/model/question/AttributeList.java b/Model/src/main/java/org/gusdb/wdk/model/question/AttributeList.java index 4714d3da07..b382b26fb2 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/question/AttributeList.java +++ b/Model/src/main/java/org/gusdb/wdk/model/question/AttributeList.java @@ -1,6 +1,3 @@ -/** - * - */ package org.gusdb.wdk.model.question; import java.util.LinkedHashMap; @@ -12,11 +9,10 @@ import org.gusdb.wdk.model.WdkModelException; /** - * This class represents the @{code /} tag. It is used + * This class represents the @{code <question>/<attributeList>} tag. It is used * to define summary attribute list and sorting attribute list. * * @author Jerric - * */ public class AttributeList extends WdkModelBase { @@ -49,23 +45,11 @@ public String[] getSummaryAttributeNames() { return this.summaryAttributeNames; } - /* - * (non-Javadoc) - * - * @see org.gusdb.wdk.model.WdkModelBase#excludeResources(java.lang.String) - */ @Override public void excludeResources(String projectId) { // no resource to release, do nothing } - /* - * (non-Javadoc) - * - * @see - * org.gusdb.wdk.model.WdkModelBase#resolveReferences(org.gusdb.wdk.model. - * WdkModel) - */ @Override public void resolveReferences(WdkModel wodkModel) throws WdkModelException { // nothing to resolve. diff --git a/Model/src/main/java/org/gusdb/wdk/model/question/QuestionSuggestion.java b/Model/src/main/java/org/gusdb/wdk/model/question/QuestionSuggestion.java index 482946140e..e472199400 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/question/QuestionSuggestion.java +++ b/Model/src/main/java/org/gusdb/wdk/model/question/QuestionSuggestion.java @@ -1,6 +1,3 @@ -/** - * - */ package org.gusdb.wdk.model.question; import org.gusdb.wdk.model.WdkModelBase; @@ -13,16 +10,11 @@ public class QuestionSuggestion extends WdkModelBase { private String _newBuild; private String _reviseBuild; - /** - * - */ + public QuestionSuggestion() { - // TODO Auto-generated constructor stub + // needed by digester } - /** - * @param base - */ public QuestionSuggestion(QuestionSuggestion suggestion) { super(suggestion); this._newBuild = suggestion._newBuild; diff --git a/Model/src/main/java/org/gusdb/wdk/model/question/SearchCategory.java b/Model/src/main/java/org/gusdb/wdk/model/question/SearchCategory.java index 430fb1e75e..81cddc9cef 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/question/SearchCategory.java +++ b/Model/src/main/java/org/gusdb/wdk/model/question/SearchCategory.java @@ -15,12 +15,11 @@ /** * The SearchCategory is used to group questions into tree structure, and it is * used in the search menu, web service list, frontpage bubbles etc. - * + * * Currently, due to the implementation limitation on the add step popup, the * search category can have at most 3 levels deep. - * + * * @author jerric - * */ public class SearchCategory extends WdkModelBase { @@ -256,7 +255,7 @@ public void resolveReferences(WdkModel wdkModel) throws WdkModelException { /** * an alternate means to build the tree - * @param kids + * @param kid */ public void addChild(SearchCategory kid) { _children.put(kid.getName(), kid); diff --git a/Model/src/main/java/org/gusdb/wdk/model/record/AttributeQueryReference.java b/Model/src/main/java/org/gusdb/wdk/model/record/AttributeQueryReference.java index 889599738b..2711062d7c 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/record/AttributeQueryReference.java +++ b/Model/src/main/java/org/gusdb/wdk/model/record/AttributeQueryReference.java @@ -24,7 +24,7 @@ /** *

    - * an object representation of the @{code /}, it + * an object representation of the @{code <recordClass>/<attributeQuery>}, it * provides a reference to an attribute {@link Query}, and * {@link AttributeField}s can be defined in this tag. *

    @@ -37,19 +37,18 @@ *

    * *

    - * The attribute {@link Query> must also have all the primary key + * The attribute {@link Query} must also have all the primary key * {@link Column}s defined, but defining a {@link ColumnAttributeField} for * those columns is optional. *

    * *

    * At runtime, the attribute query will be used by WDK in two contexts: on - * summary page & on record page. Please refer to the {@link Query} class for + * summary page and on record page. Please refer to the {@link Query} class for * how to define attribute queries. *

    * * @author Jerric - * @created Jan 18, 2006 */ public class AttributeQueryReference extends Reference { diff --git a/Model/src/main/java/org/gusdb/wdk/model/record/ResultSizeQueryReference.java b/Model/src/main/java/org/gusdb/wdk/model/record/ResultSizeQueryReference.java index 7ea24d48e8..1a2ae6e5a6 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/record/ResultSizeQueryReference.java +++ b/Model/src/main/java/org/gusdb/wdk/model/record/ResultSizeQueryReference.java @@ -1,6 +1,3 @@ -/** - * - */ package org.gusdb.wdk.model.record; import org.gusdb.wdk.model.Reference; @@ -8,13 +5,11 @@ /** *

    - * a representation of a @{code /} that is a specification for a ResultSizeSqlPlugin. - * Has a reference to a {@link Query} + * a representation of a @{code <recordClass>/<resultSizeQueryReference>} that is a specification for a ResultSizeSqlPlugin. + * Has a reference to a {@link org.gusdb.wdk.model.query.Query} *

    - * - * + * * @author Steve - * @created Mar 17, 2015 */ public class ResultSizeQueryReference extends Reference { @@ -23,9 +18,6 @@ public class ResultSizeQueryReference extends Reference { private String recordShortDisplayName; private String recordShortDisplayNamePlural; - /** - * - */ public ResultSizeQueryReference() {} /** diff --git a/Model/src/main/java/org/gusdb/wdk/model/record/TableValue.java b/Model/src/main/java/org/gusdb/wdk/model/record/TableValue.java index fb86b48d1a..bb463db0f1 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/record/TableValue.java +++ b/Model/src/main/java/org/gusdb/wdk/model/record/TableValue.java @@ -25,10 +25,9 @@ * id query, and then the query will be executed in a "bulk" mode, and the table * value object cannot be used (because we don't want to cache all that many * values). the external program is responsible for combining the table query - * with the sorted & paged id query, and read the values directly. + * with the sorted and paged id query, and read the values directly. * * @author jerric - * */ public class TableValue implements Iterable { diff --git a/Model/src/main/java/org/gusdb/wdk/model/record/attribute/ColumnAttributeValue.java b/Model/src/main/java/org/gusdb/wdk/model/record/attribute/ColumnAttributeValue.java index 7b305eadd3..eb6a67a093 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/record/attribute/ColumnAttributeValue.java +++ b/Model/src/main/java/org/gusdb/wdk/model/record/attribute/ColumnAttributeValue.java @@ -4,8 +4,8 @@ import org.gusdb.wdk.model.WdkModelException; /** - * An wrapper to the actual value of a {@link Column} retrieved from a - * {@link Query}. + * An wrapper to the actual value of a {@link org.gusdb.wdk.model.query.Column} retrieved from a + * {@link org.gusdb.wdk.model.query.Query}. * * @author Jerric Gao */ diff --git a/Model/src/main/java/org/gusdb/wdk/model/record/attribute/LinkAttributeField.java b/Model/src/main/java/org/gusdb/wdk/model/record/attribute/LinkAttributeField.java index c560031f81..69d06f5564 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/record/attribute/LinkAttributeField.java +++ b/Model/src/main/java/org/gusdb/wdk/model/record/attribute/LinkAttributeField.java @@ -13,9 +13,9 @@ /** *

    * This is an {@link AttributeField} that will be rendered as hyper links on the - * website. You can define your url in the {@code } tag of this field, and - * the the content in @{code } will be rendered as display inside - * of {@code }. + * website. You can define your url in the {@code <url>} tag of this field, and + * the the content in @{code <displayText>} will be rendered as display inside + * an anchor link. *

    * *

    diff --git a/Model/src/main/java/org/gusdb/wdk/model/record/attribute/TextAttributeValue.java b/Model/src/main/java/org/gusdb/wdk/model/record/attribute/TextAttributeValue.java index eb795e6095..7a6fe10eb9 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/record/attribute/TextAttributeValue.java +++ b/Model/src/main/java/org/gusdb/wdk/model/record/attribute/TextAttributeValue.java @@ -26,8 +26,8 @@ public class TextAttributeValue extends DerivedAttributeValue { private String _display; /** - * @param attributeValueContainer * @param field + * @param container */ public TextAttributeValue(TextAttributeField field, AttributeValueContainer container) { super(field, container); diff --git a/Model/src/main/java/org/gusdb/wdk/model/report/util/RecordFormatter.java b/Model/src/main/java/org/gusdb/wdk/model/report/util/RecordFormatter.java index e63222d4da..2c0dce59ba 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/report/util/RecordFormatter.java +++ b/Model/src/main/java/org/gusdb/wdk/model/report/util/RecordFormatter.java @@ -27,7 +27,7 @@ * Formats WDK RecordInstance objects. RecordInstance JSON will have the following form: * * { - * id: Array (each has name (name of PK column) and value (PK column value) properties, + * id: Array<Object> (each has name (name of PK column) and value (PK column value) properties, * attributes: { [name: String]: [value: Any] }, * tables: { [name: String]: [ { [name: String]: [value: Any] } ] } * } diff --git a/Model/src/main/java/org/gusdb/wdk/model/report/util/ReporterFactory.java b/Model/src/main/java/org/gusdb/wdk/model/report/util/ReporterFactory.java index 0d0f1ae09d..27bd923015 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/report/util/ReporterFactory.java +++ b/Model/src/main/java/org/gusdb/wdk/model/report/util/ReporterFactory.java @@ -15,7 +15,7 @@ /** * Provides methods to get a configured reporter using the passed AnswerValue and configuration. Two options - * exist for configuration: the (legacy) Map or a JSON Object. You may also specify start + * exist for configuration: the (legacy) Map<String,String> or a JSON Object. You may also specify start * and end indexes for the result if a subset of results is desired. * * @author rdoherty diff --git a/Model/src/main/java/org/gusdb/wdk/model/test/CacheCLI.java b/Model/src/main/java/org/gusdb/wdk/model/test/CacheCLI.java index e7e16e1bfa..6d047bd6d8 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/test/CacheCLI.java +++ b/Model/src/main/java/org/gusdb/wdk/model/test/CacheCLI.java @@ -40,7 +40,6 @@ public static void main(String[] args) { /** * @param command - * @param description */ protected CacheCLI(String command) { super((command == null) ? "wdkCache" : command, diff --git a/Model/src/main/java/org/gusdb/wdk/model/test/CommandHelper.java b/Model/src/main/java/org/gusdb/wdk/model/test/CommandHelper.java index 792c1d9932..a514f2593d 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/test/CommandHelper.java +++ b/Model/src/main/java/org/gusdb/wdk/model/test/CommandHelper.java @@ -1,6 +1,3 @@ -/** - * - */ package org.gusdb.wdk.model.test; import org.apache.commons.cli.BasicParser; @@ -13,7 +10,6 @@ /** * @author Jerric - * @created Sep 22, 2005 */ public class CommandHelper { diff --git a/Model/src/main/java/org/gusdb/wdk/model/test/QuestionSummaryReporter.java b/Model/src/main/java/org/gusdb/wdk/model/test/QuestionSummaryReporter.java index b834eddc63..a37a798f89 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/test/QuestionSummaryReporter.java +++ b/Model/src/main/java/org/gusdb/wdk/model/test/QuestionSummaryReporter.java @@ -96,7 +96,6 @@ public static void main(String[] args) throws Exception { /** * @param command - * @param description */ protected QuestionSummaryReporter(String command) { super((command == null) ? "wdkReportQuestionSummary" : command, diff --git a/Model/src/main/java/org/gusdb/wdk/model/test/RecordSummaryReporter.java b/Model/src/main/java/org/gusdb/wdk/model/test/RecordSummaryReporter.java index 26ba5877f1..c0671d6eef 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/test/RecordSummaryReporter.java +++ b/Model/src/main/java/org/gusdb/wdk/model/test/RecordSummaryReporter.java @@ -83,18 +83,12 @@ public static void main(String[] args) throws Exception { /** * @param command - * @param description */ protected RecordSummaryReporter(String command) { super((command == null) ? "wdkReportRecordSummary" : command, "Report text info in recordClasses."); } - /* - * (non-Javadoc) - * - * @see org.gusdb.fgputil.BaseCLI#declareOptions() - */ @Override protected void declareOptions() { addSingleValueOption(ARG_PROJECT_ID, true, null, @@ -104,11 +98,6 @@ protected void declareOptions() { "The name of the output file."); } - /* - * (non-Javadoc) - * - * @see org.gusdb.fgputil.BaseCLI#invoke() - */ @Override protected void execute() throws WdkModelException { String gusHome = System.getProperty(Utilities.SYSTEM_PROPERTY_GUS_HOME); diff --git a/Model/src/main/java/org/gusdb/wdk/model/test/stress/InvalidStatusException.java b/Model/src/main/java/org/gusdb/wdk/model/test/stress/InvalidStatusException.java index 8304f4606e..8acefd0cfe 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/test/stress/InvalidStatusException.java +++ b/Model/src/main/java/org/gusdb/wdk/model/test/stress/InvalidStatusException.java @@ -1,46 +1,33 @@ -/** - * - */ package org.gusdb.wdk.model.test.stress; /** - * @author: Jerric - * @created: Mar 14, 2006 - * @modified by: Jerric - * @modified at: Mar 14, 2006 - * + * @author Jerric */ public class InvalidStatusException extends Exception { - /** - * - */ private static final long serialVersionUID = 3801781867877203626L; - /** - * - */ public InvalidStatusException() { super(); } /** - * @param arg0 + * @param msg */ public InvalidStatusException(String msg) { super(msg); } /** - * @param arg0 - * @param arg1 + * @param msg + * @param internal */ public InvalidStatusException(String msg, Throwable internal) { super(msg, internal); } /** - * @param arg0 + * @param internal */ public InvalidStatusException(Throwable internal) { super(internal); diff --git a/Model/src/main/java/org/gusdb/wdk/model/test/stress/StressTestAnalyzer.java b/Model/src/main/java/org/gusdb/wdk/model/test/stress/StressTestAnalyzer.java index ed5d490272..86fbaaa14e 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/test/stress/StressTestAnalyzer.java +++ b/Model/src/main/java/org/gusdb/wdk/model/test/stress/StressTestAnalyzer.java @@ -1,6 +1,3 @@ -/** - * - */ package org.gusdb.wdk.model.test.stress; import java.sql.ResultSet; @@ -18,11 +15,7 @@ import org.gusdb.wdk.model.test.stress.StressTestTask.ResultType; /** - * @author: Jerric - * @created: Mar 16, 2006 - * @modified by: Jerric - * @modified at: Mar 16, 2006 - * + * @author Jerric */ public class StressTestAnalyzer { diff --git a/Model/src/main/java/org/gusdb/wdk/model/test/stress/StressTestRunner.java b/Model/src/main/java/org/gusdb/wdk/model/test/stress/StressTestRunner.java index 3a22142e73..e57ff69776 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/test/stress/StressTestRunner.java +++ b/Model/src/main/java/org/gusdb/wdk/model/test/stress/StressTestRunner.java @@ -11,11 +11,7 @@ import org.gusdb.wdk.model.test.stress.StressTestTask.ResultType; /** - * @author: Jerric - * @created: Mar 14, 2006 - * @modified by: Jerric - * @modified at: Mar 14, 2006 - * + * @author Jerric */ public class StressTestRunner implements Runnable { diff --git a/Model/src/main/java/org/gusdb/wdk/model/test/stress/StressTestTask.java b/Model/src/main/java/org/gusdb/wdk/model/test/stress/StressTestTask.java index f7cf8fbcaa..ec8c6e6bda 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/test/stress/StressTestTask.java +++ b/Model/src/main/java/org/gusdb/wdk/model/test/stress/StressTestTask.java @@ -1,15 +1,7 @@ -/** - * - */ package org.gusdb.wdk.model.test.stress; - /** - * @author: Jerric - * @created: Mar 14, 2006 - * @modified by: Jerric - * @modified at: Mar 31, 2006 - * + * @author Jerric */ public class StressTestTask { diff --git a/Model/src/main/java/org/gusdb/wdk/model/test/stress/StressTester.java b/Model/src/main/java/org/gusdb/wdk/model/test/stress/StressTester.java index b493b899f6..b2ef1d64b7 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/test/stress/StressTester.java +++ b/Model/src/main/java/org/gusdb/wdk/model/test/stress/StressTester.java @@ -52,11 +52,7 @@ import org.gusdb.wdk.model.xml.XmlQuestionSet; /** - * @author: Jerric - * @created: Mar 15, 2006 - * @modified by: Jerric - * @modified at: Mar 15, 2006 - * + * @author Jerric */ public class StressTester { diff --git a/Model/src/main/java/org/gusdb/wdk/model/test/stress/UrlItem.java b/Model/src/main/java/org/gusdb/wdk/model/test/stress/UrlItem.java index 9f15d4d51b..12d7e0c5c4 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/test/stress/UrlItem.java +++ b/Model/src/main/java/org/gusdb/wdk/model/test/stress/UrlItem.java @@ -1,6 +1,3 @@ -/** - * - */ package org.gusdb.wdk.model.test.stress; import java.io.IOException; @@ -9,20 +6,13 @@ import java.net.URL; /** - * @author: Jerric - * @created: Mar 21, 2006 - * @modified by: Jerric - * @modified at: Mar 21, 2006 - * + * @author Jerric */ public class UrlItem { private String urlPattern; private String urlType; - /** - * - */ public UrlItem( String urlPattern, String urlType ) { this.urlPattern = urlPattern; this.urlType = urlType; @@ -49,12 +39,7 @@ public HttpURLConnection getConnection( String cookies ) throws IOException { connection.setRequestProperty( "Cookie", cookies ); return connection; } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#toString() - */ + @Override public String toString() { StringBuffer sb = new StringBuffer(); diff --git a/Model/src/main/java/org/gusdb/wdk/model/user/BasketFactory.java b/Model/src/main/java/org/gusdb/wdk/model/user/BasketFactory.java index 08dafca4c8..edb2305b9d 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/user/BasketFactory.java +++ b/Model/src/main/java/org/gusdb/wdk/model/user/BasketFactory.java @@ -101,7 +101,8 @@ public void removePksFromBasket(User user, RecordClass recordClass, Collection

    /} tag, it's + * An object representation to the {@code <recordClass>/<favorite>} tag, it's * used to associate the note field of a {@link Favorite} in the favorite page to an - * {@link AttributeField} in the {@link RecordClass}. - * + * {@link AttributeField} in the {@link org.gusdb.wdk.model.record.RecordClass}. + * * @author jerric - * */ public class FavoriteReference extends WdkModelBase { diff --git a/Model/src/main/java/org/gusdb/wdk/model/user/StepFactory.java b/Model/src/main/java/org/gusdb/wdk/model/user/StepFactory.java index c16550c136..7ee1454c82 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/user/StepFactory.java +++ b/Model/src/main/java/org/gusdb/wdk/model/user/StepFactory.java @@ -1162,8 +1162,8 @@ public Optional getStepByIdAndUserId(long stepId, long userId, * Transfers ownership of all the strategies belonging to one user to another * user. * - * @param fromUser user strats will be transferred from - * @param toUser user strats will be transferred to + * @param guestUser user strats will be transferred from + * @param registeredUser user strats will be transferred to * @throws WdkModelException */ public void transferStrategyOwnership(User guestUser, User registeredUser) throws WdkModelException { diff --git a/Model/src/main/java/org/gusdb/wdk/model/user/UserFactory.java b/Model/src/main/java/org/gusdb/wdk/model/user/UserFactory.java index f6741748a1..caa5b3e004 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/user/UserFactory.java +++ b/Model/src/main/java/org/gusdb/wdk/model/user/UserFactory.java @@ -269,10 +269,10 @@ private static String generateTemporaryPassword() { } /** - * Save the temporary (in-memory guest) user into database, and initialize its remaining fields. + * Create an unregistered user of the specified type and persist in the database * - * @param user guest user to persist - * @return the guest user with remaining fields populated + * @param userType unregistered user type to persist + * @return new unregistered user with remaining fields populated * @throws WdkRuntimeException if unable to persist temporary user */ public UnregisteredUser createUnregistedUser(UnregisteredUserType userType) throws WdkRuntimeException { diff --git a/Model/src/main/java/org/gusdb/wdk/model/user/analysis/StepAnalysisFactoryImpl.java b/Model/src/main/java/org/gusdb/wdk/model/user/analysis/StepAnalysisFactoryImpl.java index 69ff329461..a76f37509e 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/user/analysis/StepAnalysisFactoryImpl.java +++ b/Model/src/main/java/org/gusdb/wdk/model/user/analysis/StepAnalysisFactoryImpl.java @@ -385,8 +385,7 @@ public Optional getExecutionInfo(RunnableObj getExecutionResult(RunnableObj instance) throws WdkModelException { diff --git a/Model/src/main/java/org/gusdb/wdk/model/user/dataset/event/datastore/InstalledUserDatasetDBActions.java b/Model/src/main/java/org/gusdb/wdk/model/user/dataset/event/datastore/InstalledUserDatasetDBActions.java index 91b7a60f78..ca3e204a4f 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/user/dataset/event/datastore/InstalledUserDatasetDBActions.java +++ b/Model/src/main/java/org/gusdb/wdk/model/user/dataset/event/datastore/InstalledUserDatasetDBActions.java @@ -11,6 +11,7 @@ *

    * {@code InstalledUserDataset} table: * + * * * * diff --git a/Model/src/main/java/org/gusdb/wdk/model/user/dataset/event/datastore/UserDatasetEventDBActions.java b/Model/src/main/java/org/gusdb/wdk/model/user/dataset/event/datastore/UserDatasetEventDBActions.java index aa00d6061f..f6a287db6b 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/user/dataset/event/datastore/UserDatasetEventDBActions.java +++ b/Model/src/main/java/org/gusdb/wdk/model/user/dataset/event/datastore/UserDatasetEventDBActions.java @@ -21,6 +21,7 @@ *

    * {@code UserDatasetEvent} Table: *

    User Dataset Columns Definition
    ColumnType
    + * * * * diff --git a/Model/src/main/java/org/gusdb/wdk/model/user/dataset/event/datastore/UserDatasetOwnerDBActions.java b/Model/src/main/java/org/gusdb/wdk/model/user/dataset/event/datastore/UserDatasetOwnerDBActions.java index 97eb0cdc67..14c44c26de 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/user/dataset/event/datastore/UserDatasetOwnerDBActions.java +++ b/Model/src/main/java/org/gusdb/wdk/model/user/dataset/event/datastore/UserDatasetOwnerDBActions.java @@ -10,6 +10,7 @@ *

    * {@code UserDatasetOwner} table: *

    User Dataset Event Columns Definition
    ColumnType
    + * * * * diff --git a/Model/src/main/java/org/gusdb/wdk/model/user/dataset/event/datastore/UserDatasetShareDBActions.java b/Model/src/main/java/org/gusdb/wdk/model/user/dataset/event/datastore/UserDatasetShareDBActions.java index 0349203fe0..c678dbef5b 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/user/dataset/event/datastore/UserDatasetShareDBActions.java +++ b/Model/src/main/java/org/gusdb/wdk/model/user/dataset/event/datastore/UserDatasetShareDBActions.java @@ -11,6 +11,7 @@ *

    * {@code UserDatasetSharedWith} table: *

    User Dataset Owner Columns Definition
    ColumnType
    + * * * * diff --git a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlAnswerValue.java b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlAnswerValue.java index 0e09be84a2..1007ed808c 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlAnswerValue.java +++ b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlAnswerValue.java @@ -1,6 +1,3 @@ -/** - * - */ package org.gusdb.wdk.model.xml; import java.util.ArrayList; @@ -12,7 +9,6 @@ /** * @author Jerric - * @created Oct 11, 2005 */ public class XmlAnswerValue { diff --git a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlAttributeField.java b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlAttributeField.java index 73b4d541a8..de637f3308 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlAttributeField.java +++ b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlAttributeField.java @@ -10,7 +10,6 @@ /** * @author Jerric - * @since Oct 11, 2005 */ public class XmlAttributeField extends AttributeField { diff --git a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlAttributeValue.java b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlAttributeValue.java index 38a4658039..f8659541ca 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlAttributeValue.java +++ b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlAttributeValue.java @@ -1,13 +1,9 @@ -/** - * - */ package org.gusdb.wdk.model.xml; import org.gusdb.wdk.model.Utilities; /** * @author Jerric - * @created Oct 11, 2005 */ public class XmlAttributeValue { diff --git a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlDataLoader.java b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlDataLoader.java index cc97ce0c59..b906074c9e 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlDataLoader.java +++ b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlDataLoader.java @@ -18,7 +18,6 @@ /** * @author Jerric - * @created Oct 11, 2005 */ public class XmlDataLoader { diff --git a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlQuestion.java b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlQuestion.java index 7ee3069834..279002e60c 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlQuestion.java +++ b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlQuestion.java @@ -22,7 +22,6 @@ /** * @author Jerric - * @created Oct 11, 2005 */ public class XmlQuestion extends WdkModelBase { @@ -113,8 +112,8 @@ public void setName(String name) { } /** - * @param summaryAttributesRef - * The summaryAttributesRef to set. + * @param summaryAttributeNames + * The summaryAttributes to set. */ public void setSummaryAttributes(String summaryAttributeNames) { _summaryAttributeNames = summaryAttributeNames; diff --git a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlQuestionSet.java b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlQuestionSet.java index 639ef41e8a..56a698b044 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlQuestionSet.java +++ b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlQuestionSet.java @@ -13,7 +13,6 @@ /** * @author Jerric - * @created Oct 14, 2005 */ public class XmlQuestionSet extends WdkModelBase implements ModelSetI { diff --git a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlRecordClass.java b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlRecordClass.java index f45f29e003..5b3df7cc1d 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlRecordClass.java +++ b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlRecordClass.java @@ -11,7 +11,6 @@ /** * @author Jerric - * @created Oct 11, 2005 */ public class XmlRecordClass extends WdkModelBase { diff --git a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlRecordClassSet.java b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlRecordClassSet.java index f9f3d636fc..c550def99c 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlRecordClassSet.java +++ b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlRecordClassSet.java @@ -12,7 +12,6 @@ /** * @author Jerric - * @created Oct 14, 2005 */ public class XmlRecordClassSet extends WdkModelBase implements ModelSetI { diff --git a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlRecordInstance.java b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlRecordInstance.java index 754ca8d196..b0b1ec94ae 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlRecordInstance.java +++ b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlRecordInstance.java @@ -9,7 +9,6 @@ /** * @author Jerric - * @created Oct 11, 2005 */ public class XmlRecordInstance { diff --git a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlRowValue.java b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlRowValue.java index aa59b68bab..33a188eb2b 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlRowValue.java +++ b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlRowValue.java @@ -1,6 +1,3 @@ -/** - * - */ package org.gusdb.wdk.model.xml; import java.util.LinkedHashMap; @@ -10,7 +7,6 @@ /** * @author Jerric - * @created Oct 14, 2005 */ public class XmlRowValue { diff --git a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlTableField.java b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlTableField.java index 43e154d522..01459f719c 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlTableField.java +++ b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlTableField.java @@ -11,7 +11,6 @@ /** * @author Jerric - * @created Oct 11, 2005 */ public class XmlTableField extends Field { diff --git a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlTableValue.java b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlTableValue.java index f4e3cbfdbe..9bee0d67a6 100644 --- a/Model/src/main/java/org/gusdb/wdk/model/xml/XmlTableValue.java +++ b/Model/src/main/java/org/gusdb/wdk/model/xml/XmlTableValue.java @@ -1,6 +1,3 @@ -/** - * - */ package org.gusdb.wdk.model.xml; import java.util.ArrayList; @@ -8,7 +5,6 @@ /** * @author Jerric - * @created Oct 11, 2005 */ public class XmlTableValue { diff --git a/Service/src/main/java/org/gusdb/wdk/service/WdkServiceApplication.java b/Service/src/main/java/org/gusdb/wdk/service/WdkServiceApplication.java index 890a4dfd98..e070526544 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/WdkServiceApplication.java +++ b/Service/src/main/java/org/gusdb/wdk/service/WdkServiceApplication.java @@ -122,7 +122,7 @@ public Set> getClasses() { * Convenience method for subclasses to filter WDK services by class * object, either for removal or replacement * - * @param classes array of classes which should not be added to the application + * @param classesToFilterOut array of classes which should not be added to the application * @return predicate which filters those classes */ protected static Predicate> acceptAllExcept(Class... classesToFilterOut) { diff --git a/Service/src/main/java/org/gusdb/wdk/service/annotation/InSchema.java b/Service/src/main/java/org/gusdb/wdk/service/annotation/InSchema.java index 8b6d23cb40..68ff37dd7c 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/annotation/InSchema.java +++ b/Service/src/main/java/org/gusdb/wdk/service/annotation/InSchema.java @@ -16,11 +16,9 @@ * Paths are relative to the value source directory. *

    * - *

    - *

    -   *     @InSchema("users.idList.json")
    -   *   
    - *

    + *
    +   *   @InSchema("users.idList.json")
    +   * 
    */ String value(); } diff --git a/Service/src/main/java/org/gusdb/wdk/service/annotation/OutSchema.java b/Service/src/main/java/org/gusdb/wdk/service/annotation/OutSchema.java index ddc694b3d1..b7e304cf4f 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/annotation/OutSchema.java +++ b/Service/src/main/java/org/gusdb/wdk/service/annotation/OutSchema.java @@ -1,6 +1,5 @@ package org.gusdb.wdk.service.annotation; - import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -16,11 +15,9 @@ * Paths are relative to the value source directory. *

    * - *

    - *

    -   *     @InSchema("users.idList.json")
    -   *   
    - *

    + *
    +   *   @InSchema("users.idList.json")
    +   * 
    */ String value(); } diff --git a/Service/src/main/java/org/gusdb/wdk/service/formatter/ProjectFormatter.java b/Service/src/main/java/org/gusdb/wdk/service/formatter/ProjectFormatter.java index 0a29c520d1..466fcae614 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/formatter/ProjectFormatter.java +++ b/Service/src/main/java/org/gusdb/wdk/service/formatter/ProjectFormatter.java @@ -26,7 +26,7 @@ * oauthClientId: String * }, * profileProperties: [ - * { : String } + * { <propName>: String } * ] * } */ diff --git a/Service/src/main/java/org/gusdb/wdk/service/formatter/StepFormatter.java b/Service/src/main/java/org/gusdb/wdk/service/formatter/StepFormatter.java index 986ac6c8f1..4776168051 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/formatter/StepFormatter.java +++ b/Service/src/main/java/org/gusdb/wdk/service/formatter/StepFormatter.java @@ -39,7 +39,7 @@ * parameters: Object, * filters: Array, * viewFilters: Array, - * columnFilters: Map> + * columnFilters: Map<String,Map<String,Array<Object>> * legacyFilter: String, * wdkWeight: Number * }, diff --git a/Service/src/main/java/org/gusdb/wdk/service/request/filter/ColumnFilterServiceFormat.java b/Service/src/main/java/org/gusdb/wdk/service/request/filter/ColumnFilterServiceFormat.java index ad26fe6214..20d3ecc571 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/request/filter/ColumnFilterServiceFormat.java +++ b/Service/src/main/java/org/gusdb/wdk/service/request/filter/ColumnFilterServiceFormat.java @@ -9,7 +9,7 @@ public final class ColumnFilterServiceFormat { /** - * Parses the given JSON configuration into a {@link StandardColumnFilterConfigSetBuilder}. + * Parses the given JSON configuration into a {@link ColumnFilterConfigSetBuilder}. * * @param question * Question for which column filters are being configured. Used to provide @@ -17,7 +17,7 @@ public final class ColumnFilterServiceFormat { * @param config * User input JSON from the HTTP API. * - * @return A constructed {@code StandardColumnFilterConfigSetBuilder} containing the + * @return A constructed {@code ColumnFilterConfigSetBuilder} containing the * config data for a legal set of columns and filters. * * @throws WdkUserException diff --git a/Service/src/main/java/org/gusdb/wdk/service/request/strategy/StrategyRequest.java b/Service/src/main/java/org/gusdb/wdk/service/request/strategy/StrategyRequest.java index e95cce0b1d..8f262e023f 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/request/strategy/StrategyRequest.java +++ b/Service/src/main/java/org/gusdb/wdk/service/request/strategy/StrategyRequest.java @@ -58,7 +58,7 @@ public class StrategyRequest { * @param description * @param isSaved * @param isPublic - * @param stepTree + * @param rootStepId */ public StrategyRequest( String name, diff --git a/Service/src/main/java/org/gusdb/wdk/service/request/user/BasketRequests.java b/Service/src/main/java/org/gusdb/wdk/service/request/user/BasketRequests.java index 072f01e8d1..5820eac6f0 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/request/user/BasketRequests.java +++ b/Service/src/main/java/org/gusdb/wdk/service/request/user/BasketRequests.java @@ -76,7 +76,6 @@ public static class BasketActions extends PatchMap * Where PrimaryKey is [ { name: String, value: String } ]. * * @param json input object - * @return parsed actions to perform on IDs * @throws WdkModelException * @throws DataValidationException */ diff --git a/Service/src/main/java/org/gusdb/wdk/service/request/user/FavoriteRequests.java b/Service/src/main/java/org/gusdb/wdk/service/request/user/FavoriteRequests.java index 002c0ce30b..7b4a9bbbdd 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/request/user/FavoriteRequests.java +++ b/Service/src/main/java/org/gusdb/wdk/service/request/user/FavoriteRequests.java @@ -64,7 +64,7 @@ public static Optional fromString(String s) { public static class FavoriteActions extends PatchMap { /** - * Creates set of actions, each associated with a list of favorite ids + * Creates set of actions, each associated with a list of favorite IDs *

    * Input Format: *

    @@ -75,7 +75,6 @@ public static class FavoriteActions extends PatchMap {
          * 
    * * @param json input object - * @return parsed actions to perform on IDs * @throws DataValidationException * @throws WdkModelException */ diff --git a/Service/src/main/java/org/gusdb/wdk/service/service/AbstractWdkService.java b/Service/src/main/java/org/gusdb/wdk/service/service/AbstractWdkService.java index 9898db75a6..392b132dd9 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/service/AbstractWdkService.java +++ b/Service/src/main/java/org/gusdb/wdk/service/service/AbstractWdkService.java @@ -198,7 +198,7 @@ protected void triggerErrorEvents(List errors) { /** * Returns an error context for the current request * - * @return error context for the current request + * @return errorLocation location error occurred */ public ErrorContext getErrorContext(ErrorLocation errorLocation) { return getErrorContext(getRequest(), getWdkModel(), errorLocation); @@ -209,7 +209,7 @@ public ErrorContext getErrorContext(ErrorLocation errorLocation) { * * @param request current HTTP servlet request * @param wdkModel this WDK Model - * @return context data for this error + * @return errorLocation location error occurred */ public static ErrorContext getErrorContext(RequestData request, WdkModel wdkModel, ErrorLocation errorLocation) { return new ErrorContext( diff --git a/Service/src/main/java/org/gusdb/wdk/service/service/AnswerService.java b/Service/src/main/java/org/gusdb/wdk/service/service/AnswerService.java index 1230e0cbd5..09036b06ff 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/service/AnswerService.java +++ b/Service/src/main/java/org/gusdb/wdk/service/service/AnswerService.java @@ -227,14 +227,12 @@ public Response createCustomReportAnswerFromForm( } /** - * {@code GET} form of the service method {@link - * #buildDefaultReporterResult(JSONObject)}. + * {@code GET} form of the service method {@link #createStandardReportAnswer(JSONObject)}. *

    * This method is required because of Jersey's route matching trying to run * {@code GET} requests through the {@code buildDefaultReporterResult} method. * - * @see #getReport(String) - * @see #buildDefaultReporterResult(JSONObject) + * @see #createStandardReportAnswer(JSONObject) */ @GET @Path(STANDARD_REPORT_SEGMENT) @@ -246,10 +244,10 @@ public Response createStandardReportAnswer() } /** - * {@code GET} form of the {@link #buildResult(String, JSONObject)} service + * {@code GET} form of the {@link #createCustomReportAnswer(String, JSONObject)} service * method. * - * @see #buildResult(String, JSONObject) + * @see #createCustomReportAnswer(String, JSONObject) */ @GET @Path(CUSTOM_REPORT_SEGMENT) @@ -307,7 +305,7 @@ private static RunnableObj parseAnswerSpec(Question question, .getOrThrow(spec -> new DataValidationException(spec.getValidationBundle())); } - // TODO: now that this method is public, should find a better place for it + // TODO: now that this method is public, should find a better place for it public static StepContainer loadContainer(AnswerSpecBuilder specBuilder, WdkModel wdkModel, User sessionUser) throws WdkModelException, DataValidationException { diff --git a/Service/src/main/java/org/gusdb/wdk/service/service/QuestionService.java b/Service/src/main/java/org/gusdb/wdk/service/service/QuestionService.java index ed9200e021..ac5eefe21c 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/service/QuestionService.java +++ b/Service/src/main/java/org/gusdb/wdk/service/service/QuestionService.java @@ -158,7 +158,7 @@ public static DisplayablyValid getDisplayableAnswerSpec( *

        * {
        *   "contextParamValues": {
    -   *     "": String (stable value for param)
    +   *     "[each-param-name]": String (stable value for param)
        *   }
        * }
        * 
    diff --git a/Service/src/main/java/org/gusdb/wdk/service/service/search/ColumnFilterService.java b/Service/src/main/java/org/gusdb/wdk/service/service/search/ColumnFilterService.java index 369471ca72..051bc01b58 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/service/search/ColumnFilterService.java +++ b/Service/src/main/java/org/gusdb/wdk/service/service/search/ColumnFilterService.java @@ -58,7 +58,7 @@ public JSONArray getFilters() { * Retrieves and returns the input spec for the named filter on the current * column. * - * @param filter + * @param toolName * name of the filter for which the input spec was requested. * * @return Input specification for what the named filter expects as config diff --git a/Service/src/main/java/org/gusdb/wdk/service/service/search/ColumnReporterService.java b/Service/src/main/java/org/gusdb/wdk/service/service/search/ColumnReporterService.java index 13f15fe5de..18ea93b8b5 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/service/search/ColumnReporterService.java +++ b/Service/src/main/java/org/gusdb/wdk/service/service/search/ColumnReporterService.java @@ -127,10 +127,10 @@ public JsonNode getReporterDetails(@PathParam(COLUMN_TOOL_PATH_PARAM) final Stri @Consumes(MediaType.APPLICATION_JSON) public StreamingOutput runReporter( @PathParam(REPORT_NAME_PATH_PARAM) final String toolName, - final String requestStr + final String requestBody ) throws WdkModelException, WdkUserException, DataValidationException { try { - JSONObject requestJson = new JSONObject(requestStr); + JSONObject requestJson = new JSONObject(requestBody); // try to find and create a column reporter for this tool // (could validate this after answer spec, etc. but cheap and feel this error should be emitted first) diff --git a/Service/src/main/java/org/gusdb/wdk/service/service/user/DatasetService.java b/Service/src/main/java/org/gusdb/wdk/service/service/user/DatasetService.java index aa152a620c..7228e9ee02 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/service/user/DatasetService.java +++ b/Service/src/main/java/org/gusdb/wdk/service/service/user/DatasetService.java @@ -46,9 +46,9 @@ public DatasetService(@PathParam(USER_ID_PATH_PARAM) String uid) { *
        * {
        *   "displayName": String (optional),
    -   *   "sourceType": Enum // more types to come...
    +   *   "sourceType": Enum<IdList,Basket,Strategy,File> // more types to come...
        *   "sourceContent": {
    -   *     "ids": Array,        // only for IdList
    +   *     "ids": Array<String>,        // only for IdList
        *     "basketName": String,        // record class full name, only for basket
        *     "strategyId": Number,        // strategy id, only for strategy
        *     "temporaryFileId": String,   // temporary file id, only for file
    diff --git a/Service/src/main/java/org/gusdb/wdk/service/service/user/PreferenceService.java b/Service/src/main/java/org/gusdb/wdk/service/service/user/PreferenceService.java
    index c87ed222ee..7c61696f09 100644
    --- a/Service/src/main/java/org/gusdb/wdk/service/service/user/PreferenceService.java
    +++ b/Service/src/main/java/org/gusdb/wdk/service/service/user/PreferenceService.java
    @@ -42,15 +42,17 @@ public Response getUserPrefs() throws WdkModelException {
       }
     
       /**
    -   * Web service to update preferences of existing user with those provided in the request.  Null values cause a delete of the preference
    -   * @param userIdStr
    -   * @param body
    -   * @return - 204 - Success without content
    -   * @throws WdkModelException, DataValidationException
    -   * 
    +   * Web service to update preferences of existing user with those provided in the request.
    +   * Null values cause a delete of the preference.
    +   *
        * { action: 'clear' | 'update'
        *   updates: { json object }
        * }
    +   * 
    +   * @param body
    +   * @return 204 response - Success without content
    +   * @throws WdkModelException
    +   * @throws DataValidationException
        */
       @PATCH
       @Path("preferences/global")
    diff --git a/Service/src/main/java/org/gusdb/wdk/service/service/user/StepAnalysisFormService.java b/Service/src/main/java/org/gusdb/wdk/service/service/user/StepAnalysisFormService.java
    index 2fdfe04574..02b120f9bd 100644
    --- a/Service/src/main/java/org/gusdb/wdk/service/service/user/StepAnalysisFormService.java
    +++ b/Service/src/main/java/org/gusdb/wdk/service/service/user/StepAnalysisFormService.java
    @@ -140,7 +140,7 @@ public JSONObject getStepAnalysisTypeDataFromName(
        * 
        * {
        *   "contextParamValues": {
    -   *     "": String (stable value for param)
    +   *     "[each-param-name]": String (stable value for param)
        *   }
        * }
        * 
    diff --git a/Service/src/main/java/org/gusdb/wdk/service/service/user/StepAnalysisInstanceService.java b/Service/src/main/java/org/gusdb/wdk/service/service/user/StepAnalysisInstanceService.java index 337ae5265b..7b0830a9a6 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/service/user/StepAnalysisInstanceService.java +++ b/Service/src/main/java/org/gusdb/wdk/service/service/user/StepAnalysisInstanceService.java @@ -108,10 +108,10 @@ public long getStepId() { * Create a new step analysis; expects JSON in the following format: * { * analysisName: string - * parameters: object + * parameters: object>string,string> * displayName?: string * } - * @param body input JSON string + * @param json input JSON string * @return Details of the newly created step analysis instance as JSON */ @POST diff --git a/Service/src/main/java/org/gusdb/wdk/service/service/user/UserService.java b/Service/src/main/java/org/gusdb/wdk/service/service/user/UserService.java index 126c431db3..400e3fa959 100644 --- a/Service/src/main/java/org/gusdb/wdk/service/service/user/UserService.java +++ b/Service/src/main/java/org/gusdb/wdk/service/service/user/UserService.java @@ -47,8 +47,7 @@ protected boolean isUserIdSpecialString(String specialString) { * Ensures the target user exists and that the session user has the * permissions requested. If either condition is not true, the appropriate * exception (corresponding to 404 and 403 respectively) is thrown. - * - * @param userIdStr id string of the target user + * * @param requestedAccess the access requested by the caller * @return a userBundle representing the target user and his relationship to the session user * @throws WdkModelException if error occurs creating user bundle (probably a DB problem) From ef783f0548d7dc175ade24d466647e84012ac2e4 Mon Sep 17 00:00:00 2001 From: Ryan Doherty Date: Wed, 20 Apr 2022 23:23:46 -0400 Subject: [PATCH 3/5] Cherry pick plugin timeout fix from recent WSF commit 876cbf5c9cc147dcde7f0b8a3196e68b6ddf2406 --- .../org/gusdb/wsf/client/WsfRemoteClient.java | 30 +++++++++++++++++-- .../java/org/gusdb/wsf/common/WsfRequest.java | 1 + .../org/gusdb/wsf/plugin/PluginRequest.java | 23 ++++++++++---- 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/WSF/src/main/java/org/gusdb/wsf/client/WsfRemoteClient.java b/WSF/src/main/java/org/gusdb/wsf/client/WsfRemoteClient.java index cf8311e70f..efe92c51fb 100644 --- a/WSF/src/main/java/org/gusdb/wsf/client/WsfRemoteClient.java +++ b/WSF/src/main/java/org/gusdb/wsf/client/WsfRemoteClient.java @@ -4,8 +4,14 @@ import java.io.InputStream; import java.io.ObjectInputStream; import java.net.URI; +import java.time.Duration; import java.util.HashMap; import java.util.Map; +import java.util.Optional; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import javax.ws.rs.client.Client; import javax.ws.rs.client.ClientBuilder; @@ -52,9 +58,27 @@ public int invoke(ClientRequest request) throws ClientModelException, ClientUser form.param(WsfRequest.PARAM_REQUEST, request.toString()); // invoke service - Response response = client.target(serviceURI).property(ClientProperties.FOLLOW_REDIRECTS, Boolean.TRUE).request( - MediaType.APPLICATION_OCTET_STREAM_TYPE).post( - Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE)); + Response response; + try { + final Optional timeout = request.getRemoteExecuteTimeout(); + final Future responseFuture = client.target(serviceURI) + .property(ClientProperties.FOLLOW_REDIRECTS, Boolean.TRUE) + .request(MediaType.APPLICATION_OCTET_STREAM_TYPE) + .async() + .post(Entity.entity(form, MediaType.APPLICATION_FORM_URLENCODED_TYPE)); + if (timeout.isPresent()) { + response = responseFuture.get(timeout.get().toMillis(), TimeUnit.MILLISECONDS); + } else { + response = responseFuture.get(); + } + } catch (InterruptedException ex) { + LOG.warn(String.format("Interrupted while invoking service at %s.", serviceURI.toString()), ex); + Thread.currentThread().interrupt(); + throw new ClientModelException(ex); + } catch (ExecutionException | TimeoutException ex) { + LOG.warn(String.format("Exception while invoking service at %s.", serviceURI.toString()), ex); + throw new ClientModelException(ex); + } int status = response.getStatus(); if (status >= 400) throw new ClientModelException("Request failed with status code: " + status); diff --git a/WSF/src/main/java/org/gusdb/wsf/common/WsfRequest.java b/WSF/src/main/java/org/gusdb/wsf/common/WsfRequest.java index 5bbff28840..d8bbd22084 100644 --- a/WSF/src/main/java/org/gusdb/wsf/common/WsfRequest.java +++ b/WSF/src/main/java/org/gusdb/wsf/common/WsfRequest.java @@ -5,6 +5,7 @@ public interface WsfRequest { String PARAM_REQUEST = "request"; + String REMOTE_EXECUTE_TIMEOUT_ISO_8601_CONTEXT_KEY = "timeout_iso_8601"; /** * @return the projectId diff --git a/WSF/src/main/java/org/gusdb/wsf/plugin/PluginRequest.java b/WSF/src/main/java/org/gusdb/wsf/plugin/PluginRequest.java index 9925683658..63801deb21 100644 --- a/WSF/src/main/java/org/gusdb/wsf/plugin/PluginRequest.java +++ b/WSF/src/main/java/org/gusdb/wsf/plugin/PluginRequest.java @@ -1,11 +1,7 @@ package org.gusdb.wsf.plugin; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.time.Duration; +import java.util.*; import org.gusdb.fgputil.json.JsonUtil; import org.gusdb.wsf.common.WsfRequest; @@ -213,4 +209,19 @@ public void setContext(Map context) { this._context = new HashMap<>(context); } + public void appendContext(String key, String value) { + this._context = new HashMap<>(_context); + this._context.put(key, value); + } + + public void setContextTimeout(Duration value) { + this.appendContext(REMOTE_EXECUTE_TIMEOUT_ISO_8601_CONTEXT_KEY, value.toString()); + } + + public Optional getRemoteExecuteTimeout() { + return Optional.ofNullable(this._context.get(REMOTE_EXECUTE_TIMEOUT_ISO_8601_CONTEXT_KEY)) + .map(Duration::parse) + .filter(duration -> !duration.isZero()); + } + } From 4578ee27eb5a458dd7922d067c40972118fb88ce Mon Sep 17 00:00:00 2001 From: Ryan Doherty Date: Thu, 21 Apr 2022 04:17:37 -0400 Subject: [PATCH 4/5] streamline build.xml --- build.xml | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/build.xml b/build.xml index 36961131e0..073994cf33 100755 --- a/build.xml +++ b/build.xml @@ -1,16 +1,11 @@ - - - - - @@ -18,13 +13,6 @@ - - - - - - - @@ -41,14 +29,14 @@ - + - + @@ -79,6 +67,7 @@ + Date: Mon, 25 Apr 2022 15:53:09 -0400 Subject: [PATCH 5/5] Change gus pom name --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6ff2084871..e0e8b7692e 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ org.gusdb - shared-project-pom + gus-project-pom 1.0.0 ../install/pom.xml
    User Dataset Sharing Columns Definition
    ColumnType