예제 #1
0
  @CoberturaIgnore
  public static String constructUserAgentName() {
    final Package pkg = StringUtils.class.getPackage();
    final String implementationVersion =
        StringUtils.isSet(pkg.getImplementationVersion())
            ? pkg.getImplementationVersion()
            : "x.x.xx";

    return String.format("stubby4j/%s (HTTP stub client request)", implementationVersion);
  }
예제 #2
0
  /** @return the version of the dart-analyzer tool */
  public static String getBuildVersion() {
    final String fallbackVersion = "0.0.0";

    Package analyzerPackage = AnalyzerMain.class.getPackage();

    if (analyzerPackage.getImplementationVersion() == null) {
      return fallbackVersion;
    } else {
      return analyzerPackage.getImplementationVersion();
    }
  }
 public String getVersion(Class<?> api) {
   log.trace("getVersion for {}", api);
   Package pkg = api.getPackage();
   log.trace("    -> {}/{}", pkg.getImplementationVersion(), pkg.getSpecificationVersion());
   String version = pkg.getSpecificationVersion();
   if (version == null) version = pkg.getImplementationVersion();
   if (version == null) {
     try {
       version = readVersionFromManifest(api);
     } catch (IOException e) {
       log.error("Could not extract version for " + api, e);
       return null;
     }
   }
   return version;
 }
예제 #4
0
  public static void main(String args[]) throws Exception {
    if (args.length >= 2) {
      String className = args[0];
      String infoNeeded = args[1];
      String message = "";
      Class clazz = null;

      try {
        clazz = Class.forName(className);
      } catch (Exception e) {
        System.out.println("class not found: '" + className + "'");
        return;
      }

      if ("ImplementationVersion".equals(infoNeeded)) {
        final Package aPackage = clazz.getPackage();
        if (aPackage != null) {
          System.out.print(aPackage.getImplementationVersion());
          return;
        } else {
          System.out.println("package for class '" + className + "' not found!");
          return;
        }
      } else {
        throw new Exception(infoNeeded + " not supported");
      }
    } else {
      throw new Exception("Usage: PackageInfo class-name info-required");
    }
  }
  /** Add Karaf core features URL in the default repositories set */
  private void appendKarafCoreFeaturesDescriptors() {
    if (repositories == null) {
      repositories = new ArrayList<String>();
    }
    if (karafVersion == null) {
      Package p = Package.getPackage("org.apache.karaf.tooling.features");
      karafVersion = p.getImplementationVersion();
    }
    String karafCoreStandardFeaturesUrl =
        String.format(KARAF_CORE_STANDARD_FEATURE_URL, karafVersion);
    String karafCoreEnterpriseFeaturesUrl =
        String.format(KARAF_CORE_ENTERPRISE_FEATURE_URL, karafVersion);

    try {
      resolve(karafCoreStandardFeaturesUrl);
      repositories.add(karafCoreStandardFeaturesUrl);
    } catch (Exception e) {
      warn("Can't add " + karafCoreStandardFeaturesUrl + " in the default repositories set");
    }

    try {
      resolve(karafCoreEnterpriseFeaturesUrl);
      repositories.add(karafCoreEnterpriseFeaturesUrl);
    } catch (Exception e) {
      warn("Can't add " + karafCoreStandardFeaturesUrl + " in the default repositories set");
    }
  }
예제 #6
0
 private void logVersionInfo(Class<?> clazz, String title, Log log) {
   Package pack = clazz.getPackage();
   String version = null;
   if (pack != null) {
     if (pack.getImplementationTitle() != null) {
       title = pack.getImplementationTitle();
     }
     version = pack.getImplementationVersion();
   }
   if (version == null) {
     try {
       String classname = clazz.getName();
       Class<?> packinf =
           Class.forName(classname.substring(0, classname.lastIndexOf('.')) + ".PackageInfo");
       java.lang.reflect.Method mo = packinf.getMethod("getProductVersion");
       version = mo.invoke(null).toString();
     } catch (Exception pie) {
       log.info("PackageInfo not found");
     }
     if (version == null) {
       version = "<unknown>";
     }
   }
   log.info(title + " version " + version);
 }
