Collection col1 = null;
Collection parentCol = null;
try {
broker = pool.get(pool.getSecurityManager().getSystemSubject());
col1 = broker.openCollection(col1uri, Lock.WRITE_LOCK);
parentCol = broker.openCollection(col2uri.removeLastSegment(), Lock.WRITE_LOCK);
final DocumentImpl doc2 = col1.getDocument(broker, doc2uri.lastSegment());
//add metas for XML document
doc1Metadata.put(KEY1, doc2);