Package javax.naming

Examples of javax.naming.InitialContext


      if (ds == null)
      {
         System.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);
         DummyTransactionManager.getInstance();

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

         prop = UnitTestDatabaseManager.getTestDbProperties();

         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


   @AfterTest
   protected void destroyDbAfterTest() throws Exception
   {
      Properties icProps = new Properties();
      icProps.setProperty(Context.INITIAL_CONTEXT_FACTORY, FACTORY);
      Context ctx = new InitialContext(icProps);
      ctx.unbind(JNDI_NAME);
      UnitTestDatabaseManager.shutdownInMemoryDatabase(prop);
   }
View Full Code Here

    * @return A user transaction.
    * @throws Exception Any exception thrown by the context lookup.
    */
   private UserTransaction getTransaction() throws Exception
   {
      return (UserTransaction) new InitialContext(PROPERTIES)
            .lookup("UserTransaction");
   }
View Full Code Here

  static Context ictx = null;

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

    ictx = new InitialContext();
    Topic topic = (Topic) ictx.lookup("topic");
    ConnectionFactory tcf = (ConnectionFactory) ictx.lookup("tcf");
    ictx.close();

    Connection cnx = tcf.createConnection();
View Full Code Here

    Topic dest = null;

    if (args.length != 1)
     throw new Exception("Bad number of argument");

    ictx = new InitialContext();
    try {
      if (args[0].equals("-")) {
        // Choose a connection factory and the associated topic depending of
        // the location property.
        cf = (ConnectionFactory) ictx.lookup("clusterCF");
View Full Code Here

  static Context ictx = null;

  public static void main(String[] args) throws Exception {
    System.out.println("Trace1");

    ictx = new InitialContext();
    Queue queue = (Queue) ictx.lookup("receiveMailQueue");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();

    System.out.println("Trace2");
View Full Code Here

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

    ictx = new InitialContext();
    Queue queue = (Queue) ictx.lookup("queue");
    // Topic topic = (Topic) ictx.lookup("topic");
    ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
    ictx.close();
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);
    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");

    Session session = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageConsumer consumer = session.createConsumer(dmq);
View Full Code Here

      JoramAdapter ja= new JoramAdapter() ;
     
      ja.start(bt);
      System.out.println("start ...");
    
      Context ictx = new InitialContext();
      Queue queue = (Queue) ictx.lookup("queue");
      Topic topic = (Topic) ictx.lookup("topic");
    
      ictx.close();

      ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
      mcf.setResourceAdapter(ja);
      System.out.println("ManagedConnectionFactoryImpl ok");
    
View Full Code Here

TOP

Related Classes of javax.naming.InitialContext

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.