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);
}
}
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);
}
}
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);
}
}
}
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);
}
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();
}
}
Aggregations