private boolean isUriRegistered( String uri ) throws RepositoryException { try { session.getNamespacePrefix(uri); return true; } catch (NamespaceException e) { return false; } }
public void setUp() throws Exception { super.setUp(); JCR_XMLTEXT = superuser.getNamespacePrefix(NS_JCR_URI) + ":xmltext"; JCR_XMLCHAR = superuser.getNamespacePrefix(NS_JCR_URI) + ":xmlcharacters"; }
/** * {@inheritDoc} */ public String getPrefix(String uri) throws NamespaceException { try { return session.getNamespacePrefix(uri); } catch (RepositoryException e) { // should never get here... throw new NamespaceException("internal error: failed to resolve namespace uri", e); } }
/** * Return namespace prefix. */ public String getNamespacePrefix(String arg0) throws NamespaceException, RepositoryException { return getSession().getNamespacePrefix(arg0); }
@Override public void runTest() throws RepositoryException { for (int i = 0; i < 10000; i++) { for (String uri : registry.getURIs()) { session.getNamespacePrefix(uri); } } }
private String getNamespacePrefix(final Name name) { try { final String namespacePrefix = monitorSession.getNamespacePrefix(name.getNamespaceURI()); if (!hippoNamespacePrefixed.contains(namespacePrefix)) { return namespacePrefix; } } catch (RepositoryException e) { // ignore } return null; }
/** * {@inheritDoc} */ public String getPrefix(String uri) throws NamespaceException { try { return session.getNamespacePrefix(uri); } catch (RepositoryException e) { throw new NamespaceException(e); } }
/** * {@inheritDoc} */ public String getPrefix(String uri) throws NamespaceException { try { return session.getNamespacePrefix(uri); } catch (RepositoryException e) { throw new NamespaceException(e); } }
/** {@inheritDoc} */ public String getNamespacePrefix(String uri) throws RepositoryException, RemoteException { try { return session.getNamespacePrefix(uri); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
/** * Tests if <code>VersionHistory.getPath()</code> returns the right path */ public void testGetPath() throws Exception { assertTrue("VersionHistory.getPath() does not return the right path", vHistory.getPath().startsWith("/" + superuser.getNamespacePrefix(NS_JCR_URI) + ":system/" + superuser.getNamespacePrefix(NS_JCR_URI) + ":versionStorage/")); }
/** * {@inheritDoc} */ public String getPrefix(String uri) throws NamespaceException { try { return session.getNamespacePrefix(uri); } catch (RepositoryException e) { // should never get here... throw new NamespaceException("internal error: failed to resolve namespace uri", e); } }
/** * {@inheritDoc} */ public String getPrefix(String uri) throws NamespaceException { try { return session.getNamespacePrefix(uri); } catch (RepositoryException e) { // should never get here... throw new NamespaceException("internal error: failed to resolve namespace uri", e); } }
protected void setUp() throws Exception { isReadOnly = true; session = getHelper().getReadOnlySession(); workspace = session.getWorkspace(); nsr = workspace.getNamespaceRegistry(); file = File.createTempFile("docViewExportTest", ".xml"); super.setUp(); JCR_XMLTEXT = session.getNamespacePrefix(NS_JCR_URI) + ":xmltext"; JCR_XMLDATA = session.getNamespacePrefix(NS_JCR_URI) + ":xmlcharacters"; testPath = testRoot; }
public NodeRepositoryFileData fromContentNode( final Session session, final PentahoJcrConstants pentahoJcrConstants, final Node fileNode ) throws RepositoryException { Node unstructuredNode = fileNode.getNode( pentahoJcrConstants.getJCR_CONTENT() ); final String pattern = session.getNamespacePrefix( PentahoJcrConstants.PHO_NS ) + ":" + "*"; //$NON-NLS-1$ //$NON-NLS-2$ Assert.isTrue( unstructuredNode.getNodes( pattern ).getSize() == 1 ); Node jcrNode = unstructuredNode.getNodes( pattern ).nextNode(); return new NodeRepositoryFileData( internalRead( session, pentahoJcrConstants, jcrNode, null ) ); }
private String createAttributeName( String uri, String localName ) throws RepositoryException { if (StringUtil.isBlank(uri)) { return decoder.decode(localName.trim()); } String prefix = session.getNamespacePrefix(uri); assert prefix != null; return prefix + ":" + decoder.decode(localName.trim()); }
private String createAttributeName( String uri, String localName ) throws RepositoryException { if (StringUtil.isBlank(uri)) { return decoder.decode(localName.trim()); } String prefix = session.getNamespacePrefix(uri); assert prefix != null; return prefix + ":" + decoder.decode(localName.trim()); }
protected void setUp() throws Exception { super.setUp(); checkSupportedOption(Repository.OPTION_BASELINES_SUPPORTED); vm = superuser.getWorkspace().getVersionManager(); versionableNode2 = createVersionableNode(testRootNode, nodeName4, versionableNodeType); ntConfiguration = superuser.getNamespacePrefix(NS_NT_URI) + ":configuration"; }
/** * Tests that Session.getNamespacePrefix returns the session scoped * mapping. */ public void testGetNamespacePrefix() throws RepositoryException { String testPrefix = getUnusedPrefix(); // remap the jcr uri session.setNamespacePrefix(testPrefix, NS_JCR_URI); String prefix = session.getNamespacePrefix(NS_JCR_URI); assertEquals("Session.getNamespacePrefix does not return the correct value.", testPrefix, prefix); }
/** * Tests if <code>Version.getNodes()</code> and <code>Version.getNodes(String)</code> * returns the right child Node */ public void testGetNodes() throws Exception { assertTrue("Version.getNodes() does not return a sub-node of type nt:frozenNode", version.getNodes().nextNode().isNodeType(ntFrozenNode)); assertTrue("Version.getNodes(String) does not return a sub-node of type nt:frozenNode", version.getNodes(superuser.getNamespacePrefix(NS_JCR_URI) + ":*").nextNode().isNodeType(ntFrozenNode)); }
/** * Tests if <code>VersionHistory.getNodes()</code> and * <code>VersionHistory.getNodes(String)</code> returns the right child * Node */ public void testGetNodes() throws Exception { Node n = vHistory.getNodes().nextNode(); assertTrue("VersionHistory.getNodes() does not return a sub-node of type nt:version", n.isNodeType(ntVersion) || n.isNodeType(ntVersionLabels)); assertTrue("VersionHistory.getNodes(String) does not return a sub-node of type nt:version", vHistory.getNodes(superuser.getNamespacePrefix(NS_JCR_URI) + ":r*").nextNode().isNodeType(ntVersion)); }