Package org.glassfish.api.naming

Examples of org.glassfish.api.naming.NamedNamingObjectProxy


    }

    public static Object tryNamedProxies(String name)
            throws NamingException {

        NamedNamingObjectProxy proxy = getCachedProxy(name);
        if (proxy != null) {
            if (logger.isLoggable(Level.FINE)) {
                logger.logp(Level.FINE, "NamedNamingObjectManager", "tryNamedProxies",
                        "found cached proxy [{0}] for [{1}]", new Object[]{proxy, name});
            }
            return proxy.handle(name);
        }

//        for (Binding<?> b : getHabitat().getBindings(new NamingDescriptor())) {
//            for (String prefix : b.getDescriptor().getNames()) {
//                if (name.startsWith(prefix)) {
//                    proxy = (NamedNamingObjectProxy) b.getProvider().get();
//                    System.out.println("NamedNamingObjectManager.tryNamedProxies: found a proxy " + proxy + " for " + name);
//                    cacheProxy(prefix, proxy);
//                    return proxy.handle(name);
//                }
//            }
//        }
       
    for (ServiceHandle<?> inhabitant : getHabitat()
        .getAllServiceHandles(NamespacePrefixes.class)) {
        List<String> prefixes = inhabitant.getActiveDescriptor().getMetadata().get(GlassfishNamingManager.NAMESPACE_METADATA_KEY);
        if (prefixes == null) continue;
       
        String prefix = null;
        for (String candidate : prefixes) {
            if (name.startsWith(candidate)) {
                prefix = candidate;
                break;
            }
        }
       
      if (prefix != null) {
        proxy = (NamedNamingObjectProxy) inhabitant.getService();
        if (logger.isLoggable(Level.FINE)) {
          logger.logp(Level.FINE, "NamedNamingObjectManager",
              "tryNamedProxies",
              "found a new proxy [{0}] for [{1}]", new Object[] {
                  proxy, name });
        }
        cacheProxy(prefix, proxy);
        return proxy.handle(name);
      }
    }

        return null;
    }
View Full Code Here

TOP

Related Classes of org.glassfish.api.naming.NamedNamingObjectProxy

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.