You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2011/10/17 03:14:08 UTC
svn commit: r1184969 [2/3] - in /incubator/airavata/trunk/modules/xbaya-gui:
./ src/main/java/org/apache/airavata/xbaya/
src/main/java/org/apache/airavata/xbaya/appwrapper/
src/main/java/org/apache/airavata/xbaya/component/gui/
src/main/java/org/apache...
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/pegasus/gui/PegasusMenu.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/pegasus/gui/PegasusMenu.java?rev=1184969&r1=1184968&r2=1184969&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/pegasus/gui/PegasusMenu.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/pegasus/gui/PegasusMenu.java Mon Oct 17 01:14:07 2011
@@ -29,115 +29,112 @@ import javax.swing.JMenu;
import javax.swing.JMenuItem;
import org.apache.airavata.xbaya.XBayaEngine;
-import org.apache.airavata.xbaya.experiment.gui.OGCEXRegistryLoaderWindow;
-import org.apache.airavata.xbaya.experiment.gui.XRegistryConfigurationWindow;
-import org.apache.airavata.xbaya.xregistry.XRegistryAccesser;
public class PegasusMenu {
- private JMenu pegasusMenu;
-
- protected XRegistryAccesser xregistry;
-
- private JMenuItem configureXRegistryItem;
-
- private JMenuItem saveWorkflowtoXRegistryItem;
-
- private JMenuItem loadWorkflowfromXRegistryItem;
-
- private JMenuItem launchPegasusWorkflowItem;
-
- private XBayaEngine engine;
-
- /**
- * Constructs a FileMenu.
- *
- * @param engine
- *
- */
- public PegasusMenu(XBayaEngine engine) {
- this.engine = engine;
- this.xregistry = new XRegistryAccesser(engine);
-
- createExperimentMenu();
- }
-
- private void createExperimentMenu() {
-
- createConfigureXRegistryItem();
- createSaveWorkflowtoXRegistryItem();
- createLoadWorkflowfromXRegistryItem();
- createLaunchPegasusWorkflowItem();
-
- this.pegasusMenu = new JMenu("Pegasus");
- this.pegasusMenu.setMnemonic(KeyEvent.VK_F);
-
- this.pegasusMenu.add(this.configureXRegistryItem);
- this.pegasusMenu.addSeparator();
- this.pegasusMenu.add(this.saveWorkflowtoXRegistryItem);
- this.pegasusMenu.add(this.loadWorkflowfromXRegistryItem);
- this.pegasusMenu.addSeparator();
- this.pegasusMenu.add(this.launchPegasusWorkflowItem);
- }
-
- /**
- * @return The Experiment menu.
- */
- public JMenu getMenu() {
- return this.pegasusMenu;
- }
-
- private void createConfigureXRegistryItem() {
- this.configureXRegistryItem = new JMenuItem("Configure XRegistry");
- this.configureXRegistryItem.setMnemonic(KeyEvent.VK_C);
- this.configureXRegistryItem.addActionListener(new AbstractAction() {
- private XRegistryConfigurationWindow window;
-
- public void actionPerformed(ActionEvent e) {
- if (this.window == null) {
- this.window = new XRegistryConfigurationWindow(PegasusMenu.this.engine);
- }
- this.window.show();
- }
- });
- }
-
- private void createSaveWorkflowtoXRegistryItem() {
- this.saveWorkflowtoXRegistryItem = new JMenuItem("Save Workflow to XRegistry");
- this.saveWorkflowtoXRegistryItem.addActionListener(new AbstractAction() {
- public void actionPerformed(ActionEvent e) {
- PegasusMenu.this.xregistry.saveWorkflow();
- }
- });
- }
-
- private void createLoadWorkflowfromXRegistryItem() {
- this.loadWorkflowfromXRegistryItem = new JMenuItem("Load Workflow from XRegistry");
- this.loadWorkflowfromXRegistryItem.addActionListener(new AbstractAction() {
- public void actionPerformed(ActionEvent e) {
- new OGCEXRegistryLoaderWindow(PegasusMenu.this.engine).show();
- }
- });
- }
-
- private void createLaunchPegasusWorkflowItem() {
- this.launchPegasusWorkflowItem = new JMenuItem("Launch Workflow to Pegasys Engine");
- this.launchPegasusWorkflowItem.addActionListener(new AbstractAction() {
- private PegasusInvokerWindow window;
-
- public void actionPerformed(ActionEvent e) {
- if (this.window == null) {
- this.window = new PegasusInvokerWindow(PegasusMenu.this.engine);
- }
- try {
- this.window.show();
- } catch (Exception e1) {
- PegasusMenu.this.engine.getErrorWindow().error(e1);
- }
-
- }
- });
-
- }
+// private JMenu pegasusMenu;
+//
+// protected XRegistryAccesser xregistry;
+//
+// private JMenuItem configureXRegistryItem;
+//
+// private JMenuItem saveWorkflowtoXRegistryItem;
+//
+// private JMenuItem loadWorkflowfromXRegistryItem;
+//
+// private JMenuItem launchPegasusWorkflowItem;
+//
+// private XBayaEngine engine;
+//
+// /**
+// * Constructs a FileMenu.
+// *
+// * @param engine
+// *
+// */
+// public PegasusMenu(XBayaEngine engine) {
+// this.engine = engine;
+// this.xregistry = new XRegistryAccesser(engine);
+//
+// createExperimentMenu();
+// }
+//
+// private void createExperimentMenu() {
+//
+// createConfigureXRegistryItem();
+// createSaveWorkflowtoXRegistryItem();
+// createLoadWorkflowfromXRegistryItem();
+// createLaunchPegasusWorkflowItem();
+//
+// this.pegasusMenu = new JMenu("Pegasus");
+// this.pegasusMenu.setMnemonic(KeyEvent.VK_F);
+//
+// this.pegasusMenu.add(this.configureXRegistryItem);
+// this.pegasusMenu.addSeparator();
+// this.pegasusMenu.add(this.saveWorkflowtoXRegistryItem);
+// this.pegasusMenu.add(this.loadWorkflowfromXRegistryItem);
+// this.pegasusMenu.addSeparator();
+// this.pegasusMenu.add(this.launchPegasusWorkflowItem);
+// }
+//
+// /**
+// * @return The Experiment menu.
+// */
+// public JMenu getMenu() {
+// return this.pegasusMenu;
+// }
+//
+// private void createConfigureXRegistryItem() {
+// this.configureXRegistryItem = new JMenuItem("Configure XRegistry");
+// this.configureXRegistryItem.setMnemonic(KeyEvent.VK_C);
+// this.configureXRegistryItem.addActionListener(new AbstractAction() {
+// private XRegistryConfigurationWindow window;
+//
+// public void actionPerformed(ActionEvent e) {
+// if (this.window == null) {
+// this.window = new XRegistryConfigurationWindow(PegasusMenu.this.engine);
+// }
+// this.window.show();
+// }
+// });
+// }
+//
+// private void createSaveWorkflowtoXRegistryItem() {
+// this.saveWorkflowtoXRegistryItem = new JMenuItem("Save Workflow to XRegistry");
+// this.saveWorkflowtoXRegistryItem.addActionListener(new AbstractAction() {
+// public void actionPerformed(ActionEvent e) {
+// PegasusMenu.this.xregistry.saveWorkflow();
+// }
+// });
+// }
+//
+// private void createLoadWorkflowfromXRegistryItem() {
+// this.loadWorkflowfromXRegistryItem = new JMenuItem("Load Workflow from XRegistry");
+// this.loadWorkflowfromXRegistryItem.addActionListener(new AbstractAction() {
+// public void actionPerformed(ActionEvent e) {
+// new OGCEXRegistryLoaderWindow(PegasusMenu.this.engine).show();
+// }
+// });
+// }
+//
+// private void createLaunchPegasusWorkflowItem() {
+// this.launchPegasusWorkflowItem = new JMenuItem("Launch Workflow to Pegasys Engine");
+// this.launchPegasusWorkflowItem.addActionListener(new AbstractAction() {
+// private PegasusInvokerWindow window;
+//
+// public void actionPerformed(ActionEvent e) {
+// if (this.window == null) {
+// this.window = new PegasusInvokerWindow(PegasusMenu.this.engine);
+// }
+// try {
+// this.window.show();
+// } catch (Exception e1) {
+// PegasusMenu.this.engine.getErrorWindow().error(e1);
+// }
+//
+// }
+// });
+//
+// }
}
\ No newline at end of file
Copied: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/RegistryAccesser.java (from r1184954, incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/xregistry/XRegistryAccesser.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/RegistryAccesser.java?p2=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/RegistryAccesser.java&p1=incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/xregistry/XRegistryAccesser.java&r1=1184954&r2=1184969&rev=1184969&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/xregistry/XRegistryAccesser.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/registry/RegistryAccesser.java Mon Oct 17 01:14:07 2011
@@ -19,7 +19,7 @@
*
*/
-package org.apache.airavata.xbaya.xregistry;
+package org.apache.airavata.xbaya.registry;
import java.io.BufferedReader;
import java.io.IOException;
@@ -60,18 +60,10 @@ import org.ogce.schemas.gfac.beans.utils
import org.ogce.schemas.gfac.beans.utils.GFacSchemaException;
import org.ogce.schemas.gfac.beans.utils.HostUtils;
import org.ogce.schemas.gfac.beans.utils.ServiceUtils;
-import org.ogce.xregistry.client.XRegistryClient;
-import org.ogce.xregistry.utils.XRegClientConstants;
-import org.ogce.xregistry.utils.XRegistryClientException;
import org.xmlpull.infoset.XmlElement;
-import xregistry.generated.FindAppDescResponseDocument.FindAppDescResponse.AppData;
-import xregistry.generated.HostDescData;
-import xregistry.generated.OGCEResourceData;
-import xregistry.generated.ResourceData;
-import xregistry.generated.ServiceDescData;
-public class XRegistryAccesser {
+public class RegistryAccesser {
/**
* PUBLIC_ACTOR
@@ -80,8 +72,6 @@ public class XRegistryAccesser {
private XBayaEngine engine;
- private XRegistryClient xregistryClient;
-
private GSSCredential gssCredential;
private URI xregistryURL;
@@ -91,170 +81,39 @@ public class XRegistryAccesser {
*
* @param engine
*/
- public XRegistryAccesser(XBayaEngine engine) {
+ public RegistryAccesser(XBayaEngine engine) {
this.engine = engine;
}
-
- /**
- * Constructs a XRegistryAccesser.
- *
- * @param engine
- */
- public XRegistryAccesser(GSSCredential gssCredential, URI xRegistryURL) {
- this.gssCredential = gssCredential;
- this.xregistryURL = xRegistryURL;
- }
-
- /**
- * Constructs a XRegistryAccesser.
- *
- * @param engine
- */
- public XRegistryAccesser(String userName, String password, String myproxyServer, URI xRegistryURL) {
-
- this.gssCredential = SecurityUtil.getGSSCredential(userName, password, myproxyServer);
- this.xregistryURL = xRegistryURL;
- }
-
- /**
- * Connect to XRegistry Service, the constructors should have filled the credential and service url
- *
- * @return xregistryconnection
- * @throws XregistryException
- */
- private void connectToXRegistry() throws XRegistryClientException {
- if (null == this.gssCredential) {
-// new MyProxyDialog(this.engine).show(true);
- this.gssCredential = this.engine.getMyProxyClient().getProxy();
- // if its still null => user cancelled
- if (null == this.gssCredential) {
- throw new XBayaRuntimeException("GSI Credintial cannot be null");
- }
- }
- if (this.xregistryURL == null) {
- this.xregistryURL = XBayaConstants.DEFAULT_XREGISTRY_URL;
- }
- if (this.xregistryURL == null) {
- throw new XBayaRuntimeException("XRegistry URL cannot be null");
- }
-
- try {
- this.xregistryClient = new XRegistryClient(this.gssCredential, XBayaSecurity.getTrustedCertificates(),
- this.xregistryURL.toString());
- } catch (XRegistryClientException e) {
- throw new XBayaRuntimeException(e);
- }
- }
-
+
private Registry connectToRegistry(){
JCRComponentRegistry jcrComponentRegistry = this.engine.getConfiguration().getJcrComponentRegistry();
return jcrComponentRegistry.getRegistry();
}
- private XRegistryClientException convertXRegistryClientException(Throwable th) {
- String message = th.getMessage();
- BufferedReader br = null;
- String line;
- try {
- br = new BufferedReader(new StringReader(message));
- while ((line = br.readLine()) != null) {
- if (!line.contains("xregistry.XregistryException"))
- continue;
-
- String[] split = line.split(":", 3);
- return new XRegistryClientException(split[2], th);
- }
- return new XRegistryClientException(th);
- } catch (Exception e) {
- // no op
- } finally {
- if (br != null) {
- try {
- br.close();
- } catch (Exception ex) {
- // no op
- }
- }
- }
- return null;
- }
-
+
/**
- * Fetch all workflow templates from XRegistry
+ * Fetch all workflow templates from Registry
*
* @return workflow templates
* @throws XregistryException
*/
- public Map<QName,Node> getOGCEWorkflowTemplateList() throws XRegistryClientException {
+ public Map<QName,Node> getOGCEWorkflowTemplateList() throws RepositoryException {
Registry registry = connectToRegistry();
return registry.getAvailableWorkflows(this.engine.getConfiguration().getRegigstryUserName());
}
- /**
- * @param hostName
- * @return host templates
- * @throws XRegistryClientException
- */
- public Map<QName, HostDescData> getHostDescByName(String hostName) throws XRegistryClientException {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
- Map<QName, HostDescData> val = new HashMap<QName, HostDescData>();
- HostDescData[] hostDescs = this.searchHostByName(hostName);
- for (HostDescData hostDesc : hostDescs) {
- val.put(hostDesc.getName(), hostDesc);
- }
-
- return val;
- }
-
- /**
- * @param appName
- * @return application templates
- * @throws XRegistryClientException
- */
- public Map<QName, AppData> getApplicationDescByName(String appName) throws XRegistryClientException {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
- Map<QName, AppData> val = new HashMap<QName, AppData>();
- AppData[] appDescs = this.searchApplicationByName(appName);
- for (AppData appDesc : appDescs) {
- val.put(appDesc.getName(), appDesc);
- }
-
- return val;
- }
-
- /**
- * @param serviceName
- * @return service templates
- * @throws XRegistryClientException
- */
- public Map<QName, ServiceDescData> getServiceDescByName(String serviceName) throws XRegistryClientException {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
- Map<QName, ServiceDescData> val = new HashMap<QName, ServiceDescData>();
- ServiceDescData[] serviceDescs = this.searchServiceByName(serviceName);
- for (ServiceDescData serviceDesc : serviceDescs) {
- val.put(serviceDesc.getName(), serviceDesc);
- }
-
- return val;
- }
/**
* Retrieves workflow from xregistry.
*
* @param workflowTemplateId
* @return workflow
- * @throws XRegistryClientException
+ * @throws RepositoryException
* @throws XregistryException
* @throws GraphException
* @throws ComponentException
* @throws Exception
*/
- public Workflow getOGCEWorkflow(QName workflowTemplateId) throws XRegistryClientException, GraphException,
+ public Workflow getOGCEWorkflow(QName workflowTemplateId) throws RepositoryException, GraphException,
ComponentException, Exception {
Registry registry = connectToRegistry();
Node node = registry.getWorkflow(workflowTemplateId,this.engine.getConfiguration().getRegigstryUserName());
@@ -334,55 +193,15 @@ public class XRegistryAccesser {
* @param workflowTemplateId
* @param xRegistryURL
* @param context
- * @throws XRegistryClientException
+ * @throws RepositoryException
* @throws XregistryException
*/
- public void deleteOGCEWorkflow(QName workflowTemplateId) throws XRegistryClientException {
+ public void deleteOGCEWorkflow(QName workflowTemplateId) throws RepositoryException {
Registry registry = connectToRegistry();
registry.deleteWorkflow(workflowTemplateId,this.engine.getConfiguration().getRegigstryUserName());
}
/**
- * @param hostName
- * @throws XRegistryClientException
- */
- public void deleteHostDescription(String hostName) throws XRegistryClientException {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
-
- this.xregistryClient.removeHostDesc(hostName);
- }
-
- /**
- * @param appName
- * @param hostName
- * @throws XRegistryClientException
- */
- public void deleteAppDescription(QName appName, String hostName) throws XRegistryClientException {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
-
- this.xregistryClient.removeAppDesc(appName, hostName);
- }
-
- /**
- * @param serviceName
- * @throws XRegistryClientException
- */
- public void deleteServiceDescrption(QName serviceName) throws XRegistryClientException {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
- this.xregistryClient.removeServiceDesc(serviceName);
- } catch (Exception e) {
- throw convertXRegistryClientException(e);
- }
- }
-
- /**
* Returns a Workflow object with the Template IDs properly set and ready to be loaded into XBaya
*
* @param xRegistryURI
@@ -410,480 +229,6 @@ public class XRegistryAccesser {
}
/**
- *
- * @return XRegistryClient
- */
- public XRegistryClient getXRegistryClient() {
- return this.xregistryClient;
-
- }
-
- /**
- * @param hostName
- * @return HostDescData Array
- */
- public HostDescData[] searchHostByName(String hostName) {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
-
- return this.xregistryClient.findHosts(hostName);
- } catch (XRegistryClientException e) {
- throw new XBayaRuntimeException(e);
- }
- }
-
- /**
- * @param appName
- * @return AppData Array
- */
- public AppData[] searchApplicationByName(String appName) {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
-
- return this.xregistryClient.findAppDesc(appName);
- } catch (XRegistryClientException e) {
- throw new XBayaRuntimeException(e);
- }
- }
-
- /**
- * @param serviceName
- * @return ServiceData Array
- */
- public ServiceDescData[] searchServiceByName(String serviceName) {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
-
- return this.xregistryClient.findServiceDesc(serviceName);
- } catch (XRegistryClientException e) {
- throw new XBayaRuntimeException(e);
- }
- }
-
- /**
- * @param rescName
- * @return ResourceData Array
- */
- public ResourceData[] searchResourceByName(String rescName) {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
-
- return this.xregistryClient.findResource(rescName);
- } catch (XRegistryClientException e) {
- throw new XBayaRuntimeException(e);
- }
- }
-
- /**
- * @param hostBean
- * @return Registration Result
- */
- public boolean registerHost(HostBean hostBean) {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
-
- String toFormatXML = HostUtils.simpleHostXMLRequest(hostBean);
- String formattedXML = XmlFormatter.format(toFormatXML);
-
-
- this.xregistryClient.registerHostDesc(formattedXML);
-
- return true;
- } catch (XRegistryClientException e) {
- e.printStackTrace();
- return false;
- } catch (GFacSchemaException e) {
- e.printStackTrace();
- return false;
- }
- }
-
- /**
- * @param appBean
- * @return Registration Result
- */
- public boolean registerApplication(ApplicationBean appBean) {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
-
- String toFormatXML = ApplicationUtils.simpleAppXMLRequest(appBean);
- String formattedXML = XmlFormatter.format(toFormatXML);
-
-
- this.xregistryClient.registerAppDesc(formattedXML);
-
- return true;
- } catch (XRegistryClientException e) {
- return false;
- }
- }
-
- /**
- * @param serviceBean
- * @return Registration Result
- */
- public boolean registerService(ServiceBean serviceBean) {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
-
- String toFormatXML = ServiceUtils.simpleServiceXMLRequest(serviceBean);
- String formattedXML = XmlFormatter.format(toFormatXML);
- String serviceWsdl = ServiceUtils.createAwsdl4ServiceMap(formattedXML);
-
-
- this.xregistryClient.registerServiceDesc(formattedXML, serviceWsdl);
-
- return true;
- } catch (XRegistryClientException e) {
- e.printStackTrace();
- return false;
- } catch (GFacSchemaException e) {
- e.printStackTrace();
- return false;
- }
- }
-
- /**
- * @param hostDesc
- * @return Registration Result
- */
- public boolean registerHost(String hostDesc) {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
-
- this.xregistryClient.registerHostDesc(hostDesc);
- return true;
- } catch (XRegistryClientException e) {
- e.printStackTrace();
- return false;
- }
- }
-
- /**
- * @param appDesc
- * @return Registration Result
- */
- public boolean registerApplication(String appDesc) {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
-
- this.xregistryClient.registerAppDesc(appDesc);
- return true;
- } catch (XRegistryClientException e) {
- e.printStackTrace();
- return false;
- }
- }
-
- /**
- * @param serviceDesc
- * @return Registration Result
- */
- public boolean registerService(String serviceDesc) {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
-
- String awsdlAsStr = ServiceUtils.createAwsdl4ServiceMap(serviceDesc);
- this.xregistryClient.registerServiceDesc(serviceDesc, awsdlAsStr);
- return true;
- } catch (XRegistryClientException e) {
- e.printStackTrace();
- return false;
- } catch (GFacSchemaException e) {
- e.printStackTrace();
- return false;
- }
- }
-
- /**
- * @param hostName
- * @return Host Description
- */
- public HostBean getHostBean(String hostName) {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
- String hostDesc = this.xregistryClient.getHostDesc(hostName);
- return HostUtils.simpleHostBeanRequest(hostDesc);
- } catch (XRegistryClientException e) {
- e.printStackTrace();
- return null;
- } catch (XmlException e) {
- e.printStackTrace();
- return null;
- }
- }
-
- /**
- * @param hostName
- * @return Host Description
- */
- public String getHostDesc(String hostName) {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
- String hostDesc = this.xregistryClient.getHostDesc(hostName);
- return hostDesc;
- } catch (XRegistryClientException e) {
- return e.getMessage();
- }
- }
-
- /**
- * @param appName
- * @param hostName
- * @return ApplicationBean
- */
- public ApplicationBean getApplicationBean(String appName, String hostName) {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
- String appDesc = this.xregistryClient.getAppDesc(appName, hostName);
- return ApplicationUtils.simpleApplicationBeanRequest(appDesc);
- } catch (XRegistryClientException e) {
- e.printStackTrace();
- return null;
- } catch (XmlException e) {
- e.printStackTrace();
- return null;
- }
- }
-
- /**
- * @param appName
- * @param hostName
- * @return Application Description
- */
- public String getApplicationDesc(String appName, String hostName) {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
- String appDesc = this.xregistryClient.getAppDesc(appName, hostName);
- return appDesc;
- } catch (XRegistryClientException e) {
- return e.getMessage();
- }
- }
-
- /**
- * @param serviceName
- * @return ServiceBean
- */
- public ServiceBean getServiceBean(QName serviceName) {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
- String serviceMapStr = this.xregistryClient.getServiceDesc(serviceName);
- return ServiceUtils.serviceBeanRequest(serviceMapStr);
- } catch (XRegistryClientException e) {
- e.printStackTrace();
- return null;
- } catch (XmlException e) {
- e.printStackTrace();
- return null;
- } catch (IOException e) {
- e.printStackTrace();
- return null;
- }
- }
-
- /**
- * @param serviceName
- * @return Service Description
- */
- public String getServiceDesc(QName serviceName) {
- try {
- if (this.xregistryClient == null) {
- connectToXRegistry();
- }
- String serviceMapStr = this.xregistryClient.getServiceDesc(serviceName);
- return serviceMapStr;
- } catch (XRegistryClientException e) {
- return e.getMessage();
- }
- }
-
- // following method are now deprecated. Now all workflows should be savaed
- // as ogecresources with workflowtemplate as types.
-
- /**
- * Retrieves all documents from XRegistry
- *
- * @return
- * @throws XRegistryClientException
- * @throws XregistryException
- */
- // public Map<QName, ResourceData> list() throws XRegistryClientException {
- // if (this.xregistryClient == null) {
- // connectToXRegistry();
- // }
- // Map<QName, ResourceData> val = new HashMap<QName, ResourceData>();
- // ResourceData[] resources = this.xregistryClient.findResource("");
- // for (ResourceData resource : resources) {
- // QName resourceName = resource.getName();
- // if (resourceName != null
- // && XBayaConstants.LEAD_NS.equals(resourceName
- // .getNamespaceURI()))
- // val.put(resourceName, resource);
- // }
- // return val;
- // }
-
- /**
- * Export the workflow to the X-Registry
- */
- // public void exportWorkflow() {
- //
- // boolean makePublic = false;
- //
- // try {
- // if (this.xregistryClient == null) {
- // connectToXRegistry();
- // }
- // Workflow workflow = this.engine.getWorkflow();
- // JythonScript script = new JythonScript(workflow, this.engine
- // .getConfiguration());
- //
- // // Check if there is any errors in the workflow first.
- // ArrayList<String> warnings = new ArrayList<String>();
- // if (!script.validate(warnings)) {
- // StringBuilder buf = new StringBuilder();
- // for (String warning : warnings) {
- // buf.append("- ");
- // buf.append(warning);
- // buf.append("\n");
- // }
- // this.engine.getErrorWindow().warning(buf.toString());
- // return;
- // }
- //
- // XRegistryWorkflowPublisherWindow registryPublishingWindow = new
- // XRegistryWorkflowPublisherWindow(
- // this.engine);
- // registryPublishingWindow.show();
- // String finalWorkflowName = registryPublishingWindow.getLabel();
- // if (null != finalWorkflowName && !"".equals(finalWorkflowName)) {
- // workflow.setName(finalWorkflowName);
- // }
- //
- // // first find whether this resource is already in xregistry
- // String resource = this.xregistryClient.getResource(workflow
- // .getQname());
- // if (resource != null && !"".equals(resource)) {
- // // if already there then remove
- // int result = JOptionPane
- // .showConfirmDialog(
- // this.engine.getGUI().getGraphCanvas()
- // .getSwingComponent(),
- // "Workflow Already Exist in Xregistry. Do you want to overwrite",
- // "Workflow already exist",
- // JOptionPane.YES_NO_OPTION);
- // if (result != JOptionPane.YES_OPTION) {
- // return;
- // }
- // this.xregistryClient.removeResource(workflow.getQname());
- // }
- // String workflowAsString = XMLUtil.xmlElementToString(workflow
- // .toXML());
- // this.xregistryClient.registerResource(workflow.getQname(),
- // workflowAsString);
- // makePublic = registryPublishingWindow.isMakePublic();
- // if (makePublic) {
- // this.xregistryClient.addCapability(workflow.getQname()
- // .toString(), PUBLIC_ACTOR, false,
- // XRegClientConstants.Action.Read.toString());
- // }
- // registryPublishingWindow.hide();
- //
- // } catch (Exception e) {
- // this.engine.getErrorWindow().error(e.getMessage(), e);
- // }
- // }
-
- /**
- * Returns all the workflows that the user associated with the credential has access to
- *
- * @param xRegistryURL
- * Xregistry URL eg:https://silktree.cs.indiana.edu:6666/xregistry
- * @param credential
- * Proxy credential
- * @return List of workflows
- */
- // public Workflow[] getWorkflows() {
- // return getWorkflows(-1);
- // }
-
- /**
- * Returns all the workflows that the user associated with the credential has access to
- *
- * @param xRegistryURL
- * Xregistry URL eg:https://silktree.cs.indiana.edu:6666/xregistry
- * @param credential
- * Proxy credential
- * @param resultSetSize
- * return array will be limited to this
- * @return List of workflows
- */
- // public Workflow[] getWorkflows(int resultSetSize) {
- // try {
- // if (this.xregistryClient == null) {
- // connectToXRegistry();
- // }
- // ResourceData[] resources = this.xregistryClient.findResource("");
- // LinkedList<Workflow> workflows = new LinkedList<Workflow>();
- // if (resultSetSize == -1) {
- // for (ResourceData resource : resources) {
- // QName resourceName = resource.getName();
- // if (resourceName != null
- // && XBayaConstants.LEAD_NS.equals(resourceName
- // .getNamespaceURI())) {
- // workflows.add(getWorkflow(resourceName));
- // }
- // }
- // } else {
- // for (int i = 0; i < Math.min(resources.length, resultSetSize); i++) {
- // ResourceData resource = resources[i];
- // QName resourceName = resource.getName();
- // if (resourceName != null
- // && XBayaConstants.LEAD_NS.equals(resourceName
- // .getNamespaceURI())) {
- // workflows.add(getWorkflow(resourceName));
- // }
- // }
- // }
- //
- // return workflows.toArray(new Workflow[0]);
- // } catch (XRegistryClientException e) {
- // throw new XBayaRuntimeException(e);
- // }
- // }
-
- /**
* Returns the workflow object fetched from Xregistry.
*
* @param xRegistryURI
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/streaming/StreamClient.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/streaming/StreamClient.java?rev=1184969&r1=1184968&r2=1184969&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/streaming/StreamClient.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/streaming/StreamClient.java Mon Oct 17 01:14:07 2011
@@ -32,7 +32,6 @@ import org.apache.airavata.xbaya.ode.ODE
import org.apache.airavata.xbaya.security.SecurityUtil;
import org.apache.airavata.xbaya.security.XBayaSecurity;
import org.apache.airavata.xbaya.wf.Workflow;
-import org.apache.airavata.xbaya.xregistry.XRegistryAccesser;
import org.ietf.jgss.GSSCredential;
import org.ietf.jgss.GSSException;
@@ -45,55 +44,55 @@ import xsul5.wsdl.WsdlResolver;
public class StreamClient {
- public void invoke(String operationName, WsdlDefinitions wsdl, String name, String topic) {
- ODEClient odeClient = new ODEClient();
- GSSCredential credential = SecurityUtil.getGSSCredential("chathura", "changeme",
- XBayaConstants.DEFAULT_MYPROXY_SERVER);
- XRegistryAccesser xregistryAccesser = new XRegistryAccesser(credential, XBayaConstants.DEFAULT_XREGISTRY_URL);
- Workflow workflow = xregistryAccesser.getWorkflow(name);
-
- GsiInvoker secureInvoker = null;
- secureInvoker = new GsiInvoker(credential, XBayaSecurity.getTrustedCertificates());
-
- try {
- LeadContextHeader defaultLeadHeader = odeClient.getDefaultLeadHeader(workflow, topic, credential.getName()
- .toString(), new URI(topic), null, null);
- defaultLeadHeader.setExperimentId(topic);
- LEADWorkflowInvoker invoker = new LEADWorkflowInvoker(wsdl, defaultLeadHeader, null, secureInvoker,
- operationName);
-
- WSIFMessage inputMessage = invoker.getInputMessage();
- // inputMessage.setObjectPart("input",
- // XmlConstants.BUILDER.newFragment("<n1:Run xmlns:n1='http://www.extreme.indiana.edu/xbaya/demok/xsd/'><file1>fds</file1><file2>fsfas</file2></n1:Run>"));
- inputMessage.setObjectPart("input", "tttt");
- // inputMessage.setObjectPart("file2", "tttt");
- invoker.invoke();
- } catch (ComponentException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (GSSException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (URISyntaxException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (XBayaException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- /**
- * @param args
- * @throws URISyntaxException
- * @throws WsdlException
- */
- public static void main(String[] args) throws WsdlException, URISyntaxException {
-
- StreamClient streamTestClient = new StreamClient();
- WsdlDefinitions wsdl = WsdlResolver.getInstance().loadWsdl(
- new URI("http://pagodatree.cs.indiana.edu:17080/ode/processes/Control_Stream_Echo?wsdl"));
- streamTestClient.invoke("Run", wsdl, "Control_Stream_Echo", "9e15d8ae-0f36-4c2e-ae8a-930557cdcdd2");
- }
+// public void invoke(String operationName, WsdlDefinitions wsdl, String name, String topic) {
+// ODEClient odeClient = new ODEClient();
+// GSSCredential credential = SecurityUtil.getGSSCredential("chathura", "changeme",
+// XBayaConstants.DEFAULT_MYPROXY_SERVER);
+// XRegistryAccesser xregistryAccesser = new XRegistryAccesser(credential, XBayaConstants.DEFAULT_XREGISTRY_URL);
+// Workflow workflow = xregistryAccesser.getWorkflow(name);
+//
+// GsiInvoker secureInvoker = null;
+// secureInvoker = new GsiInvoker(credential, XBayaSecurity.getTrustedCertificates());
+//
+// try {
+// LeadContextHeader defaultLeadHeader = odeClient.getDefaultLeadHeader(workflow, topic, credential.getName()
+// .toString(), new URI(topic), null, null);
+// defaultLeadHeader.setExperimentId(topic);
+// LEADWorkflowInvoker invoker = new LEADWorkflowInvoker(wsdl, defaultLeadHeader, null, secureInvoker,
+// operationName);
+//
+// WSIFMessage inputMessage = invoker.getInputMessage();
+// // inputMessage.setObjectPart("input",
+// // XmlConstants.BUILDER.newFragment("<n1:Run xmlns:n1='http://www.extreme.indiana.edu/xbaya/demok/xsd/'><file1>fds</file1><file2>fsfas</file2></n1:Run>"));
+// inputMessage.setObjectPart("input", "tttt");
+// // inputMessage.setObjectPart("file2", "tttt");
+// invoker.invoke();
+// } catch (ComponentException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// } catch (GSSException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// } catch (URISyntaxException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// } catch (XBayaException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+// }
+//
+// /**
+// * @param args
+// * @throws URISyntaxException
+// * @throws WsdlException
+// */
+// public static void main(String[] args) throws WsdlException, URISyntaxException {
+//
+// StreamClient streamTestClient = new StreamClient();
+// WsdlDefinitions wsdl = WsdlResolver.getInstance().loadWsdl(
+// new URI("http://pagodatree.cs.indiana.edu:17080/ode/processes/Control_Stream_Echo?wsdl"));
+// streamTestClient.invoke("Run", wsdl, "Control_Stream_Echo", "9e15d8ae-0f36-4c2e-ae8a-930557cdcdd2");
+// }
}
\ No newline at end of file
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/HierarchicalWorkflowTestCase.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/HierarchicalWorkflowTestCase.java?rev=1184969&r1=1184968&r2=1184969&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/HierarchicalWorkflowTestCase.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/HierarchicalWorkflowTestCase.java Mon Oct 17 01:14:07 2011
@@ -89,18 +89,18 @@ public class HierarchicalWorkflowTestCas
this.workflowCreator = new WorkflowCreator();
// GPEL Setup
- X509Certificate[] trustedCertificates = XBayaSecurity.getTrustedCertificates();
- MyProxyClient client = new MyProxyClient(this.configuration.getMyProxyServer(),
- this.configuration.getMyProxyPort(), this.configuration.getMyProxyUsername(),
- this.configuration.getMyProxyPassphrase(), this.configuration.getMyProxyLifetime());
- client.load();
- GSSCredential proxy = client.getProxy();
- UserX509Credential credential = new UserX509Credential(proxy, trustedCertificates);
- this.workflowClient = WorkflowEngineManager.getWorkflowClient(XBayaConstants.DEFAULT_GPEL_ENGINE_URL,
- credential);
-
- this.gpelComponentRegistry = new GPELRegistry(null, WorkflowClient.WorkflowType.TEMPLATE, 100);
- this.componentRegistry = new LocalComponentRegistry(XBayaPathConstants.WSDL_DIRECTORY);
+// X509Certificate[] trustedCertificates = XBayaSecurity.getTrustedCertificates();
+// MyProxyClient client = new MyProxyClient(this.configuration.getMyProxyServer(),
+// this.configuration.getMyProxyPort(), this.configuration.getMyProxyUsername(),
+// this.configuration.getMyProxyPassphrase(), this.configuration.getMyProxyLifetime());
+// client.load();
+// GSSCredential proxy = client.getProxy();
+// UserX509Credential credential = new UserX509Credential(proxy, trustedCertificates);
+// this.workflowClient = WorkflowEngineManager.getWorkflowClient(XBayaConstants.DEFAULT_GPEL_ENGINE_URL,
+// credential);
+//
+// this.gpelComponentRegistry = new GPELRegistry(null, WorkflowClient.WorkflowType.TEMPLATE, 100);
+// this.componentRegistry = new LocalComponentRegistry(XBayaPathConstants.WSDL_DIRECTORY);
}
/**
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/WSIFTestCase.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/WSIFTestCase.java?rev=1184969&r1=1184968&r2=1184969&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/WSIFTestCase.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/test/WSIFTestCase.java Mon Oct 17 01:14:07 2011
@@ -25,7 +25,6 @@ import junit.framework.TestSuite;
import org.apache.airavata.xbaya.XBayaConstants;
import org.apache.airavata.xbaya.component.gui.ComponentTreeNode;
-import org.apache.airavata.xbaya.xregistry.XRegistryComponent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -54,62 +53,4 @@ public class WSIFTestCase extends XBayaT
this.xRegistryComponentTree = null;
}
- /**
- * @throws InterruptedException
- */
- public void ttestXRegistry() throws InterruptedException {
- Thread xRegistryThread = new Thread() {
- @Override
- public void run() {
- try {
- XRegistryComponent client = new XRegistryComponent(XBayaConstants.DEFAULT_XREGISTRY_URL,
- XRegistryComponent.Type.ABSTRACT);
- WSIFTestCase.this.xRegistryComponentTree = client.getComponentTree();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- }
- }
- };
-
- xRegistryThread.start();
-
- // Join them otherwise the test finishes.
- xRegistryThread.join();
-
- assertNotNull(this.xRegistryComponentTree);
- }
-
- /**
- * @throws InterruptedException
- */
- public void testSynchronization() throws InterruptedException {
-
- Thread xRegistryThread = new Thread() {
- @Override
- public void run() {
- try {
- XRegistryComponent client = new XRegistryComponent(XBayaConstants.DEFAULT_XREGISTRY_URL,
- XRegistryComponent.Type.ABSTRACT);
- WSIFTestCase.this.xRegistryComponentTree = client.getComponentTree();
- System.err.println("ALEK c=" + WSIFTestCase.this.xRegistryComponentTree);
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- }
- }
- };
-
- xRegistryThread.start();
-
- System.err.println("ALEK2 c=" + WSIFTestCase.this.xRegistryComponentTree);
- System.err.println("ALEK2 r=" + WSIFTestCase.this.resouceCatalogComponentTree);
-
- // Join them otherwise the test finishes.
- xRegistryThread.join();
-
- System.err.println("ALEK3 c=" + WSIFTestCase.this.xRegistryComponentTree);
- System.err.println("ALEK3 r=" + WSIFTestCase.this.resouceCatalogComponentTree);
-
- assertNotNull(this.resouceCatalogComponentTree);
- assertNotNull(this.xRegistryComponentTree);
- }
}
\ No newline at end of file
Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/WorkflowEngineManager.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/WorkflowEngineManager.java?rev=1184969&r1=1184968&r2=1184969&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/WorkflowEngineManager.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/WorkflowEngineManager.java Mon Oct 17 01:14:07 2011
@@ -29,29 +29,29 @@ import org.apache.airavata.xbaya.workflo
public class WorkflowEngineManager {
- public static final String WORKFLOW_CLIENT_PROXY = "WorkflowProxy";
- public static final String WORKFLOW_CLIENT_GPEL = "GPELClient";
-
-
- private WorkflowEngineManager() {
- }
-
- public static WorkflowClient getWorkflowClient() {
- String workflowClientName = System.getProperty("org.apache.airavata.xbaya.workflow.ClientType");
- if (WORKFLOW_CLIENT_PROXY.equals(workflowClientName)) {
- return new WorkflowProxyClient();
- } else {
- return new GPELClient();
- }
- }
-
- public static WorkflowClient getWorkflowClient(URI engineURL, UserX509Credential gpelUserX509Credential)
- throws WorkflowEngineException {
- String workflowClientName = System.getProperty("org.apache.airavata.xbaya.workflow.ClientType");
- if (WORKFLOW_CLIENT_PROXY.equals(workflowClientName)) {
- return new WorkflowProxyClient(engineURL, "", gpelUserX509Credential);
- } else {
- return new GPELClient(engineURL, gpelUserX509Credential);
- }
- }
+// public static final String WORKFLOW_CLIENT_PROXY = "WorkflowProxy";
+// public static final String WORKFLOW_CLIENT_GPEL = "GPELClient";
+//
+//
+// private WorkflowEngineManager() {
+// }
+//
+// public static WorkflowClient getWorkflowClient() {
+// String workflowClientName = System.getProperty("org.apache.airavata.xbaya.workflow.ClientType");
+// if (WORKFLOW_CLIENT_PROXY.equals(workflowClientName)) {
+// return new WorkflowProxyClient();
+// } else {
+// return new GPELClient();
+// }
+// }
+//
+// public static WorkflowClient getWorkflowClient(URI engineURL, UserX509Credential gpelUserX509Credential)
+// throws WorkflowEngineException {
+// String workflowClientName = System.getProperty("org.apache.airavata.xbaya.workflow.ClientType");
+// if (WORKFLOW_CLIENT_PROXY.equals(workflowClientName)) {
+// return new WorkflowProxyClient(engineURL, "", gpelUserX509Credential);
+// } else {
+// return new GPELClient(engineURL, gpelUserX509Credential);
+// }
+// }
}