@Override protected final void internalRemoveComponent(Component component) throws RegistryException { File componentDir = new File(componentFamilyDir, component.getName()); try { deleteDirectory(componentDir); } catch (IOException e) { throw new RegistryException("Unable to delete component", e); } } }
@Override protected final void internalRemoveComponent(Component component) throws RegistryException { File componentDir = new File(componentFamilyDir, component.getName()); try { deleteDirectory(componentDir); } catch (IOException e) { throw new RegistryException("Unable to delete component", e); } } }
@Override protected String doInBackground() throws Exception { Family chosenFamily = registryAndFamilyChooserPanel .getChosenFamily(); if (chosenFamily != null) for (Component component : chosenFamily.getComponents()) componentMap.put(component.getName(), component); return null; }
protected void refresh(Component component, SwingWorker<ComponentServiceProviderConfig, Object> worker) { try { refreshComponentServiceProvider(worker.get()); } catch (ExecutionException e) { logger.error("failed to delete component", e.getCause()); showMessageDialog( null, format(FAILED_MSG, component.getName(), e.getCause() .getMessage()), DELETE_FAILED_TITLE, ERROR_MESSAGE); } catch (ConfigurationException e) { logger.error("failed to handle service panel update " + "after deleting component", e); } catch (InterruptedException e) { logger.warn("interrupted during component deletion", e); } }
@Override public final void removeComponent(Component component) throws RegistryException { if (component != null) { checkComponentCache(); synchronized (componentCache) { componentCache.remove(component.getName()); } internalRemoveComponent(component); } }
@Override public final void removeComponent(Component component) throws RegistryException { if (component != null) { checkComponentCache(); synchronized (componentCache) { componentCache.remove(component.getName()); } internalRemoveComponent(component); } }
public ComponentVersionIdentification(Registry registry, Family family, net.sf.taverna.t2.component.api.Component component, Integer version) { this(registry.getRegistryBase(), family.getName(), component.getName(), version); }
private void doDelete(final Component chosenComponent) { if (chosenComponent == null) { showMessageDialog(null, WHAT_COMPONENT_MSG, COMPONENT_PROBLEM_TITLE, ERROR_MESSAGE); } else if (componentIsInUse(chosenComponent)) { showMessageDialog(null, OPEN_COMPONENT_MSG, COMPONENT_PROBLEM_TITLE, ERROR_MESSAGE); } else if (showConfirmDialog(null, format(CONFIRM_MSG, chosenComponent.getName()), CONFIRM_TITLE, YES_NO_OPTION) == YES_OPTION) new SwingWorker<ComponentServiceProviderConfig, Object>() { @Override protected ComponentServiceProviderConfig doInBackground() throws Exception { return deleteComponent(chosenComponent); } @Override protected void done() { refresh(chosenComponent, this); } }.execute(); }
public ComponentVersionIdentification(Registry registry, Family family, net.sf.taverna.t2.component.api.Component component, Integer version) { this(registry.getRegistryBase(), family.getName(), component.getName(), version); }
public static String convertValueToString(Object value) { if (value instanceof Registry) { return ((Registry) value).getRegistryBase().toString(); } if (value instanceof Family) { return ((Family) value).getName(); } if (value instanceof Component) { return ((Component) value).getName(); } if (value instanceof Version) { return ((Version) value).getVersionNumber().toString(); } if (value instanceof Integer) { return ((Integer) value).toString(); } if (value instanceof String) { return (String) value; } if (value == null) { return ("null"); } return "Spaceholder for " + value.getClass().getName(); }
private void doMerge(Component sourceComponent, Component targetComponent) { if (sourceComponent == null) { showMessageDialog(null, "Unable to determine source component", "Component Merge Problem", ERROR_MESSAGE); return; } else if (targetComponent == null) { showMessageDialog(null, "Unable to determine target component", "Component Merge Problem", ERROR_MESSAGE); return; } else if (sourceComponent.equals(targetComponent)) { showMessageDialog(null, "Cannot merge a component with itself", "Component Merge Problem", ERROR_MESSAGE); return; } try { Version sourceVersion = sourceComponent.getComponentVersionMap() .get(sourceComponent.getComponentVersionMap().lastKey()); targetComponent.addVersionBasedOn(sourceVersion.getDataflow(), "Merge from " + sourceComponent.getFamily().getName() + ":" + sourceComponent.getName()); } catch (RegistryException e) { logger.error("failed to merge component", e); } }
private void doOpen(Registry registry, Family family, Component component, Version version) { Version.ID ident = new ComponentVersionIdentification( registry.getRegistryBase(), family.getName(), component.getName(), version.getVersionNumber()); try { Dataflow d = fm.openDataflow(ComponentFileType.instance, ident); final GraphController gc = graphControllerMap.get(d); invokeLater(new Runnable() { @Override public void run() { if (gc != null) { SVGGraph g = (SVGGraph) gc.getGraph(); g.setFillColor(RED); gc.redraw(); } } }); } catch (OpenException e) { logger.error("Failed to open component definition", e); } } }
private Version.ID findComponentVersionWithWorkflow(Element wfElement) throws RegistryException { String resourceUri = wfElement.getAttributeValue("resource"); for (Family f : this.getComponentFamilies()) for (Component c : f.getComponents()) for (Version cv : c.getComponentVersionMap().values()) if (cv instanceof MyExperimentComponentVersion) if (((MyExperimentComponentVersion) cv) .hasWorkflowUri(resourceUri)) return new ComponentVersionIdentification( this.getRegistryBase(), f.getName(), c.getName(), cv.getVersionNumber()); return null; }
private Version.ID findComponentVersionWithWorkflow(Element wfElement) throws RegistryException { String resourceUri = wfElement.getAttributeValue("resource"); for (Family f : this.getComponentFamilies()) for (Component c : f.getComponents()) for (Version cv : c.getComponentVersionMap().values()) if (cv instanceof MyExperimentComponentVersion) if (((MyExperimentComponentVersion) cv) .hasWorkflowUri(resourceUri)) return new ComponentVersionIdentification( this.getRegistryBase(), f.getName(), c.getName(), cv.getVersionNumber()); return null; }
@Override public ID getID() { Component c = getComponent(); return new ComponentVersionIdentification(c.getRegistry() .getRegistryBase(), c.getFamily().getName(), c.getName(), getVersionNumber()); } }
@Override public ID getID() { Component c = getComponent(); return new ComponentVersionIdentification(c.getRegistry() .getRegistryBase(), c.getFamily().getName(), c.getName(), getVersionNumber()); } }
@Test public void testCreateComponentBasedOn() throws Exception { Version componentVersion = componentFamily.createComponentBasedOn( "Test Component", "Some description", dataflow); assertEquals("Test Component", componentVersion.getComponent() .getName()); }
@Test public void testCreateComponentBasedOn() throws Exception { Version componentVersion = componentFamily.createComponentBasedOn( "Test Component", "Some description", dataflow); assertEquals("Test Component", componentVersion.getComponent() .getName()); }