private void writeActivation(Activation activation, String tagName, XmlSerializer serializer) throws java.io.IOException { serializer.startTag(NAMESPACE, tagName); flush(serializer); StringBuffer b = b(serializer); int start = b.length(); if (activation.isActiveByDefault() != false) { writeValue(serializer, "activeByDefault", String.valueOf(activation.isActiveByDefault()), activation); } if (activation.getJdk() != null) { writeValue(serializer, "jdk", activation.getJdk(), activation); } if (activation.getOs() != null) { writeActivationOS((ActivationOS) activation.getOs(), "os", serializer); } if (activation.getProperty() != null) { writeActivationProperty((ActivationProperty) activation.getProperty(), "property", serializer); } if (activation.getFile() != null) { writeActivationFile((ActivationFile) activation.getFile(), "file", serializer); } serializer.endTag(NAMESPACE, tagName).flush(); logLocation(activation, "", start, b.length()); }
private void visitProfileActivation( ModelVisitor visitor, Activation activation ) { ActivationOS os = activation.getOs(); if ( os != null ) { visitor.visitProfileActivationO( os ); os = visitor.replaceProfileActivationO( os ); activation.setOs( os ); } ActivationProperty property = activation.getProperty(); if ( property != null ) { visitor.visitProfileActivationProperty( property ); property = visitor.replaceProfileActivationProperty( property ); activation.setProperty( property ); } ActivationFile file = activation.getFile(); if ( file != null ) { visitor.visitProfileActivationFile( file ); file = visitor.replaceProfileActivationFile( file ); activation.setFile( file ); } }
private void writeActivationFile(ActivationFile activationFile, String tagName, XmlSerializer serializer) throws java.io.IOException { serializer.startTag(NAMESPACE, tagName); flush(serializer); StringBuffer b = b(serializer); int start = b.length(); if (activationFile.getMissing() != null) { writeValue(serializer, "missing", activationFile.getMissing(), activationFile); } if (activationFile.getExists() != null) { writeValue(serializer, "exists", activationFile.getExists(), activationFile); } serializer.endTag(NAMESPACE, tagName).flush(); logLocation(activationFile, "", start, b.length()); }
/** * Method updateActivationFile * * @param value * @param element * @param counter * @param xmlTag */ protected void updateActivationFile( ActivationFile value, String xmlTag, Counter counter, Element element ) { boolean shouldExist = value != null; Element root = updateElement( counter, element, xmlTag, shouldExist ); if ( shouldExist ) { Counter innerCount = new Counter( counter.getDepth() + 1 ); findAndReplaceSimpleElement( innerCount, root, "missing", value.getMissing(), null ); findAndReplaceSimpleElement( innerCount, root, "exists", value.getExists(), null ); } }
private org.apache.maven.model.Activation createModelActivation( Activation activation) { org.apache.maven.model.Activation modelActivation = new org.apache.maven.model.Activation(); modelActivation.setActiveByDefault(activation.isActiveByDefault()); if (activation.getFile() != null) { ActivationFile activationFile = new ActivationFile(); activationFile.setExists(activation.getFile().getExists()); activationFile.setMissing(activation.getFile().getMissing()); modelActivation.setFile(activationFile); } modelActivation.setJdk(activation.getJdk()); if (activation.getOs() != null) { ActivationOS os = new ActivationOS(); os.setArch(activation.getOs().getArch()); os.setFamily(activation.getOs().getFamily()); os.setName(activation.getOs().getName()); os.setVersion(activation.getOs().getVersion()); modelActivation.setOs(os); } if (activation.getProperty() != null) { ActivationProperty property = new ActivationProperty(); property.setName(activation.getProperty().getName()); property.setValue(activation.getProperty().getValue()); modelActivation.setProperty(property); } return modelActivation; }
private static ActivationFile convertToMavenActivationFile(MavenActivationFile file) { if (file != null) { ActivationFile result = new ActivationFile(); result.setExists(file.getExist()); result.setMissing(file.getMissing()); return result; } return null; }
@Override public ActivationFile replaceProfileActivationFile( ActivationFile file ) { return file; }
@Override public void visitProfileActivationFile( ActivationFile file ) { }
private static MavenActivationFile convertFileActivation(ActivationFile file) { if (file == null) { return null; } return new MavenActivationFile(file.getExists(), file.getMissing()); }
/** * @param settingsProfile * @return a profile */ public static Profile convertToSettingsProfile( org.apache.maven.model.Profile modelProfile ) { Profile profile = new Profile(); profile.setId( modelProfile.getId() ); org.apache.maven.model.Activation modelActivation = modelProfile.getActivation(); if ( modelActivation != null ) { Activation activation = new Activation(); activation.setActiveByDefault( modelActivation.isActiveByDefault() ); activation.setJdk( modelActivation.getJdk() ); org.apache.maven.model.ActivationProperty modelProp = modelActivation.getProperty(); if ( modelProp != null ) { ActivationProperty prop = new ActivationProperty(); prop.setName( modelProp.getName() ); prop.setValue( modelProp.getValue() ); activation.setProperty( prop ); } org.apache.maven.model.ActivationOS modelOs = modelActivation.getOs(); if ( modelOs != null ) { ActivationOS os = new ActivationOS(); os.setArch( modelOs.getArch() ); os.setFamily( modelOs.getFamily() ); os.setName( modelOs.getName() ); os.setVersion( modelOs.getVersion() ); activation.setOs( os ); } ActivationFile modelFile = modelActivation.getFile(); if ( modelFile != null ) { org.apache.maven.settings.ActivationFile file = new org.apache.maven.settings.ActivationFile(); file.setExists( modelFile.getExists() ); file.setMissing( modelFile.getMissing() ); activation.setFile( file ); } profile.setActivation( activation ); } profile.setProperties( modelProfile.getProperties() ); List<org.apache.maven.model.Repository> repos = modelProfile.getRepositories(); if ( repos != null ) { for ( org.apache.maven.model.Repository repo : repos ) { profile.addRepository( convertToSettingsRepository( repo ) ); } } List<org.apache.maven.model.Repository> pluginRepos = modelProfile.getPluginRepositories(); if ( pluginRepos != null ) { for ( org.apache.maven.model.Repository pluginRepo : pluginRepos ) { profile.addPluginRepository( convertToSettingsRepository( pluginRepo ) ); } } return profile; }
ActivationFile replaceProfileActivationFile( ActivationFile file );
void visitProfileActivationFile( ActivationFile file );