Example usage for org.apache.commons.lang3 SystemUtils JAVA_VENDOR

List of usage examples for org.apache.commons.lang3 SystemUtils JAVA_VENDOR

Introduction

In this page you can find the example usage for org.apache.commons.lang3 SystemUtils JAVA_VENDOR.

Prototype

String JAVA_VENDOR

To view the source code for org.apache.commons.lang3 SystemUtils JAVA_VENDOR.

Click Source Link

Document

The java.vendor System Property.

Usage

From source file:net.centro.rtb.monitoringcenter.infos.JvmInfo.java

public static JvmInfo create() {
    JvmInfo jvmInfo = new JvmInfo();

    jvmInfo.specVersion = SystemUtils.JAVA_SPECIFICATION_VERSION;
    jvmInfo.classVersion = SystemUtils.JAVA_CLASS_VERSION;
    jvmInfo.jreVersion = SystemUtils.JAVA_VERSION;
    jvmInfo.jreVendor = SystemUtils.JAVA_VENDOR;
    jvmInfo.vmName = SystemUtils.JAVA_VM_NAME;
    jvmInfo.vmVendor = SystemUtils.JAVA_VM_VENDOR;
    jvmInfo.vmVersion = SystemUtils.JAVA_VM_VERSION;

    RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
    jvmInfo.inputArguments = new ArrayList<>(runtimeMXBean.getInputArguments());
    jvmInfo.startedTimestamp = new Date(runtimeMXBean.getStartTime());

    jvmInfo.defaultTimeZone = TimeZone.getDefault().getID();
    jvmInfo.defaultCharset = Charset.defaultCharset().displayName();

    return jvmInfo;
}

From source file:jp.co.iidev.subartifact1.divider1.mojo.ArtifactDividerMojo.java

public void execute() throws MojoExecutionException {

    Artifact projArt = project.getArtifact();
    Map<Dependency, Artifact> artifactsForDep = Maps.newHashMap();

    projArt = project.getArtifact();/*from  w  w  w .  j a v  a 2s . c  o  m*/

    {
        List<Dependency> dep = project.getDependencies();
        Set<Artifact> arts = project.getDependencyArtifacts();

        for (Dependency dx : dep) {
            String grpid = dx.getGroupId();
            String artid = dx.getArtifactId();
            String clsf = dx.getClassifier();

            for (Artifact art : arts) {
                boolean a = StringUtils.equals(art.getArtifactId(), artid);
                boolean g = StringUtils.equals(art.getGroupId(), grpid);
                boolean c = StringUtils.equals(art.getClassifier(), clsf);

                if (a && g && c) {
                    artifactsForDep.put(dx, art);
                }
            }
        }
    }

    {
        String version = project.getVersion();
        String groupId = project.getGroupId();

        LinkedHashMap<File, Dependency> compiletimeClasspath = Maps.newLinkedHashMap();

        File rtjar = Paths.get(System.getProperty("java.home"), "lib", "rt.jar").toFile();
        Dependency rtjar_dummyDep = new Dependency();
        {
            rtjar_dummyDep.setGroupId(SystemUtils.JAVA_VENDOR.replace(" ", "."));
            rtjar_dummyDep.setVersion(SystemUtils.JAVA_RUNTIME_VERSION);
            rtjar_dummyDep.setArtifactId(SystemUtils.JAVA_RUNTIME_NAME);
        }

        File targetJar = project.getArtifact().getFile();
        Dependency targetJarDep = new Dependency();
        {
            targetJarDep.setArtifactId(project.getArtifactId());
            targetJarDep.setGroupId(project.getGroupId());
            targetJarDep.setVersion(project.getVersion());
            targetJarDep.setClassifier(projArt.getClassifier());
        }

        compiletimeClasspath.put(rtjar, rtjar_dummyDep);
        compiletimeClasspath.put(targetJar, targetJarDep);
        artifactsForDep.forEach((d, a) -> {
            compiletimeClasspath.put(a.getFile(), d);
        });

        LoggableFactory lf = new LoggableFactory() {
            @Override
            public Loggable createLoggable(Class cx) {
                return new Loggable() {
                    Logger l = LoggerFactory.getLogger(cx);

                    @Override
                    public void warn(String text) {
                        l.warn(text);
                    }

                    @Override
                    public void info(String text) {
                        l.info(text);
                    }

                    @Override
                    public void error(String text) {
                        l.error(text);
                    }

                    @Override
                    public void debug(String text) {
                        l.debug(text);
                    }
                };
            }
        };
        try {
            LinkedHashMap<SubArtifactDefinition, SubArtifactDeployment> buildPlan = new DivisionExecutor(
                    lf.createLoggable(DivisionExecutor.class)).planDivision(targetJar, rootSubArtifactId,
                            Arrays.asList(subartifacts == null ? new SubArtifact[0] : subartifacts),
                            compiletimeClasspath, not(in(ImmutableSet.of(rtjar, targetJar))),
                            defaultRootTransitivePropagations, defaultRootSourceReferencePropagations,
                            defaultSubartifactSourceReferencePropagations, globalReferencePropagations, lf);

            Set<File> usableJar = Sets.newLinkedHashSet(compiletimeClasspath.keySet());
            usableJar.remove(targetJar);
            usableJar.remove(rtjar);

            int ix = 0;
            for (SubArtifact s : subartifacts) {
                for (Dependency d : s.getExtraDependencies()) {
                    buildPlan.get(s).getJarDeps().put(new File("x_xx_xyx_duMmy" + (ix++) + ".jar"), d);
                }
            }

            new PomSetGenerator(project.getBasedir().toPath().resolve("pom.xml"), outputDirectory.toPath(),
                    templateOutputDirectory.toPath(), lf).generate(groupId, version,
                            this.subArtifactsParentArtifactId, buildPlan);
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new MojoExecutionException("division process error", e);
        }
    }

}

