Package org.apache.naming.core

Examples of org.apache.naming.core.NamingEntry


       
        if (name.isEmpty()) {
            return new NamingContextEnumeration(bindings.elements(), this, true);
        }
       
        NamingEntry entry = (NamingEntry) bindings.get(name.get(0));
       
        if (entry == null) {
            throw new NameNotFoundException
                (sm.getString("namingContext.nameNotBound", name.get(0)));
        }
View Full Code Here


//             mmc.setBindings( bindings );
//             return mmc;
             return null;
         }
       
        NamingEntry entry = (NamingEntry) bindings.get(name.get(0));
       
        if (entry == null) {
            throw new NameNotFoundException
                (sm.getString("namingContext.nameNotBound", name.get(0)));
        }
View Full Code Here

    {
        // Removing empty parts
        while ((!name.isEmpty()) && (name.get(0).length() == 0))
            name = name.getSuffix(1);
       
        NamingEntry entry=findNamingEntry( name, resolveLinks );

        if( entry.type == NamingEntry.CONTEXT ) {
            return ((BaseDirContext) entry.value).lookup(name.getSuffix(1), resolveLinks);
        }
       
View Full Code Here

        if (name.isEmpty())
            throw new NamingException
                (sm.getString("namingContext.invalidName"));
       
        NamingEntry entry = (NamingEntry) bindings.get(name.get(0));
       
        if (name.size() > 1) {
            if (entry == null) {
                throw new NameNotFoundException
                    (sm.getString("namingContext.nameNotBound", name.get(0)));
            }
            if (entry.type == NamingEntry.CONTEXT) {
                if (rebind) {
                    ((Context) entry.value).rebind(name.getSuffix(1), obj);
                } else {
                    ((Context) entry.value).bind(name.getSuffix(1), obj);
                }
            } else {
                throw new NamingException
                    (sm.getString("namingContext.contextExpected"));
            }
        } else {
            if ((!rebind) && (entry != null)) {
                throw new NamingException
                    (sm.getString("namingContext.alreadyBound", name.get(0)));
            } else {
                // Getting the type of the object and wrapping it within a new
                // NamingEntry
                Object toBind =
                    NamingManager.getStateToBind(obj, name, this, env);
                if (toBind instanceof Context) {
                    entry = new NamingEntry(name.get(0), toBind, attrs, 
                                            NamingEntry.CONTEXT);
                } else if (toBind instanceof LinkRef) {
                    entry = new NamingEntry(name.get(0), toBind, attrs,
                                            NamingEntry.LINK_REF);
                } else if (toBind instanceof Reference) {
                    entry = new NamingEntry(name.get(0), toBind, attrs,
                                            NamingEntry.REFERENCE);
                } else if (toBind instanceof Referenceable) {
                    toBind = ((Referenceable) toBind).getReference();
                    entry = new NamingEntry(name.get(0), toBind, attrs,
                                            NamingEntry.REFERENCE);
                } else {
                    entry = new NamingEntry(name.get(0), toBind, attrs,
                                            NamingEntry.ENTRY);
                }
                bindings.put(name.get(0), entry);
            }
        }
View Full Code Here

            return entries;
        String[] names = file.list();
        Arrays.sort(names);             // Sort alphabetically
        if (names == null)
            return entries;
        NamingEntry entry = null;

        for (int i = 0; i < names.length; i++) {

            File currentFile = new File(file, names[i]);
            Object object = null;
            if (currentFile.isDirectory()) {
                FileDirContext tempContext = new FileDirContext(env);
                tempContext.setDocBase(file.getPath());
                object = tempContext;
            } else {
                //object = new FileResource(currentFile);
                object = currentFile;
            }
            entry = new NamingEntry(names[i], object, null, NamingEntry.ENTRY);
            entries.addElement(entry);

        }

        return entries;
View Full Code Here

TOP

Related Classes of org.apache.naming.core.NamingEntry

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.