@Override public final Profile getComponentProfile(String id) throws RegistryException { // TODO use a map instead of a *linear search*... for (Profile p : getComponentProfiles()) if (p.getId().equals(id)) return p; return null; }
@Override public List<SemanticAnnotationProfile> getActivitySemanticAnnotationProfiles() throws RegistryException { List<SemanticAnnotationProfile> saProfiles = new ArrayList<SemanticAnnotationProfile>(); List<ActivityProfile> activityProfiles = getActivityProfiles(); activityProfiles.addAll(parent().getActivityProfiles()); for (ActivityProfile activityProfile : activityProfiles) saProfiles.addAll(activityProfile.getSemanticAnnotations()); if (!isBase()) saProfiles.addAll(baseProfile .getActivitySemanticAnnotationProfiles()); return getUniqueSemanticAnnotationProfiles(saProfiles); }
@Override public List<SemanticAnnotationProfile> getInputSemanticAnnotationProfiles() throws RegistryException { List<SemanticAnnotationProfile> saProfiles = new ArrayList<SemanticAnnotationProfile>(); List<PortProfile> portProfiles = getInputPortProfiles(); portProfiles.addAll(parent().getInputPortProfiles()); for (PortProfile portProfile : portProfiles) saProfiles.addAll(portProfile.getSemanticAnnotations()); if (!isBase()) saProfiles.addAll(baseProfile.getInputSemanticAnnotationProfiles()); return getUniqueSemanticAnnotationProfiles(saProfiles); }
if (p.getName().equals(sourceProfile.getName())) { showMessageDialog(null, "Target registry already contains a profile named " + sourceProfile.getName(), "Copy Problem", ERROR_MESSAGE); return; String sourceId = sourceProfile.getId(); if (sourceId == null) { showMessageDialog(null, "Source profile \"" + sourceProfile.getName() + "\" has no id ", "Copy Problem", ERROR_MESSAGE); return; String id = p.getId(); if (sourceId.equals(id)) { showMessageDialog(null,
public SemanticAnnotationContextualView(Annotated<?> selection) { super(true); super.setAnnotated(selection); componentProfile = getComponentProfile(); try { if (componentProfile == null) super.setSemanticAnnotationProfiles(new ArrayList<SemanticAnnotationProfile>()); else if (selection instanceof Dataflow) super.setSemanticAnnotationProfiles(componentProfile .getSemanticAnnotationProfiles()); else if (selection instanceof DataflowInputPort) super.setSemanticAnnotationProfiles(componentProfile .getInputSemanticAnnotationProfiles()); else if (selection instanceof DataflowOutputPort) super.setSemanticAnnotationProfiles(componentProfile .getOutputSemanticAnnotationProfiles()); else if (selection instanceof Processor) super.setSemanticAnnotationProfiles(componentProfile .getActivitySemanticAnnotationProfiles()); else super.setSemanticAnnotationProfiles(new ArrayList<SemanticAnnotationProfile>()); } catch (RegistryException e) { logger.error("failed to look up semantic annotations", e); } super.initialise(); }
private Element addComponentProfileInternal(Profile componentProfile, License license, SharingPolicy sharingPolicy) throws RegistryException { if (componentProfile == null) throw new RegistryException(("Component profile must not be null")); Element profileElement = null; if (componentProfile instanceof MyExperimentComponentProfile) { MyExperimentComponentProfile myExperimentComponentProfile = (MyExperimentComponentProfile) componentProfile; if (myExperimentComponentProfile.getComponentRegistry() .equals(this)) profileElement = getResource(myExperimentComponentProfile .getUri()); } MyExperimentSharingPolicy permissions = (MyExperimentSharingPolicy) sharingPolicy; if (permissions == null) permissions = MyExperimentComponentRegistry.PRIVATE; if (profileElement == null) { profileElement = uploadFile(componentProfile.getName(), componentProfile.getDescription(), "XML", componentProfile.getXML(), license, permissions.getPolicyString()); tagResource("component profile", profileElement.getAttributeValue("resource")); } return profileElement; }
if (selection instanceof ComponentActivity) { super.setSemanticAnnotationProfiles(componentProfile .getSemanticAnnotationProfiles()); } else if (selection instanceof ActivityInputPort) { super.setSemanticAnnotationProfiles(componentProfile .getInputSemanticAnnotationProfiles()); } else if (selection instanceof ActivityOutputPort) { super.setSemanticAnnotationProfiles(componentProfile .getOutputSemanticAnnotationProfiles());
@Override public List<SemanticAnnotationProfile> getOutputSemanticAnnotationProfiles() throws RegistryException { List<SemanticAnnotationProfile> saProfiles = new ArrayList<SemanticAnnotationProfile>(); List<PortProfile> portProfiles = getOutputPortProfiles(); portProfiles.addAll(parent().getOutputPortProfiles()); for (PortProfile portProfile : portProfiles) saProfiles.addAll(portProfile.getSemanticAnnotations()); if (!isBase()) saProfiles .addAll(baseProfile.getOutputSemanticAnnotationProfiles()); return getUniqueSemanticAnnotationProfiles(saProfiles); }
@Override public List<SemanticAnnotationProfile> getSemanticAnnotationProfiles() throws RegistryException { List<SemanticAnnotationProfile> saProfiles = getComponentProfiles(); saProfiles.addAll(parent().getSemanticAnnotationProfiles()); if (!isBase()) saProfiles.addAll(baseProfile.getSemanticAnnotationProfiles()); return saProfiles; }
@Override public final synchronized Profile getComponentProfile() throws RegistryException { if (componentProfile == null) componentProfile = internalGetComponentProfile(); if (componentProfile == null) { Profile baseProfile = getBaseProfile(); if ((baseProfile != null) && componentProfile.getName().equals(baseProfile.getName())) return baseProfile; } return componentProfile; }
@Override public Profile internalAddComponentProfile(Profile componentProfile, License license, SharingPolicy sharingPolicy) throws RegistryException { String name = componentProfile.getName().replaceAll("\\W+", "") + ".xml"; String inputString = componentProfile.getXML(); File outputFile = new File(getComponentProfilesDir(), name); try { writeStringToFile(outputFile, inputString); } catch (IOException e) { throw new RegistryException("Unable to save profile", e); } try { Profile newProfile = new ComponentProfile(this, outputFile.toURI()); return newProfile; } catch (MalformedURLException e) { throw new RegistryException("Unable to create profile", e); } }
@Override public Map<String, String> getPrefixMap() throws RegistryException { Map<String, String> result = internalGetPrefixMap(); if (!isBase()) result.putAll(baseProfile.getPrefixMap()); return result; }
private void setProfile(Profile componentProfile) { if (componentProfile != null) profileBox.setToolTipText(componentProfile.getDescription()); else profileBox.setToolTipText(null); Profile chosenProfile = getChosenProfile(); ProfileChoiceMessage message = new ProfileChoiceMessage(chosenProfile); for (Observer<ProfileChoiceMessage> o : getObservers()) try { o.notify(this, message); } catch (Exception e) { logger.error("failure when notifying about profile choice", e); } }
@Override public List<PortProfile> getInputPortProfiles() { List<PortProfile> portProfiles = new ArrayList<PortProfile>(); try { for (Port port : getProfileDocument().getComponent().getInputPort()) portProfiles.add(new PortProfile(this, port)); } catch (RegistryException e) { } if (!isBase()) portProfiles.addAll(baseProfile.getInputPortProfiles()); return portProfiles; }
public SemanticAnnotationContextualView(Annotated<?> selection) { super(true); super.setAnnotated(selection); componentProfile = getComponentProfile(); try { if (componentProfile == null) super.setSemanticAnnotationProfiles(new ArrayList<SemanticAnnotationProfile>()); else if (selection instanceof Dataflow) super.setSemanticAnnotationProfiles(componentProfile .getSemanticAnnotationProfiles()); else if (selection instanceof DataflowInputPort) super.setSemanticAnnotationProfiles(componentProfile .getInputSemanticAnnotationProfiles()); else if (selection instanceof DataflowOutputPort) super.setSemanticAnnotationProfiles(componentProfile .getOutputSemanticAnnotationProfiles()); else if (selection instanceof Processor) super.setSemanticAnnotationProfiles(componentProfile .getActivitySemanticAnnotationProfiles()); else super.setSemanticAnnotationProfiles(new ArrayList<SemanticAnnotationProfile>()); } catch (RegistryException e) { logger.error("failed to look up semantic annotations", e); } super.initialise(); }
private Element addComponentProfileInternal(Profile componentProfile, License license, SharingPolicy sharingPolicy) throws RegistryException { if (componentProfile == null) throw new RegistryException(("Component profile must not be null")); Element profileElement = null; if (componentProfile instanceof MyExperimentComponentProfile) { MyExperimentComponentProfile myExperimentComponentProfile = (MyExperimentComponentProfile) componentProfile; if (myExperimentComponentProfile.getComponentRegistry() .equals(this)) profileElement = getResource(myExperimentComponentProfile .getUri()); } MyExperimentSharingPolicy permissions = (MyExperimentSharingPolicy) sharingPolicy; if (permissions == null) permissions = MyExperimentComponentRegistry.PRIVATE; if (profileElement == null) { profileElement = uploadFile(componentProfile.getName(), componentProfile.getDescription(), "XML", componentProfile.getXML(), license, permissions.getPolicyString()); tagResource("component profile", profileElement.getAttributeValue("resource")); } return profileElement; }
@Override public List<SemanticAnnotationProfile> getOutputSemanticAnnotationProfiles() throws RegistryException { List<SemanticAnnotationProfile> saProfiles = new ArrayList<SemanticAnnotationProfile>(); List<PortProfile> portProfiles = getOutputPortProfiles(); portProfiles.addAll(parent().getOutputPortProfiles()); for (PortProfile portProfile : portProfiles) saProfiles.addAll(portProfile.getSemanticAnnotations()); if (!isBase()) saProfiles .addAll(baseProfile.getOutputSemanticAnnotationProfiles()); return getUniqueSemanticAnnotationProfiles(saProfiles); }
@Override public List<SemanticAnnotationProfile> getSemanticAnnotationProfiles() throws RegistryException { List<SemanticAnnotationProfile> saProfiles = getComponentProfiles(); saProfiles.addAll(parent().getSemanticAnnotationProfiles()); if (!isBase()) saProfiles.addAll(baseProfile.getSemanticAnnotationProfiles()); return saProfiles; }
@Override protected String doInBackground() throws Exception { if (registry == null) return null; List<Profile> componentProfiles; try { componentProfiles = registry.getComponentProfiles(); } catch (RegistryException e) { logger.error("failed to get profiles", e); throw e; } catch (NullPointerException e) { logger.error("failed to get profiles", e); throw e; } for (Profile profile : componentProfiles) try { profileMap.put(profile.getName(), profile); } catch (NullPointerException e) { logger.error("failure getting profile name", e); } return null; }
@Override public Profile internalAddComponentProfile(Profile componentProfile, License license, SharingPolicy sharingPolicy) throws RegistryException { String name = componentProfile.getName().replaceAll("\\W+", "") + ".xml"; String inputString = componentProfile.getXML(); File outputFile = new File(getComponentProfilesDir(), name); try { writeStringToFile(outputFile, inputString); } catch (IOException e) { throw new RegistryException("Unable to save profile", e); } try { Profile newProfile = new ComponentProfile(this, outputFile.toURI()); return newProfile; } catch (MalformedURLException e) { throw new RegistryException("Unable to create profile", e); } }