Package javax.naming

Examples of javax.naming.Context.lookup()


   {
      props = null;
      Context context = new InitialContext();
      try
      {
         Object obj = context.lookup(JNDI_NAME);
         assertNull(JNDI_NAME + " not bound", obj);
      }
      catch (NameNotFoundException n)
      {
         // expected
View Full Code Here


      cache.create();


      MockDataSource ds = new MockDataSource(props);
      context.bind(JNDI_NAME, ds);
      assertNotNull(JNDI_NAME + " bound", context.lookup(JNDI_NAME));
      cache.start();

      assertNotNull("Cache has a cache loader", cache.getCacheLoaderManager().getCacheLoader());
   }
View Full Code Here

         DummyTransactionManager.getInstance();

         Context context = new InitialContext();
         try
         {
            Object obj = context.lookup(JNDI_NAME);
            assertNull(JNDI_NAME + " not bound", obj);
         }
         catch (NameNotFoundException n)
         {
            // expected
View Full Code Here

         ds = new jdbcDataSource();
         ds.setDatabase(prop.getProperty("cache.jdbc.url"));
         ds.setUser("sa");

         context.bind(JNDI_NAME, ds);
         assertNotNull(JNDI_NAME + " bound", context.lookup(JNDI_NAME));
      }
      Properties p = new Properties();
      p.setProperty("cache.jdbc.datasource", JNDI_NAME);
      p.setProperty("cache.jdbc.node.type", prop.getProperty("cache.jdbc.node.type"));
      p.setProperty("cache.jdbc.table.name", prop.getProperty("cache.jdbc.table.name"));
View Full Code Here

                //## Java 1.4 begin ##
            } else if (javax.naming.Context.class.isAssignableFrom(d)) {
                // JNDI context
                try {
                    Context context = (Context) d.newInstance();
                    DataSource ds = (DataSource) context.lookup(url);
                    String user = prop.getProperty("user");
                    String password = prop.getProperty("password");
                    if (StringUtils.isNullOrEmpty(user) && StringUtils.isNullOrEmpty(password)) {
                        return ds.getConnection();
                    }
View Full Code Here

    ResolveResult r = findContextFor(name);
    Context ctx = (Context) r.getResolvedObj();
    String rname = r.getRemainingName().toString();
   

    Object o =  ctx.lookup(rname);
    return o;
    ////////////////////////////
    // Resolve the name in its proper context
    //return ctx.lookup(rname);
  }
View Full Code Here

  public static void main(String[] args) throws Exception {
    System.out.println();
    System.out.println("Listens to the monitoring topic...");

    Context ictx = new InitialContext();
    Topic topic = (Topic) ictx.lookup("MonitoringTopic");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    Connection cnx = cf.createConnection();
    Session sess = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
View Full Code Here

    System.out.println();
    System.out.println("Listens to the monitoring topic...");

    Context ictx = new InitialContext();
    Topic topic = (Topic) ictx.lookup("MonitoringTopic");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    Connection cnx = cf.createConnection();
    Session sess = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageConsumer subs = sess.createConsumer(topic);
View Full Code Here

public class DMQWatcher {
  public static void main(String[] args) throws Exception {
    System.out.println("Listens to the dead message queue...");

    Context ictx = new InitialContext();
    Queue dmq = (Queue) ictx.lookup("dmq");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    Connection cnx = cf.createConnection("anonymous", "anonymous");
View Full Code Here

  public static void main(String[] args) throws Exception {
    System.out.println("Listens to the dead message queue...");

    Context ictx = new InitialContext();
    Queue dmq = (Queue) ictx.lookup("dmq");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    Connection cnx = cf.createConnection("anonymous", "anonymous");

    Session session = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
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.