예제 #7
0
  /** Starts the Error Checker Service thread */
  @Override
  public void run() {
    lastTab = editor.getSketch().getCodeIndex(editor.getSketch().getCurrentCode());
    initializeErrorWindow();
    xqpreproc = new XQPreprocessor();
    // Run check code just once before entering into loop.
    // Makes sure everything is initialized and set.
    checkCode();
    editor.getTextArea().repaint();
    stopThread = false;

    while (!stopThread) {
      try {
        // Take a nap.
        Thread.sleep(sleepTime);
      } catch (Exception e) {
        System.out.println("Oops! [ErrorCheckerThreaded]: " + e);
        // e.printStackTrace();
      }

      if (pauseThread) continue;

      // Check every x seconds
      checkCode();
      if (runCount < 5) {
        runCount++;
      }

      if (runCount == 3) {
        Package p = XQMode.class.getPackage();
        System.out.println(p.getImplementationTitle() + " v" + p.getImplementationVersion());
      }
    }
  }
  static {
    // Put JOGL version information into system properties to
    // assist in debugging.
    Package joglPackage = Package.getPackage("javax.media.opengl");
    System.setProperty("jogl.specification.version", joglPackage.getSpecificationVersion());
    System.setProperty("jogl.implementation.version", joglPackage.getImplementationVersion());

    ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
  }
 @Override
 protected String getUserAgentExtraString(
     final HttpClient httpClient, final ConnectionInstanceData connectionInstanceData) {
   // https://stackoverflow.com/a/6773868/
   final Class<? extends ModernHTTPClientFactory> me = this.getClass();
   final Package us = me.getPackage();
   String version = us.getImplementationVersion();
   if (version == null) {
     version = "devtest";
   }
   return "TFS-Jenkins " + version;
 }
예제 #10
0
  private static boolean initJUELSupportsMethodExpression() {
    final Package juelPackage = Package.getPackage("de.odysseus.el");
    if (juelPackage == null) {
      return false;
    }

    final String juelVersion = juelPackage.getImplementationVersion();
    if (juelVersion == null) {
      return false;
    }

    return Hacks.isSameOrHigherVersion(juelVersion, Hacks.JUEL_MINIMUM_METHOD_EXPRESSION_VERSION);
  }
예제 #11
0
  /**
   * Prints out general IdP information. This includes IdP version, start up time, and whether the
   * attribute resolver is currently operational.
   *
   * @param out output writer to which information will be written
   */
  protected void printIdPInformation(PrintWriter out) {
    Package pkg = Version.class.getPackage();

    out.println("### Identity Provider Information");
    out.println("idp_version: " + pkg.getImplementationVersion());
    out.println("idp_start_time: " + startTime.toString(dateFormat));
    try {
      attributeResolver.validate();
      out.println("attribute_resolver_valid: " + Boolean.TRUE);
    } catch (AttributeResolutionException e) {
      out.println("attribute_resolver_valid: " + Boolean.FALSE);
    }
  }
예제 #12
0
 public static void main(String[] args) {
   Package pckgs[];
   pckgs = Package.getPackages();
   for (Package pckg : pckgs) {
     System.out.println(
         pckg.getName()
             + " "
             + pckg.getImplementationTitle()
             + " "
             + pckg.getImplementationVendor()
             + " "
             + pckg.getImplementationVersion());
   }
 }
 private void ensureDroolsRuntimeMatches(
     String expectedRuntimeVersion, VersionCheckStrategy versionCheckStrategy) {
   final Package droolsCorePackage = KnowledgePackageImp.class.getPackage();
   final String implementationTitle = droolsCorePackage.getImplementationTitle();
   final String implementationVersion = droolsCorePackage.getImplementationVersion();
   switch (versionCheckStrategy) {
     case VERSIONS_MUST_MATCH:
       ensureVersionsMatch(expectedRuntimeVersion, implementationTitle, implementationVersion);
       break;
     case IGNORE_UNKNOWN_RUNTIME_VERSION:
       ensureVersionsMatchIgnoringUnknown(
           expectedRuntimeVersion, implementationTitle, implementationVersion);
       break;
   }
 }
