Package javax.naming

Examples of javax.naming.RefAddr


        if (obj instanceof Reference) {
            Map<String, Object> values = new HashMap<String, Object>();
            Reference ref = (Reference)obj;
            Enumeration<?> en = ref.getAll();
            while (en.hasMoreElements()) {
                RefAddr subref = (RefAddr)en.nextElement();
                if (subref instanceof StringRefAddr) {
                    String key = subref.getType();
                    Object value = subref.getContent();
                    if (value != null) values.put(key, value.toString());
                } else if (subref instanceof BinaryRefAddr) {
                    String key = subref.getType();
                    Object value = subref.getContent();
                    if (value instanceof byte[]) {
                        // Deserialize ...
                        ByteArrayInputStream bais = new ByteArrayInputStream((byte[])value);
                        ObjectInputStream ois = new ObjectInputStream(bais);
                        value = ois.readObject();
View Full Code Here


        if (obj instanceof Reference) {
            Map<String, String> values = new HashMap<String, String>();
            Reference ref = (Reference)obj;
            Enumeration<?> en = ref.getAll();
            while (en.hasMoreElements()) {
                RefAddr subref = (RefAddr)en.nextElement();
                if (subref instanceof StringRefAddr) {
                    String key = subref.getType();
                    Object value = subref.getContent();
                    if (value != null) values.put(key, value.toString());
                }
            }
            String sourceName = values.get(SOURCE_NAME);
            String retryLimit = values.get(RETRY_LIMIT);
View Full Code Here

    protected Map<String, Object> valuesFrom( Reference ref ) throws IOException, ClassNotFoundException {
        Map<String, Object> values = new HashMap<String, Object>();

        Enumeration<?> en = ref.getAll();
        while (en.hasMoreElements()) {
            RefAddr subref = (RefAddr)en.nextElement();
            if (subref instanceof StringRefAddr) {
                String key = subref.getType();
                Object value = subref.getContent();
                if (value != null) values.put(key, value.toString());
            } else if (subref instanceof BinaryRefAddr) {
                String key = subref.getType();
                Object value = subref.getContent();
                if (value instanceof byte[]) {
                    // Deserialize ...
                    ByteArrayInputStream bais = new ByteArrayInputStream((byte[])value);
                    ObjectInputStream ois = new ObjectInputStream(bais);
                    value = ois.readObject();
View Full Code Here

   
    if (!targetClass.isAssignableFrom(CommonDataSource.class)) return null;
   
    CommonDataSource<Z, D, F> result = targetClass.asSubclass(CommonDataSource.class).newInstance();
   
    RefAddr clusterAddr = reference.get(CLUSTER);
   
    if (clusterAddr == null) return null;

    Object clusterAddrContent = clusterAddr.getContent();
   
    if (!(clusterAddrContent instanceof String)) return null;

    result.setCluster((String) clusterAddrContent);
   
    RefAddr configAddr = reference.get(CONFIG);
   
    if (configAddr == null) return null;

    Object configAddrContent = configAddr.getContent();
   
    if (configAddrContent == null) return null;
   
    if (configAddrContent instanceof String)
    {
      result.setConfig((String) configAddrContent);
    }
    else if (configAddrContent instanceof byte[])
    {
      byte[] config = (byte[]) configAddrContent;
     
      result.setConfigurationFactory(Objects.<DatabaseClusterConfigurationFactory<Z, D>>deserialize(config));
    }
   
    RefAddr userAddr = reference.get(USER);
    if (userAddr != null)
    {
      Object userAddrContent = userAddr.getContent();
      if (userAddrContent instanceof String)
      {
        result.setUser((String) userAddrContent);
      }
    }
   
    RefAddr passwordAddr = reference.get(USER);
    if (passwordAddr != null)
    {
      Object passwordAddrContent = passwordAddr.getContent();
      if (passwordAddrContent instanceof String)
      {
        result.setPassword((String) passwordAddrContent);
      }
    }
View Full Code Here

    */
    public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable env)
        throws Exception
    // Get the nns value from the Reference obj and use it as the map key
        Reference ref = (Reference) obj;
        RefAddr addr = ref.get("nns");
        String key = (String) addr.getContent();
        Object target = wrapperMap.get(key);
        return target;
    }
View Full Code Here

         if (trace)
            log.trace("using default in ENC");
         reftype = "default";
      }

      RefAddr addr = ref.get(reftype);
      if (addr == null)
      {
         if (trace)
            log.trace("using default in ENC");
         addr = ref.get("default"); // try to get default linking
      }
      if (addr != null)
      {
         String target = (String) addr.getContent();
         if (trace)
            log.trace("found Reference " + reftype + " with content " + target);
         return new LinkRef(target);
      }
      return null;
View Full Code Here

    */
    public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable env)
        throws Exception
    // Get the nns value from the Reference obj and use it as the map key
        Reference ref = (Reference) obj;
        RefAddr addr = ref.get("nns");
        String key = (String) addr.getContent();
        Object target = wrapperMap.get(key);
        return target;
    }
View Full Code Here

         if (trace)
            log.trace("using default in ENC");
         reftype = "default";
      }

      RefAddr addr = ref.get(reftype);
      if (addr == null)
      {
         if (trace)
            log.trace("using default in ENC");
         addr = ref.get("default"); // try to get default linking
      }
      if (addr != null)
      {
         String target = (String) addr.getContent();
         if (trace)
            log.trace("found Reference " + reftype + " with content " + target);
         return new LinkRef(target);
      }
      return null;
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

         chandler, true);

      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);
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.