List active = root.getActiveProfiles(); profileManager.explicitlyActivate( root.getActiveProfiles() ); for ( Iterator it = root.getProfiles().iterator(); it.hasNext(); )
/** * Method addProfile. * * @param profile */ public void addProfile( Profile profile ) { getProfiles().add( profile ); } //-- void addProfile( Profile )
/** * Method addActiveProfile. * * @param string */ public void addActiveProfile( String string ) { getActiveProfiles().add( string ); } //-- void addActiveProfile( String )
ProfilesRoot profilesRoot = new ProfilesRoot(); for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- ) profilesRoot.setProfiles( profiles ); while ( parser.nextTag() == XmlPullParser.START_TAG ) profilesRoot.setActiveProfiles( activeProfiles ); while ( parser.nextTag() == XmlPullParser.START_TAG )
public org.apache.maven.profiles.Profile getNetbeansPrivateProfile(boolean addIfNotPresent) { if (privateProfile == null) { List lst = profiles.getProfiles(); if (lst != null) { Iterator it = lst.iterator(); act.setProperty(prop); privateProfile.setActivation(act); profiles.addProfile(privateProfile); markAsModified(profiles);
/** * Method write. * * @param stream * @param profilesRoot * @throws java.io.IOException */ public void write( OutputStream stream, ProfilesRoot profilesRoot ) throws java.io.IOException { XmlSerializer serializer = new MXSerializer(); serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", " " ); serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" ); serializer.setOutput( stream, profilesRoot.getModelEncoding() ); serializer.startDocument( profilesRoot.getModelEncoding(), null ); writeProfilesRoot( profilesRoot, "profilesXml", serializer ); serializer.endDocument(); } //-- void write( OutputStream, ProfilesRoot )
/** * @deprecated use the XAM-based model for editing the profiles file, * see org.netbeans.modules.maven.profile package * * @param projectDir * @return */ public @Deprecated static ProfilesRoot createProfilesModel(FileObject projectDir) { FileObject profiles = projectDir.getFileObject("profiles.xml"); ProfilesRoot prof = null; if (profiles != null) { InputStreamReader read = null; try { read = new InputStreamReader(profiles.getInputStream()); prof = new ProfilesXpp3Reader().read(read); } catch (IOException ex) { ex.printStackTrace(); } catch (XmlPullParserException ex) { ex.printStackTrace(); } finally { IOUtil.close(read); } } if (prof == null) { prof = new ProfilesRoot(); } return prof; }
/** * Method removeProfile. * * @param profile */ public void removeProfile( Profile profile ) { getProfiles().remove( profile ); } //-- void removeProfile( Profile )
/** * Method removeActiveProfile. * * @param string */ public void removeActiveProfile( String string ) { getActiveProfiles().remove( string ); } //-- void removeActiveProfile( String )
/** * Method write. * * @param writer * @param profilesRoot * @throws java.io.IOException */ public void write( Writer writer, ProfilesRoot profilesRoot ) throws java.io.IOException { XmlSerializer serializer = new MXSerializer(); serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-indentation", " " ); serializer.setProperty( "http://xmlpull.org/v1/doc/properties.html#serializer-line-separator", "\n" ); serializer.setOutput( writer ); serializer.startDocument( profilesRoot.getModelEncoding(), null ); writeProfilesRoot( profilesRoot, "profilesXml", serializer ); serializer.endDocument(); } //-- void write( Writer, ProfilesRoot )
public static ProfilesRoot createProfilesModel(FileObject projectDir) { FileObject profiles = projectDir.getFileObject("profiles.xml"); ProfilesRoot prof = null; if (profiles != null) { InputStreamReader read = null; try { read = new InputStreamReader(profiles.getInputStream()); prof = new ProfilesXpp3Reader().read(read); } catch (IOException ex) { ex.printStackTrace(); } catch (XmlPullParserException ex) { ex.printStackTrace(); } finally { IOUtil.close(read); } } if (prof == null) { prof = new ProfilesRoot(); } return prof; }
serializer.startTag( NAMESPACE, tagName ); serializer.attribute( "", "xsi:schemaLocation", "http://maven.apache.org/PROFILES/1.0.0 http://maven.apache.org/xsd/profiles-1.0.0.xsd" ); if ( ( profilesRoot.getProfiles() != null ) && ( profilesRoot.getProfiles().size() > 0 ) ) for ( Iterator iter = profilesRoot.getProfiles().iterator(); iter.hasNext(); ) if ( ( profilesRoot.getActiveProfiles() != null ) && ( profilesRoot.getActiveProfiles().size() > 0 ) ) for ( Iterator iter = profilesRoot.getActiveProfiles().iterator(); iter.hasNext(); )
private static void extractProfiles(Set<String> profileIds, File file) { extractProfilesFromModelLineage(file, profileIds); File basedir = FileUtil.normalizeFile(file.getParentFile()); FileObject fileObject = FileUtil.toFileObject(basedir); //read from profiles.xml Iterator it2 = MavenSettingsSingleton.createProfilesModel(fileObject).getProfiles().iterator(); while (it2.hasNext()) { org.apache.maven.profiles.Profile prof = (org.apache.maven.profiles.Profile) it2.next(); profileIds.add(prof.getId()); } }
public List<String> getMergedActiveProfiles(boolean shared) { Set<String> prifileides = new HashSet<String>(); MavenProject mavenProject = nmp.getOriginalMavenProject(); List<Profile> profiles = mavenProject.getActiveProfiles(); for (Profile profile : profiles) { prifileides.add(profile.getId()); } //read from Settings.xml List<String> profileStrings = MavenSettingsSingleton.getInstance().createUserSettingsModel().getActiveProfiles(); for (String profile : profileStrings) { prifileides.add(profile); } File basedir = FileUtil.normalizeFile(mavenProject.getBasedir()); FileObject fileObject = FileUtil.toFileObject(basedir); //read from profiles.xml Iterator it2 = MavenSettingsSingleton.createProfilesModel(fileObject).getActiveProfiles().iterator(); while (it2.hasNext()) { prifileides.add((String) it2.next()); } prifileides.addAll(getActiveProfiles(shared)); return new ArrayList<String>(prifileides); }
String encoding = profilesRoot.getModelEncoding() != null ? profilesRoot.getModelEncoding() : "UTF-8"; outStr = new OutputStreamWriter(fo.getOutputStream(lock), encoding); Format form = Format.getRawFormat().setEncoding(encoding);
/** * Method updateProfilesRoot. * * @param value * @param element * @param counter * @param xmlTag */ protected void updateProfilesRoot(ProfilesRoot value, String xmlTag, Counter counter, Element element) { Element root = element; Counter innerCount = new Counter(counter.getDepth() + 1); iterateProfile(innerCount, root, value.getProfiles(),"profiles","profile"); findAndReplaceSimpleLists(innerCount, root, value.getActiveProfiles(), "activeProfiles", "activeProfile"); } //-- void updateProfilesRoot(ProfilesRoot, String, Counter, Element)
String encoding = profilesRoot.getModelEncoding() != null ? profilesRoot.getModelEncoding() : "UTF-8"; outStr = new OutputStreamWriter(fo.getOutputStream(lock), encoding); Format form = Format.getRawFormat().setEncoding(encoding);
/** * Method updateProfilesRoot * * @param value * @param element * @param counter * @param xmlTag */ protected void updateProfilesRoot(ProfilesRoot value, String xmlTag, Counter counter, Element element) { Element root = element; Counter innerCount = new Counter(counter.getDepth() + 1); iterateProfile(innerCount, root, value.getProfiles(),"profiles","profile"); findAndReplaceSimpleLists(innerCount, root, value.getActiveProfiles(), "activeProfiles", "activeProfile"); } //-- void updateProfilesRoot(ProfilesRoot, String, Counter, Element)