• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Activation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.maven.model.Activation的典型用法代码示例。如果您正苦于以下问题:Java Activation类的具体用法?Java Activation怎么用?Java Activation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Activation类属于org.apache.maven.model包,在下文中一共展示了Activation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: writeActivation

import org.apache.maven.model.Activation; //导入依赖的package包/类
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());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:LocationAwareMavenXpp3Writer.java


示例2: visitProfileActivation

import org.apache.maven.model.Activation; //导入依赖的package包/类
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 );
    }
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:27,代码来源:DefaultModelProcessor.java


示例3: isActive

import org.apache.maven.model.Activation; //导入依赖的package包/类
public boolean isActive( Profile profile )
{
    Activation activation = profile.getActivation();
    ActivationOS os = activation.getOs();

    boolean result = ensureAtLeastOneNonNull( os );

    if ( result && os.getFamily() != null )
    {
        result = determineFamilyMatch( os.getFamily() );
    }
    if ( result && os.getName() != null )
    {
        result = determineNameMatch( os.getName() );
    }
    if ( result && os.getArch() != null )
    {
        result = determineArchMatch( os.getArch() );
    }
    if ( result && os.getVersion() != null )
    {
        result = determineVersionMatch( os.getVersion() );
    }
    return result;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:26,代码来源:OperatingSystemProfileActivator.java


示例4: addProfile

import org.apache.maven.model.Activation; //导入依赖的package包/类
public void addProfile( Profile profile )
{
    String profileId = profile.getId();

    Profile existing = (Profile) profilesById.get( profileId );
    if ( existing != null )
    {
        logger.warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource()
            + ") with new instance from source: " + profile.getSource() );
    }

    profilesById.put( profile.getId(), profile );

    Activation activation = profile.getActivation();

    if ( activation != null && activation.isActiveByDefault() )
    {
        activateAsDefault( profileId );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:21,代码来源:DefaultProfileManager.java


示例5: shouldResolveDependencyFromDefaultProfile

import org.apache.maven.model.Activation; //导入依赖的package包/类
@Test
public void shouldResolveDependencyFromDefaultProfile() {
    Model bar = pom().artifactId("bar").create(repoBarDir);
    Model foo = pom().artifactId("foo").create(repoFooDir);

    Activation fooProfileActivation = new Activation();
    fooProfileActivation.setActiveByDefault(true);

    Profile fooProfile = new Profile();
    fooProfile.setId("fooProfile");
    fooProfile.setActivation(fooProfileActivation);
    fooProfile.addDependency(dependency().to(bar).build());
    foo.addProfile(fooProfile);

    createArtifact(repoFooDir, foo);

    validationExecutor.execute(ctx);

    assertSuccess();
    assertLocalRepoContains(foo);
    assertLocalRepoContains(bar);
}
 
开发者ID:release-engineering,项目名称:redhat-repository-validator,代码行数:23,代码来源:TestDependenciesValidator.java


示例6: shouldResolveDependencyFromActiveProfile

import org.apache.maven.model.Activation; //导入依赖的package包/类
@Test
public void shouldResolveDependencyFromActiveProfile() {
    Model bar = pom().artifactId("bar").create(repoBarDir);
    Model foo = pom().artifactId("foo").create(repoFooDir);

    Activation fooProfileActivation = new Activation();
    fooProfileActivation.setJdk("!1.0");

    Profile fooProfile = new Profile();
    fooProfile.setId("fooProfile");
    fooProfile.setActivation(fooProfileActivation);
    fooProfile.addDependency(dependency().to(bar).build());
    foo.addProfile(fooProfile);

    createArtifact(repoFooDir, foo);

    validationExecutor.execute(ctx);

    assertSuccess();
    assertLocalRepoContains(foo);
    assertLocalRepoContains(bar);
}
 
开发者ID:release-engineering,项目名称:redhat-repository-validator,代码行数:23,代码来源:TestDependenciesValidator.java


示例7: shouldFindMissingDependencyFromActiveProfile

import org.apache.maven.model.Activation; //导入依赖的package包/类
@Test
public void shouldFindMissingDependencyFromActiveProfile() {
    Model bar = pom().artifactId("bar").model();
    Model foo = pom().artifactId("foo").create(repoFooDir);

    Activation fooProfileActivation = new Activation();
    fooProfileActivation.setJdk("!1.0");

    Profile fooProfile = new Profile();
    fooProfile.setId("fooProfile");
    fooProfile.setActivation(fooProfileActivation);
    fooProfile.addDependency(dependency().to(bar).build());
    foo.addProfile(fooProfile);

    createArtifact(repoFooDir, foo);

    validationExecutor.execute(ctx);

    assertExpectedException(ArtifactNotFoundException.class, "Could not find artifact com.acme:bar:jar:1.0");
}
 
开发者ID:release-engineering,项目名称:redhat-repository-validator,代码行数:21,代码来源:TestDependenciesValidator.java


示例8: activateProfilesWithProperties

import org.apache.maven.model.Activation; //导入依赖的package包/类
private List<String> activateProfilesWithProperties(MavenProject mavenProject, List<String> activeProfileIds) {
	if (mavenProject == null) return activeProfileIds;
	List<String> result = new ArrayList<String>();
	if (activeProfileIds != null) {
		result.addAll(activeProfileIds);
	}

	for (Profile profile : mavenProject.getModel().getProfiles()) {
		Activation activation = profile.getActivation();
		if (activation != null) {
			ActivationProperty property = activation.getProperty();
			if (property != null) {
				String name = property.getName();
				if (name != null) {
					String value;
					if (name.startsWith("!")) {
						value = propertiesManager.getPropertyValue(name.substring(1));
					} else {
						value = propertiesManager.getPropertyValue(name);
					}
					if (value != null) {
						if (!name.startsWith("!") && value.equals(property.getValue()) || name.startsWith("!") && !value.equals(property.getValue())) {
							result.add(profile.getId());
						}
					}
				}
			}
		}
	}

	return result;
}
 
开发者ID:fastconnect,项目名称:tibco-bwmaven,代码行数:33,代码来源:BWLifecycleParticipant.java


示例9: isBuildTimeDriven

import org.apache.maven.model.Activation; //导入依赖的package包/类
/**
 * @param activation is the {@link Activation} of a {@link Profile}.
 * @return <code>true</code> if the given {@link Activation} is build-time driven, <code>false</code> otherwise (if
 *         it is triggered by OS or JDK).
 */
protected static boolean isBuildTimeDriven( Activation activation )
{

    if ( activation == null )
    {
        return true;
    }
    if ( StringUtils.isEmpty( activation.getJdk() ) && activation.getOs() == null )
    {
        return true;
    }
    return false;
}
 
开发者ID:mojohaus,项目名称:flatten-maven-plugin,代码行数:19,代码来源:FlattenMojo.java


示例10: convertActivation

import org.apache.maven.model.Activation; //导入依赖的package包/类
private static MavenActivation convertActivation(Activation activation) {
  if (activation == null) {
    return null;
  }

  MavenActivation result = new MavenActivation();
  result.setActiveByDefault(activation.isActiveByDefault());
  result.setFile(convertFileActivation(activation.getFile()));
  result.setJdk(activation.getJdk());
  result.setOs(convertOsActivation(activation.getOs()));
  result.setProperty(convertPropertyActivation(activation.getProperty()));

  return result;
}
 
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:MavenModelUtil.java


示例11: convertToMavenActivation

import org.apache.maven.model.Activation; //导入依赖的package包/类
private static Activation convertToMavenActivation(MavenActivation activation) {
  if (activation != null) {
    Activation result = new Activation();
    result.setActiveByDefault(activation.isActiveByDefault());
    result.setFile(convertToMavenActivationFile(activation.getFile()));
    result.setJdk(activation.getJdk());
    result.setOs(convertToMavenActivationOs(activation.getOs()));
    result.setProperty(convertToMavenActivationProperty(activation.getProperty()));
    return result;
  }
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:MavenModelUtil.java


示例12: transformableWithDiscardActiveReference

import org.apache.maven.model.Activation; //导入依赖的package包/类
@SuppressWarnings({"unchecked"})
public void transformableWithDiscardActiveReference() throws IOException {

    PomTransformer pomTransformer = new PomTransformer(transformablePomAsString,
            PomCleanupPolicy.discard_active_reference);
    String transformedPom = pomTransformer.transform();

    Model pom = MavenModelUtils.stringToMavenModel(transformedPom);
    List repositoriesList = pom.getRepositories();
    List pluginsRepositoriesList = pom.getPluginRepositories();

    assertEmptyList(repositoriesList, pluginsRepositoriesList);

    List<Profile> pomProfiles = pom.getProfiles();
    for (Profile profile : pomProfiles) {
        boolean activeByDefault = false;
        Activation activation = profile.getActivation();
        if (activation != null) {
            activeByDefault = activation.isActiveByDefault();
        }
        List profileRepositories = profile.getRepositories();
        List profilePluginsRepositories = profile.getPluginRepositories();
        if (activeByDefault) {
            assertEmptyList(profileRepositories, profilePluginsRepositories);
        } else {
            assertNotEmptyList(profileRepositories, profilePluginsRepositories);
        }
    }
    assertTrue(transformablePomAsString.contains("This is a comment"));
    compareChecksums(transformablePomAsString, transformedPom, false);
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:32,代码来源:PomTransformerTest.java


示例13: addProfile

import org.apache.maven.model.Activation; //导入依赖的package包/类
/**
 * Add the profile to the list of profiles. If an existing profile has the same
 * id it is removed first.
 *
 * @param profiles Existing profiles
 * @param profile Target profile to add
 */
void addProfile( final List<Profile> profiles, final Profile profile )
{
    final Iterator<Profile> i = profiles.iterator();
    while ( i.hasNext() )
    {
        final Profile p = i.next();

        if ( profile.getId()
                    .equals( p.getId() ) )
        {
            logger.debug( "Removing local profile {} ", p );
            i.remove();
            // Don't break out of the loop so we can check for active profiles
        }

        // If we have injected profiles and one of the current profiles is using
        // activeByDefault it will get mistakingly deactivated due to the semantics
        // of activeByDefault. Therefore replace the activation.
        if (p.getActivation() != null && p.getActivation().isActiveByDefault())
        {
            logger.warn( "Profile {} is activeByDefault", p );

            final Activation replacement = new Activation();
            final ActivationProperty replacementProp = new ActivationProperty();
            replacementProp.setName( "!disableProfileActivation" );
            replacement.setProperty( replacementProp );

            p.setActivation( replacement );
        }
    }

    logger.debug( "Adding profile {}", profile );
    profiles.add( profile );
}
 
开发者ID:release-engineering,项目名称:pom-manipulation-ext,代码行数:42,代码来源:ProfileInjectionManipulator.java


示例14: isActive

import org.apache.maven.model.Activation; //导入依赖的package包/类
public boolean isActive( Profile profile )
    throws ProfileActivationException
{
    Activation activation = profile.getActivation();

    String jdk = activation.getJdk();

    // null case is covered by canDetermineActivation(), so we can do a straight startsWith() here.
    if ( jdk.startsWith( "[" ) || jdk.startsWith( "(" ) )
    {
        try
        {
            return matchJdkVersionRange( jdk );
        }
        catch ( InvalidVersionSpecificationException e )
        {
            throw new ProfileActivationException( "Invalid JDK version in profile '" + profile.getId() + "': "
                + e.getMessage() );
        }
    }

    boolean reverse = false;

    if ( jdk.startsWith( "!" ) )
    {
        reverse = true;
        jdk = jdk.substring( 1 );
    }

    if ( getJdkVersion().startsWith( jdk ) )
    {
        return !reverse;
    }
    else
    {
        return reverse;
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:39,代码来源:JdkPrefixProfileActivator.java


示例15: isActive

import org.apache.maven.model.Activation; //导入依赖的package包/类
public boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems )
{
    Activation activation = profile.getActivation();

    if ( activation == null )
    {
        return false;
    }

    String jdk = activation.getJdk();

    if ( jdk == null )
    {
        return false;
    }

    String version = context.getSystemProperties().get( "java.version" );

    if ( version == null || version.length() <= 0 )
    {
        problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE )
                .setMessage( "Failed to determine Java version for profile " + profile.getId() )
                .setLocation(activation.getLocation( "jdk" ) ) );
        return false;
    }

    if ( jdk.startsWith( "!" ) )
    {
        return !version.startsWith( jdk.substring( 1 ) );
    }
    else if ( isRange( jdk ) )
    {
        return isInRange( version, getRange( jdk ) );
    }
    else
    {
        return version.startsWith( jdk );
    }
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:40,代码来源:JdkVersionProfileActivator.java


示例16: isActive

import org.apache.maven.model.Activation; //导入依赖的package包/类
public boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems )
{
    Activation activation = profile.getActivation();

    if ( activation == null )
    {
        return false;
    }

    ActivationOS os = activation.getOs();

    if ( os == null )
    {
        return false;
    }

    boolean active = ensureAtLeastOneNonNull( os );

    if ( active && os.getFamily() != null )
    {
        active = determineFamilyMatch( os.getFamily() );
    }
    if ( active && os.getName() != null )
    {
        active = determineNameMatch( os.getName() );
    }
    if ( active && os.getArch() != null )
    {
        active = determineArchMatch( os.getArch() );
    }
    if ( active && os.getVersion() != null )
    {
        active = determineVersionMatch( os.getVersion() );
    }

    return active;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:38,代码来源:OperatingSystemProfileActivator.java


示例17: newProfile

import org.apache.maven.model.Activation; //导入依赖的package包/类
private Profile newProfile( String jdkVersion )
{
    Activation a = new Activation();
    a.setJdk( jdkVersion );

    Profile p = new Profile();
    p.setActivation( a );

    return p;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:11,代码来源:JdkVersionProfileActivatorTest.java


示例18: testNullSafe

import org.apache.maven.model.Activation; //导入依赖的package包/类
public void testNullSafe()
    throws Exception
{
    Profile p = new Profile();

    assertActivation( false, p, newContext( null, null ) );

    p.setActivation( new Activation() );

    assertActivation( false, p, newContext( null, null ) );
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:12,代码来源:JdkVersionProfileActivatorTest.java


示例19: newProfile

import org.apache.maven.model.Activation; //导入依赖的package包/类
private Profile newProfile( String key, String value )
{
    ActivationProperty ap = new ActivationProperty();
    ap.setName( key );
    ap.setValue( value );

    Activation a = new Activation();
    a.setProperty( ap );

    Profile p = new Profile();
    p.setActivation( a );

    return p;
}
 
开发者ID:gems-uff,项目名称:oceano,代码行数:15,代码来源:PropertyProfileActivatorTest.java


示例20: replaceProfileActivation

import org.apache.maven.model.Activation; //导入依赖的package包/类
@Override
public Activation replaceProfileActivation( Activation activation )
{
    return activation;
}
 
开发者ID:fedora-java,项目名称:xmvn,代码行数:6,代码来源:AbstractModelVisitor.java



注:本文中的org.apache.maven.model.Activation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EvaluationException类代码示例发布时间:2022-05-21
下一篇:
Java MqttMessage类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap