exo-jcr SVN: r4004 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: core/query/ispn and 1 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-02-22 09:04:54 -0500 (Tue, 22 Feb 2011)
New Revision: 4004
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexNamesKey.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheKey.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesId.java
Log:
EXOJCR-832: implementation ISPNIndexInfos.java
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/ISPNIndexInfos.java 2011-02-22 14:04:54 UTC (rev 4004)
@@ -0,0 +1,206 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.core.query.ispn;
+
+import org.exoplatform.services.jcr.impl.core.query.IndexerIoMode;
+import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeHandler;
+import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeListener;
+import org.exoplatform.services.jcr.impl.core.query.lucene.IndexInfos;
+import org.exoplatform.services.jcr.impl.core.query.lucene.MultiIndex;
+import org.exoplatform.services.jcr.infinispan.PrivilegedISPNCacheHelper;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
+import org.infinispan.Cache;
+import org.infinispan.notifications.Listener;
+import org.infinispan.notifications.cachelistener.annotation.CacheEntryModified;
+import org.infinispan.notifications.cachelistener.event.CacheEntryModifiedEvent;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Set;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * Date: 22.02.2011
+ *
+ * List of indexes is stored in FS and all operations with it are wrapped by IndexInfos class. In
+ * standalone mode index and so the list of indexes are managed by indexer and can't be changed
+ * externally.
+ * But in cluster environment all JCR Indexers are reading from shared file system and only one
+ * cluster node is writing this index. So read-only cluster nodes should be notified when content
+ * of index (actually list of index segments) is changed.
+ * This class is responsible for storing list of segments (indexes) in ISPN cache.
+ *
+ * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
+ * @version $Id: ISPNIndexInfos.java 34360 2010-11-11 11:11:11Z tolusha $
+ */
+@Listener
+public class ISPNIndexInfos extends IndexInfos implements IndexerIoModeListener
+{
+
+ /**
+ * Logger.
+ */
+ private final Log log = ExoLogger.getLogger("exo.jcr.component.core.ISPNIndexInfos");
+
+ private static final String INDEX_NAMES = "$names".intern();
+
+ private static final String SYSINDEX_NAMES = "$sysNames".intern();
+
+ /**
+ * ISPN cache.
+ */
+ private final Cache<Serializable, Object> cache;
+
+ /**
+ * Used to retrieve the current mode.
+ */
+ private final IndexerIoModeHandler modeHandler;
+
+ /**
+ * Cache key for storing index names.
+ */
+ private final IndexNamesKey namesKey;
+
+ /**
+ * ISPNIndexInfos constructor.
+ *
+ * @param wsId
+ * unique workspace identifier
+ * @param cache
+ * ISPN cache
+ * @param system
+ * notifies if this IndexInfos is from system search manager or not
+ * @param modeHandler
+ * used to retrieve the current mode
+ */
+ public ISPNIndexInfos(String wsId, Cache<Serializable, Object> cache, boolean system,
+ IndexerIoModeHandler modeHandler)
+ {
+ this(wsId, DEFALUT_NAME, cache, system, modeHandler);
+ }
+
+ /**
+ * ISPNIndexInfos constructor.
+ *
+ * @param wsId
+ * unique workspace identifier
+ * @param fileName
+ * name of the file where the infos are stored.
+ * @param cache
+ * ISPN cache
+ * @param system
+ * notifies if this IndexInfos is from system search manager or not
+ * @param modeHandler
+ * used to retrieve the current mode
+ */
+ public ISPNIndexInfos(String wsId, String fileName, Cache<Serializable, Object> cache, boolean system,
+ IndexerIoModeHandler modeHandler)
+ {
+ super(fileName);
+ this.cache = cache;
+ this.modeHandler = modeHandler;
+ this.modeHandler.addIndexerIoModeListener(this);
+ this.namesKey = new IndexNamesKey(wsId + (system ? SYSINDEX_NAMES : INDEX_NAMES));
+
+ if (modeHandler.getMode() == IndexerIoMode.READ_ONLY)
+ {
+ // Currently READ_ONLY is set, so new lists should be fired to multiIndex.
+ cache.addListener(this);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void onChangeMode(IndexerIoMode mode)
+ {
+ if (mode == IndexerIoMode.READ_WRITE)
+ {
+ // Now is read-write. Index list is actual and shouldn't be refreshed.
+ // Remove listener to avoid asserting if ioMode is RO on each cache event
+ cache.removeListener(this);
+ // re-read from FS current actual list.
+ try
+ {
+ super.read();
+ }
+ catch (IOException e)
+ {
+ log.error("Cannot read the list of index names", e);
+ }
+ }
+ else
+ {
+ // Currently READ_ONLY is set, so new lists should be fired to multiIndex.
+ cache.addListener(this);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void write() throws IOException
+ {
+ // if READ_WRITE and is dirty, then flush.
+ if (isDirty() && modeHandler.getMode() == IndexerIoMode.READ_WRITE)
+ {
+ // write to FS
+ super.write();
+
+ // write to cache
+ PrivilegedISPNCacheHelper.put(cache, namesKey, getNames());
+ }
+ }
+
+ /**
+ * Cache listener method will be invoked when a cache entry has been modified only in READ_ONLY mode.
+ *
+ * @param event
+ * CacheEntryModifiedEvent
+ */
+ @CacheEntryModified
+ public void cacheEntryModified(CacheEntryModifiedEvent event)
+ {
+ if (!event.isPre() && event.getKey().equals(namesKey))
+ {
+ Set<String> set = (Set<String>)event.getValue();
+ if (set != null)
+ {
+ setNames(set);
+
+ // callback multiIndex to refresh lists
+ try
+ {
+ MultiIndex multiIndex = getMultiIndex();
+ if (multiIndex != null)
+ {
+ multiIndex.refreshIndexList();
+ }
+ }
+ catch (IOException e)
+ {
+ log.error("Failed to update indexes! " + e.getMessage(), e);
+ }
+ }
+ }
+ }
+}
Added: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexNamesKey.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexNamesKey.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/ispn/IndexNamesKey.java 2011-02-22 14:04:54 UTC (rev 4004)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.impl.core.query.ispn;
+
+import org.exoplatform.services.jcr.impl.dataflow.persistent.infinispan.CacheKey;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * Date: 22.02.011
+ *
+ * @author <a href="mailto:anatoliy.bazko@exoplatform.com.ua">Anatoliy Bazko</a>
+ * @version $Id: IndexNamesKey.java 34360 2010-11-11 11:11:11Z tolusha $
+ */
+public class IndexNamesKey extends CacheKey
+{
+
+ IndexNamesKey(String id)
+ {
+ super(id);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof IndexNamesKey)
+ {
+ IndexNamesKey key = (IndexNamesKey)obj;
+ return (key.hash == hash && key.id.equals(id));
+ }
+ else
+ {
+ return false;
+ }
+ }
+}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheKey.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheKey.java 2011-02-22 12:52:11 UTC (rev 4003)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheKey.java 2011-02-22 14:04:54 UTC (rev 4004)
@@ -37,13 +37,13 @@
protected final int hash;
- CacheKey(String id)
+ public CacheKey(String id)
{
this.id = id;
this.hash = id.hashCode();
}
- CacheKey(String id, int hash)
+ public CacheKey(String id, int hash)
{
this.id = id;
this.hash = hash;
@@ -74,4 +74,10 @@
{
return id.compareTo(o.id);
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public abstract boolean equals(Object obj);
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesId.java 2011-02-22 12:52:11 UTC (rev 4003)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesId.java 2011-02-22 14:04:54 UTC (rev 4004)
@@ -49,7 +49,4 @@
return false;
}
}
-
- // check is this descendant of prevRootPath
-
}
13 years, 2 months
exo-jcr SVN: r4003 - in jcr/trunk/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/api/importing and 1 other directory.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2011-02-22 07:52:11 -0500 (Tue, 22 Feb 2011)
New Revision: 4003
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImportVersionedChild.java
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/SystemViewImporter.java
Log:
EXOJCR-1208: Import version history - nt:versionedChild allowed in any place below jcr:frozenNode.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/SystemViewImporter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/SystemViewImporter.java 2011-02-22 11:08:50 UTC (rev 4002)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/SystemViewImporter.java 2011-02-22 12:52:11 UTC (rev 4003)
@@ -419,9 +419,16 @@
{
NodeData parentNodeData = getParent();
// nodeTypeDataManager.findChildNodeDefinition(primaryTypeName,)
- if (!nodeTypeDataManager.isChildNodePrimaryTypeAllowed(primaryTypeName, parentNodeData.getPrimaryTypeName(),
- parentNodeData.getMixinTypeNames()))
+
+ // check is nt:versionedChild subnode of frozenNode
+ if (nodeData.getQPath().getDepth() > 6 && primaryTypeName.equals(Constants.NT_VERSIONEDCHILD)
+ && nodeData.getQPath().getEntries()[5].equals(Constants.JCR_FROZENNODE))
{
+ //do nothing
+ }
+ else if (!nodeTypeDataManager.isChildNodePrimaryTypeAllowed(primaryTypeName, parentNodeData
+ .getPrimaryTypeName(), parentNodeData.getMixinTypeNames()))
+ {
throw new ConstraintViolationException("Can't add node " + nodeData.getQName().getAsString() + " to "
+ parentNodeData.getQPath().getAsString() + " node type " + sName
+ " is not allowed as child's node type for parent node type "
Added: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImportVersionedChild.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImportVersionedChild.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImportVersionedChild.java 2011-02-22 12:52:11 UTC (rev 4003)
@@ -0,0 +1,278 @@
+/*
+ * Copyright (C) 2003-2011 eXo Platform SAS.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Affero General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see<http://www.gnu.org/licenses/>.
+ */
+package org.exoplatform.services.jcr.api.importing;
+
+import org.exoplatform.commons.utils.MimeTypeResolver;
+import org.exoplatform.services.jcr.JcrAPIBaseTest;
+import org.exoplatform.services.jcr.dataflow.ItemState;
+import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
+import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.exoplatform.services.jcr.impl.core.PropertyImpl;
+import org.exoplatform.services.jcr.impl.core.SessionDataManager;
+import org.exoplatform.services.jcr.util.VersionHistoryImporter;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.Calendar;
+
+import javax.jcr.ImportUUIDBehavior;
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date:
+ *
+ * @author <a href="karpenko.sergiy(a)gmail.com">Karpenko Sergiy</a>
+ * @version $Id: TestImportImage.java 111 2008-11-11 11:11:11Z serg $
+ */
+public class TestImportVersionedChild extends JcrAPIBaseTest
+{
+
+ Node testRoot;
+
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ testRoot = this.root.addNode("parent", "nt:folder");
+ root.save();
+ }
+
+ public void tearDown() throws Exception
+ {
+ testRoot.remove();
+ root.save();
+ super.tearDown();
+ }
+
+ protected void loadTestTree() throws Exception
+ {
+ // wc1/medias/picture
+ Node wc1 = testRoot.addNode("wc1", "nt:folder");
+ wc1.addMixin("mix:versionable");
+ testRoot.save();
+ Node medias = wc1.addNode("medias", "nt:folder");
+
+ Node picture = medias.addNode("picture", "nt:file");
+ picture.addMixin("mix:versionable");
+
+ Node res = picture.addNode("jcr:content", "nt:resource");
+ res.setProperty("jcr:lastModified", Calendar.getInstance());
+ res.setProperty("jcr:data", new ByteArrayInputStream("bla bla".getBytes()));
+ MimeTypeResolver mimres = new MimeTypeResolver();
+ res.setProperty("jcr:mimeType", mimres.getMimeType("screen.txt"));
+ root.save();
+ }
+
+ public void testImportVersionHistoryPreloadChildVersionHistory() throws Exception
+ {
+ loadTestTree();
+ Node wc1 = (NodeImpl)session.getItem("/parent/wc1");
+ Node picture = (NodeImpl)session.getItem("/parent/wc1/medias/picture");
+
+ // make checkin/checkout a lot
+
+ wc1.checkin();
+ wc1.checkout();
+
+ picture.checkin();
+ picture.checkout();
+
+ // export import version history and node
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ session.exportSystemView("/parent/wc1", out, false, false);
+
+ ByteArrayOutputStream childvhout = new ByteArrayOutputStream();
+ session.exportSystemView(picture.getVersionHistory().getPath(), childvhout, false, false);
+
+ ByteArrayOutputStream vhout = new ByteArrayOutputStream();
+ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false);
+
+ // prepare data for version import
+
+ String versionHistory = wc1.getProperty("jcr:versionHistory").getValue().getString();
+ String baseVersion = wc1.getProperty("jcr:baseVersion").getValue().getString();
+ Value[] jcrPredecessors = wc1.getProperty("jcr:predecessors").getValues();
+ StringBuilder jcrPredecessorsBuilder = new StringBuilder();
+ String[] predecessorsHistory;
+ for (Value value : jcrPredecessors)
+ {
+ if (jcrPredecessorsBuilder.length() > 0)
+ jcrPredecessorsBuilder.append(",");
+ jcrPredecessorsBuilder.append(value.getString());
+ }
+ if (jcrPredecessorsBuilder.toString().indexOf(",") > -1)
+ {
+ predecessorsHistory = jcrPredecessorsBuilder.toString().split(",");
+ }
+ else
+ {
+ predecessorsHistory = new String[]{jcrPredecessorsBuilder.toString()};
+ }
+
+ // prepare data for child version import
+
+ String chversionHistory = picture.getProperty("jcr:versionHistory").getValue().getString();
+ String chbaseVersion = picture.getProperty("jcr:baseVersion").getValue().getString();
+ Value[] chjcrPredecessors = picture.getProperty("jcr:predecessors").getValues();
+ StringBuilder chjcrPredecessorsBuilder = new StringBuilder();
+ String[] chpredecessorsHistory;
+ for (Value value : chjcrPredecessors)
+ {
+ if (chjcrPredecessorsBuilder.length() > 0)
+ chjcrPredecessorsBuilder.append(",");
+ chjcrPredecessorsBuilder.append(value.getString());
+ }
+ if (chjcrPredecessorsBuilder.toString().indexOf(",") > -1)
+ {
+ chpredecessorsHistory = chjcrPredecessorsBuilder.toString().split(",");
+ }
+ else
+ {
+ chpredecessorsHistory = new String[]{chjcrPredecessorsBuilder.toString()};
+ }
+
+ // remove node
+ wc1.remove();
+ session.save();
+
+ out.close();
+ vhout.close();
+
+ // import
+ session.importXML("/parent", new ByteArrayInputStream(out.toByteArray()),
+ ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW, true);
+
+ session.save();
+
+ wc1 = (NodeImpl)session.getItem("/parent/wc1");
+ picture = wc1.getNode("medias").getNode("picture");
+
+ VersionHistoryImporter chversionHistoryImporter =
+ new VersionHistoryImporter((NodeImpl)picture, new ByteArrayInputStream(childvhout.toByteArray()),
+ chbaseVersion, chpredecessorsHistory, chversionHistory);
+ chversionHistoryImporter.doImport();
+ session.save();
+
+ VersionHistoryImporter versionHistoryImporter =
+ new VersionHistoryImporter((NodeImpl)wc1, new ByteArrayInputStream(vhout.toByteArray()), baseVersion,
+ predecessorsHistory, versionHistory);
+ versionHistoryImporter.doImport();
+ session.save();
+
+ assertTrue(picture.isNodeType("mix:versionable"));
+ assertEquals(chversionHistory, picture.getProperty("jcr:versionHistory").getValue().getString());
+ assertEquals(chbaseVersion, picture.getProperty("jcr:baseVersion").getValue().getString());
+ assertEquals(chpredecessorsHistory[0], picture.getProperty("jcr:predecessors").getValues()[0].getString());
+ }
+
+ public void testImportVersionHistory() throws Exception
+ {
+ loadTestTree();
+ Node wc1 = (NodeImpl)session.getItem("/parent/wc1");
+
+ // make checkin/checkout
+ wc1.checkin();
+ wc1.checkout();
+
+ // export import version history and node
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ session.exportSystemView("/parent/wc1", out, false, false);
+
+ ByteArrayOutputStream vhout = new ByteArrayOutputStream();
+ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false);
+
+ // prepare data for version import
+ String versionHistory = wc1.getProperty("jcr:versionHistory").getValue().getString();
+ String baseVersion = wc1.getProperty("jcr:baseVersion").getValue().getString();
+ Value[] jcrPredecessors = wc1.getProperty("jcr:predecessors").getValues();
+ StringBuilder jcrPredecessorsBuilder = new StringBuilder();
+ String[] predecessorsHistory;
+ for (Value value : jcrPredecessors)
+ {
+ if (jcrPredecessorsBuilder.length() > 0)
+ jcrPredecessorsBuilder.append(",");
+ jcrPredecessorsBuilder.append(value.getString());
+ }
+ if (jcrPredecessorsBuilder.toString().indexOf(",") > -1)
+ {
+ predecessorsHistory = jcrPredecessorsBuilder.toString().split(",");
+ }
+ else
+ {
+ predecessorsHistory = new String[]{jcrPredecessorsBuilder.toString()};
+ }
+
+ // remove node
+ wc1.remove();
+ session.save();
+
+ out.close();
+ vhout.close();
+
+ // import
+ session.importXML("/parent", new ByteArrayInputStream(out.toByteArray()),
+ ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW, true);
+
+ session.save();
+
+ wc1 = (NodeImpl)session.getItem("/parent/wc1");
+
+ VersionHistoryImporter versionHistoryImporter =
+ new VersionHistoryImporter((NodeImpl)wc1, new ByteArrayInputStream(vhout.toByteArray()), baseVersion,
+ predecessorsHistory, versionHistory);
+ versionHistoryImporter.doImport();
+ session.save();
+
+ Node picture = wc1.getNode("medias").getNode("picture");
+ assertTrue(picture.isNodeType("mix:versionable"));
+
+ //try to remove wc1, there must be RepositoryException
+ try
+ {
+ wc1.remove();
+ session.save();
+ fail();
+ }
+ catch (RepositoryException e)
+ {
+ // OK - wc1 Version History contain nt:versionedChild with link to non exist Version history
+
+ // remove bugy version history
+ SessionDataManager dataManager = session.getTransientNodesManager();
+ NodeImpl vhPicture =
+ (NodeImpl)session.getItem("/jcr:system/jcr:versionStorage/" + versionHistory
+ + "/1/jcr:frozenNode/medias/picture");
+
+ assertTrue(vhPicture.isNodeType("nt:versionedChild"));
+
+ PlainChangesLog changesLogDelete = new PlainChangesLogImpl();
+ changesLogDelete.add(ItemState.createDeletedState(((PropertyImpl)vhPicture.getProperty("jcr:primaryType"))
+ .getData()));
+ changesLogDelete.add(ItemState.createDeletedState(((PropertyImpl)vhPicture
+ .getProperty("jcr:childVersionHistory")).getData()));
+ for (ItemState itemState : changesLogDelete.getAllStates())
+ {
+ dataManager.delete(itemState.getData(), itemState.getAncestorToSave());
+ }
+ session.save();
+ }
+ }
+}
13 years, 2 months
exo-jcr SVN: r4002 - jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1584.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2011-02-22 06:08:50 -0500 (Tue, 22 Feb 2011)
New Revision: 4002
Modified:
jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1584/JCR-1584.patch
Log:
JCR-1584: new patch proposed - export/import child node version history in single xml reverted
Modified: jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1584/JCR-1584.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1584/JCR-1584.patch 2011-02-22 07:57:39 UTC (rev 4001)
+++ jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1584/JCR-1584.patch 2011-02-22 11:08:50 UTC (rev 4002)
@@ -1,493 +1,17 @@
-Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/Constants.java
-===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/Constants.java (revision 3980)
-+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/Constants.java (working copy)
-@@ -569,6 +569,11 @@
- public static final String SV_NODE = "node";
-
- /**
-+ * SV_VERSION_HISTORY.
-+ */
-+ public static final String SV_VERSION_HISTORY = "versionhistory";
-+
-+ /**
- * SV_PROPERTY.
- */
- public static final String SV_PROPERTY = "property";
-@@ -604,6 +609,11 @@
- public static final InternalQName SV_NODE_NAME = new InternalQName(NS_SV_URI, SV_NODE);
-
- /**
-+ * sv:versionhistory internal name.
-+ */
-+ public static final InternalQName SV_VERSION_HISTORY_NAME = new InternalQName(NS_SV_URI, SV_VERSION_HISTORY);
-+
-+ /**
- * sv:property internal name.
- */
- public static final InternalQName SV_PROPERTY_NAME = new InternalQName(NS_SV_URI, SV_PROPERTY);
-@@ -667,7 +677,7 @@
- * eXo JCR default Strings encoding.
- */
- public static final String DEFAULT_ENCODING = "UTF-8";
--
-+
- /**
- * System identifier for remote workspace initializer changes.
- */
-Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
-===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java (revision 3980)
-+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java (working copy)
-@@ -393,6 +393,12 @@
- public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse)
- throws IOException, PathNotFoundException, RepositoryException
- {
-+ exportSystemView(absPath, out, skipBinary, noRecurse, false);
-+ }
-+
-+ public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse,
-+ boolean exportChildVersionHisotry) throws IOException, PathNotFoundException, RepositoryException
-+ {
- LocationFactory factory = new LocationFactory(((NamespaceRegistryImpl)repository.getNamespaceRegistry()));
-
- WorkspaceEntry wsConfig = (WorkspaceEntry)container.getComponentInstanceOfType(WorkspaceEntry.class);
-@@ -403,11 +409,12 @@
- ValueFactoryImpl valueFactoryImpl = new ValueFactoryImpl(factory, wsConfig, cleanerHolder);
- try
- {
-+ JCRPath srcNodePath = getLocationFactory().parseAbsPath(absPath);
- BaseXmlExporter exporter =
- new ExportImportFactory().getExportVisitor(XmlMapping.SYSVIEW, out, skipBinary, noRecurse,
-- getTransientNodesManager(), repository.getNamespaceRegistry(), valueFactoryImpl);
-+ exportChildVersionHisotry, getTransientNodesManager(), repository.getNamespaceRegistry(),
-+ valueFactoryImpl);
-
-- JCRPath srcNodePath = getLocationFactory().parseAbsPath(absPath);
- ItemData srcItemData = dataManager.getItemData(srcNodePath.getInternalPath());
-
- if (srcItemData == null)
-@@ -872,8 +879,8 @@
- + destAbsPath);
- }
-
-- destParentNode.validateChildNode(destNodePath.getName().getInternalName(),
-- ((NodeTypeImpl)srcNode.getPrimaryNodeType()).getQName());
-+ destParentNode.validateChildNode(destNodePath.getName().getInternalName(), ((NodeTypeImpl)srcNode
-+ .getPrimaryNodeType()).getQName());
-
- // Check for node with destAbsPath name in session
- NodeImpl destNode =
-Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/ExportImportFactory.java
-===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/ExportImportFactory.java (revision 3980)
-+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/ExportImportFactory.java (working copy)
-@@ -112,7 +112,33 @@
- ItemDataConsumer dataManager, NamespaceRegistry namespaceRegistry, ValueFactoryImpl systemValueFactory)
- throws NamespaceException, RepositoryException, IOException
- {
-+ return getExportVisitor(type, stream, skipBinary, noRecurse, false, dataManager, namespaceRegistry,
-+ systemValueFactory);
-+ }
-
-+ /**
-+ * Create export visitor for given type of view.\
-+ *
-+ * @param type - 6.4 XML Mappings
-+ * @param stream - output result stream
-+ * @param skipBinary- If skipBinary is true then any properties of
-+ * PropertyType.BINARY will be serialized as if they are empty.
-+ * @param noRecurse- if noRecurse is false, the whole subtree are serialized
-+ * @param exportChildVersionHistory - does versioned child nodes version history must be exported
-+ * (works ONLY with system view).
-+ * @param dataManager - ItemDataConsumer
-+ * @param namespaceRegistry - NamespaceRegistry
-+ * @param systemValueFactory - default value factory
-+ * @return - visitor BaseXmlExporter.
-+ * @throws NamespaceException
-+ * @throws RepositoryException
-+ * @throws IOException
-+ */
-+ public BaseXmlExporter getExportVisitor(XmlMapping type, OutputStream stream, boolean skipBinary, boolean noRecurse,
-+ boolean exportChildVersionHistory, ItemDataConsumer dataManager, NamespaceRegistry namespaceRegistry,
-+ ValueFactoryImpl systemValueFactory) throws NamespaceException, RepositoryException, IOException
-+ {
-+
- XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
- XMLStreamWriter streamWriter;
- try
-@@ -127,7 +153,7 @@
- if (type == XmlMapping.SYSVIEW)
- {
- return new SystemViewStreamExporter(streamWriter, dataManager, namespaceRegistry, systemValueFactory,
-- skipBinary, noRecurse);
-+ skipBinary, noRecurse, exportChildVersionHistory);
- }
- else if (type == XmlMapping.DOCVIEW)
- {
-Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/exporting/DocumentViewStreamExporter.java
-===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/exporting/DocumentViewStreamExporter.java (revision 3980)
-+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/exporting/DocumentViewStreamExporter.java (working copy)
-@@ -49,7 +49,7 @@
- NamespaceRegistry namespaceRegistry, ValueFactoryImpl systemValueFactory, boolean skipBinary, boolean noRecurse)
- throws NamespaceException, RepositoryException
- {
-- super(writer, dataManager, namespaceRegistry, systemValueFactory, skipBinary, noRecurse);
-+ super(writer, dataManager, namespaceRegistry, systemValueFactory, skipBinary, noRecurse, false);
- }
-
- /**
-Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/exporting/StreamExporter.java
-===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/exporting/StreamExporter.java (revision 3980)
-+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/exporting/StreamExporter.java (working copy)
-@@ -38,14 +38,22 @@
-
- protected final XMLStreamWriter writer;
-
-+ protected final boolean exportChildVersionHistory;
-+
- public StreamExporter(XMLStreamWriter writer, ItemDataConsumer dataManager, NamespaceRegistry namespaceRegistry,
- ValueFactoryImpl systemValueFactory, boolean skipBinary, boolean noRecurse) throws NamespaceException,
- RepositoryException
- {
-+ this(writer, dataManager, namespaceRegistry, systemValueFactory, skipBinary, noRecurse, false);
-+ }
-
-+ public StreamExporter(XMLStreamWriter writer, ItemDataConsumer dataManager, NamespaceRegistry namespaceRegistry,
-+ ValueFactoryImpl systemValueFactory, boolean skipBinary, boolean noRecurse, boolean exportChildVersionHistory)
-+ throws NamespaceException, RepositoryException
-+ {
- super(dataManager, namespaceRegistry, systemValueFactory, skipBinary, noRecurse, noRecurse ? 1 : -1);
- this.writer = writer;
--
-+ this.exportChildVersionHistory = exportChildVersionHistory;
- }
-
- @Override
-Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/exporting/SystemViewStreamExporter.java
-===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/exporting/SystemViewStreamExporter.java (revision 3980)
-+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/exporting/SystemViewStreamExporter.java (working copy)
-@@ -21,14 +21,17 @@
- import org.apache.ws.commons.util.Base64;
- import org.exoplatform.services.jcr.core.ExtendedPropertyType;
- import org.exoplatform.services.jcr.dataflow.ItemDataConsumer;
-+import org.exoplatform.services.jcr.datamodel.ItemType;
- import org.exoplatform.services.jcr.datamodel.NodeData;
- import org.exoplatform.services.jcr.datamodel.PropertyData;
-+import org.exoplatform.services.jcr.datamodel.QPathEntry;
- import org.exoplatform.services.jcr.datamodel.ValueData;
- import org.exoplatform.services.jcr.impl.Constants;
- import org.exoplatform.services.jcr.impl.core.value.ValueFactoryImpl;
-
- import java.io.IOException;
- import java.io.InputStream;
-+import java.util.ArrayList;
- import java.util.List;
-
- import javax.jcr.NamespaceException;
-@@ -47,6 +50,8 @@
-
- private static final int BUFFER_SIZE = 3 * 1024 * 3;
-
-+ private static final List<String> exportedVersionHistories = new ArrayList<String>();
-+
- /**
- * @param writer
- * @param session
-@@ -59,9 +64,17 @@
- NamespaceRegistry namespaceRegistry, ValueFactoryImpl systemValueFactory, boolean skipBinary, boolean noRecurse)
- throws NamespaceException, RepositoryException
- {
-- super(writer, dataManager, namespaceRegistry, systemValueFactory, skipBinary, noRecurse);
-+ this(writer, dataManager, namespaceRegistry, systemValueFactory, skipBinary, noRecurse, false);
- }
-
-+ public SystemViewStreamExporter(XMLStreamWriter writer, ItemDataConsumer dataManager,
-+ NamespaceRegistry namespaceRegistry, ValueFactoryImpl systemValueFactory, boolean skipBinary, boolean noRecurse,
-+ boolean exportChildVersionHistory) throws NamespaceException, RepositoryException
-+ {
-+ super(writer, dataManager, namespaceRegistry, systemValueFactory, skipBinary, noRecurse,
-+ exportChildVersionHistory);
-+ }
-+
- /*
- * (non-Javadoc)
- * @see
-@@ -145,6 +158,40 @@
- {
- try
- {
-+ if (exportChildVersionHistory && node.getPrimaryTypeName().equals(Constants.NT_VERSIONEDCHILD))
-+ {
-+ try
-+ {
-+ PropertyData childVersionHistory =
-+ ((PropertyData)dataManager.getItemData(node, new QPathEntry(Constants.JCR_CHILDVERSIONHISTORY, 1),
-+ ItemType.PROPERTY));
-+ String childVersionHistoryId =
-+ getValueAsStringForExport(childVersionHistory.getValues().get(0), childVersionHistory.getType());
-+
-+ //check does this child version history was already exported
-+ if (!exportedVersionHistories.contains(childVersionHistoryId))
-+ {
-+
-+ writer.writeStartElement(Constants.NS_SV_PREFIX, Constants.SV_VERSION_HISTORY, getSvNamespaceUri());
-+ writer.writeAttribute(Constants.NS_SV_PREFIX, getSvNamespaceUri(), Constants.SV_NAME,
-+ childVersionHistoryId);
-+
-+ NodeData versionStorage = (NodeData)dataManager.getItemData(Constants.VERSIONSTORAGE_UUID);
-+ NodeData childVersionNodeData =
-+ (NodeData)dataManager.getItemData(versionStorage, new QPathEntry("", childVersionHistoryId, 1),
-+ ItemType.NODE);
-+ childVersionNodeData.accept(this);
-+
-+ writer.writeEndElement();
-+ exportedVersionHistories.add(childVersionHistoryId);
-+ }
-+ }
-+ catch (IOException e)
-+ {
-+ throw new RepositoryException("Can't export versioned child version history: " + e.getMessage(), e);
-+ }
-+ }
-+
- writer.writeEndElement();
- }
- catch (XMLStreamException e)
-Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/BaseXmlImporter.java
-===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/BaseXmlImporter.java (revision 3980)
-+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/BaseXmlImporter.java (working copy)
-@@ -383,7 +383,7 @@
- */
- protected void checkReferenceable(ImportNodeData currentNodeInfo, String olUuid) throws RepositoryException
- {
-- // if node is in version storrage - do not assign new id from jcr:uuid
-+ // if node is in version storage - do not assign new id from jcr:uuid
- // property
- if (Constants.JCR_VERSION_STORAGE_PATH.getDepth() + 3 <= currentNodeInfo.getQPath().getDepth()
- && currentNodeInfo.getQPath().getEntries()[Constants.JCR_VERSION_STORAGE_PATH.getDepth() + 3]
-Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/ContentImporter.java
-===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/ContentImporter.java (revision 3980)
-+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/ContentImporter.java (working copy)
-@@ -35,6 +35,8 @@
- */
- public String RESPECT_PROPERTY_DEFINITIONS_CONSTRAINTS = "respectPropertyDefinitionsConstraints";
-
-+ public final String LIST_OF_IMPORTED_VERSION_HISTORIES = "importedSubversions";
-+
- /**
- * Receive notification of character data.
- *
Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/SystemViewImporter.java
===================================================================
--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/SystemViewImporter.java (revision 3980)
+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/SystemViewImporter.java (working copy)
-@@ -27,8 +27,10 @@
- import org.exoplatform.services.jcr.datamodel.IllegalNameException;
- import org.exoplatform.services.jcr.datamodel.IllegalPathException;
- import org.exoplatform.services.jcr.datamodel.InternalQName;
-+import org.exoplatform.services.jcr.datamodel.ItemType;
- import org.exoplatform.services.jcr.datamodel.NodeData;
- import org.exoplatform.services.jcr.datamodel.QPath;
-+import org.exoplatform.services.jcr.datamodel.QPathEntry;
- import org.exoplatform.services.jcr.datamodel.ValueData;
- import org.exoplatform.services.jcr.impl.Constants;
- import org.exoplatform.services.jcr.impl.core.JCRName;
-@@ -36,6 +38,7 @@
- import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
- import org.exoplatform.services.jcr.impl.core.value.BaseValue;
- import org.exoplatform.services.jcr.impl.core.value.ValueFactoryImpl;
-+import org.exoplatform.services.jcr.impl.dataflow.ItemDataRemoveVisitor;
- import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
- import org.exoplatform.services.jcr.impl.dataflow.ValueDataConvertor;
- import org.exoplatform.services.jcr.impl.xml.DecodedValue;
-@@ -76,7 +79,7 @@
- private static Log log = ExoLogger.getLogger("exo.jcr.component.core.SystemViewImporter");
-
- protected PropertyInfo propertyInfo = new PropertyInfo();
--
-+
- protected Map<String, NodePropertiesInfo> mapNodePropertiesInfo = new HashMap<String, NodePropertiesInfo>();
-
- /**
-@@ -156,13 +159,13 @@
- if (propertyData != null)
- {
- changesLog.add(new ItemState(propertyData, ItemState.ADDED, true, getAncestorToSave()));
--
-+
- ImportNodeData currentNodeInfo = (ImportNodeData)getParent();
--
-+
- NodePropertiesInfo currentNodePropertiesInfo = mapNodePropertiesInfo.get(currentNodeInfo.getIdentifier());
--
-+
- currentNodePropertiesInfo.addProperty(propertyData);
-- }
-+ }
- }
- else if (Constants.SV_VALUE_NAME.equals(elementName))
+@@ -418,9 +418,16 @@
{
-@@ -171,6 +174,11 @@
- DecodedValue curPropValue = propertyInfo.getValues().get(propertyInfo.getValues().size() - 1);
- curPropValue.setComplete(true);
- }
-+ else if (Constants.SV_VERSION_HISTORY_NAME.equals(elementName))
-+ {
-+ // remove version history node from tree
-+ tree.pop();
-+ }
- else
- {
- throw new RepositoryException("invalid element in system view xml document: " + localName);
-@@ -218,7 +226,7 @@
- newNodeData.setIdentifier(IdGenerator.generate());
-
- changesLog.add(new ItemState(newNodeData, ItemState.ADDED, true, getAncestorToSave()));
--
-+
- mapNodePropertiesInfo.put(newNodeData.getIdentifier(), new NodePropertiesInfo(newNodeData));
-
- tree.push(newNodeData);
-@@ -260,6 +268,36 @@
- propertyInfo.getValues().add(new DecodedValue());
-
- }
-+ else if (Constants.SV_VERSION_HISTORY_NAME.equals(elementName))
-+ {
-+ String svName = getAttribute(atts, Constants.SV_NAME_NAME);
-+ if (svName == null)
-+ {
-+ throw new RepositoryException("Missing mandatory sv:name attribute of element sv:node");
-+ }
-+
-+ NodeData versionStorage = (NodeData)this.dataConsumer.getItemData(Constants.VERSIONSTORAGE_UUID);
-+
-+ NodeData versionHistory =
-+ (NodeData)dataConsumer.getItemData(versionStorage, new QPathEntry("", svName, 1), ItemType.NODE);
-+
-+ if (versionHistory != null)
-+ {
-+ RemoveVisitor rv = new RemoveVisitor();
-+ rv.visit(versionHistory);
-+ changesLog.addAll(rv.getRemovedStates());
-+ }
-+ tree.push(versionStorage);
-+
-+ List<String> list = (List<String>)context.get(ContentImporter.LIST_OF_IMPORTED_VERSION_HISTORIES);
-+ if (list == null)
-+ {
-+ list = new ArrayList<String>();
-+ }
-+ list.add(svName);
-+ context.put(ContentImporter.LIST_OF_IMPORTED_VERSION_HISTORIES, list);
-+
-+ }
- else
- {
- throw new RepositoryException("Unknown element " + elementName.getAsString());
-@@ -306,16 +344,15 @@
- private void endNode() throws RepositoryException
- {
- ImportNodeData currentNodeInfo = (ImportNodeData)tree.pop();
-+ NodePropertiesInfo currentNodePropertiesInfo = mapNodePropertiesInfo.get(currentNodeInfo.getIdentifier());
-
-- NodePropertiesInfo currentNodePropertiesInfo = mapNodePropertiesInfo.get(currentNodeInfo.getIdentifier());
--
- if (currentNodePropertiesInfo != null)
- {
- checkProperties(currentNodePropertiesInfo);
- }
--
-+
- mapNodePropertiesInfo.remove(currentNodeInfo.getIdentifier());
--
-+
- currentNodeInfo.setMixinTypeNames(currentNodeInfo.getMixinTypeNames());
-
- if (currentNodeInfo.isMixVersionable())
-@@ -326,7 +363,7 @@
- currentNodeInfo.setACL(initAcl(currentNodeInfo.getACL(), currentNodeInfo.isExoOwneable(), currentNodeInfo
- .isExoPrivilegeable(), currentNodeInfo.getExoOwner(), currentNodeInfo.getExoPrivileges()));
- }
--
-+
- /**
- * Checking priopertis if nodetype is nt:frozennode
- *
-@@ -339,7 +376,7 @@
- private void checkProperties(NodePropertiesInfo currentNodePropertiesInfo) throws RepositoryException
- {
- if (currentNodePropertiesInfo.getNode().getQPath().isDescendantOf(Constants.JCR_VERSION_STORAGE_PATH)
-- && currentNodePropertiesInfo.getNode().getPrimaryTypeName().equals(Constants.NT_FROZENNODE))
-+ && currentNodePropertiesInfo.getNode().getPrimaryTypeName().equals(Constants.NT_FROZENNODE))
- {
- InternalQName fptName = null;
- List<InternalQName> fmtNames = new ArrayList<InternalQName>();
-@@ -351,13 +388,16 @@
- {
- if (propertyData.getQName().equals(Constants.JCR_FROZENPRIMARYTYPE))
- {
-- fptName = InternalQName.parse(new String(propertyData.getValues().get(0).getAsByteArray(), Constants.DEFAULT_ENCODING));
-+ fptName =
-+ InternalQName.parse(new String(propertyData.getValues().get(0).getAsByteArray(),
-+ Constants.DEFAULT_ENCODING));
- }
- else if (propertyData.getQName().equals(Constants.JCR_FROZENMIXINTYPES))
- {
- for (ValueData valueData : propertyData.getValues())
- {
-- fmtNames.add(InternalQName.parse(new String(valueData.getAsByteArray(), Constants.DEFAULT_ENCODING)));
-+ fmtNames.add(InternalQName
-+ .parse(new String(valueData.getAsByteArray(), Constants.DEFAULT_ENCODING)));
- }
- }
- }
-@@ -374,20 +414,22 @@
- {
- throw new RepositoryException(e.getMessage(), e);
- }
--
-+
- InternalQName nodePrimaryTypeName = currentNodePropertiesInfo.getNode().getPrimaryTypeName();
- InternalQName[] nodeMixinTypeName = currentNodePropertiesInfo.getNode().getMixinTypeNames();
-
- for (ImportPropertyData propertyData : currentNodePropertiesInfo.getProperties())
- {
-- PropertyDefinitionDatas defs = nodeTypeDataManager.getPropertyDefinitions(propertyData.getQName(), nodePrimaryTypeName, nodeMixinTypeName);
--
-- if (defs == null || (defs != null && defs.getAnyDefinition().isResidualSet()))
-+ PropertyDefinitionDatas defs =
-+ nodeTypeDataManager.getPropertyDefinitions(propertyData.getQName(), nodePrimaryTypeName,
-+ nodeMixinTypeName);
-+
-+ if (defs == null || (defs != null && defs.getAnyDefinition().isResidualSet()))
- {
- PropertyDefinitionDatas vhdefs =
-- nodeTypeDataManager.getPropertyDefinitions(propertyData.getQName(), fptName, fmtNames
-- .toArray(new InternalQName[fmtNames.size()]));
--
-+ nodeTypeDataManager.getPropertyDefinitions(propertyData.getQName(), fptName, fmtNames
-+ .toArray(new InternalQName[fmtNames.size()]));
-+
- if (vhdefs != null)
- {
- boolean isMultivalue = (vhdefs.getDefinition(true) != null ? true : false);
-@@ -418,9 +460,16 @@
- {
NodeData parentNodeData = getParent();
// nodeTypeDataManager.findChildNodeDefinition(primaryTypeName,)
- if (!nodeTypeDataManager.isChildNodePrimaryTypeAllowed(primaryTypeName, parentNodeData.getPrimaryTypeName(),
- parentNodeData.getMixinTypeNames()))
+
-+ // check is node data descendant of frozenNode and primary type is nt:versionedChild
-+ if (nodeData.getQPath().getDepth() > 6 && nodeData.getQPath().getEntries()[5].equals(Constants.JCR_FROZENNODE)
-+ && primaryTypeName.equals(Constants.NT_VERSIONEDCHILD))
++ // check is nt:versionedChild subnode of frozenNode
++ if (nodeData.getQPath().getDepth() > 6 && primaryTypeName.equals(Constants.NT_VERSIONEDCHILD)
++ && nodeData.getQPath().getEntries()[5].equals(Constants.JCR_FROZENNODE))
{
+ //do nothing
+ }
@@ -497,275 +21,11 @@
throw new ConstraintViolationException("Can't add node " + nodeData.getQName().getAsString() + " to "
+ parentNodeData.getQPath().getAsString() + " node type " + sName
+ " is not allowed as child's node type for parent node type "
-@@ -555,7 +604,7 @@
- propertyData =
- new ImportPropertyData(QPath.makeChildPath(currentNodeInfo.getQPath(), propertyInfo.getName()), propertyInfo
- .getIndentifer(), 0, propertyInfo.getType(), currentNodeInfo.getIdentifier(), false);
--
-+
- if (currentNodeInfo.getQPath().isDescendantOf(Constants.JCR_VERSION_STORAGE_PATH))
- {
- propertyData.setValue(new TransientValueData(propertyInfo.getValues().get(0).toString()));
-@@ -566,7 +615,7 @@
- }
-
- tree.push(currentNodeInfo);
--
-+
- mapNodePropertiesInfo.put(currentNodeInfo.getIdentifier(), new NodePropertiesInfo(currentNodeInfo));
-
- return propertyData;
-@@ -676,4 +725,26 @@
- JCRName jname = locationFactory.createJCRName(name);
- return attributes.get(jname.getAsString());
- }
-+
-+ protected class RemoveVisitor extends ItemDataRemoveVisitor
-+ {
-+ /**
-+ * Default constructor.
-+ *
-+ * @throws RepositoryException - exception.
-+ */
-+ RemoveVisitor() throws RepositoryException
-+ {
-+ super(dataConsumer, null, nodeTypeDataManager, accessManager, userState);
-+ }
-+
-+ /**
-+ * {@inheritDoc}
-+ */
-+ protected void validateReferential(NodeData node) throws RepositoryException
-+ {
-+ // no REFERENCE validation here
-+ }
-+ };
-+
- }
-Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/VersionHistoryImporter.java
-===================================================================
---- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/VersionHistoryImporter.java (revision 3980)
-+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/VersionHistoryImporter.java (working copy)
-@@ -23,23 +23,31 @@
- import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
- import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
- import org.exoplatform.services.jcr.datamodel.Identifier;
-+import org.exoplatform.services.jcr.datamodel.ItemType;
- import org.exoplatform.services.jcr.datamodel.NodeData;
-+import org.exoplatform.services.jcr.datamodel.PropertyData;
-+import org.exoplatform.services.jcr.datamodel.QPathEntry;
- import org.exoplatform.services.jcr.datamodel.ValueData;
- import org.exoplatform.services.jcr.impl.Constants;
- import org.exoplatform.services.jcr.impl.core.NodeImpl;
- import org.exoplatform.services.jcr.impl.core.PropertyImpl;
-+import org.exoplatform.services.jcr.impl.core.SessionDataManager;
- import org.exoplatform.services.jcr.impl.core.SessionImpl;
- import org.exoplatform.services.jcr.impl.dataflow.ItemDataRemoveVisitor;
- import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
- import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
-+import org.exoplatform.services.jcr.impl.dataflow.ValueDataConvertor;
- import org.exoplatform.services.jcr.impl.xml.ItemDataKeeperAdapter;
-+import org.exoplatform.services.jcr.impl.xml.importing.ContentImporter;
- import org.exoplatform.services.log.ExoLogger;
- import org.exoplatform.services.log.Log;
-
- import java.io.IOException;
- import java.io.InputStream;
- import java.util.ArrayList;
-+import java.util.HashMap;
- import java.util.List;
-+import java.util.Map;
-
- import javax.jcr.PropertyType;
- import javax.jcr.RepositoryException;
-@@ -144,7 +152,7 @@
- {
- uuid = versionableNode.getUUID();
- path = versionableNode.getVersionHistory().getParent().getPath();
-- LOG.info("Started: Import version history for node wiht path=" + path + " and UUID=" + uuid);
-+ LOG.info("Started: Import version history for node with path=" + path + " and UUID=" + uuid);
-
- NodeData versionable = (NodeData)versionableNode.getData();
- // ----- VERSIONABLE properties -----
-@@ -176,32 +184,43 @@
- changesLog.add(ItemState.createAddedState(bv));
- changesLog.add(ItemState.createAddedState(pd));
- // remove version properties to avoid referential integrety check
-- PlainChangesLog changesLogDeltete = new PlainChangesLogImpl();
-+ PlainChangesLog changesLogDelete = new PlainChangesLogImpl();
-
-- changesLogDeltete.add(ItemState.createDeletedState(((PropertyImpl)versionableNode
-+ changesLogDelete.add(ItemState.createDeletedState(((PropertyImpl)versionableNode
- .getProperty("jcr:versionHistory")).getData()));
-- changesLogDeltete.add(ItemState.createDeletedState(((PropertyImpl)versionableNode
-+ changesLogDelete.add(ItemState.createDeletedState(((PropertyImpl)versionableNode
- .getProperty("jcr:baseVersion")).getData()));
-- changesLogDeltete.add(ItemState.createDeletedState(((PropertyImpl)versionableNode
-+ changesLogDelete.add(ItemState.createDeletedState(((PropertyImpl)versionableNode
- .getProperty("jcr:predecessors")).getData()));
-- dataKeeper.save(changesLogDeltete);
-+ dataKeeper.save(changesLogDelete);
- // remove version history
- dataKeeper.save(changesLog);
- userSession.save();
-+
- // import new version history
-- userSession.getWorkspace().importXML(path, versionHistoryStream, 0);
-+ Map<String, Object> context = new HashMap<String, Object>();
-+ //context.put("versionablenode", versionableNode);
-+ context.put(ContentImporter.RESPECT_PROPERTY_DEFINITIONS_CONSTRAINTS, true);
-+ userSession.getWorkspace().importXML(path, versionHistoryStream, 0, context);
- userSession.save();
-
-- LOG.info("Completed: Import version history for node wiht path=" + path + " and UUID=" + uuid);
-+ LOG.info("Completed: Import version history for node with path=" + path + " and UUID=" + uuid);
-+
-+ // fetch list of imported child nodes versions
-+ List<String> versionUuids = (List<String>)context.get(ContentImporter.LIST_OF_IMPORTED_VERSION_HISTORIES);
-+ if (versionUuids != null && !versionUuids.isEmpty())
-+ {
-+ updateVersionedChildNodes(versionUuids);
-+ }
- }
- catch (RepositoryException exception)
- {
-- LOG.error("Failed: Import version history for node wiht path=" + path + " and UUID=" + uuid, exception);
-+ LOG.error("Failed: Import version history for node with path=" + path + " and UUID=" + uuid, exception);
- throw new RepositoryException(exception);
- }
- catch (IOException exception)
- {
-- LOG.error("Failed: Import version history for node wiht path=" + path + " and UUID=" + uuid, exception);
-+ LOG.error("Failed: Import version history for node with path=" + path + " and UUID=" + uuid, exception);
- IOException newException = new IOException();
- newException.initCause(exception);
- throw newException;
-@@ -209,6 +228,120 @@
- }
-
- /**
-+ * Update child nodes that owns versions from versionUuids list.
-+ *
-+ * @param versionUuids - list of version histories uuids.
-+ * @throws RepositoryException
-+ * @throws IOException
-+ */
-+ private void updateVersionedChildNodes(List<String> versionUuids) throws RepositoryException, IOException
-+ {
-+ SessionDataManager dataManager = userSession.getTransientNodesManager();
-+
-+ NodeData versionStorage = (NodeData)dataManager.getItemData(Constants.VERSIONSTORAGE_UUID);
-+
-+ for (String versionUuid : versionUuids)
-+ {
-+ NodeData versionHistoryData =
-+ (NodeData)dataManager.getItemData(versionStorage, new QPathEntry("", versionUuid, 1), ItemType.NODE);
-+
-+ PropertyData versionableUuidProp =
-+ (PropertyData)dataManager.getItemData(versionHistoryData, new QPathEntry(Constants.JCR_VERSIONABLEUUID, 1),
-+ ItemType.PROPERTY);
-+
-+ String versionableUuid = ValueDataConvertor.readString(versionableUuidProp.getValues().get(0));
-+
-+ // fetch child versionable node
-+
-+ NodeData versionedChild = (NodeData)dataManager.getItemData(versionableUuid);
-+
-+ if (versionedChild != null && versionedChild.getQPath().isDescendantOf(versionableNode.getData().getQPath()))
-+ {
-+ // find latest version
-+ String latestVersionUuid = null;
-+ for (int versionNumber = 1;; versionNumber++)
-+ {
-+ NodeData nodeData =
-+ (NodeData)dataManager.getItemData(versionHistoryData, new QPathEntry("", Integer
-+ .toString(versionNumber), 1), ItemType.NODE);
-+
-+ if (nodeData == null)
-+ {
-+ break;
-+ }
-+ else
-+ {
-+ latestVersionUuid = nodeData.getIdentifier();
-+ }
-+ }
-+
-+ if (latestVersionUuid == null)
-+ {
-+ // fetch root version
-+ NodeData rootVersion =
-+ (NodeData)dataManager.getItemData(versionHistoryData, new QPathEntry(Constants.JCR_ROOTVERSION, 1),
-+ ItemType.NODE);
-+ latestVersionUuid = rootVersion.getIdentifier();
-+ }
-+
-+ PropertyData propVersionHistory =
-+ (PropertyData)dataManager.getItemData(versionedChild, new QPathEntry(Constants.JCR_VERSIONHISTORY, 1),
-+ ItemType.PROPERTY);
-+ String prevVerHistoryId = ValueDataConvertor.readString(propVersionHistory.getValues().get(0));
-+
-+ PropertyData propBaseVersion =
-+ (PropertyData)dataManager.getItemData(versionedChild, new QPathEntry(Constants.JCR_BASEVERSION, 1),
-+ ItemType.PROPERTY);
-+
-+ PropertyData propPredecessors =
-+ (PropertyData)dataManager.getItemData(versionedChild, new QPathEntry(Constants.JCR_PREDECESSORS, 1),
-+ ItemType.PROPERTY);
-+
-+ TransientPropertyData newVersionHistoryProp =
-+ TransientPropertyData.createPropertyData(versionedChild, Constants.JCR_VERSIONHISTORY,
-+ PropertyType.REFERENCE, false, new TransientValueData(new Identifier(versionUuid)));
-+
-+ // jcr:baseVersion
-+ TransientPropertyData newBaseVersionProp =
-+ TransientPropertyData.createPropertyData(versionedChild, Constants.JCR_BASEVERSION,
-+ PropertyType.REFERENCE, false, new TransientValueData(new Identifier(latestVersionUuid)));
-+
-+ // jcr:predecessors
-+ List<ValueData> predecessorValues = new ArrayList<ValueData>();
-+ predecessorValues.add(new TransientValueData(new Identifier(latestVersionUuid)));
-+ TransientPropertyData newPredecessorsProp =
-+ TransientPropertyData.createPropertyData(versionedChild, Constants.JCR_PREDECESSORS,
-+ PropertyType.REFERENCE, true, predecessorValues);
-+
-+ //remove previous version of childnode nad update properties
-+ NodeData prevVersionHistory = (NodeData)dataManager.getItemData(prevVerHistoryId);
-+
-+ PlainChangesLogImpl changesLog = new PlainChangesLogImpl();
-+ if (!prevVerHistoryId.equals(versionUuid))
-+ {
-+ RemoveVisitor rv = new RemoveVisitor();
-+ rv.visit(prevVersionHistory);
-+ changesLog.addAll(rv.getRemovedStates());
-+ }
-+ changesLog.add(ItemState.createAddedState(newVersionHistoryProp));
-+ changesLog.add(ItemState.createAddedState(newBaseVersionProp));
-+ changesLog.add(ItemState.createAddedState(newPredecessorsProp));
-+
-+ PlainChangesLogImpl changesLogDelete = new PlainChangesLogImpl();
-+ changesLogDelete.add(ItemState.createDeletedState(propVersionHistory));
-+ changesLogDelete.add(ItemState.createDeletedState(propBaseVersion));
-+ changesLogDelete.add(ItemState.createDeletedState(propPredecessors));
-+ dataKeeper.save(changesLogDelete);
-+ // remove version history
-+ dataKeeper.save(changesLog);
-+ userSession.save();
-+ LOG.info("Completed: Import version history for node with path=" + versionedChild.getQPath().getAsString()
-+ + " and UUID=" + versionedChild.getIdentifier());
-+ }
-+ }
-+ }
-+
-+ /**
- * Remover helper.
- *
- * @author sj
Index: exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImportVersionedChild.java
===================================================================
--- exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImportVersionedChild.java (revision 0)
+++ exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImportVersionedChild.java (revision 0)
-@@ -0,0 +1,856 @@
+@@ -0,0 +1,278 @@
+/*
+ * Copyright (C) 2003-2011 eXo Platform SAS.
+ *
@@ -792,12 +52,10 @@
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
+import org.exoplatform.services.jcr.impl.core.PropertyImpl;
+import org.exoplatform.services.jcr.impl.core.SessionDataManager;
-+import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import org.exoplatform.services.jcr.util.VersionHistoryImporter;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
-+import java.io.InputStream;
+import java.util.Calendar;
+
+import javax.jcr.ImportUUIDBehavior;
@@ -851,93 +109,6 @@
+ root.save();
+ }
+
-+ public void testImportVersionHistory() throws Exception
-+ {
-+ loadTestTree();
-+ Node wc1 = (NodeImpl)session.getItem("/parent/wc1");
-+
-+ // make checkin/checkout a lot
-+ wc1.checkin();
-+ wc1.checkout();
-+
-+ // export import version history and node
-+ ByteArrayOutputStream out = new ByteArrayOutputStream();
-+ session.exportSystemView("/parent/wc1", out, false, false, true);
-+
-+ ByteArrayOutputStream vhout = new ByteArrayOutputStream();
-+ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false, true);
-+
-+ // prepare data for version import
-+ String versionHistory = wc1.getProperty("jcr:versionHistory").getValue().getString();
-+ String baseVersion = wc1.getProperty("jcr:baseVersion").getValue().getString();
-+ Value[] jcrPredecessors = wc1.getProperty("jcr:predecessors").getValues();
-+ StringBuilder jcrPredecessorsBuilder = new StringBuilder();
-+ String[] predecessorsHistory;
-+ for (Value value : jcrPredecessors)
-+ {
-+ if (jcrPredecessorsBuilder.length() > 0)
-+ jcrPredecessorsBuilder.append(",");
-+ jcrPredecessorsBuilder.append(value.getString());
-+ }
-+ if (jcrPredecessorsBuilder.toString().indexOf(",") > -1)
-+ {
-+ predecessorsHistory = jcrPredecessorsBuilder.toString().split(",");
-+ }
-+ else
-+ {
-+ predecessorsHistory = new String[]{jcrPredecessorsBuilder.toString()};
-+ }
-+
-+ // remember "picture" nodes version history data
-+ Node picture = (NodeImpl)session.getItem("/parent/wc1/medias/picture");
-+ String chversionHistory = picture.getProperty("jcr:versionHistory").getValue().getString();
-+ String chbaseVersion = picture.getProperty("jcr:baseVersion").getValue().getString();
-+ Value[] chjcrPredecessors = picture.getProperty("jcr:predecessors").getValues();
-+ StringBuilder chjcrPredecessorsBuilder = new StringBuilder();
-+ String[] chpredecessorsHistory;
-+ for (Value value : chjcrPredecessors)
-+ {
-+ if (chjcrPredecessorsBuilder.length() > 0)
-+ chjcrPredecessorsBuilder.append(",");
-+ chjcrPredecessorsBuilder.append(value.getString());
-+ }
-+ if (chjcrPredecessorsBuilder.toString().indexOf(",") > -1)
-+ {
-+ chpredecessorsHistory = chjcrPredecessorsBuilder.toString().split(",");
-+ }
-+ else
-+ {
-+ chpredecessorsHistory = new String[]{chjcrPredecessorsBuilder.toString()};
-+ }
-+
-+ // remove node
-+ wc1.remove();
-+ session.save();
-+
-+ out.close();
-+ vhout.close();
-+
-+ // import
-+ session.importXML("/parent", new ByteArrayInputStream(out.toByteArray()),
-+ ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW, true);
-+
-+ session.save();
-+
-+ wc1 = (NodeImpl)session.getItem("/parent/wc1");
-+
-+ VersionHistoryImporter versionHistoryImporter =
-+ new VersionHistoryImporter((NodeImpl)wc1, new ByteArrayInputStream(vhout.toByteArray()), baseVersion,
-+ predecessorsHistory, versionHistory);
-+ versionHistoryImporter.doImport();
-+ session.save();
-+
-+ picture = wc1.getNode("medias").getNode("picture");
-+ assertTrue(picture.isNodeType("mix:versionable"));
-+ assertEquals(chversionHistory, picture.getProperty("jcr:versionHistory").getValue().getString());
-+ assertEquals(chbaseVersion, picture.getProperty("jcr:baseVersion").getValue().getString());
-+ assertEquals(chpredecessorsHistory[0], picture.getProperty("jcr:predecessors").getValues()[0].getString());
-+ }
-+
+ public void testImportVersionHistoryPreloadChildVersionHistory() throws Exception
+ {
+ loadTestTree();
@@ -957,10 +128,10 @@
+ session.exportSystemView("/parent/wc1", out, false, false);
+
+ ByteArrayOutputStream childvhout = new ByteArrayOutputStream();
-+ session.exportSystemView(picture.getVersionHistory().getPath(), childvhout, false, false, true);
++ session.exportSystemView(picture.getVersionHistory().getPath(), childvhout, false, false);
+
+ ByteArrayOutputStream vhout = new ByteArrayOutputStream();
-+ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false, true);
++ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false);
+
+ // prepare data for version import
+
@@ -1040,67 +211,23 @@
+ assertEquals(chpredecessorsHistory[0], picture.getProperty("jcr:predecessors").getValues()[0].getString());
+ }
+
-+ /**
-+ * Many mix:versionable subnodes.
-+ * @throws Exception
-+ */
-+ public void testImportVersionHistoryWithManySubversions() throws Exception
++ public void testImportVersionHistory() throws Exception
+ {
++ loadTestTree();
++ Node wc1 = (NodeImpl)session.getItem("/parent/wc1");
+
-+ // wc1/medias/picture
-+ Node wc1 = testRoot.addNode("wc1", "nt:folder");
-+ wc1.addMixin("mix:versionable");
-+ testRoot.save();
-+ Node medias = wc1.addNode("medias", "nt:folder");
-+
-+ Node picture = medias.addNode("picture", "nt:file");
-+ picture.addMixin("mix:versionable");
-+
-+ Node res = picture.addNode("jcr:content", "nt:resource");
-+ res.setProperty("jcr:lastModified", Calendar.getInstance());
-+ res.setProperty("jcr:data", new ByteArrayInputStream("bla bla".getBytes()));
-+ MimeTypeResolver mimres = new MimeTypeResolver();
-+ res.setProperty("jcr:mimeType", mimres.getMimeType("screen.txt"));
-+ root.save();
-+
-+ Node subNode1 = medias.addNode("subnode1", "nt:folder");
-+ subNode1.addMixin("mix:versionable");
-+ root.save();
-+
-+ Node subNode2 = subNode1.addNode("subnode2", "nt:folder");
-+ Node subNode3 = subNode2.addNode("subnode3", "nt:folder");
-+ subNode3.addMixin("mix:versionable");
-+ root.save();
-+
-+ Node subNode4 = subNode3.addNode("subnode4", "nt:folder");
-+ subNode4.addMixin("mix:versionable");
-+ root.save();
-+
-+ // /medias/subnode1/subnode2/subnode3/subnode4
++ // make checkin/checkout
+ wc1.checkin();
+ wc1.checkout();
+
-+ picture.checkin();
-+ picture.checkout();
-+
-+ subNode1.checkin();
-+ subNode1.checkout();
-+
-+ subNode4.checkin();
-+ subNode4.checkout();
-+
-+ subNode3.checkin();
-+ subNode3.checkout();
-+
+ // export import version history and node
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
-+ session.exportSystemView("/parent/wc1", out, false, false, true);
++ session.exportSystemView("/parent/wc1", out, false, false);
+
+ ByteArrayOutputStream vhout = new ByteArrayOutputStream();
-+ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false, true);
++ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false);
+
+ // prepare data for version import
-+
+ String versionHistory = wc1.getProperty("jcr:versionHistory").getValue().getString();
+ String baseVersion = wc1.getProperty("jcr:baseVersion").getValue().getString();
+ Value[] jcrPredecessors = wc1.getProperty("jcr:predecessors").getValues();
@@ -1121,28 +248,6 @@
+ predecessorsHistory = new String[]{jcrPredecessorsBuilder.toString()};
+ }
+
-+ // prepare data for child version import
-+
-+ String chversionHistory = subNode4.getProperty("jcr:versionHistory").getValue().getString();
-+ String chbaseVersion = subNode4.getProperty("jcr:baseVersion").getValue().getString();
-+ Value[] chjcrPredecessors = subNode4.getProperty("jcr:predecessors").getValues();
-+ StringBuilder chjcrPredecessorsBuilder = new StringBuilder();
-+ String[] chpredecessorsHistory;
-+ for (Value value : chjcrPredecessors)
-+ {
-+ if (chjcrPredecessorsBuilder.length() > 0)
-+ chjcrPredecessorsBuilder.append(",");
-+ chjcrPredecessorsBuilder.append(value.getString());
-+ }
-+ if (chjcrPredecessorsBuilder.toString().indexOf(",") > -1)
-+ {
-+ chpredecessorsHistory = chjcrPredecessorsBuilder.toString().split(",");
-+ }
-+ else
-+ {
-+ chpredecessorsHistory = new String[]{chjcrPredecessorsBuilder.toString()};
-+ }
-+
+ // remove node
+ wc1.remove();
+ session.save();
@@ -1158,437 +263,16 @@
+
+ wc1 = (NodeImpl)session.getItem("/parent/wc1");
+
-+ subNode4 = (NodeImpl)session.getItem("/parent/wc1/medias/subnode1/subnode2/subnode3/subnode4");
-+
+ VersionHistoryImporter versionHistoryImporter =
+ new VersionHistoryImporter((NodeImpl)wc1, new ByteArrayInputStream(vhout.toByteArray()), baseVersion,
+ predecessorsHistory, versionHistory);
+ versionHistoryImporter.doImport();
+ session.save();
+
-+ assertTrue(subNode4.isNodeType("mix:versionable"));
-+ assertEquals(chversionHistory, subNode4.getProperty("jcr:versionHistory").getValue().getString());
-+ assertEquals(chbaseVersion, subNode4.getProperty("jcr:baseVersion").getValue().getString());
-+ assertEquals(chpredecessorsHistory[0], subNode4.getProperty("jcr:predecessors").getValues()[0].getString());
-+ }
-+
-+ public void testImportVersionHistoryManyVersions() throws Exception
-+ {
-+ // wc1/medias/picture
-+ Node wc1 = testRoot.addNode("wc1", "nt:folder");
-+ wc1.addMixin("mix:versionable");
-+ testRoot.save();
-+ Node medias = wc1.addNode("medias", "nt:folder");
-+
-+ Node picture = medias.addNode("picture", "nt:file");
-+ picture.addMixin("mix:versionable");
-+
-+ Node res = picture.addNode("jcr:content", "nt:resource");
-+ res.setProperty("jcr:lastModified", Calendar.getInstance());
-+ res.setProperty("jcr:data", new ByteArrayInputStream("bla bla".getBytes()));
-+ MimeTypeResolver mimres = new MimeTypeResolver();
-+ res.setProperty("jcr:mimeType", mimres.getMimeType("screen.txt"));
-+ root.save();
-+
-+ // make checkin/checkout a lot
-+ wc1.checkin();
-+ wc1.checkout();
-+
-+ picture.checkin();
-+ picture.checkout();
-+
-+ res.setProperty("jcr:data", new ByteArrayInputStream("new data".getBytes()));
-+ root.save();
-+
-+ picture.checkin();
-+ picture.checkout();
-+
-+ // check before import
-+
-+ picture.restore("1", true);
-+ String strvalue = picture.getNode("jcr:content").getProperty("jcr:data").getString();
-+ assertEquals("bla bla", strvalue);
-+
-+ picture.restore("2", true);
-+ strvalue = picture.getNode("jcr:content").getProperty("jcr:data").getString();
-+ assertEquals("new data", strvalue);
-+
-+ picture.checkout();
-+
-+ // make new version
-+ assertTrue(picture.getProperty("jcr:isCheckedOut").getValue().getBoolean());
-+
-+ // export import version history and node
-+ ByteArrayOutputStream out = new ByteArrayOutputStream();
-+ session.exportSystemView("/parent/wc1", out, false, false, true);
-+
-+ ByteArrayOutputStream vhout = new ByteArrayOutputStream();
-+ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false, true);
-+
-+ // prepare data for version import
-+
-+ String versionHistory = wc1.getProperty("jcr:versionHistory").getValue().getString();
-+ String baseVersion = wc1.getProperty("jcr:baseVersion").getValue().getString();
-+ Value[] jcrPredecessors = wc1.getProperty("jcr:predecessors").getValues();
-+ StringBuilder jcrPredecessorsBuilder = new StringBuilder();
-+ String[] predecessorsHistory;
-+ for (Value value : jcrPredecessors)
-+ {
-+ if (jcrPredecessorsBuilder.length() > 0)
-+ jcrPredecessorsBuilder.append(",");
-+ jcrPredecessorsBuilder.append(value.getString());
-+ }
-+ if (jcrPredecessorsBuilder.toString().indexOf(",") > -1)
-+ {
-+ predecessorsHistory = jcrPredecessorsBuilder.toString().split(",");
-+ }
-+ else
-+ {
-+ predecessorsHistory = new String[]{jcrPredecessorsBuilder.toString()};
-+ }
-+
-+ String childVersionHistory = picture.getProperty("jcr:versionHistory").getValue().getString();
-+ String childBaseVersion = picture.getProperty("jcr:baseVersion").getValue().getString();
-+ Value[] childJcrPredecessors = picture.getProperty("jcr:predecessors").getValues();
-+ StringBuilder childJcrPredecessorsBuilder = new StringBuilder();
-+ String[] childPredecessorsHistory;
-+ for (Value value : childJcrPredecessors)
-+ {
-+ if (childJcrPredecessorsBuilder.length() > 0)
-+ childJcrPredecessorsBuilder.append(",");
-+ childJcrPredecessorsBuilder.append(value.getString());
-+ }
-+ if (childJcrPredecessorsBuilder.toString().indexOf(",") > -1)
-+ {
-+ childPredecessorsHistory = childJcrPredecessorsBuilder.toString().split(",");
-+ }
-+ else
-+ {
-+ childPredecessorsHistory = new String[]{childJcrPredecessorsBuilder.toString()};
-+ }
-+
-+ String chversionHistory = picture.getProperty("jcr:versionHistory").getValue().getString();
-+ String chbaseVersion = picture.getProperty("jcr:baseVersion").getValue().getString();
-+ Value[] chjcrPredecessors = picture.getProperty("jcr:predecessors").getValues();
-+ StringBuilder chjcrPredecessorsBuilder = new StringBuilder();
-+ String[] chpredecessorsHistory;
-+ for (Value value : chjcrPredecessors)
-+ {
-+ if (chjcrPredecessorsBuilder.length() > 0)
-+ chjcrPredecessorsBuilder.append(",");
-+ chjcrPredecessorsBuilder.append(value.getString());
-+ }
-+ if (chjcrPredecessorsBuilder.toString().indexOf(",") > -1)
-+ {
-+ chpredecessorsHistory = chjcrPredecessorsBuilder.toString().split(",");
-+ }
-+ else
-+ {
-+ chpredecessorsHistory = new String[]{chjcrPredecessorsBuilder.toString()};
-+ }
-+
-+ // remove node
-+ wc1.remove();
-+ session.save();
-+
-+ out.close();
-+ vhout.close();
-+
-+ // import
-+ session.importXML("/parent", new ByteArrayInputStream(out.toByteArray()),
-+ ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW, true);
-+
-+ session.save();
-+
-+ wc1 = (NodeImpl)session.getItem("/parent/wc1");
-+
-+ VersionHistoryImporter versionHistoryImporter =
-+ new VersionHistoryImporter((NodeImpl)wc1, new ByteArrayInputStream(vhout.toByteArray()), baseVersion,
-+ predecessorsHistory, versionHistory);
-+ versionHistoryImporter.doImport();
-+ session.save();
-+
-+ picture = wc1.getNode("medias").getNode("picture");
-+ assertTrue(picture.isNodeType("mix:versionable"));
-+ assertEquals(chversionHistory, picture.getProperty("jcr:versionHistory").getValue().getString());
-+ assertEquals(chbaseVersion, picture.getProperty("jcr:baseVersion").getValue().getString());
-+ assertEquals(chpredecessorsHistory[0], picture.getProperty("jcr:predecessors").getValues()[0].getString());
-+ assertTrue(picture.getProperty("jcr:isCheckedOut").getValue().getBoolean());
-+
-+ String value = picture.getNode("jcr:content").getProperty("jcr:data").getString();
-+ assertEquals("new data", value);
-+
-+ picture.restore("1", true);
-+ value = picture.getNode("jcr:content").getProperty("jcr:data").getString();
-+ assertEquals("bla bla", value);
-+
-+ picture.restore("2", true);
-+ value = picture.getNode("jcr:content").getProperty("jcr:data").getString();
-+ assertEquals("new data", value);
-+
-+ picture.checkout();
-+
-+ // make new version
-+ assertTrue(picture.getProperty("jcr:isCheckedOut").getValue().getBoolean());
-+ res = picture.getNode("jcr:content");
-+ res.setProperty("jcr:data", new ByteArrayInputStream("third".getBytes()));
-+ root.save();
-+
-+ picture.checkin();
-+ picture.checkout();
-+
-+ picture.restore("1", true);
-+ value = picture.getNode("jcr:content").getProperty("jcr:data").getString();
-+ assertEquals("bla bla", value);
-+
-+ picture.restore("3", true);
-+ value = picture.getNode("jcr:content").getProperty("jcr:data").getString();
-+ assertEquals("third", value);
-+ }
-+
-+ /**
-+ * Many mix:versionable subnodes.
-+ * @throws Exception
-+ */
-+ public void testImportVersionHistoryWithManyVersions() throws Exception
-+ {
-+
-+ // wc1/medias/picture
-+ Node wc1 = testRoot.addNode("wc1", "nt:folder");
-+ wc1.addMixin("mix:versionable");
-+ testRoot.save();
-+ Node medias = wc1.addNode("medias", "nt:folder");
-+
-+ Node picture = medias.addNode("picture", "nt:file");
-+ picture.addMixin("mix:versionable");
-+
-+ Node res = picture.addNode("jcr:content", "nt:resource");
-+ res.setProperty("jcr:lastModified", Calendar.getInstance());
-+ res.setProperty("jcr:data", new ByteArrayInputStream("bla bla".getBytes()));
-+ MimeTypeResolver mimres = new MimeTypeResolver();
-+ res.setProperty("jcr:mimeType", mimres.getMimeType("screen.txt"));
-+ root.save();
-+
-+ wc1.checkin();
-+ wc1.checkout();
-+
-+ wc1.checkin();
-+ wc1.checkout();
-+
-+ // export import version history and node
-+ ByteArrayOutputStream out = new ByteArrayOutputStream();
-+ session.exportSystemView("/parent/wc1", out, false, false, true);
-+
-+ ByteArrayOutputStream vhout = new ByteArrayOutputStream();
-+ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false, true);
-+
-+ // prepare data for version import
-+ String versionHistory = wc1.getProperty("jcr:versionHistory").getValue().getString();
-+ String baseVersion = wc1.getProperty("jcr:baseVersion").getValue().getString();
-+ Value[] jcrPredecessors = wc1.getProperty("jcr:predecessors").getValues();
-+ StringBuilder jcrPredecessorsBuilder = new StringBuilder();
-+ String[] predecessorsHistory;
-+ for (Value value : jcrPredecessors)
-+ {
-+ if (jcrPredecessorsBuilder.length() > 0)
-+ jcrPredecessorsBuilder.append(",");
-+ jcrPredecessorsBuilder.append(value.getString());
-+ }
-+ if (jcrPredecessorsBuilder.toString().indexOf(",") > -1)
-+ {
-+ predecessorsHistory = jcrPredecessorsBuilder.toString().split(",");
-+ }
-+ else
-+ {
-+ predecessorsHistory = new String[]{jcrPredecessorsBuilder.toString()};
-+ }
-+ // remove node
-+ wc1.remove();
-+ session.save();
-+
-+ out.close();
-+ vhout.close();
-+
-+ // import
-+ session.importXML("/parent", new ByteArrayInputStream(out.toByteArray()),
-+ ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW, true);
-+
-+ session.save();
-+
-+ wc1 = (NodeImpl)session.getItem("/parent/wc1");
-+ picture = wc1.getNode("medias").getNode("picture");
-+
-+ VersionHistoryImporter versionHistoryImporter =
-+ new VersionHistoryImporter((NodeImpl)wc1, new ByteArrayInputStream(vhout.toByteArray()), baseVersion,
-+ predecessorsHistory, versionHistory);
-+ versionHistoryImporter.doImport();
-+ session.save();
-+
-+ assertTrue(picture.isNodeType("mix:versionable"));
-+ }
-+
-+ public void testImportVersionHistoryNonSysWorkspace() throws Exception
-+ {
-+
-+ SessionImpl session = (SessionImpl)this.repository.login(credentials, "ws1");
-+
-+ Node root = session.getRootNode();
-+ Node testRoot = root.addNode("parent", "nt:folder");
-+ root.save();
-+
-+ try
-+ {
-+ // wc1/medias/picture
-+ Node wc1 = testRoot.addNode("wc1", "nt:folder");
-+ wc1.addMixin("mix:versionable");
-+ testRoot.save();
-+ Node medias = wc1.addNode("medias", "nt:folder");
-+
-+ Node picture = medias.addNode("picture", "nt:file");
-+ picture.addMixin("mix:versionable");
-+
-+ Node res = picture.addNode("jcr:content", "nt:resource");
-+ res.setProperty("jcr:lastModified", Calendar.getInstance());
-+ res.setProperty("jcr:data", new ByteArrayInputStream("bla bla".getBytes()));
-+ MimeTypeResolver mimres = new MimeTypeResolver();
-+ res.setProperty("jcr:mimeType", mimres.getMimeType("screen.txt"));
-+ root.save();
-+
-+ // make checkin/checkout a lot
-+
-+ wc1.checkin();
-+ wc1.checkout();
-+
-+ // export import version history and node
-+ ByteArrayOutputStream out = new ByteArrayOutputStream();
-+ session.exportSystemView("/parent/wc1", out, false, false, true);
-+
-+ ByteArrayOutputStream vhout = new ByteArrayOutputStream();
-+ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false, true);
-+
-+ // prepare data for version import
-+
-+ String versionHistory = wc1.getProperty("jcr:versionHistory").getValue().getString();
-+ String baseVersion = wc1.getProperty("jcr:baseVersion").getValue().getString();
-+ Value[] jcrPredecessors = wc1.getProperty("jcr:predecessors").getValues();
-+ StringBuilder jcrPredecessorsBuilder = new StringBuilder();
-+ String[] predecessorsHistory;
-+ for (Value value : jcrPredecessors)
-+ {
-+ if (jcrPredecessorsBuilder.length() > 0)
-+ jcrPredecessorsBuilder.append(",");
-+ jcrPredecessorsBuilder.append(value.getString());
-+ }
-+ if (jcrPredecessorsBuilder.toString().indexOf(",") > -1)
-+ {
-+ predecessorsHistory = jcrPredecessorsBuilder.toString().split(",");
-+ }
-+ else
-+ {
-+ predecessorsHistory = new String[]{jcrPredecessorsBuilder.toString()};
-+ }
-+
-+ // remove node
-+ wc1.remove();
-+ session.save();
-+
-+ out.close();
-+ vhout.close();
-+
-+ // import
-+ session.importXML("/parent", new ByteArrayInputStream(out.toByteArray()),
-+ ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW, true);
-+
-+ session.save();
-+
-+ wc1 = (NodeImpl)session.getItem("/parent/wc1");
-+
-+ VersionHistoryImporter versionHistoryImporter =
-+ new VersionHistoryImporter((NodeImpl)wc1, new ByteArrayInputStream(vhout.toByteArray()), baseVersion,
-+ predecessorsHistory, versionHistory);
-+ versionHistoryImporter.doImport();
-+ session.save();
-+
-+ picture = wc1.getNode("medias").getNode("picture");
-+ assertTrue(picture.isNodeType("mix:versionable"));
-+ }
-+ finally
-+ {
-+ testRoot.remove();
-+ root.save();
-+ session.logout();
-+ }
-+ }
-+
-+ public void testImportVersionHistoryFromFileWithChildVH() throws Exception
-+ {
-+
-+ String baseVersion = "397dad17c0a8004201c7b45ea76d4b1b";
-+ String[] predecessorsHistory = new String[]{"397dad17c0a8004201c7b45ea76d4b1b"};
-+ String versionHistory = "397dac8bc0a8004201729d052a305832";
-+
-+ String chbaseVersion = "397dac9ac0a8004201cde5722fec978e";
-+ String[] chpredecessorsHistory = new String[]{"397dac9ac0a8004201cde5722fec978e"};
-+ String chversionHistory = "397dac9ac0a8004200f37de3ace7b0ad";
-+
-+ InputStream is =
-+ TestImportVersionedChild.class.getResourceAsStream("/import-export/data_with_versioned_child.xml");
-+ InputStream vhis =
-+ TestImportVersionedChild.class.getResourceAsStream("/import-export/vh_with_versioned_child.xml");
-+
-+ // import
-+ session.importXML("/parent", is, ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW, true);
-+
-+ session.save();
-+
-+ Node wc1 = (NodeImpl)session.getItem("/parent/wc1");
-+
-+ VersionHistoryImporter versionHistoryImporter =
-+ new VersionHistoryImporter((NodeImpl)wc1, vhis, baseVersion, predecessorsHistory, versionHistory);
-+ versionHistoryImporter.doImport();
-+ session.save();
-+
+ Node picture = wc1.getNode("medias").getNode("picture");
+ assertTrue(picture.isNodeType("mix:versionable"));
-+ assertEquals(chversionHistory, picture.getProperty("jcr:versionHistory").getValue().getString());
-+ assertEquals(chbaseVersion, picture.getProperty("jcr:baseVersion").getValue().getString());
-+ assertEquals(chpredecessorsHistory[0], picture.getProperty("jcr:predecessors").getValues()[0].getString());
+
-+ }
-+
-+ public void testImportVersionHistoryFromFile() throws Exception
-+ {
-+
-+ String baseVersion = "0019980ec0a80042014313ff82e97096";
-+ String[] predecessorsHistory = new String[]{"0019980ec0a80042014313ff82e97096"};
-+ String versionHistory = "001997a1c0a80042007d98739b97e1bc";
-+
-+ String chbaseVersion = "001997b1c0a8004200d65c82779a2e13";
-+ String[] chpredecessorsHistory = new String[]{"001997b1c0a8004200d65c82779a2e13"};
-+ String chversionHistory = "001997b1c0a8004201d35a6fa36ef4e7";
-+
-+ InputStream is = TestImportVersionedChild.class.getResourceAsStream("/import-export/data.xml");
-+ InputStream vhis = TestImportVersionedChild.class.getResourceAsStream("/import-export/vh.xml");
-+
-+ // import
-+ session.importXML("/parent", is, ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW, true);
-+
-+ session.save();
-+
-+ Node wc1 = (NodeImpl)session.getItem("/parent/wc1");
-+
-+ VersionHistoryImporter versionHistoryImporter =
-+ new VersionHistoryImporter((NodeImpl)wc1, vhis, baseVersion, predecessorsHistory, versionHistory);
-+ versionHistoryImporter.doImport();
-+ session.save();
-+
-+ Node picture = wc1.getNode("medias").getNode("picture");
-+ assertTrue(picture.isNodeType("mix:versionable"));
-+ assertFalse(chversionHistory.equals(picture.getProperty("jcr:versionHistory").getValue().getString()));
-+ assertFalse(chbaseVersion.equals(picture.getProperty("jcr:baseVersion").getValue().getString()));
-+ assertFalse(chpredecessorsHistory[0].equals(picture.getProperty("jcr:predecessors").getValues()[0].getString()));
-+
-+ // try to remove picture, there must be RepositoryException
++ //try to remove wc1, there must be RepositoryException
+ try
+ {
+ wc1.remove();
@@ -1612,176 +296,11 @@
+ .getData()));
+ changesLogDelete.add(ItemState.createDeletedState(((PropertyImpl)vhPicture
+ .getProperty("jcr:childVersionHistory")).getData()));
-+
+ for (ItemState itemState : changesLogDelete.getAllStates())
+ {
+ dataManager.delete(itemState.getData(), itemState.getAncestorToSave());
+ }
-+
+ session.save();
+ }
+ }
+}
-\ No newline at end of file
-Index: exo.jcr.component.core/src/test/resources/import-export/data.xml
-===================================================================
---- exo.jcr.component.core/src/test/resources/import-export/data.xml (revision 0)
-+++ exo.jcr.component.core/src/test/resources/import-export/data.xml (revision 0)
-@@ -0,0 +1 @@
-+<?xml version="1.0" encoding="UTF-8"?><sv:node xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:test="http://www.apache.org/jackrabbit/test" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:exojcrtest="http://www.exoplatform.org/jcr/test/1.0" xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:publication="http://www.exoplatform.com/jcr/publication/1.1/" xmlns:exo="http://www.exoplatform.com/jcr/exo/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rma="http://www.rma.com/jcr/" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:metadata="http://www.exoplatform.com/jcr/metadata/1.1/" xmlns:rep="internal" sv:name="wc1"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:folder</sv:value></sv:property><sv:property sv:name="jcr:mixinTypes" sv:type="Name"><sv:value>mix:versionable</sv:value></sv:property><sv:property sv:na!
me="jcr:uuid" sv:type="String"><sv:value>00199791c0a800420106a227837ca02a</sv:value></sv:property><sv:property sv:name="jcr:baseVersion" sv:type="Reference"><sv:value>0019980ec0a80042014313ff82e97096</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-07T14:30:00.593+02:00</sv:value></sv:property><sv:property sv:name="jcr:isCheckedOut" sv:type="Boolean"><sv:value>true</sv:value></sv:property><sv:property sv:name="jcr:predecessors" sv:type="Reference"><sv:value>0019980ec0a80042014313ff82e97096</sv:value></sv:property><sv:property sv:name="jcr:versionHistory" sv:type="Reference"><sv:value>001997a1c0a80042007d98739b97e1bc</sv:value></sv:property><sv:node sv:name="medias"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:folder</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-07T14:30:00.625+02:00</sv:value></sv:property><sv:node sv:name="picture"><sv:property sv:name="jcr:primar!
yType" sv:type="Name"><sv:value>nt:file</sv:value></sv:propert!
y><sv:pr
operty sv:name="jcr:mixinTypes" sv:type="Name"><sv:value>mix:versionable</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>001997b1c0a8004201ab6f6dfdaf70f9</sv:value></sv:property><sv:property sv:name="jcr:baseVersion" sv:type="Reference"><sv:value>001997b1c0a8004200d65c82779a2e13</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-07T14:30:00.625+02:00</sv:value></sv:property><sv:property sv:name="jcr:isCheckedOut" sv:type="Boolean"><sv:value>true</sv:value></sv:property><sv:property sv:name="jcr:predecessors" sv:type="Reference"><sv:value>001997b1c0a8004200d65c82779a2e13</sv:value></sv:property><sv:property sv:name="jcr:versionHistory" sv:type="Reference"><sv:value>001997b1c0a8004201d35a6fa36ef4e7</sv:value></sv:property><sv:node sv:name="jcr:content"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:resource</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv!
:value>001997b1c0a800420058c90fbc883ce3</sv:value></sv:property><sv:property sv:name="jcr:data" sv:type="Binary"><sv:value>YmxhIGJsYQ==</sv:value></sv:property><sv:property sv:name="jcr:lastModified" sv:type="Date"><sv:value>2011-02-07T14:30:00.625+02:00</sv:value></sv:property><sv:property sv:name="jcr:mimeType" sv:type="String"><sv:value>text/plain</sv:value></sv:property></sv:node></sv:node></sv:node></sv:node>
-\ No newline at end of file
-Index: exo.jcr.component.core/src/test/resources/import-export/data_with_versioned_child.xml
-===================================================================
---- exo.jcr.component.core/src/test/resources/import-export/data_with_versioned_child.xml (revision 0)
-+++ exo.jcr.component.core/src/test/resources/import-export/data_with_versioned_child.xml (revision 0)
-@@ -0,0 +1 @@
-+<?xml version="1.0" encoding="UTF-8"?><sv:node xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:test="http://www.apache.org/jackrabbit/test" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:exojcrtest="http://www.exoplatform.org/jcr/test/1.0" xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:publication="http://www.exoplatform.com/jcr/publication/1.1/" xmlns:exo="http://www.exoplatform.com/jcr/exo/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rma="http://www.rma.com/jcr/" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:metadata="http://www.exoplatform.com/jcr/metadata/1.1/" xmlns:rep="internal" sv:name="wc1"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:folder</sv:value></sv:property><sv:property sv:name="jcr:mixinTypes" sv:type="Name"><sv:value>mix:versionable</sv:value></sv:property><sv:property sv:na!
me="jcr:uuid" sv:type="String"><sv:value>397dac7bc0a80042019e86f907ef0339</sv:value></sv:property><sv:property sv:name="jcr:baseVersion" sv:type="Reference"><sv:value>397dad17c0a8004201c7b45ea76d4b1b</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-18T17:57:40.859+02:00</sv:value></sv:property><sv:property sv:name="jcr:isCheckedOut" sv:type="Boolean"><sv:value>true</sv:value></sv:property><sv:property sv:name="jcr:predecessors" sv:type="Reference"><sv:value>397dad17c0a8004201c7b45ea76d4b1b</sv:value></sv:property><sv:property sv:name="jcr:versionHistory" sv:type="Reference"><sv:value>397dac8bc0a8004201729d052a305832</sv:value></sv:property><sv:node sv:name="medias"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:folder</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-18T17:57:40.890+02:00</sv:value></sv:property><sv:node sv:name="picture"><sv:property sv:name="jcr:primar!
yType" sv:type="Name"><sv:value>nt:file</sv:value></sv:propert!
y><sv:pr
operty sv:name="jcr:mixinTypes" sv:type="Name"><sv:value>mix:versionable</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>397dac9ac0a800420182f12f406ca1a3</sv:value></sv:property><sv:property sv:name="jcr:baseVersion" sv:type="Reference"><sv:value>397dac9ac0a8004201cde5722fec978e</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-18T17:57:40.890+02:00</sv:value></sv:property><sv:property sv:name="jcr:isCheckedOut" sv:type="Boolean"><sv:value>true</sv:value></sv:property><sv:property sv:name="jcr:predecessors" sv:type="Reference"><sv:value>397dac9ac0a8004201cde5722fec978e</sv:value></sv:property><sv:property sv:name="jcr:versionHistory" sv:type="Reference"><sv:value>397dac9ac0a8004200f37de3ace7b0ad</sv:value></sv:property><sv:node sv:name="jcr:content"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:resource</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv!
:value>397dac9ac0a8004201e6a413bc33907f</sv:value></sv:property><sv:property sv:name="jcr:data" sv:type="Binary"><sv:value>YmxhIGJsYQ==</sv:value></sv:property><sv:property sv:name="jcr:lastModified" sv:type="Date"><sv:value>2011-02-18T17:57:40.890+02:00</sv:value></sv:property><sv:property sv:name="jcr:mimeType" sv:type="String"><sv:value>text/plain</sv:value></sv:property></sv:node></sv:node></sv:node></sv:node>
-\ No newline at end of file
-Index: exo.jcr.component.core/src/test/resources/import-export/vh.xml
-===================================================================
---- exo.jcr.component.core/src/test/resources/import-export/vh.xml (revision 0)
-+++ exo.jcr.component.core/src/test/resources/import-export/vh.xml (revision 0)
-@@ -0,0 +1,136 @@
-+<?xml version="1.0" encoding="UTF-8"?>
-+<sv:node sv:name="001997a1c0a80042007d98739b97e1bc"
-+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
-+ xmlns:test="http://www.apache.org/jackrabbit/test"
-+ xmlns:sv="http://www.jcp.org/jcr/sv/1.0"
-+ xmlns:rma="http://www.rma.com/jcr/" xmlns:rep="internal"
-+ xmlns:publication="http://www.exoplatform.com/jcr/publication/1.1/"
-+ xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
-+ xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
-+ xmlns:metadata="http://www.exoplatform.com/jcr/metadata/1.1/"
-+ xmlns:jcr="http://www.jcp.org/jcr/1.0"
-+ xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions"
-+ xmlns:fn="http://www.w3.org/2005/xpath-functions"
-+ xmlns:exojcrtest="http://www.exoplatform.org/jcr/test/1.0"
-+ xmlns:exo="http://www.exoplatform.com/jcr/exo/1.0"
-+ xmlns:dc="http://purl.org/dc/elements/1.1/">
-+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
-+ <sv:value>nt:versionHistory</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:uuid" sv:type="String">
-+ <sv:value>001997a1c0a80042007d98739b97e1bc</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:versionableUuid" sv:type="String">
-+ <sv:value>00199791c0a800420106a227837ca02a</sv:value>
-+ </sv:property>
-+
-+ <sv:node sv:name="jcr:rootVersion">
-+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
-+ <sv:value>nt:version</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:mixinTypes" sv:type="Name">
-+ <sv:value>mix:referenceable</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:uuid" sv:type="String">
-+ <sv:value>001997a1c0a8004201a3af806d45ed9b</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:created" sv:type="Date">
-+ <sv:value>2011-02-07T14:30:00.609+02:00</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:successors" sv:type="Reference">
-+ <sv:value>0019980ec0a80042014313ff82e97096</sv:value>
-+ </sv:property>
-+ </sv:node>
-+
-+ <sv:node sv:name="1">
-+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
-+ <sv:value>nt:version</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:mixinTypes" sv:type="Name">
-+ <sv:value>mix:referenceable</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:uuid" sv:type="String">
-+ <sv:value>0019980ec0a80042014313ff82e97096</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:created" sv:type="Date">
-+ <sv:value>2011-02-07T14:30:00.718+02:00</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:predecessors" sv:type="Reference">
-+ <sv:value>001997a1c0a8004201a3af806d45ed9b</sv:value>
-+ </sv:property>
-+
-+ <sv:node sv:name="jcr:frozenNode">
-+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
-+ <sv:value>nt:frozenNode</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:mixinTypes" sv:type="Name">
-+ <sv:value>mix:referenceable</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:uuid" sv:type="String">
-+ <sv:value>0019980ec0a8004200d64e422bf86f49</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:created" sv:type="Date">
-+ <sv:value>2011-02-07T14:30:00.734+02:00</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:frozenMixinTypes" sv:type="Name">
-+ <sv:value>mix:versionable</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:frozenPrimaryType" sv:type="Name">
-+ <sv:value>nt:folder</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:frozenUuid" sv:type="String">
-+ <sv:value>00199791c0a800420106a227837ca02a</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:predecessors" sv:type="Reference">
-+ <sv:value>001997a1c0a8004201a3af806d45ed9b</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:versionHistory" sv:type="Reference">
-+ <sv:value>001997a1c0a80042007d98739b97e1bc</sv:value>
-+ </sv:property>
-+
-+ <sv:node sv:name="medias">
-+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
-+ <sv:value>nt:folder</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:created" sv:type="Date">
-+ <sv:value>2011-02-07T14:30:00.734+02:00</sv:value>
-+ </sv:property>
-+
-+ <sv:node sv:name="picture">
-+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
-+ <sv:value>nt:versionedChild</sv:value>
-+ </sv:property>
-+
-+ <sv:property sv:name="jcr:childVersionHistory" sv:type="Reference">
-+ <sv:value>001997b1c0a8004201d35a6fa36ef4e7</sv:value>
-+ </sv:property>
-+ </sv:node>
-+ </sv:node>
-+ </sv:node>
-+ </sv:node>
-+
-+ <sv:node sv:name="jcr:versionLabels">
-+ <sv:property sv:name="jcr:primaryType" sv:type="Name">
-+ <sv:value>nt:versionLabels</sv:value>
-+ </sv:property>
-+ </sv:node>
-+</sv:node>
-Index: exo.jcr.component.core/src/test/resources/import-export/vh_with_versioned_child.xml
-===================================================================
---- exo.jcr.component.core/src/test/resources/import-export/vh_with_versioned_child.xml (revision 0)
-+++ exo.jcr.component.core/src/test/resources/import-export/vh_with_versioned_child.xml (revision 0)
-@@ -0,0 +1 @@
-+<?xml version="1.0" encoding="UTF-8"?><sv:node xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:test="http://www.apache.org/jackrabbit/test" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:exojcrtest="http://www.exoplatform.org/jcr/test/1.0" xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:publication="http://www.exoplatform.com/jcr/publication/1.1/" xmlns:exo="http://www.exoplatform.com/jcr/exo/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rma="http://www.rma.com/jcr/" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:metadata="http://www.exoplatform.com/jcr/metadata/1.1/" xmlns:rep="internal" sv:name="397dac8bc0a8004201729d052a305832"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:versionHistory</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>397dac8bc0a8004201729d052!
a305832</sv:value></sv:property><sv:property sv:name="jcr:versionableUuid" sv:type="String"><sv:value>397dac7bc0a80042019e86f907ef0339</sv:value></sv:property><sv:node sv:name="jcr:rootVersion"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:version</sv:value></sv:property><sv:property sv:name="jcr:mixinTypes" sv:type="Name"><sv:value>mix:referenceable</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>397dac8bc0a8004201a2e53eb73949bd</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-18T17:57:40.875+02:00</sv:value></sv:property><sv:property sv:name="jcr:successors" sv:type="Reference"><sv:value>397dad17c0a8004201c7b45ea76d4b1b</sv:value></sv:property></sv:node><sv:node sv:name="1"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:version</sv:value></sv:property><sv:property sv:name="jcr:mixinTypes" sv:type="Name"><sv:value>mix:referenceable</sv:value></sv:property>!
<sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>397!
dad17c0a
8004201c7b45ea76d4b1b</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-18T17:57:41.031+02:00</sv:value></sv:property><sv:property sv:name="jcr:predecessors" sv:type="Reference"><sv:value>397dac8bc0a8004201a2e53eb73949bd</sv:value></sv:property><sv:node sv:name="jcr:frozenNode"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:frozenNode</sv:value></sv:property><sv:property sv:name="jcr:mixinTypes" sv:type="Name"><sv:value>mix:referenceable</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>397dad27c0a800420029031c7e421afa</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-18T17:57:41.031+02:00</sv:value></sv:property><sv:property sv:name="jcr:frozenMixinTypes" sv:type="Name"><sv:value>mix:versionable</sv:value></sv:property><sv:property sv:name="jcr:frozenPrimaryType" sv:type="Name"><sv:value>nt:folder</sv:value></sv:property><sv:property sv:na!
me="jcr:frozenUuid" sv:type="String"><sv:value>397dac7bc0a80042019e86f907ef0339</sv:value></sv:property><sv:property sv:name="jcr:predecessors" sv:type="Reference"><sv:value>397dac8bc0a8004201a2e53eb73949bd</sv:value></sv:property><sv:property sv:name="jcr:versionHistory" sv:type="Reference"><sv:value>397dac8bc0a8004201729d052a305832</sv:value></sv:property><sv:node sv:name="medias"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:folder</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-18T17:57:41.031+02:00</sv:value></sv:property><sv:node sv:name="picture"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:versionedChild</sv:value></sv:property><sv:property sv:name="jcr:childVersionHistory" sv:type="Reference"><sv:value>397dac9ac0a8004200f37de3ace7b0ad</sv:value></sv:property><sv:versionhistory sv:name="397dac9ac0a8004200f37de3ace7b0ad"><sv:node sv:name="397dac9ac0a8004200f37de3ace7b0ad"><sv:prope!
rty sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:vers!
ionHisto
ry</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>397dac9ac0a8004200f37de3ace7b0ad</sv:value></sv:property><sv:property sv:name="jcr:versionableUuid" sv:type="String"><sv:value>397dac9ac0a800420182f12f406ca1a3</sv:value></sv:property><sv:node sv:name="jcr:rootVersion"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:version</sv:value></sv:property><sv:property sv:name="jcr:mixinTypes" sv:type="Name"><sv:value>mix:referenceable</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>397dac9ac0a8004201cde5722fec978e</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-18T17:57:40.890+02:00</sv:value></sv:property></sv:node><sv:node sv:name="jcr:versionLabels"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:versionLabels</sv:value></sv:property></sv:node></sv:node></sv:versionhistory></sv:node></sv:node></sv:node></sv:node><sv:node sv:name="!
jcr:versionLabels"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:versionLabels</sv:value></sv:property></sv:node></sv:node>
-\ No newline at end of file
13 years, 2 months
exo-jcr SVN: r4001 - ws/trunk/packaging/module/src/main/javascript.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-02-22 02:57:39 -0500 (Tue, 22 Feb 2011)
New Revision: 4001
Modified:
ws/trunk/packaging/module/src/main/javascript/ws.packaging.module.js
Log:
EXOJCR-1201: Js file cleaned
Modified: ws/trunk/packaging/module/src/main/javascript/ws.packaging.module.js
===================================================================
--- ws/trunk/packaging/module/src/main/javascript/ws.packaging.module.js 2011-02-21 19:17:43 UTC (rev 4000)
+++ ws/trunk/packaging/module/src/main/javascript/ws.packaging.module.js 2011-02-22 07:57:39 UTC (rev 4001)
@@ -4,22 +4,21 @@
function getModule(params) {
var module = new Module();
- module.version = "${project.version}" ;//
- module.relativeMavenRepo = "org/exoplatform/ws" ;
- module.relativeSRCRepo = "ws/trunk" ;
- module.name = "ws" ;
+ module.version = "${project.version}";
+ module.relativeMavenRepo = "org/exoplatform/ws";
+ module.relativeSRCRepo = "ws/trunk";
+ module.name = "ws";
module.commons =
new Project("org.exoplatform.ws", "exo.ws.commons", "jar", module.version);
module.soap_cxf_jsr181 =
new Project("org.exoplatform.ws", "exo.ws.soap.cxf.jsr181", "jar", module.version).
- addDependency(new Project("org.apache.cxf", "cxf-rt-transports-http", "jar", "2.1.2")) ;
+ addDependency(new Project("org.apache.cxf", "cxf-rt-transports-http", "jar", "2.1.2"));
module.frameworks = {};
module.frameworks.servlet =
- new Project("org.exoplatform.ws", "exo.ws.frameworks.servlet", "jar", module.version)
- //.addDependency(new Project("javax.servlet", "servlet-api", "jar", "2.4"));
+ new Project("org.exoplatform.ws", "exo.ws.frameworks.servlet", "jar", module.version);
module.frameworks.json =
new Project("org.exoplatform.ws", "exo.ws.frameworks.json", "jar", module.version);
@@ -38,21 +37,16 @@
addDependency(new Project("org.exoplatform.ws", "exo.ws.rest.ext", "jar", module.version)).
addDependency(new Project("javax.annotation", "jsr250-api", "jar", "1.0")).
addDependency(new Project("javax.ws.rs", "jsr311-api", "jar", "1.0")).
- addDependency(new Project("commons-chain", "commons-chain", "jar", "1.0")) .
-// addDependency(new Project("javax.xml.parsers", "jaxp-api", "jar", "1.4")) .
- addDependency(new Project("javax.xml.bind", "jaxb-api", "jar", "2.1")) .
- //addDependency(new Project("com.sun.xml.bind", "jaxb-impl", "jar", "2.1.7")) .
-// addDependency(new Project("com.sun.xml.parsers", "jaxp-ri", "jar", "1.4")) .
- //addDependency(new Project("org.jvnet.jaxb2.maven2", "maven-jaxb2-plugin", "jar", "0.1"));
+ addDependency(new Project("commons-chain", "commons-chain", "jar", "1.0")).
+ addDependency(new Project("javax.xml.bind", "jaxb-api", "jar", "2.1"));
module.soap = {};
module.soap.jsr181 =
new Project("org.exoplatform.ws", "exo.ws.soap.xfire.jsr181", "jar", module.version).
- addDependency(new Project("picocontainer", "picocontainer", "jar", "1.1")) .
- addDependency(new Project("org.codehaus.xfire", "xfire-jsr181-api", "jar", "1.0")) .
- addDependency(new Project("org.codehaus.xfire", "xfire-all", "jar", "1.2.6")) .
- // addDependency(new Project("stax", "stax-api", "jar", "1.0")) .
- addDependency(new Project("wsdl4j", "wsdl4j", "jar", "1.6.1")) .
+ addDependency(new Project("picocontainer", "picocontainer", "jar", "1.1")).
+ addDependency(new Project("org.codehaus.xfire", "xfire-jsr181-api", "jar", "1.0")).
+ addDependency(new Project("org.codehaus.xfire", "xfire-all", "jar", "1.2.6")).
+ addDependency(new Project("wsdl4j", "wsdl4j", "jar", "1.6.1")).
addDependency(new Project("jdom", "jdom", "jar", "1.0"));
return module;
13 years, 2 months
exo-jcr SVN: r4000 - kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/monitor/jvm and 1 other directory.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-02-21 14:17:43 -0500 (Mon, 21 Feb 2011)
New Revision: 4000
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/kernel/container-configuration.xml
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/monitor/jvm/J2EEServerInfo.java
Log:
EXOJCR-1160: GlassFish home directory is set to ${com.sun.aas.instanceRoot}
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/kernel/container-configuration.xml
===================================================================
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/kernel/container-configuration.xml 2011-02-21 18:34:50 UTC (rev 3999)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/kernel/container-configuration.xml 2011-02-21 19:17:43 UTC (rev 4000)
@@ -176,7 +176,47 @@
<note>
<para><emphasis>$AS_HOME</emphasis> - application server home
directory, or <emphasis>user.dir</emphasis> JVM system property
- value in case of Java Standalone application.</para>
+ value in case of Java Standalone application. The application server
+ home is:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>For <envar>Jonas</envar>, the value of the variable
+ <emphasis>${jonas.base}.</emphasis></para>
+ </listitem>
+
+ <listitem>
+ <para>For <envar>Jetty</envar>, the value of the variable
+ <emphasis>${jetty.home}.</emphasis></para>
+ </listitem>
+
+ <listitem>
+ <para>For <envar>Websphere</envar>, the value of the variable
+ <emphasis>${was.install.root}.</emphasis></para>
+ </listitem>
+
+ <listitem>
+ <para>For <envar>Weblogic</envar>, the value of the variable
+ <emphasis>${wls.home}</emphasis>.</para>
+ </listitem>
+
+ <listitem>
+ <para>For <envar>Glassfish</envar>, the value of the variable
+ <emphasis>${com.sun.aas.instanceRoot}</emphasis>.</para>
+ </listitem>
+
+ <listitem>
+ <para>For <envar>Tomcat</envar>, the value of the variable
+ <emphasis>${catalina.home}</emphasis>.</para>
+ </listitem>
+
+ <listitem>
+ <para>For <envar>JBoss AS</envar>, the value of the variable
+ <emphasis>${jboss.server.config.url}</emphasis> if the exo-conf
+ directory can be found there otherwise it will be the value of
+ the variable <emphasis>${jboss.home.dir}</emphasis>.</para>
+ </listitem>
+ </itemizedlist>
</note>
<note>
@@ -208,14 +248,6 @@
</note>
<note>
- <para>Under JBoss application server <emphasis>exo-conf</emphasis>
- will be looked up in directory described by JBoss System property
- <emphasis>jboss.server.config.url</emphasis>. If the property is not
- found or empty <emphasis>$AS_HOME/exo-conf</emphasis> will be
- asked.</para>
- </note>
-
- <note>
<para>The search looks for a configuration file in each JAR/WAR
available from the classpath using the current thread context
classloader. During the search these configurations are added to a
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/monitor/jvm/J2EEServerInfo.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/monitor/jvm/J2EEServerInfo.java 2011-02-21 18:34:50 UTC (rev 3999)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/monitor/jvm/J2EEServerInfo.java 2011-02-21 19:17:43 UTC (rev 4000)
@@ -76,6 +76,7 @@
String jettyHome = PrivilegedSystemHelper.getProperty("jetty.home");
String websphereHome = PrivilegedSystemHelper.getProperty("was.install.root");
String weblogicHome = PrivilegedSystemHelper.getProperty("wls.home");
+ String glassfishHome = PrivilegedSystemHelper.getProperty("com.sun.aas.instanceRoot");
String catalinaHome = PrivilegedSystemHelper.getProperty("catalina.home");
String testHome = PrivilegedSystemHelper.getProperty("maven.exoplatform.dir");
@@ -85,7 +86,6 @@
{
serverName_ = "jonas";
serverHome_ = jonasHome;
- exoConfDir_ = serverHome_ + "/" + confDirName;
}
else if (jbossHome != null)
{
@@ -104,11 +104,8 @@
catch (Throwable e)
{
// don't care about it
- exoConfDir_ = serverHome_ + "/" + confDirName;
}
}
- else
- exoConfDir_ = serverHome_ + "/" + confDirName;
//
try
@@ -134,38 +131,41 @@
{
serverName_ = "jetty";
serverHome_ = jettyHome;
- exoConfDir_ = serverHome_ + "/" + confDirName;
}
else if (websphereHome != null)
{
serverName_ = "websphere";
serverHome_ = websphereHome;
- exoConfDir_ = serverHome_ + "/" + confDirName;
}
else if (weblogicHome != null)
{
serverName_ = "weblogic";
serverHome_ = weblogicHome;
- exoConfDir_ = serverHome_ + "/" + confDirName;
- // Catalina has to be processed at the end as other servers may embed it
}
+ else if (glassfishHome != null)
+ {
+ serverName_ = "glassfish";
+ serverHome_ = glassfishHome;
+ }
else if (catalinaHome != null)
{
+ // Catalina has to be processed at the end as other servers may embed it
serverName_ = "tomcat";
serverHome_ = catalinaHome;
- exoConfDir_ = serverHome_ + "/" + confDirName;
}
else if (testHome != null)
{
serverName_ = "test";
serverHome_ = testHome;
- exoConfDir_ = serverHome_ + "/" + confDirName;
}
else
{
// throw new UnsupportedOperationException("unknown server platform") ;
serverName_ = "standalone";
serverHome_ = PrivilegedSystemHelper.getProperty("user.dir");
+ }
+ if (exoConfDir_ == null)
+ {
exoConfDir_ = serverHome_ + "/" + confDirName;
}
if (mbeanServer == null)
13 years, 2 months
exo-jcr SVN: r3999 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-02-21 13:34:50 -0500 (Mon, 21 Feb 2011)
New Revision: 3999
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheKey.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesId.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePropsId.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheQPath.java
Log:
EXOJCR-970: Ensure the collocation of the data related to the same node when it is possible
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheKey.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheKey.java 2011-02-21 16:20:08 UTC (rev 3998)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheKey.java 2011-02-21 18:34:50 UTC (rev 3999)
@@ -43,6 +43,12 @@
this.hash = id.hashCode();
}
+ CacheKey(String id, int hash)
+ {
+ this.id = id;
+ this.hash = hash;
+ }
+
/**
* {@inheritDoc}
*/
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesId.java 2011-02-21 16:20:08 UTC (rev 3998)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheNodesId.java 2011-02-21 18:34:50 UTC (rev 3999)
@@ -31,11 +31,9 @@
public class CacheNodesId extends CacheKey
{
- public static final String PREFIX = "N";
-
CacheNodesId(String id)
{
- super(PREFIX + id);
+ super(id);
}
@Override
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePropsId.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePropsId.java 2011-02-21 16:20:08 UTC (rev 3998)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CachePropsId.java 2011-02-21 18:34:50 UTC (rev 3999)
@@ -31,11 +31,9 @@
public class CachePropsId extends CacheKey
{
- public static final String PREFIX = "P";
-
CachePropsId(String id)
{
- super(PREFIX + id);
+ super(id);
}
@Override
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheQPath.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheQPath.java 2011-02-21 16:20:08 UTC (rev 3998)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/infinispan/CacheQPath.java 2011-02-21 18:34:50 UTC (rev 3999)
@@ -35,28 +35,15 @@
*/
class CacheQPath extends CacheKey
{
-
- private final String parentId;
-
- private final QPath path;
-
CacheQPath(String parentId, QPath path, ItemType itemType)
{
- super(new StringBuilder().append(parentId != null ? parentId : Constants.ROOT_PARENT_UUID)
- .append(path.getEntries()[path.getEntries().length - 1].getAsString(true)).append(itemType.toString())
- .toString());
-
- this.parentId = parentId;
- this.path = path;
+ this(parentId, path.getEntries()[path.getEntries().length - 1], itemType);
}
CacheQPath(String parentId, QPathEntry name, ItemType itemType)
{
super(new StringBuilder().append(parentId != null ? parentId : Constants.ROOT_PARENT_UUID)
- .append(name.getAsString(true)).append(itemType.toString()).toString());
-
- this.parentId = parentId;
- this.path = null;
+ .append(name.getAsString(true)).append(itemType.toString()).toString(), parentId.hashCode());
}
@Override
@@ -65,23 +52,11 @@
if (obj instanceof CacheQPath)
{
CacheQPath cacheQPath = (CacheQPath)obj;
- return (cacheQPath.hashCode() == hash && cacheQPath.id.equals(id));
+ return (cacheQPath.hash == hash && cacheQPath.id.equals(id));
}
else
{
return false;
}
}
-
- @Override
- public String toString()
- {
- final StringBuilder s = new StringBuilder();
- s.append((this.parentId != null ? this.parentId : Constants.ROOT_PARENT_UUID));
- s.append((path != null ? path.getEntries()[path.getEntries().length - 1] : "null"));
- s.append(", ");
- s.append(id);
- return s.toString();
- }
-
}
13 years, 2 months
exo-jcr SVN: r3998 - jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1584.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2011-02-21 11:20:08 -0500 (Mon, 21 Feb 2011)
New Revision: 3998
Modified:
jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1584/JCR-1584.patch
Log:
JCR-1584: patch updated - SessionImpl.exportSysView do not exports child versions by default
Modified: jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1584/JCR-1584.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1584/JCR-1584.patch 2011-02-21 08:52:16 UTC (rev 3997)
+++ jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1584/JCR-1584.patch 2011-02-21 16:20:08 UTC (rev 3998)
@@ -39,24 +39,45 @@
===================================================================
--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java (revision 3980)
+++ exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java (working copy)
-@@ -403,11 +403,15 @@
+@@ -393,6 +393,12 @@
+ public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse)
+ throws IOException, PathNotFoundException, RepositoryException
+ {
++ exportSystemView(absPath, out, skipBinary, noRecurse, false);
++ }
++
++ public void exportSystemView(String absPath, OutputStream out, boolean skipBinary, boolean noRecurse,
++ boolean exportChildVersionHisotry) throws IOException, PathNotFoundException, RepositoryException
++ {
+ LocationFactory factory = new LocationFactory(((NamespaceRegistryImpl)repository.getNamespaceRegistry()));
+
+ WorkspaceEntry wsConfig = (WorkspaceEntry)container.getComponentInstanceOfType(WorkspaceEntry.class);
+@@ -403,11 +409,12 @@
ValueFactoryImpl valueFactoryImpl = new ValueFactoryImpl(factory, wsConfig, cleanerHolder);
try
{
+ JCRPath srcNodePath = getLocationFactory().parseAbsPath(absPath);
-+
-+ boolean isVersionHistoryExport =
-+ srcNodePath.getInternalPath().isDescendantOf(Constants.JCR_VERSION_STORAGE_PATH);
-+
BaseXmlExporter exporter =
new ExportImportFactory().getExportVisitor(XmlMapping.SYSVIEW, out, skipBinary, noRecurse,
- getTransientNodesManager(), repository.getNamespaceRegistry(), valueFactoryImpl);
-+ isVersionHistoryExport, getTransientNodesManager(), repository.getNamespaceRegistry(), valueFactoryImpl);
++ exportChildVersionHisotry, getTransientNodesManager(), repository.getNamespaceRegistry(),
++ valueFactoryImpl);
- JCRPath srcNodePath = getLocationFactory().parseAbsPath(absPath);
ItemData srcItemData = dataManager.getItemData(srcNodePath.getInternalPath());
if (srcItemData == null)
+@@ -872,8 +879,8 @@
+ + destAbsPath);
+ }
+
+- destParentNode.validateChildNode(destNodePath.getName().getInternalName(),
+- ((NodeTypeImpl)srcNode.getPrimaryNodeType()).getQName());
++ destParentNode.validateChildNode(destNodePath.getName().getInternalName(), ((NodeTypeImpl)srcNode
++ .getPrimaryNodeType()).getQName());
+
+ // Check for node with destAbsPath name in session
+ NodeImpl destNode =
Index: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/ExportImportFactory.java
===================================================================
--- exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/ExportImportFactory.java (revision 3980)
@@ -285,6 +306,33 @@
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
import org.exoplatform.services.jcr.impl.dataflow.ValueDataConvertor;
import org.exoplatform.services.jcr.impl.xml.DecodedValue;
+@@ -76,7 +79,7 @@
+ private static Log log = ExoLogger.getLogger("exo.jcr.component.core.SystemViewImporter");
+
+ protected PropertyInfo propertyInfo = new PropertyInfo();
+-
++
+ protected Map<String, NodePropertiesInfo> mapNodePropertiesInfo = new HashMap<String, NodePropertiesInfo>();
+
+ /**
+@@ -156,13 +159,13 @@
+ if (propertyData != null)
+ {
+ changesLog.add(new ItemState(propertyData, ItemState.ADDED, true, getAncestorToSave()));
+-
++
+ ImportNodeData currentNodeInfo = (ImportNodeData)getParent();
+-
++
+ NodePropertiesInfo currentNodePropertiesInfo = mapNodePropertiesInfo.get(currentNodeInfo.getIdentifier());
+-
++
+ currentNodePropertiesInfo.addProperty(propertyData);
+- }
++ }
+ }
+ else if (Constants.SV_VALUE_NAME.equals(elementName))
+ {
@@ -171,6 +174,11 @@
DecodedValue curPropValue = propertyInfo.getValues().get(propertyInfo.getValues().size() - 1);
curPropValue.setComplete(true);
@@ -297,7 +345,16 @@
else
{
throw new RepositoryException("invalid element in system view xml document: " + localName);
-@@ -260,6 +268,27 @@
+@@ -218,7 +226,7 @@
+ newNodeData.setIdentifier(IdGenerator.generate());
+
+ changesLog.add(new ItemState(newNodeData, ItemState.ADDED, true, getAncestorToSave()));
+-
++
+ mapNodePropertiesInfo.put(newNodeData.getIdentifier(), new NodePropertiesInfo(newNodeData));
+
+ tree.push(newNodeData);
+@@ -260,6 +268,36 @@
propertyInfo.getValues().add(new DecodedValue());
}
@@ -321,11 +378,20 @@
+ changesLog.addAll(rv.getRemovedStates());
+ }
+ tree.push(versionStorage);
++
++ List<String> list = (List<String>)context.get(ContentImporter.LIST_OF_IMPORTED_VERSION_HISTORIES);
++ if (list == null)
++ {
++ list = new ArrayList<String>();
++ }
++ list.add(svName);
++ context.put(ContentImporter.LIST_OF_IMPORTED_VERSION_HISTORIES, list);
++
+ }
else
{
throw new RepositoryException("Unknown element " + elementName.getAsString());
-@@ -306,9 +335,27 @@
+@@ -306,16 +344,15 @@
private void endNode() throws RepositoryException
{
ImportNodeData currentNodeInfo = (ImportNodeData)tree.pop();
@@ -333,30 +399,87 @@
- NodePropertiesInfo currentNodePropertiesInfo = mapNodePropertiesInfo.get(currentNodeInfo.getIdentifier());
-
-+ //check is it child nodes version history
-+
-+ if (!tree.isEmpty())
-+ {
-+ NodeData parentNodeData = tree.pop();
-+ if (!tree.isEmpty() && parentNodeData.getIdentifier().equals(Constants.VERSIONSTORAGE_UUID)
-+ && tree.peek().getPrimaryTypeName().equals(Constants.NT_VERSIONEDCHILD))
-+ {
-+ List<String> list = (List<String>)context.get(ContentImporter.LIST_OF_IMPORTED_VERSION_HISTORIES);
-+ if (list == null)
-+ {
-+ list = new ArrayList<String>();
-+ }
-+ list.add(currentNodeInfo.getQName().getName());
-+ context.put(ContentImporter.LIST_OF_IMPORTED_VERSION_HISTORIES, list);
-+ }
-+ tree.push(parentNodeData);
-+ }
-+
if (currentNodePropertiesInfo != null)
{
checkProperties(currentNodePropertiesInfo);
-@@ -418,9 +465,16 @@
+ }
+-
++
+ mapNodePropertiesInfo.remove(currentNodeInfo.getIdentifier());
+-
++
+ currentNodeInfo.setMixinTypeNames(currentNodeInfo.getMixinTypeNames());
+
+ if (currentNodeInfo.isMixVersionable())
+@@ -326,7 +363,7 @@
+ currentNodeInfo.setACL(initAcl(currentNodeInfo.getACL(), currentNodeInfo.isExoOwneable(), currentNodeInfo
+ .isExoPrivilegeable(), currentNodeInfo.getExoOwner(), currentNodeInfo.getExoPrivileges()));
+ }
+-
++
+ /**
+ * Checking priopertis if nodetype is nt:frozennode
+ *
+@@ -339,7 +376,7 @@
+ private void checkProperties(NodePropertiesInfo currentNodePropertiesInfo) throws RepositoryException
+ {
+ if (currentNodePropertiesInfo.getNode().getQPath().isDescendantOf(Constants.JCR_VERSION_STORAGE_PATH)
+- && currentNodePropertiesInfo.getNode().getPrimaryTypeName().equals(Constants.NT_FROZENNODE))
++ && currentNodePropertiesInfo.getNode().getPrimaryTypeName().equals(Constants.NT_FROZENNODE))
{
+ InternalQName fptName = null;
+ List<InternalQName> fmtNames = new ArrayList<InternalQName>();
+@@ -351,13 +388,16 @@
+ {
+ if (propertyData.getQName().equals(Constants.JCR_FROZENPRIMARYTYPE))
+ {
+- fptName = InternalQName.parse(new String(propertyData.getValues().get(0).getAsByteArray(), Constants.DEFAULT_ENCODING));
++ fptName =
++ InternalQName.parse(new String(propertyData.getValues().get(0).getAsByteArray(),
++ Constants.DEFAULT_ENCODING));
+ }
+ else if (propertyData.getQName().equals(Constants.JCR_FROZENMIXINTYPES))
+ {
+ for (ValueData valueData : propertyData.getValues())
+ {
+- fmtNames.add(InternalQName.parse(new String(valueData.getAsByteArray(), Constants.DEFAULT_ENCODING)));
++ fmtNames.add(InternalQName
++ .parse(new String(valueData.getAsByteArray(), Constants.DEFAULT_ENCODING)));
+ }
+ }
+ }
+@@ -374,20 +414,22 @@
+ {
+ throw new RepositoryException(e.getMessage(), e);
+ }
+-
++
+ InternalQName nodePrimaryTypeName = currentNodePropertiesInfo.getNode().getPrimaryTypeName();
+ InternalQName[] nodeMixinTypeName = currentNodePropertiesInfo.getNode().getMixinTypeNames();
+
+ for (ImportPropertyData propertyData : currentNodePropertiesInfo.getProperties())
+ {
+- PropertyDefinitionDatas defs = nodeTypeDataManager.getPropertyDefinitions(propertyData.getQName(), nodePrimaryTypeName, nodeMixinTypeName);
+-
+- if (defs == null || (defs != null && defs.getAnyDefinition().isResidualSet()))
++ PropertyDefinitionDatas defs =
++ nodeTypeDataManager.getPropertyDefinitions(propertyData.getQName(), nodePrimaryTypeName,
++ nodeMixinTypeName);
++
++ if (defs == null || (defs != null && defs.getAnyDefinition().isResidualSet()))
+ {
+ PropertyDefinitionDatas vhdefs =
+- nodeTypeDataManager.getPropertyDefinitions(propertyData.getQName(), fptName, fmtNames
+- .toArray(new InternalQName[fmtNames.size()]));
+-
++ nodeTypeDataManager.getPropertyDefinitions(propertyData.getQName(), fptName, fmtNames
++ .toArray(new InternalQName[fmtNames.size()]));
++
+ if (vhdefs != null)
+ {
+ boolean isMultivalue = (vhdefs.getDefinition(true) != null ? true : false);
+@@ -418,9 +460,16 @@
+ {
NodeData parentNodeData = getParent();
// nodeTypeDataManager.findChildNodeDefinition(primaryTypeName,)
- if (!nodeTypeDataManager.isChildNodePrimaryTypeAllowed(primaryTypeName, parentNodeData.getPrimaryTypeName(),
@@ -374,7 +497,7 @@
throw new ConstraintViolationException("Can't add node " + nodeData.getQName().getAsString() + " to "
+ parentNodeData.getQPath().getAsString() + " node type " + sName
+ " is not allowed as child's node type for parent node type "
-@@ -555,7 +609,7 @@
+@@ -555,7 +604,7 @@
propertyData =
new ImportPropertyData(QPath.makeChildPath(currentNodeInfo.getQPath(), propertyInfo.getName()), propertyInfo
.getIndentifer(), 0, propertyInfo.getType(), currentNodeInfo.getIdentifier(), false);
@@ -383,7 +506,16 @@
if (currentNodeInfo.getQPath().isDescendantOf(Constants.JCR_VERSION_STORAGE_PATH))
{
propertyData.setValue(new TransientValueData(propertyInfo.getValues().get(0).toString()));
-@@ -676,4 +730,26 @@
+@@ -566,7 +615,7 @@
+ }
+
+ tree.push(currentNodeInfo);
+-
++
+ mapNodePropertiesInfo.put(currentNodeInfo.getIdentifier(), new NodePropertiesInfo(currentNodeInfo));
+
+ return propertyData;
+@@ -676,4 +725,26 @@
JCRName jname = locationFactory.createJCRName(name);
return attributes.get(jname.getAsString());
}
@@ -446,7 +578,16 @@
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
-@@ -176,23 +184,34 @@
+@@ -144,7 +152,7 @@
+ {
+ uuid = versionableNode.getUUID();
+ path = versionableNode.getVersionHistory().getParent().getPath();
+- LOG.info("Started: Import version history for node wiht path=" + path + " and UUID=" + uuid);
++ LOG.info("Started: Import version history for node with path=" + path + " and UUID=" + uuid);
+
+ NodeData versionable = (NodeData)versionableNode.getData();
+ // ----- VERSIONABLE properties -----
+@@ -176,32 +184,43 @@
changesLog.add(ItemState.createAddedState(bv));
changesLog.add(ItemState.createAddedState(pd));
// remove version properties to avoid referential integrety check
@@ -476,7 +617,8 @@
+ userSession.getWorkspace().importXML(path, versionHistoryStream, 0, context);
userSession.save();
- LOG.info("Completed: Import version history for node wiht path=" + path + " and UUID=" + uuid);
+- LOG.info("Completed: Import version history for node wiht path=" + path + " and UUID=" + uuid);
++ LOG.info("Completed: Import version history for node with path=" + path + " and UUID=" + uuid);
+
+ // fetch list of imported child nodes versions
+ List<String> versionUuids = (List<String>)context.get(ContentImporter.LIST_OF_IMPORTED_VERSION_HISTORIES);
@@ -487,6 +629,17 @@
}
catch (RepositoryException exception)
{
+- LOG.error("Failed: Import version history for node wiht path=" + path + " and UUID=" + uuid, exception);
++ LOG.error("Failed: Import version history for node with path=" + path + " and UUID=" + uuid, exception);
+ throw new RepositoryException(exception);
+ }
+ catch (IOException exception)
+ {
+- LOG.error("Failed: Import version history for node wiht path=" + path + " and UUID=" + uuid, exception);
++ LOG.error("Failed: Import version history for node with path=" + path + " and UUID=" + uuid, exception);
+ IOException newException = new IOException();
+ newException.initCause(exception);
+ throw newException;
@@ -209,6 +228,120 @@
}
@@ -598,7 +751,7 @@
+ // remove version history
+ dataKeeper.save(changesLog);
+ userSession.save();
-+ LOG.info("Completed: Import version history for node wiht path=" + versionedChild.getQPath().getAsString()
++ LOG.info("Completed: Import version history for node with path=" + versionedChild.getQPath().getAsString()
+ + " and UUID=" + versionedChild.getIdentifier());
+ }
+ }
@@ -709,10 +862,10 @@
+
+ // export import version history and node
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
-+ session.exportSystemView("/parent/wc1", out, false, false);
++ session.exportSystemView("/parent/wc1", out, false, false, true);
+
+ ByteArrayOutputStream vhout = new ByteArrayOutputStream();
-+ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false);
++ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false, true);
+
+ // prepare data for version import
+ String versionHistory = wc1.getProperty("jcr:versionHistory").getValue().getString();
@@ -804,10 +957,10 @@
+ session.exportSystemView("/parent/wc1", out, false, false);
+
+ ByteArrayOutputStream childvhout = new ByteArrayOutputStream();
-+ session.exportSystemView(picture.getVersionHistory().getPath(), childvhout, false, false);
++ session.exportSystemView(picture.getVersionHistory().getPath(), childvhout, false, false, true);
+
+ ByteArrayOutputStream vhout = new ByteArrayOutputStream();
-+ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false);
++ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false, true);
+
+ // prepare data for version import
+
@@ -941,10 +1094,10 @@
+
+ // export import version history and node
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
-+ session.exportSystemView("/parent/wc1", out, false, false);
++ session.exportSystemView("/parent/wc1", out, false, false, true);
+
+ ByteArrayOutputStream vhout = new ByteArrayOutputStream();
-+ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false);
++ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false, true);
+
+ // prepare data for version import
+
@@ -1067,10 +1220,10 @@
+
+ // export import version history and node
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
-+ session.exportSystemView("/parent/wc1", out, false, false);
++ session.exportSystemView("/parent/wc1", out, false, false, true);
+
+ ByteArrayOutputStream vhout = new ByteArrayOutputStream();
-+ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false);
++ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false, true);
+
+ // prepare data for version import
+
@@ -1224,10 +1377,10 @@
+
+ // export import version history and node
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
-+ session.exportSystemView("/parent/wc1", out, false, false);
++ session.exportSystemView("/parent/wc1", out, false, false, true);
+
+ ByteArrayOutputStream vhout = new ByteArrayOutputStream();
-+ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false);
++ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false, true);
+
+ // prepare data for version import
+ String versionHistory = wc1.getProperty("jcr:versionHistory").getValue().getString();
@@ -1308,10 +1461,10 @@
+
+ // export import version history and node
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
-+ session.exportSystemView("/parent/wc1", out, false, false);
++ session.exportSystemView("/parent/wc1", out, false, false, true);
+
+ ByteArrayOutputStream vhout = new ByteArrayOutputStream();
-+ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false);
++ session.exportSystemView(wc1.getVersionHistory().getPath(), vhout, false, false, true);
+
+ // prepare data for version import
+
13 years, 2 months
exo-jcr SVN: r3997 - jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1584.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2011-02-21 03:52:16 -0500 (Mon, 21 Feb 2011)
New Revision: 3997
Modified:
jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1584/JCR-1584.patch
Log:
JCR-1584: patch updated - new tests added
Modified: jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1584/JCR-1584.patch
===================================================================
--- jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1584/JCR-1584.patch 2011-02-18 14:26:16 UTC (rev 3996)
+++ jcr/branches/1.12.x/patch/1.12.8-GA/JCR-1584/JCR-1584.patch 2011-02-21 08:52:16 UTC (rev 3997)
@@ -612,7 +612,7 @@
===================================================================
--- exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImportVersionedChild.java (revision 0)
+++ exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/api/importing/TestImportVersionedChild.java (revision 0)
-@@ -0,0 +1,748 @@
+@@ -0,0 +1,856 @@
+/*
+ * Copyright (C) 2003-2011 eXo Platform SAS.
+ *
@@ -633,16 +633,23 @@
+
+import org.exoplatform.commons.utils.MimeTypeResolver;
+import org.exoplatform.services.jcr.JcrAPIBaseTest;
++import org.exoplatform.services.jcr.dataflow.ItemState;
++import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
++import org.exoplatform.services.jcr.dataflow.PlainChangesLogImpl;
+import org.exoplatform.services.jcr.impl.core.NodeImpl;
++import org.exoplatform.services.jcr.impl.core.PropertyImpl;
++import org.exoplatform.services.jcr.impl.core.SessionDataManager;
+import org.exoplatform.services.jcr.impl.core.SessionImpl;
+import org.exoplatform.services.jcr.util.VersionHistoryImporter;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
++import java.io.InputStream;
+import java.util.Calendar;
+
+import javax.jcr.ImportUUIDBehavior;
+import javax.jcr.Node;
++import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+
+/**
@@ -1360,5 +1367,268 @@
+ }
+ }
+
++ public void testImportVersionHistoryFromFileWithChildVH() throws Exception
++ {
++
++ String baseVersion = "397dad17c0a8004201c7b45ea76d4b1b";
++ String[] predecessorsHistory = new String[]{"397dad17c0a8004201c7b45ea76d4b1b"};
++ String versionHistory = "397dac8bc0a8004201729d052a305832";
++
++ String chbaseVersion = "397dac9ac0a8004201cde5722fec978e";
++ String[] chpredecessorsHistory = new String[]{"397dac9ac0a8004201cde5722fec978e"};
++ String chversionHistory = "397dac9ac0a8004200f37de3ace7b0ad";
++
++ InputStream is =
++ TestImportVersionedChild.class.getResourceAsStream("/import-export/data_with_versioned_child.xml");
++ InputStream vhis =
++ TestImportVersionedChild.class.getResourceAsStream("/import-export/vh_with_versioned_child.xml");
++
++ // import
++ session.importXML("/parent", is, ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW, true);
++
++ session.save();
++
++ Node wc1 = (NodeImpl)session.getItem("/parent/wc1");
++
++ VersionHistoryImporter versionHistoryImporter =
++ new VersionHistoryImporter((NodeImpl)wc1, vhis, baseVersion, predecessorsHistory, versionHistory);
++ versionHistoryImporter.doImport();
++ session.save();
++
++ Node picture = wc1.getNode("medias").getNode("picture");
++ assertTrue(picture.isNodeType("mix:versionable"));
++ assertEquals(chversionHistory, picture.getProperty("jcr:versionHistory").getValue().getString());
++ assertEquals(chbaseVersion, picture.getProperty("jcr:baseVersion").getValue().getString());
++ assertEquals(chpredecessorsHistory[0], picture.getProperty("jcr:predecessors").getValues()[0].getString());
++
++ }
++
++ public void testImportVersionHistoryFromFile() throws Exception
++ {
++
++ String baseVersion = "0019980ec0a80042014313ff82e97096";
++ String[] predecessorsHistory = new String[]{"0019980ec0a80042014313ff82e97096"};
++ String versionHistory = "001997a1c0a80042007d98739b97e1bc";
++
++ String chbaseVersion = "001997b1c0a8004200d65c82779a2e13";
++ String[] chpredecessorsHistory = new String[]{"001997b1c0a8004200d65c82779a2e13"};
++ String chversionHistory = "001997b1c0a8004201d35a6fa36ef4e7";
++
++ InputStream is = TestImportVersionedChild.class.getResourceAsStream("/import-export/data.xml");
++ InputStream vhis = TestImportVersionedChild.class.getResourceAsStream("/import-export/vh.xml");
++
++ // import
++ session.importXML("/parent", is, ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW, true);
++
++ session.save();
++
++ Node wc1 = (NodeImpl)session.getItem("/parent/wc1");
++
++ VersionHistoryImporter versionHistoryImporter =
++ new VersionHistoryImporter((NodeImpl)wc1, vhis, baseVersion, predecessorsHistory, versionHistory);
++ versionHistoryImporter.doImport();
++ session.save();
++
++ Node picture = wc1.getNode("medias").getNode("picture");
++ assertTrue(picture.isNodeType("mix:versionable"));
++ assertFalse(chversionHistory.equals(picture.getProperty("jcr:versionHistory").getValue().getString()));
++ assertFalse(chbaseVersion.equals(picture.getProperty("jcr:baseVersion").getValue().getString()));
++ assertFalse(chpredecessorsHistory[0].equals(picture.getProperty("jcr:predecessors").getValues()[0].getString()));
++
++ // try to remove picture, there must be RepositoryException
++ try
++ {
++ wc1.remove();
++ session.save();
++ fail();
++ }
++ catch (RepositoryException e)
++ {
++ // OK - wc1 Version History contain nt:versionedChild with link to non exist Version history
++
++ // remove bugy version history
++ SessionDataManager dataManager = session.getTransientNodesManager();
++ NodeImpl vhPicture =
++ (NodeImpl)session.getItem("/jcr:system/jcr:versionStorage/" + versionHistory
++ + "/1/jcr:frozenNode/medias/picture");
++
++ assertTrue(vhPicture.isNodeType("nt:versionedChild"));
++
++ PlainChangesLog changesLogDelete = new PlainChangesLogImpl();
++ changesLogDelete.add(ItemState.createDeletedState(((PropertyImpl)vhPicture.getProperty("jcr:primaryType"))
++ .getData()));
++ changesLogDelete.add(ItemState.createDeletedState(((PropertyImpl)vhPicture
++ .getProperty("jcr:childVersionHistory")).getData()));
++
++ for (ItemState itemState : changesLogDelete.getAllStates())
++ {
++ dataManager.delete(itemState.getData(), itemState.getAncestorToSave());
++ }
++
++ session.save();
++ }
++ }
+}
\ No newline at end of file
+Index: exo.jcr.component.core/src/test/resources/import-export/data.xml
+===================================================================
+--- exo.jcr.component.core/src/test/resources/import-export/data.xml (revision 0)
++++ exo.jcr.component.core/src/test/resources/import-export/data.xml (revision 0)
+@@ -0,0 +1 @@
++<?xml version="1.0" encoding="UTF-8"?><sv:node xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:test="http://www.apache.org/jackrabbit/test" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:exojcrtest="http://www.exoplatform.org/jcr/test/1.0" xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:publication="http://www.exoplatform.com/jcr/publication/1.1/" xmlns:exo="http://www.exoplatform.com/jcr/exo/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rma="http://www.rma.com/jcr/" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:metadata="http://www.exoplatform.com/jcr/metadata/1.1/" xmlns:rep="internal" sv:name="wc1"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:folder</sv:value></sv:property><sv:property sv:name="jcr:mixinTypes" sv:type="Name"><sv:value>mix:versionable</sv:value></sv:property><sv:property sv:na!
me="jcr:uuid" sv:type="String"><sv:value>00199791c0a800420106a227837ca02a</sv:value></sv:property><sv:property sv:name="jcr:baseVersion" sv:type="Reference"><sv:value>0019980ec0a80042014313ff82e97096</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-07T14:30:00.593+02:00</sv:value></sv:property><sv:property sv:name="jcr:isCheckedOut" sv:type="Boolean"><sv:value>true</sv:value></sv:property><sv:property sv:name="jcr:predecessors" sv:type="Reference"><sv:value>0019980ec0a80042014313ff82e97096</sv:value></sv:property><sv:property sv:name="jcr:versionHistory" sv:type="Reference"><sv:value>001997a1c0a80042007d98739b97e1bc</sv:value></sv:property><sv:node sv:name="medias"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:folder</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-07T14:30:00.625+02:00</sv:value></sv:property><sv:node sv:name="picture"><sv:property sv:name="jcr:primar!
yType" sv:type="Name"><sv:value>nt:file</sv:value></sv:propert!
y><sv:pr
operty sv:name="jcr:mixinTypes" sv:type="Name"><sv:value>mix:versionable</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>001997b1c0a8004201ab6f6dfdaf70f9</sv:value></sv:property><sv:property sv:name="jcr:baseVersion" sv:type="Reference"><sv:value>001997b1c0a8004200d65c82779a2e13</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-07T14:30:00.625+02:00</sv:value></sv:property><sv:property sv:name="jcr:isCheckedOut" sv:type="Boolean"><sv:value>true</sv:value></sv:property><sv:property sv:name="jcr:predecessors" sv:type="Reference"><sv:value>001997b1c0a8004200d65c82779a2e13</sv:value></sv:property><sv:property sv:name="jcr:versionHistory" sv:type="Reference"><sv:value>001997b1c0a8004201d35a6fa36ef4e7</sv:value></sv:property><sv:node sv:name="jcr:content"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:resource</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv!
:value>001997b1c0a800420058c90fbc883ce3</sv:value></sv:property><sv:property sv:name="jcr:data" sv:type="Binary"><sv:value>YmxhIGJsYQ==</sv:value></sv:property><sv:property sv:name="jcr:lastModified" sv:type="Date"><sv:value>2011-02-07T14:30:00.625+02:00</sv:value></sv:property><sv:property sv:name="jcr:mimeType" sv:type="String"><sv:value>text/plain</sv:value></sv:property></sv:node></sv:node></sv:node></sv:node>
+\ No newline at end of file
+Index: exo.jcr.component.core/src/test/resources/import-export/data_with_versioned_child.xml
+===================================================================
+--- exo.jcr.component.core/src/test/resources/import-export/data_with_versioned_child.xml (revision 0)
++++ exo.jcr.component.core/src/test/resources/import-export/data_with_versioned_child.xml (revision 0)
+@@ -0,0 +1 @@
++<?xml version="1.0" encoding="UTF-8"?><sv:node xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:test="http://www.apache.org/jackrabbit/test" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:exojcrtest="http://www.exoplatform.org/jcr/test/1.0" xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:publication="http://www.exoplatform.com/jcr/publication/1.1/" xmlns:exo="http://www.exoplatform.com/jcr/exo/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rma="http://www.rma.com/jcr/" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:metadata="http://www.exoplatform.com/jcr/metadata/1.1/" xmlns:rep="internal" sv:name="wc1"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:folder</sv:value></sv:property><sv:property sv:name="jcr:mixinTypes" sv:type="Name"><sv:value>mix:versionable</sv:value></sv:property><sv:property sv:na!
me="jcr:uuid" sv:type="String"><sv:value>397dac7bc0a80042019e86f907ef0339</sv:value></sv:property><sv:property sv:name="jcr:baseVersion" sv:type="Reference"><sv:value>397dad17c0a8004201c7b45ea76d4b1b</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-18T17:57:40.859+02:00</sv:value></sv:property><sv:property sv:name="jcr:isCheckedOut" sv:type="Boolean"><sv:value>true</sv:value></sv:property><sv:property sv:name="jcr:predecessors" sv:type="Reference"><sv:value>397dad17c0a8004201c7b45ea76d4b1b</sv:value></sv:property><sv:property sv:name="jcr:versionHistory" sv:type="Reference"><sv:value>397dac8bc0a8004201729d052a305832</sv:value></sv:property><sv:node sv:name="medias"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:folder</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-18T17:57:40.890+02:00</sv:value></sv:property><sv:node sv:name="picture"><sv:property sv:name="jcr:primar!
yType" sv:type="Name"><sv:value>nt:file</sv:value></sv:propert!
y><sv:pr
operty sv:name="jcr:mixinTypes" sv:type="Name"><sv:value>mix:versionable</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>397dac9ac0a800420182f12f406ca1a3</sv:value></sv:property><sv:property sv:name="jcr:baseVersion" sv:type="Reference"><sv:value>397dac9ac0a8004201cde5722fec978e</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-18T17:57:40.890+02:00</sv:value></sv:property><sv:property sv:name="jcr:isCheckedOut" sv:type="Boolean"><sv:value>true</sv:value></sv:property><sv:property sv:name="jcr:predecessors" sv:type="Reference"><sv:value>397dac9ac0a8004201cde5722fec978e</sv:value></sv:property><sv:property sv:name="jcr:versionHistory" sv:type="Reference"><sv:value>397dac9ac0a8004200f37de3ace7b0ad</sv:value></sv:property><sv:node sv:name="jcr:content"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:resource</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv!
:value>397dac9ac0a8004201e6a413bc33907f</sv:value></sv:property><sv:property sv:name="jcr:data" sv:type="Binary"><sv:value>YmxhIGJsYQ==</sv:value></sv:property><sv:property sv:name="jcr:lastModified" sv:type="Date"><sv:value>2011-02-18T17:57:40.890+02:00</sv:value></sv:property><sv:property sv:name="jcr:mimeType" sv:type="String"><sv:value>text/plain</sv:value></sv:property></sv:node></sv:node></sv:node></sv:node>
+\ No newline at end of file
+Index: exo.jcr.component.core/src/test/resources/import-export/vh.xml
+===================================================================
+--- exo.jcr.component.core/src/test/resources/import-export/vh.xml (revision 0)
++++ exo.jcr.component.core/src/test/resources/import-export/vh.xml (revision 0)
+@@ -0,0 +1,136 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<sv:node sv:name="001997a1c0a80042007d98739b97e1bc"
++ xmlns:xs="http://www.w3.org/2001/XMLSchema"
++ xmlns:test="http://www.apache.org/jackrabbit/test"
++ xmlns:sv="http://www.jcp.org/jcr/sv/1.0"
++ xmlns:rma="http://www.rma.com/jcr/" xmlns:rep="internal"
++ xmlns:publication="http://www.exoplatform.com/jcr/publication/1.1/"
++ xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
++ xmlns:mix="http://www.jcp.org/jcr/mix/1.0"
++ xmlns:metadata="http://www.exoplatform.com/jcr/metadata/1.1/"
++ xmlns:jcr="http://www.jcp.org/jcr/1.0"
++ xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions"
++ xmlns:fn="http://www.w3.org/2005/xpath-functions"
++ xmlns:exojcrtest="http://www.exoplatform.org/jcr/test/1.0"
++ xmlns:exo="http://www.exoplatform.com/jcr/exo/1.0"
++ xmlns:dc="http://purl.org/dc/elements/1.1/">
++ <sv:property sv:name="jcr:primaryType" sv:type="Name">
++ <sv:value>nt:versionHistory</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:uuid" sv:type="String">
++ <sv:value>001997a1c0a80042007d98739b97e1bc</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:versionableUuid" sv:type="String">
++ <sv:value>00199791c0a800420106a227837ca02a</sv:value>
++ </sv:property>
++
++ <sv:node sv:name="jcr:rootVersion">
++ <sv:property sv:name="jcr:primaryType" sv:type="Name">
++ <sv:value>nt:version</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:mixinTypes" sv:type="Name">
++ <sv:value>mix:referenceable</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:uuid" sv:type="String">
++ <sv:value>001997a1c0a8004201a3af806d45ed9b</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:created" sv:type="Date">
++ <sv:value>2011-02-07T14:30:00.609+02:00</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:successors" sv:type="Reference">
++ <sv:value>0019980ec0a80042014313ff82e97096</sv:value>
++ </sv:property>
++ </sv:node>
++
++ <sv:node sv:name="1">
++ <sv:property sv:name="jcr:primaryType" sv:type="Name">
++ <sv:value>nt:version</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:mixinTypes" sv:type="Name">
++ <sv:value>mix:referenceable</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:uuid" sv:type="String">
++ <sv:value>0019980ec0a80042014313ff82e97096</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:created" sv:type="Date">
++ <sv:value>2011-02-07T14:30:00.718+02:00</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:predecessors" sv:type="Reference">
++ <sv:value>001997a1c0a8004201a3af806d45ed9b</sv:value>
++ </sv:property>
++
++ <sv:node sv:name="jcr:frozenNode">
++ <sv:property sv:name="jcr:primaryType" sv:type="Name">
++ <sv:value>nt:frozenNode</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:mixinTypes" sv:type="Name">
++ <sv:value>mix:referenceable</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:uuid" sv:type="String">
++ <sv:value>0019980ec0a8004200d64e422bf86f49</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:created" sv:type="Date">
++ <sv:value>2011-02-07T14:30:00.734+02:00</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:frozenMixinTypes" sv:type="Name">
++ <sv:value>mix:versionable</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:frozenPrimaryType" sv:type="Name">
++ <sv:value>nt:folder</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:frozenUuid" sv:type="String">
++ <sv:value>00199791c0a800420106a227837ca02a</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:predecessors" sv:type="Reference">
++ <sv:value>001997a1c0a8004201a3af806d45ed9b</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:versionHistory" sv:type="Reference">
++ <sv:value>001997a1c0a80042007d98739b97e1bc</sv:value>
++ </sv:property>
++
++ <sv:node sv:name="medias">
++ <sv:property sv:name="jcr:primaryType" sv:type="Name">
++ <sv:value>nt:folder</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:created" sv:type="Date">
++ <sv:value>2011-02-07T14:30:00.734+02:00</sv:value>
++ </sv:property>
++
++ <sv:node sv:name="picture">
++ <sv:property sv:name="jcr:primaryType" sv:type="Name">
++ <sv:value>nt:versionedChild</sv:value>
++ </sv:property>
++
++ <sv:property sv:name="jcr:childVersionHistory" sv:type="Reference">
++ <sv:value>001997b1c0a8004201d35a6fa36ef4e7</sv:value>
++ </sv:property>
++ </sv:node>
++ </sv:node>
++ </sv:node>
++ </sv:node>
++
++ <sv:node sv:name="jcr:versionLabels">
++ <sv:property sv:name="jcr:primaryType" sv:type="Name">
++ <sv:value>nt:versionLabels</sv:value>
++ </sv:property>
++ </sv:node>
++</sv:node>
+Index: exo.jcr.component.core/src/test/resources/import-export/vh_with_versioned_child.xml
+===================================================================
+--- exo.jcr.component.core/src/test/resources/import-export/vh_with_versioned_child.xml (revision 0)
++++ exo.jcr.component.core/src/test/resources/import-export/vh_with_versioned_child.xml (revision 0)
+@@ -0,0 +1 @@
++<?xml version="1.0" encoding="UTF-8"?><sv:node xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:test="http://www.apache.org/jackrabbit/test" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:exojcrtest="http://www.exoplatform.org/jcr/test/1.0" xmlns:fn_old="http://www.w3.org/2004/10/xpath-functions" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:publication="http://www.exoplatform.com/jcr/publication/1.1/" xmlns:exo="http://www.exoplatform.com/jcr/exo/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rma="http://www.rma.com/jcr/" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:fn="http://www.w3.org/2005/xpath-functions" xmlns:metadata="http://www.exoplatform.com/jcr/metadata/1.1/" xmlns:rep="internal" sv:name="397dac8bc0a8004201729d052a305832"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:versionHistory</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>397dac8bc0a8004201729d052!
a305832</sv:value></sv:property><sv:property sv:name="jcr:versionableUuid" sv:type="String"><sv:value>397dac7bc0a80042019e86f907ef0339</sv:value></sv:property><sv:node sv:name="jcr:rootVersion"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:version</sv:value></sv:property><sv:property sv:name="jcr:mixinTypes" sv:type="Name"><sv:value>mix:referenceable</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>397dac8bc0a8004201a2e53eb73949bd</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-18T17:57:40.875+02:00</sv:value></sv:property><sv:property sv:name="jcr:successors" sv:type="Reference"><sv:value>397dad17c0a8004201c7b45ea76d4b1b</sv:value></sv:property></sv:node><sv:node sv:name="1"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:version</sv:value></sv:property><sv:property sv:name="jcr:mixinTypes" sv:type="Name"><sv:value>mix:referenceable</sv:value></sv:property>!
<sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>397!
dad17c0a
8004201c7b45ea76d4b1b</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-18T17:57:41.031+02:00</sv:value></sv:property><sv:property sv:name="jcr:predecessors" sv:type="Reference"><sv:value>397dac8bc0a8004201a2e53eb73949bd</sv:value></sv:property><sv:node sv:name="jcr:frozenNode"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:frozenNode</sv:value></sv:property><sv:property sv:name="jcr:mixinTypes" sv:type="Name"><sv:value>mix:referenceable</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>397dad27c0a800420029031c7e421afa</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-18T17:57:41.031+02:00</sv:value></sv:property><sv:property sv:name="jcr:frozenMixinTypes" sv:type="Name"><sv:value>mix:versionable</sv:value></sv:property><sv:property sv:name="jcr:frozenPrimaryType" sv:type="Name"><sv:value>nt:folder</sv:value></sv:property><sv:property sv:na!
me="jcr:frozenUuid" sv:type="String"><sv:value>397dac7bc0a80042019e86f907ef0339</sv:value></sv:property><sv:property sv:name="jcr:predecessors" sv:type="Reference"><sv:value>397dac8bc0a8004201a2e53eb73949bd</sv:value></sv:property><sv:property sv:name="jcr:versionHistory" sv:type="Reference"><sv:value>397dac8bc0a8004201729d052a305832</sv:value></sv:property><sv:node sv:name="medias"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:folder</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-18T17:57:41.031+02:00</sv:value></sv:property><sv:node sv:name="picture"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:versionedChild</sv:value></sv:property><sv:property sv:name="jcr:childVersionHistory" sv:type="Reference"><sv:value>397dac9ac0a8004200f37de3ace7b0ad</sv:value></sv:property><sv:versionhistory sv:name="397dac9ac0a8004200f37de3ace7b0ad"><sv:node sv:name="397dac9ac0a8004200f37de3ace7b0ad"><sv:prope!
rty sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:vers!
ionHisto
ry</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>397dac9ac0a8004200f37de3ace7b0ad</sv:value></sv:property><sv:property sv:name="jcr:versionableUuid" sv:type="String"><sv:value>397dac9ac0a800420182f12f406ca1a3</sv:value></sv:property><sv:node sv:name="jcr:rootVersion"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:version</sv:value></sv:property><sv:property sv:name="jcr:mixinTypes" sv:type="Name"><sv:value>mix:referenceable</sv:value></sv:property><sv:property sv:name="jcr:uuid" sv:type="String"><sv:value>397dac9ac0a8004201cde5722fec978e</sv:value></sv:property><sv:property sv:name="jcr:created" sv:type="Date"><sv:value>2011-02-18T17:57:40.890+02:00</sv:value></sv:property></sv:node><sv:node sv:name="jcr:versionLabels"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:versionLabels</sv:value></sv:property></sv:node></sv:node></sv:versionhistory></sv:node></sv:node></sv:node></sv:node><sv:node sv:name="!
jcr:versionLabels"><sv:property sv:name="jcr:primaryType" sv:type="Name"><sv:value>nt:versionLabels</sv:value></sv:property></sv:node></sv:node>
+\ No newline at end of file
13 years, 2 months
exo-jcr SVN: r3996 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-02-18 09:26:16 -0500 (Fri, 18 Feb 2011)
New Revision: 3996
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
Log:
EXOJCR-1193: Index retrieval from coordinator node
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2011-02-18 14:19:44 UTC (rev 3995)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java 2011-02-18 14:26:16 UTC (rev 3996)
@@ -203,6 +203,11 @@
private RemoteCommand resume;
/**
+ * Index recovery.
+ */
+ private final IndexRecovery indexRecovery;
+
+ /**
* Request to all nodes to check if there is someone who responsible for resuming.
*/
private RemoteCommand requestForResponsibleForResuming;
@@ -272,9 +277,17 @@
((WorkspacePersistentDataManager)this.itemMgr).addItemPersistenceListener(this);
}
- if (rpcService != null)
+ if (rpcService == null)
{
+ this.indexRecovery = null;
+ }
+ else
+ {
doInitRemoteCommands();
+
+ this.indexRecovery = new IndexRecoveryImpl(rpcService, this);
+ rpcService.registerTopologyChangeListener(this);
+ rpcService.registerTopologyChangeListener((TopologyChangeListener)indexRecovery);
}
}
@@ -688,8 +701,6 @@
throw new RepositoryConfigurationException(e);
}
- IndexRecovery indexRecovery = rpcService == null ? null : new IndexRecoveryImpl(rpcService, this);
-
QueryHandlerContext context =
new QueryHandlerContext(container, itemMgr, indexingTree, nodeTypeDataManager, nsReg, parentHandler,
PrivilegedFileHelper.getAbsolutePath(getIndexDirectory()), extractor, true, virtualTableResolver,
@@ -1083,8 +1094,6 @@
return isResponsibleForResuming;
}
});
-
- rpcService.registerTopologyChangeListener(this);
}
protected void suspendLocally() throws SuspendException
13 years, 2 months
exo-jcr SVN: r3995 - in kernel/trunk/exo.kernel.container/src: main/java/org/exoplatform/container/jmx and 2 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-02-18 09:19:44 -0500 (Fri, 18 Feb 2011)
New Revision: 3995
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/MX4JComponentAdapter.java
kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestExoContainer.java
kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/test-exo-container.xml
Log:
EXOJCR-1197: Bug fixed by adding a dependencies resolution context in which we register the dependencies that are currently resolved, this is necessary to resolve cyclic dependencies. The bug was due to the fact that the UserPortalConfigService depends on the OrganizationService and the OrganizationService depends indirectly through a plugin on UserPortalConfigListener, moreover the OrganizationService has a plugin that depends on the NodeHierarchyCreator. If the UserPortalConfigService is started before the NodeHierarchyCreator, we got this exception because to solve the cyclic dependency issue, we have to break the chain of dependencies which makes the OrganizationService starts before the NodeHierarchyCreator.
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java 2011-02-18 13:38:33 UTC (rev 3994)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/ExoContainer.java 2011-02-18 14:19:44 UTC (rev 3995)
@@ -78,6 +78,12 @@
}
static Log log = ExoLogger.getLogger("exo.kernel.container.ExoContainer");
+
+ /**
+ * Context used to keep in memory the components that are currently being created.
+ * This context is used to prevent cyclic resolution due to component plugins.
+ */
+ private final ThreadLocal<Map<Object, Object>> depResolutionCtx = new ThreadLocal<Map<Object, Object>>();
private Map<String, ComponentLifecyclePlugin> componentLifecylePlugin_ =
new HashMap<String, ComponentLifecyclePlugin>();
@@ -308,7 +314,7 @@
}
else
{
- args[i] = getComponentInstanceOfType(parameters[i]);
+ args[i] = getComponentInstanceOfTypeInternal(parameters[i]);
if (args[i] == null)
{
satisfied = false;
@@ -332,4 +338,59 @@
ConfigurationManager cm = (ConfigurationManager)getComponentInstanceOfType(ConfigurationManager.class);
return cm == null ? null : cm.getConfiguration();
}
+
+ /**
+ * Add the component corresponding to the given key, to the dependency resolution
+ * context
+ * @param key The key of the component to add to the context
+ * @param component The instance of the component to add to the context
+ */
+ public void addComponentToCtx(Object key, Object component)
+ {
+ Map<Object, Object> map = depResolutionCtx.get();
+ if (map == null)
+ {
+ map = new HashMap<Object, Object>();
+ depResolutionCtx.set(map);
+ }
+ map.put(key, component);
+ }
+
+ /**
+ * Remove the component corresponding to the given key, from the dependency resolution
+ * context
+ * @param key The key of the component to remove from the context
+ */
+ public void removeComponentFromCtx(Object key)
+ {
+ Map<Object, Object> map = depResolutionCtx.get();
+ if (map != null)
+ {
+ map.remove(key);
+ if (map.isEmpty())
+ {
+ depResolutionCtx.set(null);
+ }
+ }
+ }
+
+ /**
+ * Try to get the component from the dependency resolution context and if it cannot be found
+ * it will try to get it from the method <code>getComponentInstanceOfType</code>
+ * @param componentType the type of the component to find
+ * @return the instance of the component corresponding to the given component type
+ */
+ private Object getComponentInstanceOfTypeInternal(Class componentType)
+ {
+ Map<Object, Object> map = depResolutionCtx.get();
+ if (map != null)
+ {
+ Object result = map.get(componentType);
+ if (result != null)
+ {
+ return result;
+ }
+ }
+ return getComponentInstanceOfType(componentType);
+ }
}
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/MX4JComponentAdapter.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/MX4JComponentAdapter.java 2011-02-18 13:38:33 UTC (rev 3994)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/jmx/MX4JComponentAdapter.java 2011-02-18 14:19:44 UTC (rev 3995)
@@ -100,26 +100,27 @@
// to component plugins
return instance_;
}
+ exocontainer.addComponentToCtx(getComponentKey(), instance);
+ if (debug)
+ log.debug("==> create component : " + instance_);
+ if (component != null && component.getComponentPlugins() != null)
+ {
+ addComponentPlugin(debug, instance, component.getComponentPlugins(), exocontainer);
+ }
+ ExternalComponentPlugins ecplugins = manager.getConfiguration().getExternalComponentPlugins(componentKey);
+ if (ecplugins != null)
+ {
+ addComponentPlugin(debug, instance, ecplugins.getComponentPlugins(), exocontainer);
+ }
+ // check if component implement the ComponentLifecycle
+ if (instance instanceof ComponentLifecycle)
+ {
+ ComponentLifecycle lc = (ComponentLifecycle)instance;
+ lc.initComponent(exocontainer);
+ }
instance_ = instance;
}
- if (debug)
- log.debug("==> create component : " + instance_);
- if (component != null && component.getComponentPlugins() != null)
- {
- addComponentPlugin(debug, instance_, component.getComponentPlugins(), exocontainer);
- }
- ExternalComponentPlugins ecplugins = manager.getConfiguration().getExternalComponentPlugins(componentKey);
- if (ecplugins != null)
- {
- addComponentPlugin(debug, instance_, ecplugins.getComponentPlugins(), exocontainer);
- }
- // check if component implement the ComponentLifecycle
- if (instance_ instanceof ComponentLifecycle)
- {
- ComponentLifecycle lc = (ComponentLifecycle)instance_;
- lc.initComponent(exocontainer);
- }
}
catch (Exception ex)
{
@@ -132,7 +133,10 @@
}
throw new RuntimeException(msg, ex);
}
-
+ finally
+ {
+ exocontainer.removeComponentFromCtx(getComponentKey());
+ }
return instance_;
}
Modified: kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestExoContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestExoContainer.java 2011-02-18 13:38:33 UTC (rev 3994)
+++ kernel/trunk/exo.kernel.container/src/test/java/org/exoplatform/container/TestExoContainer.java 2011-02-18 14:19:44 UTC (rev 3995)
@@ -26,6 +26,7 @@
import org.picocontainer.PicoInitializationException;
import org.picocontainer.PicoIntrospectionException;
import org.picocontainer.PicoVisitor;
+import org.picocontainer.Startable;
import org.picocontainer.defaults.DuplicateComponentKeyRegistrationException;
import java.net.URL;
@@ -119,6 +120,18 @@
assertEquals(a, b.a);
}
+ public void testStartOrder()
+ {
+ final RootContainer container = createRootContainer("test-exo-container.xml", "testStartOrder");
+ C0 c0 = (C0)container.getComponentInstanceOfType(C0.class);
+ assertNotNull(c0);
+ C1 c1 = (C1)container.getComponentInstanceOfType(C1.class);
+ assertNotNull(c1);
+ C2 c2 = (C2)container.getComponentInstanceOfType(C2.class);
+ assertNotNull(c2);
+ assertTrue(c1.started);
+ }
+
public void testCache()
{
URL rootURL = getClass().getResource("test-exo-container.xml");
@@ -560,4 +573,101 @@
{
}
}
+
+ public static class C0 implements Startable
+ {
+ C1 c1;
+ public C0(C1 c1)
+ {
+ this.c1 = c1;
+ }
+
+ /**
+ * @see org.picocontainer.Startable#start()
+ */
+ public void start()
+ {
+ }
+
+ /**
+ * @see org.picocontainer.Startable#stop()
+ */
+ public void stop()
+ {
+ }
+
+ }
+
+ public static class C1 implements Startable
+ {
+ public boolean started;
+
+ P p;
+
+ /**
+ * @see org.picocontainer.Startable#start()
+ */
+ public void start()
+ {
+ try
+ {
+ p.init();
+ this.started = true;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @see org.picocontainer.Startable#stop()
+ */
+ public void stop()
+ {
+ }
+
+ public void add(P p)
+ {
+ this.p = p;
+ }
+ }
+ public static class P extends BaseComponentPlugin
+ {
+ public C0 c0;
+ public C1 c1;
+ public C2 c2;
+ public P(C0 c0, C1 c1, C2 c2)
+ {
+ this.c0 = c0;
+ this.c1 = c1;
+ this.c2 = c2;
+ }
+
+ public void init()
+ {
+ if (!c2.started)
+ throw new IllegalStateException("C2 should be started");
+ }
+ }
+
+ public static class C2 implements Startable
+ {
+ public boolean started;
+
+ /**
+ * @see org.picocontainer.Startable#start()
+ */
+ public void start()
+ {
+ started = true;
+ }
+
+ /**
+ * @see org.picocontainer.Startable#stop()
+ */
+ public void stop()
+ {
+ }
+ }
}
Modified: kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/test-exo-container.xml
===================================================================
--- kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/test-exo-container.xml 2011-02-18 13:38:33 UTC (rev 3994)
+++ kernel/trunk/exo.kernel.container/src/test/resources/org/exoplatform/container/test-exo-container.xml 2011-02-18 14:19:44 UTC (rev 3995)
@@ -58,4 +58,20 @@
</component-plugin>
</component-plugins>
</component>
+ <component profiles="testStartOrder">
+ <type>org.exoplatform.container.TestExoContainer$C0</type>
+ </component>
+ <component profiles="testStartOrder">
+ <type>org.exoplatform.container.TestExoContainer$C1</type>
+ <component-plugins>
+ <component-plugin>
+ <name>testStartOrder</name>
+ <set-method>add</set-method>
+ <type>org.exoplatform.container.TestExoContainer$P</type>
+ </component-plugin>
+ </component-plugins>
+ </component>
+ <component profiles="testStartOrder">
+ <type>org.exoplatform.container.TestExoContainer$C2</type>
+ </component>
</configuration>
\ No newline at end of file
13 years, 2 months