Example usage for java.lang Package getImplementationVersion

List of usage examples for java.lang Package getImplementationVersion

Introduction

In this page you can find the example usage for java.lang Package getImplementationVersion.

Prototype

public String getImplementationVersion() 

Source Link

Document

Return the version of this implementation.

Usage

From source file:com.tactfactory.harmony.Harmony.java

private static String getVersion() {
    Package objPackage = Harmony.class.getPackage();
    String version = objPackage.getImplementationVersion();

    if (Strings.isNullOrEmpty(version)) {
        version = "DEVELOPPMENT";
    }//from  ww w .ja va  2  s.com

    return version;
}

From source file:mitm.application.djigzo.DjigzoConfigurator.java

private static void logAllPackages() {
    List<Package> packages = Arrays.asList(Package.getPackages());

    Comparator<Package> packageComparator = new Comparator<Package>() {
        @Override//from   w w w.ja v a  2 s.  c  om
        public int compare(Package package1, Package package2) {
            return package1.getName().compareTo(package2.getName());
        }
    };

    Collections.sort(packages, packageComparator);

    StrBuilder sb = new StrBuilder(1024);

    sb.appendNewLine();

    for (Package pack : packages) {
        sb.append("Package: ").append(pack.getName()).appendSeparator("; ");
        sb.append("Title: ").append(pack.getImplementationTitle()).appendSeparator("; ");
        sb.append("Version: ").append(pack.getImplementationVersion());
        sb.appendNewLine();
    }

    logger.info(sb.toString());
}

From source file:org.psystems.dicom.daemon.Dcm2Jpg.java

private static CommandLine parse(String[] args) {
    Options opts = new Options();
    OptionBuilder.withArgName("frame");
    OptionBuilder.hasArg();/*from  w  ww  .j  a  va2s.c  o m*/
    OptionBuilder.withDescription("frame to convert, 1 (= first frame) by default");
    opts.addOption(OptionBuilder.create("f"));
    OptionBuilder.withArgName("prfile");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("file path of presentation state to apply");
    opts.addOption(OptionBuilder.create("p"));
    OptionBuilder.withArgName("center");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Window Center");
    opts.addOption(OptionBuilder.create("c"));
    OptionBuilder.withArgName("width");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Window Width");
    opts.addOption(OptionBuilder.create("w"));
    opts.addOption("sigmoid", false, "apply sigmoid VOI LUT function with given Window Center/Width");
    opts.addOption("noauto", false, "disable auto-windowing for images w/o VOI attributes");
    OptionBuilder.withArgName("file");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("file path of P-Value to gray value map");
    opts.addOption(OptionBuilder.create("pv2gray"));
    OptionBuilder.withArgName(".xxx");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "jpeg file extension used with destination directory argument," + " default: '.jpg'.");
    opts.addOption(OptionBuilder.create("jpgext"));
    opts.addOption("h", "help", false, "print this message");
    opts.addOption("V", "version", false, "print the version information and exit");
    CommandLine cl = null;
    try {
        cl = new GnuParser().parse(opts, args);
    } catch (ParseException e) {
        exit("dcm2jpg: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption('V')) {
        Package p = Dcm2Jpg.class.getPackage();
        System.out.println("dcm2jpg v" + p.getImplementationVersion());
        System.exit(0);
    }
    if (cl.hasOption('h') || cl.getArgList().size() < 2) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE);
        System.exit(0);
    }
    return cl;
}

From source file:org.jodconverter.cli.Convert.java

private static void checkPrintInfoAndExit(final CommandLine commandLine) {

    if (commandLine.hasOption(OPT_HELP.getOpt())) {
        printHelp();/* ww w . j ava2s  .com*/
        System.exit(0);
    }

    if (commandLine.hasOption(OPT_VERSION.getOpt())) {
        final Package pack = Convert.class.getPackage();
        printInfo("jodconverter-cli version %s", pack.getImplementationVersion());
        System.exit(0);
    }
}

From source file:org.apache.solr.handler.admin.SystemInfoHandler.java

