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:monasca.log.api.MonApiApplication.java

private static void showVersion() {
    Package pkg;
    pkg = Package.getPackage("monasca.log.api");

    System.out.println("-------- Version Information --------");
    System.out.println(pkg.getImplementationVersion());
}

From source file:com.callidusrobotics.irc.NaNoBot.java

public static String getImplementationVersion() {
    final Package myPackage = NaNoBot.class.getPackage();
    final String implementationVersion = myPackage.getImplementationVersion();

    if (implementationVersion == null || StringUtils.isBlank(implementationVersion)) {
        return "DEBUG";
    }//  w w w.j av  a2 s.  c  o m

    return implementationVersion;
}

From source file:org.dcm4chee.xds2.pix.tool.PixQueryCmd.java

private static CommandLine parseComandLine(String[] args) throws ParseException {
    Options opts = new Options();
    opts.addOption("h", "help", false, rb.getString("help"));
    opts.addOption("V", "version", false, rb.getString("version"));
    CommandLineParser parser = new PosixParser();
    CommandLine cl = parser.parse(opts, args);
    if (cl.hasOption("h")) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(rb.getString("usage"), rb.getString("description"), opts, rb.getString("example"));
        System.exit(0);/* ww w.  j  a  va2s. c  o  m*/
    }
    if (cl.hasOption("V")) {
        Package p = PixQueryCmd.class.getPackage();
        String s = p.getName();
        System.out.println(s.substring(s.lastIndexOf('.') + 1) + ": " + p.getImplementationVersion());
        System.exit(0);
    }
    return cl;
}

From source file:org.dcm4che2.tool.xml2dcm.Xml2Dcm.java

private static CommandLine parse(String[] args) {
    Options opts = new Options();
    Option ifile = new Option("i", true,
            "Update attributes in specified DICOM file instead " + "generating new one.");
    ifile.setArgName("dcmfile");
    opts.addOption(ifile);/*w  w  w .  j av a2 s  .c  om*/
    Option xmlfile = new Option("x", true, "XML input, used to update or generate new DICOM file."
            + "Without <xmlfile>, read from standard input.");
    xmlfile.setOptionalArg(true);
    xmlfile.setArgName("xmlfile");
    opts.addOption(xmlfile);
    Option basedir = new Option("d", true,
            "Directory to resolve external attribute values referenced by " + "XML read from standard input.");
    basedir.setArgName("basedir");
    opts.addOption(basedir);
    Option ofile = new Option("o", true, "Generated DICOM file or ACR/NEMA-2 dump");
    ofile.setArgName("dcmfile");
    opts.addOption(ofile);
    Option tsuid = new Option("t", true, "Store result with specified Transfer Syntax.");
    tsuid.setArgName("tsuid");
    opts.addOption(tsuid);
    opts.addOption("a", "acrnema2", false,
            "Store result as ACR/NEMA 2 dump. Mutual exclusive " + "with option -d");
    opts.addOption("d", "dicom", false,
            "Store result as DICOM Part 10 File. Mutual exclusive " + "with option -a");
    opts.addOption("g", "grlen", false, "Include (gggg,0000) Group Length attributes."
            + "By default, optional Group Length attributes are excluded.");
    opts.addOption("E", "explseqlen", false, "Encode sequences with explicit length. At default, non-empty "
            + "sequences are encoded with undefined length.");
    opts.addOption("e", "explitemlen", false, "Encode sequence items with explicit length. At default, "
            + "non-empty sequence items are encoded with undefined length.");
    opts.addOption("U", "undefseqlen", false,
            "Encode all sequences with undefined length. Mutual exclusive " + "with option -E.");
    opts.addOption("u", "undefitemlen", false,
            "Encode all sequence items with undefined length. Mutual " + "exclusive with option -e.");
    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("dcm2xml: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption('V')) {
        Package p = Xml2Dcm.class.getPackage();
        System.out.println("dcm2xml v" + p.getImplementationVersion());
        System.exit(0);
    }
    if (cl.hasOption('h') || !cl.hasOption("o") || (!cl.hasOption("x") && !cl.hasOption("i"))) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE);
        System.exit(0);
    }
    if (cl.hasOption("a") && cl.hasOption("d"))
        exit("xml2dcm: Option -a and -d are mutual exclusive");
    if (cl.hasOption("e") && cl.hasOption("u"))
        exit("xml2dcm: Option -e and -u are mutual exclusive");
    if (cl.hasOption("E") && cl.hasOption("U"))
        exit("xml2dcm: Option -E and -U are mutual exclusive");
    return cl;
}

From source file:Dcm2Txt.java

private static CommandLine parse(String[] args) {
    Options opts = new Options();
    Option width = new Option("w", "width", true, "maximal number of characters per line, by default: 80");
    width.setArgName("max");
    opts.addOption(width);/*from   w ww .j  a v a 2 s .  c  o  m*/
    Option vallen = new Option("l", "vallen", true,
            "limit value prompt to <maxlen> characters, by default: 64");
    vallen.setArgName("max");
    opts.addOption(vallen);
    opts.addOption("c", "compact", false, "dump without attribute names");
    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("dcm2txt: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption('V')) {
        Package p = Dcm2Txt.class.getPackage();
        System.out.println("dcm2txt v" + p.getImplementationVersion());
        System.exit(0);
    }
    if (cl.hasOption('h') || cl.getArgList().isEmpty()) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE);
        System.exit(0);
    }
    return cl;
}