예제 #14
0
  static void pkgInfo(ClassLoader classLoader, String pkgName, String className) {

    try {
      classLoader.loadClass(pkgName + "." + className);

      Package p = Package.getPackage(pkgName);
      if (p == null) {
        System.err.println("WARNING: Package.getPackage(" + pkgName + ") is null");
      } else {
        if (devPhase && debug) {
          System.err.println(p);
          System.err.println("Specification Title = " + p.getSpecificationTitle());
          System.err.println("Specification Vendor = " + p.getSpecificationVendor());
          System.err.println("Specification Version = " + p.getSpecificationVersion());
          System.err.println("Implementation Vendor = " + p.getImplementationVendor());
          System.err.println("Implementation Version = " + p.getImplementationVersion());
        } else if (devPhase) System.err.println(", Java 3D " + p.getImplementationVersion() + ".");
      }
    } catch (ClassNotFoundException e) {
      System.err.println("Unable to load " + pkgName);
    }

    // 	System.err.println();
  }
예제 #15
0
  static {
    Package p = GrailsUtil.class.getPackage();
    String version = p != null ? p.getImplementationVersion() : null;
    if (version == null || isBlank(version)) {
      PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
      try {
        Resource[] manifests = resolver.getResources("classpath*:META-INF/MANIFEST.MF");
        Manifest grailsManifest = null;
        for (int i = 0; i < manifests.length; i++) {
          Resource r = manifests[i];
          InputStream inputStream = null;
          Manifest mf = null;
          try {
            inputStream = r.getInputStream();
            mf = new Manifest(inputStream);
          } finally {
            IOUtils.closeQuietly(inputStream);
          }
          String implTitle = mf.getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_TITLE);
          if (!isBlank(implTitle) && implTitle.equals(GRAILS_IMPLEMENTATION_TITLE)) {
            grailsManifest = mf;
            break;
          }
        }

        if (grailsManifest != null) {
          version =
              grailsManifest.getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION);
        }

        if (isBlank(version)) {
          LOG.error(
              "Unable to read Grails version from MANIFEST.MF. Are you sure the grails-core jar is on the classpath? ");
          version = "Unknown";
        }
      } catch (Exception e) {
        version = "Unknown";
        LOG.error(
            "Unable to read Grails version from MANIFEST.MF. Are you sure it the grails-core jar is on the classpath? "
                + e.getMessage(),
            e);
      }
    }
    GRAILS_VERSION = version;
  }
예제 #16
0
파일: Version.java 프로젝트: EasyBeans/core
  /** @return Returns the EasyBeans Version Number. */
  public static String getVersion() {
    if (versionNumber == null) {
      // Read version from the package
      Package pkg = Version.class.getPackage();
      if (pkg != null) {
        String implVersion = pkg.getImplementationVersion();
        if (implVersion != null) {
          versionNumber = implVersion;
        }
      }
      // not found, return default value
      if (versionNumber == null || versionNumber.length() == 0) {
        versionNumber = DEFAULT_VERSION_NUMBER;
      }
    }

    return versionNumber;
  }
예제 #17
0
 public JFXAboutDialog(
     @NotNull String appVersion,
     @NotNull String iconUrl,
     @NotNull ResourceExtractor resourceExtractor) {
   super("About Dialog", resourceExtractor);
   prepareOneButtonKeyListener();
   okAction = prepareHideAction("OK", ButtonType.OK_DONE);
   addActions(okAction);
   @Nullable Package frameworkPackage = JFXAboutDialog.class.getPackage();
   @Nullable
   String frameworkVersion =
       (frameworkPackage != null) ? frameworkPackage.getImplementationVersion() : "?";
   if (frameworkVersion == null) {
     frameworkVersion = "?";
   }
   prepareTexts(appVersion, frameworkVersion);
   setIcon(iconUrl);
 }
예제 #18
0
 static String productVersion(Class<?> clazz) {
   String title = null;
   String version = null;
   String vendor = null;
   Package pkg = clazz.getPackage();
   if (pkg != null) {
     title = pkg.getImplementationTitle();
     version = pkg.getImplementationVersion();
     vendor = pkg.getImplementationVendor();
   }
   StringBuilder builder = new StringBuilder("Product Version: ");
   builder.append((title != null) ? title : clazz.getSimpleName());
   builder.append("  ");
   builder.append((version != null) ? version : "(unknown version)");
   if (vendor != null) {
     builder.append(",  ").append(vendor);
   }
   return builder.toString();
 }
