Package javax.naming

Examples of javax.naming.CannotProceedException


                ne = new NameNotFoundException();
            }

        } else if (e instanceof CannotProceed) {

            ne = new CannotProceedException();
            NamingContext nc = ((CannotProceed) e).cxt;
            NameComponent[] rest = ((CannotProceed) e).rest_of_name;

            // %%% We assume that rest returns *all* unprocessed components.
            // Don't' know if that is a good assumption, given
View Full Code Here


                System.arraycopy(inputName, 0, resolvedName, 0, len);
            }
        }

        // Create CPE and set common fields
        CannotProceedException cpe = new CannotProceedException();
        cpe.setRootCause(e);
        if (rest != null && rest.length > 0) {
            cpe.setRemainingName(org.jboss.as.jacorb.naming.jndi.CNNameParser.cosNameToName(rest));
        }
        cpe.setEnvironment(ctx._env);

        // Lookup resolved name to get resolved object
        final java.lang.Object resolvedObj =
                (resolvedName != null) ? ctx.callResolve(resolvedName) : ctx;

        if (resolvedObj instanceof javax.naming.Context) {
            // obj is a context and child is not found
            // try getting its nns dynamically by constructing
            // a Reference containing obj.
            RefAddr addr = new RefAddr("nns") {
                public java.lang.Object getContent() {
                    return resolvedObj;
                }

                private static final long serialVersionUID =
                        669984699392133792L;
            };
            Reference ref = new Reference("java.lang.Object", addr);

            // Resolved name has trailing slash to indicate nns
            CompositeName cname = new CompositeName();
            cname.add(""); // add trailing slash

            cpe.setResolvedObj(ref);
            cpe.setAltName(cname);
            cpe.setAltNameCtx((javax.naming.Context) resolvedObj);

            return cpe;
        } else {
            // Not a context, use object factory to transform object.

            Name cname = org.jboss.as.jacorb.naming.jndi.CNNameParser.cosNameToName(resolvedName);
            java.lang.Object resolvedObj2;
            try {
                resolvedObj2 = NamingManager.getObjectInstance(resolvedObj,
                        cname, ctx, ctx._env);
            } catch (NamingException ge) {
                throw ge;
            } catch (Exception ge) {
                NamingException ne = JacORBMessages.MESSAGES.errorGeneratingObjectViaFactory();
                ne.setRootCause(ge);
                throw ne;
            }

            // If a context, continue operation with context
            if (resolvedObj2 instanceof javax.naming.Context) {
                cpe.setResolvedObj(resolvedObj2);
            } else {
                // Add trailing slash
                cname.add("");
                cpe.setAltName(cname);

                // Create nns reference
                final java.lang.Object rf2 = resolvedObj2;
                RefAddr addr = new RefAddr("nns") {
                    public java.lang.Object getContent() {
                        return rf2;
                    }

                    private static final long serialVersionUID =
                            -785132553978269772L;
                };
                Reference ref = new Reference("java.lang.Object", addr);
                cpe.setResolvedObj(ref);
                cpe.setAltNameCtx(ctx);
            }
            return cpe;
        }
    }
View Full Code Here

     * @param resolvedObject the resolved object
     * @param remainingName the remaining name
     * @return the exception
     */
    public static CannotProceedException cannotProceedException(final Object resolvedObject, final Name remainingName) {
        final CannotProceedException cpe = new CannotProceedException();
        cpe.setResolvedObj(resolvedObject);
        cpe.setRemainingName(remainingName);
        return cpe;
    }
View Full Code Here

     * @param resolvedObject the resolved object
     * @param remainingName the remaining name
     * @return the exception
     */
    public static CannotProceedException cannotProceedException(final Object resolvedObject, final Name remainingName) {
        final CannotProceedException cpe = new CannotProceedException();
        cpe.setResolvedObj(resolvedObject);
        cpe.setRemainingName(remainingName);
        return cpe;
    }
View Full Code Here

            }
        }
    }

    private static CannotProceedException cannotProceedException(final Object resolvedObject, final Name remainingName) {
        final CannotProceedException cpe = new CannotProceedException();
        cpe.setResolvedObj(resolvedObject);
        cpe.setRemainingName(remainingName);
        return cpe;
    }