From source file:org.astrojournal.AJMain.java

/**
 * Main function. By default AstroJournal Main GUI is started. Arguments can
 * be passed. Please see AJMainConsole.printHelp() for options.
 * /*from ww w. j a  va2s  .c o  m*/
 * @param args
 */
public static void main(String[] args) {
    // Get some information for debugging
    log.debug("Application: " + AJMetaInfo.NAME.getInfo() + " " + AJMetaInfo.VERSION.getInfo());
    log.debug("Operating System: " + SystemUtils.OS_ARCH + " " + SystemUtils.OS_NAME + " "
            + SystemUtils.OS_VERSION);
    log.debug("Java: " + SystemUtils.JAVA_VENDOR + " " + SystemUtils.JAVA_VERSION);

    // Initialise dependency injection with Spring
    ApplicationContext context = new ClassPathXmlApplicationContext("META-INF/aj_spring_default_context.xml");
    BeanFactory factory = context;
    Configuration config = (Configuration) factory.getBean("configuration");
    ConfigurationUtils configUtils = config.getConfigurationUtils();

    try {
        if (args.length == 0) {
            Generator generator = (Generator) factory.getBean("generator");
            startAJMainGUI(generator, config);
        } else if (args[0].equals("-f") || args[0].equals("--config")) {
            log.info(configUtils.printConfiguration(config));
        } else if (args[0].equals("-c") || args[0].equals("--console")) {
            AJMainConsole.main(args);
        } else if (args[0].equals("-h") || args[0].equals("--help")) {
            log.info(AJMainConsole.printHelp());
        } else if (args[0].equals("--license")) {
            log.info(AJMetaInfo.SHORT_LICENSE.getInfo());
        } else if (args[0].equals("-t") || args[0].equals("--test-latex")) {
            log.info(configUtils.printPDFLatexVersion(config));
        } else {
            log.fatal(
                    "Unrecognised option. Please, run AstroJournal with the option -h [--help] for suggestions.");
        }
    } catch (Exception ex) {
        log.error(ex, ex);
    }
}

From source file:org.lenskit.cli.Main.java

public static void main(String[] args) {
    ArgumentParser parser = ArgumentParsers.newArgumentParser("lenskit")
            .description("Work with LensKit recommenders and data.");
    Logging.addLoggingGroup(parser);//from w ww . j  a v a 2s . c o  m

    Subparsers subparsers = parser.addSubparsers().metavar("COMMAND").title("commands");
    ServiceLoader<Command> loader = ServiceLoader.load(Command.class);
    for (Command cmd : loader) {
        Subparser cp = subparsers.addParser(cmd.getName()).help(cmd.getHelp()).setDefault("command", cmd);
        cmd.configureArguments(cp);
    }

    try {
        Namespace options = parser.parseArgs(args);
        Logging.configureLogging(options);
        Runtime rt = Runtime.getRuntime();
        logger.info("Starting LensKit {} on Java {} from {}", LenskitInfo.lenskitVersion(),
                SystemUtils.JAVA_VERSION, SystemUtils.JAVA_VENDOR);
        logger.debug("Built from Git revision {}", LenskitInfo.getHeadRevision());
        logger.debug("Using VM '{}' version {} from {}", SystemUtils.JAVA_VM_NAME, SystemUtils.JAVA_VM_VERSION,
                SystemUtils.JAVA_VM_VENDOR);
        logger.info("Have {} processors and heap limit of {} MiB", rt.availableProcessors(),
                rt.maxMemory() >> 20);
        Command cmd = options.get("command");
        cmd.execute(options);
        logger.info("If you use LensKit in published research, please see http://lenskit.org/research/");
    } catch (ArgumentParserException e) {
        parser.handleError(e);
        System.exit(1);
    } catch (Exception e) {
        logger.error("error running command: " + e, e);
        System.exit(2);
    }
}