Package javax.naming

Examples of javax.naming.Context.lookup()


    public static synchronized <E> E getBeanLocalInstance(final Class beanClass, final Class<E> beanInterface) throws Exception {
        System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                "org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory");

        Context initialContext = new InitialContext();
        E clBean = (E) initialContext.lookup(beanClass.getName() + "_" + beanInterface.getName() + ITF_LOCAL);
        return clBean;
    }

    /**
     * Gets an instance of a bean by the mappedName.
View Full Code Here


    public static synchronized <E> E getBeanByMappedName(final String mappedName) throws Exception {
        System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
                "org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory");

        Context initialContext = new InitialContext();
        E clBean = (E) initialContext.lookup(mappedName);
        return clBean;
    }

}
View Full Code Here

        E eJNDI = null;
        try {
            Context initCtx = new InitialContext();
            Context myEnv = (Context) initCtx.lookup("java:comp/env");

            eJNDI = (E) myEnv.lookup(entryName);

            if (eJNDI == null) {
                logger.debug("Entry reference is null. Name = {0}", entryName);
            }
        } catch (NamingException e) {
View Full Code Here

        // gets the initialcontext
        Context initialContext = new InitialContext();

        // gets the database
       return (DataSource) initialContext.lookup(dsName);
    }
}
View Full Code Here

        
         try
         {
            ic = providerAdaptor.getInitialContext();
           
            Object obj = ic.lookup(providerAdaptor.getFactoryRef());
           
            if (!(obj instanceof XAConnectionFactory))
            {
               throw new IllegalArgumentException("Connection factory from jms provider is not a XAConnectionFactory");
            }
View Full Code Here

        SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMddHHmmss");

        Context initialContext = getInitialContext();
        boolean clusteringEnabled = false;

        ClusterRemote statelessBean = (ClusterRemote) initialContext.lookup("org.ow2.easybeans.examples.cluster.ClusterBeanAN"
                + "_" + ClusterRemote.class.getName() + "@Remote");

        if (statelessBean instanceof CMIProxy) {
            clusteringEnabled = true;
            System.out.println("Clustering is enabled.");
View Full Code Here

        String msg = null;
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMddHHmmss");

        Context initialContext = getInitialContext();
        boolean clusteringEnabled = false;
        ClusterRemote statelessBean = (ClusterRemote) initialContext.lookup("clusterBeanConfiguredByXML");

        if (statelessBean instanceof CMIProxy) {
            clusteringEnabled = true;
            System.out.println("Clustering is enabled.");
        }
View Full Code Here

        }

        // Get bean configured with annotation
        final BusinessInterface poolBeanAnnotation;
        try {
            poolBeanAnnotation = (BusinessInterface) initialContext.lookup("poolBeanConfiguredByAnnotation");
        } catch (NamingException e) {
            System.err.println("Cannot get bean: " + e);
            System.exit(2);
            return;
        }
View Full Code Here

        }

        // Get bean configured with XML
        final BusinessInterface poolBeanXML;
        try {
            poolBeanXML = (BusinessInterface) initialContext.lookup("poolBeanConfiguredByXML");
        } catch (NamingException e) {
            System.err.println("Cannot get bean: " + e);
            System.exit(2);
            return;
        }
View Full Code Here

        // Get context
        Context initialContext = getInitialContext();

        // Get factory
        QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) initialContext
        .lookup(QUEUE_CONNECTION_FACTORY);

        // Lookup the Queues through their JNDI name
        Queue annotationQueue = (Queue) initialContext.lookup(SAMPLE_QUEUE_MDB_ANNOTATION);
        Queue xmlQueue = (Queue) initialContext.lookup(SAMPLE_QUEUE_MDB_XML);
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.