Cleaned unnecessary comments and unused code 

Project: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-gis/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-gis/commit/e7744a5d
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-gis/tree/e7744a5d
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-gis/diff/e7744a5d

Branch: refs/heads/taverna2
Commit: e7744a5d0dc190be19552d967a6d9c6b0a9ae782
Parents: da87620
Author: edikaradumi <[email protected]>
Authored: Sun Jul 10 16:24:55 2016 +0100
Committer: edikaradumi <[email protected]>
Committed: Sun Jul 10 16:24:55 2016 +0100

----------------------------------------------------------------------
 .../gis/ui/config/GisConfigurationPanel.java    |  14 +--
 .../gis/ui/serviceprovider/GisServiceDesc.java  |   5 +-
 .../ui/serviceprovider/GisServiceProvider.java  |   5 +-
 .../org/apache/taverna/gis/GisActivity.java     | 123 +++----------------
 .../gis/GisActivityConfigurationBean.java       |   4 +-
 5 files changed, 28 insertions(+), 123 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-gis/blob/e7744a5d/apache-taverna-plugin-gis-activity-ui/src/main/java/org/apache/taverna/gis/ui/config/GisConfigurationPanel.java
----------------------------------------------------------------------
diff --git 
a/apache-taverna-plugin-gis-activity-ui/src/main/java/org/apache/taverna/gis/ui/config/GisConfigurationPanel.java
 
b/apache-taverna-plugin-gis-activity-ui/src/main/java/org/apache/taverna/gis/ui/config/GisConfigurationPanel.java
index 2980ffd..dd5a965 100644
--- 
a/apache-taverna-plugin-gis-activity-ui/src/main/java/org/apache/taverna/gis/ui/config/GisConfigurationPanel.java
+++ 
b/apache-taverna-plugin-gis-activity-ui/src/main/java/org/apache/taverna/gis/ui/config/GisConfigurationPanel.java
@@ -22,7 +22,7 @@ public class GisConfigurationPanel
        private GisActivity activity;
        private GisActivityConfigurationBean configBean;
        
-       private JTextField fieldString;
+       private JTextField fieldProcessIdentifier;
        private JTextField fieldURI;
 
        public GisConfigurationPanel(GisActivity activity) {
@@ -37,9 +37,9 @@ public class GisConfigurationPanel
                // FIXME: Create GUI depending on activity configuration bean
                JLabel labelString = new JLabel("Example string:");
                add(labelString);
-               fieldString = new JTextField(20);
-               add(fieldString);
-               labelString.setLabelFor(fieldString);
+               fieldProcessIdentifier = new JTextField(20);
+               add(fieldProcessIdentifier);
+               labelString.setLabelFor(fieldProcessIdentifier);
 
                JLabel labelURI = new JLabel("Example URI:");
                add(labelURI);
@@ -86,7 +86,7 @@ public class GisConfigurationPanel
                String originalString = configBean.getProcessIdentifier();
                String originalUri = 
configBean.getOgcServiceUri().toASCIIString();
                // true (changed) unless all fields match the originals
-               return ! (originalString.equals(fieldString.getText())
+               return ! 
(originalString.equals(fieldProcessIdentifier.getText())
                                && originalUri.equals(fieldURI.getText()));
        }
 
@@ -99,7 +99,7 @@ public class GisConfigurationPanel
                configBean = new GisActivityConfigurationBean();
                
                // FIXME: Update bean fields from your UI elements
-               configBean.setProcessIdentifier(fieldString.getText());
+               
configBean.setProcessIdentifier(fieldProcessIdentifier.getText());
                configBean.setOgcServiceUri(URI.create(fieldURI.getText()));
        }
 
@@ -112,7 +112,7 @@ public class GisConfigurationPanel
                configBean = activity.getConfiguration();
                
                // FIXME: Update UI elements from your bean fields
-               fieldString.setText(configBean.getProcessIdentifier());
+               
fieldProcessIdentifier.setText(configBean.getProcessIdentifier());
                fieldURI.setText(configBean.getOgcServiceUri().toASCIIString());
        }
 }

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-gis/blob/e7744a5d/apache-taverna-plugin-gis-activity-ui/src/main/java/org/apache/taverna/gis/ui/serviceprovider/GisServiceDesc.java
----------------------------------------------------------------------
diff --git 
a/apache-taverna-plugin-gis-activity-ui/src/main/java/org/apache/taverna/gis/ui/serviceprovider/GisServiceDesc.java
 
