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:org.dcm4chee.xds2.src.tool.pnrsnd.PnRSnd.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"));
    opts.addOption("c", "showCodes", false, "Show defined codes for affinity domain");
    opts.addOption("a", "audit", false, "Send a dummy audit message");
    addURLOption(opts);/*ww  w. j a v  a  2  s.c  o m*/
    addPropertyOption(opts);
    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);
    }
    if (cl.hasOption("V")) {
        Package p = PnRSnd.class.getPackage();
        String s = p.getName();
        System.out.println(s.substring(s.lastIndexOf('.') + 1) + ": " + p.getImplementationVersion());
        System.exit(0);
    }
    if (cl.hasOption("c")) {
        showCodes(cl);
        System.exit(0);
    }
    if (cl.hasOption("a")) {
        new PnRSnd().audit();
        System.exit(0);
    }
    if (cl.hasOption("u")) {
        props.setProperty("URL", cl.getOptionValue("u"));
    }
    if (cl.hasOption("p")) {
        String[] codes = cl.getOptionValues("p");
        int pos;
        for (int i = 0; i < codes.length; i++) {
            pos = codes[i].indexOf('=');
            props.setProperty(codes[i].substring(0, pos), codes[i].substring(++pos));
        }
    }
    return cl;
}

From source file:org.dcm4che2.tool.dcm2dcm.Dcm2Dcm.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   w  w w.j a v a 2 s  . c om
    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 = Dcm2Dcm.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.shelloid.vpt.agent.App.java

public static String getVersion() {
    Package p = App.class.getPackage();
    String version = p.getImplementationVersion();
    if (version == null) {
        version = "devTest";
    }/*  w  w  w  . java2  s  .co  m*/
    return version;
}

From source file:org.dcm4che2.tool.dcmdir.DcmDir.java

private static CommandLine parse(String[] args) {
    Options opts = new Options();
    OptionGroup cmdOpt = new OptionGroup();
    OptionBuilder.withArgName("dicomdir");
    OptionBuilder.hasArg();//from www . j a  v  a 2 s.c  om
    OptionBuilder.withDescription("create new directory file <dicomdir> for DICOM file-set "
            + "specified by file.. or directory.. arguments");
    cmdOpt.addOption(OptionBuilder.create("c"));
    OptionBuilder.withArgName("dicomdir");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("read directory file <dicomdir> and dump content to stdout");
    cmdOpt.addOption(OptionBuilder.create("t"));
    OptionBuilder.withArgName("dicomdir");
    OptionBuilder.hasArg();
    OptionBuilder
            .withDescription("add references to specified files to existing directory file " + "<dicomdir>");
    cmdOpt.addOption(OptionBuilder.create("a"));
    OptionBuilder.withArgName("dicomdir");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "delete references to specified files from existing directory " + "file <dicomdir>");
    cmdOpt.addOption(OptionBuilder.create("d"));
    OptionBuilder.withArgName("dicomdir");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("purge records without file references from directory file " + "<dicomdir>.");
    cmdOpt.addOption(OptionBuilder.create("p"));
    OptionBuilder.withArgName("dicomdir");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("compact existing directory file <dicomdir> by removing unused entries");
    cmdOpt.addOption(OptionBuilder.create("z"));
    opts.addOptionGroup(cmdOpt);
    OptionBuilder.withArgName("txtfile");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("specify File-set Descriptor File");
    opts.addOption(OptionBuilder.create("desc"));
    OptionBuilder.withArgName("code");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "Character Set used in File-set Descriptor File" + "(\"ISO_IR 100\" = ISO Latin 1).");
    opts.addOption(OptionBuilder.create("desccs"));
    OptionBuilder.withArgName("id");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("specify File-set ID");
    opts.addOption(OptionBuilder.create("id"));
    OptionBuilder.withArgName("uid");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("specify File-set UID");
    opts.addOption(OptionBuilder.create("uid"));
    OptionBuilder.withArgName("max");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("maximal number of characters per line, by default: 80");
    opts.addOption(OptionBuilder.create("w"));
    OptionBuilder.withArgName("max");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("limit value prompt to <maxlen> characters, by default: 64");
    opts.addOption(OptionBuilder.create("W"));
    opts.addOption("inactive", false, "dump also inactive records.");
    opts.addOption("S", false,
            "encode Sequences with undefined length," + "encode with explicit length by default.");
    opts.addOption("I", false,
            "encode Sequence Items with undefined length," + "encode with explicit length by default.");
    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("dcmdir: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption('V')) {
        Package p = DcmDir.class.getPackage();
        System.out.println("dcmdir v" + p.getImplementationVersion());
        System.exit(0);
    }
    if (cl.hasOption('h') || !(cl.hasOption("a") || cl.hasOption("c") || cl.hasOption("d") || cl.hasOption("p")
            || cl.hasOption("t") || cl.hasOption("z"))) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE);
        System.exit(0);
    }
    return cl;
}

