Examples of IndexInfo


Examples of org.exist.collections.IndexInfo

        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

Examples of org.exist.collections.IndexInfo

                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

Examples of org.exist.collections.IndexInfo

      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

Examples of org.exist.collections.IndexInfo

      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

Examples of org.exist.collections.IndexInfo

                }
            }
            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

Examples of org.exist.collections.IndexInfo

        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

Examples of org.exist.collections.IndexInfo

                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

Examples of org.exist.collections.IndexInfo

      if (!(file.exists() && file.canRead()))
        return;
     
        MimeType mime = getMimeTable().getContentTypeFor( file.getName() );
        if (mime != null && mime.isXMLType()) {
          IndexInfo info = col.validateXMLResource(null, broker,
                XmldbURI.create(file.getName()),
                new InputSource(new FileInputStream(file))
              );
            //info.getDocument().getMetadata().setMimeType();
         
View Full Code Here

Examples of org.exist.collections.IndexInfo

            if (configuration != null) {
                CollectionConfigurationManager mgr = pool.getConfigurationManager();
                mgr.addConfiguration(transaction, broker, root, configuration);
            }

            IndexInfo info = root.validateXMLResource(transaction, broker, XmldbURI.create(docName), data);
            assertNotNull(info);
            root.store(transaction, broker, info, data, false);

            docs.add(info.getDocument());
            transact.commit(transaction);
        } catch (Exception e) {
            if (transact != null)
                transact.abort(transaction);
            e.printStackTrace();
View Full Code Here

Examples of org.exist.collections.IndexInfo

            for (int j = 0; j < files.length; j++) {
                MimeType mime = mimeTab.getContentTypeFor(files[j].getName());
                if(mime != null && mime.isXMLType()) {
                    System.out.println("Storing document " + files[j].getName());
                    InputSource is = new InputSource(files[j].getAbsolutePath());
                    IndexInfo info =
                            root.validateXMLResource(transaction, broker, XmldbURI.create(files[j].getName()), is);
                    assertNotNull(info);
                    is = new InputSource(files[j].getAbsolutePath());
                    root.store(transaction, broker, info, is, false);
                    docs.add(info.getDocument());
                }
            }
            transact.commit(transaction);
        } catch (Exception e) {
            if (transact != null)
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.