Package com.dbxml.util

Examples of com.dbxml.util.dbXMLException


      }
      catch ( dbXMLException e ) {
         throw e;
      }
      catch ( Exception e ) {
         throw new dbXMLException(e);
      }
   }
View Full Code Here


      }
      catch ( dbXMLException e ) {
         throw e;
      }
      catch ( Exception e ) {
         throw new dbXMLException(e);
      }
   }
View Full Code Here

      iterator = null;
   }

   private void checkClosed() throws dbXMLException {
      if ( iterator == null )
         throw new dbXMLException("ResultSet is closed");
   }
View Full Code Here

   private static final String ACTION_LSROLE = "LSROLE";

   public void process() throws dbXMLException {
      CollectionClient col = (CollectionClient)cl.getProperty(CommandLine.COLLECTION);
      if ( col == null )
         throw new dbXMLException("Collection context required");

      AccessManagerClient manager = new AccessManagerClient(cl.getClient());
      PrintWriter pw = cl.getWriter();

      if ( !cl.hasMoreTokens() )
         throw new dbXMLException("User ID is required");
      String userID = cl.getNextToken();

      if ( !cl.hasMoreTokens() )
         throw new dbXMLException("A User action must be specified");
      String action = cl.getNextToken().toUpperCase();

      if ( action.equals(ACTION_PASSWORD) ) {
         if ( !cl.hasMoreTokens() )
            throw new dbXMLException("A new password must be specified");
         String password = cl.getNextToken();
         manager.setUserPassword(userID, password);
         pw.println("Password set for '"+userID+"'");
      }
      else if ( action.equals(ACTION_ADDROLE) ) {
         if ( !cl.hasMoreTokens() )
            throw new dbXMLException("A Role ID must be specified");
         String roleID = cl.getNextToken();
         manager.addRoleToUser(userID, roleID);
         pw.println("Role '"+roleID+"' added to User '"+userID+"'");
      }
      else if ( action.equals(ACTION_RMROLE) ) {
         if ( !cl.hasMoreTokens() )
            throw new dbXMLException("A Role ID must be specified");
         String roleID = cl.getNextToken();
         manager.removeRoleFromUser(userID, roleID);
         pw.println("Role '"+roleID+"' removed from User '"+userID+"'");
      }
      else if ( action.equals(ACTION_LSROLE) ) {
         String[] list = manager.listRolesForUser(userID);
         int count = 0;
         for ( int i = 0; i < list.length; i++ ) {
            pw.println(list[i]);
            count++;
         }

         if ( cl.isPropertyTrue(CommandLine.TOTALS) ) {
            if ( count > 0 )
               pw.println("-----------------------");
            if ( count != 1 )
               pw.println(count + " Roles");
            else
               pw.println(count + " Role");
         }
      }
      else
         throw new dbXMLException("Unknown action '"+action+"'");
   }
View Full Code Here

