コード例 #1
0
  /**
   * Appends WMS tiled image layer configuration elements to the superclass configuration document.
   *
   * @param params configuration parameters describing this WMS tiled image layer.
   * @return a WMS tiled image layer configuration document.
   */
  protected Document createConfigurationDocument(AVList params) {

    Document doc = super.createConfigurationDocument(params);
    if (doc == null || doc.getDocumentElement() == null) return doc;

    LayerConfiguration.createWMSTiledImageLayerElements(params, doc.getDocumentElement());

    return doc;
  }
コード例 #2
0
  public ArrayList<String> parseXML() throws Exception {
    ArrayList<String> ret = new ArrayList<String>();

    handshake();

    URL url =
        new URL(
            "http://mangaonweb.com/page.do?cdn="
                + cdn
                + "&cpn=book.xml&crcod="
                + crcod
                + "&rid="
                + (int) (Math.random() * 10000));
    String page = DownloaderUtils.getPage(url.toString(), "UTF-8", cookies);

    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    InputSource is = new InputSource(new StringReader(page));
    Document d = builder.parse(is);
    Element doc = d.getDocumentElement();

    NodeList pages = doc.getElementsByTagName("page");
    total = pages.getLength();
    for (int i = 0; i < pages.getLength(); i++) {
      Element e = (Element) pages.item(i);
      ret.add(e.getAttribute("path"));
    }

    return (ret);
  }
コード例 #3
0
ファイル: MetatypeTest.java プロジェクト: vikchilu/bnd
  public static void testEnum() throws Exception {
    Builder b = new Builder();
    b.addClasspath(new File("bin"));
    b.setProperty("Export-Package", "test.metatype");
    b.setProperty("-metatype", "*");
    b.build();
    assertEquals(0, b.getErrors().size());
    assertEquals(0, b.getWarnings().size());

    Resource r = b.getJar().getResource("OSGI-INF/metatype/test.metatype.MetatypeTest$Enums.xml");
    IO.copy(r.openInputStream(), System.err);

    Document d = db.parse(r.openInputStream());
    assertEquals(
        "http://www.osgi.org/xmlns/metatype/v1.1.0", d.getDocumentElement().getNamespaceURI());

    Properties p = new Properties();
    p.setProperty("r", "requireConfiguration");
    p.setProperty("i", "ignoreConfiguration");
    p.setProperty("o", "optionalConfiguration");
    Enums enums = Configurable.createConfigurable(Enums.class, (Map<Object, Object>) p);
    assertEquals(Enums.X.requireConfiguration, enums.r());
    assertEquals(Enums.X.ignoreConfiguration, enums.i());
    assertEquals(Enums.X.optionalConfiguration, enums.o());
  }
コード例 #4
0
 public void load(InputStream is) throws IOException, ParserConfigurationException, SAXException {
   doc = db.parse(is);
   docElt = doc.getDocumentElement();
   if (docElt.getTagName().equals(docElementName)) {
     NodeList nl = docElt.getElementsByTagName(trackElementName);
     for (int i = 0; i < nl.getLength(); i++) {
       Element elt = (Element) nl.item(i);
       Track track = new Track(elt);
       tracks.add(track);
       hash.put(track.getKey(), track);
     }
   }
 }
コード例 #5
0
  @Override
  public VPackage parse() {

    logger.debug("Starting parsing package: " + xmlFile.getAbsolutePath());

    long startParsing = System.currentTimeMillis();

    try {
      Document document = getDocument();
      Element root = document.getDocumentElement();

      _package = new VPackage(xmlFile);

      Node name = root.getElementsByTagName(EL_NAME).item(0);
      _package.setName(name.getTextContent());
      Node descr = root.getElementsByTagName(EL_DESCRIPTION).item(0);
      _package.setDescription(descr.getTextContent());

      NodeList list = root.getElementsByTagName(EL_CLASS);

      boolean initPainters = false;
      for (int i = 0; i < list.getLength(); i++) {
        PackageClass pc = parseClass((Element) list.item(i));
        if (pc.getPainterName() != null) {
          initPainters = true;
        }
      }

      if (initPainters) {
        _package.initPainters();
      }

      logger.info(
          "Parsing the package '{}' finished in {}ms.\n",
          _package.getName(),
          (System.currentTimeMillis() - startParsing));
    } catch (Exception e) {
      collector.collectDiagnostic(e.getMessage(), true);
      if (RuntimeProperties.isLogDebugEnabled()) {
        e.printStackTrace();
      }
    }

    try {
      checkProblems("Error parsing package file " + xmlFile.getName());
    } catch (Exception e) {
      return null;
    }

    return _package;
  }