private static SimpleOrderedMap<Object> getLuceneInfo() throws Exception {
    SimpleOrderedMap<Object> info = new SimpleOrderedMap<Object>();

    String solrImplVersion = "";
    String solrSpecVersion = "";
    String luceneImplVersion = "";
    String luceneSpecVersion = "";

    // ---/*www. jav  a2s .c o m*/
    Package p = SolrCore.class.getPackage();
    StringWriter tmp = new StringWriter();
    solrImplVersion = p.getImplementationVersion();
    if (null != solrImplVersion) {
        XML.escapeCharData(solrImplVersion, tmp);
        solrImplVersion = tmp.toString();
    }
    tmp = new StringWriter();
    solrSpecVersion = p.getSpecificationVersion();
    if (null != solrSpecVersion) {
        XML.escapeCharData(solrSpecVersion, tmp);
        solrSpecVersion = tmp.toString();
    }

    p = LucenePackage.class.getPackage();
    tmp = new StringWriter();
    luceneImplVersion = p.getImplementationVersion();
    if (null != luceneImplVersion) {
        XML.escapeCharData(luceneImplVersion, tmp);
        luceneImplVersion = tmp.toString();
    }
    tmp = new StringWriter();
    luceneSpecVersion = p.getSpecificationVersion();
    if (null != luceneSpecVersion) {
        XML.escapeCharData(luceneSpecVersion, tmp);
        luceneSpecVersion = tmp.toString();
    }

    // Add it to the list
    info.add("solr-spec-version", solrSpecVersion);
    info.add("solr-impl-version", solrImplVersion);
    info.add("lucene-spec-version", luceneSpecVersion);
    info.add("lucene-impl-version", luceneImplVersion);
    return info;
}

From source file:org.dcm4che3.tool.jpg2dcm.Jpg2Dcm.java

private static CommandLine parse(String[] args) {
    Options opts = new Options();

    OptionBuilder.withArgName("code");
    OptionBuilder.hasArg();/*from w w  w .jav a 2 s  .co  m*/
    OptionBuilder.withDescription(OPT_CHARSET_DESC);
    OptionBuilder.withLongOpt(LONG_OPT_CHARSET);
    opts.addOption(OptionBuilder.create());

    OptionBuilder.withArgName("file");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(OPT_AUGMENT_CONFIG_DESC);
    opts.addOption(OptionBuilder.create("c"));

    OptionBuilder.withArgName("file");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(OPT_REPLACE_CONFIG_DESC);
    opts.addOption(OptionBuilder.create("C"));

    OptionBuilder.withArgName("prefix");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(OPT_UID_PREFIX_DESC);
    OptionBuilder.withLongOpt(LONG_OPT_UID_PREFIX);
    opts.addOption(OptionBuilder.create());

    OptionBuilder.withArgName("uid");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(OPT_TRANSFER_SYNTAX_DESC);
    OptionBuilder.withLongOpt(LONG_OPT_TRANSFER_SYNTAX);
    opts.addOption(OptionBuilder.create());

    opts.addOption(null, LONG_OPT_MPEG, false, OPT_MPEG_DESC);

    opts.addOption(null, LONG_OPT_NO_APPN, false, OPT_NO_APPN_DESC);

    opts.addOption("h", "help", false, OPT_HELP_DESC);
    opts.addOption("V", "version", false, OPT_VERSION_DESC);

    CommandLine cl = null;
    try {
        cl = new PosixParser().parse(opts, args);
    } catch (ParseException e) {
        exit("jpg2dcm: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption('V')) {
        Package p = Jpg2Dcm.class.getPackage();
        LOG.info("jpg2dcm v" + p.getImplementationVersion());
        System.exit(0);
    }
    if (cl.hasOption('h') || cl.getArgList().size() != 2) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE);
        System.exit(0);
    }

    return cl;
}

From source file:org.dcm4che2.tool.jpg2dcm.Jpg2Dcm.java

