@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 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; }
if (p.getName().equals(sourceProfile.getName())) { showMessageDialog(null, "Target registry already contains a profile named " + sourceProfile.getName(), "Copy Problem", ERROR_MESSAGE); return; if (sourceId == null) { showMessageDialog(null, "Source profile \"" + sourceProfile.getName() + "\" has no id ", "Copy Problem", ERROR_MESSAGE);
@Override public Family internalCreateComponentFamily(String name, Profile componentProfile, String description, License license, SharingPolicy sharingPolicy) throws RegistryException { File newFamilyDir = new File(getComponentFamiliesDir(), name); newFamilyDir.mkdirs(); File profileFile = new File(newFamilyDir, "profile"); try { writeStringToFile(profileFile, componentProfile.getName(), ENC); } catch (IOException e) { throw new RegistryException("Could not write out profile", e); } File descriptionFile = new File(newFamilyDir, "description"); try { writeStringToFile(descriptionFile, description, ENC); } catch (IOException e) { throw new RegistryException("Could not write out description", e); } return new LocalComponentFamily(this, newFamilyDir); }
@Override public Family internalCreateComponentFamily(String name, Profile componentProfile, String description, License license, SharingPolicy sharingPolicy) throws RegistryException { File newFamilyDir = new File(getComponentFamiliesDir(), name); newFamilyDir.mkdirs(); File profileFile = new File(newFamilyDir, "profile"); try { writeStringToFile(profileFile, componentProfile.getName(), ENC); } catch (IOException e) { throw new RegistryException("Could not write out profile", e); } File descriptionFile = new File(newFamilyDir, "description"); try { writeStringToFile(descriptionFile, description, ENC); } catch (IOException e) { throw new RegistryException("Could not write out description", e); } return new LocalComponentFamily(this, newFamilyDir); }
@Override protected final Profile internalGetComponentProfile() throws RegistryException { Profile result = null; LocalComponentRegistry parentRegistry = (LocalComponentRegistry) this .getComponentRegistry(); File profileFile = new File(componentFamilyDir, PROFILE); String profileName; try { profileName = readFileToString(profileFile, ENC); } catch (IOException e) { throw new RegistryException("Unable to read profile name", e); } for (Profile p : parentRegistry.getComponentProfiles()) if (p.getName().equals(profileName)) { result = p; break; } return result; }
@Override protected final Profile internalGetComponentProfile() throws RegistryException { Profile result = null; LocalComponentRegistry parentRegistry = (LocalComponentRegistry) this .getComponentRegistry(); File profileFile = new File(componentFamilyDir, PROFILE); String profileName; try { profileName = readFileToString(profileFile, ENC); } catch (IOException e) { throw new RegistryException("Unable to read profile name", e); } for (Profile p : parentRegistry.getComponentProfiles()) if (p.getName().equals(profileName)) { result = p; break; } return result; }
@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 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); } }
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; }
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 protected Profile internalAddComponentProfile(Profile componentProfile, License license, SharingPolicy sharingPolicy) throws RegistryException { if (componentProfile == null) throw new RegistryException(("Component profile must not be null")); try { if (componentProfile instanceof NewComponentProfile) { NewComponentProfile profile = (NewComponentProfile) componentProfile; if (profile.getComponentRegistry().equals(this)) return new NewComponentProfile(this, getComponentProfileById(profile.getId(), NewComponentProfile.ELEMENTS)); } } catch (RegistryException e) { // Do nothing but fall through } return new NewComponentProfile(this, getClient().post( ComponentProfileType.class, objectFactory.createFile(makeComponentProfileCreateRequest( componentProfile.getName(), componentProfile.getDescription(), componentProfile.getXML(), license, sharingPolicy)), COMPONENT_PROFILE_SERVICE, "elements=" + NewComponentProfile.ELEMENTS)); }
@Override protected Profile internalAddComponentProfile(Profile componentProfile, License license, SharingPolicy sharingPolicy) throws RegistryException { if (componentProfile == null) throw new RegistryException(("Component profile must not be null")); try { if (componentProfile instanceof NewComponentProfile) { NewComponentProfile profile = (NewComponentProfile) componentProfile; if (profile.getComponentRegistry().equals(this)) return new NewComponentProfile(this, getComponentProfileById(profile.getId(), NewComponentProfile.ELEMENTS)); } } catch (RegistryException e) { // Do nothing but fall through } checkClientCreated(); return new NewComponentProfile(this, client.post( ComponentProfileType.class, objectFactory .createFile(makeComponentProfileCreateRequest( componentProfile.getName(), componentProfile.getDescription(), componentProfile.getXML(), license, sharingPolicy)), COMPONENT_PROFILE_SERVICE, "elements=" + NewComponentProfile.ELEMENTS)); }