List of usage examples for java.lang Package getImplementationVersion
public String getImplementationVersion()
From source file:org.springframework.boot.ResourceBanner.java
protected String getApplicationVersion(Class<?> sourceClass) { Package sourcePackage = (sourceClass == null ? null : sourceClass.getPackage()); return (sourcePackage == null ? null : sourcePackage.getImplementationVersion()); }
From source file:info.magnolia.cms.license.LicenseFileExtractor.java
/** * Returns the current magnolia version, read from the jar Manifest. This will return null if classes are not inside * a jar./*from w w w .j av a2s . c o m*/ * @return implementation version, read from the manifest file. */ public String getVersionFromManifest() { Package p = this.getClass().getPackage(); if (p != null) { return StringUtils.defaultString(p.getImplementationVersion()); } return StringUtils.EMPTY; }
From source file:org.tradex.tx.GenericJCAContainer.java
public void afterPropertiesSet() throws Exception { bootstrapContext = new SimpleBootstrapContext(workManager, xaTerminator); resourceAdapter.start(bootstrapContext); // now lets start all of the JCAConnector instances if (!lazyLoad) { if (applicationContext == null) { throw new IllegalArgumentException("applicationContext should have been set by Spring"); }//from www . j a v a2 s . co m applicationContext.getBeansOfType(JCAConnector.class); } String version = null; Package aPackage = Package.getPackage("org.jencks"); if (aPackage != null) { version = aPackage.getImplementationVersion(); } log.info("Jencks JCA Container (http://jencks.org/) has started running version: " + version); }
From source file:com.cloudera.cdk.morphline.solr.EnvironmentTest.java
@Test public void testEnvironment() throws UnknownHostException { System.out.println("EXPECTED_SOLR_VERSION: " + EXPECTED_SOLR_VERSION); System.out.println("Running test suite with java version: " + SystemUtils.JAVA_VERSION + " " + SystemUtils.JAVA_VM_NAME + " on " + SystemUtils.OS_NAME + " " + SystemUtils.OS_VERSION + "/" + SystemUtils.OS_ARCH + " on host: " + InetAddress.getLocalHost().getHostName()); Package p = SolrCore.class.getPackage(); System.out.println("Running test suite with solr-spec-version: " + p.getSpecificationVersion() + ", solr-impl-version: " + p.getImplementationVersion()); if (EXPECTED_SOLR_VERSION != null) { assertTrue("unexpected version: " + p.getSpecificationVersion(), p.getSpecificationVersion().startsWith(EXPECTED_SOLR_VERSION)); assertTrue("unexpected version: " + p.getImplementationVersion(), p.getImplementationVersion().startsWith(EXPECTED_SOLR_VERSION)); }//from ww w . j ava2 s . co m p = LucenePackage.class.getPackage(); System.out.println("Running test suite with lucene-spec-version: " + p.getSpecificationVersion() + ", lucene-impl-version: " + p.getImplementationVersion()); if (EXPECTED_SOLR_VERSION != null) { assertTrue("unexpected version: " + p.getSpecificationVersion(), p.getSpecificationVersion().startsWith(EXPECTED_SOLR_VERSION)); assertTrue("unexpected version: " + p.getImplementationVersion(), p.getImplementationVersion().startsWith(EXPECTED_SOLR_VERSION)); Version expectedMinorLuceneVersion = getMinorLuceneVersion(EXPECTED_SOLR_VERSION); System.out.println("expectedMinorLuceneVersion: " + expectedMinorLuceneVersion); assertTrue(Version.LUCENE_CURRENT.onOrAfter(expectedMinorLuceneVersion)); } }
From source file:com.norconex.collector.core.AbstractCollector.java
private void printReleaseVersion(String moduleName, Package p) { String version = p.getImplementationVersion(); if (StringUtils.isBlank(version)) { // No version is likely due to using an unpacked or modified // jar, or the jar not being packaged with version // information. LOG.info("Version: \"" + moduleName + "\" version is undefined."); return;/*from w w w . j a v a 2s .c o m*/ } LOG.info("Version: " + p.getImplementationTitle() + " " + p.getImplementationVersion() + " (" + p.getImplementationVendor() + ")"); }
From source file:gov.nyc.doitt.gis.geoclient.service.configuration.AppConfig.java
public String getImplementationVersion(Class<?> clazz) { Package pkg = clazz.getPackage(); if (pkg == null) { return "UNKNOWN"; }/*from www . j a v a 2 s. com*/ return pkg.getImplementationVersion(); }
From source file:org.dcm4che2.tool.dcmups.DcmUPS.java
private static CommandLine parse(String[] args) { Options opts = new Options(); OptionBuilder.withArgName("name"); OptionBuilder.hasArg();/*w ww .j av a 2s .co m*/ OptionBuilder.withDescription("set device name, use DCMGPWL 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")); opts.addOption("ivrle", false, "offer only Implicit VR Little Endian Transfer Syntax."); opts.addOption("fuzzy", false, "negotiate support of fuzzy semantic person name attribute matching."); opts.addOption("pdv1", false, "send only one PDV in one P-Data-TF PDU, pack command and data " + "PDV in one P-DATA-TF PDU by default."); opts.addOption("tcpdelay", false, "set TCP_NODELAY socket option to false, true by default"); 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("KB"); OptionBuilder.hasArg(); OptionBuilder.withDescription("maximal length in KB of received P-DATA-TF PDUs, 16KB by default"); opts.addOption(OptionBuilder.create("rcvpdulen")); OptionBuilder.withArgName("KB"); OptionBuilder.hasArg(); OptionBuilder.withDescription("maximal length in KB of sent P-DATA-TF PDUs, 16KB by default"); opts.addOption(OptionBuilder.create("sndpdulen")); OptionBuilder.withArgName("KB"); OptionBuilder.hasArg(); OptionBuilder.withDescription("set SO_RCVBUF socket option to specified value in KB"); opts.addOption(OptionBuilder.create("sorcvbuf")); OptionBuilder.withArgName("KB"); OptionBuilder.hasArg(); OptionBuilder.withDescription("set SO_SNDBUF socket option to specified value in KB"); opts.addOption(OptionBuilder.create("sosndbuf")); OptionBuilder.withArgName("state"); OptionBuilder.hasArg(); OptionBuilder.withDescription("match/change UPS of/to specified <state>"); opts.addOption(OptionBuilder.create("state")); OptionBuilder.withArgName("file"); OptionBuilder.hasArg(); OptionBuilder.withDescription("path to DICOM or XML file with UPS attributes to create or set."); opts.addOption(OptionBuilder.create("f")); OptionBuilder.withArgName("uid"); OptionBuilder.hasArg(); OptionBuilder.withDescription("SOP Instance UID of UPS. Required for " + "operation set, get, chstate, reqcancel, and for operation " + "subscribe/unsubscribe to/form receiving UPS events about a " + "specific UPS - and not subscribe/unsubscribe globally."); opts.addOption(OptionBuilder.create("iuid")); OptionBuilder.withArgName("uid"); OptionBuilder.hasArg(); OptionBuilder.withDescription("Transaction UID."); opts.addOption(OptionBuilder.create("tuid")); OptionBuilder.withArgName("aet"); OptionBuilder.hasArg(); OptionBuilder.withDescription( "Specifies AET of Requesting AE for " + "operation reqcancel and AET of Receiving AE for operation " + "subscribe, unsubscribe and suspend."); opts.addOption(OptionBuilder.create("aet")); opts.addOption("dellock", false, "invoke operation subscribe with Deletion Lock."); OptionBuilder.withArgName("[seq/]attr=value"); OptionBuilder.hasArgs(); OptionBuilder.withValueSeparator('='); OptionBuilder.withDescription( "specify matching key. attr can be " + "specified by name or tag value (in hex), e.g. " + "ScheduledProcedureStepStartDateTime or 00404005. " + "Attributes in nested Datasets can be specified by " + "including the name/tag value of the sequence attribute, " + "e.g. 00404018/00080100 for Code Value in the Scheduled " + "Workitem Code Sequence."); opts.addOption(OptionBuilder.create("q")); OptionBuilder.withArgName("attr"); OptionBuilder.hasArgs(); OptionBuilder.withDescription( "specify return key. attr can be " + "specified by name or tag value (in hex). If no return key" + "is specified, defaults are used for invoked find operation."); opts.addOption(OptionBuilder.create("r")); OptionGroup sopClass = new OptionGroup(); sopClass.addOption(new Option("upspush", "Use UPS Push SOP Class to invoke operation. " + "Use appropriate SOP Class by default.")); sopClass.addOption(new Option("upspull", "Use UPS Pull SOP Class to invoke operation. " + "Use appropriate SOP Class by default.")); sopClass.addOption(new Option("upswatch", "Use UPS Watch SOP Class to invoke operation. " + "Use appropriate SOP Class by default.")); opts.addOptionGroup(sopClass); OptionBuilder.withArgName("NORMAL|HIGH|LOW"); OptionBuilder.hasArgs(); OptionBuilder.withDescription("specify priority of the C-FIND " + "operation, NORMAL by default."); opts.addOption(OptionBuilder.create("findprior")); 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("dcmups: " + e.getMessage()); throw new RuntimeException("unreachable"); } if (cl.hasOption('V')) { Package p = DcmUPS.class.getPackage(); System.out.println("dcmups v" + p.getImplementationVersion()); System.exit(0); } if (cl.hasOption('h')) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE); System.exit(0); } return cl; }
From source file:com.github.wolf480pl.mias4j.core.runtime.BMClassLoader.java
protected Package copyPackage(Package pkg, CodeSource cs) { return definePackage(pkg.getName(), pkg.getSpecificationTitle(), pkg.getSpecificationVersion(), pkg.getSpecificationVendor(), pkg.getImplementationTitle(), pkg.getImplementationVersion(), pkg.getImplementationVendor(), pkg.isSealed() ? cs.getLocation() : null); }
From source file:org.psystems.dicom.daemon.Archive.java
private static CommandLine parse(String[] args) { Options opts = new Options(); OptionBuilder.withArgName("name"); OptionBuilder.hasArg();/*from w ww.jav a 2 s.c o m*/ OptionBuilder.withDescription("set device name, use DCMRCV by default"); opts.addOption(OptionBuilder.create("device")); 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_2.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("dir"); OptionBuilder.hasArg(); OptionBuilder.withDescription("store received objects into files in specified directory <dir>." + " Do not store received objects by default."); opts.addOption(OptionBuilder.create("dest")); OptionBuilder.withArgName("URL"); OptionBuilder.hasArg(); OptionBuilder.withDescription("jdbc connect <URL>.\n example: " + Extractor.connectionStr); opts.addOption(OptionBuilder.create("jdbcconnect")); OptionBuilder.withArgName("config"); OptionBuilder.hasArg(); OptionBuilder.withDescription("config file <config> .\n example: " + Extractor.configStr); opts.addOption(OptionBuilder.create("config")); opts.addOption("startdb", false, "Start 'Derby Network Server' set JavaVM Args: -Dderby.system.home=dtabase/instance -Dderby.drda.startNetworkServer=true -Dderby.drda.portNumber=1527 -Dderby.drda.host=localhost"); OptionBuilder.withArgName("file|url"); OptionBuilder.hasArg(); OptionBuilder.withDescription("file path or URL of properties for mapping Calling AETs to " + "sub-directories of the storage directory specified by " + "-dest, to separate the storage location dependend on " + "Calling AETs."); opts.addOption(OptionBuilder.create("calling2dir")); OptionBuilder.withArgName("file|url"); OptionBuilder.hasArg(); OptionBuilder.withDescription("file path or URL of properties for mapping Called AETs to " + "sub-directories of the storage directory specified by " + "-dest, to separate the storage location dependend on " + "Called AETs."); opts.addOption(OptionBuilder.create("called2dir")); OptionBuilder.withArgName("sub-dir"); OptionBuilder.hasArg(); OptionBuilder.withDescription("storage sub-directory used for Calling AETs for which no " + " mapping is defined by properties specified by " + "-calling2dir, 'OTHER' by default."); opts.addOption(OptionBuilder.create("callingdefdir")); OptionBuilder.withArgName("sub-dir"); OptionBuilder.hasArg(); OptionBuilder.withDescription("storage sub-directory used for Called AETs for which no " + " mapping is defined by properties specified by " + "-called2dir, 'OTHER' by default."); opts.addOption(OptionBuilder.create("calleddefdir")); OptionBuilder.withArgName("dir"); OptionBuilder.hasArg(); OptionBuilder.withDescription("register stored objects in cache journal files in specified directory <dir>." + " Do not register stored objects by default."); opts.addOption(OptionBuilder.create("journal")); OptionBuilder.withArgName("pattern"); OptionBuilder.hasArg(); OptionBuilder.withDescription("cache journal file path, with " + "'yyyy' will be replaced by the current year, " + "'MM' by the current month, 'dd' by the current date, " + "'HH' by the current hour and 'mm' by the current minute. " + "'yyyy/MM/dd/HH/mm' by default."); opts.addOption(OptionBuilder.create("journalfilepath")); opts.addOption("defts", false, "accept only default transfer syntax."); opts.addOption("bigendian", false, "accept also Explict VR Big Endian transfer syntax."); opts.addOption("native", false, "accept only transfer syntax with uncompressed pixel data."); OptionBuilder.withArgName("maxops"); OptionBuilder.hasArg(); OptionBuilder.withDescription( "maximum number of outstanding operations performed " + "asynchronously, unlimited by default."); opts.addOption(OptionBuilder.create("async")); opts.addOption("pdv1", false, "send only one PDV in one P-Data-TF PDU, " + "pack command and data PDV in one P-DATA-TF PDU by default."); opts.addOption("tcpdelay", false, "set TCP_NODELAY socket option to false, true by default"); 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("delay in ms for DIMSE-RSP; useful for testing asynchronous mode"); opts.addOption(OptionBuilder.create("rspdelay")); OptionBuilder.withArgName("ms"); OptionBuilder.hasArg(); OptionBuilder.withDescription("timeout in ms for receiving -ASSOCIATE-RQ, 5s by default"); opts.addOption(OptionBuilder.create("requestTO")); 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("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-RQ, 60s by default"); opts.addOption(OptionBuilder.create("idleTO")); OptionBuilder.withArgName("KB"); OptionBuilder.hasArg(); OptionBuilder.withDescription("maximal length in KB of received P-DATA-TF PDUs, 16KB by default"); opts.addOption(OptionBuilder.create("rcvpdulen")); OptionBuilder.withArgName("KB"); OptionBuilder.hasArg(); OptionBuilder.withDescription("maximal length in KB of sent P-DATA-TF PDUs, 16KB by default"); opts.addOption(OptionBuilder.create("sndpdulen")); OptionBuilder.withArgName("KB"); OptionBuilder.hasArg(); OptionBuilder.withDescription("set SO_RCVBUF socket option to specified value in KB"); opts.addOption(OptionBuilder.create("sorcvbuf")); OptionBuilder.withArgName("KB"); OptionBuilder.hasArg(); OptionBuilder.withDescription("set SO_SNDBUF socket option to specified value in KB"); opts.addOption(OptionBuilder.create("sosndbuf")); OptionBuilder.withArgName("KB"); OptionBuilder.hasArg(); OptionBuilder.withDescription("minimal buffer size to write received object to file, 1KB by default"); opts.addOption(OptionBuilder.create("bufsize")); 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("dcmarchive: " + e.getMessage()); throw new RuntimeException("unreachable"); } if (cl.hasOption("V")) { Package p = Archive.class.getPackage(); System.out.println("dcmarchive v" + p.getImplementationVersion()); System.exit(0); } if (cl.hasOption("h")/* || cl.getArgList().size() == 0*/) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(USAGE, DESCRIPTION, opts, EXAMPLE); System.exit(0); } return cl; }
From source file:fr.inrialpes.exmo.align.cli.CommonCLI.java
public void usage(String firstlines, String footer) { Package pkg = this.getClass().getPackage(); String rfooter = footer;/*from w ww . j a v a 2s.c om*/ if (pkg != null) rfooter += "\n" + pkg.getImplementationTitle() + " " + pkg.getImplementationVersion(); new HelpFormatter().printHelp(80, firstlines, "\nOptions:", options, rfooter); }