FileDocCategorySizeDatePackage
create.javaAPI DocExample2219Thu Dec 15 21:14:30 GMT 2005com.oreilly.jent.jndi

create

public class create extends Object implements Command
create: Command to create a new context within the current JNDI context.

Fields Summary
Constructors Summary
Methods Summary
public voidexecute(javax.naming.Context c, java.util.Vector v)

            
    // Check to see if we have the name we need to create a context
    if (v.isEmpty())
      throw new CommandException(new Exception(), "No name specified");
                
    String name = (String)v.firstElement();
    try {
      c.createSubcontext(name);
      System.out.println("Created " + name);
    }
    catch (NoPermissionException npe) {
      throw new CommandException(npe,
        "You don't have permission to create " + name + " at this context");
    }
    catch (NamingException ne) {
      throw new CommandException(ne, "Couldn't create " + name);
    }
  
public voidhelp()

  System.out.println("Usage: create [name]");