Package javax.naming

Examples of javax.naming.Reference


            // The context
            context,
            // It should look like so "invokers/<name>/iiop"
            "invokers/" + InetAddress.getLocalHost().getHostName() + "/iiop",
            // A reference to this invoker
            new Reference(getClass().getName(),
                          getClass().getName(),
                          null));

      log.debug("Bound IIOP invoker for JMX node");
   }
View Full Code Here


      InitialContext ctx = new InitialContext();
      try
      {
         StringRefAddr addr = new StringRefAddr("nns", bindName);
         Reference ref = new Reference(Session.class.getName(),
            addr,
            SessionObjectFactory.class.getName(),
            null);
         Util.bind(ctx, bindName, ref);
      }
View Full Code Here

      InitialContext ctx = new InitialContext();
     
      //bind myself into JNDI, at java:/CounterService
      NonSerializableFactory.bind(JNDI_NAME, this);
      StringRefAddr addr = new StringRefAddr("nns", JNDI_NAME);
      Reference ref = new Reference(this.getClass().getName(), addr, NonSerializableFactory.class.getName(), null);
      ctx.bind(JNDI_NAME, ref);
   }
View Full Code Here

         try {
            // Bind the bean home in the JNDI initial context
            Util.rebind(initialContext,
                        jnpName,
                        new Reference(
                              "javax.ejb.EJBHome",
                              new StringRefAddr("IOR",
                                       orb.object_to_string(
                                               (org.omg.CORBA.Object)ejbHome)),
                              IIOPHomeFactory.class.getName(),
View Full Code Here

   // Private -------------------------------------------------------

   private void bind(String name, String className)
      throws Exception
   {
      Reference ref = new Reference(className, getClass().getName(), null);
      new InitialContext().bind("java:/"+name, ref);
   }
View Full Code Here

   // Private -------------------------------------------------------

   private void bind(String name, String className)
      throws Exception
   {
      Reference ref = new Reference(className, getClass().getName(), null);
      new InitialContext().bind("java:/"+name, ref);
   }
View Full Code Here

                                    "[env] " + (env == null ? "" : env.toString()) + " ");
        }

        if (obj instanceof Reference)
        {
            Reference ref = (Reference) obj;
            if (ref.getClassName().equals(JDOClassNameConstants.JDOPersistenceManagerFactory) ||
                ref.getClassName().equals(JDOClassNameConstants.JAVAX_JDO_PersistenceManagerFactory))
            {
                // Extract the properties to use for PMF creation
                Properties p = new Properties();
                for (Enumeration e = ref.getAll(); e.hasMoreElements();)
                {
                    StringRefAddr sra = (StringRefAddr) e.nextElement();
                    p.setProperty(sra.getType(), (String) sra.getContent());
                }

                // Create the PMF
                pmf = createInstance(p);

                // Freeze the PMF config now that we are handing out PM's : see JDO 1.0.1 [11.7]
                pmf.freezeConfiguration();

                if (JPOXLogger.NAMING.isDebugEnabled())
                {
                    JPOXLogger.NAMING.debug(LOCALISER_JDO.msg("012006", name.toString()));
                }
            }
            else
            {
                JPOXLogger.NAMING.warn(LOCALISER_JDO.msg("012007",
                    ref.getClassName(), JDOClassNameConstants.JDOPersistenceManagerFactory));
            }
        }
        else
        {
            JPOXLogger.NAMING.warn(LOCALISER_JDO.msg("012008", (obj.getClass().getName())));
View Full Code Here

     * Retrieves the (JNDI) reference of this PMF object.
     * @return The reference
     */
    public Reference getReference()
    {
        Reference rc = null;
        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        try
        {
            ObjectOutputStream oos = new ObjectOutputStream(baos);
            oos.writeObject(this);
            rc = new Reference(JDOClassNameConstants.JAVAX_JDO_PersistenceManagerFactory,
                JDOClassNameConstants.JDOPersistenceManagerFactory, null);
           
            Map p = getOptions();
            for (Iterator i = p.keySet().iterator(); i.hasNext();)
            {
                String key = (String) i.next();
                if (p.get(key) instanceof String)
                {
                    String value = (String) p.get(key);
                    rc.add(new StringRefAddr(key, value));
                    if (JPOXLogger.NAMING.isDebugEnabled())
                    {
                        JPOXLogger.NAMING.debug(LOCALISER_JDO.msg("012009", key, value));
                    }
                }
                else if (p.get(key) instanceof Long)
                {
                    String value = "" + p.get(key);
                    rc.add(new StringRefAddr(key, value));
                    if (JPOXLogger.NAMING.isDebugEnabled())
                    {
                        JPOXLogger.NAMING.debug(LOCALISER_JDO.msg("012009", key, value));
                    }
                }
                else if (p.get(key) instanceof Integer)
                {
                    String value = "" + p.get(key);
                    rc.add(new StringRefAddr(key, value));
                    if (JPOXLogger.NAMING.isDebugEnabled())
                    {
                        JPOXLogger.NAMING.debug(LOCALISER_JDO.msg("012009", key, value));
                    }
                }
                else if (p.get(key) instanceof Boolean)
                {
                    String value = (((Boolean)p.get(key)).booleanValue() ? "true" : "false");
                    rc.add(new StringRefAddr(key, value));
                    if (JPOXLogger.NAMING.isDebugEnabled())
                    {
                        JPOXLogger.NAMING.debug(LOCALISER_JDO.msg("012009", key, value));
                    }
                }
View Full Code Here

    // javadoc to be copied from javax.naming.Referenceable.getReference()
    public Reference getReference() throws NamingException {

        String    cname = "org.hsqldb.jdbc.JDBCDataSourceFactory";
        Reference ref   = new Reference(getClass().getName(), cname, null);

        ref.add(new StringRefAddr("database", getDatabase()));
        ref.add(new StringRefAddr("user", getUser()));
        ref.add(new StringRefAddr("password", password));

        return ref;
    }
View Full Code Here

     */
    public Object getObjectInstance(Object obj, Name name, Context nameCtx,
                                    Hashtable environment) throws Exception {

        String    dsClass = "org.hsqldb.jdbc.JDBCDataSource";
        Reference ref     = (Reference) obj;

        if (ref.getClassName().equals(dsClass)) {
            JDBCDataSource ds = new JDBCDataSource();

            ds.setDatabase((String) ref.get("database").getContent());
            ds.setUser((String) ref.get("user").getContent());
            ds.setPassword((String) ref.get("password").getContent());

            return ds;
        } else {
            return null;
        }
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.