Package com.dbxml.db.client

Examples of com.dbxml.db.client.CollectionClient


      manager.grant(colName, roleID, permissions);

      if ( recursive ) {
         String[] children = col.listCollections();
         for ( int i = 0; i < children.length; i++ ) {
            CollectionClient child = col.getCollection(children[i]);
            process(manager, child, roleID, permissions, recursive);
         }
      }
   }
View Full Code Here


      textEditor.setEnabled(true);
      textEditor.setLanguage(doc.getLanguage());

      boolean sys = false;
      try {
         CollectionClient c = doc.col.getParentCollection();
         while ( !sys && c != null ) {
            sys = c.getName().equals("system");
            if ( !sys )
               c = c.getParentCollection();
         }
      }
      catch ( Exception e ) {
         // No Parent or NullPointer, either way, it ain't system
      }
View Full Code Here

         DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
         AdminNode info = (AdminNode)node.getUserObject();

         if ( info instanceof HasCollection && ((HasCollection)info).getCollection() != null ) {
            setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            CollectionClient col = ((HasCollection)info).getCollection();
            Stopwatch sw = new Stopwatch("Query Results", true);
            String style;
            switch ( cmbQueryType.getSelectedIndex() ) {
               case 0:  style = XPathQueryResolver.STYLE_XPATH;       break;
               case 1:  style = FullTextQueryResolver.STYLE_FULLTEXT; break;
               case 2:  style = XSLTQueryResolver.STYLE_XSLT;         break;
               default: style = XUpdateQueryResolver.STYLE_XUPDATE;   break;
            }
            ResultSetClient rs = col.queryCollection(style, query, cfg.getNamespaceMap());

            sw.stop();
            statusBar.setText(sw.toString());

            Document doc = DOMHelper.newDocument();
            Element root = doc.createElementNS(Query.NSURI, Query.PREFIX+":"+ResultSetWrapper.RESULTS);
            String colName = rs.getCollection().getCanonicalName();
            root.setAttribute("xmlns:"+Query.PREFIX, Query.NSURI);
            root.setAttribute(ResultSetWrapper.COL, colName);
            int count = rs.getCount();
            if ( count != -1 )
               root.setAttribute(ResultSetWrapper.COUNT, Integer.toString(count));
            doc.appendChild(root);
            root.appendChild(doc.createTextNode("\n"));

            while ( rs.next() ) {
               Node n = rs.getResult();
               Element result = doc.createElementNS(Query.NSURI, Query.PREFIX+":"+ResultSetWrapper.RESULT);
               result.appendChild(doc.createTextNode("\n"));
               CollectionClient rc = rs.getResultCollection();
               String rsColName = rc.getCanonicalName();
               if ( !rsColName.equals(colName) )
                  result.setAttribute(ResultSetWrapper.COL, rsColName);
               String key = rs.getResultKey();
               if ( key != null && key.length() > 0 )
                  result.setAttribute(ResultSetWrapper.KEY, key);
View Full Code Here

         sb.append('\u0008');
      EOL_STRING = sb.toString();
   }

   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";
View Full Code Here

      try {

         client.connect();
         cl.setClient(client);
         CollectionClient db = client.getDatabase();
         cl.setProperty(CommandLine.COLLECTION, db);
         pw.println("Connected");
      }
      catch ( Exception e ) {
         cl.setClient(null);
View Full Code Here

   }

   public Collection getParentCollection() throws XMLDBException {
      checkOpened();
      try {
         CollectionClient parent = client.getParentCollection();
         if ( parent != null )
            return new CollectionImpl(parent);
         else
            throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION, "No Parent Collection");
      }
View Full Code Here

      }
   }

   public Collection getChildCollection(String name) throws XMLDBException {
      try {
         CollectionClient child = client.getCollection(name);
         if ( child != null )
            return new CollectionImpl(child);
         else
            throw new XMLDBException(ErrorCodes.NO_SUCH_COLLECTION, "No Child Collection named '" + name + "'");
      }
View Full Code Here

         if ( templates != null ) {
            Collection parent = templates.getParentCollection();
            if ( parent instanceof CollectionImpl ) {
               CollectionImpl impl = (CollectionImpl)parent;
               CollectionClient cli = impl.getCollectionClient();
               String path = cli.getCanonicalName()+"/"+templates.getId();
               sb.append("   <dbxml:stylesheet document=\""+path+"\"/>\n");
            }
            else {
               sb.append("   <dbxml:stylesheet>\n");
               sb.append((String)templates.getContent());
View Full Code Here

* ContentBase is a base class for several content-related Commands.
*/

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

View Full Code Here

*/

public final class Collection extends CommandBase {
   public void process() throws dbXMLException {
      String colName = cl.getNextToken("Collection Name");
      CollectionClient col = (CollectionClient)cl.getProperty(CommandLine.COLLECTION);
      if ( col != null ) {
         if ( colName.equals("..") )
            col = col.getParentCollection();
         else if ( colName.equals(".") )
            col = col;
         else if ( colName.startsWith("/") )
            col = cl.getClient().getCollection(colName);
         else
            col = col.getCollection(colName);
      }
      else {
         if ( !colName.startsWith("/") )
            colName = '/' + colName;
         col = cl.getClient().getCollection(colName);
      }
      cl.setProperty(CommandLine.COLLECTION, col);

      PrintWriter pw = cl.getWriter();
      pw.println("Collection: "+col.getCanonicalName());
   }
View Full Code Here

TOP

Related Classes of com.dbxml.db.client.CollectionClient

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.