Package com.dbxml.util

Examples of com.dbxml.util.dbXMLException


      try {
         Container con = col.getContainer(tx, key);
         if ( con != null )
            return new ContentClientImpl(this, con);
         else
            throw new dbXMLException("Content '" + key + "' not found");
      }
      catch ( dbXMLException e ) {
         tx.cancel();
         throw e;
      }
View Full Code Here


      return props;
   }

   public void connect() throws dbXMLException {
      if ( connected )
         throw new dbXMLException("Already connected");
      connected = true;
   }
View Full Code Here

      connected = true;
   }

   public void disconnect() throws dbXMLException {
      if ( !connected )
         throw new dbXMLException("Not connected");
      connected = false;
   }
View Full Code Here

   public CollectionClient getDatabase() throws dbXMLException {
      Database db = Database.getInstance();
      if ( db != null )
         return new CollectionClientImpl(this, db);
      else
         throw new dbXMLException("Database not found");
   }
View Full Code Here

   public CollectionClient getCollection(String path) throws dbXMLException {
      Collection col = getAbsoluteCollection(path);
      if ( col != null )
         return new CollectionClientImpl(this, col);
      else
         throw new dbXMLException("Collection '" + path + "' not found");
   }
View Full Code Here

            if ( col != null ) {
               Container con = col.getContainer(tx, docName);
               if ( con != null )
                  return new ContentClientImpl(new CollectionClientImpl(this, col), con);
               else
                  throw new dbXMLException("Document '" + docName + "' not found");
            }
            else
               throw new dbXMLException("Collection '" + path + "' not found");
         }
         else
            throw new dbXMLException("Invalid Document Path '" + path + "'");
      }
      catch ( dbXMLException e ) {
         tx.cancel();
         throw e;
      }
View Full Code Here

            cm = cm.getCollection(path);
         }
         return (Collection)cm;
      }
      else
         throw new dbXMLException("Invalid Collection Path '"+path+"'");
   }
View Full Code Here

               Document doc = DOMHelper.parse(new File(mapFile));
               Configuration mapCfg = new Configuration(doc);
               sb = new SQLBuilder(mapCfg);
            }
            catch ( IOException e ) {
               throw new dbXMLException(e);
            }
            catch ( SAXException e ) {
               throw new dbXMLException(e);
            }
         }
         else
            sb = new SQLBuilder(config.getChild(TABLE));
         map = sb.getMap();
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 roleID = cl.getNextToken("Role ID");
      int permissions = 0;
      boolean recursive = false;

      if ( !cl.hasMoreTokens() )
         throw new dbXMLException("At least one permission must be specified");

      while ( cl.hasMoreTokens() ) {
         String mode = cl.getNextToken("Mode").toUpperCase();
         boolean found = false;
         for ( int i = 0; i < STRS.length; i++ ) {
            if ( mode.equals(STRS[i]) ) {
               permissions |= INTS[i];
               found = true;
            }
         }
         if ( mode.equals(ALL) ) {
            for ( int i = 0; i < INTS.length; i++ )
               permissions |= INTS[i];
            found = true;
         }
         if ( mode.equals(RECURSIVE) ) {
            recursive = true;
            found = true;
         }

         if ( !found )
            throw new dbXMLException("Unknown mode '"+mode+"'");
      }

      process(col, roleID, permissions, recursive);

      StringBuffer sb = new StringBuffer();
View Full Code Here

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

      String name = cl.getNextToken(getType()+" Name");
      Properties props = cl.parseProperties();

      PrintWriter pw = cl.getWriter();

      if ( cl.isPropertyTrue(CommandLine.CONFIRM) ) {
         try {
            String ans = cl.readLine("Create " + getType() + " (Y/n)? ");
            if ( ans.equalsIgnoreCase("no") || ans.equalsIgnoreCase("n") ) {
               pw.println(getType() + " creation canceled");
               return;
            }
         }
         catch ( Exception e ) {
            throw new dbXMLException("Error obtaining answer");
         }
      }

      if ( createObject(col, name, props) )
         pw.println(getType() + " '" + name + "' created");
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.