Package javax.naming

Examples of javax.naming.Context.createSubcontext()


    public Context createSubcontext(String name) throws NamingException {
        ResolveResult result = getRootURLContext(name, environment);
        Context context = (Context) result.getResolvedObj();

        try {
            return context.createSubcontext(result.getRemainingName());
        } finally {
            context.close();
        }
    }
View Full Code Here


        }
        final Context namespaceContext = selector.getContext(parsedName.namespace());
        if (namespaceContext == null) {
            throw new NameNotFoundException(name.toString());
        }
        return namespaceContext.createSubcontext(parsedName.remaining());
    }

    private interface ParsedName {
        String namespace();
View Full Code Here

   protected void createSubContextForFactories()
   {
      try
      {
         Context root = new InitialContext(jndiEnvironment);
         this.bvFactoryContext = root.createSubcontext(BV_FACTORY_JNDI_SUBCONTEXT);
      }
      catch (NamingException e)
      {
         log.error("Unable to create JNDI subcontext for Bean Validation Factories", e);
      }
View Full Code Here

         {
            fromCtx = (Context) fromCtx.lookup(comp);
         }
         catch(NameNotFoundException e)
         {
            fromCtx = fromCtx.createSubcontext(comp);
         }
      }

      log.debug("atom: " + atom);
      log.debug("link: " + link);
View Full Code Here

     * @throws StartException If any problems occur creating the context
     */
    public synchronized void start(final StartContext context) throws StartException {
        final Context parentContext = parentContextValue.getValue();
        try {
            this.context = parentContext.createSubcontext(name.getLocalName());
        } catch (NamingException e) {
            throw new StartException("Failed to create sub-context with name '" + name + "' in context '" + parentContext + "'", e);
        }
    }

View Full Code Here

     */
    protected void bindDataSource() throws Exception
    {
        BasicDataSource dataSource = getDataSource();
        Context context = getInitialContext();
        context.createSubcontext(JNDI_SUBCONTEXT);
        context.bind(JNDI_PATH, dataSource);
    }

    /**
     * Retrieves a BasicDataSource from jndi.
View Full Code Here

        if (name.size() == 1) {
            return createSubcontext(name.get(0));
        }
        Context context = getContinuationContext(name);
        try {
            return context.createSubcontext(name.getSuffix(1));
        } finally {
            context.close();
        }
    }
View Full Code Here

    public Context createSubcontext(String name) throws NamingException {
        ResolveResult result = getRootURLContext(name, environment);
        Context context = (Context) result.getResolvedObj();

        try {
            return context.createSubcontext(result.getRemainingName());
        } finally {
            context.close();
        }
    }
View Full Code Here

            // create intermediate contexts
            for (int i = 1; i < parsedName.size(); i++) {
                Name contextName = parsedName.getPrefix(i);
                if (!bindingExists(context, contextName)) {
                    context.createSubcontext(contextName);
                }
            }

            // bind
            context.bind(jndiName, value);
View Full Code Here

         result.lookup( "java:comp/env" );
      }
      catch ( NameNotFoundException e )
      {
         compContext = result.createSubcontext( "comp" );
         compContext.createSubcontext( "env" );
      }

      return result;
   }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.