From source file:org.dcm4che2.tool.dcm2jpg.Dcm2Jpg.java

private static CommandLine parse(String[] args) {
    Options opts = new Options();
    OptionBuilder.withArgName("frame");
    OptionBuilder.hasArg();/* w ww  .  ja v  a2 s.com*/
    OptionBuilder.withDescription("frame to convert, 1 (= first frame) by default");
    opts.addOption(OptionBuilder.create("f"));

    OptionBuilder.withArgName("imagequality");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("JPEG Image Quality (0-100)");
    opts.addOption(OptionBuilder.create("q"));

    OptionBuilder.withArgName("ImageWriterClass");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "ImageWriter to be used [Default: JPEGImageEncoder instead of imageIO]. Use * to choose the first ImageIO Writer found for given image format");
    opts.addOption(OptionBuilder.create("imagewriter"));
    opts.addOption("S", "showFormats", false, "Show all supported format names by registered ImageWriters.");
    opts.addOption("s", "showimagewriter", false, "Show all available Image Writer for specified format name.");

    OptionBuilder.withArgName("formatName");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "Image Format Name. [default JPEG] This option will imply default values for ImageWriterClass='*' and jpgext='.<formatname>'");
    opts.addOption(OptionBuilder.create("F"));
    OptionBuilder.withArgName("compressionType");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "Compression Type. [default: '*' (exception: jpeg for format JPEG)] Only applicable if an ImageWriterClass is used! Use * to choose the first compression type.");
    opts.addOption(OptionBuilder.create("T"));

    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.hasOption('s') || cl.hasOption('S')) && cl.getArgList().size() < 2) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE);
        System.exit(0);
    }
    return cl;
}

From source file:PackageInfo.java

static void pkgInfo(ClassLoader classLoader, String pkgName, String className) {

    try {/*from  ww  w . j av  a 2s . co m*/
        classLoader.loadClass(pkgName + "." + className);

        Package p = Package.getPackage(pkgName);
        if (p == null) {
            System.out.println("WARNING: Package.getPackage(" + pkgName + ") is null");
        } else {
            System.out.println(p);
            System.out.println("Specification Title = " + p.getSpecificationTitle());
            System.out.println("Specification Vendor = " + p.getSpecificationVendor());
            System.out.println("Specification Version = " + p.getSpecificationVersion());

            System.out.println("Implementation Vendor = " + p.getImplementationVendor());
            System.out.println("Implementation Version = " + p.getImplementationVersion());
        }
    } catch (ClassNotFoundException e) {
        System.out.println("Unable to load " + pkgName);
    }

    System.out.println();
}

From source file:org.dcm4che.tool.common.CLIUtils.java

