コード例 #1
0
ファイル: LinkModel.java プロジェクト: amirhakim/Ref
  /**
   * Export links to XML
   *
   * @param fw the writer to write XML to
   * @throws Exception the exception
   */
  @Override
  public void export(Writer fw) throws Exception {

    JAXBContext jc = JAXBContext.newInstance(XmlContainer.class);
    Marshaller m = jc.createMarshaller();
    XmlContainer container = new XmlContainer();
    container.Link = getLinks();
    m.marshal(container, fw);
  }
コード例 #2
0
ファイル: replaceIndex.java プロジェクト: cajus/dbxml-debian
 // Utility function to clean up objects, exceptions or not,
 // containers and environments must be closed.
 private static void cleanup(myDbEnv env, XmlContainer openedContainer) {
   try {
     if (openedContainer != null) openedContainer.delete();
     if (env != null) env.cleanup();
   } catch (Exception e) {
     // ignore exceptions on close
   }
 }
コード例 #3
0
ファイル: XmlDataset.java プロジェクト: nhauser/cdma
 private void loadAttributes(Node node, XmlContainer container) throws Exception {
   Hashtable<String, String> attributeProperties = XmlUtils.loadAttributes(node);
   if (!attributeProperties.isEmpty()) {
     for (String entry : attributeProperties.keySet()) {
       container.addStringAttribute(entry, attributeProperties.get(entry));
     }
   }
 }
コード例 #4
0
ファイル: replaceIndex.java プロジェクト: cajus/dbxml-debian
  // Method used to replace an index with a new index type
  private static void replaceAnIndex(
      XmlManager mgr,
      XmlContainer container,
      String URI,
      String nodeName,
      String indexType,
      XmlTransaction txn)
      throws Throwable {
    System.out.println("Replacing index specification " + indexType + " for node " + nodeName);

    // Retrieve the index specification from the container
    XmlIndexSpecification idxSpec = container.getIndexSpecification(txn);

    // See what indexes exist on the container
    int count = 0;
    System.out.println("Before index replacement.");
    XmlIndexDeclaration idxDecl = null;
    while ((idxDecl = (idxSpec.next())) != null) {
      System.out.println(
          "\tFor node '" + idxDecl.name + "', found index: '" + idxDecl.index + "'.");
      count++;
    }

    System.out.println(count + " indexes found.");

    // Replace the container's index specification with a new specification
    idxSpec.replaceIndex(URI, nodeName, indexType);

    // Set the specification back to the container
    container.setIndexSpecification(txn, idxSpec, mgr.createUpdateContext());

    // Look at the indexes again to make sure our replacement took.
    count = 0;
    idxSpec.reset();
    System.out.println("After index replacement.");
    while ((idxDecl = (idxSpec.next())) != null) {
      System.out.println(
          "\tFor node '" + idxDecl.name + "', found index: '" + idxDecl.index + "'.");
      count++;
    }

    System.out.println(count + " indexes found.");
    idxSpec.delete();
  }