View Full Code Here

            throw new InvalidNameException(Messages.getString("jndi.4B")); //$NON-NLS-1$
        }

        // we should have correct nameToLookFor at this point
        if (remainingName != null) {
            CannotProceedException cpe = constructCannotProceedException(
                    altName, remainingName);
            DirContext nnsContext =
                    DirectoryManager.getContinuationDirContext(cpe);

            attrs = nnsContext.getAttributes(remainingName, attrNames);
View Full Code Here

        }
        // we should have correct nameToLookFor at this point
        types[0] = lookupAttrType;
        classes[0] = lookupAttrClass;
        if (remainingName != null) {
            CannotProceedException cpe = constructCannotProceedException(
                    altName, remainingName);
            Context nnsContext = DirectoryManager.getContinuationContext(cpe);

            result = nnsContext.lookup(remainingName);
        } else {
View Full Code Here

                return context;
            }
        };
        Reference ref = new Reference(
                this.getClass().getName(), refAddr);
        CannotProceedException cpe = null;
        CompositeName resolvedName = null;

        if (environment.containsKey(NamingManager.CPE)) {
            cpe = (CannotProceedException)
                    environment.get(NamingManager.CPE);
            resolvedName = (CompositeName) cpe.getResolvedName();
            // remove the last component if it is ""
            // (the sign of the next naming system)
            if (resolvedName != null &&
                    resolvedName.get(resolvedName.size() - 1)
                            .equals("")) //$NON-NLS-1$
            {
                resolvedName.remove(resolvedName.size() - 1);
            }
        }               
        else {
            cpe = new CannotProceedException();
        }
        cpe.setEnvironment((Hashtable) environment.clone());
        cpe.setAltName(name);
        cpe.setAltNameCtx((DNSContext) this.clone());
        cpe.setRemainingName(remainingName);
        if (resolvedName == null) {
            resolvedName = new CompositeName();
        }
        resolvedName.add(nameToLookFor.toString());
        // the sign of the next naming system
        resolvedName.add(""); //$NON-NLS-1$
        cpe.setResolvedName(resolvedName);
        cpe.setResolvedObj(ref);
        return cpe;
    }
View Full Code Here

        else {
            throw new InvalidNameException(Messages.getString("jndi.4B")); //$NON-NLS-1$
        }
        // we should have correct nameToLookFor at this point
        if (remainingName != null) {
            CannotProceedException cpe = constructCannotProceedException(
                    altName, remainingName);
            Context nnsContext = DirectoryManager.getContinuationContext(cpe);

            result = (NamingEnumeration<T>)nnsContext.list(remainingName);
        } else {
View Full Code Here

        }
        return target.toString();
    }

    protected Context findNnsContext(Name name) throws NamingException {
        CannotProceedException cpe = null;
        if (env.containsKey(NamingManager.CPE)) {
            cpe = (CannotProceedException) env.get(NamingManager.CPE);
        } else {
            cpe = new CannotProceedException();
        }

        Name remainingName = name.getSuffix(1);
        Name altName = name.getPrefix(0);
        Name targetName = composeName(altName, contextDn);

        Name resolvedName = cpe.getResolvedName();
        if (resolvedName == null) {
            resolvedName = new CompositeName();

        } else if (resolvedName.size() >= 2
                && resolvedName.get(resolvedName.size() - 1).equals("")) {
            // remove the last component if it is ""
            // (the sign of the next naming system), so there must be at least
            // one name before "".
            resolvedName.remove(resolvedName.size() - 1);
        }

        resolvedName.add(targetName.toString());
        // add empty component name to indicate nns pointer
        resolvedName.add("");

        cpe.setAltName(altName);
        cpe.setAltNameCtx(this);
        cpe.setEnvironment((Hashtable<Object, Object>) env.clone());
        cpe.setRemainingName(remainingName);
        cpe.setResolvedName(resolvedName);

        final LdapContextImpl context = new LdapContextImpl(this, env,
                composeName(altName, contextDn).toString());

        RefAddr addr = new RefAddr("nns") { //$NON-NLS-1$

            private static final long serialVersionUID = -5428706819217461955L;

            @Override
            public Object getContent() {
                return context;
            }

        };

        Reference ref = new Reference(context.getClass().getName(), addr);
        cpe.setResolvedObj(ref);

        return DirectoryManager.getContinuationDirContext(cpe);
    }
View Full Code Here

TOP

Related Classes of javax.naming.CannotProceedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.