Examples of XmldbURI


Examples of org.exist.xmldb.XmldbURI

        }
        return bd;
    }
   
    private String setAdminCredentials(String uri, String username, String password, String adminPassword) throws XMLDBException, URISyntaxException {
        final XmldbURI dbUri;

        if(!uri.endsWith(XmldbURI.ROOT_COLLECTION)) {
            dbUri = XmldbURI.xmldbUriFor(uri + XmldbURI.ROOT_COLLECTION);
        } else {
            dbUri = XmldbURI.xmldbUriFor(uri);
        }
       
        final Collection root = DatabaseManager.getCollection(dbUri.toString(), username, password);
        final UserManagementService mgmt = (UserManagementService)root.getService("UserManagementService", "1.0");
        final Account dba  = mgmt.getAccount(SecurityManager.DBA_USER);
        if (dba == null) {
            throw new XMLDBException(ErrorCodes.PERMISSION_DENIED, "'"+SecurityManager.DBA_USER+"' account can't be found.");
        }
View Full Code Here

Examples of org.exist.xmldb.XmldbURI

    this(XmldbURI.create(parent).append(child));
//    this(child.startsWith("/db") ? XmldbURI.create(child) : XmldbURI.create(parent).append(child));
  }

  public Resource getParentFile() {
      final XmldbURI parentPath = uri.removeLastSegment();
    if (parentPath == XmldbURI.EMPTY_URI) {
      if (uri.startsWith(XmldbURI.DB))
        return null;
     
      return new Resource(XmldbURI.DB);
View Full Code Here

Examples of org.exist.xmldb.XmldbURI

    return ((collection != null) || (resource != null));
     
    }
   
    public boolean _renameTo(File dest) {
      final XmldbURI destinationPath = ((Resource)dest).uri;

      DBBroker broker = null;
    BrokerPool db = null;
    TransactionManager tm;

    try {
      try {
        db = BrokerPool.getInstance();
        broker = db.get(null);
      } catch (final EXistException e) {
        return false;
      }
 
      tm = db.getTransactionManager();
      Txn transaction = null;
 
          org.exist.collections.Collection destination = null;
          org.exist.collections.Collection source = null;
          XmldbURI newName;
      try {
           source = broker.openCollection(uri.removeLastSegment(), Lock.WRITE_LOCK);
          if(source == null) {
            return false;
              }
View Full Code Here

Examples of org.exist.xmldb.XmldbURI

    DBBroker broker = null;
    try {
      db = BrokerPool.getInstance();
      broker = db.get(null);
     
      XmldbURI uri = XmldbURI.create(ms.uri);
      Collection col = broker.getCollection(uri.removeLastSegment());
      if (col != null) {
        return col.getDocument(broker, uri.lastSegment());
      }
     
      return null;
    } finally {
      if (db != null)
View Full Code Here

Examples of org.exist.xmldb.XmldbURI

   
    public boolean renameTo(File dest) {
     
//      System.out.println("rename from "+uri+" to "+dest.getPath());
     
        final XmldbURI destinationPath = ((Resource)dest).uri;

        DBBroker broker = null;
        BrokerPool db = null;
        TransactionManager tm;

        try {
            try {
                db = BrokerPool.getInstance();
                broker = db.get(null);
            } catch (final EXistException e) {
                return false;
            }
   
            tm = db.getTransactionManager();
            Txn transaction = null;
   
            org.exist.collections.Collection destination = null;
            org.exist.collections.Collection source = null;
            XmldbURI newName;
            try {
                source = broker.openCollection(uri.removeLastSegment(), Lock.WRITE_LOCK);
                if(source == null) {
                    return false;
                }
View Full Code Here

Examples of org.exist.xmldb.XmldbURI

          {throw new IOException("It collection, but should be resource: "+uri);}
      } catch (final Exception e) {
        throw new IOException(e);
      }
     
      final XmldbURI collectionURI = uri.removeLastSegment();
      collection = broker.getCollection(collectionURI);
      if (collection == null)
        {throw new IOException("Collection not found: "+collectionURI);}
     
      final XmldbURI fileName = uri.lastSegment();
 
//      try {
//        resource = broker.getXMLResource(uri, Lock.READ_LOCK);
//      } catch (final PermissionDeniedException e1) {
//      } finally {
View Full Code Here

Examples of org.exist.xmldb.XmldbURI

    DBBroker broker = null;
    try {
      db = BrokerPool.getInstance();
      broker = db.get(null);
     
      XmldbURI uri = XmldbURI.create(ms.uri);
      return broker.getCollection(uri);
    } finally {
      if (db != null)
        db.release(broker);
    }
View Full Code Here

Examples of org.exist.xmldb.XmldbURI

        }
        return tempFile;
    }

    public static void restore(DBBroker broker) throws IOException, PermissionDeniedException {
        final XmldbURI docPath = XmldbURI.createInternal(XmldbURI.ROOT_COLLECTION + "/" + REPO_ARCHIVE);
        DocumentImpl doc = null;
        try {
            doc = broker.getXMLResource(docPath, Lock.READ_LOCK);
            if (doc == null)
                {return;}
View Full Code Here

Examples of org.exist.xmldb.XmldbURI

        DBBroker broker = null;
        final TransactionManager transact = pool.getTransactionManager();
        final Txn txn = transact.beginTransaction();
        try {
            broker = pool.get(session.getUser());
            final XmldbURI collectionUri = path.removeLastSegment();
            final XmldbURI docUri = path.lastSegment();
            if (collectionUri==null || docUri==null) {
                transact.abort(txn);
                throw new EXistException("Illegal document path");
            }
            final Collection collection = broker.getCollection(collectionUri);
View Full Code Here

Examples of org.exist.xmldb.XmldbURI

        DBBroker broker = null;
        final TransactionManager transact = pool.getTransactionManager();
        final Txn txn = transact.beginTransaction();
        try {
            broker = pool.get(session.getUser());
            final XmldbURI collectionUri = path.removeLastSegment();
            final XmldbURI docUri = path.lastSegment();
            if (collectionUri==null || docUri==null) {
                transact.abort(txn);
                throw new EXistException("Illegal document path");
            }
            final Collection collection = broker.getCollection(collectionUri);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.