private static CommandLine parse(String[] args) {
    Options opts = new Options();

    OptionBuilder.withArgName("code");
    OptionBuilder.hasArg();/*  w ww .  ja  va2 s. c om*/
    OptionBuilder.withDescription(OPT_CHARSET_DESC);
    OptionBuilder.withLongOpt(LONG_OPT_CHARSET);
    opts.addOption(OptionBuilder.create());

    OptionBuilder.withArgName("file");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(OPT_AUGMENT_CONFIG_DESC);
    opts.addOption(OptionBuilder.create("c"));

    OptionBuilder.withArgName("file");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(OPT_REPLACE_CONFIG_DESC);
    opts.addOption(OptionBuilder.create("C"));

    OptionBuilder.withArgName("prefix");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(OPT_UID_PREFIX_DESC);
    OptionBuilder.withLongOpt(LONG_OPT_UID_PREFIX);
    opts.addOption(OptionBuilder.create());

    OptionBuilder.withArgName("uid");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(OPT_TRANSFER_SYNTAX_DESC);
    OptionBuilder.withLongOpt(LONG_OPT_TRANSFER_SYNTAX);
    opts.addOption(OptionBuilder.create());

    opts.addOption(null, LONG_OPT_MPEG, false, OPT_MPEG_DESC);

    opts.addOption(null, LONG_OPT_NO_APPN, false, OPT_NO_APPN_DESC);

    opts.addOption("h", "help", false, OPT_HELP_DESC);
    opts.addOption("V", "version", false, OPT_VERSION_DESC);

    CommandLine cl = null;
    try {
        cl = new PosixParser().parse(opts, args);
    } catch (ParseException e) {
        exit("jpg2dcm: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption('V')) {
        Package p = Jpg2Dcm.class.getPackage();
        System.out.println("jpg2dcm v" + p.getImplementationVersion());
        System.exit(0);
    }
    if (cl.hasOption('h') || cl.getArgList().size() != 2) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE);
        System.exit(0);
    }

    return cl;
}

From source file:org.psystems.dicomweb.Dcm2DcmCopy.java

private static CommandLine parse(String[] args) {
    Options opts = new Options();

    opts.addOption(null, "no-fmi", false, "Encode result without File Meta Information. At default, "
            + " File Meta Information is included.");
    opts.addOption("e", "explicit", false, "Encode result with Explicit VR Little Endian Transfer Syntax. "
            + "At default, Implicit VR Little Endian is used.");
    opts.addOption("b", "big-endian", false, "Encode result with Explicit VR Big Endian Transfer Syntax. "
            + "At default, Implicit VR Little Endian is used.");
    opts.addOption("z", "deflated", false, "Encode result with Deflated Explicit VR Little Endian Syntax. "
            + "At default, Implicit VR Little Endian is used.");

    OptionBuilder.withArgName("[seq/]attr=value");
    OptionBuilder.hasArgs(2);//from www .j av a 2s .c  o  m
    OptionBuilder.withValueSeparator('=');
    OptionBuilder.withDescription(
            "specify value to set in the output stream.  Currently only works when transcoding images.");
    opts.addOption(OptionBuilder.create("s"));

    opts.addOption("t", "syntax", true,
            "Encode result with the specified transfer syntax - recodes" + " the image typically.");

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("transcoder buffer size in KB, 1KB by default");
    OptionBuilder.withLongOpt("buffer");
    opts.addOption(OptionBuilder.create(null));

    opts.addOption("h", "help", false, "print this message");
    opts.addOption("V", "version", false, "print the version information and exit");
    CommandLine cl = null;
    try {
        cl = new PosixParser().parse(opts, args);
    } catch (ParseException e) {
        exit("dcm2dcm: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption('V')) {
        Package p = Dcm2DcmCopy.class.getPackage();
        System.out.println("dcm2dcm v" + p.getImplementationVersion());
        System.exit(0);
    }
    if (cl.hasOption('h') || cl.getArgList().size() < 2) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE);
        System.exit(0);
    }
    return cl;
}

From source file:org.psystems.dicomweb.Dcm2DcmOld.java

