Search in sources :

Example 1 with ComponentRegistryException

use of org.apache.airavata.workflow.model.component.ComponentRegistryException in project airavata by apache.

the class LocalComponentRegistry method getComponents.

/**
 * @param file
 * @return The list of components defined in the specified file.
 * @throws ComponentException
 * @throws ComponentRegistryException
 */
public List<WSComponent> getComponents(File file) throws ComponentException, ComponentRegistryException {
    try {
        String compString = IOUtil.readFileToString(file);
        List<WSComponent> components = WSComponentFactory.createComponents(compString);
        return components;
    } catch (IOException e) {
        throw new ComponentRegistryException(e);
    }
}
Also used : WSComponent(org.apache.airavata.workflow.model.component.ws.WSComponent) IOException(java.io.IOException) ComponentRegistryException(org.apache.airavata.workflow.model.component.ComponentRegistryException)

Example 2 with ComponentRegistryException

use of org.apache.airavata.workflow.model.component.ComponentRegistryException in project airavata by apache.

the class SimpleWSClient method sendSOAPMessage.

/**
 * @param wclient
 * @param args
 * @param opName
 * @return The output
 * @throws ComponentRegistryException
 */
public WSIFMessage sendSOAPMessage(WSIFClient wclient, Object[][] args, String opName) throws ComponentRegistryException {
    WSIFPort port = wclient.getPort();
    WSIFOperation operation = port.createOperation(opName);
    WSIFMessage outputMessage = operation.createOutputMessage();
    WSIFMessage faultMessage = operation.createFaultMessage();
    String messageName = operation.createInputMessage().getName();
    XmlElement inputMsgElem = builder.newFragment(this.requestNS, messageName);
    for (int i = 0; i < args.length; i++) {
        createMessage((String) args[i][0], args[i][1], inputMsgElem);
    }
    WSIFMessageElement inputMessage = new WSIFMessageElement(inputMsgElem);
    boolean success = operation.executeRequestResponseOperation(inputMessage, outputMessage, faultMessage);
    if (success) {
        logger.debug("" + outputMessage);
        return outputMessage;
    } else {
        throw new ComponentRegistryException("Excpetion at server " + faultMessage);
    }
}
Also used : WSIFMessageElement(xsul.wsif.impl.WSIFMessageElement) WSIFOperation(xsul.wsif.WSIFOperation) WSIFPort(xsul.wsif.WSIFPort) XmlElement(org.xmlpull.v1.builder.XmlElement) ComponentRegistryException(org.apache.airavata.workflow.model.component.ComponentRegistryException) WSIFMessage(xsul.wsif.WSIFMessage)

Example 3 with ComponentRegistryException

use of org.apache.airavata.workflow.model.component.ComponentRegistryException in project airavata by apache.

the class XBayaEngine method initRegistry.

/**
 * Initializes registris.
 */
private void initRegistry() {
    componentTreeViewer = this.gui.getComponentSelector();
    try {
        this.componentRegistry = new SystemComponentRegistry();
        // This does not take time, so we can do it in the same thread.
        this.systemComponentTree = ComponentController.getComponentTree(this.componentRegistry);
        componentTreeViewer.addComponentTree(0, this.systemComponentTree);
        componentTreeViewer.addComponentTree(1, ComponentController.getComponentTree(new AmazonComponentRegistry()));
    } catch (RuntimeException e) {
        // This should not happen
        logger.error(e.getMessage(), e);
        getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
    } catch (ComponentRegistryException e) {
        logger.error(e.getMessage(), e);
        getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
    }
    List<String> localRegistryPaths = this.configuration.getLocalRegistry();
    for (String path : localRegistryPaths) {
        try {
            LocalComponentRegistry registry = new LocalComponentRegistry(path);
            // XXX This might take time, so it's better to move to another
            // thread.
            ComponentTreeNode componentTree = ComponentController.getComponentTree(registry);
            componentTreeViewer.addComponentTree(componentTree);
        } catch (ComponentRegistryException e) {
            getGUI().getErrorWindow().error(ErrorMessages.COMPONENT_LIST_LOAD_ERROR, e);
        } catch (RuntimeException e) {
            getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
        }
    }
}
Also used : SystemComponentRegistry(org.apache.airavata.workflow.model.component.system.SystemComponentRegistry) AmazonComponentRegistry(org.apache.airavata.workflow.model.component.amazon.AmazonComponentRegistry) LocalComponentRegistry(org.apache.airavata.workflow.model.component.local.LocalComponentRegistry) ComponentRegistryException(org.apache.airavata.workflow.model.component.ComponentRegistryException) ComponentTreeNode(org.apache.airavata.xbaya.ui.widgets.component.ComponentTreeNode)

Example 4 with ComponentRegistryException

use of org.apache.airavata.workflow.model.component.ComponentRegistryException in project airavata by apache.

the class ComponentSelector method createNodePopupMenu.

