Package org.exist.xmldb

Examples of org.exist.xmldb.XmldbURI


                {
                    entry = newEntry(name);
                }
                else if (useHierarchy) {
      String docCollection = doc.getCollection().getURI().toString();
      XmldbURI collection = XmldbURI.create(removeLeadingOffset(docCollection, stripOffset));
      entry = newEntry(collection.append(doc.getFileURI()).toString());
    } else {
      entry = newEntry(doc.getFileURI().toString());
    }

    if (doc.getResourceType() == DocumentImpl.XML_FILE) {
View Full Code Here


      }
    }
    // iterate over child collections
    for (Iterator<XmldbURI> itChildCols = col.collectionIterator(context.getBroker()); itChildCols.hasNext();) {
      // get the child collection
      XmldbURI childColURI = (XmldbURI) itChildCols.next();
      Collection childCol = context.getBroker().getCollection(col.getURI().append(childColURI));
      // recurse
      compressCollection(os, childCol, useHierarchy, stripOffset);
    }
  }
View Full Code Here

   
    String password = null;
    String digestPassword = null;
   
    int id = -1;
    XmldbURI home = null;
   
    final String name = node.getAttribute(NAME);
    if (name == null ) //|| name.length() == 0
      {throw new ConfigurationException("account needs a name");}
   
View Full Code Here

   
    private Map<XmldbURI, Integer> saving = new HashMap<XmldbURI, Integer>();
   
    @Override
    public void processPramatterBeforeSave(DBBroker broker, DocumentImpl document) throws ConfigurationException {
        XmldbURI uri = document.getCollection().getURI();
       
        final boolean isRemoved = uri.endsWith(SecurityManager.REMOVED_COLLECTION_URI);
        if(isRemoved) {
            uri = uri.removeLastSegment();
        }
   
        final boolean isAccount = uri.endsWith(SecurityManager.ACCOUNTS_COLLECTION_URI);
        final boolean isGroup = uri.endsWith(SecurityManager.GROUPS_COLLECTION_URI);
   
        if(isAccount || isGroup) {
            //uri = uri.removeLastSegment();
            //String realmId = uri.lastSegment().toString();
            //AbstractRealm realm = (AbstractRealm)findRealmForRealmId(realmId);
View Full Code Here

    }

    @Override
    public void processPramatter(DBBroker broker, DocumentImpl document) throws ConfigurationException {

        XmldbURI uri = document.getCollection().getURI();
       
        //System.out.println(document);

        final boolean isRemoved = uri.endsWith(SecurityManager.REMOVED_COLLECTION_URI);
        if(isRemoved) {
            uri = uri.removeLastSegment();
        }
   
        final boolean isAccount = uri.endsWith(SecurityManager.ACCOUNTS_COLLECTION_URI);
        final boolean isGroup = uri.endsWith(SecurityManager.GROUPS_COLLECTION_URI);
   
        if(isAccount || isGroup) {
            uri = uri.removeLastSegment();

            final String realmId = uri.lastSegment().toString();
     
            final AbstractRealm realm = (AbstractRealm)findRealmForRealmId(realmId);
            final Configuration conf = Configurator.parse(document);

            Integer id = -1;
View Full Code Here

        else if(location.startsWith(XmldbURI.XMLDB_URI_PREFIX))
        {
          DocumentImpl resource = null;
          try
          {
        final XmldbURI pathUri = XmldbURI.create(location);
        resource = broker.getXMLResource(pathUri, Lock.READ_LOCK);
        if (resource != null)
          {source = new DBSource(broker, (BinaryDocument)resource, true);}
          }
      finally
View Full Code Here

            }
        }
       
        try {
            listener.createCollection(name);
            final XmldbURI collUri;

            if(version >= STRICT_URI_VERSION) {
                collUri = XmldbURI.create(name);
            } else {
                try {
View Full Code Here

        final String publicid = atts.getValue("publicid");
        final String systemid = atts.getValue("systemid");
        final String namedoctype = atts.getValue("namedoctype");


        final XmldbURI docUri;

        if(version >= STRICT_URI_VERSION) {
            docUri = XmldbURI.create(name);
        } else {
            try {
                docUri = URIUtils.encodeXmldbUriFor(name);
            } catch(final URISyntaxException e) {
                final String msg = "Could not parse document name into a URI: " + e.getMessage();
                listener.error(msg);
                LOG.error(msg, e);
                return new SkippedEntryDeferredPermission();
            }
        }

        final EXistInputSource is = descriptor.getInputSource(filename);
        if(is == null) {
            final String msg = "Failed to restore resource '" + name + "'\nfrom file '" + descriptor.getSymbolicPath( name, false ) + "'.\nReason: Unable to obtain its EXistInputSource";
            listener.warn(msg);
            return new SkippedEntryDeferredPermission();
        }

        try {
           
            listener.setCurrentResource(name);
            if(currentCollection instanceof Observable) {
                listener.observe((Observable)currentCollection);
            }

            Resource res = currentCollection.createResource(docUri.toString(), type);

            if(mimetype != null) {
                ((EXistResource)res).setMimeType(mimetype);
            }
View Full Code Here

    }
   
    private CollectionImpl mkcol(final XmldbURI collPath, final Date created) throws XMLDBException, URISyntaxException {
        final XmldbURI[] allSegments = collPath.getPathSegments();
        final XmldbURI[] segments = Arrays.copyOfRange(allSegments, 1, allSegments.length); //drop the first 'db' segment
        final XmldbURI dbUri;

        if(!dbBaseUri.endsWith(XmldbURI.ROOT_COLLECTION)) {
            dbUri = XmldbURI.xmldbUriFor(dbBaseUri + XmldbURI.ROOT_COLLECTION);
        } else {
            dbUri = XmldbURI.xmldbUriFor(dbBaseUri);
        }
       
        CollectionImpl current = (CollectionImpl)DatabaseManager.getCollection(dbUri.toString(), dbUsername, dbPassword);
        XmldbURI p = XmldbURI.ROOT_COLLECTION_URI;
       
        for(final XmldbURI segment : segments) {
            p = p.append(segment);
            final XmldbURI xmldbURI = dbUri.resolveCollectionPath(p);
            CollectionImpl c = (CollectionImpl)DatabaseManager.getCollection(xmldbURI.toString(), dbUsername, dbPassword);
            if(c == null) {
              current.setTriggersEnabled(false);
                final CollectionManagementServiceImpl mgtService = (CollectionManagementServiceImpl)current.getService("CollectionManagementService", "1.0");
                c = (CollectionImpl)mgtService.createCollection(segment, created);
                current.setTriggersEnabled(true);
View Full Code Here

            "setIdAttributeNode(Attr idAttr, boolean isId) not implemented on class " + getClass().getName())
    }

    @Override
    public String getBaseURI() {
        final XmldbURI baseURI = calculateBaseURI();
        if (baseURI != null)
            {return baseURI.toString();}
       
        return ""; //UNDERSTAND: is it ok?
    }
View Full Code Here

TOP

Related Classes of org.exist.xmldb.XmldbURI

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.