use of org.omg.CosNaming.NamingContextPackage.CannotProceed in project wildfly by wildfly.
the class EjbIIOPService method stop.
@Override
public synchronized void stop(final StopContext context) {
// Get local (in-VM) CORBA naming context
final NamingContextExt corbaContext = corbaNamingContext.getValue();
// Unregister bean home from local CORBA naming context
try {
NameComponent[] name = corbaContext.to_name(this.name);
corbaContext.unbind(name);
} catch (InvalidName invalidName) {
EjbLogger.ROOT_LOGGER.cannotUnregisterEJBHomeFromCobra(invalidName);
} catch (NotFound notFound) {
EjbLogger.ROOT_LOGGER.cannotUnregisterEJBHomeFromCobra(notFound);
} catch (CannotProceed cannotProceed) {
EjbLogger.ROOT_LOGGER.cannotUnregisterEJBHomeFromCobra(cannotProceed);
}
// Deactivate the home servant and the bean servant
try {
homeServantRegistry.unbind(homeServantName(this.name));
} catch (Exception e) {
EjbLogger.ROOT_LOGGER.cannotDeactivateHomeServant(e);
}
try {
beanServantRegistry.unbind(beanServantName(this.name));
} catch (Exception e) {
EjbLogger.ROOT_LOGGER.cannotDeactivateBeanServant(e);
}
if (iri != null) {
// Deactivate the interface repository
iri.shutdown();
}
this.name = null;
}
use of org.omg.CosNaming.NamingContextPackage.CannotProceed in project wildfly by wildfly.
the class CorbaNamingContext method bind_context.
public void bind_context(NameComponent[] nc, NamingContext obj) throws NotFound, CannotProceed, InvalidName, AlreadyBound {
if (this.destroyed)
throw new CannotProceed();
Name n = new Name(nc);
Name ctx = n.ctxName();
NameComponent nb = n.baseNameComponent();
if (ctx == null) {
if (this.names.containsKey(n)) {
// if the name is still in use, try to ping the object
org.omg.CORBA.Object ref = (org.omg.CORBA.Object) this.names.get(n);
if (isDead(ref))
unbind(n.components());
else
throw new AlreadyBound();
} else if (this.contexts.containsKey(n)) {
// if the name is still in use, try to ping the object
org.omg.CORBA.Object ref = (org.omg.CORBA.Object) this.contexts.get(n);
if (isDead(ref)) {
rebind_context(n.components(), obj);
return;
}
throw new AlreadyBound();
}
if ((this.contexts.put(n, obj)) != null)
throw new CannotProceed(_this(), n.components());
IIOPLogger.ROOT_LOGGER.debugf("Bound context: %s", n);
} else {
NameComponent[] ncx = new NameComponent[] { nb };
org.omg.CORBA.Object context = this.resolve(ctx.components());
// try first to call the context implementation object directly.
String contextOID = this.getObjectOID(context);
CorbaNamingContext jbossContext = (contextOID == null ? null : contextImpls.get(contextOID));
if (jbossContext != null)
jbossContext.bind_context(ncx, obj);
else
NamingContextExtHelper.narrow(context).bind_context(ncx, obj);
}
}
use of org.omg.CosNaming.NamingContextPackage.CannotProceed in project wildfly by wildfly.
the class ExceptionMapper method mapException.
public static NamingException mapException(Exception e, CNCtx ctx, NameComponent[] inputName) throws NamingException {
if (e instanceof NamingException) {
return (NamingException) e;
}
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
NamingException ne;
if (e instanceof NotFound) {
if (ctx.federation) {
return tryFed((NotFound) e, ctx, inputName);
} else {
ne = new NameNotFoundException();
}
} else if (e instanceof CannotProceed) {
ne = new CannotProceedException();
NamingContext nc = ((CannotProceed) e).cxt;
NameComponent[] rest = ((CannotProceed) e).rest_of_name;
// NotFound doesn't set rest as expected. -RL
if (inputName != null && (inputName.length > rest.length)) {
NameComponent[] resolvedName = new NameComponent[inputName.length - rest.length];
System.arraycopy(inputName, 0, resolvedName, 0, resolvedName.length);
// Wrap resolved NamingContext inside a CNCtx
// Guess that its name (which is relative to ctx)
// is the part of inputName minus rest_of_name
ne.setResolvedObj(new CNCtx(ctx._orb, nc, ctx._env, ctx.makeFullName(resolvedName)));
} else {
ne.setResolvedObj(ctx);
}
ne.setRemainingName(org.wildfly.iiop.openjdk.naming.jndi.CNNameParser.cosNameToName(rest));
} else if (e instanceof InvalidName) {
ne = new InvalidNameException();
} else if (e instanceof AlreadyBound) {
ne = new NameAlreadyBoundException();
} else if (e instanceof NotEmpty) {
ne = new ContextNotEmptyException();
} else {
ne = new NamingException();
}
ne.setRootCause(e);
return ne;
}
use of org.omg.CosNaming.NamingContextPackage.CannotProceed in project wildfly by wildfly.
the class CorbaNamingContext method rebind_context.
public void rebind_context(NameComponent[] nc, NamingContext obj) throws NotFound, CannotProceed, InvalidName {
if (this.destroyed)
throw new CannotProceed();
if (nc == null || nc.length == 0)
throw new InvalidName();
if (obj == null)
throw new org.omg.CORBA.BAD_PARAM();
Name n = new Name(nc);
Name ctx = n.ctxName();
NameComponent nb = n.baseNameComponent();
if (ctx == null) {
// the name is bound, but it is bound to an object - the client should have been using rebind().
if (this.names.containsKey(n))
throw new NotFound(NotFoundReason.not_context, new NameComponent[] { nb });
// try to remove an existing context binding.
org.omg.CORBA.Object ref = (org.omg.CORBA.Object) this.contexts.remove(n);
if (ref != null) {
ref._release();
// remove the old context from the implementation cache.
String oid = this.getObjectOID(ref);
if (oid != null)
contextImpls.remove(oid);
}
this.contexts.put(n, obj);
IIOPLogger.ROOT_LOGGER.debugf("Bound context: %s", n.baseNameComponent().id);
} else {
// rebind in the correct context
NameComponent[] ncx = new NameComponent[] { nb };
org.omg.CORBA.Object context = this.resolve(ctx.components());
// try first to call the context implementation object directly.
String contextOID = this.getObjectOID(context);
CorbaNamingContext jbossContext = (contextOID == null ? null : contextImpls.get(contextOID));
if (jbossContext != null)
jbossContext.rebind_context(ncx, obj);
else
NamingContextExtHelper.narrow(context).rebind_context(ncx, obj);
}
}
use of org.omg.CosNaming.NamingContextPackage.CannotProceed in project wildfly by wildfly.
the class CorbaNamingContext method bind.
//======================================= NamingContextOperation Methods ==================================//
public void bind(NameComponent[] nc, org.omg.CORBA.Object obj) throws NotFound, CannotProceed, InvalidName, AlreadyBound {
if (this.destroyed)
throw new CannotProceed();
if (nc == null || nc.length == 0)
throw new InvalidName();
if (obj == null)
throw new org.omg.CORBA.BAD_PARAM();
Name n = new Name(nc);
Name ctx = n.ctxName();
NameComponent nb = n.baseNameComponent();
if (ctx == null) {
if (this.names.containsKey(n)) {
// if the name is still in use, try to ping the object
org.omg.CORBA.Object ref = (org.omg.CORBA.Object) this.names.get(n);
if (isDead(ref)) {
rebind(n.components(), obj);
return;
}
throw new AlreadyBound();
} else if (this.contexts.containsKey(n)) {
// if the name is still in use, try to ping the object
org.omg.CORBA.Object ref = (org.omg.CORBA.Object) this.contexts.get(n);
if (isDead(ref))
unbind(n.components());
throw new AlreadyBound();
}
if ((this.names.put(n, obj)) != null)
throw new CannotProceed(_this(), n.components());
IIOPLogger.ROOT_LOGGER.debugf("Bound name: %s", n);
} else {
NameComponent[] ncx = new NameComponent[] { nb };
org.omg.CORBA.Object context = this.resolve(ctx.components());
// try first to call the context implementation object directly.
String contextOID = this.getObjectOID(context);
CorbaNamingContext jbossContext = (contextOID == null ? null : contextImpls.get(contextOID));
if (jbossContext != null)
jbossContext.bind(ncx, obj);
else
NamingContextExtHelper.narrow(context).bind(ncx, obj);
}
}
Aggregations