当前位置: 首页>>代码示例>>Java>>正文


Java XmldbURI类代码示例

本文整理汇总了Java中org.exist.xmldb.XmldbURI的典型用法代码示例。如果您正苦于以下问题:Java XmldbURI类的具体用法?Java XmldbURI怎么用?Java XmldbURI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


XmldbURI类属于org.exist.xmldb包,在下文中一共展示了XmldbURI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dropSingleDocument

import org.exist.xmldb.XmldbURI; //导入依赖的package包/类
@Test
public void dropSingleDocument() {
    final BrokerPool pool = existEmbeddedServer.getBrokerPool();
    final TransactionManager transact = pool.getTransactionManager();
    try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()));
         final Txn transaction = transact.beginTransaction()) {

        TDBIndexWorker worker = (TDBIndexWorker) broker.getIndexController().getWorkerByIndexId(TDBRDFIndex.ID);

        DocumentSet docs = configureAndStore(COLLECTION_CONFIG, XML, "dropDocument.xml");
        DocumentImpl doc = docs.getDocumentIterator().next();

        assertTrue(worker.isDocumentIndexed(doc));

        root.removeXMLResource(transaction, broker, XmldbURI.create("dropDocument.xml"));

        transact.commit(transaction);

        assertFalse(worker.isDocumentIndexed(doc));

    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
 
开发者ID:ljo,项目名称:exist-sparql,代码行数:26,代码来源:RDFIndexTest.java

示例2: configureAndStore

import org.exist.xmldb.XmldbURI; //导入依赖的package包/类
private DocumentSet configureAndStore(String configuration, String data, String docName) {
    MutableDocumentSet docs = new DefaultDocumentSet();
    final BrokerPool pool = existEmbeddedServer.getBrokerPool();
    final TransactionManager transact = pool.getTransactionManager();
    try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()));
         final Txn transaction = transact.beginTransaction()) {

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

        docs.add(info.getDocument());
        transact.commit(transaction);
    } catch (Exception e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
    return docs;
}
 
开发者ID:ljo,项目名称:exist-sparql,代码行数:25,代码来源:RDFIndexTest.java

示例3: cleanup

import org.exist.xmldb.XmldbURI; //导入依赖的package包/类
@After
    public void cleanup() throws EXistException {
        final BrokerPool pool = existEmbeddedServer.getBrokerPool();
        final TransactionManager transact = pool.getTransactionManager();
        try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()));
             final Txn transaction = transact.beginTransaction()) {

            Collection collConfig = broker.getOrCreateCollection(transaction,
                    XmldbURI.create(XmldbURI.CONFIG_COLLECTION + "/db"));
            assertNotNull(collConfig);
            broker.removeCollection(transaction, collConfig);

            if (root != null) {
                assertNotNull(root);
                broker.removeCollection(transaction, root);
            }
            transact.commit(transaction);

//            Configuration config = BrokerPool.getInstance().getConfiguration();
//            config.setProperty(Indexer.PROPERTY_PRESERVE_WS_MIXED_CONTENT, savedConfig);
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }
    }
 
开发者ID:ljo,项目名称:exist-sparql,代码行数:26,代码来源:RDFIndexTest.java

示例4: configure

import org.exist.xmldb.XmldbURI; //导入依赖的package包/类
@Override
public void configure(final DBBroker broker, final Collection collection, final Map<String, List<? extends Object>> parameters) throws TriggerException {

    //extract the black list parameter value from the parameters
    final List<String> lst = (List<String>)parameters.get(BLACKLIST_PARAM);
    if(lst == null) {
        throw new TriggerException("The parameter '" + blacklist + "' has not been provided in the collection configuration of '" + collection.getURI() + "' for '" + getClass().getName() + "'.");
    }

    for(final String blacklisted : lst) {
        try {
            this.blacklist.add(XmldbURI.create(blacklisted));
        } catch(final IllegalArgumentException iae) {
            LOG.warn("Skipping... collection uri '" + blacklisted + "' provided in the black list is invalid: " + iae.getMessage());
        }
    }

    //extract the optional protectMode parameter value from the parameters
    final List<String> protect = (List<String>)parameters.get(PROTECT_MOVE_PARAM);
    if(protect != null && protect.size() == 1) {
        this.protectMove = Boolean.parseBoolean(protect.get(0));
    }
}
 
开发者ID:eXist-book,项目名称:book-code,代码行数:24,代码来源:NoDeleteCollectionTrigger.java

示例5: beforeMoveCollection

