public String getPrefix(String uri) throws NamespaceException, RepositoryException { return nsRegistry.getPrefix(uri); } }
@Override public String getPrefix(String uri) throws RepositoryException { return delegate.getPrefix(uri); } }
public String getPrefix(String uri) throws NamespaceException, RepositoryException { return nsRegistry.getPrefix(uri); } }
public String getPrefix(String uri) throws NamespaceException { try { return registry.getPrefix(uri); } catch (RepositoryException e) { if (!(e instanceof NamespaceException)) { e = new NamespaceException( "Failed to resolve namespace URI: " + uri, e); } throw (NamespaceException) e; } }
public String getPrefix(String uri) throws NamespaceException { try { return registry.getPrefix(uri); } catch (RepositoryException e) { if (!(e instanceof NamespaceException)) { e = new NamespaceException( "Failed to resolve namespace URI: " + uri, e); } throw (NamespaceException) e; } }
public String getPrefix(String uri) throws NamespaceException { try { return nsReg.getPrefix(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 RepositoryException, RemoteException { try { return registry.getPrefix(uri); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
/** * {@inheritDoc} */ public String getNamespacePrefix(String uri) throws NamespaceException, RepositoryException { if (prefixes.containsKey(uri)) { return prefixes.get(uri); } return workspace.getNamespaceRegistry().getPrefix(uri); }
public String getPrefix(String uri) throws NamespaceException { try { return nsReg.getPrefix(uri); } catch (RepositoryException e) { // should never get here... throw new NamespaceException("internal error: failed to resolve namespace uri", e); } }
@Override public void startPrefixMapping( String prefix, String uri ) throws SAXException { try { try { namespaces.getPrefix(uri); } catch (NamespaceException e) { namespaces.registerNamespace(prefix, uri); } } catch (RepositoryException e) { throw new SAXException(e); } }
@Override public void startPrefixMapping( String prefix, String uri ) throws SAXException { try { try { namespaces.getPrefix(uri); } catch (NamespaceException e) { namespaces.registerNamespace(prefix, uri); } } catch (RepositoryException e) { throw new SAXException(e); } }
/** * {@inheritDoc} */ public String getNamespacePrefix(SessionInfo sessionInfo, String uri) throws NamespaceException, RepositoryException { SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo); return sInfo.getSession().getWorkspace().getNamespaceRegistry().getPrefix(uri); }
/** * {@inheritDoc} */ public String getNamespacePrefix(SessionInfo sessionInfo, String uri) throws NamespaceException, RepositoryException { SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo); return sInfo.getSession().getWorkspace().getNamespaceRegistry().getPrefix(uri); }
private void copyNamespaces() throws RepositoryException { NamespaceRegistry sourceRegistry = source.getNamespaceRegistry(); NamespaceRegistry targetRegistry = target.getNamespaceRegistry(); logger.info("Copying registered namespaces"); Collection<String> existing = Arrays.asList(targetRegistry.getURIs()); for (String uri : sourceRegistry.getURIs()) { if (!existing.contains(uri)) { // TODO: what if the prefix is already taken? targetRegistry.registerNamespace( sourceRegistry.getPrefix(uri), uri); } } }
private void copyNamespaces() throws RepositoryException { NamespaceRegistry sourceRegistry = source.getNamespaceRegistry(); NamespaceRegistry targetRegistry = target.getNamespaceRegistry(); logger.info("Copying registered namespaces"); Collection<String> existing = Arrays.asList(targetRegistry.getURIs()); for (String uri : sourceRegistry.getURIs()) { if (!existing.contains(uri)) { // TODO: what if the prefix is already taken? targetRegistry.registerNamespace( sourceRegistry.getPrefix(uri), uri); } } }
/** * {@inheritDoc} */ public void unregisterNamespace(SessionInfo sessionInfo, String uri) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException { Session session = getSessionInfoImpl(sessionInfo).getSession(); NamespaceRegistry nsReg = session.getWorkspace().getNamespaceRegistry(); nsReg.unregisterNamespace(nsReg.getPrefix(uri)); }
/** * {@inheritDoc} */ public void unregisterNamespace(SessionInfo sessionInfo, String uri) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException { Session session = getSessionInfoImpl(sessionInfo).getSession(); NamespaceRegistry nsReg = session.getWorkspace().getNamespaceRegistry(); nsReg.unregisterNamespace(nsReg.getPrefix(uri)); }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteredUri() throws Exception { registry.getPrefix("bogus"); }
protected void assertThatNamespaceUriIsNotRegistered( String uri ) throws Exception { try { registry.getPrefix(uri); fail("Should not have found namespace mapping with URI \"" + uri + "\""); } catch (NamespaceException e) { // good } for (String existingUri : registry.getURIs()) { assertThat(existingUri, is(not(uri))); } }
@FixFor("MODE-1795") @Test public void shouldBeAbleToImportXmlFileThatUsesDefaultNamespaceWithNonBlankUri() throws Exception { session.importXML("/", resourceStream("io/simple-document-view-with-default-namespace.xml"), ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW); // Get the prefix for the namespace used in the imported file ... String prefix = session.getWorkspace().getNamespaceRegistry().getPrefix("http://www.ns.com"); assertNode("/" + prefix + ":childNode", "nt:unstructured"); }