@Override protected Object doOperation(HttpServerExchange exchange, String name) throws NamingException { localContext.destroySubcontext(name); return null; } }
@Override public void destroySubcontext(Name name) throws NamingException { context.destroySubcontext(name); }
@Override public void destroySubcontext(String name) throws NamingException { context.destroySubcontext(name); }
@Override public void destroySubcontext(final Name name) throws NamingException { CNCtxFactory.INSTANCE.getInitialContext(environment).destroySubcontext(name); }
@Override public void destroySubcontext(final String name) throws NamingException { CNCtxFactory.INSTANCE.getInitialContext(environment).destroySubcontext(name); }
@Override public void destroySubcontext(final Name name) throws NamingException { Assert.checkNotNullParam("name", name); final ReparsedName reparsedName = reparse(name); ContextResult result = getProviderContext(reparsedName.getUrlScheme()); if(result.oldStyle) { result.context.destroySubcontext(name); } else { result.context.destroySubcontext(reparsedName.getName()); } }
/** * Unbinds a name from ctx, and removes parents if they are empty * * @param ctx the parent JNDI Context under which the name will be unbound * @param name The name to unbind * @throws NamingException for any error */ public static void unbind(Context ctx, Name name) throws NamingException { ctx.unbind(name); //unbind the end node in the name int sz = name.size(); // walk the tree backwards, stopping at the domain while (--sz > 0) { Name pname = name.getPrefix(sz); try { ctx.destroySubcontext(pname); } catch (NamingException e) { //log.trace("Unable to remove context " + pname, e); break; } } } }
@Override public void destroySubcontext(final String name) throws NamingException { Assert.checkNotNullParam("name", name); final ReparsedName reparsedName = reparse(getNameParser().parse(name)); ContextResult result = getProviderContext(reparsedName.getUrlScheme()); if(result.oldStyle) { result.context.destroySubcontext(name); } else { result.context.destroySubcontext(reparsedName.getName()); } }
void handleDestroySubcontext(final MessageInputStream message, final int messageId, final int id) throws IOException { try (MessageInputStream mis = message) { if (version == 1) { try (Unmarshaller unmarshaller = createUnmarshaller(mis, configuration)) { final int parameterType = unmarshaller.readUnsignedByte(); if (parameterType != Protocol.P_NAME) { Messages.log.unexpectedParameterType(Protocol.P_NAME, parameterType); } final Name name = unmarshaller.readObject(Name.class); localContext.destroySubcontext(name); } catch (ClassNotFoundException e) { throw new IOException(e); } } else { mis.readInt(); // consume authId final String name = mis.readUTF(); localContext.destroySubcontext(name); } } catch (NamingException e) { writeExceptionResponse(e, messageId, id); return; } writeSuccessResponse(messageId, id); }
public void destroySubcontext(Name name) throws NamingException { final ParsedName parsedName = parse(name); final Context namespaceContext = findContext(name, parsedName); if (namespaceContext == null) super.destroySubcontext(parsedName.remaining()); else namespaceContext.destroySubcontext(parsedName.remaining()); }
/** * Tests inability to destroy non empty subcontexts. */ @Test public void testSubcontextNonEmptyDestruction() throws Exception { // Bind some object in ejb subcontext dataSourceContext.bind("Test", "Object"); // Attempt to destroy any subcontext try { initialContext.destroySubcontext("java:gf"); fail(); } catch (ContextNotEmptyException expected) { } try { initialContext.destroySubcontext("java:gf/env/datasource"); fail(); } catch (ContextNotEmptyException expected) { } try { envContext.destroySubcontext("datasource"); fail(); } catch (ContextNotEmptyException expected) { } }
/** * Tests ability to destroy empty subcontexts. */ @Test public void testSubcontextDestruction() throws Exception { // Create three new subcontexts dataSourceContext.createSubcontext("sub1"); dataSourceContext.createSubcontext("sub2"); envContext.createSubcontext("sub3"); // Destroy initialContext.destroySubcontext("java:gf/env/datasource/sub1"); dataSourceContext.destroySubcontext("sub2"); envContext.destroySubcontext("sub3"); // Perform lookup try { dataSourceContext.lookup("sub1"); fail(); } catch (NameNotFoundException expected) { } try { envContext.lookup("datasource/sub2"); fail(); } catch (NameNotFoundException expected) { } try { initialContext.lookup("java:gf/sub3"); fail(); } catch (NameNotFoundException expected) { } }
} catch (CannotProceedException e) { javax.naming.Context cctx = getContinuationContext(e); cctx.destroySubcontext(e.getRemainingName()); return; } catch (NameNotFoundException e) {
public void destroySubcontext(final Name name) throws NamingException { Assert.checkNotNullParam("name", name); if (name.isEmpty()) { throw log.invalidEmptyName(); } if (name instanceof CompositeName) { final String first = name.get(0); final Name firstName = getNativeNameParser().parse(first); if (name.size() == 1) { destroySubcontext(firstName); return; } final Object next = lookup(firstName); if (next instanceof Context) { final Context context = (Context) next; try { context.destroySubcontext(name.getSuffix(1)); return; } finally { NamingUtils.safeClose(context); } } else { throw log.notContextInCompositeName(first); } } else { destroySubcontextNative(name); } }
initialContext.destroySubcontext("java:gf/env/datasource/sub4"); sub.destroySubcontext("sub6"); fail(); } catch (NoPermissionException expected) {
@Override public void delete(String name) throws Exception { Context context = new InitialContext(); context.destroySubcontext(name); }
@Override public Object operation() throws NamingException { getDelegate().destroySubcontext(name); return null; } }.perform();
@Override public Object operation() throws NamingException { getDelegate().destroySubcontext(name); return null; } }.perform();
@Override public Object operation() throws NamingException { getDelegate().destroySubcontext(name); return null; } }.perform();
public void destroySubcontext(Name name) throws NamingException { final ParsedName parsedName = parse(name); final Context namespaceContext = findContext(name, parsedName); if (namespaceContext == null) super.destroySubcontext(parsedName.remaining()); else namespaceContext.destroySubcontext(parsedName.remaining()); }