Search in sources :

Example 1 with InvalidName

use of org.omg.CosNaming.NamingContextPackage.InvalidName 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;
}
Also used : NameComponent(org.omg.CosNaming.NameComponent) InvalidName(org.omg.CosNaming.NamingContextPackage.InvalidName) NamingContextExt(org.omg.CosNaming.NamingContextExt) CannotProceed(org.omg.CosNaming.NamingContextPackage.CannotProceed) InvalidClassException(java.io.InvalidClassException) StartException(org.jboss.msc.service.StartException) IOException(java.io.IOException) NotFound(org.omg.CosNaming.NamingContextPackage.NotFound)

Example 2 with InvalidName

use of org.omg.CosNaming.NamingContextPackage.InvalidName 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);
    }
}
Also used : NameComponent(org.omg.CosNaming.NameComponent) AlreadyBound(org.omg.CosNaming.NamingContextPackage.AlreadyBound) CannotProceed(org.omg.CosNaming.NamingContextPackage.CannotProceed) InvalidName(org.omg.CosNaming.NamingContextPackage.InvalidName)

Example 3 with InvalidName

use of org.omg.CosNaming.NamingContextPackage.InvalidName in project wildfly by wildfly.

the class CorbaNamingContext method unbind.

public void unbind(NameComponent[] nc) throws NotFound, CannotProceed, InvalidName {
    if (this.destroyed)
        throw new CannotProceed();
    if (nc == null || nc.length == 0)
        throw new InvalidName();
    Name n = new Name(nc);
    Name ctx = n.ctxName();
    NameComponent nb = n.baseNameComponent();
    if (ctx == null) {
        if (this.names.containsKey(n)) {
            org.omg.CORBA.Object ref = (org.omg.CORBA.Object) this.names.remove(n);
            ref._release();
            IIOPLogger.ROOT_LOGGER.debugf("Unbound: %s", n);
        } else if (this.contexts.containsKey(n)) {
            org.omg.CORBA.Object ref = (org.omg.CORBA.Object) this.contexts.remove(n);
            ref._release();
            // remove the context from the implementation cache.
            String oid = this.getObjectOID(ref);
            if (oid != null)
                contextImpls.remove(oid);
            IIOPLogger.ROOT_LOGGER.debugf("Unbound: %s", n);
        } else {
            IIOPLogger.ROOT_LOGGER.failedToUnbindObject(n);
            throw new NotFound(NotFoundReason.not_context, n.components());
        }
    } 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.unbind(ncx);
        else
            NamingContextExtHelper.narrow(context).unbind(ncx);
    }
}
Also used : NameComponent(org.omg.CosNaming.NameComponent) CannotProceed(org.omg.CosNaming.NamingContextPackage.CannotProceed) InvalidName(org.omg.CosNaming.NamingContextPackage.InvalidName) InvalidName(org.omg.CosNaming.NamingContextPackage.InvalidName) NotFound(org.omg.CosNaming.NamingContextPackage.NotFound)

Example 4 with InvalidName

use of org.omg.CosNaming.NamingContextPackage.InvalidName in project wildfly by wildfly.

the class CorbaNamingContext method resolve.

public org.omg.CORBA.Object resolve(NameComponent[] nc) throws NotFound, CannotProceed, InvalidName {
    if (this.destroyed)
        throw new CannotProceed();
    if (nc == null || nc.length == 0)
        throw new InvalidName();
    Name n = new Name(nc[0]);
    if (nc.length > 1) {
        org.omg.CORBA.Object next_context = (org.omg.CORBA.Object) this.contexts.get(n);
        if ((next_context == null) || (isDead(next_context)))
            throw new NotFound(NotFoundReason.missing_node, nc);
        NameComponent[] nc_prime = new NameComponent[nc.length - 1];
        System.arraycopy(nc, 1, nc_prime, 0, nc_prime.length);
        // try first to call the context implementation object directly.
        String contextOID = this.getObjectOID(next_context);
        CorbaNamingContext jbossContext = (contextOID == null ? null : contextImpls.get(contextOID));
        if (jbossContext != null)
            return jbossContext.resolve(nc_prime);
        else
            return NamingContextExtHelper.narrow(next_context).resolve(nc_prime);
    } else {
        org.omg.CORBA.Object result = (org.omg.CORBA.Object) this.contexts.get(n);
        if (result == null)
            result = (org.omg.CORBA.Object) this.names.get(n);
        if (result == null)
            throw new NotFound(NotFoundReason.missing_node, n.components());
        if (!noPing && isDead(result))
            throw new NotFound(NotFoundReason.missing_node, n.components());
        return result;
    }
}
Also used : NameComponent(org.omg.CosNaming.NameComponent) CannotProceed(org.omg.CosNaming.NamingContextPackage.CannotProceed) InvalidName(org.omg.CosNaming.NamingContextPackage.InvalidName) InvalidName(org.omg.CosNaming.NamingContextPackage.InvalidName) NotFound(org.omg.CosNaming.NamingContextPackage.NotFound)

Example 5 with InvalidName

use of org.omg.CosNaming.NamingContextPackage.InvalidName 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);
    }
}
Also used : NameComponent(org.omg.CosNaming.NameComponent) CannotProceed(org.omg.CosNaming.NamingContextPackage.CannotProceed) InvalidName(org.omg.CosNaming.NamingContextPackage.InvalidName) InvalidName(org.omg.CosNaming.NamingContextPackage.InvalidName) AlreadyBound(org.omg.CosNaming.NamingContextPackage.AlreadyBound)

Aggregations

InvalidName (org.omg.CosNaming.NamingContextPackage.InvalidName)11 NameComponent (org.omg.CosNaming.NameComponent)9 CannotProceed (org.omg.CosNaming.NamingContextPackage.CannotProceed)9 NotFound (org.omg.CosNaming.NamingContextPackage.NotFound)6 AlreadyBound (org.omg.CosNaming.NamingContextPackage.AlreadyBound)3 NamingContext (org.omg.CosNaming.NamingContext)2 IOException (java.io.IOException)1 InvalidClassException (java.io.InvalidClassException)1 Vector (java.util.Vector)1 CannotProceedException (javax.naming.CannotProceedException)1 ContextNotEmptyException (javax.naming.ContextNotEmptyException)1 InvalidNameException (javax.naming.InvalidNameException)1 NameAlreadyBoundException (javax.naming.NameAlreadyBoundException)1 NameNotFoundException (javax.naming.NameNotFoundException)1 NamingException (javax.naming.NamingException)1 StartException (org.jboss.msc.service.StartException)1 NamingContextExt (org.omg.CosNaming.NamingContextExt)1 NotEmpty (org.omg.CosNaming.NamingContextPackage.NotEmpty)1