Package javax.naming

Examples of javax.naming.Context.lookup()


    /** Helper method - gets the EJB home interface based on name. */
    public static Object getHomeInterface(String name, Class homeInterface)
            throws NamingException {
        Context context = new InitialContext();
        Object ref = context.lookup(name);

        if (null == ref)
            return null;

        return PortableRemoteObject.narrow(ref, homeInterface);
View Full Code Here


    protected void createEnvContext ()
    throws NamingException
    {
        Context context = new InitialContext();
        compCtx =  (Context)context.lookup ("java:comp");
        envCtx = compCtx.createSubcontext("env");
        if (Log.isDebugEnabled())
            Log.debug("Created java:comp/env for webapp "+getWebAppContext().getContextPath());
    }
   
View Full Code Here

      if ( initialContext == null ) {
        fLogger.severe(
          "DataSource problem. InitialContext is null. Db : " + Util.quote(dbConnString)
        );
      }
      DataSource datasource = (DataSource)initialContext.lookup(dbConnString);
      if ( datasource == null ){
        fLogger.severe("Datasource is null for : " + dbConnString);
      }
      result = datasource.getConnection();
    }
View Full Code Here

        Context context = JMSUtils.getInitialContext(addrDetails);
        Connection connection = null;
       
        if (JMSConstants.JMS_QUEUE.equals(addrDetails.getDestinationStyle().value())) {
            QueueConnectionFactory qcf =
                (QueueConnectionFactory)context.lookup(addrDetails.getJndiConnectionFactoryName());
            if (addrDetails.isSetConnectionUserName()) {
                connection = qcf.createQueueConnection(addrDetails.getConnectionUserName(),
                                                       addrDetails.getConnectionPassword());
            } else {
                connection = qcf.createQueueConnection();
View Full Code Here

            } else {
                connection = qcf.createQueueConnection();
            }
        } else {
            TopicConnectionFactory tcf =
                (TopicConnectionFactory)context.lookup(addrDetails.getJndiConnectionFactoryName());
            if (addrDetails.isSetConnectionUserName()) {
                connection = tcf.createTopicConnection(addrDetails.getConnectionUserName(),
                                                       addrDetails.getConnectionPassword());
            } else {
                connection = tcf.createTopicConnection();
View Full Code Here

        }

        connection.start();

        Destination requestDestination =
                (Destination)context.lookup(
                                           addrDetails.getJndiDestinationName());

        Destination replyDestination = (null != addrDetails.getJndiReplyDestinationName())
            ? (Destination)context.lookup(addrDetails.getJndiReplyDestinationName()) : null;
View Full Code Here

        Destination requestDestination =
                (Destination)context.lookup(
                                           addrDetails.getJndiDestinationName());

        Destination replyDestination = (null != addrDetails.getJndiReplyDestinationName())
            ? (Destination)context.lookup(addrDetails.getJndiReplyDestinationName()) : null;

        // create session factory to manage session, reply destination,
        // producer and consumer pooling
        //
           
View Full Code Here

                        // Make contexts that are not already present
                        try {
                            currentContext = currentContext
                                    .createSubcontext(fullName.get(0));
                        } catch (NamingException err) {
                            currentContext = (Context) currentContext
                                    .lookup(fullName.get(0));
                        }
                        fullName = fullName.getSuffix(1);
                    }
                    ic.bind(name, this.objectsToCreate.get(name));
View Full Code Here

      {
         String tok = st.nextToken();

         try
         {
            Object o = crtContext.lookup(tok);
            if (!(o instanceof Context))
            {
               throw new NamingException("Path " + path + " overwrites and already bound object");
            }
            crtContext = (Context)o;
View Full Code Here

     
      Context icTarget = targetAdaptor.getInitialContext();
     
      Destination sourceDest = (Destination)icSource.lookup(sourceDestinationLookup);
     
      Destination targetDest = (Destination)icTarget.lookup(targetDestinationLookup);
           
      String sourceCFRef = sourceAdaptor.getFactoryRef();
     
      String targetCFRef = targetAdaptor.getFactoryRef();
     
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.