public abstract class ListBase extends CommandBase {
   public final void process() throws dbXMLException {
      CollectionClient col = (CollectionClient)cl.getProperty(CommandLine.COLLECTION);
      if ( col == null )
         throw new dbXMLException("Collection context required");

      WildcardMatcher matcher = null;
      if ( cl.hasMoreTokens() )
         matcher = new WildcardMatcher(cl.getNextToken("Filespec"));
View Full Code Here

   private static final String ACTION_LSUSER = "LSUSER";

   public void process() throws dbXMLException {
      CollectionClient col = (CollectionClient)cl.getProperty(CommandLine.COLLECTION);
      if ( col == null )
         throw new dbXMLException("Collection context required");

      AccessManagerClient manager = new AccessManagerClient(cl.getClient());
      PrintWriter pw = cl.getWriter();

      String roleID = cl.getNextToken("Role ID");
      String action = cl.getNextToken("Role Action").toUpperCase();

      if ( action.equals(ACTION_ADDUSER) ) {
         String userID = cl.getNextToken("User ID");
         manager.addRoleToUser(userID, roleID);
         pw.println("User '"+userID+"' added to Role '"+roleID+"'");
      }
      else if ( action.equals(ACTION_RMUSER) ) {
         String userID = cl.getNextToken("User ID");
         manager.removeRoleFromUser(userID, roleID);
         pw.println("User '"+userID+"' removed from Role '"+roleID+"'");
      }
      else if ( action.equals(ACTION_LSUSER) ) {
         String[] list = manager.listUsersForRole(roleID);
         int count = 0;
         for ( int i = 0; i < list.length; i++ ) {
            pw.println(list[i]);
            count++;
         }

         if ( cl.isPropertyTrue(CommandLine.TOTALS) ) {
            if ( count > 0 )
               pw.println("-----------------------");
            if ( count != 1 )
               pw.println(count + " Users");
            else
               pw.println(count + " User");
         }
      }
      else
         throw new dbXMLException("Unknown action '"+action+"'");
   }
View Full Code Here

   private static final int[] INTS = {Access.NONE, Access.READ, Access.WRITE, Access.EXECUTE, Access.CREATE};

   public void process() throws dbXMLException {
      CollectionClient col = (CollectionClient)cl.getProperty(CommandLine.COLLECTION);
      if ( col == null )
         throw new dbXMLException("Collection context required");

      String path = col.getCanonicalName();
      String roleID = null;

      if ( cl.hasMoreTokens() )
         roleID = cl.getNextToken("Role ID");

      AccessManagerClient manager = new AccessManagerClient(cl.getClient());
      Map map = manager.listAccessControl(path);

      PrintWriter pw = cl.getWriter();

      if ( roleID != null ) {
         Integer i = (Integer)map.get(roleID);
         if ( i != null )
            display(pw, roleID, i.intValue());
         else
            throw new dbXMLException("Role ID '"+roleID+"' does not participate in this Collection");
      }
      else {
         System.out.println(StringUtilities.leftJustify("Role", 20)+" Permissions");
         System.out.println("-------------------- ------------------------------");
View Full Code Here

   }

   public void process() throws dbXMLException {
      CollectionClient col = (CollectionClient)cl.getProperty(CommandLine.COLLECTION);
      if ( col == null )
         throw new dbXMLException("Collection context required");

      boolean binary = col.getCollectionType() == CollectionClient.TYPE_VALUES;
      String type;
      if ( binary )
         type = "Record";
      else
         type = "Document";

      String filename = cl.getNextToken("Filename");
      File file = new File(filename);
      String docName = file.getName();
      boolean asUsed = false;
      boolean recursive = false;
      while ( cl.hasMoreTokens() ) {
         String adj = cl.getNextToken("As");
         if ( adj.equalsIgnoreCase("AS") ) {
            asUsed = true;
            if ( cl.hasMoreTokens() )
               docName = cl.getNextToken(type+" Name");
            else
               throw new dbXMLException(type + " name required");
         }
         else if ( adj.equalsIgnoreCase("RECURSIVE") )
            recursive = true;
      }

      File dir = file.getParentFile();
      if ( dir == null )
         dir = new File("./");

      String fName = file.getName();
      if ( fName.indexOf('?') != -1 || fName.indexOf('*') != -1 ) {
         // Wildcard specified
         if ( asUsed )
            throw new dbXMLException("Can't assign a " + type + " name to a wildcard path");
         List files = new ArrayList();
         PrintWriter pw = cl.getWriter();

         long size = addFiles(files, dir, fName, recursive);
         int fileCount = files.size();
View Full Code Here

      }
   }

   private long addFiles(List list, File dir, String wildcard, boolean recursive) throws dbXMLException {
      if ( !dir.exists() )
         throw new dbXMLException("Directory '"+dir.getPath()+"' does not exist");

      long totalSize = 0;
      File[] fl = dir.listFiles(new WildcardFilter(wildcard));
      for ( int i = 0; i < fl.length; i++ ) {
         list.add(fl[i]);
View Full Code Here

               pw.println(getType() + " deletion canceled");
               return;
            }
         }
         catch ( Exception e ) {
            throw new dbXMLException("Error obtaining answer");
         }
      }

      if ( dropObject(col, argument) )
         pw.println(getType() + " '" + argument + "' deleted");
View Full Code Here

TOP

Related Classes of com.dbxml.util.dbXMLException

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.