@Override public Profile internalAddComponentProfile(Profile componentProfile, License license, SharingPolicy sharingPolicy) throws RegistryException { Element element = addComponentProfileInternal(componentProfile, license, sharingPolicy); String fileUri = element.getAttributeValue("uri"); Profile result = new MyExperimentComponentProfile(this, fileUri, componentProfile.getXML()); return result; }
@Override public Profile internalAddComponentProfile(Profile componentProfile, License license, SharingPolicy sharingPolicy) throws RegistryException { Element element = addComponentProfileInternal(componentProfile, license, sharingPolicy); String fileUri = element.getAttributeValue("uri"); Profile result = new MyExperimentComponentProfile(this, fileUri, componentProfile.getXML()); 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)); }