Package javax.naming

Examples of javax.naming.Reference


    OutboundConnectionFactory factory =
      new OutboundQueueConnectionFactory(this,
                                         DefaultConnectionManager.getRef());

    Reference ref =
      new Reference(factory.getClass().getName(),
                    "org.objectweb.joram.client.connector.ObjectFactoryImpl",
                    null);
    ref.add(new StringRefAddr("hostName", hostName));
    ref.add(new StringRefAddr("serverPort", "" + serverPort));
    ref.add(new StringRefAddr("userName", userName));
    ref.add(new StringRefAddr("password", password));
    ref.add(new StringRefAddr("identityClass", identityClass));

    factory.setReference(ref);
    return factory;
  }
View Full Code Here


      AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG, this + " getObjectInstance(" + obj +
                                    ", " + name +
                                    ", " + ctx +
                                    ", " + env + ")");

    Reference ref = (Reference) obj;

    String hostName = (String) ref.get("hostName").getContent();
    Integer serverPort =
      new Integer((String) ref.get("serverPort").getContent());
    String userName = (String) ref.get("userName").getContent();
    String password = (String) ref.get("password").getContent();
    String identityClass = (String) ref.get("identityClass").getContent();

    ManagedConnectionFactoryImpl mcf = null;

    if (ref.getClassName().equals(cf))
      mcf = new ManagedConnectionFactoryImpl();
    else if (ref.getClassName().equals(qcf))
      mcf = new ManagedQueueConnectionFactoryImpl();
    else if (ref.getClassName().equals(tcf))
      mcf = new ManagedTopicConnectionFactoryImpl();
    else
      return null;

    mcf.setCollocated(new Boolean(false));
View Full Code Here

    OutboundConnectionFactory factory =
      new OutboundTopicConnectionFactory(this,
                                         DefaultConnectionManager.getRef());

    Reference ref =
      new Reference(factory.getClass().getName(),
                    "org.objectweb.joram.client.connector.ObjectFactoryImpl",
                    null);
    ref.add(new StringRefAddr("hostName", hostName));
    ref.add(new StringRefAddr("serverPort", "" + serverPort));
    ref.add(new StringRefAddr("userName", userName));
    ref.add(new StringRefAddr("password", password));
    ref.add(new StringRefAddr("identityClass", identityClass));

    factory.setReference(ref);
    return factory;
  }
View Full Code Here

public abstract class  AdministeredObject implements Serializable, javax.naming.Referenceable, SoapObjectItf {
  /** define serialVersionUID for interoperability */
  private static final long serialVersionUID = 1L;

  public final Reference getReference() throws NamingException {
    Reference ref = null;
    ref = new Reference(this.getClass().getName(), ObjectFactory.class.getName(), null);
    toReference(ref);
    return ref;
  }
View Full Code Here

    return res;
  }

  private static String getClassName(Object obj) {
    if (obj instanceof Reference) {
      Reference ref = (Reference)obj;
      return ref.getClassName();
    }
    return obj.getClass().getName();
  }
View Full Code Here

      AdapterTracing.dbgAdapter.log(BasicLevel.DEBUG, this + " createConnectionFactory()");

    OutboundConnectionFactory factory =
      new OutboundConnectionFactory(this, null);
   
    Reference ref =
      new Reference(factory.getClass().getName(),
                    "org.objectweb.joram.client.connector.ObjectFactoryImpl",
                    null);
    ref.add(new StringRefAddr("hostName", hostName));
    ref.add(new StringRefAddr("serverPort", "" + serverPort));
    ref.add(new StringRefAddr("userName", userName));
    ref.add(new StringRefAddr("password", password));
    ref.add(new StringRefAddr("identityClass", identityClass));

    factory.setReference(ref);
    return factory;
  }
