congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ParsingContentHandler
Code IndexAdd Tabnine to your IDE (free)

How to use
ParsingContentHandler
in
org.apache.jackrabbit.commons.xml

Best Java code snippets using org.apache.jackrabbit.commons.xml.ParsingContentHandler (Showing top 20 results out of 315)

origin: apache/jackrabbit-oak

@Override
public void importXML(String parentAbsPath, InputStream in, int uuidBehavior)
    throws IOException, RepositoryException {
  try {
    ContentHandler handler = getImportContentHandler(
        checkNotNull(parentAbsPath), uuidBehavior);
    new ParsingContentHandler(handler).parse(in);
  } catch (SAXException e) {
    Throwable exception = e.getException();
    if (exception instanceof RepositoryException) {
      throw (RepositoryException) exception;
    } else if (exception instanceof IOException) {
      throw (IOException) exception;
    } else {
      throw new InvalidSerializedDataException("XML parse error", e);
    }
  } finally {
    // JCR-2903
    if (in != null) {
      try {
        in.close();
      } catch (IOException ignore) {
      }
    }
  }
}
origin: org.apache.jackrabbit/com.springsource.org.apache.jackrabbit.commons

/**
 * Parses the given input stream as an XML document and processes the
 * SAX events using the {@link ContentHandler} returned by
 * {@link Session#getImportContentHandler(String, int)}.
 *
 * @param parentAbsPath passed through
 * @param in input stream to be parsed as XML and imported
 * @param uuidBehavior passed through
 * @throws IOException if an I/O error occurs
 * @throws RepositoryException if another error occurs
 */
public void importXML(
    String parentAbsPath, InputStream in, int uuidBehavior)
    throws IOException, RepositoryException {
  ContentHandler handler =
    getImportContentHandler(parentAbsPath, uuidBehavior);
  new DefaultContentHandler(handler).parse(in);
}
origin: org.apache.jackrabbit/com.springsource.org.apache.jackrabbit.commons

/**
 * Parses the given input stream as an XML document and processes the
 * SAX events using the {@link ContentHandler} returned by
 * {@link Workspace#getImportContentHandler(String, int)}.
 *
 * @param parentAbsPath passed through
 * @param in input stream to be parsed as XML and imported
 * @param uuidBehavior passed through
 * @throws IOException if an I/O error occurs
 * @throws RepositoryException if another error occurs
 */
public void importXML(
    String parentAbsPath, InputStream in, int uuidBehavior)
    throws IOException, RepositoryException {
  ContentHandler handler =
    getImportContentHandler(parentAbsPath, uuidBehavior);
  new DefaultContentHandler(handler).parse(in);
}
origin: org.apache.jackrabbit/oak-jcr