From source file:lu.tudor.santec.dicom.gui.header.Dcm2Xml.java

private static CommandLine parse(String[] args) {
    Options opts = new Options();
    Option basedir = new Option("d", true, "store extracted values in files under <basedir>. Cannot be "
            + "specified together with option -o <xmlfile>.");
    basedir.setArgName("basedir");
    opts.addOption(basedir);// w  w  w .  j a va  2  s  .co  m
    Option xmlfile = new Option("o", true, "file to write XML to, standard output by default");
    xmlfile.setArgName("xmlfile");
    opts.addOption(xmlfile);
    Option exclude = new Option("x", true,
            "tag (e.g.: 7FE00010) or name (e.g.: PixelData) of attribute " + "to exclude from XML output");
    exclude.setArgName("tag");
    opts.addOption(exclude);
    opts.addOption("X", false, "exclude pixel data from XML output " + "(= shortcut for -x 7FE00010).");
    Option xslurl = new Option("T", true, "transform XML output by applying specified XSL stylesheet.");
    xslurl.setArgName("xslurl");
    opts.addOption(xslurl);
    Option xsltparams = new Option("P", true, "pass specified parameters to the XSL stylesheet.");
    xsltparams.setArgName("param=value,...");
    xsltparams.setValueSeparator('=');
    xsltparams.setArgs(2);
    opts.addOption(xsltparams);
    opts.addOption("I", "incxslt", false, "enable incremental XSLT");
    opts.addOption("c", "compact", false, "suppress additional whitespaces in XML output");
    opts.addOption("C", "comments", false, "include attribute names as comments in XML output");
    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("dcm2xml: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption('V')) {
        Package p = Dcm2Xml.class.getPackage();
        System.out.println("dcm2xml v" + p.getImplementationVersion());
        System.exit(0);
    }
    if (cl.hasOption('h') || cl.getArgList().isEmpty()) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE);
        System.exit(0);
    }
    if (cl.hasOption("o") && cl.hasOption("d"))
        exit("dcm2xml: Option -o <xmlfile> and -d <basedir> are mutual" + "exclusive");
    return cl;
}

From source file:monasca.api.MonApiApplication.java

private static void showVersion() {
    Package pkg;
    pkg = Package.getPackage("monasca.api");

    System.out.println("-------- Version Information --------");
    System.out.println(pkg.getImplementationVersion());
}

From source file:org.dcm4che2.tool.txt2dcmsr.Txt2DcmSR.java

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

    OptionBuilder.withArgName("charset");
    OptionBuilder.hasArg();/*from w  w  w .  ja v a  2 s .co  m*/
    OptionBuilder.withDescription("Specific Character Set, ISO_IR 100 by default");
    opts.addOption(OptionBuilder.create("cs"));

    OptionBuilder.withArgName("file");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("Configuration file specifying DICOM attribute values");
    opts.addOption(OptionBuilder.create("c"));

    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("para", false, "Separate text in paragraphs according line delimiters");

    opts.addOption("ivrle", false, "use Implicit VR Little Endian instead "
            + "Explicit VR Little Endian Transfer Syntax for DICOM encoding.");
    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("txt2dcmsr: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption('V')) {
        Package p = Txt2DcmSR.class.getPackage();
        System.out.println("txt2dcmsr 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.krysalis.barcode4j.cli.Main.java

/** @return the Barcode4J version */
public static String getVersion() {
    String version = null;/*  w w w  .j a v a  2  s.c o m*/
    Package jarinfo = Main.class.getPackage();
    if (jarinfo != null) {
        version = jarinfo.getImplementationVersion();
    }
    if (version == null) {
        //Fallback if Barcode4J is used in a development environment
        version = "DEV";
    }
    return version;
}

From source file:org.clinigrid.capillary.inspector.Inspector.java

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

    OptionBuilder.withArgName("external-model-uris");
    OptionBuilder.hasArg();/*  ww  w. j ava 2  s.co  m*/
    OptionBuilder.withDescription("set the paths of the external model URIs to import (semi-colon separated)");
    opts.addOption(OptionBuilder.create("i"));

    OptionBuilder.withArgName("jar-file-path");
    OptionBuilder.hasArg();
    OptionBuilder
            .withDescription("set the path of the archive file (jar or war) to scan (semi-colon separated)");
    opts.addOption(OptionBuilder.create("j"));

    OptionBuilder.withArgName("dependency-jar");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set the paths of the dependency archives (semi-colon separated)");
    opts.addOption(OptionBuilder.create("d"));

    OptionBuilder.withArgName("output-file.ecore");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set the output ecore file name");
    opts.addOption(OptionBuilder.create("o"));

    opts.addOption("v", "verbose", false, "set the verbose mode");

    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("dcmmwl: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption('V')) {
        Package p = Inspector.class.getPackage();
        System.out.println("Capillary 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;
}