import org.exist.xmldb.XmldbURI; //导入依赖的package包/类
@Override
public void beforeMoveCollection(final DBBroker broker, final Txn txn, final Collection collection, final XmldbURI newUri) throws TriggerException {
    /**
     * If we are protecting moves (as a form
     * of delete) and the collection is on
     * the blacklist, we throw a TriggerException
     * to abort the operation which is attempting
     * to move the collection.
     *
     * After all a Move would remove the
     * original location of the collection!
     */
    if(protectMove && blacklist.contains(collection.getURI())) {
        LOG.info("Preventing move of blacklisted collection '" + collection.getURI() + "'.");
        throw new TriggerException("The collection '" + collection.getURI().lastSegment() + "' is black-listed by the NoDeleteCollectionTrigger and may not be moved, consider a copy instead!");
    }
}
 
开发者ID:eXist-book,项目名称:book-code,代码行数:18,代码来源:NoDeleteCollectionTrigger.java

示例6: getPipelineArgument

import org.exist.xmldb.XmldbURI; //导入依赖的package包/类
private Either<XmldbURI, InputStream> getPipelineArgument(final Sequence[] args) throws IOException, XPathException, SAXException {
    final Sequence pipe = args[0];
    if (Type.subTypeOf(pipe.getItemType(), Type.DOCUMENT) || Type.subTypeOf(pipe.getItemType(), Type.ELEMENT)) {
        try (final StringWriter writer = new StringWriter()) {
            final XQuerySerializer xqSerializer = new XQuerySerializer(context.getBroker(), new Properties(), writer);
            xqSerializer.serialize(pipe);
            return Either.Right(new ByteArrayInputStream(writer.toString().getBytes(UTF_8)));
        }
    } else if(Type.subTypeOf(pipe.getItemType(), Type.ANY_URI)) {
        return Either.Left(((AnyURIValue)pipe.itemAt(0).convertTo(Type.ANY_URI)).toXmldbURI());
    } else if(Type.subTypeOf(pipe.getItemType(), Type.STRING)) {
        return Either.Left(XmldbURI.create(pipe.itemAt(0).getStringValue()));
    } else {
        throw new XPathException(this, "$pipeline must be either document(), element() or xs:anyURI (or xs:anyURI as xs:string)");
    }
}
 
开发者ID:eXist-db,项目名称:xquery-xproc-xmlcalabash-module,代码行数:17,代码来源:ProcessFunction.java

示例7: configureAndStore

import org.exist.xmldb.XmldbURI; //导入依赖的package包/类
private DocumentSet configureAndStore(final String configuration, final String data, final String docName) throws EXistException, CollectionConfigurationException, LockException, SAXException, PermissionDeniedException, IOException {
    final MutableDocumentSet docs = new DefaultDocumentSet();
    final TransactionManager transact = pool.getTransactionManager();
    try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()));
         final Txn transaction = transact.beginTransaction()) {

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

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

        docs.add(info.getDocument());
        transact.commit(transaction);
    }
    return docs;
}
 
开发者ID:eXist-db,项目名称:xquery-xproc-xmlcalabash-module,代码行数:21,代码来源:Simplest.java

示例8: setup

import org.exist.xmldb.XmldbURI; //导入依赖的package包/类
@Before
public void setup() throws EXistException, PermissionDeniedException, IOException, TriggerException {
    final TransactionManager transact = pool.getTransactionManager();
    try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()));
         final Txn transaction = transact.beginTransaction()) {

        root = broker.getOrCreateCollection(transaction, XmldbURI.ROOT_COLLECTION_URI.append("test"));
        assertNotNull(root);

        //root.setPermissions(0770);

        broker.saveCollection(transaction, root);

        transact.commit(transaction);

    }
}
 
开发者ID:eXist-db,项目名称:xquery-xproc-xmlcalabash-module,代码行数:18,代码来源:Simplest.java

示例9: cleanup

import org.exist.xmldb.XmldbURI; //导入依赖的package包/类
@After
    public void cleanup() throws EXistException, PermissionDeniedException, IOException, TriggerException {
        final BrokerPool pool = BrokerPool.getInstance();
        final TransactionManager transact = pool.getTransactionManager();
        try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()));
             final Txn transaction = transact.beginTransaction()) {

            final Collection collConfig = broker.getOrCreateCollection(transaction, XmldbURI.CONFIG_COLLECTION_URI.append("db"));
            assertNotNull(collConfig);
            broker.removeCollection(transaction, collConfig);

//            if (root != null) {
//                assertNotNull(root);
//                broker.removeCollection(transaction, root);
//            }
            transact.commit(transaction);

        }
    }
 
开发者ID:eXist-db,项目名称:xquery-xproc-xmlcalabash-module,代码行数:20,代码来源:Simplest.java

示例10: run

import org.exist.xmldb.XmldbURI; //导入依赖的package包/类
public Sequence run(final BinaryDocument xq) throws Exception {
    try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()))) {
        assertNotNull(broker);

        final XQuery xquery = pool.getXQueryService();
        assertNotNull(xquery);

        final DBSource source = new DBSource(broker, xq, true);
        final XQueryContext context = new XQueryContext(pool);
        context.setModuleLoadPath(XmldbURI.EMBEDDED_SERVER_URI.append(xq.getCollection().getURI()).toString());
        context.setStaticallyKnownDocuments(new XmldbURI[]{
                xq.getCollection().getURI()
        });

        final CompiledXQuery compiled = xquery.compile(broker, context, source);
        return xquery.execute(broker, compiled, null);

    }
}
 
