Package com.dbxml.util

Examples of com.dbxml.util.dbXMLException


            StringTokenizer st = new StringTokenizer(msg.substring(ResponseMsg.length()));
            String code = st.nextToken();
            String message = (String)ResponseCodes.get(code);
            if ( message == null )
               message = "Unknown Error";
            throw new dbXMLException("HTTP "+code+" ("+message+")", e);
         }
         else
            throw new dbXMLException(e);
      }
      catch ( XmlRpcException e ) {
         throw new dbXMLException(e.code, e);
      }
   }
View Full Code Here


            if ( queryCfg != null )
               engine.setConfig(queryCfg);
         }
         catch ( Exception e ) {
            e.printStackTrace(System.err);
            throw new dbXMLException("Couldn't initialize Query Engine", e);
         }

         try {
            sysCol = new SystemCollection(this, magicUser, userStack);
            try {
               sysCol.init();
            }
            catch ( dbXMLException e ) {
               e.printStackTrace(System.err);
            }
            collections.put(sysCol.getName(), sysCol);
         }
         catch ( Exception e ) {
            e.printStackTrace(System.err);
            throw new dbXMLException("Couldn't initialize System Collection", e);
         }

         Transaction tx = new Transaction();
         try {
            // Bootstrap from the database itself...  This is accomplished
            // by intercepting the setConfig call and using a Configuration
            // retrieved from the database instead of the standard config
            Collection col = sysCol.getCollection(SystemCollection.CONFIGS);
            DOMAdapter domAdapter = new DOMAdapter(col);
            Document colDoc = domAdapter.getDocument(tx, COLKEY);

            if ( colDoc == null ) {
               colDoc = DOMHelper.newDocument();
               Element root = colDoc.createElement(DATABASE);
               root.setAttribute(NAME, name);
               colDoc.appendChild(root);

               domAdapter.setDocument(tx, COLKEY, colDoc);
            }

            super.setConfig(new Configuration(colDoc));
         }
         catch ( Throwable e ) {
            tx.cancel();
            e.printStackTrace(System.err);
            throw new dbXMLException("Couldn't bootstrap Database", e);
         }
         finally {
            if ( tx.getStatus() == Transaction.ACTIVE )
               tx.commit();
         }

         try {
            Configuration securityCfg = config.getChild(SECURITY);
            if ( securityCfg != null ) {
               String className = securityCfg.getAttribute(CLASS);
               security = (SecurityManager)ClassResolver.get(className).newInstance();
               security.setDatabase(this);
               security.setMagicUser(magicUser);
               security.setUserStack(userStack);
               security.setConfig(securityCfg);
            }
         }
         catch ( Exception e ) {
            e.printStackTrace(System.err);
            throw new dbXMLException("Couldn't initialize Security Manager", e);
         }
      }
      finally {
         userStack.popCurrentUser();
      }
View Full Code Here

      // String value
      if ( newObj == null )
         newObj = value;

      if ( obj != null && (obj.getClass() != newObj.getClass()) )
         throw new dbXMLException("Cannot change type of property '" + name + "'");

      props.put(name, newObj);
   }
View Full Code Here

      this.client = client;
   }

   public dbXMLClient getClient() throws dbXMLException {
      if ( client == null )
         throw new dbXMLException("Not connected");
      return client;
   }
View Full Code Here

      Properties properties = new Properties();

      while ( st.hasMoreTokens() ) {
         String name = getNextToken();
         if ( getTokenType(name) != TOKEN_VALUE )
            throw new dbXMLException("Name Token Expected");

         String operator = getNextToken();
         if ( getTokenType(operator) != TOKEN_OPERATOR )
            throw new dbXMLException("Operator Token Expected");

         String value = getNextToken();
         switch ( getTokenType(value) ) {
            case TOKEN_VALUE:
               properties.setProperty(name, value);
               break;

            default:
               throw new dbXMLException("Value Token Expected");
         }
      }
      return properties;
   }
View Full Code Here

                           sb.append(value);
                           break;
                     }
                  }
                  else
                     throw new dbXMLException("String Token Not Terminated");
               }
               token = sb.toString();
               return;

            case TOKEN_WHITESPACE:
View Full Code Here

      }
   }

   public String getNextToken(String tokenName) throws dbXMLException {
      if ( token == null )
         throw new dbXMLException(tokenName+" Expected");

      String result = token;
      fetchNextToken();
      return result;
   }
View Full Code Here

   public CollectionClient getParentCollection() throws dbXMLException {
      Collection pc = col.getParentCollection();
      if ( pc != null )
         return new CollectionClientImpl(client, pc);
      else
         throw new dbXMLException("No parent Collection");
   }
View Full Code Here

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

      Configuration cfg = new Configuration(configuration);
      Collection c = col.createCollection(path, cfg);
      if ( c != null )
         return new CollectionClientImpl(client, c);
      else
         throw new dbXMLException("Couldn't create Collection '" + path + "'");
   }
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.