From: Loren C. <lor...@gm...> - 2011-04-08 03:41:13
|
Hello folks, I am having a problem with DBBroker.getOrCreateCollection(Txn transaction, XmldbURI name). I pass in the following URI for the new collection xmldb:exist:///db/cms/apps/foo/data/70/PUBLIC/Sections and get the following collection being created /db/db/cms/apps/foo/data/70/PUBLIC/Sections. The collection that is created has an extra /db in the start of the path. I will be looking into it tomorrow. If anyone else has the time to take a look at it in the mean time, I would appreciate it. You will find the method that I am using and the resulting log file below. Here is the version information: project.version=1.5.0dev project.build=20110315 svn.revision=13997 Loren public static boolean storeMemtreeDocument(BrokerPool brokerPool, org.exist.memtree.DocumentImpl document, String collectionPath, String docName) { if (LOG.isDebugEnabled()) { LOG.debug("==========================================================================="); LOG.debug("==========================================================================="); LOG.debug("==========================================================================="); LOG.debug("==========================================================================="); LOG.debug("==========================================================================="); LOG.debug("Attempting to create document: " + collectionPath + "/" + docName); } boolean status = true; TransactionManager transact = null; Txn txn = null; Collection collection = null; XmldbURI collectionURI = null; XmldbURI docURI = null; IndexInfo info = null; DBBroker broker = null; Realm securityRealm = brokerPool.getSecurityManager().getRealm(RealmImpl.ID); Subject systemSubject = brokerPool.getSecurityManager().getSystemSubject(); Account owner = securityRealm.getAccount(systemSubject, ""); try { broker = brokerPool.get(systemSubject); collectionURI = XmldbURI.xmldbUriFor(collectionPath); LOG.debug("collectionURI: " + collectionURI); docURI = XmldbURI.xmldbUriFor(docName); LOG.debug("docURI: " + docURI); try { transact = brokerPool.getTransactionManager(); if (transact != null) { txn = transact.beginTransaction(); if (txn != null) { collection = broker.getOrCreateCollection(txn, collectionURI); LOG.debug("collection: " + collection); if (collection == null) { LOG.error("Failure to find collection: " + collectionPath); return false; } broker.saveCollection(txn, collection); collection.getLock().acquire(Lock.WRITE_LOCK); info = collection.validateXMLResource(txn, broker, docURI, document); collection.store(txn, broker, info, document, false); transact.commit(txn); LOG.info("INFO: " + info.toString()); } } } catch (Exception e) { LOG.error(MessageFormat.format("Failure to store document ({0}) [{1}/{2}]", e.getClass().getName(), collectionPath, docName), e); if (transact != null && txn != null) transact.abort(txn); } finally { if (collection != null) collection.getLock().release(Lock.WRITE_LOCK); } LOG.debug(docName + " stored"); } catch (URISyntaxException e) { status = false; LOG.error(MessageFormat.format("Failure to store document ({0}) [{1}/{2}]", e.getClass().getName(), collectionPath, docName), e); if (transact != null && txn != null) transact.abort(txn); } catch (TransactionException e) { status = false; LOG.error(MessageFormat.format("Failure to store document ({0}) [{1}/{2}]", e.getClass().getName(), collectionPath, docName), e); if (transact != null && txn != null) transact.abort(txn); } catch (EXistException e) { status = false; LOG.error(MessageFormat.format("Failure to store document ({0}) [{1}/{2}]", e.getClass().getName(), collectionPath, docName), e); if (transact != null && txn != null) transact.abort(txn); } finally { brokerPool.release(broker); if (LOG.isDebugEnabled()) { LOG.debug("==========================================================================="); LOG.debug("==========================================================================="); LOG.debug("==========================================================================="); LOG.debug("==========================================================================="); LOG.debug("==========================================================================="); } } return status; } 2011-04-07 14:07:29,984 [exist_QuartzScheduler_Worker-2] DEBUG (FooJobUtility.java [storeMemtreeDocument]:166) - =========================================================================== 2011-04-07 14:07:29,984 [exist_QuartzScheduler_Worker-2] DEBUG (FooJobUtility.java [storeMemtreeDocument]:167) - =========================================================================== 2011-04-07 14:07:29,984 [exist_QuartzScheduler_Worker-2] DEBUG (FooJobUtility.java [storeMemtreeDocument]:168) - =========================================================================== 2011-04-07 14:07:29,984 [exist_QuartzScheduler_Worker-2] DEBUG (FooJobUtility.java [storeMemtreeDocument]:169) - =========================================================================== 2011-04-07 14:07:29,984 [exist_QuartzScheduler_Worker-2] DEBUG (FooJobUtility.java [storeMemtreeDocument]:170) - Attempting to create document: xmldb:exist:///db/cms/apps/foo/data/70/PUBLIC/Sections/count.xml 2011-04-07 14:07:29,985 [exist_QuartzScheduler_Worker-2] DEBUG (FooJobUtility.java [storeMemtreeDocument]:188) - collectionURI: xmldb:exist:///db/cms/apps/foo/data/70/PUBLIC/Sections 2011-04-07 14:07:29,985 [exist_QuartzScheduler_Worker-2] DEBUG (FooJobUtility.java [storeMemtreeDocument]:190) - docURI: count.xml 2011-04-07 14:07:29,985 [exist_QuartzScheduler_Worker-2] DEBUG (FooJobUtility.java [storeMemtreeDocument]:198) - collection: /db/db/cms/apps/foo/data/70/PUBLIC/Sections[count.xml] 2011-04-07 14:07:29,985 [exist_QuartzScheduler_Worker-2] DEBUG (Collection.java [checkPermissions]:1331) - Found old doc 3171 2011-04-07 14:07:29,985 [exist_QuartzScheduler_Worker-2] DEBUG (Collection.java [validateXMLResourceInternal]:1196) - Scanning document /db/db/cms/apps/foo/data/70/PUBLIC/Sections/count.xml 2011-04-07 14:07:29,986 [exist_QuartzScheduler_Worker-2] DEBUG (Collection.java [validateXMLResourceInternal]:1201) - removing old document count.xml 2011-04-07 14:07:29,986 [exist_QuartzScheduler_Worker-2] INFO (NativeBroker.java [removeXMLResource]:2162) - Removing document count.xml (3171) ... 2011-04-07 14:07:29,989 [exist_QuartzScheduler_Worker-2] DEBUG (NativeTextEngine.java [dropIndex]:1072) - Removing 0 tokens 2011-04-07 14:07:29,989 [exist_QuartzScheduler_Worker-2] DEBUG (NativeTextEngine.java [dropIndex]:1072) - Removing 0 tokens 2011-04-07 14:07:29,989 [exist_QuartzScheduler_Worker-2] DEBUG (NativeTextEngine.java [dropIndex]:1072) - Removing 0 tokens 2011-04-07 14:07:29,992 [exist_QuartzScheduler_Worker-2] DEBUG (NativeBroker.java [removeXMLResource]:2167) - removeDocument() - removing dom 2011-04-07 14:07:29,993 [exist_QuartzScheduler_Worker-2] DEBUG (NativeBroker.java [removeResourceMetadata]:2262) - Removing resource metadata for 3171 2011-04-07 14:07:29,993 [exist_QuartzScheduler_Worker-2] DEBUG (Collection.java [validateXMLResourceInternal]:1227) - removed old document count.xml 2011-04-07 14:07:29,993 [exist_QuartzScheduler_Worker-2] DEBUG (Collection.java [storeXMLInternal]:1006) - storing document 3171 ... 2011-04-07 14:07:29,999 [exist_QuartzScheduler_Worker-2] DEBUG (Collection.java [storeXMLInternal]:1019) - document stored. 2011-04-07 14:07:29,999 [exist_QuartzScheduler_Worker-2] INFO (FooJobUtility.java [storeMemtreeDocument]:208) - INFO: IndexInfo: Indexer: org.exist.Indexer@224577f9 DOMStreamer: org.exist.util.serializer.DOMStreamer@7ec78e02 DocumentTrigger: null IsCreating: falseCollectionConfiguration: Full-text index includeByDefault : false includeAttributes : false includeAlphaNum : true exclude : /auth 2011-04-07 14:07:29,999 [exist_QuartzScheduler_Worker-2] DEBUG (FooJobUtility.java [storeMemtreeDocument]:219) - count.xml stored 2011-04-07 14:07:29,999 [exist_QuartzScheduler_Worker-2] DEBUG (FooJobUtility.java [storeMemtreeDocument]:238) - =========================================================================== 2011-04-07 14:07:29,999 [exist_QuartzScheduler_Worker-2] DEBUG (FooJobUtility.java [storeMemtreeDocument]:239) - =========================================================================== 2011-04-07 14:07:30,000 [exist_QuartzScheduler_Worker-2] DEBUG (FooJobUtility.java [storeMemtreeDocument]:240) - =========================================================================== 2011-04-07 14:07:30,000 [exist_QuartzScheduler_Worker-2] DEBUG (FooJobUtility.java [storeMemtreeDocument]:241) - =========================================================================== 2011-04-07 14:07:30,000 [exist_QuartzScheduler_Worker-2] DEBUG (FooJobUtility.java [storeMemtreeDocument]:242) - =========================================================================== |