예제 #19
0
  static {
    String version = "unknown";
    int major = 0;
    int minor = 0;
    try {
      Package p = Package.getPackage(MetaDataSupport.class.getPackage().getName());
      if (p != null) {
        version = p.getImplementationVersion();
        Pattern pattern = Pattern.compile("(\\d+)\\.(\\d+).*");
        Matcher m = pattern.matcher(version);
        if (m.matches()) {
          major = Integer.parseInt(m.group(1));
          minor = Integer.parseInt(m.group(2));
        }
      }
    } catch (Throwable e) {
      LOG.trace("Problem generating primary version details", e);

      InputStream in = null;
      String path = MetaDataSupport.class.getPackage().getName().replace(".", "/");
      if ((in = MetaDataSupport.class.getResourceAsStream("/" + path + "/version.txt")) != null) {
        try {
          BufferedReader reader =
              new BufferedReader(new InputStreamReader(in, StandardCharsets.US_ASCII));
          version = reader.readLine();
          Pattern pattern = Pattern.compile("(\\d+)\\.(\\d+).*");
          Matcher m = pattern.matcher(version);
          if (m.matches()) {
            major = Integer.parseInt(m.group(1));
            minor = Integer.parseInt(m.group(2));
          }
          reader.close();
        } catch (Throwable err) {
          LOG.trace("Problem generating fallback version details", err);
        }
      }
    }

    PROVIDER_VERSION = version;
    PROVIDER_MAJOR_VERSION = major;
    PROVIDER_MINOR_VERSION = minor;
  }
예제 #20
0
  /**
   * @param args
   * @return
   */
  private static void parseCommandLine(RunTimeData anRtData, String[] args) {
    Trace.println(Trace.UTIL, "parseCommandLine(  runTimeData, args )", true);

    CmdLineParser cmdLine = new CmdLineExecutionParser(APPLICATIONNAME);
    cmdLine.setDefaultCommand("execute");

    cmdLine.acceptFlag(Testium.VERSION, "Displays the versions of Testium and the plugins");

    try {
      cmdLine.parse(anRtData, args);
    } catch (ParameterException pe) {
      Trace.print(Trace.UTIL, pe);
      cmdLine.printHelpOn(System.out);
      throw new Error("Error on command line.", pe);
    }

    if (anRtData.getValueAsBoolean(Testium.HELP)) {
      cmdLine.printHelpOn(System.out);
      System.exit(0);
    }

    if (anRtData.getValueAsBoolean(Testium.VERSION)) {
      System.out.println("The version of Testium");
      Package[] packages = Package.getPackages();
      for (Package pkg : packages) {
        String pkgName = pkg.getName();
        if (!pkgName.startsWith("java")
            && !pkgName.startsWith("sun")
            && !pkgName.startsWith("joptsimple")
            && !pkgName.startsWith("org.xml")) {
          System.out.println(pkgName + ":\t" + pkg.getImplementationVersion());
        }
      }

      System.exit(0);
    }
  }
 /** @return Hazelcast's implementation version */
 public String getAdapterVersion() {
   return HZ_PACKAGE.getImplementationVersion();
 }