开发者ID:eXist-db,项目名称:xquery-xproc-xmlcalabash-module,代码行数:20,代码来源:ExternalTests.java

示例11: configureAndStore

import org.exist.xmldb.XmldbURI; //导入依赖的package包/类
private DocumentSet configureAndStore(final String configuration, final String data, final String docName) throws EXistException, CollectionConfigurationException, LockException, SAXException, PermissionDeniedException, IOException {
    final TransactionManager transact = pool.getTransactionManager();
    final MutableDocumentSet docs = new DefaultDocumentSet();
    try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()));
         final Txn transaction = transact.beginTransaction()) {

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

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

        docs.add(info.getDocument());
        transact.commit(transaction);
    }
    return docs;
}
 
开发者ID:eXist-db,项目名称:xquery-xproc-xmlcalabash-module,代码行数:21,代码来源:ExternalTests.java

示例12: start

import org.exist.xmldb.XmldbURI; //导入依赖的package包/类
public void start() throws Exception {
    synchronized (started) {
        if (database == null) {
            database = new DatabaseImpl();
            database.setProperty("create-database", "true");

            if (configuration != null && configuration.length() > 0) {
                database.setProperty("configuration", configuration);
            }

            current = database.getCollection(XmldbURI.EMBEDDED_SERVER_URI, null, null);
            DatabaseManager.registerDatabase(database);
            started  = true;
        }
    }
}
 
开发者ID:vgoldin,项目名称:camel-existdb,代码行数:17,代码来源:DatabaseFactory.java

示例13: getCollectionPath

import org.exist.xmldb.XmldbURI; //导入依赖的package包/类
private String getCollectionPath(final String aCollectionPath) {
    final StringBuilder builder = new StringBuilder();

    if (!aCollectionPath.startsWith(XmldbURI.ROOT_COLLECTION)) {
        builder.append(XmldbURI.ROOT_COLLECTION);

        if (!aCollectionPath.startsWith("/")) {
            builder.append('/');
        }
    }

    return builder.append(aCollectionPath).toString();
}
 
开发者ID:ksclarke,项目名称:freelib-marc4j-exist,代码行数:14,代码来源:ReadFromFile.java

示例14: getCollectionManagementService

import org.exist.xmldb.XmldbURI; //导入依赖的package包/类
/**
 * Gets the correct CollectionManagementService for internal use
 * @return
 * @throws Exception
 */
private CollectionManagementService getCollectionManagementService() throws Exception 
{
	
	Collection root = DatabaseManager.getCollection(_uri+XmldbURI.ROOT_COLLECTION+"/RootCollection", _user, _pass);
       return (CollectionManagementService)root.getService("CollectionManagementService", "1.0");
}
 
开发者ID:rwth-acis,项目名称:LAS2peer-iStarMLModel-Service,代码行数:12,代码来源:Storage.java

示例15: storeDocument

import org.exist.xmldb.XmldbURI; //导入依赖的package包/类
/**
 * Stores a document into the weather collection
 *
 * @param broker The broker for accessing the database
 * @param targetCollection The collection to store the document into
 * @param document The document to store
 * @param lockCollection Should the collection be locked whilst storing the document?
 */
public static void storeDocument(final DBBroker broker, final String targetCollection, final Node document, final boolean lockCollection) throws StoreException {

    Collection collection = null;
    final TransactionManager transact = broker.getBrokerPool().getTransactionManager();
    final Txn txn = transact.beginTransaction();
    final IndexInfo indexInfo;
    try {

        //prepare to store
        try {

            //open the weather collection
            collection = broker.openCollection(XmldbURI.create(targetCollection), lockCollection ? Lock.WRITE_LOCK : Lock.NO_LOCK);
            if(collection == null) {
                transact.abort(txn);
                throw new JobException(JobException.JobExceptionAction.JOB_ABORT_THIS, "Collection: " + targetCollection + " not found!");
            }

            //generate a unique name for the document
            final String documentName = UUID.randomUUID().toString() + ".xml";

            //validate the document
            indexInfo = collection.validateXMLResource(txn, broker, XmldbURI.create(documentName), document);
        } finally {
            //release the lock on the weather collection
            if(collection != null && lockCollection) {
                collection.release(Lock.WRITE_LOCK);
            }
        }

        //store
        collection.store(txn, broker, indexInfo, document, false);
        transact.commit(txn);

    } catch(final Exception e) {
        transact.abort(txn);
        throw new StoreException(e);
    }
}
 
开发者ID:eXist-book,项目名称:book-code,代码行数:48,代码来源:CommonUtils.java


注:本文中的org.exist.xmldb.XmldbURI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。