private void createNodePopupMenu() {
    this.popup = new JPopupMenu();
    JMenuItem refreshItem = new JMenuItem("Refresh Registry");
    refreshItem.addActionListener(new AbstractAction() {

        public void actionPerformed(ActionEvent event) {
            new Thread() {

                @Override
                public void run() {
                    try {
                        updateSelectedRegistry();
                    } catch (ComponentRegistryException e) {
                        ComponentSelector.this.engine.getGUI().getErrorWindow().error(ErrorMessages.COMPONENT_LIST_LOAD_ERROR, e);
                    } catch (RuntimeException e) {
                        ComponentSelector.this.engine.getGUI().getErrorWindow().error(ErrorMessages.COMPONENT_LIST_LOAD_ERROR, e);
                    } catch (Error e) {
                        ComponentSelector.this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
                    }
                }
            }.start();
        }
    });
    this.popup.add(refreshItem);
}
Also used : WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException) ActionEvent(java.awt.event.ActionEvent) ComponentRegistryException(org.apache.airavata.workflow.model.component.ComponentRegistryException) JMenuItem(javax.swing.JMenuItem) AbstractAction(javax.swing.AbstractAction) JPopupMenu(javax.swing.JPopupMenu)

Example 5 with ComponentRegistryException

use of org.apache.airavata.workflow.model.component.ComponentRegistryException in project airavata by apache.

the class ComponentSelector method select.

/**
 * This method is called when a component is selected. It reads the component information from the server and set
 * the selectedComponent.
 *
 * @param treePath
 *            The path of the selected selectedComponent.
 */
private void select(TreePath treePath) {
    final ComponentTreeNode selectedNode = (ComponentTreeNode) treePath.getLastPathComponent();
    final ComponentReference componentReference = selectedNode.getComponentReference();
    selectComponent(null);
    this.selectedComponentReference = null;
    if (componentReference != null) {
        this.selectedComponentReference = componentReference;
        new Thread() {

            @Override
            public void run() {
                try {
                    // get all components and check the number of
                    // components. If there are multiple, expand the tree.
                    final List<? extends Component> components = componentReference.getComponents();
                    if (components.size() == 1) {
                        selectComponent(components.get(0));
                    } else {
                        SwingUtilities.invokeLater(new Runnable() {

                            public void run() {
                                expandTreeLeaf(selectedNode, components);
                            }
                        });
                    }
                } catch (ComponentException e) {
                    selectComponent(null);
                    ComponentSelector.this.engine.getGUI().getErrorWindow().error(ErrorMessages.COMPONENT_FORMAT_ERROR, e);
                } catch (ComponentRegistryException e) {
                    selectComponent(null);
                    ComponentSelector.this.engine.getGUI().getErrorWindow().error(ErrorMessages.COMPONENT_LOAD_ERROR, e);
                } catch (RuntimeException e) {
                    selectComponent(null);
                    ComponentSelector.this.engine.getGUI().getErrorWindow().error(ErrorMessages.COMPONENT_LOAD_ERROR, e);
                } catch (Exception e) {
                    selectComponent(null);
                    ComponentSelector.this.engine.getGUI().getErrorWindow().error(ErrorMessages.COMPONENT_LOAD_ERROR, e);
                }
            }
        }.start();
    }
}
Also used : WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException) ComponentReference(org.apache.airavata.workflow.model.component.ComponentReference) ComponentException(org.apache.airavata.workflow.model.component.ComponentException) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) ComponentRegistryException(org.apache.airavata.workflow.model.component.ComponentRegistryException) WSComponent(org.apache.airavata.workflow.model.component.ws.WSComponent) Component(org.apache.airavata.workflow.model.component.Component) XBayaComponent(org.apache.airavata.xbaya.ui.widgets.XBayaComponent) ComponentException(org.apache.airavata.workflow.model.component.ComponentException) ComponentRegistryException(org.apache.airavata.workflow.model.component.ComponentRegistryException) InvocationTargetException(java.lang.reflect.InvocationTargetException) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)

Aggregations

ComponentRegistryException (org.apache.airavata.workflow.model.component.ComponentRegistryException)8 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)2 Component (org.apache.airavata.workflow.model.component.Component)2 ComponentException (org.apache.airavata.workflow.model.component.ComponentException)2 ComponentReference (org.apache.airavata.workflow.model.component.ComponentReference)2 WSComponent (org.apache.airavata.workflow.model.component.ws.WSComponent)2 WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)2 XmlElement (org.xmlpull.v1.builder.XmlElement)2 Point (java.awt.Point)1 Transferable (java.awt.datatransfer.Transferable)1 UnsupportedFlavorException (java.awt.datatransfer.UnsupportedFlavorException)1 ActionEvent (java.awt.event.ActionEvent)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HttpURLConnection (java.net.HttpURLConnection)1 URL (java.net.URL)1 Collection (java.util.Collection)1 Iterator (java.util.Iterator)1