View Full Code Here

    }

    private void testDataSourceFactory() throws Exception {
        ObjectFactory factory = new JdbcDataSourceFactory();
        assertTrue(null == factory.getObjectInstance("test", null, null, null));
        Reference ref = new Reference("java.lang.String");
        assertTrue(null == factory.getObjectInstance(ref, null, null, null));
        ref = new Reference(JdbcDataSource.class.getName());
        ref.add(new StringRefAddr("url", "jdbc:h2:mem:"));
        ref.add(new StringRefAddr("user", "u"));
        ref.add(new StringRefAddr("password", "p"));
        ref.add(new StringRefAddr("loginTimeout", "1"));
        ref.add(new StringRefAddr("description", "test"));
        JdbcDataSource ds = (JdbcDataSource) factory.getObjectInstance(ref, null, null, null);
        assertEquals(1, ds.getLoginTimeout());
        assertEquals("test", ds.getDescription());
        assertEquals("jdbc:h2:mem:", ds.getURL());
        assertEquals("u", ds.getUser());
        assertEquals("p", ds.getPassword());
        Reference ref2 = ds.getReference();
        assertEquals(ref.size(), ref2.size());
        assertEquals(ref.get("url").getContent().toString(), ref2.get("url").getContent().toString());
        assertEquals(ref.get("user").getContent().toString(), ref2.get("user").getContent().toString());
        assertEquals(ref.get("password").getContent().toString(), ref2.get("password").getContent().toString());
        assertEquals(ref.get("loginTimeout").getContent().toString(), ref2.get("loginTimeout").getContent().toString());
        assertEquals(ref.get("description").getContent().toString(), ref2.get("description").getContent().toString());
        ds.setPasswordChars("abc".toCharArray());
        assertEquals("abc", ds.getPassword());
    }
View Full Code Here

     * @return the new reference
     */
    public Reference getReference() {
        debugCodeCall("getReference");
        String factoryClassName = JdbcDataSourceFactory.class.getName();
        Reference ref = new Reference(getClass().getName(), factoryClassName, null);
        ref.add(new StringRefAddr("url", url));
        ref.add(new StringRefAddr("user", userName));
        ref.add(new StringRefAddr("password", convertToString(passwordChars)));
        ref.add(new StringRefAddr("loginTimeout", String.valueOf(loginTimeout)));
        ref.add(new StringRefAddr("description", description));
        return ref;
    }
View Full Code Here

         throw new XBException(ex, ME + ".createQueueConnection");
      }
   }

   public Reference getReference() {
      Reference ret = new Reference(this.getClass().getName(), XBObjectFactory.class.getName(), null);
      ret.add(new StringRefAddr("" + this.forQueues, null));        
      ret.add(new StringRefAddr(this.connectQos.toXml(), null));        
      for (int i=0; i < this.args.length; i++) {
         ret.add(new StringRefAddr(this.args[i], null));        
      }
      return ret;
   }
View Full Code Here

   }
  
   public Object getObjectInstance(Object object, Name name, Context context, Hashtable env)
      throws Exception {
      if (object instanceof Reference) {
         Reference ref = (Reference)object;
         String className = ref.getClassName();
           
         if (className.equals(XBConnectionFactory.class.getName())) {
            String[] args = new String[ref.size()-2];
            Enumeration iter = ref.getAll();
            RefAddr addr = (RefAddr)iter.nextElement();
            String forQueuesTxt = addr.getType();
            boolean forQueues = false;
            try {
               forQueues = Boolean.getBoolean(forQueuesTxt);
            }
            catch (Throwable ex) {
            }
            addr = (RefAddr)iter.nextElement();
            String qosLitteral = addr.getType();
            int i = 0;
            while (iter.hasMoreElements()) {
               addr = (RefAddr)iter.nextElement();
               args[i] = addr.getType();
               i++;
            }
            String connectQos = (String)getProperty(XBPropertyNames.CONNECT_QOS, context, env);
            if (connectQos != null) qosLitteral = connectQos;
            return new XBConnectionFactory(qosLitteral, args, forQueues);
         }

         if (className.equals(XBDestination.class.getName())) {
            RefAddr topicRef = ref.get("topicName");
            RefAddr queueRef = ref.get("queueName");
            RefAddr forceQueuingRef = ref.get("forceQueuing");
            String topicName = (String)topicRef.getContent();
            String queueName = (String)queueRef.getContent();
            String forceQueuingTxt = (String)forceQueuingRef.getContent();
            boolean forceQueuing = (new Boolean(forceQueuingTxt)).booleanValue();
            return new XBDestination(topicName, queueName, forceQueuing);
View Full Code Here

TOP

Related Classes of javax.naming.Reference

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.