http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringListMerge ---------------------------------------------------------------------- diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringListMerge b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringListMerge index cdd408d..91876fa 100644 --- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringListMerge +++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringListMerge @@ -1,4 +1,4 @@ -<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> +<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> <script>String seperatorString = "\n"; if (seperator != void) { seperatorString = seperator; @@ -15,7 +15,7 @@ concatenated = sb.toString(); </script> <dependencies /> <inputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> <handledReferenceSchemes /> <translatedElementType>java.lang.String</translatedElementType> <allowsLiteralValues>true</allowsLiteralValues> @@ -24,8 +24,8 @@ concatenated = sb.toString(); <mimeTypes> <string>l('text/plain')</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> <handledReferenceSchemes /> <translatedElementType>java.lang.String</translatedElementType> <allowsLiteralValues>true</allowsLiteralValues> @@ -34,16 +34,16 @@ concatenated = sb.toString(); <mimeTypes> <string>'text/plain'</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> </inputs> <outputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> <granularDepth>0</granularDepth> <name>concatenated</name> <depth>0</depth> <mimeTypes> <string>'text/plain'</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> </outputs> -</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file +</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetDifference ---------------------------------------------------------------------- diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetDifference b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetDifference index c7bb289..d9a1022 100644 --- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetDifference +++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetDifference @@ -1,4 +1,4 @@ -<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> +<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> <script>List difference = new ArrayList(); for (Iterator i = list1.iterator(); i.hasNext();) { Object o = i.next(); @@ -15,7 +15,7 @@ for (Iterator i = list2.iterator(); i.hasNext();) { </script> <dependencies /> <inputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> <handledReferenceSchemes /> <translatedElementType>java.lang.String</translatedElementType> <allowsLiteralValues>true</allowsLiteralValues> @@ -24,8 +24,8 @@ for (Iterator i = list2.iterator(); i.hasNext();) { <mimeTypes> <string>l('text/plain')</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> <handledReferenceSchemes /> <translatedElementType>java.lang.String</translatedElementType> <allowsLiteralValues>true</allowsLiteralValues> @@ -34,16 +34,16 @@ for (Iterator i = list2.iterator(); i.hasNext();) { <mimeTypes> <string>l('text/plain')</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> </inputs> <outputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> <granularDepth>1</granularDepth> <name>difference</name> <depth>1</depth> <mimeTypes> <string>l('text/plain')</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> </outputs> -</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file +</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetIntersection ---------------------------------------------------------------------- diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetIntersection b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetIntersection index a4c2f5a..c7cd72b 100644 --- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetIntersection +++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetIntersection @@ -1,4 +1,4 @@ -<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> +<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> <script>List intersection = new ArrayList(); for (Iterator i = list1.iterator(); i.hasNext();) { Object o = i.next(); @@ -9,7 +9,7 @@ for (Iterator i = list1.iterator(); i.hasNext();) { </script> <dependencies /> <inputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> <handledReferenceSchemes /> <translatedElementType>java.lang.String</translatedElementType> <allowsLiteralValues>true</allowsLiteralValues> @@ -18,8 +18,8 @@ for (Iterator i = list1.iterator(); i.hasNext();) { <mimeTypes> <string>l('text/plain')</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> <handledReferenceSchemes /> <translatedElementType>java.lang.String</translatedElementType> <allowsLiteralValues>true</allowsLiteralValues> @@ -28,16 +28,16 @@ for (Iterator i = list1.iterator(); i.hasNext();) { <mimeTypes> <string>l('text/plain')</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> </inputs> <outputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> <granularDepth>1</granularDepth> <name>intersection</name> <depth>1</depth> <mimeTypes> <string>l('text/plain')</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> </outputs> -</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file +</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetUnion ---------------------------------------------------------------------- diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetUnion b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetUnion index 1ef0958..154c67d 100644 --- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetUnion +++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringSetUnion @@ -1,6 +1,6 @@ <activity xmlns="http://taverna.sf.net/2008/xml/t2flow"> -<class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> +<class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> <script>Set results = new HashSet(); results.addAll(list1); results.addAll(list2); @@ -9,7 +9,7 @@ union.addAll(results); </script> <dependencies /> <inputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> <handledReferenceSchemes /> <translatedElementType>java.lang.String</translatedElementType> <allowsLiteralValues>true</allowsLiteralValues> @@ -18,8 +18,8 @@ union.addAll(results); <mimeTypes> <string>l('text/plain')</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> <handledReferenceSchemes /> <translatedElementType>java.lang.String</translatedElementType> <allowsLiteralValues>true</allowsLiteralValues> @@ -28,16 +28,16 @@ union.addAll(results); <mimeTypes> <string>l('text/plain')</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> </inputs> <outputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> <granularDepth>1</granularDepth> <name>union</name> <depth>1</depth> <mimeTypes> <string>l('text/plain')</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> </outputs> -</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file +</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringStripDuplicates ---------------------------------------------------------------------- diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringStripDuplicates b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringStripDuplicates index 310dccc..6ecd7c8 100644 --- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringStripDuplicates +++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.StringStripDuplicates @@ -1,4 +1,4 @@ -<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> +<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> <script>List strippedlist = new ArrayList(); for (Iterator i = stringlist.iterator(); i.hasNext();) { String item = (String) i.next(); @@ -9,7 +9,7 @@ for (Iterator i = stringlist.iterator(); i.hasNext();) { </script> <dependencies /> <inputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> <handledReferenceSchemes /> <translatedElementType>java.lang.String</translatedElementType> <allowsLiteralValues>true</allowsLiteralValues> @@ -18,16 +18,16 @@ for (Iterator i = stringlist.iterator(); i.hasNext();) { <mimeTypes> <string>l('text/plain')</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> </inputs> <outputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> <granularDepth>1</granularDepth> <name>strippedlist</name> <depth>1</depth> <mimeTypes> <string>l('text/plain')</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> </outputs> -</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file +</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestAlwaysFailingProcessor ---------------------------------------------------------------------- diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestAlwaysFailingProcessor b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestAlwaysFailingProcessor index 790073a..6632920 100644 --- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestAlwaysFailingProcessor +++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestAlwaysFailingProcessor @@ -1,8 +1,8 @@ -<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> +<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> <script>throw new Exception("This script fails");</script> <dependencies /> <inputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> <handledReferenceSchemes /> <translatedElementType>java.lang.String</translatedElementType> <allowsLiteralValues>true</allowsLiteralValues> @@ -11,8 +11,8 @@ <mimeTypes> <string>'text/plain'</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> <handledReferenceSchemes /> <translatedElementType>java.lang.String</translatedElementType> <allowsLiteralValues>true</allowsLiteralValues> @@ -21,16 +21,16 @@ <mimeTypes> <string>'text/plain'</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> </inputs> <outputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> <granularDepth>0</granularDepth> <name>urgle</name> <depth>0</depth> <mimeTypes> <string>'text/plain'</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> </outputs> -</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file +</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestSometimesFails ---------------------------------------------------------------------- diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestSometimesFails b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestSometimesFails index 90e8ba8..0b98e4f 100644 --- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestSometimesFails +++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.TestSometimesFails @@ -1,4 +1,4 @@ -<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> +<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> <script>import java.util.Random; Random r = new Random(); @@ -10,7 +10,7 @@ if ((r.nextInt() % 4) == 0) { out = in;</script> <dependencies /> <inputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> <handledReferenceSchemes /> <translatedElementType>java.lang.String</translatedElementType> <allowsLiteralValues>true</allowsLiteralValues> @@ -19,16 +19,16 @@ out = in;</script> <mimeTypes> <string>'text/plain'</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> </inputs> <outputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> <granularDepth>0</granularDepth> <name>out</name> <depth>0</depth> <mimeTypes> <string>'text/plain'</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> </outputs> -</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file +</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebImageFetcher ---------------------------------------------------------------------- diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebImageFetcher b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebImageFetcher index db3a73a..94a8ffd 100644 --- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebImageFetcher +++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebImageFetcher @@ -1,4 +1,4 @@ -<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> +<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> <script>if ((url == void) || (url == null)) { throw new RuntimeException("The url must be specified"); } @@ -30,7 +30,7 @@ os.close(); </script> <dependencies /> <inputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> <handledReferenceSchemes /> <translatedElementType>java.lang.String</translatedElementType> <allowsLiteralValues>true</allowsLiteralValues> @@ -39,8 +39,8 @@ os.close(); <mimeTypes> <string>'text/x-taverna-web-url'</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> <handledReferenceSchemes /> <translatedElementType>java.lang.String</translatedElementType> <allowsLiteralValues>true</allowsLiteralValues> @@ -49,16 +49,16 @@ os.close(); <mimeTypes> <string>'text/x-taverna-web-url'</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> </inputs> <outputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> <granularDepth>0</granularDepth> <name>image</name> <depth>0</depth> <mimeTypes> <string>'image/*'</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> </outputs> -</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file +</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebPageFetcher ---------------------------------------------------------------------- diff --git a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebPageFetcher b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebPageFetcher index dcd76a6..7d7a4f6 100644 --- a/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebPageFetcher +++ b/taverna-localworker-activity-ui/src/main/resources/org.embl.ebi.escience.scuflworkers.java.WebPageFetcher @@ -1,4 +1,4 @@ -<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> +<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>org.apache.taverna.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean xmlns=""> <script>if ((url == void) || (url == null)) { throw new RuntimeException("The url must be specified"); } @@ -34,7 +34,7 @@ contents = result.toString(); </script> <dependencies /> <inputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> <handledReferenceSchemes /> <translatedElementType>java.lang.String</translatedElementType> <allowsLiteralValues>true</allowsLiteralValues> @@ -43,8 +43,8 @@ contents = result.toString(); <mimeTypes> <string>'text/x-taverna-web-url'</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> <handledReferenceSchemes /> <translatedElementType>java.lang.String</translatedElementType> <allowsLiteralValues>true</allowsLiteralValues> @@ -53,16 +53,16 @@ contents = result.toString(); <mimeTypes> <string>'text/x-taverna-web-url'</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean> </inputs> <outputs> - <net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + <org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> <granularDepth>0</granularDepth> <name>contents</name> <depth>0</depth> <mimeTypes> <string>'text/plain,text/html'</string> </mimeTypes> - </net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> + </org.apache.taverna.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean> </outputs> -</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file +</org.apache.taverna.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/pom.xml ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/pom.xml b/taverna-rest-activity-ui/pom.xml index 5268144..74d62b1 100644 --- a/taverna-rest-activity-ui/pom.xml +++ b/taverna-rest-activity-ui/pom.xml @@ -16,15 +16,15 @@ <dependencies> <dependency> - <groupId>org.apache.taverna.commonactivities</groupId> - <artifactId>taverna-rest-activity</artifactId> - <version>${taverna.commonactivities.version}</version> - </dependency> - <dependency> <groupId>org.apache.taverna.engine</groupId> <artifactId>taverna-services-api</artifactId> <version>${taverna.engine.version}</version> </dependency> + <dependency> + <groupId>org.apache.taverna.commonactivities</groupId> + <artifactId>taverna-rest-activity</artifactId> + <version>${taverna.commonactivities.version}</version> + </dependency> <dependency> <groupId>org.apache.taverna.workbench</groupId> <artifactId>taverna-activity-tools</artifactId> http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/HTTPHeadersTableModel.java ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/HTTPHeadersTableModel.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/HTTPHeadersTableModel.java deleted file mode 100644 index 30507c9..0000000 --- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/HTTPHeadersTableModel.java +++ /dev/null @@ -1,119 +0,0 @@ -package net.sf.taverna.t2.activities.rest.ui.config; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; - -import javax.swing.table.AbstractTableModel; - -@SuppressWarnings("serial") -public class HTTPHeadersTableModel extends AbstractTableModel { - - protected String[] columnNames; - protected ArrayList<ArrayList<String>> data; - - public HTTPHeadersTableModel() { - columnNames = new String[] {"HTTP Header Name", "HTTP Header Value"}; - data = new ArrayList<ArrayList<String>>(); - } - - public String getColumnName(int column) { - return columnNames[column]; - } - - public boolean isCellEditable(int row, int column) { - return true; - } - - public int getColumnCount() - { - return columnNames.length; - } - - public int getRowCount() - { - return data.size(); - } - - public Object getValueAt(int row, int column) - { - return data.get(row).get(column); - } - - public void setValueAt(Object value, int row, int column) { - if ((row < 0) || (column < 0)) { - throw new IllegalArgumentException("Invalid row/column setting"); - } - data.get(row).set(column, (String)value); - } - - /** - * Get the class at of the cells at the given column position. - */ - public Class<? extends Object> getColumnClass(int iCol) - { - return getValueAt(0, iCol).getClass(); - } - - - public void addEmptyRow() { - data.add(new ArrayList<String>(Arrays.asList("", ""))); // add empty row - fireTableRowsInserted( - data.size() - 1, - data.size() - 1); - } - - public void addRow(ArrayList<String> headerValuePair) { - data.add(headerValuePair); - fireTableRowsInserted( - data.size() - 1, - data.size() - 1); - } - - public void removeRow(int row) - { - if (row >=0 && row < data.size()){ - data.remove(row); - fireTableRowsDeleted(row, row); - } - } - - public ArrayList<ArrayList<String>> getHTTPHeaderData(){ - // Return a deep copy of the 2-dimensional array - return deepCopy(data); - } - - public void setHTTPHeaderData(ArrayList<ArrayList<String>> data){ - this.data = deepCopy(data); - fireTableChanged(null); - } - - public ArrayList<String> getHTTPHeaderNames(){ - ArrayList<String> headerNames = new ArrayList<String>(); - for (ArrayList<String> headerNameValuePair : data){ - headerNames.add(headerNameValuePair.get(0)); - } - return headerNames; - } - - public ArrayList<String> getHTTPHeaderValues(){ - ArrayList<String> headerValues = new ArrayList<String>(); - for (ArrayList<String> headerNameValuePair : data){ - headerValues.add(headerNameValuePair.get(1)); - } - return headerValues; - } - - public static ArrayList<ArrayList<String>> deepCopy(ArrayList<ArrayList<String>> src) - { - ArrayList<ArrayList<String>> dest = new ArrayList<ArrayList<String>>(); - - for (int i = 0; i< src.size(); i++){ - dest.add(new ArrayList<String>(Arrays.asList(new String[src.get(i).size()]))); - Collections.copy(dest.get(i), src.get(i)); - } - return dest; - } - -} - http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigurationPanel.java ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigurationPanel.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigurationPanel.java deleted file mode 100644 index 3f1ae9b..0000000 --- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigurationPanel.java +++ /dev/null @@ -1,670 +0,0 @@ -package net.sf.taverna.t2.activities.rest.ui.config; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.Scanner; - -import javax.swing.Icon; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.ListSelectionModel; - -import org.apache.taverna.activities.rest.RESTActivity; -import org.apache.taverna.activities.rest.RESTActivity.DATA_FORMAT; -import org.apache.taverna.activities.rest.RESTActivity.HTTP_METHOD; -import org.apache.taverna.activities.rest.RESTActivityConfigurationBean; -import org.apache.taverna.activities.rest.URISignatureHandler; -import org.apache.taverna.activities.rest.URISignatureHandler.URISignatureParsingException; -import net.sf.taverna.t2.workbench.MainWindow; -import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.MultiPageActivityConfigurationPanel; -import org.apache.taverna.commons.services.ServiceRegistry; -import org.apache.taverna.scufl2.api.activity.Activity; - -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; - -@SuppressWarnings("serial") -public class RESTActivityConfigurationPanel extends MultiPageActivityConfigurationPanel { - private static final Icon infoIcon = new ImageIcon( - RESTActivityConfigurationPanel.class.getResource("information.png")); - - // GENERAL tab - private JComboBox<HTTP_METHOD> cbHTTPMethod; // HTTP method of this REST activity - private JTextField tfURLSignature; // URL signature that determines its - // input ports - private JComboBox<String> cbAccepts; // for Accepts header - private JLabel jlContentTypeExplanation; - private JLabel jlContentTypeExplanationPlaceholder; - private JLabel jlContentType; - private JLabel jlContentTypeLabelPlaceholder; // this placeholder label will - // take up space of the - // ContentType combo-box - // when the latter is not - // shown - private JLabel jlContentTypeFieldPlaceholder; - private JComboBox<String> cbContentType; // for MIME type of data sent to the server - // by POST / PUT methods - private JLabel jlSendDataAs; - private JComboBox<DATA_FORMAT> cbSendDataAs; - private JLabel jlSendDataAsLabelPlaceholder; - private JLabel jlSendDataAsFieldPlaceholder; - - // ADVANCED tab - private JCheckBox cbSendHTTPExpectHeader; - private JCheckBox cbShowRedirectionOutputPort; - private JCheckBox cbShowActualUrlPort; - private JCheckBox cbShowResponseHeadersPort; - private JCheckBox cbEscapeParameters; - private JButton addHeaderButton; - private JButton removeHeaderButton; - private JTable httpHeadersTable; - private HTTPHeadersTableModel httpHeadersTableModel; - - private String[] mediaTypes; - - private final ServiceRegistry serviceRegistry; - - public RESTActivityConfigurationPanel(Activity activity, ServiceRegistry serviceRegistry) { - super(activity); - this.serviceRegistry = serviceRegistry; - initialise(); - } - - @Override - protected void initialise() { - super.initialise(); - removeAllPages(); - addPage("General", createGeneralTab()); - addPage("Advanced", createAdvancedTab()); - refreshConfiguration(); - } - - @Override - public void noteConfiguration() { - ObjectNode requestNode = json.objectNode(); - - String methodName = ((HTTP_METHOD) cbHTTPMethod.getSelectedItem()).name(); - requestNode.put("httpMethod", methodName); - requestNode.put("absoluteURITemplate", tfURLSignature.getText().trim()); - - ArrayNode headersNode = requestNode.arrayNode(); - headersNode.addObject().put("header", "Accept").put("value", (String) cbAccepts.getSelectedItem()); - headersNode.addObject().put("header", "Content-Type").put("value", (String) cbContentType.getSelectedItem()); - if (cbSendHTTPExpectHeader.isSelected()) { - headersNode.addObject().put("header", "Expect").put("value", "100-continue"); - } - ArrayList<String> headerNames = httpHeadersTableModel.getHTTPHeaderNames(); - ArrayList<String> headerValues = httpHeadersTableModel.getHTTPHeaderValues(); - for (int i = 0; i < headerNames.size(); i++) { - headersNode.addObject().put("header", headerNames.get(i)).put("value", headerValues.get(i)); - } - - requestNode.set("headers", headersNode); - json.set("request", requestNode); - - json.put("outgoingDataFormat", ((DATA_FORMAT) cbSendDataAs.getSelectedItem()).name()); - json.put("showRedirectionOutputPort", cbShowRedirectionOutputPort - .isSelected()); - json.put("showActualURLPort", cbShowActualUrlPort.isSelected()); - json.put("showResponseHeadersPort", cbShowResponseHeadersPort.isSelected()); - json.put("escapeParameters", cbEscapeParameters.isSelected()); - - configureInputPorts(serviceRegistry); - configureOutputPorts(serviceRegistry); - } - - /** - * Check that user values in the UI are valid. - */ - @Override - public boolean checkValues() { - // HTTP method is a fixed selection combo-box - no validation required - - // URL signature must be present and be valid - String candidateURLSignature = tfURLSignature.getText().trim(); - if (candidateURLSignature == null - || candidateURLSignature.length() == 0) { - JOptionPane.showMessageDialog(MainWindow.getMainWindow(), - "URL signature must not be empty", - "REST Activity Configuration - Warning", - JOptionPane.WARNING_MESSAGE); - return (false); - } else { - try { - // Test if any exceptions will be thrown - if not, proceed to - // other validations - URISignatureHandler.validate(candidateURLSignature); - } catch (URISignatureParsingException e) { - JOptionPane.showMessageDialog(MainWindow.getMainWindow(), e - .getMessage(), "REST Activity Configuration - Warning", - JOptionPane.WARNING_MESSAGE); - return (false); - } - - // Test if the URL string contains "unsafe" characters, i.e. characters - // that need URL-encoding. - // From RFC 1738: "...Only alphanumerics [0-9a-zA-Z], the special - // characters "$-_.+!*'()," (not including the quotes) and reserved - // characters used for their reserved purposes may be - // used unencoded within a URL." - // Reserved characters are: ";/?:@&=" ..." (excluding quotes) and "%" used - // for escaping. - // We do not warn the user if they have not properly enclosed parameter - // names in curly braces as this check is already being done elsewhere in the code. - // We do not check the characters in parameter names either. - try { - // Test if any exceptions will be thrown - if not, proceed to - // other validations - URISignatureHandler.checkForUnsafeCharacters(candidateURLSignature); - } catch (URISignatureParsingException e) { - JOptionPane.showMessageDialog(MainWindow.getMainWindow(), e - .getMessage(), "REST Activity Configuration - Warning", - JOptionPane.WARNING_MESSAGE); - return (false); - } - - // Other HTTP headers configured must not have empty names - ArrayList<String> otherHTTPHeaderNames = httpHeadersTableModel.getHTTPHeaderNames(); - for (String headerName : otherHTTPHeaderNames){ - if (headerName.equals("")){ - JOptionPane.showMessageDialog(MainWindow.getMainWindow(), "One of the HTTP header names is empty", "REST Activity Configuration - Warning", - JOptionPane.WARNING_MESSAGE); - return false; - } - } - } - - // All valid, return true - return true; - } - - /** - * Update GUI from a changed configuration bean (perhaps by undo / redo). - */ - @Override - public void refreshConfiguration() { - RESTActivityConfigurationBean configBean = new RESTActivityConfigurationBean(json); - - cbHTTPMethod.setSelectedItem(configBean.getHttpMethod()); - tfURLSignature.setText(configBean.getUrlSignature()); - tfURLSignature.setCaretPosition(0); - cbAccepts.setSelectedItem(configBean.getAcceptsHeaderValue()); - cbContentType.setSelectedItem(configBean.getContentTypeForUpdates()); - cbSendDataAs.setSelectedItem(configBean.getOutgoingDataFormat()); - cbSendHTTPExpectHeader.setSelected(configBean - .getSendHTTPExpectRequestHeader()); - cbShowRedirectionOutputPort.setSelected(configBean - .getShowRedirectionOutputPort()); - cbShowActualUrlPort.setSelected(configBean.getShowActualUrlPort()); - cbShowResponseHeadersPort.setSelected(configBean.getShowResponseHeadersPort()); - cbEscapeParameters.setSelected(configBean.getEscapeParameters()); - httpHeadersTableModel.setHTTPHeaderData(configBean.getOtherHTTPHeaders()); - } - - private JPanel createGeneralTab() { - JPanel jpGeneral = new JPanel(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - // All components to be anchored WEST - c.anchor = GridBagConstraints.WEST; - - c.gridx = 0; - c.gridy = 0; - c.gridwidth = 1; - c.insets = new Insets(7, 7, 3, 3); - c.weightx = 0.0; - c.fill = GridBagConstraints.NONE; - JLabel labelMethod = new JLabel("HTTP Method:", infoIcon, JLabel.LEFT); - labelMethod - .setToolTipText("<html>HTTP method determines how a request to the remote server will be made.<br><br>" - + "Supported HTTP methods are normally used for different purposes:<br>" - + "<b>GET</b> - to fetch data;<br>" - + "<b>POST</b> - to create new resources;<br>" - + "<b>PUT</b> - to update existing resources;<br>" - + "<b>DELETE</b> - to remove existing resources.<br><br>" - + "Documentation of the server that is about to be used may suggest the<br>" - + "HTTP method that should be used.</html>"); - jpGeneral.add(labelMethod, c); - - // the HTTP method combo-box will always contain the same values - it is - // the selected - // method which is important; therefore, can prepopulate as the set of - // values is known - c.gridx++; - c.insets = new Insets(7, 3, 3, 7); - c.fill = GridBagConstraints.HORIZONTAL; - c.weightx = 1.0; - cbHTTPMethod = new JComboBox<>(HTTP_METHOD.values()); - cbHTTPMethod.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - boolean contentTypeSelEnabled = RESTActivity - .hasMessageBodyInputPort((HTTP_METHOD) cbHTTPMethod - .getSelectedItem()); - - jlContentTypeExplanation.setVisible(contentTypeSelEnabled); - jlContentType.setVisible(contentTypeSelEnabled); - cbContentType.setVisible(contentTypeSelEnabled); - jlSendDataAs.setVisible(contentTypeSelEnabled); - cbSendDataAs.setVisible(contentTypeSelEnabled); - - jlContentTypeExplanationPlaceholder - .setVisible(!contentTypeSelEnabled); - jlContentTypeLabelPlaceholder - .setVisible(!contentTypeSelEnabled); - jlContentTypeFieldPlaceholder - .setVisible(!contentTypeSelEnabled); - jlSendDataAsLabelPlaceholder.setVisible(!contentTypeSelEnabled); - jlSendDataAsFieldPlaceholder.setVisible(!contentTypeSelEnabled); - } - }); - jpGeneral.add(cbHTTPMethod, c); - - c.gridx = 0; - c.gridy++; - c.insets = new Insets(3, 7, 3, 3); - c.fill = GridBagConstraints.NONE; - c.weightx = 0.0; - JLabel labelString = new JLabel("URL Template:", infoIcon, JLabel.LEFT); - labelString - .setToolTipText("<html>URL template enables to define a URL with <b>configurable<br>" - + "parameters</b> that will be used to access a remote server.<br><br>" - + "The template may contain zero or more <b>parameters</b> - each<br>" - + "enclosed within curly braces <b>\"{\"</b> and <b>\"}\"</b>.<br>" - + "Taverna will automatically create an individual input port for<br>" - + "this activity for each parameter.<br><br>" - + "Values extracted from these input ports during the workflow<br>" - + "execution these will be used to replace the parameters to<br>" - + "produce complete URLs.<br><br>" - + "For example, if the URL template is configured as<br>" - + "\"<i>http://www.myexperiment.org/user.xml?id={userID}</i>\", a<br>" - + "single input port with the name \"<i>userID</i>\" will be created.</html>"); - labelString.setLabelFor(tfURLSignature); - jpGeneral.add(labelString, c); - - c.gridx++; - c.insets = new Insets(3, 3, 3, 7); - c.fill = GridBagConstraints.HORIZONTAL; - c.weightx = 1.0; - tfURLSignature = new JTextField(40); - tfURLSignature.addFocusListener(new FocusListener() { - public void focusGained(FocusEvent e) { - tfURLSignature.selectAll(); - } - - public void focusLost(FocusEvent e) { /* do nothing */ - } - }); - jpGeneral.add(tfURLSignature, c); - - c.gridx = 0; - c.gridwidth = 2; - c.gridy++; - c.weightx = 0.0; - c.fill = GridBagConstraints.NONE; - c.insets = new Insets(18, 7, 3, 7); - JLabel jlAcceptsExplanation = new JLabel( - "Preferred MIME type for data to be fetched from the remote server --"); - jpGeneral.add(jlAcceptsExplanation, c); - c.gridwidth = 1; - - c.gridx = 0; - c.gridy++; - c.insets = new Insets(3, 7, 3, 3); - c.weightx = 0.0; - c.fill = GridBagConstraints.NONE; - JLabel jlAccepts = new JLabel("'Accept' header:", infoIcon, JLabel.LEFT); - jlAccepts - .setToolTipText("<html>Select a MIME type from the drop-down menu or type your own.<br>Select blank if you do not want this header to be set.</br>"); - jlAccepts.setLabelFor(cbAccepts); - jpGeneral.add(jlAccepts, c); - - c.gridx++; - c.insets = new Insets(3, 3, 3, 7); - c.weightx = 1.0; - c.fill = GridBagConstraints.HORIZONTAL; - cbAccepts = new JComboBox<>(getMediaTypes()); - cbAccepts.setEditable(true); - cbAccepts.getEditor().getEditorComponent().addFocusListener( - new FocusListener() { - public void focusGained(FocusEvent e) { - cbAccepts.getEditor().selectAll(); - } - - public void focusLost(FocusEvent e) { /* do nothing */ - } - }); - jpGeneral.add(cbAccepts, c); - - c.gridx = 0; - c.gridwidth = 2; - c.gridy++; - c.insets = new Insets(18, 7, 3, 7); - c.weightx = 0.0; - c.fill = GridBagConstraints.NONE; - jlContentTypeExplanation = new JLabel( - "MIME type of data that will be sent to the remote server --"); - jpGeneral.add(jlContentTypeExplanation, c); - c.gridwidth = 1; - - c.gridx = 0; - c.gridy++; - c.insets = new Insets(3, 7, 3, 3); - c.weightx = 0.0; - c.fill = GridBagConstraints.NONE; - jlContentType = new JLabel("'Content-Type' header:", infoIcon, - JLabel.LEFT); - jlContentType - .setToolTipText("<html>Select a MIME type from the drop-down menu or type your own.<br>Select blank if you do not want this header to be set.</html>"); - jlContentType.setLabelFor(cbContentType); - jpGeneral.add(jlContentType, c); - - c.gridx++; - c.insets = new Insets(3, 3, 3, 7); - c.weightx = 1.0; - c.fill = GridBagConstraints.HORIZONTAL; - cbContentType = new JComboBox<>(getMediaTypes()); - cbContentType.setEditable(true); - cbContentType.getEditor().getEditorComponent().addFocusListener( - new FocusListener() { - public void focusGained(FocusEvent e) { - cbContentType.getEditor().selectAll(); - } - - public void focusLost(FocusEvent e) { /* do nothing */ - } - }); - cbContentType.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - // change selection in the "Send data as" combo-box, based on - // the selection of Content-Type - String selectedContentType = (String) cbContentType - .getSelectedItem(); - if (selectedContentType.startsWith("text")) { - cbSendDataAs.setSelectedItem(DATA_FORMAT.String); - } else { - cbSendDataAs.setSelectedItem(DATA_FORMAT.Binary); - } - } - }); - jpGeneral.add(cbContentType, c); - - c.gridx = 0; - c.gridwidth = 2; - c.gridy++; - c.insets = new Insets(18, 7, 3, 7); - c.weightx = 0.0; - c.fill = GridBagConstraints.NONE; - jlContentTypeExplanationPlaceholder = new JLabel(); - jlContentTypeExplanationPlaceholder - .setPreferredSize(jlContentTypeExplanation.getPreferredSize()); - jpGeneral.add(jlContentTypeExplanationPlaceholder, c); - c.gridwidth = 1; - - c.gridx = 0; - c.gridy++; - c.insets = new Insets(3, 7, 3, 3); - c.weightx = 0.0; - c.fill = GridBagConstraints.NONE; - jlContentTypeLabelPlaceholder = new JLabel(); - jlContentTypeLabelPlaceholder.setPreferredSize(jlContentType - .getPreferredSize()); - jpGeneral.add(jlContentTypeLabelPlaceholder, c); - - c.gridx++; - c.insets = new Insets(3, 3, 3, 7); - c.weightx = 1.0; - c.fill = GridBagConstraints.HORIZONTAL; - jlContentTypeFieldPlaceholder = new JLabel(); - jlContentTypeFieldPlaceholder.setPreferredSize(cbContentType - .getPreferredSize()); - jpGeneral.add(jlContentTypeFieldPlaceholder, c); - - c.gridx = 0; - c.gridy++; - c.weightx = 0.0; - c.fill = GridBagConstraints.NONE; - c.insets = new Insets(3, 7, 8, 3); - jlSendDataAs = new JLabel("Send data as:", infoIcon, JLabel.LEFT); - jlSendDataAs - .setToolTipText("Select the format for the data to be sent to the remote server"); - jlSendDataAs.setLabelFor(cbSendDataAs); - jpGeneral.add(jlSendDataAs, c); - - c.gridx++; - c.insets = new Insets(3, 3, 8, 7); - c.weightx = 1.0; - c.fill = GridBagConstraints.HORIZONTAL; - cbSendDataAs = new JComboBox<>(DATA_FORMAT.values()); - cbSendDataAs.setEditable(false); - jpGeneral.add(cbSendDataAs, c); - - c.gridx = 0; - c.gridy++; - c.insets = new Insets(3, 7, 8, 3); - c.weightx = 0.0; - c.fill = GridBagConstraints.NONE; - jlSendDataAsLabelPlaceholder = new JLabel(); - jlSendDataAsLabelPlaceholder.setPreferredSize(jlSendDataAs - .getPreferredSize()); - jpGeneral.add(jlSendDataAsLabelPlaceholder, c); - - c.gridx++; - c.insets = new Insets(3, 3, 8, 7); - c.weightx = 1.0; - c.fill = GridBagConstraints.HORIZONTAL; - jlSendDataAsFieldPlaceholder = new JLabel(); - jlSendDataAsFieldPlaceholder.setPreferredSize(cbSendDataAs - .getPreferredSize()); - jpGeneral.add(jlSendDataAsFieldPlaceholder, c); - - JPanel finalPanel = new JPanel(new BorderLayout()); - finalPanel.add(jpGeneral, BorderLayout.NORTH); - return (finalPanel); - } - - private String[] getMediaTypes() { - if (mediaTypes != null) { - return mediaTypes; - } - List<String> types = new ArrayList<String>(); - InputStream typesStream = getClass().getResourceAsStream( - "mediatypes.txt"); - try { - // media types must be ASCII and can't have whitespace - Scanner scanner = new Scanner(typesStream, "ascii"); - while (scanner.hasNext()) { - types.add(scanner.next()); - } - scanner.close(); - } finally { - try { - typesStream.close(); - } catch (IOException ex) { - } - } - mediaTypes = types.toArray(new String[0]); - - return mediaTypes; - } - - private JPanel createAdvancedTab() { - JPanel jpAdvanced = new JPanel(new GridBagLayout()); - GridBagConstraints c = new GridBagConstraints(); - - c.gridx = 0; - c.gridy = 0; - c.anchor = GridBagConstraints.WEST; - c.fill = GridBagConstraints.BOTH; - c.insets = new Insets(8, 10, 2, 4); - JLabel jlExpectHeaderInfoIcon = new JLabel(infoIcon); - jlExpectHeaderInfoIcon - .setToolTipText("<html>Ticking this checkbox may significantly improve performance when<br>" - + "large volumes of data are sent to the remote server and a redirect<br>" - + "from the original URL to the one specified by the server is likely.<br>" - + "<br>" - + "However, this checkbox <b>must not</b> be ticked to allow this activity<br>" - + "to post updates to Twitter.</html>"); - jpAdvanced.add(jlExpectHeaderInfoIcon, c); - - c.gridx++; - c.weightx = 1.0; - c.insets = new Insets(8, 0, 2, 8); - cbSendHTTPExpectHeader = new JCheckBox( - "Send HTTP Expect request-header field"); - jpAdvanced.add(cbSendHTTPExpectHeader, c); - - c.gridx = 0; - c.gridy++; - c.weightx = 0; - c.insets = new Insets(2, 10, 5, 4); - JLabel jlShowRedirectionOutputPortInfoIcon = new JLabel(infoIcon); - jlShowRedirectionOutputPortInfoIcon - .setToolTipText("<html>\"Redirection\" output port displays the URL of the final redirect<br>" - + "that has yielded the output data on the \"Response Body\" port.</html>"); - jpAdvanced.add(jlShowRedirectionOutputPortInfoIcon, c); - - c.gridx++; - c.weightx = 1.0; - c.insets = new Insets(2, 0, 5, 8); - cbShowRedirectionOutputPort = new JCheckBox( - "Show \"Redirection\" output port"); - jpAdvanced.add(cbShowRedirectionOutputPort, c); - - c.gridx = 0; - c.gridy++; - c.weightx = 0; - c.insets = new Insets(2, 10, 5, 4); - JLabel jlShowActualUrlPortInfoIcon = new JLabel(infoIcon); - jlShowActualUrlPortInfoIcon - .setToolTipText("<html>\"Actual URL\" output port displays the URL used by the REST service<br>" - + "with the actual parameter values.</html>"); - jpAdvanced.add(jlShowActualUrlPortInfoIcon, c); - - c.gridx++; - c.weightx = 1.0; - c.insets = new Insets(2, 0, 5, 8); - cbShowActualUrlPort = new JCheckBox( - "Show \"Actual URL\" output port"); - jpAdvanced.add(cbShowActualUrlPort, c); - - c.gridx = 0; - c.gridy++; - c.weightx = 0; - c.insets = new Insets(2, 10, 5, 4); - JLabel jlShowResponseHeadersPortInfoIcon = new JLabel(infoIcon); - jlShowResponseHeadersPortInfoIcon - .setToolTipText("<html>\"Response headers\" output port displays the HTTP headers<br>" - + "received from the final (after redirection) HTTP call.</html>"); - jpAdvanced.add(jlShowResponseHeadersPortInfoIcon, c); - - c.gridx++; - c.weightx = 1.0; - c.insets = new Insets(2, 0, 5, 8); - cbShowResponseHeadersPort = new JCheckBox( - "Show \"Response headers\" output port"); - jpAdvanced.add(cbShowResponseHeadersPort, c); - - c.gridx = 0; - c.gridy++; - c.weightx = 0; - c.insets = new Insets(2, 10, 5, 4); - JLabel jlEscapeParametersInfoIcon = new JLabel(infoIcon); - jlEscapeParametersInfoIcon - .setToolTipText("<html>Determines if parameters you pass to form the full URL<br>" + - " of the REST service will be URL-escaped.</html>"); - jpAdvanced.add(jlEscapeParametersInfoIcon, c); - - c.gridx++; - c.weightx = 1.0; - c.insets = new Insets(2, 0, 5, 8); - cbEscapeParameters = new JCheckBox("Escape URL parameter values"); - jpAdvanced.add(cbEscapeParameters, c); - - c.gridx = 0; - c.gridy++; - c.weightx = 0; - c.anchor = GridBagConstraints.WEST; - c.fill = GridBagConstraints.NONE; - c.insets = new Insets(2, 10, 5, 4); - JLabel jlHTTPHeadersInfoIcon = new JLabel(infoIcon); - jlHTTPHeadersInfoIcon - .setToolTipText("<html>Set additional HTTP headers</html>"); - jpAdvanced.add(jlHTTPHeadersInfoIcon, c); - - c.gridx = 1; - c.weightx = 0; - c.weighty = 0; - c.anchor = GridBagConstraints.WEST; - c.fill = GridBagConstraints.NONE; - c.insets = new Insets(2, 10, 5, 4); - addHeaderButton = new JButton("Add HTTP header"); - addHeaderButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - httpHeadersTableModel.addEmptyRow(); - httpHeadersTable.getSelectionModel().setSelectionInterval(httpHeadersTableModel.getRowCount() - 1, httpHeadersTableModel.getRowCount() - 1); } - }); - removeHeaderButton = new JButton("Remove HTTP header"); - removeHeaderButton.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - int row = httpHeadersTable.getSelectedRow(); - httpHeadersTableModel.removeRow(row); - } - }); - JPanel buttonPanel = new JPanel(); - buttonPanel.add(addHeaderButton, FlowLayout.LEFT); - buttonPanel.add(removeHeaderButton); - jpAdvanced.add(buttonPanel, c); - - c.gridx = 1; - c.gridy++; - c.weightx = 0; - c.weighty = 1.0; - c.fill = GridBagConstraints.BOTH; - c.insets = new Insets(2, 10, 5, 4); - httpHeadersTableModel = new HTTPHeadersTableModel(); - httpHeadersTable = new JTable(httpHeadersTableModel); - httpHeadersTable.setGridColor(Color.GRAY); - httpHeadersTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - setVisibleRowCount(httpHeadersTable, 3); - JScrollPane headersTableScrollPane = new JScrollPane(httpHeadersTable); - jpAdvanced.add(headersTableScrollPane, c); - - return (jpAdvanced); - } - - /* - * Based on http://www.javalobby.org/java/forums/t19559.html - */ - public static void setVisibleRowCount(JTable table, int visibleRows){ - int height = 0; - for(int row = 0; row < visibleRows; row++) - height += table.getRowHeight(row); - - table.setPreferredScrollableViewportSize(new Dimension( - table.getPreferredScrollableViewportSize().width, - height)); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigureAction.java ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigureAction.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigureAction.java deleted file mode 100644 index ff3477d..0000000 --- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/config/RESTActivityConfigureAction.java +++ /dev/null @@ -1,51 +0,0 @@ -package net.sf.taverna.t2.activities.rest.ui.config; - -import java.awt.Frame; -import java.awt.event.ActionEvent; - -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry; -import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager; -import net.sf.taverna.t2.workbench.edits.EditManager; -import net.sf.taverna.t2.workbench.file.FileManager; -import net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction; -import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog; -import org.apache.taverna.commons.services.ServiceRegistry; -import org.apache.taverna.scufl2.api.activity.Activity; - -@SuppressWarnings("serial") -/** - * @author Sergejs Aleksejevs - * @author David Withers - */ -public class RESTActivityConfigureAction extends ActivityConfigurationAction { - - private final EditManager editManager; - private final FileManager fileManager; - private final ServiceRegistry serviceRegistry; - - public RESTActivityConfigureAction(Activity activity, Frame owner, EditManager editManager, - FileManager fileManager, ActivityIconManager activityIconManager, - ServiceDescriptionRegistry serviceDescriptionRegistry, ServiceRegistry serviceRegistry) { - super(activity, activityIconManager, serviceDescriptionRegistry); - this.editManager = editManager; - this.fileManager = fileManager; - this.serviceRegistry = serviceRegistry; - } - - public void actionPerformed(ActionEvent e) { - ActivityConfigurationDialog currentDialog = ActivityConfigurationAction - .getDialog(getActivity()); - - if (currentDialog != null) { - currentDialog.toFront(); - return; - } - - RESTActivityConfigurationPanel panel = new RESTActivityConfigurationPanel(getActivity(), serviceRegistry); - ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(getActivity(), panel, - editManager); - - ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateAction.java ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateAction.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateAction.java deleted file mode 100644 index d38c4ac..0000000 --- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateAction.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2007-2009 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - ******************************************************************************/ -package net.sf.taverna.t2.activities.rest.ui.menu; - -import java.awt.event.ActionEvent; -import java.net.URI; - -import javax.swing.AbstractAction; -import javax.swing.Action; - -import net.sf.taverna.t2.activities.rest.ui.servicedescription.GenericRESTTemplateService; -import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction; -import net.sf.taverna.t2.ui.menu.MenuManager; -import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager; -import net.sf.taverna.t2.workbench.edits.EditManager; -import net.sf.taverna.t2.workbench.selection.SelectionManager; -import net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView; -import org.apache.taverna.commons.services.ServiceRegistry; -import org.apache.taverna.scufl2.api.core.Workflow; - -/** - * An action to add a REST activity + a wrapping processor to the workflow. - * - * @author Alex Nenadic - * @author David Withers - */ -@SuppressWarnings("serial") -public class AddRESTTemplateAction extends AbstractContextualMenuAction { - - private static final String ADD_REST = "REST"; - - private static final URI insertSection = URI - .create("http://taverna.sf.net/2009/contextMenu/insert"); - - private EditManager editManager; - private MenuManager menuManager; - private SelectionManager selectionManager; - private ActivityIconManager activityIconManager; - private ServiceRegistry serviceRegistry; - - public AddRESTTemplateAction() { - super(insertSection, 500); - } - - @Override - public boolean isEnabled() { - return super.isEnabled() && getContextualSelection().getSelection() instanceof Workflow; - } - - @Override - protected Action createAction() { - - return new AddRestAction(); - } - - protected class AddRestAction extends AbstractAction { - AddRestAction() { - super(ADD_REST, activityIconManager - .iconForActivity(GenericRESTTemplateService.ACTIVITY_TYPE)); - } - - public void actionPerformed(ActionEvent e) { - WorkflowView.importServiceDescription( - GenericRESTTemplateService.getServiceDescription(), false, editManager, - menuManager, selectionManager, serviceRegistry); - } - } - - public void setEditManager(EditManager editManager) { - this.editManager = editManager; - } - - public void setMenuManager(MenuManager menuManager) { - this.menuManager = menuManager; - } - - public void setSelectionManager(SelectionManager selectionManager) { - this.selectionManager = selectionManager; - } - - public void setActivityIconManager(ActivityIconManager activityIconManager) { - this.activityIconManager = activityIconManager; - } - - public void setServiceRegistry(ServiceRegistry serviceRegistry) { - this.serviceRegistry = serviceRegistry; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateMenuAction.java ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateMenuAction.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateMenuAction.java deleted file mode 100644 index ebc8ad6..0000000 --- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/menu/AddRESTTemplateMenuAction.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2007-2009 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - ******************************************************************************/ -package net.sf.taverna.t2.activities.rest.ui.menu; - -import java.awt.event.ActionEvent; -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; -import java.net.URI; - -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.KeyStroke; - -import net.sf.taverna.t2.activities.rest.ui.servicedescription.GenericRESTTemplateService; -import net.sf.taverna.t2.ui.menu.AbstractMenuAction; -import net.sf.taverna.t2.ui.menu.DesignOnlyAction; -import net.sf.taverna.t2.ui.menu.MenuManager; -import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager; -import net.sf.taverna.t2.workbench.edits.EditManager; -import net.sf.taverna.t2.workbench.selection.SelectionManager; -import net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView; -import org.apache.taverna.commons.services.ServiceRegistry; - -/** - * An action to add a REST activity + a wrapping processor to the workflow. - * - * @author Alex Nenadic - * @author alanrw - * @author David Withers - */ -@SuppressWarnings("serial") -public class AddRESTTemplateMenuAction extends AbstractMenuAction { - - private static final String ADD_REST = "REST"; - - private static final URI INSERT = URI - .create("http://taverna.sf.net/2008/t2workbench/menu#insert"); - - private static final URI ADD_REST_URI = URI - .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddREST"); - - private EditManager editManager; - private MenuManager menuManager; - private SelectionManager selectionManager; - private ActivityIconManager activityIconManager; - private ServiceRegistry serviceRegistry; - - public AddRESTTemplateMenuAction() { - super(INSERT, 500, ADD_REST_URI); - } - - @Override - protected Action createAction() { - return new AddRESTMenuAction(); - } - - protected class AddRESTMenuAction extends AbstractAction implements DesignOnlyAction { - AddRESTMenuAction() { - super(); - putValue(SMALL_ICON, activityIconManager.iconForActivity(GenericRESTTemplateService.ACTIVITY_TYPE)); - putValue(NAME, ADD_REST); - putValue(SHORT_DESCRIPTION, "REST service"); - putValue( - Action.ACCELERATOR_KEY, - KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.SHIFT_DOWN_MASK - | InputEvent.ALT_DOWN_MASK)); - } - - public void actionPerformed(ActionEvent e) { - WorkflowView.importServiceDescription( - GenericRESTTemplateService.getServiceDescription(), false, editManager, - menuManager, selectionManager, serviceRegistry); - } - } - - public void setEditManager(EditManager editManager) { - this.editManager = editManager; - } - - public void setMenuManager(MenuManager menuManager) { - this.menuManager = menuManager; - } - - public void setSelectionManager(SelectionManager selectionManager) { - this.selectionManager = selectionManager; - } - - public void setActivityIconManager(ActivityIconManager activityIconManager) { - this.activityIconManager = activityIconManager; - } - - public void setServiceRegistry(ServiceRegistry serviceRegistry) { - this.serviceRegistry = serviceRegistry; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/GenericRESTTemplateService.java ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/GenericRESTTemplateService.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/GenericRESTTemplateService.java deleted file mode 100644 index b60fb6a..0000000 --- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/GenericRESTTemplateService.java +++ /dev/null @@ -1,82 +0,0 @@ -package net.sf.taverna.t2.activities.rest.ui.servicedescription; - -import java.net.URI; - -import javax.swing.Icon; - -import net.sf.taverna.t2.activities.rest.RESTActivity; -import net.sf.taverna.t2.servicedescriptions.AbstractTemplateService; -import net.sf.taverna.t2.servicedescriptions.ServiceDescription; -import org.apache.taverna.scufl2.api.configurations.Configuration; - -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider; - -/** - * @author Sergejs Aleksejevs - * @author David Withers - */ -public class GenericRESTTemplateService extends AbstractTemplateService { - - public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/rest"); - - private static final String REST = "REST"; - - @Override - public URI getActivityType() { - return ACTIVITY_TYPE; - } - - @Override - public Configuration getActivityConfiguration() { - Configuration configuration = new Configuration(); - configuration.setType(ACTIVITY_TYPE.resolve("#Config")); - ObjectNode json = (ObjectNode) configuration.getJson(); - ObjectNode requestNode = json.objectNode(); - - requestNode.put("httpMethod", RESTActivity.HTTP_METHOD.GET.name()); - requestNode.put("absoluteURITemplate", "http://www.uniprot.org/uniprot/{id}.xml"); - - ArrayNode headersNode = requestNode.arrayNode(); - headersNode.addObject().put("header", "Accept").put("value", "application/xml"); - headersNode.addObject().put("header", "Content-Type").put("value", "application/xml"); - - requestNode.set("headers", headersNode); - json.set("request", requestNode); - json.put("outgoingDataFormat", RESTActivity.DATA_FORMAT.String.name()); - json.put("showRedirectionOutputPort", false); - json.put("showActualURLPort", false); - json.put("showResponseHeadersPort", false); - json.put("escapeParameters", true); - return configuration; - } - - @Override - public Icon getIcon() { - return RESTActivityIcon.getRESTActivityIcon(); - } - - public String getName() { - return REST; - } - - public String getDescription() { - return "A generic REST service that can handle all HTTP methods"; - } - - public static ServiceDescription getServiceDescription() { - GenericRESTTemplateService gts = new GenericRESTTemplateService(); - return gts.templateService; - } - - public String getId() { - return "http://www.taverna.org.uk/2010/services/rest"; - } - - @Override - public ServiceDescriptionProvider newInstance() { - return new GenericRESTTemplateService(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/RESTActivityIcon.java ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/RESTActivityIcon.java b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/RESTActivityIcon.java deleted file mode 100644 index c2309a9..0000000 --- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/servicedescription/RESTActivityIcon.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.sf.taverna.t2.activities.rest.ui.servicedescription; - -import java.awt.Color; -import java.net.URI; - -import javax.swing.Icon; -import javax.swing.ImageIcon; - -import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI; -import net.sf.taverna.t2.workbench.configuration.colour.ColourManager; - -/** - * - * @author Sergejs Aleksejevs - * @author David Withers - */ -public class RESTActivityIcon implements ActivityIconSPI { - private static final Color PROCESSOR_COLOUR = Color.decode("#7AAFFF"); - - private static ImageIcon icon; - - public int canProvideIconScore(URI activityType) { - if (GenericRESTTemplateService.ACTIVITY_TYPE.equals(activityType)) - return DEFAULT_ICON + 1; - else - return NO_ICON; - } - - public Icon getIcon(URI activityType) { - return getRESTActivityIcon(); - } - - public static Icon getRESTActivityIcon() { - if (icon == null) { - synchronized (RESTActivityIcon.class) { - if (icon == null) { - try { - icon = new ImageIcon( - RESTActivityIcon.class.getResource("service_type_rest.png")); - } catch (NullPointerException e) { - /* icon wasn't found - do nothing, but no icon will be available */ - } - } - } - } - return (icon); - } - - public void setColourManager(ColourManager colourManager) { - // set colour for REST processors in the workflow diagram - colourManager.setPreferredColour(GenericRESTTemplateService.ACTIVITY_TYPE.toString(), PROCESSOR_COLOUR); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/serviceprovider/ExampleServiceDesc.java.bak ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/serviceprovider/ExampleServiceDesc.java.bak b/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/serviceprovider/ExampleServiceDesc.java.bak deleted file mode 100644 index 5d9848d..0000000 --- a/taverna-rest-activity-ui/src/main/java/net/sf/taverna/t2/activities/rest/ui/serviceprovider/ExampleServiceDesc.java.bak +++ /dev/null @@ -1,99 +0,0 @@ -package net.sf.taverna.t2.activities.rest.ui.serviceprovider; - -import java.net.URI; -import java.util.Arrays; -import java.util.List; - -import javax.swing.Icon; -import javax.swing.ImageIcon; - -import net.sf.taverna.t2.servicedescriptions.ServiceDescription; -import net.sf.taverna.t2.workflowmodel.processor.activity.Activity; - -import net.sf.taverna.t2.activities.rest.RESTActivity; -import net.sf.taverna.t2.activities.rest.RESTActivityConfigurationBean; - -public class ExampleServiceDesc extends ServiceDescription<RESTActivityConfigurationBean> -{ - /** - * The subclass of Activity which should be instantiated when adding a service - * for this description - */ - @Override - public Class<? extends Activity<RESTActivityConfigurationBean>> getActivityClass() { - return RESTActivity.class; - } - - /** - * The configuration bean which is to be used for configuring the instantiated activity. - * Making this bean will typically require some of the fields set on this service - * description, like an endpoint URL or method name. - * - */ - @Override - public RESTActivityConfigurationBean getActivityConfiguration() { - RESTActivityConfigurationBean bean = new RESTActivityConfigurationBean(); - bean.setExampleString(exampleString); - bean.setExampleUri(exampleUri); - return bean; - } - - /** - * An icon to represent this service description in the service palette. - */ - @Override - public Icon getIcon() { - return null; - } - - /** - * The display name that will be shown in service palette and will - * be used as a template for processor name when added to workflow. - */ - @Override - public String getName() { - return exampleString; - } - - /** - * The path to this service description in the service palette. Folders - * will be created for each element of the returned path. - */ - @Override - public List<String> getPath() { - // For deeper paths you may return several strings - return Arrays.asList("Service templates", "Examples " + exampleUri); - } - - /** - * Return a list of data values uniquely identifying this service - * description (to avoid duplicates). Include only primary key like fields, - * ie. ignore descriptions, icons, etc. - */ - @Override - protected List<? extends Object> getIdentifyingData() { - // FIXME: Use your fields instead of example fields - return Arrays.<Object>asList(exampleString, exampleUri); - } - - - // 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) - private String exampleString; - private URI exampleUri; - public String getExampleString() { - return exampleString; - } - public URI getExampleUri() { - return exampleUri; - } - public void setExampleString(String exampleString) { - this.exampleString = exampleString; - } - public void setExampleUri(URI exampleUri) { - this.exampleUri = exampleUri; - } - - -}