コード例 #6
0
  /** used for cut and paste. */
  public void addObjectFromClipboard(String a_value) throws CircularIncludeException {
    Reader reader = new StringReader(a_value);
    Document document = null;
    try {
      document = UJAXP.getDocument(reader);
    } catch (Exception e) {
      e.printStackTrace();
      return;
    } // try-catch

    Element root = document.getDocumentElement();
    if (!root.getNodeName().equals("clipboard")) {
      return;
    } // if

    Node child;
    for (child = root.getFirstChild(); child != null; child = child.getNextSibling()) {
      if (!(child instanceof Element)) {
        continue;
      } // if
      Element element = (Element) child;

      IGlyphFactory factory = GlyphFactory.getFactory();

      if (XModule.isMatch(element)) {
        EModuleInvoke module = (EModuleInvoke) factory.createXModule(element);
        addModule(module);
        continue;
      } // if

      if (XContour.isMatch(element)) {
        EContour contour = (EContour) factory.createXContour(element);
        addContour(contour);
        continue;
      } // if

      if (XInclude.isMatch(element)) {
        EIncludeInvoke include = (EIncludeInvoke) factory.createXInclude(element);
        addInclude(include);
        continue;
      } // if
    } // while
  }
コード例 #7
0
 public WMSTiledImageLayer(Document dom, AVList params) {
   this(dom.getDocumentElement(), params);
 }
