Package javax.naming

Examples of javax.naming.NameAlreadyBoundException


    if( name.size() == 1 )
    {
        if( binding != null && isBind == false )
      {
        throw new NameAlreadyBoundException("Use rebind to override");
      }

      // Add object to internal data structure
      bindings.put(atom, value);
View Full Code Here


    public void bind(String name, Object obj) throws NamingException
    {
        if (bindings.containsKey(name))
        {
            throw new NameAlreadyBoundException(name);
        }
        bindings.put(name, obj);
    }
View Full Code Here

        {
            throw new NameNotFoundException(oldName);
        }
        if (bindings.containsKey(newName))
        {
            throw new NameAlreadyBoundException(newName);
        }

        bindings.put(newName, bindings.remove(oldName));
    }
View Full Code Here

                        if (j > 0) {
                            subname += ".";
                        }
                        subname += composite.get(j);
                    }
                    throw new NameAlreadyBoundException(
                        "'" + subname + "' is already bound");
                } else {
                    subcontext = (Context) object;
                }
            } catch (NameNotFoundException exception) {
                subcontext = subcontext.createSubcontext(component);
            }
        }

        component = composite.get(composite.size() - 1);
        if (component.length() == 0) {
            throw new InvalidNameException("'" + name
                                           + "' is not a valid name");
        }

        try {
            Object object = subcontext.lookup(component);
            if (object instanceof Context) {
                throw new NameAlreadyBoundException("'" + name +
                                                    "' is already bound");
            }
        } catch (NameNotFoundException ignore) {
        } catch (NamingException exception) {
        }
View Full Code Here

        System.err.printf("===== Binding: %s at %s%n", arg0, arg1); ///////////////////////

      arg0 = arg0.trim();
      try {
        if (lookup(arg0) != null)
          throw new NameAlreadyBoundException();
      } catch (NameNotFoundException ne) {
        if (__debug)
          System.err.printf("Remote ctx %s%n", remoteContext);
        if (remoteContext != null)
          if (arg1 instanceof org.omg.CORBA.Object)
View Full Code Here

    public DirContext createSubcontext(String name, Attributes attrs)
        throws NamingException {
       
        File file = new File(base, name);
        if (file.exists())
            throw new NameAlreadyBoundException
                (sm.getString("resources.alreadyBound", name));
        if (!file.mkdir())
            throw new NamingException
                (sm.getString("resources.bindFailed", name));
        return (DirContext) lookup(name);
View Full Code Here

       
        // Note: No custom attributes allowed
       
        File file = new File(base, name);
        if (file.exists())
            throw new NameAlreadyBoundException
                (sm.getString("resources.alreadyBound", name));
       
        rebind(name, obj, attrs);
       
    }
View Full Code Here

                } else {
                    logger.error("Jndi(name=" + externalName + ") cannot be bound to Ejb(deployment-id=" + beanInfo.ejbDeploymentId + ").  Name already taken by another object in the system.");
                }
                // Construct a new exception as the IvmContext doesn't include
                // the name in the exception that it throws
                if (failOnCollision) throw new NameAlreadyBoundException(externalName);
            }
        } else {
            try {
                openejbContext.bind(name, ref);
                logger.debug("bound ejb at name: " + name + ", ref: " + ref);
                bindings.add(name);
            } catch (NameAlreadyBoundException e) {
                logger.error("Jndi name could not be bound; it may be taken by another ejb.  Jndi(name=" + name + ")");
                // Construct a new exception as the IvmContext doesn't include
                // the name in the exception that it throws
                throw new NameAlreadyBoundException(name);
            }
        }

    }
View Full Code Here

       
        // Note: No custom attributes allowed
       
        File file = new File(base, name);
        if (file.exists())
            throw new NameAlreadyBoundException
                (sm.getString("resources.alreadyBound", name));
       
        rebind(name, obj, attrs);
       
    }
View Full Code Here

    public DirContext createSubcontext(String name, Attributes attrs)
        throws NamingException {
       
        File file = new File(base, name);
        if (file.exists())
            throw new NameAlreadyBoundException
                (sm.getString("resources.alreadyBound", name));
        if (!file.mkdir())
            throw new NamingException
                (sm.getString("resources.bindFailed", name));
        return (DirContext) lookup(name);
View Full Code Here

TOP

Related Classes of javax.naming.NameAlreadyBoundException

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.