Package javax.naming

Examples of javax.naming.CannotProceedException


        }
        // 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


            public Object getContent() {
                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 false;
    }

    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();
        }

        String dn = name.get(0);

        // seems altName always is "/"
        Name altName = new CompositeName();
        altName.add("");

        // if the dn doesn't exist, throw NameNotFoundException
        lookup(dn);

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

        }

        resolvedName.add(dn);

        Name remainingName = name.getSuffix(1);
        if (remainingName.size() == 1 && remainingName.get(0).equals("")) {
            remainingName = new CompositeName();
            if (!resolvedName.get(resolvedName.size() - 1).equals("")) {
                resolvedName.add("");
            }
        }

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

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

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

            private static final long serialVersionUID = -5428706819217461955L;

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

        };

        // class name is always java.lang.Object in RI
        Reference ref = new Reference(Object.class.getName(), addr);

        cpe.setResolvedObj(ref);

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

  public void testGetContinuationContext_MockContext_null_null_null()
      throws NamingException {
    log
        .setMethod("testGetContinuationContext_MockContext_null_null_null()");
    CannotProceedException cpe = new CannotProceedException();
    Object resolvedObj = new MockContext(new Hashtable<String, Object>());
    cpe.setResolvedObj(resolvedObj);
    Context r = NamingManager.getContinuationContext(cpe);
    assertSame(resolvedObj, r);
    assertSame(cpe, cpe.getEnvironment().get(NamingManager.CPE));
  }
View Full Code Here

  }

  public void testGetContinuationContext_OBJ_name_context_h()
      throws NamingException {
    log.setMethod("testGetContinuationContext_OBJ_name_context_h()");
    CannotProceedException cpe = new CannotProceedException();
    cpe.setResolvedObj("resolved object");
    cpe.setAltName(new CompositeName("abc/abc"));
    cpe.setAltNameCtx(new MockContext(new Hashtable<String, Object>()));
    Hashtable<String, String> h = new Hashtable<String, String>();
    h
        .put(Context.OBJECT_FACTORIES,
            "org.apache.harmony.jndi.tests.javax.naming.spi.NamingManagerTest$MockContextObjectFactory");
    cpe.setEnvironment(h);
    Context r = NamingManager.getContinuationContext(cpe);
    assertTrue(r instanceof MockContext);
  }
View Full Code Here

  }

  public void testGetContinuationContext_OBJ_name_context_badnameh()
      throws NamingException {
    log.setMethod("testGetContinuationContext_OBJ_name_context_badnameh()");
    CannotProceedException cpe = new CannotProceedException();
    Object obj = "resolved object";
    cpe.setResolvedObj(obj);
    CompositeName altName = new CompositeName("abc/abc");
    cpe.setAltName(altName);
    MockContext context = new MockContext(new Hashtable<String, Object>());
    cpe.setAltNameCtx(context);
    Hashtable<String, String> h = new Hashtable<String, String>();
    h.put(Context.OBJECT_FACTORIES, "bad name:asdfa");
    cpe.setEnvironment(h);
    try {
      NamingManager.getContinuationContext(cpe);
      fail();
    } catch (CannotProceedException e) {
      assertCPE(cpe, altName, context, h, e, obj);
View Full Code Here

  }

  public void testGetContinuationContext_OBJ_name_context_wrongh()
      throws NamingException {
    log.setMethod("testGetContinuationContext_OBJ_name_context_wrongh()");
    CannotProceedException cpe = new CannotProceedException();
    Object obj = "resolved object";
    cpe.setResolvedObj(obj);

    CompositeName altName = new CompositeName("abc/abc");
    cpe.setAltName(altName);
    MockContext context = new MockContext(new Hashtable<String, Object>());
    cpe.setAltNameCtx(context);
    Hashtable<String, String> h = new Hashtable<String, String>();
    h
        .put(Context.OBJECT_FACTORIES,
            "org.apache.harmony.jndi.tests.javax.naming.spi.NamingManagerTest$MockObjectFactory");
    cpe.setEnvironment(h);
    try {
      NamingManager.getContinuationContext(cpe);
      fail();
    } catch (CannotProceedException e) {
      assertCPE(cpe, altName, context, h, e, obj);
View Full Code Here

  }

  public void testGetContinuationContext_null_name_context_h()
      throws NamingException {
    log.setMethod("testGetContinuationContext_null_name_context_h()");
    CannotProceedException cpe = new CannotProceedException();
    CompositeName altName = new CompositeName("abc/abc");
    cpe.setAltName(altName);
    MockContext context = new MockContext(new Hashtable<String, Object>());
    cpe.setAltNameCtx(context);
    Hashtable<String, String> h = new Hashtable<String, String>();
    h.put(Context.OBJECT_FACTORIES,"org.apache.harmony.jndi.tests.javax.naming.spi.NamingManagerTest$MockContextObjectFactory");
        cpe.setEnvironment(h);
    try {
        NamingManager.getContinuationContext(cpe);
      fail();
    } catch (CannotProceedException e) {
      assertCPE(cpe, altName, context, h, e, null);
View Full Code Here

  }

  public void testGetContinuationContext_OBJ_null_ctx_h()
      throws NamingException {
    log.setMethod("testGetContinuationContext_OBJ_null_ctx_h()");
    CannotProceedException cpe = new CannotProceedException();
    cpe.setResolvedObj("resolved object");
    cpe.setAltNameCtx(new MockContext(new Hashtable<String, Object>()));
    Hashtable<String, String> h = new Hashtable<String, String>();
    h
        .put(Context.OBJECT_FACTORIES,
            "org.apache.harmony.jndi.tests.javax.naming.spi.NamingManagerTest$MockContextObjectFactory");
    cpe.setEnvironment(h);
    Context r = NamingManager.getContinuationContext(cpe);
    assertTrue(r instanceof MockContext);
  }
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.