b/apache-taverna-plugin-gis-activity-ui/src/main/java/org/apache/taverna/gis/ui/serviceprovider/GisServiceDesc.java
index fdae85b..ba19723 100644
--- 
a/apache-taverna-plugin-gis-activity-ui/src/main/java/org/apache/taverna/gis/ui/serviceprovider/GisServiceDesc.java
+++ 
b/apache-taverna-plugin-gis-activity-ui/src/main/java/org/apache/taverna/gis/ui/serviceprovider/GisServiceDesc.java
@@ -82,9 +82,8 @@ public class GisServiceDesc extends 
ServiceDescription<GisActivityConfigurationB
        }
 
        
-       // FIXME: Replace example fields and getters/setters with any required
-       // and optional fields. (All fields are searchable in the Service 
palette,
-       // for instance try a search for exampleString:3)
+       // All fields are searchable in the Service palette,
+       // for instance try a search for exampleString:3
        private URI ogcServiceUri;
        private String processIdentifier;
        private List<ActivityInputPortDefinitionBean> inputPortDefinitions;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-gis/blob/e7744a5d/apache-taverna-plugin-gis-activity-ui/src/main/java/org/apache/taverna/gis/ui/serviceprovider/GisServiceProvider.java
----------------------------------------------------------------------
diff --git 
a/apache-taverna-plugin-gis-activity-ui/src/main/java/org/apache/taverna/gis/ui/serviceprovider/GisServiceProvider.java
 
b/apache-taverna-plugin-gis-activity-ui/src/main/java/org/apache/taverna/gis/ui/serviceprovider/GisServiceProvider.java
index d252201..f5ea684 100644
--- 
a/apache-taverna-plugin-gis-activity-ui/src/main/java/org/apache/taverna/gis/ui/serviceprovider/GisServiceProvider.java
+++ 
b/apache-taverna-plugin-gis-activity-ui/src/main/java/org/apache/taverna/gis/ui/serviceprovider/GisServiceProvider.java
@@ -51,7 +51,7 @@ public class GisServiceProvider extends 
AbstractConfigurableServiceProvider<GisS
                // TODO: Optional: set description (Set a better description
                
service.setDescription(getConfiguration().getProcessIdentifier());
 
-               // TODO: Exctract in separate method 
+               // TODO: Exctract in a separate method 
                // Get input ports
                
                WPSClientSession wpsClient = WPSClientSession.getInstance();
@@ -109,9 +109,6 @@ public class GisServiceProvider extends 
AbstractConfigurableServiceProvider<GisS
                // for-loop if the full search takes a long time
                callBack.partialResults(results);
 
-               
-               
-               
                // No more results will be coming
                callBack.finished();
        }

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-gis/blob/e7744a5d/apache-taverna-plugin-gis-activity/src/main/java/org/apache/taverna/gis/GisActivity.java
----------------------------------------------------------------------
diff --git 
a/apache-taverna-plugin-gis-activity/src/main/java/org/apache/taverna/gis/GisActivity.java
 
b/apache-taverna-plugin-gis-activity/src/main/java/org/apache/taverna/gis/GisActivity.java
index fc69c28..a6bc792 100644
--- 
a/apache-taverna-plugin-gis-activity/src/main/java/org/apache/taverna/gis/GisActivity.java
+++ 
b/apache-taverna-plugin-gis-activity/src/main/java/org/apache/taverna/gis/GisActivity.java
@@ -32,12 +32,6 @@ import 
net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputP
 
 public class GisActivity extends 
