exo-jcr SVN: r555 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-11-11 03:22:24 -0500 (Wed, 11 Nov 2009)
New Revision: 555
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
Log:
EXOJCR-201: bug fix
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-11-11 08:20:33 UTC (rev 554)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-11-11 08:22:24 UTC (rev 555)
@@ -164,32 +164,24 @@
WorkspaceStorageConnection conn = null;
if (isSystemDescendant(data.getQPath()))
{
- if (systemConnection == null)
- {
- conn = systemConnection == null
- // we need system connection but it's not exist
- ? systemConnection = (systemDataContainer != dataContainer
- // if it's different container instances
- ? systemDataContainer.equals(dataContainer) && thisConnection != null
- // but container confugrations are same and non-system connnection open
- // reuse this connection as system
- ? systemDataContainer.reuseConnection(thisConnection)
- // or open one new system
- : systemDataContainer.openConnection()
- // else if it's same container instances (system and this)
- : thisConnection == null
- // and non-system connection doens't exist - open it
- ? thisConnection = dataContainer.openConnection()
- // if already open - use it
- : thisConnection)
- // system connection opened - use it
- : systemConnection;
- }
- else
- {
+ conn = systemConnection == null
+ // we need system connection but it's not exist
+ ? systemConnection = (systemDataContainer != dataContainer
+ // if it's different container instances
+ ? systemDataContainer.equals(dataContainer) && thisConnection != null
+ // but container confugrations are same and non-system connnection open
+ // reuse this connection as system
+ ? systemDataContainer.reuseConnection(thisConnection)
+ // or open one new system
+ : systemDataContainer.openConnection()
+ // else if it's same container instances (system and this)
+ : thisConnection == null
+ // and non-system connection doens't exist - open it
+ ? thisConnection = dataContainer.openConnection()
+ // if already open - use it
+ : thisConnection)
// system connection opened - use it
- conn = systemConnection;
- }
+ : systemConnection;
}
else
{
16 years, 8 months
exo-jcr SVN: r554 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-11-11 03:20:33 -0500 (Wed, 11 Nov 2009)
New Revision: 554
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
Log:
EXOJCR-201: refactoring sessionId support
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-11-11 08:05:59 UTC (rev 553)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-11-11 08:20:33 UTC (rev 554)
@@ -166,9 +166,9 @@
{
if (systemConnection == null)
{
- conn =
+ conn = systemConnection == null
// we need system connection but it's not exist
- systemConnection = (systemDataContainer != dataContainer
+ ? systemConnection = (systemDataContainer != dataContainer
// if it's different container instances
? systemDataContainer.equals(dataContainer) && thisConnection != null
// but container confugrations are same and non-system connnection open
@@ -181,9 +181,9 @@
// and non-system connection doens't exist - open it
? thisConnection = dataContainer.openConnection()
// if already open - use it
- : thisConnection);
- if (!systemConnection.equals(thisConnection))
- systemConnection.addSessionInfo(currChangesLog.getSessionId(), "userId");
+ : thisConnection)
+ // system connection opened - use it
+ : systemConnection;
}
else
{
@@ -193,32 +193,24 @@
}
else
{
- if (thisConnection == null)
- {
- conn =
- // we need this conatiner conection
- thisConnection = (systemDataContainer != dataContainer
- // if it's different container instances
- ? dataContainer.equals(systemDataContainer) && systemConnection != null
- // but container confugrations are same and system connnection open
- // reuse system connection as this
- ? dataContainer.reuseConnection(systemConnection)
- // or open one new
- : dataContainer.openConnection()
- // else if it's same container instances (system and this)
- : systemConnection == null
- // and system connection doens't exist - open it
- ? systemConnection = dataContainer.openConnection()
- // if already open - use it
- : systemConnection);
- if (!thisConnection.equals(systemConnection))
- thisConnection.addSessionInfo(currChangesLog.getSessionId(), "userId");
- }
- else
- {
+ conn = thisConnection == null
+ // we need this conatiner conection
+ ? thisConnection = (systemDataContainer != dataContainer
+ // if it's different container instances
+ ? dataContainer.equals(systemDataContainer) && systemConnection != null
+ // but container confugrations are same and system connnection open
+ // reuse system connection as this
+ ? dataContainer.reuseConnection(systemConnection)
+ // or open one new
+ : dataContainer.openConnection()
+ // else if it's same container instances (system and this)
+ : systemConnection == null
+ // and system connection doens't exist - open it
+ ? systemConnection = dataContainer.openConnection()
+ // if already open - use it
+ : systemConnection)
// this connection opened - use it
- conn = thisConnection;
- }
+ : thisConnection;
}
data.increasePersistedVersion();
@@ -244,10 +236,10 @@
LOG.debug(ItemState.nameFromValue(itemState.getState()) + " " + (System.currentTimeMillis() - start)
+ "ms, " + data.getQPath().getAsString());
}
- if (thisConnection != null)
- thisConnection.removeSessionInfo();
- if (systemConnection != null && !systemConnection.equals(thisConnection))
- systemConnection.removeSessionInfo();
+ // if (thisConnection != null)
+ // thisConnection.removeSessionInfo();
+ // if (systemConnection != null && !systemConnection.equals(thisConnection))
+ // systemConnection.removeSessionInfo();
}
if (thisConnection != null)
thisConnection.commit();
16 years, 8 months
exo-jcr SVN: r553 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-11-11 03:05:59 -0500 (Wed, 11 Nov 2009)
New Revision: 553
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
Log:
EXOJCR-201: sessionId support
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-11-10 17:03:59 UTC (rev 552)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-11-11 08:05:59 UTC (rev 553)
@@ -164,45 +164,61 @@
WorkspaceStorageConnection conn = null;
if (isSystemDescendant(data.getQPath()))
{
- conn = systemConnection == null
- // we need system connection but it's not exist
- ? systemConnection = (systemDataContainer != dataContainer
- // if it's different container instances
- ? systemDataContainer.equals(dataContainer) && thisConnection != null
- // but container confugrations are same and non-system connnection open
- // reuse this connection as system
- ? systemDataContainer.reuseConnection(thisConnection)
- // or open one new system
- : systemDataContainer.openConnection()
- // else if it's same container instances (system and this)
- : thisConnection == null
- // and non-system connection doens't exist - open it
- ? thisConnection = dataContainer.openConnection()
- // if already open - use it
- : thisConnection)
+ if (systemConnection == null)
+ {
+ conn =
+ // we need system connection but it's not exist
+ systemConnection = (systemDataContainer != dataContainer
+ // if it's different container instances
+ ? systemDataContainer.equals(dataContainer) && thisConnection != null
+ // but container confugrations are same and non-system connnection open
+ // reuse this connection as system
+ ? systemDataContainer.reuseConnection(thisConnection)
+ // or open one new system
+ : systemDataContainer.openConnection()
+ // else if it's same container instances (system and this)
+ : thisConnection == null
+ // and non-system connection doens't exist - open it
+ ? thisConnection = dataContainer.openConnection()
+ // if already open - use it
+ : thisConnection);
+ if (!systemConnection.equals(thisConnection))
+ systemConnection.addSessionInfo(currChangesLog.getSessionId(), "userId");
+ }
+ else
+ {
// system connection opened - use it
- : systemConnection;
+ conn = systemConnection;
+ }
}
else
{
- conn = thisConnection == null
- // we need this conatiner conection
- ? thisConnection = (systemDataContainer != dataContainer
- // if it's different container instances
- ? dataContainer.equals(systemDataContainer) && systemConnection != null
- // but container confugrations are same and system connnection open
- // reuse system connection as this
- ? dataContainer.reuseConnection(systemConnection)
- // or open one new
- : dataContainer.openConnection()
- // else if it's same container instances (system and this)
- : systemConnection == null
- // and system connection doens't exist - open it
- ? systemConnection = dataContainer.openConnection()
- // if already open - use it
- : systemConnection)
+ if (thisConnection == null)
+ {
+ conn =
+ // we need this conatiner conection
+ thisConnection = (systemDataContainer != dataContainer
+ // if it's different container instances
+ ? dataContainer.equals(systemDataContainer) && systemConnection != null
+ // but container confugrations are same and system connnection open
+ // reuse system connection as this
+ ? dataContainer.reuseConnection(systemConnection)
+ // or open one new
+ : dataContainer.openConnection()
+ // else if it's same container instances (system and this)
+ : systemConnection == null
+ // and system connection doens't exist - open it
+ ? systemConnection = dataContainer.openConnection()
+ // if already open - use it
+ : systemConnection);
+ if (!thisConnection.equals(systemConnection))
+ thisConnection.addSessionInfo(currChangesLog.getSessionId(), "userId");
+ }
+ else
+ {
// this connection opened - use it
- : thisConnection;
+ conn = thisConnection;
+ }
}
data.increasePersistedVersion();
@@ -228,7 +244,10 @@
LOG.debug(ItemState.nameFromValue(itemState.getState()) + " " + (System.currentTimeMillis() - start)
+ "ms, " + data.getQPath().getAsString());
}
- // conn.removeSessionInfo();
+ if (thisConnection != null)
+ thisConnection.removeSessionInfo();
+ if (systemConnection != null && !systemConnection.equals(thisConnection))
+ systemConnection.removeSessionInfo();
}
if (thisConnection != null)
thisConnection.commit();
16 years, 8 months
exo-jcr SVN: r552 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-11-10 12:03:59 -0500 (Tue, 10 Nov 2009)
New Revision: 552
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
Log:
EXOJCR-201 : The JDBCCacheLoader was changed.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-10 16:49:51 UTC (rev 551)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-10 17:03:59 UTC (rev 552)
@@ -29,6 +29,8 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCStorageConnection;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
+import org.exoplatform.services.log.ExoLogger;
+import org.exoplatform.services.log.Log;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
@@ -56,6 +58,8 @@
*/
public class JDBCCacheLoader extends AbstractCacheLoader
{
+ protected static final Log LOG = ExoLogger.getLogger("jcr.JDBCCacheLoader");
+
private IndividualCacheLoaderConfig config;
private WorkspaceDataContainer dataContainer;
@@ -132,8 +136,15 @@
}
}
- if (jdbcConnection != null)
+ if (jdbcConnection != null) {
jdbcConnection.commit();
+ jdbcConnection = null;
+ }
+ }
+ catch (Exception e)
+ {
+ LOG.error("Can not put data to DB", e);
+ throw e;
}
finally
{
@@ -246,9 +257,7 @@
for (int i = 0; i < modifications.size(); i++)
{
- if (modifications.get(i).getType() == ModificationType.PUT_KEY_VALUE
- &&
- modifications.get(i).getValue() instanceof ItemData)
+ if (modifications.get(i).getType() == ModificationType.PUT_KEY_VALUE)
{
ItemData itemData = null;
@@ -262,7 +271,10 @@
{
PropertyData propertyData = (PropertyData) modifications.get(i).getValue();
itemData = jdbcConnection.getItemData(propertyData.getIdentifier());
- } else
+ } else {
+ modifications.set(i, new ModificationEx(modifications.get(i)));
+ continue;
+ }
// Set ModificationEx to list with type UPDATE or ADD.
if (itemData == null)
16 years, 8 months
exo-jcr SVN: r551 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2009-11-10 11:49:51 -0500 (Tue, 10 Nov 2009)
New Revision: 551
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java
Log:
EXOJCR-232 : fix is multiple flag
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java 2009-11-10 15:42:05 UTC (rev 550)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java 2009-11-10 16:49:51 UTC (rev 551)
@@ -47,7 +47,7 @@
* Created by The eXo Platform SAS.
*
* @author <a href="mailto:Sergey.Kabashnyuk@gmail.com">Sergey Kabashnyuk</a>
- * @version $Id: $
+ * @version $Id: AbstractItemDefinitionAccessProvider.java 549 2009-11-10 15:25:10Z skabashnyuk $
*/
public abstract class AbstractItemDefinitionAccessProvider
{
@@ -361,7 +361,7 @@
InternalQName[] value)
{
TransientPropertyData propertyData =
- TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.NAME, false);
+ TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.NAME, true);
List<ValueData> parents = new ArrayList<ValueData>();
for (InternalQName nt : value)
@@ -383,7 +383,7 @@
String[] value)
{
TransientPropertyData propertyData =
- TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.STRING, false);
+ TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.STRING, true);
List<ValueData> valueDatas = new ArrayList<ValueData>();
for (String vc : value)
{
16 years, 8 months
exo-jcr SVN: r550 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2009-11-10 10:42:05 -0500 (Tue, 10 Nov 2009)
New Revision: 550
Added:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ModificationEx.java
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
Log:
EXOJCR-201 : The class ModificationEx was added. The JDBCCacheLoader was changed.
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-10 15:25:10 UTC (rev 549)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JDBCCacheLoader.java 2009-11-10 15:42:05 UTC (rev 550)
@@ -16,24 +16,6 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-/*
- * 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.storage.jbosscache;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
@@ -43,12 +25,14 @@
import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.datamodel.QPathEntry;
import org.exoplatform.services.jcr.impl.Constants;
+import org.exoplatform.services.jcr.impl.storage.jbosscache.ModificationEx.JCROperaionType;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCStorageConnection;
import org.exoplatform.services.jcr.storage.WorkspaceDataContainer;
import org.exoplatform.services.jcr.storage.WorkspaceStorageConnection;
import org.jboss.cache.CacheException;
import org.jboss.cache.Fqn;
import org.jboss.cache.Modification;
+import org.jboss.cache.Modification.ModificationType;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.factories.annotations.Inject;
import org.jboss.cache.factories.annotations.NonVolatile;
@@ -72,6 +56,8 @@
*/
public class JDBCCacheLoader extends AbstractCacheLoader
{
+ private IndividualCacheLoaderConfig config;
+
private WorkspaceDataContainer dataContainer;
public JDBCCacheLoader() {
@@ -100,12 +86,17 @@
{
System.out.println(modifications);
+ // Prepare modifications list.
+ // Will be changed Modification to ModificationEx and set operation type (ADD or UPDATE).
+ prepareModifications(modifications);
+
JDBCStorageConnection jdbcConnection = (JDBCStorageConnection)dataContainer.openConnection();
try
{
- for (Modification m : modifications)
+ for (int i=0; i<modifications.size(); i++)
{
+ ModificationEx m = (ModificationEx) modifications.get(i);
switch (m.getType())
{
case PUT_DATA:
@@ -116,7 +107,12 @@
break;
case PUT_KEY_VALUE:
System.out.println(m);
- doAddOrUpdate(m, jdbcConnection);
+
+ if (m.getOperaionType() == JCROperaionType.ADD)
+ doAdd(m, jdbcConnection);
+ else if (m.getOperaionType() == JCROperaionType.UPDATE)
+ doUpdate(m, jdbcConnection);
+
break;
case REMOVE_DATA:
System.out.println(m);
@@ -184,49 +180,99 @@
}
/**
- * Performs ADD and UPDATE to NodeData and PropertyData.
+ * Performs ADD to NodeData and PropertyData.
* @param modification
* @param jdbcConnection
* @throws IllegalStateException
* @throws RepositoryException
*/
- private void doAddOrUpdate(Modification modification, JDBCStorageConnection jdbcConnection)
+ private void doAdd(ModificationEx modification, JDBCStorageConnection jdbcConnection)
throws IllegalStateException, RepositoryException
{
if (modification.getValue() instanceof NodeData)
{
- //add or update node data
+ //add node data
NodeData nodeData = (NodeData)modification.getValue();
- ItemData itemData = jdbcConnection.getItemData(nodeData.getIdentifier());
+ jdbcConnection.add(nodeData);
+ }
+ else if (modification.getValue() instanceof PropertyData)
+ {
+ //add property data
+ PropertyData propertyData = (PropertyData)modification.getValue();
- if (itemData == null)
- {
- //add
- jdbcConnection.add(nodeData);
- }
- else
- {
- //update
- jdbcConnection.update(nodeData);
- }
+ jdbcConnection.add(propertyData);
}
+ }
+
+ /**
+ * Performs UPDATE to NodeData and PropertyData.
+ * @param modification
+ * @param jdbcConnection
+ * @throws IllegalStateException
+ * @throws RepositoryException
+ */
+ private void doUpdate(ModificationEx modification, JDBCStorageConnection jdbcConnection)
+ throws IllegalStateException, RepositoryException
+ {
+ if (modification.getValue() instanceof NodeData)
+ {
+ //update node data
+ NodeData nodeData = (NodeData)modification.getValue();
+
+ jdbcConnection.update(nodeData);
+ }
else if (modification.getValue() instanceof PropertyData)
{
- //add or update property data
+ //update property data
PropertyData propertyData = (PropertyData)modification.getValue();
- ItemData itemData = jdbcConnection.getItemData(propertyData.getIdentifier());
+ jdbcConnection.update(propertyData);
+ }
+ }
+
+ /**
+ * Prepare list of modifications.
+ *
+ * Will be checked the UPDATE or ADD.
+ *
+ * @param modifications
+ * @throws RepositoryException
+ */
+ private void prepareModifications(List<Modification> modifications) throws RepositoryException
+ {
- if (itemData == null)
+ JDBCStorageConnection jdbcConnection = (JDBCStorageConnection) dataContainer.openConnection();
+
+ for (int i = 0; i < modifications.size(); i++)
+ {
+ if (modifications.get(i).getType() == ModificationType.PUT_KEY_VALUE
+ &&
+ modifications.get(i).getValue() instanceof ItemData)
{
- //add
- jdbcConnection.add(propertyData);
+ ItemData itemData = null;
+
+ //Check add or update node data
+ if (modifications.get(i).getValue() instanceof NodeData)
+ {
+ NodeData nodeData = (NodeData) modifications.get(i).getValue();
+ itemData = jdbcConnection.getItemData(nodeData.getIdentifier());
+ }
+ else if (modifications.get(i).getValue() instanceof PropertyData)
+ {
+ PropertyData propertyData = (PropertyData) modifications.get(i).getValue();
+ itemData = jdbcConnection.getItemData(propertyData.getIdentifier());
+ } else
+
+ // Set ModificationEx to list with type UPDATE or ADD.
+ if (itemData == null)
+ modifications.set(i, new ModificationEx(modifications.get(i), JCROperaionType.ADD));
+ else
+ modifications.set(i, new ModificationEx(modifications.get(i), JCROperaionType.UPDATE));
}
else
{
- //update
- jdbcConnection.update(propertyData);
+ modifications.set(i, new ModificationEx(modifications.get(i)));
}
}
}
@@ -407,8 +453,7 @@
*/
public IndividualCacheLoaderConfig getConfig()
{
- // TODO Auto-generated method stub
- return null;
+ return config;
}
/**
@@ -461,7 +506,7 @@
*/
public void setConfig(IndividualCacheLoaderConfig config)
{
- // TODO Auto-generated method stub
+ this.config = config;
}
Added: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ModificationEx.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ModificationEx.java (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ModificationEx.java 2009-11-10 15:42:05 UTC (rev 550)
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2003-2009 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.impl.storage.jbosscache;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import org.jboss.cache.Modification;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 2009
+ *
+ * @author <a href="mailto:alex.reshetnyak@exoplatform.com.ua">Alex Reshetnyak</a>
+ * @version $Id$
+ */
+public class ModificationEx
+ extends Modification implements Externalizable
+{
+
+ private static final long serialVersionUID = 4362354437203996117L;
+
+ public static enum JCROperaionType
+ {
+ ADD,
+ UPDATE,
+ UNKNOWN
+ }
+
+ /**
+ * The type of JCR operation (update or add).
+ */
+ private JCROperaionType operaionType = JCROperaionType.UNKNOWN;
+
+ /**
+ * Empty constructor to serialization.
+ */
+ public ModificationEx()
+ {
+ }
+
+ /**
+ * The constructor with JCROperaionType.
+ *
+ * @param modification
+ * the original of modification.
+ * @param operaionType
+ * the JCR operation type.
+ */
+ public ModificationEx(Modification modification, JCROperaionType operaionType) {
+ this.setType(modification.getType());
+ this.setFqn(modification.getFqn());
+ this.setFqn2(modification.getFqn2());
+ this.setValue(modification.getValue());
+ this.setOldValue(modification.getOldValue());
+ this.setKey(modification.getKey());
+ this.setData(modification.getData());
+
+ this.operaionType = operaionType;
+ }
+
+ /**
+ * The constructor without JCROperaionType.
+ *
+ * @param modification
+ * the original of modification.
+ */
+ public ModificationEx(Modification modification) {
+ this.setType(modification.getType());
+ this.setFqn(modification.getFqn());
+ this.setFqn2(modification.getFqn2());
+ this.setValue(modification.getValue());
+ this.setOldValue(modification.getOldValue());
+ this.setKey(modification.getKey());
+ this.setData(modification.getData());
+
+ this.operaionType = JCROperaionType.UNKNOWN;
+ }
+
+ /**
+ * Getter to property operaionType.
+ *
+ * @return JCROperaionType
+ * the operation type
+ */
+ public JCROperaionType getOperaionType() {
+ return operaionType;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void writeExternal(ObjectOutput out) throws IOException
+ {
+ super.writeExternal(out);
+
+ out.writeObject(operaionType);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
+ {
+ super.readExternal(in);
+
+ operaionType = (JCROperaionType) in.readObject();
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ public String toString()
+ {
+ return super.toString() + " : " + operaionType.toString();
+ }
+}
Property changes on: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/ModificationEx.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
16 years, 8 months
exo-jcr SVN: r549 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2009-11-10 10:25:10 -0500 (Tue, 10 Nov 2009)
New Revision: 549
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java
Log:
EXOJCR-232 : fix is multiple flag
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java 2009-11-10 14:53:54 UTC (rev 548)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/nodetype/registration/AbstractItemDefinitionAccessProvider.java 2009-11-10 15:25:10 UTC (rev 549)
@@ -361,7 +361,7 @@
InternalQName[] value)
{
TransientPropertyData propertyData =
- TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.NAME, false);
+ TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.NAME, true);
List<ValueData> parents = new ArrayList<ValueData>();
for (InternalQName nt : value)
@@ -383,7 +383,7 @@
String[] value)
{
TransientPropertyData propertyData =
- TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.STRING, false);
+ TransientPropertyData.createPropertyData(parentNode, propertyName, PropertyType.STRING, true);
List<ValueData> valueDatas = new ArrayList<ValueData>();
for (String vc : value)
{
16 years, 8 months
exo-jcr SVN: r548 - in jcr/branches/1.12.0-JBC/component/core/src: main/java/org/exoplatform/services/jcr/impl/storage/inmemory and 4 other directories.
by do-not-reply@jboss.org
Author: tolusha
Date: 2009-11-10 09:53:54 -0500 (Tue, 10 Nov 2009)
New Revision: 548
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorage.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheTreeStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoaderTest.java
Log:
EXOJCR-201: implementation sessionId support
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java 2009-11-10 14:53:54 UTC (rev 548)
@@ -18,10 +18,14 @@
*/
package org.exoplatform.services.jcr.impl.dataflow.persistent;
+import org.exoplatform.services.jcr.dataflow.ChangesLogIterator;
+import org.exoplatform.services.jcr.dataflow.CompositeChangesLog;
import org.exoplatform.services.jcr.dataflow.ItemState;
import org.exoplatform.services.jcr.dataflow.ItemStateChangesLog;
import org.exoplatform.services.jcr.dataflow.PersistentDataManager;
+import org.exoplatform.services.jcr.dataflow.PlainChangesLog;
import org.exoplatform.services.jcr.dataflow.ReadOnlyThroughChanges;
+import org.exoplatform.services.jcr.dataflow.TransactionChangesLog;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListenerFilter;
import org.exoplatform.services.jcr.dataflow.persistent.MandatoryItemsPersistenceListener;
@@ -128,85 +132,103 @@
WorkspaceStorageConnection thisConnection = null;
WorkspaceStorageConnection systemConnection = null;
+ // prepare changes log list
+ List<PlainChangesLog> chengesLogList = new ArrayList<PlainChangesLog>();
+ if (changesLog instanceof PlainChangesLog)
+ {
+ chengesLogList.add((PlainChangesLog)changesLog);
+ }
+ else if (changesLog instanceof CompositeChangesLog)
+ {
+ for (ChangesLogIterator iter = ((CompositeChangesLog)changesLog).getLogIterator(); iter.hasNextLog();)
+ {
+ chengesLogList.add(iter.nextLog());
+ }
+ }
+
try
{
- for (Iterator<ItemState> iter = changesLog.getAllStates().iterator(); iter.hasNext();)
+ for (PlainChangesLog currChangesLog : chengesLogList)
{
- ItemState itemState = iter.next();
+ for (Iterator<ItemState> iter = currChangesLog.getAllStates().iterator(); iter.hasNext();)
+ {
+ ItemState itemState = iter.next();
- if (!itemState.isPersisted())
- continue;
+ if (!itemState.isPersisted())
+ continue;
- long start = System.currentTimeMillis();
+ long start = System.currentTimeMillis();
- TransientItemData data = (TransientItemData)itemState.getData();
+ TransientItemData data = (TransientItemData)itemState.getData();
- WorkspaceStorageConnection conn = null;
- if (isSystemDescendant(data.getQPath()))
- {
- conn = systemConnection == null
- // we need system connection but it's not exist
- ? systemConnection = (systemDataContainer != dataContainer
- // if it's different container instances
- ? systemDataContainer.equals(dataContainer) && thisConnection != null
- // but container confugrations are same and non-system connnection open
- // reuse this connection as system
- ? systemDataContainer.reuseConnection(thisConnection)
- // or open one new system
- : systemDataContainer.openConnection()
- // else if it's same container instances (system and this)
- : thisConnection == null
- // and non-system connection doens't exist - open it
- ? thisConnection = dataContainer.openConnection()
- // if already open - use it
- : thisConnection)
- // system connection opened - use it
- : systemConnection;
- }
- else
- {
- conn = thisConnection == null
- // we need this conatiner conection
- ? thisConnection = (systemDataContainer != dataContainer
- // if it's different container instances
- ? dataContainer.equals(systemDataContainer) && systemConnection != null
- // but container confugrations are same and system connnection open
- // reuse system connection as this
- ? dataContainer.reuseConnection(systemConnection)
- // or open one new
- : dataContainer.openConnection()
- // else if it's same container instances (system and this)
- : systemConnection == null
- // and system connection doens't exist - open it
- ? systemConnection = dataContainer.openConnection()
- // if already open - use it
- : systemConnection)
- // this connection opened - use it
- : thisConnection;
- }
+ WorkspaceStorageConnection conn = null;
+ if (isSystemDescendant(data.getQPath()))
+ {
+ conn = systemConnection == null
+ // we need system connection but it's not exist
+ ? systemConnection = (systemDataContainer != dataContainer
+ // if it's different container instances
+ ? systemDataContainer.equals(dataContainer) && thisConnection != null
+ // but container confugrations are same and non-system connnection open
+ // reuse this connection as system
+ ? systemDataContainer.reuseConnection(thisConnection)
+ // or open one new system
+ : systemDataContainer.openConnection()
+ // else if it's same container instances (system and this)
+ : thisConnection == null
+ // and non-system connection doens't exist - open it
+ ? thisConnection = dataContainer.openConnection()
+ // if already open - use it
+ : thisConnection)
+ // system connection opened - use it
+ : systemConnection;
+ }
+ else
+ {
+ conn = thisConnection == null
+ // we need this conatiner conection
+ ? thisConnection = (systemDataContainer != dataContainer
+ // if it's different container instances
+ ? dataContainer.equals(systemDataContainer) && systemConnection != null
+ // but container confugrations are same and system connnection open
+ // reuse system connection as this
+ ? dataContainer.reuseConnection(systemConnection)
+ // or open one new
+ : dataContainer.openConnection()
+ // else if it's same container instances (system and this)
+ : systemConnection == null
+ // and system connection doens't exist - open it
+ ? systemConnection = dataContainer.openConnection()
+ // if already open - use it
+ : systemConnection)
+ // this connection opened - use it
+ : thisConnection;
+ }
- data.increasePersistedVersion();
+ data.increasePersistedVersion();
- if (itemState.isAdded())
- {
- doAdd(data, conn, addedNodes);
+ if (itemState.isAdded())
+ {
+ doAdd(data, conn, addedNodes);
+ }
+ else if (itemState.isUpdated())
+ {
+ doUpdate(data, conn);
+ }
+ else if (itemState.isDeleted())
+ {
+ doDelete(data, conn);
+ }
+ else if (itemState.isRenamed())
+ {
+ doRename(data, conn, addedNodes);
+ }
+
+ if (LOG.isDebugEnabled())
+ LOG.debug(ItemState.nameFromValue(itemState.getState()) + " " + (System.currentTimeMillis() - start)
+ + "ms, " + data.getQPath().getAsString());
}
- else if (itemState.isUpdated())
- {
- doUpdate(data, conn);
- }
- else if (itemState.isDeleted())
- {
- doDelete(data, conn);
- }
- else if (itemState.isRenamed())
- {
- doRename(data, conn, addedNodes);
- }
-
- if (LOG.isDebugEnabled())
- LOG.debug(ItemState.nameFromValue(itemState.getState()) + " " + (System.currentTimeMillis() - start)
- + "ms, " + data.getQPath().getAsString());
+ // conn.removeSessionInfo();
}
if (thisConnection != null)
thisConnection.commit();
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java 2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/inmemory/InmemoryStorageConnection.java 2009-11-10 14:53:54 UTC (rev 548)
@@ -211,6 +211,20 @@
{
}
+ /**
+ * {@inheritDoc}
+ */
+ public void addSessionInfo(String sessionId, String userId) throws RepositoryException
+ {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void removeSessionInfo() throws RepositoryException
+ {
+ }
+
public boolean isOpened()
{
return false;
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorage.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorage.java 2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorage.java 2009-11-10 14:53:54 UTC (rev 548)
@@ -56,11 +56,16 @@
protected final Node<Serializable, Object> propsRoot;
- protected JBossCacheStorage(Node<Serializable, Object> nodesRoot, Node<Serializable, Object> propsRoot)
+ protected final Node<Serializable, Object> sessionRoot;
+
+ protected JBossCacheStorage(Node<Serializable, Object> nodesRoot, Node<Serializable, Object> propsRoot,
+ Node<Serializable, Object> sessionRoot)
{
this.nodesRoot = nodesRoot;
this.propsRoot = propsRoot;
+
+ this.sessionRoot = sessionRoot;
}
/**
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnection.java 2009-11-10 14:53:54 UTC (rev 548)
@@ -70,9 +70,9 @@
* @param cache Cache<Serializable, Object>
*/
public JBossCacheStorageConnection(Cache<Serializable, Object> cache, Node<Serializable, Object> nodesRoot,
- Node<Serializable, Object> propsRoot)
+ Node<Serializable, Object> propsRoot, Node<Serializable, Object> sessionRoot)
{
- super(nodesRoot, propsRoot);
+ super(nodesRoot, propsRoot, sessionRoot);
this.cache = cache;
}
@@ -257,7 +257,7 @@
if (!key.equals(ITEM_DATA))
{
String propId = (String)parentNode.get(key);
- if (propId == null)
+ if (propId == null)
{
throw new RepositoryException("FATAL Child Property Id key is null. Parent "
+ parent.getQPath().getAsString());
@@ -554,6 +554,39 @@
}
/**
+ * {@inheritDoc}
+ */
+ public void addSessionInfo(String sessionId, String userId) throws RepositoryException
+ {
+ startBatch();
+
+ if (sessionRoot.getData().size() != 0)
+ {
+ throw new RepositoryException("Session attributes already exists in cache storage.");
+ }
+
+ // add attributes
+ sessionRoot.put(JBossCacheStorage.SESSION_ID, sessionId);
+ sessionRoot.put(JBossCacheStorage.USER_ID, userId);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void removeSessionInfo() throws InvalidItemStateException, RepositoryException
+ {
+ startBatch();
+
+ if (sessionRoot.getData().size() == 0)
+ {
+ throw new RepositoryException("Session attributes not exists in cache storage.");
+ }
+
+ // remove attributes
+ sessionRoot.clearData();
+ }
+
+ /**
* Start batching.
*/
private void startBatch()
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheTreeStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheTreeStorageConnection.java 2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheTreeStorageConnection.java 2009-11-10 14:53:54 UTC (rev 548)
@@ -79,7 +79,7 @@
Node<Serializable, Object> itemsRoot)
{
super(treeRoot.getFqn(), itemsRoot.getFqn());
-
+
this.cache = cache;
//this.itemsRoot = itemsRoot;
//this.treeRoot = treeRoot;
@@ -394,6 +394,20 @@
}
/**
+ * {@inheritDoc}
+ */
+ public void addSessionInfo(String sessionId, String userId) throws RepositoryException
+ {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void removeSessionInfo() throws InvalidItemStateException, RepositoryException
+ {
+ }
+
+ /**
* Start batching.
*/
private void startBatch()
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java 2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheWorkspaceDataContainer.java 2009-11-10 14:53:54 UTC (rev 548)
@@ -71,6 +71,8 @@
private Node<Serializable, Object> properties;
+ private Node<Serializable, Object> session;
+
/**
* JBossWorkspaceDataContainer constructor.
*
@@ -113,31 +115,32 @@
// initializes configuration state, the root node, etc.
this.cache.create();
this.cache.start();
-
+
Node<Serializable, Object> cacheRoot = cache.getRoot();
//Node<Serializable, Object> wsRoot = cacheRoot.addChild(Fqn.fromElements(repositoryName, containerName));
// prepare cache structures
this.nodes = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.NODES));
this.properties = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.PROPS));
+ this.session = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.SESSION));
}
public void start()
{
// TODO started on init, due to RepositoryContainer logic
-// if (persistentContainer instanceof Startable)
-// {
-// ((Startable)persistentContainer).start();
-// }
-//
-// this.cache.start();
-//
-// Node<Serializable, Object> cacheRoot = cache.getRoot();
-// //Node<Serializable, Object> wsRoot = cacheRoot.addChild(Fqn.fromElements(repositoryName, containerName));
-//
-// // prepare cache structures
-// this.nodes = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.NODES));
-// this.properties = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.PROPS));
+ // if (persistentContainer instanceof Startable)
+ // {
+ // ((Startable)persistentContainer).start();
+ // }
+ //
+ // this.cache.start();
+ //
+ // Node<Serializable, Object> cacheRoot = cache.getRoot();
+ // //Node<Serializable, Object> wsRoot = cacheRoot.addChild(Fqn.fromElements(repositoryName, containerName));
+ //
+ // // prepare cache structures
+ // this.nodes = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.NODES));
+ // this.properties = cacheRoot.addChild(Fqn.fromElements(JBossCacheStorage.PROPS));
}
public void stop()
@@ -162,12 +165,12 @@
public WorkspaceStorageConnection openConnection() throws RepositoryException
{
// TODO
-// if (nodes == null || properties == null)
-// {
-// throw new RepositoryException("Container is not started");
-// }
+ // if (nodes == null || properties == null)
+ // {
+ // throw new RepositoryException("Container is not started");
+ // }
- return new JBossCacheStorageConnection(cache, nodes, properties);
+ return new JBossCacheStorageConnection(cache, nodes, properties, session);
}
/**
@@ -176,12 +179,12 @@
public WorkspaceStorageConnection openConnection(boolean readOnly) throws RepositoryException
{
// TODO
-// if (nodes == null || properties == null)
-// {
-// throw new RepositoryException("Container is not started");
-// }
-
- return new JBossCacheStorageConnection(cache, nodes, properties);
+ // if (nodes == null || properties == null)
+ // {
+ // throw new RepositoryException("Container is not started");
+ // }
+
+ return new JBossCacheStorageConnection(cache, nodes, properties, session);
}
/**
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java 2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoader.java 2009-11-10 14:53:54 UTC (rev 548)
@@ -95,10 +95,6 @@
}
break;
case REMOVE_DATA :
- break;
- case REMOVE_KEY_VALUE :
- break;
- case REMOVE_NODE :
// perform lock or unlock operation
if (lockChanges.size() == 2)
{
@@ -132,6 +128,10 @@
lockChanges = new ArrayList<Modification>();
sessionId = null;
break;
+ case REMOVE_KEY_VALUE :
+ break;
+ case REMOVE_NODE :
+ break;
case MOVE :
break;
default :
@@ -187,37 +187,30 @@
{
// this is a node and node is locked
String nodeIdentifier = (String)m.getFqn().get(nodesPos + 1);
-
- switch (m.getType())
+ if (lockManager.hasLockNode(nodeIdentifier))
{
- case PUT_DATA_ERASE :
- break;
- case PUT_DATA :
- if (lockManager.hasLockNode(nodeIdentifier))
- {
+ switch (m.getType())
+ {
+ case PUT_DATA_ERASE :
+ break;
+ case PUT_DATA :
removedLock.remove(nodeIdentifier);
- }
- break;
- case PUT_KEY_VALUE :
- break;
- case REMOVE_DATA :
- break;
- case REMOVE_KEY_VALUE :
- break;
- case REMOVE_NODE :
- if (lockManager.hasLockNode(nodeIdentifier))
- {
+ break;
+ case PUT_KEY_VALUE :
+ break;
+ case REMOVE_DATA :
+ break;
+ case REMOVE_KEY_VALUE :
+ break;
+ case REMOVE_NODE :
removedLock.add(nodeIdentifier);
- }
- break;
- case MOVE :
- if (lockManager.hasLockNode(nodeIdentifier))
- {
+ break;
+ case MOVE :
removedLock.remove(nodeIdentifier);
- }
- break;
- default :
- throw new CacheException("Unknown modification " + m.getType());
+ break;
+ default :
+ throw new CacheException("Unknown modification " + m.getType());
+ }
}
}
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCStorageConnection.java 2009-11-10 14:53:54 UTC (rev 548)
@@ -697,6 +697,20 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
+ public void addSessionInfo(String sessionId, String userId) throws RepositoryException
+ {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void removeSessionInfo() throws RepositoryException
+ {
+ }
+
// ------------------ Private methods ---------------
/**
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/storage/WorkspaceStorageConnection.java 2009-11-10 14:53:54 UTC (rev 548)
@@ -309,6 +309,28 @@
void close() throws IllegalStateException, RepositoryException;
/**
+ * Add session information to cache storage.
+ *
+ * @param sessionId
+ * the session identifier to be added
+ *
+ * @param userId
+ * the user identifier to be added
+ *
+ * @throws RepositoryException
+ * if some exception occured
+ */
+ void addSessionInfo(String sessionId, String userId) throws RepositoryException;
+
+ /**
+ * Remove session information from cache storage.
+ *
+ * @throws RepositoryException
+ * if some exception occured
+ */
+ void removeSessionInfo() throws RepositoryException;
+
+ /**
* Returns true if connection can be used.
*
* @return boolean, true if connection is open and ready, false - otherwise
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java 2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/AbstractCacheLoaderTest.java 2009-11-10 14:53:54 UTC (rev 548)
@@ -219,7 +219,7 @@
public List<Modification> removeSession()
{
List<Modification> list = new ArrayList<Modification>();
- list.add(new Modification(ModificationType.REMOVE_NODE, Fqn.fromString("/" + JBossCacheStorage.SESSION)));
+ list.add(new Modification(ModificationType.REMOVE_DATA, Fqn.fromString("/" + JBossCacheStorage.SESSION)));
return list;
}
}
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java 2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/JBossCacheStorageConnectionTest.java 2009-11-10 14:53:54 UTC (rev 548)
@@ -16,24 +16,6 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-/*
- * 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.storage.jbosscache;
import junit.framework.TestCase;
@@ -78,6 +60,8 @@
protected Node<Serializable, Object> props;
+ protected Node<Serializable, Object> session;
+
protected String jbcConfig;
/**
@@ -103,16 +87,17 @@
// prepare cache structures
nodes = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.NODES));
props = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.PROPS));
+ session = cacheRoot.addChild(Fqn.fromString(JBossCacheStorage.SESSION));
// JCR connection
- conn = new JBossCacheStorageConnection(cache, nodes, props);
+ conn = new JBossCacheStorageConnection(cache, nodes, props, session);
}
protected void initJBCConfig()
{
jbcConfig = "conf/standalone/test-jbosscache-config-jdbcloader.xml";
}
-
+
protected void initJBC() throws Exception
{
// empty here
@@ -178,7 +163,7 @@
Object propValue) throws UnsupportedEncodingException, IllegalStateException, IOException
{
String pid = (String)node.get(propName.getAsString());
-
+
assertNotNull("Property ID should exists", pid);
assertEquals("Property ID wrong", propId, pid);
@@ -282,7 +267,7 @@
checkChildProp(rootNode, Constants.JCR_PRIMARYTYPE, propId1, propPath1, propValue1);
checkChildProp(rootNode, Constants.JCR_MIXINTYPES, propId2, propPath2, propValue2);
-
+
// TODO check order
int index = 0;
for (Serializable key : rootNode.getKeys())
@@ -505,11 +490,11 @@
// check
treePrint(props);
-
+
Node<Serializable, Object> rootNode = nodes.getChild(Fqn.fromElements(Constants.ROOT_UUID));
assertEquals("Attributes ammount wrong", 2, rootNode.getKeys().size());
-
+
checkChildProp(rootNode, Constants.JCR_PRIMARYTYPE, propId1, propPath1, propValueU);
}
@@ -560,7 +545,7 @@
// check
treePrint(props);
-
+
// check
ItemData propItem =
conn.getItemData(new TransientNodeData(Constants.ROOT_PATH, Constants.ROOT_UUID, 1, Constants.NT_UNSTRUCTURED,
Modified: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoaderTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoaderTest.java 2009-11-10 13:32:20 UTC (rev 547)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/LockCacheLoaderTest.java 2009-11-10 14:53:54 UTC (rev 548)
@@ -17,16 +17,13 @@
package org.exoplatform.services.jcr.impl.storage.jbosscache;
import org.exoplatform.services.jcr.datamodel.InternalQName;
-import org.exoplatform.services.jcr.datamodel.NodeData;
import org.exoplatform.services.jcr.datamodel.QPath;
import org.exoplatform.services.jcr.impl.Constants;
-import org.exoplatform.services.jcr.impl.core.NodeImpl;
import org.exoplatform.services.jcr.impl.core.lock.LockData;
import org.exoplatform.services.jcr.impl.core.value.ValueFactoryImpl;
-import org.exoplatform.services.jcr.impl.dataflow.TransientNodeData;
import org.exoplatform.services.jcr.impl.dataflow.TransientPropertyData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
-import org.exoplatform.services.jcr.util.IdGenerator;
+
import org.jboss.cache.Modification;
import java.util.ArrayList;
16 years, 8 months
exo-jcr SVN: r547 - jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/cacheloader.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2009-11-10 08:32:20 -0500 (Tue, 10 Nov 2009)
New Revision: 547
Modified:
jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/cacheloader/IndexerCacheLoader.java
Log:
EXOJCR-202: IndexerCacheLoaderTest updated
Modified: jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/cacheloader/IndexerCacheLoader.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/cacheloader/IndexerCacheLoader.java 2009-11-10 12:07:26 UTC (rev 546)
+++ jcr/branches/1.12.0-JBC/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/query/cacheloader/IndexerCacheLoader.java 2009-11-10 13:32:20 UTC (rev 547)
@@ -16,6 +16,7 @@
*/
package org.exoplatform.services.jcr.impl.core.query.cacheloader;
+import org.exoplatform.services.jcr.datamodel.PropertyData;
import org.exoplatform.services.jcr.impl.core.query.SearchManager;
import org.exoplatform.services.jcr.impl.storage.jbosscache.AbstractWriteOnlyCacheLoader;
import org.exoplatform.services.jcr.impl.storage.jbosscache.JBossCacheStorage;
@@ -115,8 +116,7 @@
}
else
{
- // this is property
- // TODO do update of node - need uuid of owner node
+ // this is property - do nothing
}
break;
case PUT_DATA_ERASE :
@@ -128,24 +128,26 @@
}
else
{
- // TODO do update of node - need uuid of owner node
+ // this is property - do nothing
}
-
break;
case PUT_KEY_VALUE :
- // update node
- if (isNode(m.getFqn()))
+
+ if (!isNode(m.getFqn()))
{
- if (addedNodes.contains(uuid))
- {
- // do nothing - node by uuid will be indexed
- }
- else
- {
- // update document by this uuid
- updateNodes.add(uuid);
- }
+ PropertyData property = (PropertyData)m.getValue();
+ uuid = property.getParentIdentifier();
}
+
+ if (addedNodes.contains(uuid))
+ {
+ // do nothing - node by uuid will be indexed
+ }
+ else
+ {
+ // update document by this uuid
+ updateNodes.add(uuid);
+ }
break;
case REMOVE_DATA :
// update node
@@ -155,8 +157,7 @@
}
else
{
- //TODO do update of owner node
- //updateNodes.add(owner_uuid);
+ // this is a property - do nothing
}
break;
case REMOVE_KEY_VALUE :
@@ -170,8 +171,7 @@
}
else
{
- //TODO do update of owner node
- //updateNodes.add(owner_uuid);
+ // this is a property - do nothing
}
break;
@@ -183,8 +183,7 @@
}
else
{
- //TODO do update of owner node
- //updateNodes.add(owner_uuid);
+ // this is a property - do nothing
}
break;
@@ -201,9 +200,8 @@
else
{
// must be never happen
- // TODO update both nodes
+ throw new UnsupportedOperationException("Moving of properties is unsupported.");
}
-
break;
default :
throw new CacheException("Unknown modification " + m.getType());
16 years, 8 months
exo-jcr SVN: r546 - jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2009-11-10 07:07:26 -0500 (Tue, 10 Nov 2009)
New Revision: 546
Added:
jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/SimpleNodeReadTest.java
Log:
EXOJCR-199: simple test on JCR core
Added: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/SimpleNodeReadTest.java
===================================================================
--- jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/SimpleNodeReadTest.java (rev 0)
+++ jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/SimpleNodeReadTest.java 2009-11-10 12:07:26 UTC (rev 546)
@@ -0,0 +1,86 @@
+/*
+ * 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 3 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.storage.jbosscache;
+
+import org.exoplatform.services.jcr.JcrImplBaseTest;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
+import javax.jcr.Value;
+
+/**
+ * Created by The eXo Platform SAS.
+ *
+ * <br/>Date: 10.11.2009
+ *
+ * @author <a href="mailto:peter.nedonosko@exoplatform.com.ua">Peter Nedonosko</a>
+ * @version $Id$
+ */
+public class SimpleNodeReadTest extends JcrImplBaseTest
+{
+
+ public void testReadRootNode() throws Exception
+ {
+ Node root = session.getRootNode();
+
+ log.info(session.getWorkspace().getName() + " " + root.getPath());
+ log.info("Properties: ");
+ try
+ {
+ for (PropertyIterator pi = root.getProperties(); pi.hasNext();)
+ {
+ Property p = pi.nextProperty();
+ String values = "";
+ if (p.getDefinition().isMultiple())
+ {
+ for (Value v : p.getValues())
+ {
+ values += v.getString() + " ";
+ }
+ }
+ else
+ {
+ values += p.getString();
+ }
+ log.info(p.getPath() + " : " + values);
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Error: ", e);
+ }
+
+ log.info("Child nodes: ");
+ try
+ {
+ for (NodeIterator ni = root.getNodes(); ni.hasNext();)
+ {
+ Node n = ni.nextNode();
+ log.info(n.getPath() + " : " + n.getPrimaryNodeType().getName());
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Error: ", e);
+ }
+ }
+
+}
Property changes on: jcr/branches/1.12.0-JBC/component/core/src/test/java/org/exoplatform/services/jcr/impl/storage/jbosscache/SimpleNodeReadTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Id
16 years, 8 months