public static CommandLine parseComandLine(String[] args, Options opts, ResourceBundle rb2, Class<?> clazz)
        throws ParseException {
    CommandLineParser parser = new PosixParser();
    CommandLine cl = parser.parse(opts, args);
    if (cl.hasOption("h")) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(rb2.getString("usage"), rb2.getString("description"), opts,
                rb2.getString("example"));
        System.exit(0);/*  www.java  2s . co m*/
    }
    if (cl.hasOption("V")) {
        Package p = clazz.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.dcmecho.DcmEcho.java

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

    OptionBuilder.withArgName("name");
    OptionBuilder.hasArg();//from  www  .  j a v  a 2 s.c o  m
    OptionBuilder.withDescription("set device name, use DCMECHO by default");
    opts.addOption(OptionBuilder.create("device"));

    OptionBuilder.withArgName("aet[@host]");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("set AET and local address of local Application Entity, use "
            + "device name and pick up any valid local address to " + "bind the socket by default");
    opts.addOption(OptionBuilder.create("L"));

    OptionBuilder.withArgName("username");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "enable User Identity Negotiation with specified username and " + " optional passcode");
    opts.addOption(OptionBuilder.create("username"));

    OptionBuilder.withArgName("passcode");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
            "optional passcode for User Identity Negotiation, " + "only effective with option -username");
    opts.addOption(OptionBuilder.create("passcode"));

    opts.addOption("uidnegrsp", false,
            "request positive User Identity Negotation response, " + "only effective with option -username");

    OptionBuilder.withArgName("NULL|3DES|AES");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("enable TLS connection without, 3DES or AES encryption");
    opts.addOption(OptionBuilder.create("tls"));

    OptionGroup tlsProtocol = new OptionGroup();
    tlsProtocol.addOption(new Option("tls1", "disable the use of SSLv3 and SSLv2 for TLS connections"));
    tlsProtocol.addOption(new Option("ssl3", "disable the use of TLSv1 and SSLv2 for TLS connections"));
    tlsProtocol.addOption(new Option("no_tls1", "disable the use of TLSv1 for TLS connections"));
    tlsProtocol.addOption(new Option("no_ssl3", "disable the use of SSLv3 for TLS connections"));
    tlsProtocol.addOption(new Option("no_ssl2", "disable the use of SSLv2 for TLS connections"));
    opts.addOptionGroup(tlsProtocol);

    opts.addOption("noclientauth", false, "disable client authentification for TLS");

    OptionBuilder.withArgName("file|url");
    OptionBuilder.hasArg();
    OptionBuilder
            .withDescription("file path or URL of P12 or JKS keystore, resource:tls/test_sys_1.p12 by default");
    opts.addOption(OptionBuilder.create("keystore"));

    OptionBuilder.withArgName("password");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("password for keystore file, 'secret' by default");
    opts.addOption(OptionBuilder.create("keystorepw"));

    OptionBuilder.withArgName("password");
    OptionBuilder.hasArg();
    OptionBuilder
            .withDescription("password for accessing the key in the keystore, keystore password by default");
    opts.addOption(OptionBuilder.create("keypw"));

    OptionBuilder.withArgName("file|url");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("file path or URL of JKS truststore, resource:tls/mesa_certs.jks by default");
    opts.addOption(OptionBuilder.create("truststore"));

    OptionBuilder.withArgName("password");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("password for truststore file, 'secret' by default");
    opts.addOption(OptionBuilder.create("truststorepw"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for TCP connect, no timeout by default");
    opts.addOption(OptionBuilder.create("connectTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("delay in ms for Socket close after sending A-ABORT, 50ms by default");
    opts.addOption(OptionBuilder.create("soclosedelay"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("period in ms to check for outstanding DIMSE-RSP, 10s by default");
    opts.addOption(OptionBuilder.create("reaper"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving DIMSE-RSP, 10s by default");
    opts.addOption(OptionBuilder.create("rspTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving A-ASSOCIATE-AC, 5s by default");
    opts.addOption(OptionBuilder.create("acceptTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving A-RELEASE-RP, 5s by default");
    opts.addOption(OptionBuilder.create("releaseTO"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("timeout in ms for receiving DIMSE-RQ, 10s by default");
    opts.addOption(OptionBuilder.create("idleTO"));

    OptionBuilder.withArgName("num");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription("repeat C-ECHO RQ several times");
    opts.addOption(OptionBuilder.create("repeat"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder
            .withDescription("delay in ms between repeated C-FIND RQ, immediately after C-FIND RSP by default");
    opts.addOption(OptionBuilder.create("repeatdelay"));

    opts.addOption("reuseassoc", false, "Reuse association for repeated C-ECHO");
    opts.addOption("closeassoc", false, "Close association after each C-ECHO");
    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("dcmecho: " + e.getMessage());
        throw new RuntimeException("unreachable");
    }
    if (cl.hasOption('V')) {
        Package p = DcmEcho.class.getPackage();
        System.out.println("dcmecho 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;
}

From source file:org.jboss.confluence.plugin.docbook_tools.docbookimport.DocbookImporter.java

protected static final void printClassInfo(Class<?> clazz, String msg) {
    Package pack = clazz.getPackage();
    StringBuilder sb = new StringBuilder();
    sb.append(msg).append(": ").append(clazz.getName());
    sb.append(", Specification version: ").append(pack.getSpecificationVersion());
    sb.append(", Implementation version: ").append(pack.getImplementationVersion());
    log.info(sb.toString());/*from  w  ww .  j a  va2 s  . c  om*/
}

From source file:org.ebayopensource.turmeric.plugins.maven.AbstractTurmericMojo.java

private static String getPackageVersion(Class<?> clazz) {
    Package p = clazz.getPackage();
    if (p == null) {
        return null;
    }//from  w  w w.  ja  v a 2 s  . c  o m

    String ver = p.getImplementationVersion();
    if (ver == null) {
        return null;
    }
    return ver;
}