Package com.dbxml.util

Examples of com.dbxml.util.dbXMLException


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

      if ( wildcard ) {
         WildcardMatcher matcher = new WildcardMatcher(docName);
View Full Code Here


   protected boolean createObject(CollectionClient col, String name, Properties props) throws dbXMLException {
      try {
         String cname = props.getProperty(CLASS);
         if ( cname == null || cname.length() == 0 )
            throw new dbXMLException("Class name is required");

         Document doc = DOMHelper.newDocument();
         Element root = doc.createElement("trigger");
         root.setAttribute("name", name);
         doc.appendChild(root);

         Iterator iter = props.entrySet().iterator();
         while ( iter.hasNext() ) {
            Map.Entry entry = (Map.Entry)iter.next();
            String key = (String)entry.getKey();
            String value = (String)entry.getValue();
            root.setAttribute(key, value);
         }

         return col.createTrigger(doc) != null;
      }
      catch ( Exception e ) {
         throw new dbXMLException(e);
      }
   }
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(type+" Name");
      File file = new File(filename);
      String docName = file.getName();
      boolean asUsed = false;
      while ( cl.hasMoreTokens() ) {
         String adj = cl.getNextToken("As");
         if ( adj.equalsIgnoreCase("AS") ) {
            asUsed = true;
            if ( cl.hasMoreTokens() )
               docName = cl.getNextToken("Filename");
            else
               throw new dbXMLException(type + " name required");
         }
      }

      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();

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

         else if ( tv.equals(CHAR_VAL) )
            type = CHAR;
         else if ( tv.equals(BOOLEAN_VAL) )
            type = BOOLEAN;
         else
            throw new dbXMLException("Illegal type for ValueIndexer: '"+tv+"'");

         typeSize = sizes[type];

         fileHeader.setPageSize(config.getIntAttribute(PAGESIZE, fileHeader.getPageSize()));
View Full Code Here

         }

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

         switch ( getContentType() ) {
            case CollectionClient.TYPE_DOCUMENTS:
               if ( res instanceof XMLResourceImpl )
                  client.setDocumentAsText(res.getId(), (String)res.getContent());
               else
                  throw new dbXMLException("Collection can only store document content");
               break;

            case CollectionClient.TYPE_VALUES:
               if ( res instanceof BinaryResourceImpl )
                  client.setValue(res.getId(), (byte[])res.getContent());
               else
                  throw new dbXMLException("Collection can only store binary content");
               break;

            default:
               throw new dbXMLException("Unknown Content Type");
         }
      }
      catch ( dbXMLException e ) {
         throw new XMLDBException(ErrorCodes.VENDOR_ERROR, e.getMessage());
      }
View Full Code Here

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

      AccessManagerClient manager = new AccessManagerClient(cl.getClient());
      manager.removeRole(argument);
View Full Code Here

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

      AccessManagerClient manager = new AccessManagerClient(cl.getClient());
      manager.removeUser(argument);
View Full Code Here

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

      String name = cl.getNextToken("Document Name");
      process(col, name);
   }
View Full Code Here

   protected boolean createObject(CollectionClient col, String name, Properties props) throws dbXMLException {
      try {
         String cname = props.getProperty(CLASS);
         if ( cname == null || cname.length() == 0 )
            throw new dbXMLException("Class name is required");

         Document doc = DOMHelper.newDocument();
         Element root = doc.createElement("extension");
         root.setAttribute("name", name);
         doc.appendChild(root);

         Iterator iter = props.entrySet().iterator();
         while ( iter.hasNext() ) {
            Map.Entry entry = (Map.Entry)iter.next();
            String key = (String)entry.getKey();
            String value = (String)entry.getValue();
            root.setAttribute(key, value);
         }

         return col.createExtension(doc) != null;
      }
      catch ( Exception e ) {
         throw new dbXMLException(e);
      }
   }
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.