Package javax.naming

Examples of javax.naming.Binding


            return nextElement();
        }

        public Object nextElement() {
            Map.Entry entry = getNext();
            return new Binding((String) entry.getKey(), entry.getValue());
        }
View Full Code Here


        NamingEnumeration ne;
        ne = envContext.listBindings("");
        int count = 0;
        while (ne.hasMore()) {
            count ++;
            Binding pair = (Binding) ne.next();
            assertTrue(envBinding.containsKey(pair.getName()));
            if (! (envBinding.get(pair.getName()) instanceof ReadOnlyContext)) {
                assertEquals(pair.getObject(), envBinding.get(pair.getName()));
            }
        }
        assertEquals(envBinding.size(), count);

        try {
View Full Code Here

         boolean cleanDetect = cleanDetectionCount > detectionNumber;
         String bindName = "";
         NamingEnumeration enumeration = context.listBindings(bindName);
         while(enumeration.hasMore())
         {
            Binding binding = (Binding) enumeration.next();
            Detection regMsg = (Detection) binding.getObject();
            // No need to detect myself here
            if(isRemoteDetection(regMsg))
            {
               log.debug("Detected id: " + regMsg.getIdentity().getInstanceId() + ", message: " + regMsg);
View Full Code Here

    private class ContextNode extends TreeNode {
        volatile Map<String, TreeNode> children = Collections.emptyMap();

        private ContextNode(final Name fullName, final NamingContext context) {
            super(fullName, new Binding(getLastComponent(fullName), Context.class.getName(), context));
        }
View Full Code Here

            this.className = className;
        }

        protected Void foundBindContext(ContextNode contextNode) throws NamingException {
            final String childName = getLastComponent(targetName);
            final Binding binding = new Binding(childName, className, object, true);
            final BindingNode bindingNode = new BindingNode(targetName, binding);
            contextNode.addChild(childName, bindingNode);
            fireEvent(callingContext, targetName, null, binding, NamingEvent.OBJECT_ADDED, "bind");
            return null;
        }
View Full Code Here

            this.className = className;
        }

        protected Void foundBindContext(ContextNode contextNode) throws NamingException {
            final String childName = getLastComponent(targetName);
            final Binding binding = new Binding(childName, className, object, true);
            final BindingNode bindingNode = new BindingNode(targetName, binding);
            final TreeNode previous = contextNode.replaceChild(childName, bindingNode);

            final Binding previousBinding = previous != null ? previous.binding : null;
            fireEvent(callingContext, targetName, previousBinding, binding, previousBinding != null ? NamingEvent.OBJECT_CHANGED : NamingEvent.OBJECT_ADDED, "rebind");
            return null;
        }
View Full Code Here

        }

        protected List<NameClassPair> found(final ContextNode contextNode) throws NamingException {
            final List<NameClassPair> nameClassPairs = new ArrayList<NameClassPair>();
            for (TreeNode childNode : contextNode.children.values()) {
                final Binding binding = childNode.binding;
                nameClassPairs.add(new NameClassPair(binding.getName(), binding.getClassName(), true));
            }
            return nameClassPairs;
        }
View Full Code Here

   public static void tearDownRecursively(final Context c) throws Exception
   {
      for (NamingEnumeration<Binding> ne = c.listBindings(""); ne.hasMore();)
      {
         Binding b = ne.next();
         String name = b.getName();
         Object object = b.getObject();
         if (object instanceof Context)
         {
            JNDIUtil.tearDownRecursively((Context)object);
         }
         c.unbind(name);
View Full Code Here

   public static void tearDownRecursively(Context c) throws Exception
   {
      for(NamingEnumeration ne = c.listBindings(""); ne.hasMore(); )
      {
         Binding b = (Binding)ne.next();
         String name = b.getName();
         Object object = b.getObject();
         if (object instanceof Context)
         {
            tearDownRecursively((Context)object);
         }
         c.unbind(name);
View Full Code Here

        (Set set, DirContext resources, String path)
        throws NamingException {

        Enumeration childPaths = resources.listBindings(path);
        while (childPaths.hasMoreElements()) {
            Binding binding = (Binding) childPaths.nextElement();
            String name = binding.getName();
            StringBuffer childPath = new StringBuffer(path);
            if (!"/".equals(path) && !path.endsWith("/"))
                childPath.append("/");
            childPath.append(name);
            Object object = binding.getObject();
            if (object instanceof DirContext) {
                childPath.append("/");
            }
            set.add(childPath.toString());
        }
View Full Code Here

TOP

Related Classes of javax.naming.Binding

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.