@Override
public void importXML(String parentAbsPath, InputStream in, int uuidBehavior)
    throws IOException, RepositoryException {
  try {
    ContentHandler handler = getImportContentHandler(
        checkNotNull(parentAbsPath), uuidBehavior);
    new ParsingContentHandler(handler).parse(in);
  } catch (SAXException e) {
    Throwable exception = e.getException();
    if (exception instanceof RepositoryException) {
      throw (RepositoryException) exception;
    } else if (exception instanceof IOException) {
      throw (IOException) exception;
    } else {
      throw new InvalidSerializedDataException("XML parse error", e);
    }
  } finally {
    // JCR-2903
    if (in != null) {
      try {
        in.close();
      } catch (IOException ignore) {
      }
    }
  }
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public void importXML(String parentAbsPath, InputStream in, int uuidBehavior)
    throws IOException, RepositoryException {
  try {
    ContentHandler handler = getImportContentHandler(
        checkNotNull(parentAbsPath), uuidBehavior);
    new ParsingContentHandler(handler).parse(in);
  } catch (SAXException e) {
    Throwable exception = e.getException();
    if (exception instanceof RepositoryException) {
      throw (RepositoryException) exception;
    } else if (exception instanceof IOException) {
      throw (IOException) exception;
    } else {
      throw new InvalidSerializedDataException("XML parse error", e);
    }
  } finally {
    // JCR-2903
    if (in != null) {
      try {
        in.close();
      } catch (IOException ignore) {
      }
    }
  }
}
origin: org.apache.jackrabbit/jackrabbit-jcr-commons

  ContentHandler handler =
    getImportContentHandler(parentAbsPath, uuidBehavior);
  new ParsingContentHandler(handler).parse(in);
} catch (SAXException e) {
  Throwable exception = e.getException();
origin: org.apache.jackrabbit/jackrabbit-jcr-commons

  ContentHandler handler =
    getImportContentHandler(parentAbsPath, uuidBehavior);
  new ParsingContentHandler(handler).parse(in);
} catch (SAXException e) {
  Throwable exception = e.getException();
origin: apache/jackrabbit

  ContentHandler handler =
    getImportContentHandler(parentAbsPath, uuidBehavior);
  new ParsingContentHandler(handler).parse(in);
} catch (SAXException e) {
  Throwable exception = e.getException();
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

  ContentHandler handler =
    getImportContentHandler(parentAbsPath, uuidBehavior);
  new ParsingContentHandler(handler).parse(in);
} catch (SAXException e) {
  Throwable exception = e.getException();
origin: apache/jackrabbit

  ContentHandler handler =
    getImportContentHandler(parentAbsPath, uuidBehavior);
  new ParsingContentHandler(handler).parse(in);
} catch (SAXException e) {
  Throwable exception = e.getException();
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

  ContentHandler handler =
    getImportContentHandler(parentAbsPath, uuidBehavior);
  new ParsingContentHandler(handler).parse(in);
} catch (SAXException e) {
  Throwable exception = e.getException();
origin: apache/jackrabbit-oak

@Override
public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws IOException, RepositoryException {
  ensureIsAlive();
  try {
    ContentHandler handler = getImportContentHandler(parentAbsPath, uuidBehavior);
    new ParsingContentHandler(handler).parse(in);
  } catch (SAXException e) {
    Throwable exception = e.getException();
    if (exception instanceof RepositoryException) {
      throw (RepositoryException) exception;
    } else if (exception instanceof IOException) {
      throw (IOException) exception;
    } else if (exception instanceof CommitFailedException) {
      throw ((CommitFailedException) exception).asRepositoryException();
    } else {
      throw new InvalidSerializedDataException("XML parse error", e);
    }
  } finally {
    // JCR-2903
    if (in != null) {
      try {
        in.close();
      } catch (IOException ignore) {
      }
    }
  }
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

@Override
public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws IOException, RepositoryException {
  ensureIsAlive();
  try {
    ContentHandler handler = getImportContentHandler(parentAbsPath, uuidBehavior);
    new ParsingContentHandler(handler).parse(in);
  } catch (SAXException e) {
    Throwable exception = e.getException();
    if (exception instanceof RepositoryException) {
      throw (RepositoryException) exception;
    } else if (exception instanceof IOException) {
      throw (IOException) exception;
    } else if (exception instanceof CommitFailedException) {
      throw ((CommitFailedException) exception).asRepositoryException();
    } else {
      throw new InvalidSerializedDataException("XML parse error", e);
    }
  } finally {
    // JCR-2903
    if (in != null) {
      try {
        in.close();
      } catch (IOException ignore) {
      }
    }
  }
}
origin: org.apache.jackrabbit/oak-jcr

@Override
public void importXML(String parentAbsPath, InputStream in, int uuidBehavior) throws IOException, RepositoryException {
  ensureIsAlive();
  try {
    ContentHandler handler = getImportContentHandler(parentAbsPath, uuidBehavior);
    new ParsingContentHandler(handler).parse(in);
  } catch (SAXException e) {
    Throwable exception = e.getException();
    if (exception instanceof RepositoryException) {
      throw (RepositoryException) exception;
    } else if (exception instanceof IOException) {
      throw (IOException) exception;
    } else if (exception instanceof CommitFailedException) {
      throw ((CommitFailedException) exception).asRepositoryException();
    } else {
      throw new InvalidSerializedDataException("XML parse error", e);
    }
  } finally {
    // JCR-2903
    if (in != null) {
      try {
        in.close();
      } catch (IOException ignore) {
      }
    }
  }
}
origin: apache/jackrabbit

private void doImport(NodeImpl target, String xml) throws IOException, SAXException, RepositoryException {
  InputStream in = new ByteArrayInputStream(xml.getBytes("UTF-8"));
  SessionImporter importer = new SessionImporter(target, sImpl,
      ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW, new PseudoConfig());
  ImportHandler ih = new ImportHandler(importer, sImpl);
  new ParsingContentHandler(ih).parse(in);
}
origin: apache/jackrabbit

private void doImport(NodeImpl target, String xml, int uuidBehavior, int importBehavior) throws IOException, SAXException, RepositoryException {
  InputStream in = new ByteArrayInputStream(xml.getBytes("UTF-8"));
  SessionImporter importer = new SessionImporter(target, sImpl,
      uuidBehavior, new PseudoConfig(importBehavior));
  ImportHandler ih = new ImportHandler(importer, sImpl);
  new ParsingContentHandler(ih).parse(in);
}
origin: apache/jackrabbit

private NodeImpl createPolicyNode(NodeImpl target) throws Exception {
  try {
    InputStream in = new ByteArrayInputStream(XML_POLICY_ONLY.getBytes("UTF-8"));
    SessionImporter importer = new SessionImporter(target, sImpl, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
    ImportHandler ih = new ImportHandler(importer, sImpl);
    new ParsingContentHandler(ih).parse(in);
    return (NodeImpl) target.getNode("test/rep:policy");
  } catch (Exception e) {
    e.printStackTrace();
    throw e;
  } finally {
    superuser.refresh(false);
    if (superuser.nodeExists("/test")) {
      NodeIterator it = superuser.getRootNode().getNodes("test");
      while (it.hasNext()) {
        it.nextNode().remove();
      }
    }
    superuser.save();
  }
}
origin: apache/jackrabbit

/**
 * Imports a resource-based ACL containing a single entry.
 *
 * @throws Exception
 */
public void testImportACLUnknownFail() throws Exception {
  try {
    NodeImpl target = (NodeImpl) testRootNode.addNode(nodeName1);
    target.addMixin("rep:AccessControllable");
    InputStream in = new ByteArrayInputStream(XML_POLICY_TREE_4.getBytes("UTF-8"));
    PseudoConfig config = new PseudoConfig();
    ((AccessControlImporter) config.getProtectedItemImporters().get(0)).setImportBehavior("default");
    SessionImporter importer = new SessionImporter(target, sImpl,
        ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW, config);
    ImportHandler ih = new ImportHandler(importer, sImpl);
    try {
      new ParsingContentHandler(ih).parse(in);
      fail("importing unknown principal should fail based on configuration.");
    } catch (Exception e) {
      // ok
    }
  } finally {
    superuser.refresh(false);
  }
}
origin: apache/jackrabbit

/**
 * With the default importer that isn't able to deal with ACEs the
 * policy will be created but any ACEs will be ignored.
 *
 * @throws Exception
 */
public void testImportWithDefaultImporter() throws Exception {
  NodeImpl target = (NodeImpl) testRootNode;
  try {
    InputStream in = new ByteArrayInputStream(XML_POLICY_TREE.getBytes("UTF-8"));
    SessionImporter importer = new SessionImporter(target, sImpl, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW, null);
    ImportHandler ih = new ImportHandler(importer, sImpl);
    new ParsingContentHandler(ih).parse(in);
    assertTrue(target.hasNode("test"));
    String path = target.getNode("test").getPath();
    AccessControlManager acMgr = sImpl.getAccessControlManager();
    AccessControlPolicy[] policies = acMgr.getPolicies(path);
    assertEquals(1, policies.length);
    assertTrue(policies[0] instanceof JackrabbitAccessControlList);
    AccessControlEntry[] entries = ((JackrabbitAccessControlList) policies[0]).getAccessControlEntries();
    assertEquals(0, entries.length);
  } finally {
    superuser.refresh(false);
  }
}
origin: apache/jackrabbit

    ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW, new PseudoConfig());
ImportHandler ih = new ImportHandler(importer, sImpl);
new ParsingContentHandler(ih).parse(in);
    ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW, new PseudoConfig());
ih = new ImportHandler(importer, sImpl);
new ParsingContentHandler(ih).parse(in);
org.apache.jackrabbit.commons.xmlParsingContentHandler

Javadoc

Utility class that decorates a ContentHandler instance with simple XML parsing capability.

Most used methods

  • parse
    Utility method that parses the given input stream using this handler. The parser is namespace-aware
  • <init>
    Creates a DefaultHandler adapter for the given content handler.

Popular in Java

  • Creating JSON documents from java classes using gson
  • getSystemService (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setContentView (Activity)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now