Package com.dbxml.db.core

Examples of com.dbxml.db.core.Collection$ColContainerSet


   public void toSAX(ContentHandler handler) throws QueryException {
      throw new NotSupportedException("Not implemented");
   }

   public DocumentTable toDocumentTable() throws QueryException {
      Collection col = rs.getCollection();
      TableBuilder tb;
      try {
         tb = new TableBuilder(col.getSymbols());
      }
      catch ( DBException e ) {
         throw new NotSupportedException(e);
      }

      tb.addEntry(Constants.OBJ_BEGIN_DOCUMENT);
      int rootID = tb.addEntry(Constants.OBJ_BEGIN_ELEMENT, QNAME_RESULTS);
      // Namespace
      int attrID = tb.addEntry(Constants.OBJ_BEGIN_ATTRIBUTE, QNAME_NSDEF);
      tb.addEntry(Constants.OBJ_TEXT, UTF8_URI);
      tb.addEntry(Constants.OBJ_END_ATTRIBUTE, attrID);
      // Collection
      attrID = tb.addEntry(Constants.OBJ_BEGIN_ATTRIBUTE, QNAME_COL);
      tb.addEntry(Constants.OBJ_TEXT, UTF8.toUTF8(col.getCanonicalName()));
      tb.addEntry(Constants.OBJ_END_ATTRIBUTE, attrID);

      int count = rs.getCount();
      if ( count != -1 ) {
         attrID = tb.addEntry(Constants.OBJ_BEGIN_ATTRIBUTE, QNAME_COUNT);
         tb.addEntry(Constants.OBJ_TEXT, UTF8.toUTF8(Integer.toString(count)));
         tb.addEntry(Constants.OBJ_END_ATTRIBUTE, attrID);
      }

      while ( rs.next() ) {
         Collection c = rs.getResultCollection();

         int resID = tb.addEntry(Constants.OBJ_BEGIN_ELEMENT, QNAME_RESULT);
         if ( c != col ) {
            // Alternate Collection
            attrID = tb.addEntry(Constants.OBJ_BEGIN_ATTRIBUTE, QNAME_COL);
            tb.addEntry(Constants.OBJ_TEXT, UTF8.toUTF8(c.getCanonicalName()));
            tb.addEntry(Constants.OBJ_END_ATTRIBUTE, attrID);
         }
         Key key = rs.getResultKey();
         if ( key != null && key.getLength() > 0 ) {
            // Key
View Full Code Here


         sw.write(vals[i]);
   }

   public String toText() throws QueryException {
      try {
         Collection col = rs.getCollection();

         StringWriter sw = new StringWriter(1024);
         sw.write(RESULTS_START);
         writeStrings(sw, new String[]{" ", COL, "=\"", col.getCanonicalName(), "\""});
         int count = rs.getCount();
         if ( count != -1 )
            writeStrings(sw, new String[]{" ", COUNT, "=\"", Integer.toString(count), "\""});
         sw.write(">");

         while ( rs.next() ) {
            Collection c = rs.getResultCollection();
            sw.write(RESULT_START);
            if ( c != col )
               writeStrings(sw, new String[]{" ", COL, "=\"", c.getCanonicalName(), "\""});
            Key key = rs.getResultKey();
            if ( key != null && key.getLength() > 0 )
               writeStrings(sw, new String[]{" ", KEY, "=\"", key.toString(), "\""});
            sw.write(">");
View Full Code Here

   public String getMachineID() {
      if ( machineID == null ) {
         Transaction tx = new Transaction();

         try {
            Collection sysCol = collection.getSystemCollection();
            Collection cfgCol = sysCol.getCollection(SystemCollection.CONFIGS);
        DOMAdapter domAdapter = new DOMAdapter(cfgCol);
        Document doc = domAdapter.getDocument(tx, SYNCID_XML);
            if ( doc != null ) {
               Element elem = doc.getDocumentElement();
               machineID = elem.getAttribute(ID);
            }
            else {
               machineID = cfgCol.createNewOID().toString();
               doc = DOMHelper.newDocument();
               Element elem = doc.createElement(SYNC);
               doc.appendChild(elem);
               elem.setAttribute(ID, machineID);
          domAdapter.setDocument(tx, SYNCID_XML, doc);
View Full Code Here

    }
   }

   XMLSerializableAdapter getGroupsCollection() throws DBException {
      if ( groupsCol == null ) {
         Collection sysCol = getCollection().getSystemCollection();
         Collection metaCol = sysCol.getCollection(SystemCollection.METADATA);
         Collection col = metaCol.getCollection(GROUPS_COL);
         groupsCol = new XMLSerializableAdapter(col);
      }
      return groupsCol;
   }
View Full Code Here

      return groupsCol;
   }

   XMLSerializableAdapter getContentCollection() throws DBException {
      if ( contentCol == null ) {
         Collection sysCol = getCollection().getSystemCollection();
         Collection metaCol = sysCol.getCollection(SystemCollection.METADATA);
         Collection col = metaCol.getCollection(CONTENT_COL);
         contentCol = new XMLSerializableAdapter(col);
      }
      return contentCol;
   }
View Full Code Here

   private AccessUtils getAccessUtils() {
      if ( utils == null ) {
         try {
            userStack.pushCurrentUser(magicUser);
            Collection sysCol = database.getSystemCollection();
            AccessManager manager = (AccessManager)sysCol.getExtensionManager().get(NAME);
            utils = manager.getAccessUtils();
         }
         catch ( DBException e ) {
            System.err.println("FATAL ERROR: Can't retrieve AccessManager Extensions '"+NAME+"'");
            e.printStackTrace(System.err);
View Full Code Here

    }
   }

   private XMLSerializableAdapter getUsersCollection() throws DBException {
      if ( userCol == null ) {
         Collection sysCol = database.getSystemCollection();
         Collection col = sysCol.getCollection(SystemCollection.USERS);
         userCol = new XMLSerializableAdapter(col);
      }
      return userCol;
   }
View Full Code Here

      return userCol;
   }

   private XMLSerializableAdapter getRolesCollection() throws DBException {
      if ( roleCol == null ) {
         Collection sysCol = database.getSystemCollection();
         Collection col = sysCol.getCollection(SystemCollection.ROLES);
         roleCol = new XMLSerializableAdapter(col);
      }
      return roleCol;
   }
View Full Code Here

      return roleCol;
   }

   private XMLSerializableAdapter getAccessCollection() throws DBException {
      if ( accessCol == null ) {
         Collection sysCol = database.getSystemCollection();
         Collection col = sysCol.getCollection(SystemCollection.ACCESS);
         accessCol = new XMLSerializableAdapter(col);
      }
      return accessCol;
   }
View Full Code Here

TOP

Related Classes of com.dbxml.db.core.Collection$ColContainerSet

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.