本文整理了Java中javax.naming.Context.destroySubcontext()
方法的一些代码示例,展示了Context.destroySubcontext()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Context.destroySubcontext()
方法的具体详情如下:
包路径:javax.naming.Context
类名称:Context
方法名:destroySubcontext
暂无
代码示例来源:origin: wildfly/wildfly
@Override
protected Object doOperation(HttpServerExchange exchange, String name) throws NamingException {
localContext.destroySubcontext(name);
return null;
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public void destroySubcontext(Name name) throws NamingException {
context.destroySubcontext(name);
}
代码示例来源:origin: wildfly/wildfly
@Override
public void destroySubcontext(String name) throws NamingException {
context.destroySubcontext(name);
}
代码示例来源:origin: wildfly/wildfly
@Override
public void destroySubcontext(final Name name) throws NamingException {
CNCtxFactory.INSTANCE.getInitialContext(environment).destroySubcontext(name);
}
代码示例来源:origin: wildfly/wildfly
@Override
public void destroySubcontext(final String name) throws NamingException {
CNCtxFactory.INSTANCE.getInitialContext(environment).destroySubcontext(name);
}
代码示例来源:origin: wildfly/wildfly
@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());
}
}
代码示例来源:origin: wildfly/wildfly
/**
* 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;
}
}
}
}
代码示例来源:origin: wildfly/wildfly
@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());
}
}
代码示例来源:origin: wildfly/wildfly
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);
}
代码示例来源:origin: wildfly/wildfly
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());
}
代码示例来源:origin: apache/geode
/**
* 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) {
}
}
代码示例来源:origin: apache/geode
/**
* 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) {
}
}
代码示例来源:origin: wildfly/wildfly
} catch (CannotProceedException e) {
javax.naming.Context cctx = getContinuationContext(e);
cctx.destroySubcontext(e.getRemainingName());
return;
} catch (NameNotFoundException e) {
代码示例来源:origin: wildfly/wildfly
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);
}
}
代码示例来源:origin: apache/geode
initialContext.destroySubcontext("java:gf/env/datasource/sub4");
sub.destroySubcontext("sub6");
fail();
} catch (NoPermissionException expected) {
代码示例来源:origin: apache/karaf
@Override
public void delete(String name) throws Exception {
Context context = new InitialContext();
context.destroySubcontext(name);
}
代码示例来源:origin: apache/james-project
@Override
public Object operation() throws NamingException {
getDelegate().destroySubcontext(name);
return null;
}
}.perform();
代码示例来源:origin: org.apache.james/james-server-util
@Override
public Object operation() throws NamingException {
getDelegate().destroySubcontext(name);
return null;
}
}.perform();
代码示例来源:origin: org.apache.james/james-server-util
@Override
public Object operation() throws NamingException {
getDelegate().destroySubcontext(name);
return null;
}
}.perform();
代码示例来源:origin: org.jboss.eap/wildfly-naming
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());
}
内容来源于网络,如有侵权,请联系作者删除!