Package javax.naming

Examples of javax.naming.Binding


        if (firstComponent.equals(""))
            ctx = this;
        else
        {
            Binding binding = getBinding (firstComponent);
            if (binding == null)
                throw new NameNotFoundException ();
           
            ctx = binding.getObject();
           
            if (ctx instanceof Reference)
            { 
                //deference the object
                if(Log.isDebugEnabled())Log.debug("Dereferencing Reference for "+name.get(0));
View Full Code Here


        if (firstComponent.equals(""))
            ctx = this;
        else
        {
            //it is a non-empty name component
            Binding binding = getBinding (firstComponent);
            if (binding == null)
                throw new NameNotFoundException ();
       
            ctx = binding.getObject();

            if (ctx instanceof Reference)
            { 
                //deference the object
                try
View Full Code Here

           
            if (firstComponent.equals(""))
                ctx = this;
            else
            {
                Binding  binding = getBinding (name.get(0));
                if (binding == null)
                    throw new NameNotFoundException (name.get(0)+ " is not bound");
           
                ctx = binding.getObject();


                if (ctx instanceof Reference)
                { 
                    //deference the object
View Full Code Here

           
            if (firstComponent.equals(""))
                ctx = this;
            else
            {
                Binding  binding = getBinding (name.get(0));
                if (binding == null)
                    throw new NameNotFoundException (name.get(0)+ " is not bound");
           
                ctx = binding.getObject();


                if (ctx instanceof Reference)
                { 
                    //deference the object
View Full Code Here

     */
    protected void addBinding (Name name, Object obj)
    {
        String key = name.toString();
        if(Log.isDebugEnabled())Log.debug("Adding binding with key="+key+" obj="+obj+" for context="+_name);
        _bindings.put (key, new Binding (key, obj));
    }
View Full Code Here

                                  String type, Class clazz) {

        try {
            NamingEnumeration items = namingContext.listBindings("");
            while (items.hasMore()) {
                Binding item = (Binding) items.next();
                if (item.getObject() instanceof javax.naming.Context) {
                    printResources
                        (writer, prefix + item.getName() + "/",
                         (javax.naming.Context) item.getObject(), type, clazz);
                } else {
                    if ((clazz != null) &&
                        (!(clazz.isInstance(item.getObject())))) {
                        continue;
                    }
                    writer.print(prefix + item.getName());
                    writer.print(':');
                    writer.print(item.getClassName());
                    // Do we want a description if available?
                    writer.println();
                }
            }
        } catch (Throwable t) {
View Full Code Here

    }

    private static Map toListBindingResults(NamingEnumeration enumeration) {
        Map result = new HashMap();
        while (enumeration.hasMoreElements()) {
            Binding binding = (Binding) enumeration.nextElement();
            String name = binding.getName();
            assertFalse(result.containsKey(name));
            result.put(name, binding.getObject());
        }
        return result;
    }
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 Context)) {
                assertEquals(pair.getObject(), envBinding.get(pair.getName()));
            }
        }
        assertEquals(envBinding.size(), count);

        try {
View Full Code Here

        public NameClassPair nextElement() {
            String name = entries.nextElement();
            String relativeName = getRelativeName(name);
            if (name.endsWith("/")) {
                return new Binding(removeSlash(relativeName), DirContext.class.getName());
            } else {
                return new Binding(relativeName, String.class.getName());
            }
        }
View Full Code Here

                                  String type, Class clazz) {

        try {
            NamingEnumeration items = namingContext.listBindings("");
            while (items.hasMore()) {
                Binding item = (Binding) items.next();
                if (item.getObject() instanceof javax.naming.Context) {
                    printResources
                        (writer, prefix + item.getName() + "/",
                         (javax.naming.Context) item.getObject(), type, clazz);
                } else {
                    if ((clazz != null) &&
                        (!(clazz.isInstance(item.getObject())))) {
                        continue;
                    }
                    writer.print(prefix + item.getName());
                    writer.print(':');
                    writer.print(item.getClassName());
                    // Do we want a description if available?
                    writer.println();
                }
            }
        } catch (Throwable t) {
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.