コード例 #8
0
  public void addPackageClass(PackageClass pClass) {

    Document doc;
    try {
      doc = getDocument();
    } catch (Exception e) {
      e.printStackTrace();
      return;
    }

    String name = pClass.getName();

    // check if such class exists and remove duplicates
    Element rootEl = doc.getDocumentElement();
    NodeList classEls = rootEl.getElementsByTagName(EL_CLASS);
    for (int i = 0; i < classEls.getLength(); i++) {
      Element nameEl = getElementByName((Element) classEls.item(i), EL_NAME);
      if (name.equals(nameEl.getTextContent())) {
        rootEl.removeChild(classEls.item(i));
      }
    }

    Element classNode = doc.createElement(EL_CLASS);
    doc.getDocumentElement().appendChild(classNode);
    classNode.setAttribute(ATR_TYPE, PackageClass.ComponentType.SCHEME.getXmlName());
    classNode.setAttribute(ATR_STATIC, "false");

    Element className = doc.createElement(EL_NAME);
    className.setTextContent(name);
    classNode.appendChild(className);

    Element desrc = doc.createElement(EL_DESCRIPTION);
    desrc.setTextContent(pClass.getDescription());
    classNode.appendChild(desrc);

    Element icon = doc.createElement(EL_ICON);
    icon.setTextContent(pClass.getIcon());
    classNode.appendChild(icon);

    // graphics
    classNode.appendChild(generateGraphicsNode(doc, pClass.getGraphics()));

    // ports
    List<Port> ports = pClass.getPorts();
    if (!ports.isEmpty()) {
      Element portsEl = doc.createElement(EL_PORTS);
      classNode.appendChild(portsEl);

      for (Port port : ports) {
        portsEl.appendChild(generatePortNode(doc, port));
      }
    }

    // fields
    Collection<ClassField> fields = pClass.getFields();
    if (!fields.isEmpty()) {
      Element fieldsEl = doc.createElement(EL_FIELDS);
      classNode.appendChild(fieldsEl);

      for (ClassField cf : fields) {
        fieldsEl.appendChild(generateFieldNode(doc, cf));
      }
    }

    // write
    try {
      writeDocument(doc, new FileOutputStream(xmlFile));
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
  }
コード例 #9
0
ファイル: PathMonitor.java プロジェクト: krichter/pathmonitor
  public static void main(String[] args) {
    String specloc = System.getProperty("spec");
    if (specloc == null) {
      System.out.print("No spec file given, quitting");
      System.exit(0);
    }

    DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss z");
    java.util.Date date = new java.util.Date();
    String startstamp = dateFormat.format(date);

    boolean firstrun = true;

    while (true) {
      System.out.println("Loading XML Spec file: " + specloc);
      // BufferedWriter out = null;
      SocketAcceptor acceptor = null;
      SocketAcceptor statusacceptor = null;

      Vector<MonitorThread> monitorlist = new Vector<MonitorThread>();
      try {
        DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
        Document doc = docBuilder.parse(new File(specloc));

        doc.getDocumentElement().normalize();
        String heartbeatportString = doc.getDocumentElement().getAttribute("heartbeatport");
        String statusportString = doc.getDocumentElement().getAttribute("statusport");
        String logfiledir = doc.getDocumentElement().getAttribute("logfiledir");
        String masterlabel = doc.getDocumentElement().getAttribute("label");
        String nodeid = doc.getDocumentElement().getAttribute("id");
        String smtphost = doc.getDocumentElement().getAttribute("smtphost");
        String l1mailto = doc.getDocumentElement().getAttribute("l1mailto");
        String l2mailto = doc.getDocumentElement().getAttribute("l2mailto");
        String l2threshold = doc.getDocumentElement().getAttribute("l2threshold");

        if (heartbeatportString == null || heartbeatportString.equals("")) {
          System.out.println("No heartbeat specified in spec, quitting");
          System.exit(0);
        }
        if (statusportString == null || statusportString.equals("")) {
          System.out.println("No status port specified in spec, quitting");
          System.exit(0);
        }
        if (logfiledir == null || logfiledir.equals("")) {
          System.out.println("No logfile directory location specified in spec, quitting");
          System.exit(0);
        }

        int heartbeatport = Integer.valueOf(heartbeatportString).intValue();
        System.out.println("This Monitor is using port " + heartbeatport + " for heartbeat");

        int statusport = Integer.valueOf(statusportString).intValue();
        System.out.println("This Monitor is using port " + statusport + " for status updates");

        System.out.println("Logging to directory " + logfiledir);
        Log log = new Log(logfiledir);
        log.nodelabel = masterlabel;
        log.setMailer(smtphost, l1mailto, l2mailto, convertStringToInt(l2threshold));

        if (firstrun) {
          firstrun = false;
          log.logit("Monitor Node Started", "start", null);
        }
        log.logit("Logging started", "", null);

        ThreadPing threadping = new ThreadPing(log, false);
        Thread pinger = new Thread(threadping);
        threadping.thisThread = pinger;
        pinger.start();
        log.pinger = threadping;

        // ShutdownHook hook = new ShutdownHook(out);
        // Runtime.getRuntime().addShutdownHook(hook);

        // Starting Heartbeat server

        acceptor = new NioSocketAcceptor();
        acceptor.getSessionConfig().setReuseAddress(true);
        acceptor.getSessionConfig().setTcpNoDelay(true);
        acceptor.setReuseAddress(true);
        // acceptor.getFilterChain().addLast("logger", new LoggingFilter());
        acceptor
            .getFilterChain()
            .addLast(
                "codec",
                new ProtocolCodecFilter(new TextLineCodecFactory(Charset.forName("UTF-8"))));
        acceptor.setReuseAddress(true);
        // acceptor.setCloseOnDeactivation(true);
        acceptor.getSessionConfig().setTcpNoDelay(true);

        acceptor.setDefaultLocalAddress(new InetSocketAddress(heartbeatport));
        Vector<IoSession> sessionlist = new Vector<IoSession>();
        acceptor.setHandler(new HeartBeatHandler(sessionlist));
        acceptor.bind();

        // Starting Path Monitoring
        NodeList listOfServers = doc.getElementsByTagName("check");
        int totalServers = listOfServers.getLength();
        System.out.println("Total # of checks: " + totalServers);

        // Vector<PingMonitorThread> pinglist = new Vector<PingMonitorThread>();
        // Vector<PortMonitorThread> portlist = new Vector<PortMonitorThread>();
        // Vector<HeartbeatMonitorThread> heartbeatlist = new Vector<HeartbeatMonitorThread>();

        System.out.println();
        for (int i = 0; i < totalServers; i++) {
          Node serverNode = listOfServers.item(i);

          Element serverNodeElement = (Element) serverNode;
          String checklabel = serverNodeElement.getAttribute("label");
          String host =
              serverNodeElement
                  .getElementsByTagName("host")
                  .item(0)
                  .getChildNodes()
                  .item(0)
                  .getNodeValue();
          String checktype =
              serverNodeElement
                  .getElementsByTagName("checktype")
                  .item(0)
                  .getChildNodes()
                  .item(0)
                  .getNodeValue();
          boolean enabled = true;
          if (serverNodeElement.getElementsByTagName("enabled").item(0) != null
              && serverNodeElement
                  .getElementsByTagName("enabled")
                  .item(0)
                  .getChildNodes()
                  .item(0)
                  .getNodeValue()
                  .toLowerCase()
                  .equals("false")) {
            enabled = false;
          }
          String successrateString =
              serverNodeElement
                  .getElementsByTagName("successrate")
                  .item(0)
                  .getChildNodes()
                  .item(0)
                  .getNodeValue();
          String retryrateString =
              serverNodeElement
                  .getElementsByTagName("retryrate")
                  .item(0)
                  .getChildNodes()
                  .item(0)
                  .getNodeValue();
          // String l2thresholdoverride =
          // serverNodeElement.getElementsByTagName("l2threshold").item(0).getChildNodes().item(0).getNodeValue();
          String l2thresholdoverride = getElementValue("l2threshold", serverNodeElement);
          // String l1mailtoadd =
          // serverNodeElement.getElementsByTagName("l1mailto").item(0).getChildNodes().item(0).getNodeValue();
          String l1mailtoadd = getElementValue("l1mailto", serverNodeElement);
          // String l2mailtoadd =
          // serverNodeElement.getElementsByTagName("l2mailto").item(0).getChildNodes().item(0).getNodeValue();
          String l2mailtoadd = getElementValue("l2mailto", serverNodeElement);

          int l2thresholdoverrideint = convertStringToInt(l2thresholdoverride);
          String[] l1mailtoaddarray = new String[0];
          String[] l2mailtoaddarray = new String[0];
          if (!l1mailtoadd.equals("")) {
            l1mailtoaddarray = l1mailtoadd.split(",");
          }
          if (!l2mailtoadd.equals("")) {
            l2mailtoaddarray = l2mailtoadd.split(",");
          }

          // System.out.println(l1mailtoaddarray.length + "-" + l2mailtoaddarray.length);

          int successrate = 30;
          int retryrate = 30;
          if (host == null || host.equals("")) {
            System.out.println("No Host, skipping this path");
            enabled = false;
          }

          if (successrateString == null || successrateString.equals("")) {
            System.out.println(
                "No Success Rate defined, using default (" + successrate + " seconds)");
          } else {
            successrate = Integer.valueOf(successrateString).intValue();
          }

          if (retryrateString == null || retryrateString.equals("")) {
            System.out.println("No retry rate defined, using default (" + retryrate + " seconds)");
          } else {
            retryrate = Integer.valueOf(retryrateString).intValue();
          }

          System.out.println(checklabel);

          if (checktype.equals("heartbeat")) {
            String portString =
                serverNodeElement
                    .getElementsByTagName("port")
                    .item(0)
                    .getChildNodes()
                    .item(0)
                    .getNodeValue();

            if (portString == null || portString.equals("")) {
              System.out.println("No Heartbeat, skipping this path");
            } else {
              int heartbeat = Integer.valueOf(portString).intValue();
              System.out.println("Starting Heartbeat Check:");
              System.out.println("Host: " + host);
              System.out.println("Port: " + heartbeat);
              System.out.println();
              HeartbeatMonitorThread m =
                  new HeartbeatMonitorThread(
                      host, heartbeat, log, successrate, retryrate, checklabel);
              m.setAlertOverride(l2thresholdoverrideint, l1mailtoaddarray, l2mailtoaddarray);
              Thread t = new Thread(m);
              m.thisthread = t;
              if (enabled) {
                t.start();
                log.logit(
                    "Starting Heartbeat Check - " + host + ":" + heartbeat,
                    "enable-" + successrate + "-" + retryrate,
                    m.getStatus());
              } else {
                log.logit(
                    "Heartbeat Check - " + host + ":" + heartbeat + " Disabled on start",
                    "disable",
                    m.getStatus());
              }
              monitorlist.add(m);
            }
          } else if (checktype.equals("ping")) {
            System.out.println("Starting Ping Check:");
            System.out.println("Host: " + host);
            System.out.println();
            PingMonitorThread m =
                new PingMonitorThread(host, log, successrate, retryrate, checklabel);
            m.setAlertOverride(l2thresholdoverrideint, l1mailtoaddarray, l2mailtoaddarray);
            Thread t = new Thread(m);
            m.thisthread = t;
            if (enabled) {
              t.start();
              log.logit(
                  "Starting Ping Check - " + host,
                  "enable-" + successrate + "-" + retryrate,
                  m.getStatus());
            } else {
              log.logit("Ping Check - " + host + " Disabled on start", "disable", m.getStatus());
            }
            monitorlist.add(m);
          } else if (checktype.equals("port")) {
            String portString =
                serverNodeElement
                    .getElementsByTagName("port")
                    .item(0)
                    .getChildNodes()
                    .item(0)
                    .getNodeValue();

            if (portString == null || portString.equals("")) {
              System.out.println("No Port Given, skipping");
            } else {
              int heartbeat = Integer.valueOf(portString).intValue();
              System.out.println("Starting Port Check:");
              System.out.println("Host: " + host);
              System.out.println("Port: " + heartbeat);
              System.out.println();

              PortMonitorThread m =
                  new PortMonitorThread(host, heartbeat, log, successrate, retryrate, checklabel);
              m.setAlertOverride(l2thresholdoverrideint, l1mailtoaddarray, l2mailtoaddarray);
              Thread t = new Thread(m);
              m.thisthread = t;
              if (enabled) {
                t.start();
                log.logit(
                    "Starting Port Check - " + host + ":" + heartbeat,
                    "enable-" + successrate + "-" + retryrate,
                    m.getStatus());
              } else {
                log.logit(
                    "Port Check - " + host + ":" + heartbeat + " Disabled on start",
                    "disable",
                    m.getStatus());
              }
              monitorlist.add(m);
            }
          }
        }

        statusacceptor = new NioSocketAcceptor();
        statusacceptor.setReuseAddress(true);
        // statusacceptor.getFilterChain().addLast("logger", new LoggingFilter());
        statusacceptor.getSessionConfig().setTcpNoDelay(true);
        statusacceptor.getSessionConfig().setKeepAlive(true);
        statusacceptor.getSessionConfig().setBothIdleTime(5);
        statusacceptor.getSessionConfig().setReaderIdleTime(5);
        statusacceptor.getSessionConfig().setWriteTimeout(5);
        // statusacceptor.setReuseAddress(true);
        statusacceptor.setCloseOnDeactivation(true);
        statusacceptor.setDefaultLocalAddress(new InetSocketAddress(statusport));
        statusacceptor.setHandler(
            new StatusHttpProtocolHandler(
                monitorlist,
                acceptor,
                statusacceptor,
                log,
                masterlabel,
                nodeid,
                sessionlist,
                startstamp));
        statusacceptor.bind();

        System.out.println("Status Listener activated...");
      } catch (Exception e) {
        e.printStackTrace();
        try {
          // out.flush();
          // out.close();
        } catch (Exception e2) {
        }

        try {
          Thread.sleep(30000);
        } catch (Exception e3) {
        }
      }

      for (int x = 0; x < monitorlist.size(); x++) {
        if (monitorlist.get(x).getThisThread() != null) {
          try {
            monitorlist.get(x).getThisThread().join();
          } catch (Exception e) {
          }
        }
      }

      if (acceptor != null) {
        while (acceptor.isActive() || !acceptor.isDisposed()) {
          try {
            Thread.sleep(1000);
          } catch (Exception e) {
          }
        }
      }

      if (statusacceptor != null) {
        while (statusacceptor.isActive() || !statusacceptor.isDisposed()) {
          try {
            Thread.sleep(1000);
          } catch (Exception e) {
          }
        }
      }
      System.out.println("Main thread has reached end, reloading...");
      /*
      try
      {
      	Thread.sleep(9999999);
      }
      catch (Exception e)
      {
      	e.printStackTrace();
      }
      */
    }
  }
コード例 #10
0
ファイル: MetatypeTest.java プロジェクト: vikchilu/bnd
  public static void testNaming() throws Exception {
    Map<String, Object> map = Create.map();

    map.put("_secret", "_secret");
    map.put("_secret", "_secret");
    map.put(".secret", ".secret");
    map.put("$new", "$new");
    map.put("new", "new");
    map.put("secret", "secret");
    map.put("a_b_c", "a_b_c");
    map.put("a.b.c", "a.b.c");
    map.put(".a_b", ".a_b");
    map.put("$$$$a_b", "$$$$a_b");
    map.put("$$$$a.b", "$$$$a.b");
    map.put("a", "a");
    map.put("a$", "a$");
    map.put("a$$", "a$$");
    map.put("a$.$", "a$.$");
    map.put("a$_$", "a$_$");
    map.put("a..", "a..");
    map.put("noid", "noid");
    map.put("nullid", "nullid");

    Naming trt = Configurable.createConfigurable(Naming.class, map);

    // By name
    assertEquals("secret", trt.secret());
    assertEquals("_secret", trt.__secret());
    assertEquals(".secret", trt._secret());
    assertEquals("new", trt.$new());
    assertEquals("$new", trt.$$new());
    assertEquals("a.b.c", trt.a_b_c());
    assertEquals("a_b_c", trt.a__b__c());
    assertEquals(".a_b", trt._a__b());
    assertEquals("$$$$a.b", trt.$$$$$$$$a_b());
    assertEquals("$$$$a_b", trt.$$$$$$$$a__b());
    assertEquals("a", trt.a$());
    assertEquals("a$", trt.a$$());
    assertEquals("a$", trt.a$$$());
    assertEquals("a$.$", trt.a$$_$$());
    assertEquals("a$_$", trt.a$$__$$());
    assertEquals("a..", trt.a_$_());
    assertEquals("noid", trt.noid());
    assertEquals("nullid", trt.nullid());

    // By AD
    assertEquals("secret", trt.xsecret());
    assertEquals("_secret", trt.x__secret());
    assertEquals(".secret", trt.x_secret());
    assertEquals("new", trt.x$new());
    assertEquals("$new", trt.x$$new());
    assertEquals("a.b.c", trt.xa_b_c());
    assertEquals("a_b_c", trt.xa__b__c());
    assertEquals(".a_b", trt.x_a__b());
    assertEquals("$$$$a.b", trt.x$$$$$$$$a_b());
    assertEquals("$$$$a_b", trt.x$$$$$$$$a__b());
    assertEquals("a", trt.xa$());
    assertEquals("a$", trt.xa$$());
    assertEquals("a$", trt.xa$$$());
    assertEquals("a$.$", trt.xa$$_$$());

    Builder b = new Builder();
    b.addClasspath(new File("bin"));
    b.setProperty("Export-Package", "test.metatype");
    b.setProperty("-metatype", "*");
    b.build();
    assertEquals(0, b.getErrors().size());
    assertEquals(0, b.getWarnings().size());

    Resource r = b.getJar().getResource("OSGI-INF/metatype/test.metatype.MetatypeTest$Naming.xml");
    IO.copy(r.openInputStream(), System.err);
    Document d = db.parse(r.openInputStream(), "UTF-8");
    assertEquals(
        "http://www.osgi.org/xmlns/metatype/v1.1.0", d.getDocumentElement().getNamespaceURI());
  }
コード例 #11
0
ファイル: MetatypeTest.java プロジェクト: vikchilu/bnd
  public static void testReturnTypes() throws Exception {
    Builder b = new Builder();
    b.addClasspath(new File("bin"));
    b.setProperty("Export-Package", "test.metatype");
    b.setProperty("-metatype", "*");
    b.build();
    Resource r =
        b.getJar().getResource("OSGI-INF/metatype/test.metatype.MetatypeTest$TestReturnTypes.xml");
    assertEquals(0, b.getErrors().size());
    assertEquals(0, b.getWarnings().size());
    System.err.println(b.getJar().getResources().keySet());
    assertNotNull(r);
    IO.copy(r.openInputStream(), System.err);

    Document d = db.parse(r.openInputStream());
    assertEquals(
        "http://www.osgi.org/xmlns/metatype/v1.1.0", d.getDocumentElement().getNamespaceURI());
    // Primitives
    assertEquals("Boolean", xpath.evaluate("//OCD/AD[@id='rpBoolean']/@type", d));
    assertEquals("Byte", xpath.evaluate("//OCD/AD[@id='rpByte']/@type", d));
    assertEquals("Character", xpath.evaluate("//OCD/AD[@id='rpCharacter']/@type", d));
    assertEquals("Short", xpath.evaluate("//OCD/AD[@id='rpShort']/@type", d));
    assertEquals("Integer", xpath.evaluate("//OCD/AD[@id='rpInt']/@type", d));
    assertEquals("Long", xpath.evaluate("//OCD/AD[@id='rpLong']/@type", d));
    assertEquals("Float", xpath.evaluate("//OCD/AD[@id='rpFloat']/@type", d));
    assertEquals("Double", xpath.evaluate("//OCD/AD[@id='rpDouble']/@type", d));

    // Primitive Wrappers
    assertEquals("Boolean", xpath.evaluate("//OCD/AD[@id='rBoolean']/@type", d));
    assertEquals("Byte", xpath.evaluate("//OCD/AD[@id='rByte']/@type", d));
    assertEquals("Character", xpath.evaluate("//OCD/AD[@id='rCharacter']/@type", d));
    assertEquals("Short", xpath.evaluate("//OCD/AD[@id='rShort']/@type", d));
    assertEquals("Integer", xpath.evaluate("//OCD/AD[@id='rInt']/@type", d));
    assertEquals("Long", xpath.evaluate("//OCD/AD[@id='rLong']/@type", d));
    assertEquals("Float", xpath.evaluate("//OCD/AD[@id='rFloat']/@type", d));
    assertEquals("Double", xpath.evaluate("//OCD/AD[@id='rDouble']/@type", d));

    // Primitive Arrays
    assertEquals("Boolean", xpath.evaluate("//OCD/AD[@id='rpaBoolean']/@type", d));
    assertEquals("Byte", xpath.evaluate("//OCD/AD[@id='rpaByte']/@type", d));
    assertEquals("Character", xpath.evaluate("//OCD/AD[@id='rpaCharacter']/@type", d));
    assertEquals("Short", xpath.evaluate("//OCD/AD[@id='rpaShort']/@type", d));
    assertEquals("Integer", xpath.evaluate("//OCD/AD[@id='rpaInt']/@type", d));
    assertEquals("Long", xpath.evaluate("//OCD/AD[@id='rpaLong']/@type", d));
    assertEquals("Float", xpath.evaluate("//OCD/AD[@id='rpaFloat']/@type", d));
    assertEquals("Double", xpath.evaluate("//OCD/AD[@id='rpaDouble']/@type", d));

    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='rpaBoolean']/@cardinality", d));
    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='rpaByte']/@cardinality", d));
    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='rpaCharacter']/@cardinality", d));
    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='rpaShort']/@cardinality", d));
    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='rpaInt']/@cardinality", d));
    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='rpaLong']/@cardinality", d));
    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='rpaFloat']/@cardinality", d));
    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='rpaDouble']/@cardinality", d));

    // Wrapper + Object arrays
    assertEquals("Boolean", xpath.evaluate("//OCD/AD[@id='raBoolean']/@type", d));
    assertEquals("Byte", xpath.evaluate("//OCD/AD[@id='raByte']/@type", d));
    assertEquals("Character", xpath.evaluate("//OCD/AD[@id='raCharacter']/@type", d));
    assertEquals("Short", xpath.evaluate("//OCD/AD[@id='raShort']/@type", d));
    assertEquals("Integer", xpath.evaluate("//OCD/AD[@id='raInt']/@type", d));
    assertEquals("Long", xpath.evaluate("//OCD/AD[@id='raLong']/@type", d));
    assertEquals("Float", xpath.evaluate("//OCD/AD[@id='raFloat']/@type", d));
    assertEquals("Double", xpath.evaluate("//OCD/AD[@id='raDouble']/@type", d));
    assertEquals("String", xpath.evaluate("//OCD/AD[@id='raString']/@type", d));
    assertEquals("String", xpath.evaluate("//OCD/AD[@id='raURI']/@type", d));

    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='raBoolean']/@cardinality", d));
    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='raByte']/@cardinality", d));
    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='raCharacter']/@cardinality", d));
    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='raShort']/@cardinality", d));
    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='raInt']/@cardinality", d));
    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='raLong']/@cardinality", d));
    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='raFloat']/@cardinality", d));
    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='raDouble']/@cardinality", d));
    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='raString']/@cardinality", d));
    assertEquals("2147483647", xpath.evaluate("//OCD/AD[@id='raURI']/@cardinality", d));

    // Wrapper + Object collections
    assertEquals("Boolean", xpath.evaluate("//OCD/AD[@id='rBooleans']/@type", d));
    assertEquals("Byte", xpath.evaluate("//OCD/AD[@id='rBytes']/@type", d));
    assertEquals("Character", xpath.evaluate("//OCD/AD[@id='rCharacter']/@type", d));
    assertEquals("Short", xpath.evaluate("//OCD/AD[@id='rShorts']/@type", d));
    assertEquals("Integer", xpath.evaluate("//OCD/AD[@id='rInts']/@type", d));
    assertEquals("Long", xpath.evaluate("//OCD/AD[@id='rLongs']/@type", d));
    assertEquals("Float", xpath.evaluate("//OCD/AD[@id='rFloats']/@type", d));
    assertEquals("Double", xpath.evaluate("//OCD/AD[@id='rDoubles']/@type", d));
    assertEquals("String", xpath.evaluate("//OCD/AD[@id='rStrings']/@type", d));
    assertEquals("String", xpath.evaluate("//OCD/AD[@id='rURIs']/@type", d));

    assertEquals("-2147483648", xpath.evaluate("//OCD/AD[@id='rBooleans']/@cardinality", d));
    assertEquals("-2147483648", xpath.evaluate("//OCD/AD[@id='rBytes']/@cardinality", d));
    assertEquals("-2147483648", xpath.evaluate("//OCD/AD[@id='rCharacters']/@cardinality", d));
    assertEquals("-2147483648", xpath.evaluate("//OCD/AD[@id='rShorts']/@cardinality", d));
    assertEquals("-2147483648", xpath.evaluate("//OCD/AD[@id='rInts']/@cardinality", d));
    assertEquals("-2147483648", xpath.evaluate("//OCD/AD[@id='rLongs']/@cardinality", d));
    assertEquals("-2147483648", xpath.evaluate("//OCD/AD[@id='rFloats']/@cardinality", d));
    assertEquals("-2147483648", xpath.evaluate("//OCD/AD[@id='rDoubles']/@cardinality", d));
    assertEquals("-2147483648", xpath.evaluate("//OCD/AD[@id='rStrings']/@cardinality", d));
    assertEquals("-2147483648", xpath.evaluate("//OCD/AD[@id='rURIs']/@cardinality", d));
  }