private static CommandLine parse(String[] args) {
    Options opts = new Options();

    opts.addOption(null, "no-fmi", false, "Encode result without File Meta Information. At default, "
            + " File Meta Information is included.");
    opts.addOption("e", "explicit", false, "Encode result with Explicit VR Little Endian Transfer Syntax. "
            + "At default, Implicit VR Little Endian is used.");
    opts.addOption("b", "big-endian", false, "Encode result with Explicit VR Big Endian Transfer Syntax. "
            + "At default, Implicit VR Little Endian is used.");
    opts.addOption("z", "deflated", false, "Encode result with Deflated Explicit VR Little Endian Syntax. "
            + "At default, Implicit VR Little Endian is used.");

    OptionBuilder.withArgName("[seq/]attr=value");
    OptionBuilder.hasArgs(2);/*from ww w.java  2  s  . c  o m*/
    OptionBuilder.withValueSeparator('=');
    OptionBuilder.withDescription(
            "specify value to set in the output stream.  Currently only works when transcoding images.");
    opts.addOption(OptionBuilder.create("s"));

    opts.addOption("t", "syntax", true,
            "Encode result with the specified transfer syntax - recodes" + " the image typically.");

    OptionBuilder.withArgName("KB");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("transcoder buffer size in KB, 1KB by default");
    OptionBuilder.withLongOpt("buffer");
    opts.addOption(OptionBuilder.create(null));

    opts.addOption("h", "help", false, "print this message");
    opts.addOption("V", "version", false, "print the version information and exit");
    CommandLine cl = null;
    try {
        cl = new PosixParser().parse(opts, args);
    } catch (ParseException e) {
        exit("dcm2dcm: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption('V')) {
        Package p = Dcm2DcmOld.class.getPackage();
        System.out.println("dcm2dcm v" + p.getImplementationVersion());
        System.exit(0);
    }
    if (cl.hasOption('h') || cl.getArgList().size() < 2) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE);
        System.exit(0);
    }
    return cl;
}

From source file:org.dcm4che2.tool.chess3d.Chess3D.java

private static CommandLine parse(String[] args) {
    Options opts = new Options();

    Option oThickness = new Option("t", "thickness", true, "Slice Thickness, 1 by default");
    oThickness.setArgName("thickness");
    opts.addOption(oThickness);/*from   w w  w.  ja v a 2  s.  c  o  m*/

    Option oLocation = new Option("l", "location", true,
            "Slice Location of first image, 0.0\\0.0\\0.0 by default");
    oLocation.setArgName("location");
    opts.addOption(oLocation);

    Option ox = new Option("x", "rectWidth", true, "Width of one chess rectangle (x-coord). 100 by default");
    ox.setArgName("x");
    opts.addOption(ox);
    Option oy = new Option("y", "rectDepth", true, "Heigth of one chess rectangle (y-coord). 100 by default");
    oy.setArgName("y");
    opts.addOption(oy);

    Option oX = new Option("X", "xRect", true, "Number of chess fields in x-coord, 10 by default");
    oX.setArgName("X");
    opts.addOption(oX);
    Option oY = new Option("Y", "yRect", true, "Number of chess fields in y-coord, 10 by default");
    oY.setArgName("Y");
    opts.addOption(oY);
    Option oZ = new Option("Z", "zRect", true, "Number of chess fields in z-coord, 5 by default");
    oZ.setArgName("Z");
    opts.addOption(oZ);

    Option oW = new Option("w", "white", true, "White field value (0-255), 225 by default");
    oW.setArgName("w");
    opts.addOption(oW);
    Option oB = new Option("b", "black", true, "Black field value (0-255), 0 by default");
    oB.setArgName("b");
    opts.addOption(oB);

    Option oWin = new Option("win", "window", true,
            "Window level. Format: <center>\\<width>. 128\\256 by default");
    oWin.setArgName("win");
    opts.addOption(oWin);

    OptionBuilder.withArgName("dir");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "Destination directory, parent of xml file or current working directory by default");
    opts.addOption(OptionBuilder.create("d"));

    opts.addOption("S", "studyUID", false,
            "Create new Study Instance UID. Only effective if xmlFile is specified and studyIUID is set");

    opts.addOption("s", "seriesUID", false,
            "create new Series Instance UID. Only effective if xmlFile is specified and seriesIUID is set");

    OptionBuilder.withArgName("prefix");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Generate UIDs with given prefix, 1.2.40.0.13.1.<host-ip> by default.");
    opts.addOption(OptionBuilder.create("uid"));

    opts.addOption("h", "help", false, "print this message");
    opts.addOption("V", "version", false, "print the version information and exit");
    CommandLine cl = null;
    try {
        cl = new GnuParser().parse(opts, args);
    } catch (ParseException e) {
        exit("chess3d: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption('V')) {
        Package p = Chess3D.class.getPackage();
        System.out.println("chess3d v" + p.getImplementationVersion());
        System.exit(0);
    }
    if (cl.hasOption('h') || cl.getArgList().size() < 1) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE);
        System.exit(0);
    }

    return cl;
}