Package javax.naming

Examples of javax.naming.RefAddr


    StringBuffer strbuf = new StringBuffer(20);

    while (true) {
      strbuf.setLength(0);
      strbuf.append("cluster#").append(i).append(".key");
      RefAddr refAddr = ref.get(strbuf.toString());
      if (refAddr == null) break;

      strbuf.setLength(0);
      strbuf.append("cluster#").append(i).append(".destName");
      if (isQueue()) {
        dest = new Queue((String) ref.get(strbuf.toString()).getContent());
      } else {
        dest = new Topic((String) ref.get(strbuf.toString()).getContent());
      }
      cluster.put((String) refAddr.getContent(), dest);
      i++;
    }
  }
View Full Code Here


    StringBuffer strbuf = new StringBuffer(15);

    while (true) {
      strbuf.setLength(0);
      strbuf.append("CF#").append(i).append(".key");
      RefAddr refAddr = ref.get(strbuf.toString());
      if (refAddr == null) break;
      String key = (String) refAddr.getContent();

      strbuf.setLength(0);
      strbuf.append("CF#").append(i).append(".class");
      String classname = (String) ref.get(strbuf.toString()).getContent();
      try {
View Full Code Here

         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);
         }
      }
      return null;
View Full Code Here

            throws Exception {
        if (obj instanceof Reference) {
            Reference ref = (Reference) obj;

            // get the embeddedID, getContainerId(), getFactoryName()
            RefAddr containerIDAddr = ref.get(AbsCallRef.CONTAINER_ID);
            RefAddr factoryNameAddr = ref.get(AbsCallRef.FACTORY_NAME);
            RefAddr itfClassNameAddr = ref.get(AbsCallRef.INTERFACE_NAME);
            RefAddr useIDAddr = ref.get(AbsCallRef.USE_ID);

            String containerID = (String) containerIDAddr.getContent();
            String factoryName = (String) factoryNameAddr.getContent();
            String itfClassName = (String) itfClassNameAddr.getContent();
            boolean useID = Boolean.valueOf((String) useIDAddr.getContent()).booleanValue();

            // Build new Handler
            ClientRPCInvocationHandler handler = buildRemoteHandler(containerID, factoryName, useID);
            // Set the environment used by client to do the lookup.
            handler.setRMIEnv(environment);
View Full Code Here

            throws Exception {
        if (obj instanceof Reference) {
            Reference ref = (Reference) obj;

            // get the properties
            RefAddr remoteInterfaceAddr = ref.get(EJBHomeCallRef.REMOTE_INTERFACE);
            this.remoteInterface =  (String) remoteInterfaceAddr.getContent();
        }

        // Now call the super method.
        return super.getObjectInstance(obj, name, nameCtx, environment);
    }
View Full Code Here

            throws Exception {
        if (obj instanceof Reference) {
            Reference ref = (Reference) obj;

            // get the embeddedID, getContainerId(), getFactoryName()
            RefAddr embeddedIDAddr = ref.get(LocalCallRef.EMBEDDED_ID);
            RefAddr containerIDAddr = ref.get(AbsCallRef.CONTAINER_ID);
            RefAddr factoryNameAddr = ref.get(AbsCallRef.FACTORY_NAME);
            RefAddr itfClassNameAddr = ref.get(AbsCallRef.INTERFACE_NAME);
            RefAddr useIDAddr = ref.get(AbsCallRef.USE_ID);

            Integer embeddedID = Integer.valueOf((String) embeddedIDAddr.getContent());
            String containerID = (String) containerIDAddr.getContent();
            String factoryName = (String) factoryNameAddr.getContent();
            String itfClassName = (String) itfClassNameAddr.getContent();
            boolean useID = Boolean.valueOf((String) useIDAddr.getContent()).booleanValue();

            // Build new Handler
            LocalCallInvocationHandler handler = buildLocalHandler(embeddedID, containerID, factoryName, useID);

            // Get current classloader
View Full Code Here

            // Handle special case of the LinkRef since I think
            // it's not handled by std NamingManager.getObjectInstance().
            // The name hidden in linkref is in the initial context.

            InitialContext ictx = new InitialContext();
            RefAddr ra = ((Reference) ret).get(0);
            try {
                ret = ictx.lookup((String) ra.getContent());
            } catch (Exception e) {
                NamingException ne = new NamingException(e.getMessage());
                ne.setRootCause(e);
                logger.error("unexpected exception {0}", e.getMessage(), e);
                throw ne;
View Full Code Here

         return ((InVMContext)value).lookup(name.substring(i));
      }
      if (value instanceof Reference)
      {
         Reference ref = (Reference)value;
         RefAddr refAddr = ref.get("nns");

         // we only deal with references create by NonSerializableFactory
         String key = (String)refAddr.getContent();
         return NonSerializableFactory.lookup(key);
      }
      else
      {
         return value;
View Full Code Here

     * @param reference the given reference
     * @param propertyName the given property
     * @return the given string
     */
    public String getString(final Reference reference, final String propertyName) {
        RefAddr tmpRefAddr = reference.get(propertyName);
        String tmpValue = null;
        if (tmpRefAddr instanceof StringRefAddr) {
            tmpValue = (String) ((StringRefAddr) tmpRefAddr).getContent();
        }
        return tmpValue;
View Full Code Here

     * @throws NamingException if object is not read.
     * @param <T> the type of the object to load
     */
    @SuppressWarnings("unchecked")
    public <T> T getObject(final Reference reference, final String propertyName) throws NamingException {
        RefAddr refAddr = reference.get(propertyName);
        T obj = null;
        if (refAddr != null) {
            try {
                obj = (T) Serialization.loadObject((byte[]) refAddr.getContent());
            } catch (IOException e) {
                NamingException ne = new NamingException("Cannot load mail session properties object");
                ne.initCause(e);
                throw ne;
            } catch (ClassNotFoundException e) {
View Full Code Here

TOP

Related Classes of javax.naming.RefAddr

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.