AbstractAsynchronousActivity<GisActivityConfigurationBean>
                implements AsynchronousActivity<GisActivityConfigurationBean> {
-
-       /*
-        * Best practice: Keep port names as constants to avoid misspelling. 
This
-        * would not apply if port names are looked up dynamically from the 
service
-        * operation, like done for WSDL services.
-        */
        
        private GisActivityConfigurationBean configBean;
 
@@ -49,16 +43,9 @@ public class GisActivity extends 
AbstractAsynchronousActivity<GisActivityConfigu
                if (configBean.getOgcServiceUri().equals("")) {
                        throw new ActivityConfigurationException("Geospatial 
web service URI can't be empty");
                }
-               // Store for getConfiguration(), but you could also make
-               // getConfiguration() return a new bean from other sources
+               // Store for getConfiguration()
                this.configBean = configBean;
 
-               // OPTIONAL:
-               // Do any server-side lookups and configuration, like resolving 
WSDLs
-
-               // myClient = new MyClient(configBean.getExampleUri());
-               // this.service = 
myClient.getService(configBean.getExampleString());
-
                // REQUIRED: (Re)create input/output ports depending on 
configuration
                configurePorts();
        }
@@ -69,106 +56,55 @@ public class GisActivity extends 
AbstractAsynchronousActivity<GisActivityConfigu
                removeInputs();
                removeOutputs();
 
-               // FIXME: Replace with your input and output port definitions
-
+               // Add input ports
                for(ActivityInputPortDefinitionBean inputPort : 
configBean.getInputPortDefinitions())
                {
                        
addInput(inputPort.getName(),inputPort.getDepth(),inputPort.getAllowsLiteralValues(),inputPort.getHandledReferenceSchemes(),
 inputPort.getTranslatedElementType());
                }
                
-//             // Hard coded input port, expecting a single String
-//             addInput(IN_FIRSTNAME, 0, true, null, String.class);
-
-               //
-               // // Optional ports depending on configuration
-               // if (configBean.getExampleString().equals("specialCase")) {
-               // // depth 1, ie. list of binary byte[] arrays
-               // addInput(IN_EXTRA_DATA, 1, true, null, byte[].class);
-               // addOutput(OUT_REPORT, 0);
-               // }
-
+               // Add output ports
                for(ActivityOutputPortDefinitionBean outputPort : 
configBean.getOutputPortDefinitions())
                {
                        addOutput(outputPort.getName(),outputPort.getDepth());
                }
                
-//             // Single value output port (depth 0)
-//             addOutput(OUT_FULLNAME, 0);
-//             // // Output port with list of values (depth 1)
-//             // addOutput(OUT_MORE_OUTPUTS, 1);
-
        }
 
        @SuppressWarnings("unchecked")
        @Override
        public void executeAsynch(final Map<String, T2Reference> inputs, final 
AsynchronousActivityCallback callback) {
-               // Don't execute service directly now, request to be run ask to 
be run
-               // from thread pool and return asynchronously
+               // Execute service asynchronously
                callback.requestRun(new Runnable() {
 
                        public void run() {
                                InvocationContext context = 
callback.getContext();
                                ReferenceService referenceService = 
context.getReferenceService();
-//                             // Resolve inputs
-//                             String firstNameInput = (String) 
referenceService.renderIdentifier(inputs.get(IN_FIRSTNAME), String.class, 
context);
-//                             String lastNameInput = (String) 
referenceService.renderIdentifier(inputs.get(IN_LASTNAME), String.class, 
context);
-
-                               // // Support our configuration-dependendent 
input
-                               // boolean optionalPorts =
-                               // 
configBean.getExampleString().equals("specialCase");
-                               //
-                               // List<byte[]> special = null;
-                               // // We'll also allow IN_EXTRA_DATA to be 
optionally not
-                               // provided
-                               // if (optionalPorts && 
inputs.containsKey(IN_EXTRA_DATA)) {
-                               // // Resolve as a list of byte[]
-                               // special = (List<byte[]>) 
referenceService.renderIdentifier(
-                               // inputs.get(IN_EXTRA_DATA), byte[].class, 
context);
-                               // }
-
-                               // TODO: Do the actual service invocation
-                               // try {
-                               // results = this.service.invoke(firstInput, 
special)
-                               // } catch (ServiceException ex) {
-                               // callback.fail("Could not invoke Gis service 
" +
-                               // configBean.getExampleUri(),
-                               // ex);
-                               // // Make sure we don't call 
callback.receiveResult later
-                               // return;
-                               // }
-
-//                             String wpsURL = 
"http://localhost:8080/geoserver/ows";;
-//
-//                             String processID = "gs:StringConcatWPS";
-
-                               // Register outputs
+
+                               // Declare outputs variable
                                Map<String, T2Reference> outputs = null;
                                
                                try {
-
+                                       
+                                       // prepare the execute object
                                        WPSClientSession wpsClient = 
WPSClientSession.getInstance();
 
                                        ProcessDescriptionType 
processDescription = 
wpsClient.getProcessDescription(configBean.getOgcServiceUri().toString(), 
configBean.getProcessIdentifier());
-                                       // configBean.getWpsUri().toString(),
-                                       // 
configBean.getProcessBrief().getIdentifier().getStringValue());
-
+                                       
                                        ExecuteRequestBuilder executeBuilder = 
new ExecuteRequestBuilder(processDescription);
 
                                        for (ActivityInputPortDefinitionBean 
activityInputPort : configBean.getInputPortDefinitions()) {
                                                String portValue = (String) 
referenceService.renderIdentifier(inputs.get(activityInputPort.getName()), 
String.class, context);
                                                
executeBuilder.addLiteralData(activityInputPort.getName(), portValue);
                                        }
-                                       
-//                                     
executeBuilder.addLiteralData(IN_FIRSTNAME, (String) firstNameInput);
-//                                     
executeBuilder.addLiteralData(IN_LASTNAME, (String) lastNameInput);
-
-                                       // execute request
+                               
                                        ExecuteDocument execute = 
executeBuilder.getExecute();
-                                       // 
wpsClient.retrieveExecuteResponseViaPOST(configBean.getWpsUri().toString(),
-                                       // execute, false);
+                       
                                        execute.getExecute().setService("WPS");
+                                       
                                        Object responseObject = null;
+                                       
                                        try {
+                                               // execute service
                                                responseObject = 
wpsClient.execute(configBean.getOgcServiceUri().toString(), execute);
                                        } catch (WPSClientException e) {
                                                // if the an error return from 
service
@@ -181,12 +117,13 @@ public class GisActivity extends 
AbstractAsynchronousActivity<GisActivityConfigu
                                        
                                        if (responseObject instanceof 
ExecuteResponseDocument) {
                                    ExecuteResponseDocument response = 
(ExecuteResponseDocument) responseObject;
+                                   
+                                   // analyser is used to get complex data
                                    ExecuteResponseAnalyser analyser = new 
ExecuteResponseAnalyser(
                                            execute, response, 
processDescription);
                                    
                                    for(OutputDataType output : 
response.getExecuteResponse().getProcessOutputs().getOutputArray())
                                                {
-                                       
                                        DataType data = output.getData();
                                        
                                        if (data.isSetLiteralData())
@@ -203,38 +140,10 @@ public class GisActivity extends 
AbstractAsynchronousActivity<GisActivityConfigu
                                        
                                } catch (WPSClientException e) {
                                        callback.fail(e.getMessage());
-//                             } catch (ServiceException e) {
-//                                     callback.fail(e.getMessage());
                                } catch (IOException e) {
                                        callback.fail(e.getMessage());
                                }
 
-//                             // Register outputs
-//                             Map<String, T2Reference> outputs = new 
HashMap<String, T2Reference>();
-//                             String simpleValue = "simple";
-//                             T2Reference simpleRef = 
referenceService.register(simpleValue, 0, true, context);
-//                             outputs.put(OUT_SIMPLE_OUTPUT, simpleRef);
-
-                               // // For list outputs, only need to register 
the top level list
-                               // List<String> moreValues = new 
ArrayList<String>();
-                               // moreValues.add("Value 1");
-                               // moreValues.add("Value 2");
-                               // T2Reference moreRef = 
referenceService.register(moreValues,
-                               // 1, true, context);
-                               // outputs.put(OUT_MORE_OUTPUTS, moreRef);
-                               //
-                               // if (optionalPorts) {
-                               // // Populate our optional output port
-                               // // NOTE: Need to return output values for 
all defined output
-                               // ports
-                               // String report = "Everything OK";
-                               // outputs.put(OUT_REPORT, 
referenceService.register(report,
-                               // 0, true, context));
-                               // }
-
-                               // return map of output data, with empty index 
array as this is
-                               // the only and final result (this index 
parameter is used if
-                               // pipelining output)
                                callback.receiveResult(outputs, new int[0]);
                        }
                });

http://git-wip-us.apache.org/repos/asf/incubator-taverna-plugin-gis/blob/e7744a5d/apache-taverna-plugin-gis-activity/src/main/java/org/apache/taverna/gis/GisActivityConfigurationBean.java
----------------------------------------------------------------------
diff --git 
a/apache-taverna-plugin-gis-activity/src/main/java/org/apache/taverna/gis/GisActivityConfigurationBean.java
 
b/apache-taverna-plugin-gis-activity/src/main/java/org/apache/taverna/gis/GisActivityConfigurationBean.java
index 24e3001..4f42986 100644
--- 
a/apache-taverna-plugin-gis-activity/src/main/java/org/apache/taverna/gis/GisActivityConfigurationBean.java
+++ 
b/apache-taverna-plugin-gis-activity/src/main/java/org/apache/taverna/gis/GisActivityConfigurationBean.java
@@ -15,7 +15,7 @@ import 
net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityPortsDe
 public class GisActivityConfigurationBean extends ActivityPortsDefinitionBean 
implements Serializable {
 
        /*
-        * TODO: Remove this comment.
+        * TODO: Remove this comment. Should the jackson ojbect be managed in 
this class?
         * 
         * The configuration specifies the variable options and configurations 
for
         * an activity that has been added to a workflow. For instance for a 
WSDL
@@ -32,7 +32,7 @@ public class GisActivityConfigurationBean extends 
ActivityPortsDefinitionBean im
         * be referenced as well, as long as they are part of the same plugin.
         */
        
-       // TODO: Remove the example fields and getters/setters and add your own 
+
        private URI ogcServiceUri;
        private String processIdentifier;
        

Reply via email to