Package javax.naming

Examples of javax.naming.Reference


            log.debug("started JMXConnector (" + url.toString() + ")" +
               (securityDomain!=null ? " domain=" + securityDomain : "") );
         }

         // For legacy access, bind a JMXAdapter to the JNDI names
         Reference reference = new Reference(MBeanServerConnection.class.getName(), JMXAdapter.class.getName(), null);
         reference.add(new StringRefAddr("JMXServiceURL", url.toString()));
         Util.rebind(context, JNDI_BIND_NAME, reference);
         Util.rebind(context, LEGACY_BIND_NAME, reference);
         //Object test = Util.lookup(context, JNDI_BIND_NAME, MBeanServerConnection.class);
         //log.info("test = " + test);
         SecurityFactory.prepare();
View Full Code Here


   }
  
   public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception {
      if ( obj != null && obj instanceof Reference) {
         Reference ref = (Reference)obj;
         // The JMXServiceURL points to the jmx server
         RefAddr urlRef = ref.get("JMXServiceURL");
         String  url = (String)urlRef.getContent();
         JMXServiceURL jmxserviceURL = new JMXServiceURL(url);
         javax.management.remote.JMXConnector jmxc = null;
         jmxc = jmxConnectorMap.get(url);
View Full Code Here

         oos.writeObject(theProxy);
         oos.close();
         byte[] proxyBytes = baos.toByteArray();
         BinaryRefAddr dsAddr = new BinaryRefAddr("ProxyData", proxyBytes);
         String factory = DataSourceFactory.class.getName();
         Reference dsRef = new Reference("javax.sql.DataSource", dsAddr, factory, null);
         referenceable.setReference(dsRef);
         // Set the VMID as the address local/remote indicator
         baos.reset();
         ObjectOutputStream oos2 = new ObjectOutputStream(baos);
         oos2.writeObject(DataSourceFactory.vmID);
         oos2.close();
         byte[] id = baos.toByteArray();
         BinaryRefAddr localAddr = new BinaryRefAddr("VMID", id);
         dsRef.add(localAddr);
         /* Bind the Referenceable connection factory into JNDI and set the
         JndiName value of the reference address for use by the DataSourceFactory
         when looking up the local factory from the NonSerializableFactory.
         */
         StringRefAddr jndiRef = new StringRefAddr("JndiName", bindName);
         dsRef.add(jndiRef);
         Util.rebind(ctx, bindName, cf);
         log.info("Bound ConnectionManager '" + serviceName + "' to JNDI name '" + bindName + "'");
      }
      catch (NamingException ne)
      {
View Full Code Here

     
      // The helper class NonSerializableFactory uses address type nns, we go on to
      // use the helper class to bind the service object in JNDI
      //
      StringRefAddr addr = new StringRefAddr("nns", jndiName);
      Reference ref = new Reference(classType.getName(), addr, NonSerializableFactory.class.getName(), null);
      ctx.bind(n.get(0), ref);
   }
View Full Code Here

      Context ctx = new InitialContext();
      parser = ctx.getNameParser("");

      RefAddr refAddr = new StringRefAddr("nns", "JSMCachePolicy");
      String factoryName = DefaultCacheObjectFactory.class.getName();
      Reference ref = new Reference("javax.naming.Context", refAddr, factoryName, null);
      ctx.rebind(DEFAULT_CACHE_POLICY_PATH, ref);
      log.debug("cachePolicyCtxPath="+cacheJndiName);

      // Bind the default SecurityProxyFactory instance under java:/SecurityProxyFactory
      SecurityProxyFactory proxyFactory = (SecurityProxyFactory) securityProxyFactoryClass.newInstance();
View Full Code Here

      // The helper class NonSerializableFactory uses address type nns, we go on to
      // use the helper class to bind the service object in JNDI
      //
      StringRefAddr addr = new StringRefAddr("nns", jndiName);
      Reference ref = new Reference(classType.getName (), addr, NonSerializableFactory.class.getName (), null);
      ctx.rebind (n.get (0), ref);
   }
View Full Code Here

            }
            else
            {
               // Get the invoker specific ejb-ref mappings
               Iterator it = beanMetaData.getInvokerBindings();
               Reference reference = null;
               while (it.hasNext())
               {
                  String invokerBinding = (String)it.next();
                  // Check for an invoker level jndi-name
                  String name = ref.getInvokerBinding(invokerBinding);
                  // Check for an global jndi-name
                  if (name == null)
                     name = ref.getJndiName();
                  if (name == null)
                  {
                     throw new DeploymentException("ejb-ref " + ref.getName() + ", expected either ejb-link in ejb-jar.xml or " + "jndi-name in jboss.xml");
                  }

                  StringRefAddr addr = new StringRefAddr(invokerBinding, name);
                  log.debug("adding " + invokerBinding + ":" + name + " to Reference");

                  if (reference == null)
                  {
                     reference = new Reference("javax.naming.LinkRef", ENCThreadLocalKey.class.getName(), null);
                  }
                  reference.add(addr);
               }

               // If there were invoker bindings create bind the reference
               if (reference != null)
               {
                  if (ref.getJndiName() != null)
                  {
                     // Add default for the bean level ejb-ref/jndi-name
                     StringRefAddr addr = new StringRefAddr("default", ref.getJndiName());
                     reference.add(addr);
                  }
                  if (reference.size() == 1 && reference.get("default") == null)
                  {
                     /* There is only one invoker binding and its not default so
                      create a default binding to allow the link to have a value
                      when accessed without an invoker active.
                      */
                     StringRefAddr addr = (StringRefAddr)reference.get(0);
                     String target = (String)addr.getContent();
                     StringRefAddr addr1 = new StringRefAddr("default", target);
                     reference.add(addr1);
                  }
                  Util.bind(envCtx, ref.getName(), reference);
               }
               else
               {
View Full Code Here

   //

   public Reference getReference()
      throws NamingException
   {
      Reference ref = new Reference("org.jboss.tm.usertx.client.ClientUserTransaction",
         "org.jboss.tm.usertx.client.ClientUserTransactionObjectFactory",
         null);

      return ref;
   }
View Full Code Here

      /* Create a mapping from the java:/jaas context to a SecurityDomainObjectFactory
      so that any lookup against java:/jaas/domain returns an instance of our
      security manager class.
      */
     RefAddr refAddr = new StringRefAddr("nns", "JSM");
     Reference ref = new Reference("javax.naming.Context", refAddr, factoryName, null);
     ctx.rebind(this.baseContext, ref);
   }
View Full Code Here

   public Object getObjectInstance(Object obj, Name name, Context nameCtx,
      Hashtable env)
      throws Exception
   {
      Context ctx = getInitialContext(env);
      Reference ref = (Reference) obj;
      RefAddr addr = ref.get("URL");
      String path = (String) addr.getContent();
      return ctx.lookup(path);
   }
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.