public void start() throws GaspException { checkInitDone(); log.debug("Starting application"); final Package pkg = getClass().getPackage(); final String title = pkg.getSpecificationTitle(); final String version = pkg.getSpecificationVersion(); if (!StringUtils.isBlank(title) && !StringUtils.isBlank(version)) { // print version in the log log.info("Using: " + title + " " + version); } final PluginRegistry pluginRegistry = PluginManager.instance().getPluginRegistry(); for (final String pluginDesc : pluginsToStart) { try { final String pluginId = getPluginId(pluginDesc); final Version pluginVersion = getPluginVersion(pluginDesc); pluginRegistry.activate(pluginId, pluginVersion); } catch (Exception e) { throw new GaspException("Error while starting plugin: " + pluginDesc, e); } } log.info("Platform is up and running"); }
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(); }
/** * @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()); }
@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()); }
public static void main(String[] args) { if (args.length < 1) { try { Package p = Package.getPackage("dmg.cells.nucleus"); if (p != null) { String tmp = p.getSpecificationTitle(); System.out.println("SpecificationTitle: " + (tmp == null ? "(Unknown)" : tmp)); tmp = p.getSpecificationVendor(); System.out.println("SpecificationVendor: " + (tmp == null ? "(Unknown)" : tmp)); tmp = p.getSpecificationVersion(); System.out.println("SpecificationVersion: " + (tmp == null ? "(Unknown)" : tmp)); } } catch (Exception ee) { } System.out.println("USAGE : <domainName> [options]"); System.out.println( " -telnet \"<telnetPort> [-acm=acm] " + "[-localOk] [-passwd=<passwd>]\""); System.out.println(" -tunnel(2) <tunnelPort>"); System.out.println(" -connect(2) <host> <port>"); System.out.println(" -routed"); System.out.println(" -batch <fileName>"); System.out.println(" -boot <bootDomain>"); System.out.println(" -spy <spyListenPort>"); System.out.println(" -ic <interruptHandlerClass>"); System.out.println(" -param <key>=<value> [...]"); System.out.println(" -acm <userDbRoot>"); System.out.println(" -connectDomain <domainName>"); System.out.println(" -accept"); System.out.println(" -lm [<hostname>] <portNumber> [options]"); System.out.println(" Options : /noclient /noboot /strict=yes|no"); System.out.println(" -debug [full]"); System.out.println(" -cp <cellPrinterCellName>"); System.exit(1); } // // split the rest of the arguments into rows and columns // according to the requests // int state = IDLE; Vector<String> columns = null; Vector<String[]> rowVec = new Vector<>(); for (int pos = 1; pos < args.length; ) { switch (state) { case IDLE: if (args[pos].charAt(0) == '-') { columns = new Vector<>(); columns.addElement(args[pos]); state = ASSEMBLE; } pos++; break; case ASSEMBLE: if (args[pos].charAt(0) == '-') { String[] col = new String[columns.size()]; columns.copyInto(col); rowVec.addElement(col); state = IDLE; } else { columns.addElement(args[pos++]); } break; } } if (state == ASSEMBLE) { String[] col = new String[columns.size()]; columns.copyInto(col); rowVec.addElement(col); } Hashtable<String, String[]> argHash = new Hashtable<>(); for (int i = 0; i < rowVec.size(); i++) { String[] el = rowVec.elementAt(i); argHash.put(el[0], el); } /* Enumeration e = argHash.keys() ; for( ; e.hasMoreElements() ; ){ String key = (String) e.nextElement() ; String []ar = (String []) argHash.get( key ) ; System.out.print( key+" : " ) ; for( int j = 0 ; j < ar.length ; j++ ) System.out.print( ar[j]+"," ) ; System.out.println(""); } */ // // SystemCell systemCell; try { // // start the system cell // systemCell = new SystemCell(args[0]); String[] tmp; // if (argHash.get("-version") != null) { Package p = Package.getPackage("dmg.cells.nucleus"); System.out.println(p.toString()); System.exit(0); } // // if (((tmp = argHash.get("-param")) != null) && (tmp.length > 1)) { String[][] parameters = getParameter(tmp); Map<String, Object> dict = systemCell.getDomainContext(); for (String[] parameter : parameters) { dict.put(parameter[0], parameter[1]); } } if ((tmp = argHash.get("-debug")) != null) { _log.info("Starting DebugSequence"); List<String> v = new ArrayList<>(); if ((tmp.length > 1) && (tmp[1].equals("full"))) { v.add("set printout CellGlue all"); v.add("set printout default all"); } else { v.add("set printout default 3"); } String[] commands = new String[v.size()]; new BatchCell("debug", v.toArray(commands)); } if ((tmp = argHash.get("-cp")) != null) { StringBuilder sb = new StringBuilder(); for (int i = 1; i < tmp.length; i++) { sb.append(" "); if (tmp[i].startsWith("/")) { sb.append("-").append(tmp[i].substring(1)); } else { sb.append(tmp[i]); } } String a = sb.toString(); _log.info("Loading new CellPrinter " + a); List<String> v = new ArrayList<>(); v.add("load cellprinter " + a); String[] commands = new String[v.size()]; new BatchCell("cellprinter", v.toArray(commands)); } if (argHash.get("-routed") != null) { _log.info("Starting Routing Manager"); new RoutingManager("RoutingMgr", "up0"); } if (((tmp = argHash.get("-lm")) != null) && (tmp.length > 1)) { StringBuilder sb = new StringBuilder(); for (int i = 1; i < tmp.length; i++) { sb.append(" "); if (tmp[i].startsWith("/")) { sb.append("-").append(tmp[i].substring(1)); } else { sb.append(tmp[i]); } } String a = sb.toString(); _log.info("Installing LocationManager '" + a + "'"); new LocationManager("lm", a); new RoutingManager("RoutingMgr", ""); } if (argHash.get("-silent") != null) { _log.info("Starting Silent Sequence"); List<String> v = new ArrayList<>(); v.add("set printout CellGlue none"); v.add("set printout default none"); String[] commands = new String[v.size()]; new BatchCell("silent", v.toArray(commands)); } if (((tmp = argHash.get("-telnet")) != null) && (tmp.length > 1)) { StringBuilder sb = new StringBuilder(); // // the port number class and protocol // sb.append(tmp[1]).append(" dmg.cells.services.StreamLoginCell").append(" -prot=telnet "); // // and possible options // for (int i = 3; i < tmp.length; i++) { sb.append(" -").append(tmp[i]); } _log.info("Starting LoginManager (telnet) on " + sb.toString()); new LoginManager("tlm", sb.toString()); } if (((tmp = argHash.get("-tunnel2")) != null) && (tmp.length > 1)) { StringBuilder sb = new StringBuilder(); // // the port number class and protocol // sb.append(tmp[1]).append(" dmg.cells.network.RetryTunnel2").append(" -prot=raw "); // // and possible options // for (int i = 3; i < tmp.length; i++) { sb.append(" -").append(tmp[i]); } _log.info("Starting RetryTunnel2 (raw) on " + sb.toString()); new LoginManager("down", sb.toString()); } if (((tmp = argHash.get("-connect")) != null) && (tmp.length > 2)) { _log.info("Starting RetryTunnel on " + tmp[1] + " " + tmp[2]); new RetryTunnel("up0", tmp[1] + " " + tmp[2]); } if (((tmp = argHash.get("-connect2")) != null) && (tmp.length > 2)) { _log.info("Starting RetryTunnel2 on " + tmp[1] + " " + tmp[2]); new RetryTunnel2("up0", tmp[1] + " " + tmp[2]); } if (((tmp = argHash.get("-connectDomain")) != null) && (tmp.length > 1)) { _log.info("Starting LocationMgrTunnel on " + tmp[1]); new LocationManagerConnector("upD", "-lm=lm " + "-domain=" + tmp[1]); } if (((tmp = argHash.get("-acm")) != null) && (tmp.length > 1)) { _log.info("Starting UserMgrCell on " + tmp[1]); new UserMgrCell("acm", tmp[1]); } if (((tmp = argHash.get("-tunnel")) != null) && (tmp.length > 1)) { _log.info("Starting RetryTunnel on " + tmp[1]); new GNLCell("down", "dmg.cells.network.RetryTunnel " + tmp[1]); } if (((tmp = argHash.get("-accept")) != null) && (tmp.length > 0)) { _log.info("Starting LocationMgrTunnel(listen)"); new LoginManager("downD", "0 dmg.cells.network.LocationMgrTunnel " + "-prot=raw -lm=lm"); } if (((tmp = argHash.get("-boot")) != null) && (tmp.length > 1)) { _log.info("Starting BootSequence for Domain " + tmp[1]); List<String> v = new ArrayList<>(); v.add("onerror shutdown"); v.add("set context bootDomain " + tmp[1]); v.add("waitfor context Ready ${bootDomain}"); v.add("copy context://${bootDomain}/${thisDomain}Setup context:bootStrap"); v.add("exec context bootStrap"); v.add("# exit"); String[] commands = new String[v.size()]; new BatchCell("boot", v.toArray(commands)); } if (((tmp = argHash.get("-spy")) != null) && (tmp.length > 1)) { _log.info("Starting TopologyManager "); new TopoCell("topo", ""); _log.info("Starting Spy Listener on " + tmp[1]); new LoginManager("Spy", tmp[1] + " dmg.cells.services.ObjectLoginCell" + " -prot=raw"); } if (((tmp = argHash.get("-batch")) != null) && (tmp.length > 1)) { _log.info("Starting BatchCell on " + tmp[1]); new BatchCell("batch", tmp[1]); } if (((tmp = argHash.get("-ic")) != null) && (tmp.length > 1)) { _log.info("Installing interruptHandlerClass " + tmp[1]); systemCell.enableInterrupts(tmp[1]); } } catch (Exception e) { _log.error(e.toString(), e); } }
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()); }
/** @return the specification title from Hazelast */ public String getAdapterShortDescription() { return HZ_PACKAGE.getSpecificationTitle(); }