예제 #22
0
파일: DcmRcv.java 프로젝트: Cledio/Oviyam2
  private static CommandLine parse(String[] args) {
    Options opts = new Options();

    OptionBuilder.withArgName("name");
    OptionBuilder.hasArg();
    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("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.");

    OptionGroup scRetrieveAET = new OptionGroup();
    OptionBuilder.withArgName("aet");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "Retrieve AE Title included in Storage Commitment "
            + "N-EVENT-REPORT in items of the Referenced SOP Sequence.");
    scRetrieveAET.addOption(OptionBuilder.create("scretraets"));
    OptionBuilder.withArgName("aet");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "Retrieve AE Title included in Storage Commitment "
            + "N-EVENT-REPORT outside of the Referenced SOP Sequence.");
    scRetrieveAET.addOption(OptionBuilder.create("scretraet"));
    opts.addOptionGroup(scRetrieveAET);

    opts.addOption(
        "screusefrom",
        false,
        "attempt to issue the Storage Commitment N-EVENT-REPORT on "
            + "the same Association on which the N-ACTION operation was "
            + "performed; use different Association for N-EVENT-REPORT by "
            + "default.");

    opts.addOption(
        "screuseto",
        false,
        "attempt to issue the Storage Commitment N-EVENT-REPORT on "
            + "previous initiated Association to the Storage Commitment SCU; "
            + "initiate new Association for N-EVENT-REPORT by default.");

    OptionBuilder.withArgName("port");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "port of Storage Commitment SCU to connect to issue "
            + "N-EVENT-REPORT on different Association; 104 by default.");
    opts.addOption(OptionBuilder.create("scport"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "delay in ms for N-EVENT-REPORT-RQ to Storage Commitment SCU, " + "1s by default");
    opts.addOption(OptionBuilder.create("scdelay"));

    OptionBuilder.withArgName("retry");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "number of retries to issue N-EVENT-REPORT-RQ to Storage "
            + "Commitment SCU, 0 by default");
    opts.addOption(OptionBuilder.create("scretry"));

    OptionBuilder.withArgName("ms");
    OptionBuilder.hasArg();
    OptionBuilder.withDescription(
        "interval im ms between retries to issue N-EVENT-REPORT-RQ to"
            + "Storage Commitment SCU, 60s by default");
    opts.addOption(OptionBuilder.create("scretryperiod"));

    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("timeout in ms for TCP connect, no timeout by default");
    opts.addOption(OptionBuilder.create("connectTO"));

    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(
        "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("dcmrcv: " + e.getMessage());
      throw new RuntimeException("unreachable");
    }
    if (cl.hasOption("V")) {
      Package p = DcmRcv.class.getPackage();
      System.out.println("dcmrcv 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;
  }
    public void init(GLAutoDrawable glAutoDrawable) {
      StringBuilder sb = new StringBuilder();

      sb.append(gov.nasa.worldwind.Version.getVersion() + "\n");

      sb.append("\nSystem Properties\n");
      sb.append("Processors: " + Runtime.getRuntime().availableProcessors() + "\n");
      sb.append("Free memory: " + Runtime.getRuntime().freeMemory() + " bytes\n");
      sb.append("Max memory: " + Runtime.getRuntime().maxMemory() + " bytes\n");
      sb.append("Total memory: " + Runtime.getRuntime().totalMemory() + " bytes\n");

      for (Map.Entry prop : System.getProperties().entrySet()) {
        sb.append(prop.getKey() + " = " + prop.getValue() + "\n");
      }

      GL gl = glAutoDrawable.getGL();

      sb.append("\nOpenGL Values\n");

      String oglVersion = gl.glGetString(GL.GL_VERSION);
      sb.append("OpenGL version: " + oglVersion + "\n");

      String oglVendor = gl.glGetString(GL.GL_VENDOR);
      sb.append("OpenGL vendor: " + oglVendor + "\n");

      String oglRenderer = gl.glGetString(GL.GL_RENDERER);
      sb.append("OpenGL renderer: " + oglRenderer + "\n");

      int[] intVals = new int[2];
      for (Attr attr : attrs) {
        sb.append(attr.name).append(": ");

        if (attr.attr instanceof Integer) {
          gl.glGetIntegerv((Integer) attr.attr, intVals, 0);
          sb.append(intVals[0]).append(intVals[1] > 0 ? ", " + intVals[1] : "");
        }

        sb.append("\n");
      }

      String extensionString = gl.glGetString(GL.GL_EXTENSIONS);
      String[] extensions = extensionString.split(" ");
      sb.append("Extensions\n");
      for (String ext : extensions) {
        sb.append("    " + ext + "\n");
      }

      sb.append("\nJOGL Values\n");
      String pkgName = "javax.media.opengl";
      try {
        getClass().getClassLoader().loadClass(pkgName + ".GL");

        Package p = Package.getPackage(pkgName);
        if (p == null) {
          sb.append("WARNING: Package.getPackage(" + pkgName + ") is null\n");
        } else {
          sb.append(p + "\n");
          sb.append("Specification Title = " + p.getSpecificationTitle() + "\n");
          sb.append("Specification Vendor = " + p.getSpecificationVendor() + "\n");
          sb.append("Specification Version = " + p.getSpecificationVersion() + "\n");
          sb.append("Implementation Vendor = " + p.getImplementationVendor() + "\n");
          sb.append("Implementation Version = " + p.getImplementationVersion() + "\n");
        }
      } catch (ClassNotFoundException e) {
        sb.append("Unable to load " + pkgName + "\n");
      }

      this.outputArea.setText(sb.toString());
    }
 public static String getVersion() {
   Package pkg = SpringSecurityCoreVersion.class.getPackage();
   return (pkg != null ? pkg.getImplementationVersion() : null);
 }
  @TestTargetNew(
      level = TestLevel.COMPLETE,
      notes = "",
      method = "definePackage",
      args = {
        java.lang.String.class, java.lang.String.class,
        java.lang.String.class, java.lang.String.class,
        java.lang.String.class, java.lang.String.class,
        java.lang.String.class, java.net.URL.class
      })
  public void test_definePackage() {

    PackageClassLoader pcl = new PackageClassLoader(getClass().getClassLoader());

    String[] packageProperties = {
      "test.package", "title", "1.0", "Vendor", "Title", "1.1", "implementation vendor"
    };

    URL url = null;
    try {
      url = new URL("file:");
    } catch (MalformedURLException e) {
      fail("MalformedURLException was thrown.");
    }
    pcl.definePackage(
        packageProperties[0],
        packageProperties[1],
        packageProperties[2],
        packageProperties[3],
        packageProperties[4],
        packageProperties[5],
        packageProperties[6],
        url);

    Package pack = pcl.getPackage(packageProperties[0]);
    assertEquals(packageProperties[1], pack.getSpecificationTitle());
    assertEquals(packageProperties[2], pack.getSpecificationVersion());
    assertEquals(packageProperties[3], pack.getSpecificationVendor());
    assertEquals(packageProperties[4], pack.getImplementationTitle());
    assertEquals(packageProperties[5], pack.getImplementationVersion());
    assertEquals(packageProperties[6], pack.getImplementationVendor());
    assertTrue(pack.isSealed(url));
    assertTrue(pack.isSealed());

    try {
      pcl.definePackage(
          packageProperties[0],
          packageProperties[1],
          packageProperties[2],
          packageProperties[3],
          packageProperties[4],
          packageProperties[5],
          packageProperties[6],
          null);
      fail("IllegalArgumentException was not thrown.");
    } catch (IllegalArgumentException iae) {
      // expected
    }

    pcl.definePackage("test.package.test", null, null, null, null, null, null, null);
    pack = pcl.getPackage("test.package.test");
    assertNull(pack.getSpecificationTitle());
    assertNull(pack.getSpecificationVersion());
    assertNull(pack.getSpecificationVendor());
    assertNull(pack.getImplementationTitle());
    assertNull(pack.getImplementationVersion());
    assertNull(pack.getImplementationVendor());
    assertFalse(pack.isSealed());
  }
예제 #26
0
  /**
   * @tests java.lang.Package#getImplementationVendor()
   * @tests java.lang.Package#getImplementationVersion()
   * @tests java.lang.Package#getSpecificationTitle()
   * @tests java.lang.Package#getSpecificationVendor()
   * @tests java.lang.Package#getSpecificationVersion()
   * @tests java.lang.Package#getImplementationTitle()
   */
  public void test_helper_Attributes() throws Exception {

    Package p = getTestPackage("hyts_all_attributes.jar", "p.C");
    assertEquals(
        "Package getImplementationTitle returns a wrong string (1)",
        "p Implementation-Title",
        p.getImplementationTitle());
    assertEquals(
        "Package getImplementationVendor returns a wrong string (1)",
        "p Implementation-Vendor",
        p.getImplementationVendor());
    assertEquals(
        "Package getImplementationVersion returns a wrong string (1)",
        "2.2.2",
        p.getImplementationVersion());
    assertEquals(
        "Package getSpecificationTitle returns a wrong string (1)",
        "p Specification-Title",
        p.getSpecificationTitle());
    assertEquals(
        "Package getSpecificationVendor returns a wrong string (1)",
        "p Specification-Vendor",
        p.getSpecificationVendor());
    assertEquals(
        "Package getSpecificationVersion returns a wrong string (1)",
        "2.2.2",
        p.getSpecificationVersion());

    // No entry for the package
    Package p2 = getTestPackage("hyts_no_entry.jar", "p.C");
    assertEquals(
        "Package getImplementationTitle returns a wrong string (2)",
        "MF Implementation-Title",
        p2.getImplementationTitle());
    assertEquals(
        "Package getImplementationVendor returns a wrong string (2)",
        "MF Implementation-Vendor",
        p2.getImplementationVendor());
    assertEquals(
        "Package getImplementationVersion returns a wrong string (2)",
        "5.3.b1",
        p2.getImplementationVersion());
    assertEquals(
        "Package getSpecificationTitle returns a wrong string (2)",
        "MF Specification-Title",
        p2.getSpecificationTitle());
    assertEquals(
        "Package getSpecificationVendor returns a wrong string (2)",
        "MF Specification-Vendor",
        p2.getSpecificationVendor());
    assertEquals(
        "Package getSpecificationVersion returns a wrong string (2)",
        "1.2.3",
        p2.getSpecificationVersion());

    // No attributes in the package entry
    Package p3 = getTestPackage("hyts_no_attributes.jar", "p.C");
    assertEquals(
        "Package getImplementationTitle returns a wrong string (3)",
        "MF Implementation-Title",
        p3.getImplementationTitle());
    assertEquals(
        "Package getImplementationVendor returns a wrong string (3)",
        "MF Implementation-Vendor",
        p3.getImplementationVendor());
    assertEquals(
        "Package getImplementationVersion returns a wrong string (3)",
        "5.3.b1",
        p3.getImplementationVersion());
    assertEquals(
        "Package getSpecificationTitle returns a wrong string (3)",
        "MF Specification-Title",
        p3.getSpecificationTitle());
    assertEquals(
        "Package getSpecificationVendor returns a wrong string (3)",
        "MF Specification-Vendor",
        p3.getSpecificationVendor());
    assertEquals(
        "Package getSpecificationVersion returns a wrong string (3)",
        "1.2.3",
        p3.getSpecificationVersion());

    // Some attributes in the package entry
    Package p4 = getTestPackage("hyts_some_attributes.jar", "p.C");
    assertEquals(
        "Package getImplementationTitle returns a wrong string (4)",
        "p Implementation-Title",
        p4.getImplementationTitle());
    assertEquals(
        "Package getImplementationVendor returns a wrong string (4)",
        "MF Implementation-Vendor",
        p4.getImplementationVendor());
    assertEquals(
        "Package getImplementationVersion returns a wrong string (4)",
        "2.2.2",
        p4.getImplementationVersion());
    assertEquals(
        "Package getSpecificationTitle returns a wrong string (4)",
        "MF Specification-Title",
        p4.getSpecificationTitle());
    assertEquals(
        "Package getSpecificationVendor returns a wrong string (4)",
        "p Specification-Vendor",
        p4.getSpecificationVendor());
    assertEquals(
        "Package getSpecificationVersion returns a wrong string (4)",
        "2.2.2",
        p4.getSpecificationVersion());

    // subdirectory Package
    Package p5 = getTestPackage("hyts_pq.jar", "p.q.C");
    assertEquals(
        "Package getImplementationTitle returns a wrong string (5)",
        "p Implementation-Title",
        p5.getImplementationTitle());
    assertEquals(
        "Package getImplementationVendor returns a wrong string (5)",
        "p Implementation-Vendor",
        p5.getImplementationVendor());
    assertEquals(
        "Package getImplementationVersion returns a wrong string (5)",
        "1.1.3",
        p5.getImplementationVersion());
    assertEquals(
        "Package getSpecificationTitle returns a wrong string (5)",
        "p Specification-Title",
        p5.getSpecificationTitle());
    assertEquals(
        "Package getSpecificationVendor returns a wrong string (5)",
        "p Specification-Vendor",
        p5.getSpecificationVendor());
    assertEquals(
        "Package getSpecificationVersion returns a wrong string (5)",
        "2.2.0.0.0.0.0.0.0.0.0",
        p5.getSpecificationVersion());
  }