Package org.exist.collections

Examples of org.exist.collections.IndexInfo


            tm = db.getTransactionManager();
            txn = tm.beginTransaction();

            FileInputSource is = new FileInputSource(file);
         
            final IndexInfo info = collection.validateXMLResource(txn, broker, uri.lastSegment(), is);
//          info.getDocument().getMetadata().setMimeType(mimeType.getName());
 
          is = new FileInputSource(file);
          collection.store(txn, broker, info, is, false);
View Full Code Here


               
                final File file = broker.getBinaryFile((BinaryDocument) doc);

                FileInputSource is = new FileInputSource(file);
               
                final IndexInfo info = destination.validateXMLResource(txn, broker, newName, is);
                info.getDocument().getMetadata().setMimeType(mimeType.getName());

                is = new FileInputSource(file);
                destination.store(txn, broker, info, is, false);
               
                source.removeBinaryResource(txn, broker, doc);
View Full Code Here

      InputStream is = null;
      try {
        if (mimeType.isXMLType()) {
          // store as xml resource
          final String str = "<empty/>";
          final IndexInfo info = collection.validateXMLResource(transaction, broker, fileName, str);
          info.getDocument().getMetadata().setMimeType(mimeType.getName());
          info.getDocument().getPermissions().setMode(DEFAULT_RESOURCE_PERM);
          collection.store(transaction, broker, info, str, false);
 
        } else {
          // store as binary resource
          is = new ByteArrayInputStream("".getBytes(UTF_8));
View Full Code Here

        final TransactionManager mgr = broker.getBrokerPool().getTransactionManager();
        final Txn txn = mgr.beginTransaction();
        try {
            final Collection collection = broker.getOrCreateCollection(txn, targetCollection);
            final XmldbURI name = XmldbURI.createInternal("repo.xml");
            final IndexInfo info = collection.validateXMLResource(txn, broker, name, updatedXML);
            final Permission permission = info.getDocument().getPermissions();
            setPermissions(false, MimeType.XML_TYPE, permission);

            collection.store(txn, broker, info, updatedXML, false);

            mgr.commit(txn);
View Full Code Here

                final Txn txn = mgr.beginTransaction();
                try {
                    if (mime.isXMLType()) {
                        final InputSource is = new InputSource(file.toURI().toASCIIString());
                        final IndexInfo info = targetCollection.validateXMLResource(txn, broker, name, is);
                        info.getDocument().getMetadata().setMimeType(mime.getName());
                        final Permission permission = info.getDocument().getPermissions();
                        setPermissions(false, mime, permission);

                        targetCollection.store(txn, broker, info, is, false);
                    } else {
                        final long size = file.length();
View Full Code Here

      DocumentImpl resource = null;
      try {
        if ("XMLResource".equals(type)) {
          // store as xml resource
         
          final IndexInfo info = currentCollection.validateXMLResource(txn, broker, docUri, is);
         
          resource = info.getDocument();
          final DocumentMetadata meta = resource.getMetadata();
          meta.setMimeType(mimetype);
          meta.setCreated(date_created.getTime());
          meta.setLastModified(date_modified.getTime());
         
View Full Code Here

      cleanup();
    }
   
  private static DocumentImpl storeDocument(Txn txn, DBBroker broker, Collection col, XmldbURI uri, String data) throws TriggerException, EXistException, PermissionDeniedException, SAXException, LockException, IOException {
        System.out.println("STORING DOCUMENT....");
        IndexInfo info = col.validateXMLResource(txn, broker, uri.lastSegment(), data);
        assertNotNull(info);
        System.out.println("STORING DOCUMENT....SECOND ROUND....");
        col.store(txn, broker, info, data, false);
        assertNotNull(info.getDocument());
        System.out.println("STORING DOCUMENT....DONE.");

        return info.getDocument();
  }
View Full Code Here

                }
            }
            final long startTime = System.currentTimeMillis();
// TODO check XML/Binary resource
//          IndexInfo info = collection.validate(txn, broker, path, new InputSource(new ByteArrayInputStream(data)));
            final IndexInfo info = collection.validateXMLResource(txn, broker, docUri, new InputSource(new ByteArrayInputStream(data)));
            info.getDocument().getMetadata().setMimeType(MimeType.XML_TYPE.getName());
            collection.store(txn, broker, info, new InputSource(new ByteArrayInputStream(data)), false);
            transact.commit(txn);
            LOG.debug(
                    "parsing "
                    + path
View Full Code Here

        try {
            MimeType mime = getMimeTable().getContentTypeFor( file.getName() );
            if (mime != null && mime.isXMLType()) {
                txn = txManager.beginTransaction();

                IndexInfo info = col.validateXMLResource(txn, broker,
                        XmldbURI.create(file.getName()),
                        new InputSource(new FileInputStream(file))
                    );
                //info.getDocument().getMetadata().setMimeType();
                FileInputStream is = new FileInputStream(file);
View Full Code Here

                LOG.debug("creating new file for collection contents");

                // IMPORTANT: temporarily disable triggers on the collection.
                // We would end up in infinite recursion if we don't do that
                parent.setTriggersEnabled(false);
                IndexInfo info = parent.validateXMLResource(transaction, broker, docPath, TEMPLATE);
                //TODO : unlock the collection here ?
                parent.store(transaction, broker, info, TEMPLATE, false);
                this.doc = info.getDocument();

                transactMgr.commit(transaction);
            }
        } catch (Exception e) {
            transactMgr.abort(transaction);
View Full Code Here

TOP

Related Classes of org.exist.collections.IndexInfo

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.