Author: dkatayev
Date: 2010-06-08 11:32:15 -0400 (Tue, 08 Jun 2010)
New Revision: 2518
Added:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/AddNamespacePluginHolder.java
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.h2.sql
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.h2.sql
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/BackupWorkspaceInitializer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceRegistryImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/cas/JDBCValueContentAddressStorageImpl.java
Log:
EXOJCR-751 Prepare maintenance branch for jcr 1.12: EXOJCR-570, EXOJCR-626, EXOJCR-420,
EXOJCR-635, EXOJCR-732, EXOJCR-542 ported from 1.14.x
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2010-06-08 13:54:09 UTC (rev 2517)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2010-06-08 15:32:15 UTC (rev 2518)
@@ -295,9 +295,8 @@
<!-- dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <version>1.0.74</version>
- <scope>test</scope>
- </dependency -->
+ <version>1.2.132</version>
+ </dependency-->
<!-- Ingres Database (local repository) -->
<!-- dependency>
<groupId>com.ingres.jdbc</groupId>
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java 2010-06-08
13:54:09 UTC (rev 2517)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryContainer.java 2010-06-08
15:32:15 UTC (rev 2518)
@@ -19,6 +19,7 @@
package org.exoplatform.services.jcr.impl;
import org.exoplatform.container.ExoContainer;
+import org.exoplatform.container.component.ComponentPlugin;
import org.exoplatform.container.jmx.MX4JComponentAdapterFactory;
import org.exoplatform.management.annotations.Managed;
import org.exoplatform.management.annotations.ManagedDescription;
@@ -31,6 +32,7 @@
import org.exoplatform.services.jcr.config.WorkspaceEntry;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
+import org.exoplatform.services.jcr.impl.core.AddNamespacePluginHolder;
import org.exoplatform.services.jcr.impl.core.LocationFactory;
import org.exoplatform.services.jcr.impl.core.NamespaceDataPersister;
import org.exoplatform.services.jcr.impl.core.NamespaceRegistryImpl;
@@ -101,17 +103,52 @@
private final Log log =
ExoLogger.getLogger("exo.jcr.component.core.RepositoryContainer");
/**
+ * List of AddNamespacePlugin.
+ */
+ private List<ComponentPlugin> addNamespacePlugins;
+
+ /**
* RepositoryContainer constructor.
*
* @param parent
* container
* @param config
* Repository configuration
+ * @param addNamespacePlugins
+ * list of addNamespacePlugin
* @throws RepositoryException
* container initialization error
* @throws RepositoryConfigurationException
* configuration error
*/
+ public RepositoryContainer(ExoContainer parent, RepositoryEntry config,
List<ComponentPlugin> addNamespacePlugins)
+ throws RepositoryException, RepositoryConfigurationException
+ {
+
+ super(new MX4JComponentAdapterFactory(), parent);
+
+ // Defaults:
+ if (config.getAccessControl() == null)
+ config.setAccessControl(AccessControlPolicy.OPTIONAL);
+
+ this.config = config;
+ this.addNamespacePlugins = addNamespacePlugins;
+
+ registerComponents();
+ }
+
+ /**
+ * RepositoryContainer constructor.
+ *
+ * @param parent
+ * container
+ * @param config
+ * Repository configuration
+ * @throws RepositoryException
+ * container initialization error
+ * @throws RepositoryConfigurationException
+ * configuration error
+ */
public RepositoryContainer(ExoContainer parent, RepositoryEntry config) throws
RepositoryException,
RepositoryConfigurationException
{
@@ -487,7 +524,6 @@
private void registerRepositoryComponents() throws RepositoryConfigurationException,
RepositoryException
{
-
registerComponentImplementation(IdGenerator.class);
registerComponentImplementation(RepositoryIndexSearcherHolder.class);
@@ -496,6 +532,8 @@
registerComponentImplementation(LocationFactory.class);
registerComponentImplementation(ValueFactoryImpl.class);
+ registerComponentInstance(new AddNamespacePluginHolder(addNamespacePlugins));
+
registerComponentImplementation(JCRNodeTypeDataPersister.class);
registerComponentImplementation(NamespaceDataPersister.class);
registerComponentImplementation(NamespaceRegistryImpl.class);
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2010-06-08
13:54:09 UTC (rev 2517)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/RepositoryServiceImpl.java 2010-06-08
15:32:15 UTC (rev 2518)
@@ -31,6 +31,7 @@
import org.exoplatform.services.jcr.core.ManageableRepository;
import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
import org.exoplatform.services.jcr.dataflow.persistent.ItemsPersistenceListener;
+import org.exoplatform.services.jcr.impl.core.AddNamespacePluginHolder;
import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
import org.exoplatform.services.jcr.impl.core.SessionRegistry;
import org.exoplatform.services.log.ExoLogger;
@@ -149,7 +150,7 @@
throw new RepositoryConfigurationException("Repository container " +
rEntry.getName() + " already started");
}
- RepositoryContainer repositoryContainer = new RepositoryContainer(parentContainer,
rEntry);
+ RepositoryContainer repositoryContainer = new RepositoryContainer(parentContainer,
rEntry, addNamespacesPlugins);
// Storing and starting the repository container under
// key=repository_name
@@ -157,6 +158,7 @@
{
repositoryContainers.put(rEntry.getName(), repositoryContainer);
managerStartChanges.registerListeners(repositoryContainer);
+
repositoryContainer.start();
}
catch (Throwable t)
@@ -174,7 +176,6 @@
config.getRepositoryConfigurations().add(rEntry);
}
- addNamespaces(rEntry.getName());
registerNodeTypes(rEntry.getName());
// turn on Repository ONLINE
@@ -302,53 +303,6 @@
managerStartChanges.cleanup();
}
- private void addNamespaces() throws RepositoryException
- {
-
- for (RepositoryEntry repoConfig : config.getRepositoryConfigurations())
- {
- addNamespaces(repoConfig.getName());
- }
- }
-
- private void addNamespaces(String repositoryName) throws RepositoryException
- {
-
- ManageableRepository repository = getRepository(repositoryName);
- NamespaceRegistry nsRegistry = repository.getNamespaceRegistry();
-
- for (int j = 0; j < addNamespacesPlugins.size(); j++)
- {
- AddNamespacesPlugin plugin = (AddNamespacesPlugin)addNamespacesPlugins.get(j);
- Map<String, String> namespaces = plugin.getNamespaces();
- try
- {
- for (Map.Entry<String, String> namespace : namespaces.entrySet())
- {
-
- String prefix = namespace.getKey();
- String uri = namespace.getValue();
-
- // register namespace if not found
- try
- {
- nsRegistry.getURI(prefix);
- }
- catch (NamespaceException e)
- {
- nsRegistry.registerNamespace(prefix, uri);
- }
- if (log.isDebugEnabled())
- log.debug("Namespace is registered " + prefix + " =
" + uri);
- }
- }
- catch (Exception e)
- {
- log.error("Error load namespaces ", e);
- }
- }
- }
-
private void init(ExoContainer container) throws RepositoryConfigurationException,
RepositoryException
{
this.parentContainer = container;
Copied:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/AddNamespacePluginHolder.java
(from rev 2344,
jcr/branches/1.14.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/AddNamespacePluginHolder.java)
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/AddNamespacePluginHolder.java
(rev 0)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/AddNamespacePluginHolder.java 2010-06-08
15:32:15 UTC (rev 2518)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2010 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;
+
+import org.exoplatform.container.component.ComponentPlugin;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * AddNamespacePluginHolder is used in NamespaceRegistryImpl for registration
+ * namespaces from xml-configuration after repository start.
+ *
+ * @author <a href="anatoliy.bazko(a)exoplatform.org">Anatoliy
Bazko</a>
+ * @version $Id: AddNamespacePluginHolder.java 111 2010-11-11 11:11:11Z tolusha $
+ */
+public class AddNamespacePluginHolder
+{
+ private final List<ComponentPlugin> addNamespacesPlugins;
+
+ /**
+ * AddNamespacePluginHolder constructor.
+ *
+ * @param componentPlugins
+ * list of AddNamespacesPlugins
+ */
+ public AddNamespacePluginHolder(List<ComponentPlugin> componentPlugins)
+ {
+ this.addNamespacesPlugins = new
ArrayList<ComponentPlugin>(componentPlugins);
+ }
+
+ /**
+ * @return unmodifiable list of AddNamespacesPlugins
+ */
+ public List<ComponentPlugin> getAddNamespacesPlugins()
+ {
+ return Collections.unmodifiableList(addNamespacesPlugins);
+ }
+}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/BackupWorkspaceInitializer.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/BackupWorkspaceInitializer.java 2010-06-08
13:54:09 UTC (rev 2517)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/BackupWorkspaceInitializer.java 2010-06-08
15:32:15 UTC (rev 2518)
@@ -448,12 +448,12 @@
ItemData itemData = itemState.getData();
PersistedPropertyData propertyData = (PersistedPropertyData)itemData;
- ValueData tvd =
-
(ValueData)(propertyData.getValues().get(listFixupStream.get(i).getValueDataId()));
+ TransientValueData tvd =
+
(TransientValueData)(propertyData.getValues().get(listFixupStream.get(i).getValueDataId()));
// re-init the value
- propertyData.getValues().set(listFixupStream.get(i).getValueDataId(),
- new StreamPersistedValueData(tvd.getOrderNumber(),
listFile.get(i)));
+ tvd.delegate(new TransientValueData(tvd.getOrderNumber(), null, null, new
SpoolFile(listFile.get(i)
+ .getAbsolutePath()), fileCleaner, -1, null, true));
}
for (int i = 0; i < listFile.size(); i++)
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2010-06-08
13:54:09 UTC (rev 2517)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/ItemImpl.java 2010-06-08
15:32:15 UTC (rev 2518)
@@ -416,7 +416,9 @@
int version;
PropertyImpl prevProp;
PropertyDefinitionDatas defs;
- ItemImpl prevItem = dataManager.getItem(parentNode.nodeData(), new
QPathEntry(propertyName, 0), true);
+ ItemImpl prevItem =
+ dataManager.getItem(parentNode.nodeData(), new QPathEntry(propertyName, 0),
true, dataManager.isNew(parentNode
+ .getIdentifier()));
NodeTypeDataManager ntm = session.getWorkspace().getNodeTypesHolder();
NodeData parentData = (NodeData)parentNode.getData();
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceRegistryImpl.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceRegistryImpl.java 2010-06-08
13:54:09 UTC (rev 2517)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NamespaceRegistryImpl.java 2010-06-08
15:32:15 UTC (rev 2518)
@@ -18,8 +18,10 @@
*/
package org.exoplatform.services.jcr.impl.core;
+import org.exoplatform.container.component.ComponentPlugin;
import org.exoplatform.services.jcr.dataflow.DataManager;
import org.exoplatform.services.jcr.datamodel.ItemData;
+import org.exoplatform.services.jcr.impl.AddNamespacesPlugin;
import org.exoplatform.services.jcr.impl.core.query.RepositoryIndexSearcherHolder;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -99,6 +101,8 @@
private NamespaceDataPersister persister;
+ private AddNamespacePluginHolder addNamespacePluginHolder;
+
/**
* for tests.
*/
@@ -106,19 +110,35 @@
{
this.namespaces = new HashMap<String, String>(DEF_NAMESPACES);
this.prefixes = new HashMap<String, String>(DEF_PREFIXES);
+
this.dataManager = null;
this.indexSearcherHolder = null;
+ this.persister = null;
+ this.addNamespacePluginHolder = null;
}
public NamespaceRegistryImpl(NamespaceDataPersister persister, DataManager
dataManager,
RepositoryIndexSearcherHolder indexSearcherHolder)
{
+ this.namespaces = new HashMap<String, String>(DEF_NAMESPACES);
+ this.prefixes = new HashMap<String, String>(DEF_PREFIXES);
this.dataManager = dataManager;
this.indexSearcherHolder = indexSearcherHolder;
+ this.persister = persister;
+ this.addNamespacePluginHolder = null;
+ }
+
+ public NamespaceRegistryImpl(NamespaceDataPersister persister, DataManager
dataManager,
+ RepositoryIndexSearcherHolder indexSearcherHolder, AddNamespacePluginHolder
addNamespacePluginHolder)
+ {
this.namespaces = new HashMap<String, String>(DEF_NAMESPACES);
this.prefixes = new HashMap<String, String>(DEF_PREFIXES);
+
+ this.dataManager = dataManager;
+ this.indexSearcherHolder = indexSearcherHolder;
this.persister = persister;
+ this.addNamespacePluginHolder = addNamespacePluginHolder;
}
/**
@@ -257,7 +277,6 @@
{
if (!started)
{
-
// save default
if (persister != null)
{
@@ -278,6 +297,12 @@
throw new RuntimeException(e.getLocalizedMessage(), e);
}
}
+
+ if (addNamespacePluginHolder != null)
+ {
+ addPendingNamespaces();
+ }
+
started = true;
}
}
@@ -370,4 +395,37 @@
}
+ private void addPendingNamespaces()
+ {
+ for (ComponentPlugin plugin : addNamespacePluginHolder.getAddNamespacesPlugins())
+ {
+ Map<String, String> namespaces =
((AddNamespacesPlugin)plugin).getNamespaces();
+ try
+ {
+ for (Map.Entry<String, String> namespace : namespaces.entrySet())
+ {
+
+ String prefix = namespace.getKey();
+ String uri = namespace.getValue();
+
+ // register namespace if not found
+ try
+ {
+ getURI(prefix);
+ }
+ catch (NamespaceException e)
+ {
+ registerNamespace(prefix, uri);
+ }
+ if (log.isDebugEnabled())
+ log.debug("Namespace is registered " + prefix + " =
" + uri);
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Error load namespaces ", e);
+ }
+ }
+ }
+
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2010-06-08
13:54:09 UTC (rev 2517)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java 2010-06-08
15:32:15 UTC (rev 2518)
@@ -47,6 +47,7 @@
import org.exoplatform.services.log.Log;
import java.io.IOException;
+import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -199,6 +200,15 @@
*/
public ItemData getItemData(NodeData parent, QPathEntry name) throws
RepositoryException
{
+ return getItemData(parent, name, false);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ private ItemData getItemData(NodeData parent, QPathEntry name, boolean
skipCheckInPersistence)
+ throws RepositoryException
+ {
if (name.getName().equals(JCRPath.PARENT_RELPATH) &&
name.getNamespace().equals(Constants.NS_DEFAULT_URI))
{
if (parent.getIdentifier().equals(Constants.ROOT_UUID))
@@ -218,7 +228,10 @@
if (state == null)
{
// 2. Try from txdatamanager
- data = transactionableManager.getItemData(parent, name);
+ if (!(skipCheckInPersistence))
+ {
+ data = transactionableManager.getItemData(parent, name);
+ }
}
else if (!state.isDeleted())
{
@@ -289,6 +302,45 @@
}
/**
+ * Return Item by parent NodeDada and the name of searched item.
+ *
+ * @param parent
+ * - parent of the searched item
+ * @param name
+ * - item name
+ * @param pool
+ * - indicates does the item fall in pool
+ * @param skipCheckInPersistence
+ * - skip getting Item from persistence if need
+ * @return existed item or null if not found
+ * @throws RepositoryException
+ */
+ public ItemImpl getItem(NodeData parent, QPathEntry name, boolean pool, boolean
skipCheckInPersistence)
+ throws RepositoryException
+ {
+ long start = System.currentTimeMillis();
+ if (log.isDebugEnabled())
+ {
+ log.debug("getItem(" + parent.getQPath().getAsString() + " +
" + name.getAsString() + " ) >>>>>");
+ }
+
+ ItemImpl item = null;
+ try
+ {
+ return item = readItem(getItemData(parent, name, skipCheckInPersistence),
pool);
+ }
+ finally
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("getItem(" + parent.getQPath().getAsString() + " +
" + name.getAsString() + ") --> "
+ + (item != null ? item.getPath() : "null") + "
<<<<< " + ((System.currentTimeMillis() - start) / 1000d)
+ + "sec");
+ }
+ }
+ }
+
+ /**
* Return Item by parent NodeDada and array of QPathEntry which represent a relative
path to the
* searched item
*
@@ -923,22 +975,25 @@
Collection<ItemImpl> pooledItems = itemsPool.getAll();
for (ItemImpl item : pooledItems)
{
- if (item.getInternalPath().isDescendantOf(fromItem.getQPath())
- || item.getInternalPath().equals(fromItem.getQPath()))
+ if (item != null)
{
- ItemData ri = getItemData(item.getInternalIdentifier());
- if (ri != null)
+ if (item.getInternalPath().isDescendantOf(fromItem.getQPath())
+ || item.getInternalPath().equals(fromItem.getQPath()))
{
- itemsPool.reload(ri);
+ ItemData ri = getItemData(item.getInternalIdentifier());
+ if (ri != null)
+ {
+ itemsPool.reload(ri);
+ }
+ else
+ {
+ // the item is invalid, case of version restore - the item from non
+ // current version
+ item.invalidate();
+ }
+
+ invalidated.add(item);
}
- else
- {
- // the item is invalid, case of version restore - the item from non
- // current version
- item.invalidate();
- }
-
- invalidated.add(item);
}
}
}
@@ -1958,25 +2013,31 @@
protected final class ItemReferencePool
{
- private WeakHashMap<String, ItemImpl> items;
+ private WeakHashMap<String, WeakReference<ItemImpl>> items;
- //private WeakHashMap<String, ItemData> datas;
-
ItemReferencePool()
{
- items = new WeakHashMap<String, ItemImpl>();
- //datas = new WeakHashMap<String, ItemData>();
+ items = new WeakHashMap<String, WeakReference<ItemImpl>>();
}
ItemImpl remove(String identifier)
{
- //datas.remove(identifier);
- return items.remove(identifier);
+ WeakReference<ItemImpl> weakItem = items.remove(identifier);
+ return weakItem != null ? weakItem.get() : null;
}
Collection<ItemImpl> getAll()
{
- return items.values();
+ List<ItemImpl> list = new ArrayList<ItemImpl>();
+ for (WeakReference<ItemImpl> weakItem : items.values())
+ {
+ if (weakItem != null)
+ {
+ list.add(weakItem.get());
+ }
+ }
+
+ return list;
}
int size()
@@ -2017,23 +2078,20 @@
ItemImpl get(final ItemData newData, final NodeData parent) throws
RepositoryException
{
final String identifier = newData.getIdentifier();
- ItemImpl item = items.get(identifier);
+
+ WeakReference<ItemImpl> weakItem = items.get(identifier);
+ ItemImpl item = weakItem != null ? weakItem.get() : null;
+
if (item != null)
{
item.loadData(newData, parent);
}
else
{
- // ItemData preloaded = datas.remove(identifier);
- // item =
- // itemFactory.createItem(preloaded != null
- // && preloaded.getPersistedVersion() >
newData.getPersistedVersion() ? preloaded : newData);
- //datas.remove(identifier);
-
// TODO if (changesLog.get) check if DELETED!!
item = itemFactory.createItem(newData, parent);
- items.put(item.getInternalIdentifier(), item);
+ items.put(item.getInternalIdentifier(), new
WeakReference<ItemImpl>(item));
}
return item;
}
@@ -2053,16 +2111,14 @@
ItemImpl reload(String identifier, ItemData newItemData) throws
RepositoryException
{
- ItemImpl item = items.get(identifier);
+ WeakReference<ItemImpl> weakItem = items.get(identifier);
+ ItemImpl item = weakItem != null ? weakItem.get() : null;
+
if (item != null)
{
item.loadData(newItemData);
return item;
}
- // else
- // {
- // datas.put(identifier, newItemData);
- // }
return null;
}
@@ -2080,10 +2136,13 @@
for (NodeImpl node : nodes)
{
String id = node.getInternalIdentifier();
- NodeImpl pooled = (NodeImpl)items.get(id);
+
+ WeakReference<ItemImpl> weakItem = items.get(id);
+ NodeImpl pooled = weakItem != null ? (NodeImpl)weakItem.get() : null;
+
if (pooled == null)
{
- items.put(id, node);
+ items.put(id, new WeakReference<ItemImpl>(node));
children.add(node);
}
else
@@ -2109,10 +2168,13 @@
for (PropertyImpl prop : props)
{
String id = prop.getInternalIdentifier();
- PropertyImpl pooled = (PropertyImpl)items.get(id);
+
+ WeakReference<ItemImpl> weakItem = items.get(id);
+ PropertyImpl pooled = weakItem != null ? (PropertyImpl)weakItem.get() :
null;
+
if (pooled == null)
{
- items.put(id, prop);
+ items.put(id, new WeakReference<ItemImpl>(prop));
children.add(prop);
}
else
@@ -2134,12 +2196,15 @@
{
List<ItemImpl> desc = new ArrayList<ItemImpl>();
- Collection<ItemImpl> snapshort = items.values();
+ Collection<ItemImpl> snapshort = getAll();
for (ItemImpl pitem : snapshort)
{
- if (pitem.getData().getQPath().isDescendantOf(parentPath))
+ if (pitem != null)
{
- desc.add(pitem);
+ if (pitem.getData().getQPath().isDescendantOf(parentPath))
+ {
+ desc.add(pitem);
+ }
}
}
@@ -2151,11 +2216,14 @@
String str = "Items Pool: \n";
try
{
- for (ItemImpl item : items.values())
+ for (ItemImpl item : getAll())
{
- str +=
- (item.isNode() ? "Node\t\t" : "Property\t") +
"\t" + item.isValid() + "\t" + item.isNew() + "\t"
- + item.getInternalIdentifier() + "\t" + item.getPath() +
"\n";
+ if (item != null)
+ {
+ str +=
+ (item.isNode() ? "Node\t\t" : "Property\t") +
"\t" + item.isValid() + "\t" + item.isNew() + "\t"
+ + item.getInternalIdentifier() + "\t" + item.getPath()
+ "\n";
+ }
}
}
catch (Exception e)
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java 2010-06-08
13:54:09 UTC (rev 2517)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SysViewWorkspaceInitializer.java 2010-06-08
15:32:15 UTC (rev 2518)
@@ -776,8 +776,8 @@
if (pfile != null)
{
vdata =
- new
TransientValueData(currentProperty.getValues().size(), null, null, pfile,
- fileCleaner, maxBufferSize, null, true);
+ new
TransientValueData(currentProperty.getValues().size(), null, null,
+ new SpoolFile(pfile.getAbsolutePath()),
fileCleaner, maxBufferSize, null, true);
}
else
{
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java 2010-06-08
13:54:09 UTC (rev 2517)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/WorkspaceImpl.java 2010-06-08
15:32:15 UTC (rev 2518)
@@ -294,7 +294,9 @@
public QueryManager getQueryManager() throws RepositoryException
{
if (queryManager == null)
- throw new RepositoryException("Query Manager Factory not found. Check
configuration.");
+ throw new RepositoryException(
+ "Query Manager Factory not found. Check configuration of the
query-handler for workspace " + getName()
+ + ".");
return queryManager;
}
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java 2010-06-08
13:54:09 UTC (rev 2517)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/EditableValueData.java 2010-06-08
15:32:15 UTC (rev 2518)
@@ -19,6 +19,7 @@
package org.exoplatform.services.jcr.impl.dataflow;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
+import org.exoplatform.services.jcr.impl.util.io.SpoolFile;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -59,7 +60,7 @@
}
// TODO use InputStream instead of spoolFile and use Channel.transferFrom.
- public NewEditableValueData(File spoolFile, int orderNumber, FileCleaner
fileCleaner, int maxBufferSize,
+ public NewEditableValueData(SpoolFile spoolFile, int orderNumber, FileCleaner
fileCleaner, int maxBufferSize,
File tempDirectory) throws IOException
{
@@ -68,11 +69,11 @@
this.maxIOBuffSize = calcMaxIOSize();
- File sf = null;
+ SpoolFile sf = null;
FileChannel sch = null;
try
{
- sf = File.createTempFile("jcrvdedit", null, tempDirectory);
+ sf = SpoolFile.createTempFile("jcrvdedit", null, tempDirectory);
sch = new RandomAccessFile(sf, "rw").getChannel();
@@ -123,7 +124,7 @@
this.maxIOBuffSize = calcMaxIOSize();
- File sf = File.createTempFile("jcrvdedit", null, tempDirectory);
+ SpoolFile sf = SpoolFile.createTempFile("jcrvdedit", null,
tempDirectory);
OutputStream sfout = new FileOutputStream(sf);
try
{
@@ -177,44 +178,6 @@
return buffSize;
}
- // public TransientValueData createTransientCopy() throws RepositoryException
- // {
- // if (isByteArray())
- // {
- // // bytes, make a copy of real data
- // byte[] newBytes = new byte[data.length];
- // System.arraycopy(data, 0, newBytes, 0, newBytes.length);
- // return new TransientValueData(newBytes, orderNumber);
- // }
- // else
- // {
- // // stream, make a copy
- // try
- // {
- // // force changes made to the file
- // spoolChannel.force(false);
- //
- // InputStream thisStream = getAsStream();
- // try
- // {
- // TransientValueData copy =
- // new TransientValueData(orderNumber, null, thisStream, null,
fileCleaner, maxBufferSize,
- // tempDirectory, true);
- // copy.spoolInputStream(); // force spool - read now, till the
source isn't changed
- // return copy;
- // }
- // finally
- // {
- // thisStream.close();
- // }
- // }
- // catch (IOException e)
- // {
- // throw new RepositoryException("Create transient copy error.
" + e, e);
- // }
- // }
- // }
-
/**
* Update with <code>length</code> bytes from the specified
<code>stream</code> to this value data
* at <code>position</code>.
@@ -294,13 +257,13 @@
{
// switch from bytes to file/channel
- File chf = null;
+ SpoolFile chf = null;
FileChannel chch = null;
long newIndex = 0; // first pos to write
try
{
- chf = File.createTempFile("jcrvdedit", null, tempDirectory);
+ chf = SpoolFile.createTempFile("jcrvdedit", null,
tempDirectory);
chch = new RandomAccessFile(chf, "rw").getChannel();
// allocate the space for whole file
@@ -397,11 +360,11 @@
else
{
// switch from bytes to file/channel
- File chf = null;
+ SpoolFile chf = null;
FileChannel chch = null;
try
{
- chf = File.createTempFile("jcrvdedit", null, tempDirectory);
+ chf = SpoolFile.createTempFile("jcrvdedit", null,
tempDirectory);
chch = new RandomAccessFile(chf, "rw").getChannel();
ReadableByteChannel bch = Channels.newChannel(new
ByteArrayInputStream(this.data));
@@ -504,7 +467,7 @@
this.delegate = new NewEditableValueData(bytes, orderNumber, fileCleaner,
maxBufferSize, tempDirectory);
}
- public EditableValueData(File spoolFile, int orderNumber, FileCleaner fileCleaner, int
maxBufferSize,
+ public EditableValueData(SpoolFile spoolFile, int orderNumber, FileCleaner
fileCleaner, int maxBufferSize,
File tempDirectory) throws IOException
{
this.delegate = new NewEditableValueData(spoolFile, orderNumber, fileCleaner,
maxBufferSize, tempDirectory);
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java 2010-06-08
13:54:09 UTC (rev 2517)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientValueData.java 2010-06-08
15:32:15 UTC (rev 2518)
@@ -70,7 +70,7 @@
protected InputStream tmpStream;
- protected File spoolFile;
+ protected SpoolFile spoolFile;
protected final boolean closeTmpStream;
@@ -146,7 +146,7 @@
* @throws IOException
* if read error
*/
- protected NewValueData(int orderNumber, byte[] bytes, InputStream stream, File
spoolFile,
+ protected NewValueData(int orderNumber, byte[] bytes, InputStream stream, SpoolFile
spoolFile,
FileCleaner fileCleaner, int maxBufferSize, File tempDirectory, boolean
deleteSpoolFile, boolean closeTmpStream)
throws IOException
{
@@ -163,10 +163,7 @@
if (spoolFile != null)
{
- if (spoolFile instanceof SpoolFile)
- {
- ((SpoolFile)spoolFile).acquire(this);
- }
+ spoolFile.acquire(this);
if (this.tmpStream != null)
{
@@ -744,7 +741,7 @@
* @throws IOException
* if read error
*/
- public TransientValueData(int orderNumber, byte[] bytes, InputStream stream, File
spoolFile,
+ public TransientValueData(int orderNumber, byte[] bytes, InputStream stream, SpoolFile
spoolFile,
FileCleaner fileCleaner, int maxBufferSize, File tempDirectory, boolean
deleteSpoolFile, boolean closeTmpStream)
throws IOException
{
@@ -775,7 +772,7 @@
* @throws IOException
* if read error
*/
- public TransientValueData(int orderNumber, byte[] bytes, InputStream stream, File
spoolFile,
+ public TransientValueData(int orderNumber, byte[] bytes, InputStream stream, SpoolFile
spoolFile,
FileCleaner fileCleaner, int maxBufferSize, File tempDirectory, boolean
deleteSpoolFile) throws IOException
{
this.delegate =
@@ -823,7 +820,7 @@
* @throws IOException
* if read error
*/
- public TransientValueData(int orderNumber, File spoolFile, FileCleaner fileCleaner,
boolean deleteSpoolFile)
+ public TransientValueData(int orderNumber, SpoolFile spoolFile, FileCleaner
fileCleaner, boolean deleteSpoolFile)
throws IOException
{
this.delegate =
@@ -1191,7 +1188,7 @@
*
* @return File temp file
*/
- public File getSpoolFile()
+ public SpoolFile getSpoolFile()
{
if (delegate instanceof NewValueData)
{
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java 2010-06-08
13:54:09 UTC (rev 2517)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/FilePersistedValueData.java 2010-06-08
15:32:15 UTC (rev 2518)
@@ -21,7 +21,6 @@
import org.exoplatform.services.jcr.datamodel.ValueData;
import org.exoplatform.services.jcr.impl.dataflow.AbstractPersistedValueData;
import org.exoplatform.services.jcr.impl.dataflow.TransientValueData;
-import org.exoplatform.services.jcr.impl.util.io.SwapFile;
import java.io.Externalizable;
import java.io.File;
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java 2010-06-08
13:54:09 UTC (rev 2517)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/StreamPersistedValueData.java 2010-06-08
15:32:15 UTC (rev 2518)
@@ -41,7 +41,7 @@
protected InputStream stream;
- protected File tempFile;
+ protected SpoolFile tempFile;
/**
* StreamPersistedValueData constructor for stream data.
@@ -61,7 +61,7 @@
* @param tempFile File
* @throws FileNotFoundException
*/
- public StreamPersistedValueData(int orderNumber, File tempFile) throws
FileNotFoundException
+ public StreamPersistedValueData(int orderNumber, SpoolFile tempFile) throws
FileNotFoundException
{
this(orderNumber, tempFile, null);
}
@@ -91,15 +91,15 @@
* @param tempFile File
* @throws FileNotFoundException
*/
- public StreamPersistedValueData(int orderNumber, File tempFile, File destFile) throws
FileNotFoundException
+ public StreamPersistedValueData(int orderNumber, SpoolFile tempFile, File destFile)
throws FileNotFoundException
{
super(orderNumber, destFile);
this.tempFile = tempFile;
this.stream = null;
- if (tempFile != null && tempFile instanceof SpoolFile)
+ if (tempFile != null)
{
- ((SpoolFile)tempFile).acquire(this);
+ tempFile.acquire(this);
}
}
@@ -129,7 +129,7 @@
*
* @return File temporary file or null
*/
- public File getTempFile()
+ public SpoolFile getTempFile()
{
return tempFile;
}
@@ -233,9 +233,9 @@
((SwapFile)file).release(this);
}
- if (tempFile != null && tempFile instanceof SpoolFile)
+ if (tempFile != null)
{
- ((SpoolFile)tempFile).release(this);
+ tempFile.release(this);
}
}
finally
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/cas/JDBCValueContentAddressStorageImpl.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/cas/JDBCValueContentAddressStorageImpl.java 2010-06-08
13:54:09 UTC (rev 2517)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/cas/JDBCValueContentAddressStorageImpl.java 2010-06-08
15:32:15 UTC (rev 2518)
@@ -97,6 +97,18 @@
*/
private static final String DB2_PK_CONSTRAINT_DETECT_PATTERN =
"(.*DB2 SQL error+.*SQLCODE: -803+.*SQLSTATE: 23505+.*%s.*)+?";
+
+ /**
+ * MYSQL_PK_CONSTRAINT_DETECT_PATTERN.
+ */
+ private static final String H2_PK_CONSTRAINT_DETECT_PATTERN =
+ "(.*JdbcSQLException.*violation.*PRIMARY_KEY_.*)";
+
+ /**
+ * H2_PK_CONSTRAINT_DETECT.
+ */
+ private static final Pattern H2_PK_CONSTRAINT_DETECT =
+ Pattern.compile(H2_PK_CONSTRAINT_DETECT_PATTERN, Pattern.CASE_INSENSITIVE);
/**
* DB2_PK_CONSTRAINT_DETECT.
@@ -302,11 +314,14 @@
// HSQLDB 8.x - java.sql.SQLException: Violation of unique constraint $$: duplicate
value(s) for
// column(s) $$:
// JCR_VCAS_PK in statement [INSERT INTO JCR_VCAS (PROPERTY_ID, ORDER_NUM, CAS_ID)
- // VALUES(?,?,?)]
+ // VALUES(?,?,?)] String H2_PK_CONSTRAINT_DETECT_PATTERN =
"(.*JdbcSQLException.*violation.*PRIMARY_KEY_.*)";
// PostgreSQL 8.2.x - org.postgresql.util.PSQLException: ERROR: duplicate key
violates unique
// constraint "jcr_vcas_pk"
// Oracle 9i x64 (on Fedora 7) - java.sql.SQLException: ORA-00001: unique
constraint
// (EXOADMIN.JCR_VCAS_PK) violated
+ // H2 - org.h2.jdbc.JdbcSQLException: Unique index or primary key violation:
+ // "PRIMARY_KEY_4 ON PUBLIC.JCR_VCAS_TEST(PROPERTY_ID, ORDER_NUM)";
+ //
String err = e.toString();
if (DBConstants.DB_DIALECT_MYSQL.equalsIgnoreCase(dialect)
|| DBConstants.DB_DIALECT_MYSQL_UTF8.equalsIgnoreCase(dialect))
@@ -323,6 +338,10 @@
{
return DB2_PK_CONSTRAINT_DETECT.matcher(err).find();
}
+ else if (DBConstants.DB_DIALECT_H2.equalsIgnoreCase(dialect))
+ {
+ return H2_PK_CONSTRAINT_DETECT.matcher(err).find();
+ }
// NOTICE! As an additional check we may ask the database for property currently
processed in
// VCAS
Copied: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.h2.sql
(from rev 2256,
jcr/branches/1.14.x/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.h2.sql)
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.h2.sql
(rev 0)
+++
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.h2.sql 2010-06-08
15:32:15 UTC (rev 2518)
@@ -0,0 +1,35 @@
+CREATE TABLE JCR_MCONTAINER(
+ VERSION VARCHAR(96) NOT NULL,
+ CONSTRAINT JCR_PK_MCONTAINER PRIMARY KEY(VERSION)
+);
+CREATE TABLE JCR_MITEM(
+ ID VARCHAR(96) NOT NULL,
+ PARENT_ID VARCHAR(96) NOT NULL,
+ NAME VARCHAR(512) NOT NULL,
+ VERSION INTEGER NOT NULL,
+ I_CLASS INTEGER NOT NULL,
+ I_INDEX INTEGER NOT NULL,
+ N_ORDER_NUM INTEGER,
+ P_TYPE INTEGER,
+ P_MULTIVALUED BOOLEAN,
+ CONSTRAINT JCR_PK_MITEM PRIMARY KEY(ID),
+ CONSTRAINT JCR_FK_MITEM_PARENT FOREIGN KEY(PARENT_ID) REFERENCES JCR_MITEM(ID)
+);
+CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT ON JCR_MITEM(PARENT_ID, NAME, I_INDEX, I_CLASS,
VERSION DESC);
+CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT_NAME ON JCR_MITEM(I_CLASS, PARENT_ID, NAME,
I_INDEX, VERSION DESC);
+CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT_ID ON JCR_MITEM(I_CLASS, PARENT_ID, ID, VERSION
DESC);
+CREATE TABLE JCR_MVALUE(
+ DATA VARBINARY(65535),
+ ORDER_NUM INTEGER NOT NULL,
+ PROPERTY_ID VARCHAR(96) NOT NULL,
+ STORAGE_DESC VARCHAR(512),
+ CONSTRAINT JCR_FK_MVALUE_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES JCR_MITEM(ID)
+);
+CREATE UNIQUE INDEX JCR_IDX_MVALUE_PROPERTY ON JCR_MVALUE(PROPERTY_ID, ORDER_NUM);
+CREATE TABLE JCR_MREF(
+ NODE_ID VARCHAR(96) NOT NULL,
+ PROPERTY_ID VARCHAR(96) NOT NULL,
+ ORDER_NUM INTEGER NOT NULL,
+ CONSTRAINT JCR_PK_MREF PRIMARY KEY(NODE_ID, PROPERTY_ID, ORDER_NUM)
+);
+CREATE UNIQUE INDEX JCR_IDX_MREF_PROPERTY ON JCR_MREF(PROPERTY_ID, ORDER_NUM);
\ No newline at end of file
Copied: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.h2.sql
(from rev 2256,
jcr/branches/1.14.x/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.h2.sql)
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.h2.sql
(rev 0)
+++
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.h2.sql 2010-06-08
15:32:15 UTC (rev 2518)
@@ -0,0 +1,36 @@
+CREATE TABLE JCR_SCONTAINER(
+ VERSION VARCHAR(96) NOT NULL,
+ CONSTRAINT JCR_PK_SCONTAINER PRIMARY KEY(VERSION)
+);
+CREATE TABLE JCR_SITEM(
+ ID VARCHAR(96) NOT NULL,
+ PARENT_ID VARCHAR(96) NOT NULL,
+ NAME VARCHAR(512) NOT NULL,
+ VERSION INTEGER NOT NULL,
+ CONTAINER_NAME VARCHAR(96) NOT NULL,
+ I_CLASS INTEGER NOT NULL,
+ I_INDEX INTEGER NOT NULL,
+ N_ORDER_NUM INTEGER,
+ P_TYPE INTEGER,
+ P_MULTIVALUED INTEGER,
+ CONSTRAINT JCR_PK_SITEM PRIMARY KEY(ID),
+ CONSTRAINT JCR_FK_SITEM_PARENT FOREIGN KEY(PARENT_ID) REFERENCES JCR_SITEM(ID)
+);
+CREATE UNIQUE INDEX JCR_IDX_SITEM_PARENT ON JCR_SITEM(CONTAINER_NAME, PARENT_ID, NAME,
I_INDEX, I_CLASS, VERSION DESC);
+CREATE UNIQUE INDEX JCR_IDX_SITEM_PARENT_NAME ON JCR_SITEM(I_CLASS, CONTAINER_NAME,
PARENT_ID, NAME, I_INDEX, VERSION DESC);
+CREATE UNIQUE INDEX JCR_IDX_SITEM_PARENT_ID ON JCR_SITEM(I_CLASS, CONTAINER_NAME,
PARENT_ID, ID, VERSION DESC);
+CREATE TABLE JCR_SVALUE(
+ DATA VARBINARY(65535),
+ ORDER_NUM INTEGER NOT NULL,
+ PROPERTY_ID VARCHAR(96) NOT NULL,
+ STORAGE_DESC VARCHAR(512),
+ CONSTRAINT JCR_FK_SVALUE_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES JCR_SITEM(ID)
+);
+CREATE UNIQUE INDEX JCR_IDX_SVALUE_PROPERTY ON JCR_SVALUE(PROPERTY_ID, ORDER_NUM);
+CREATE TABLE JCR_SREF(
+ NODE_ID VARCHAR(96) NOT NULL,
+ PROPERTY_ID VARCHAR(96) NOT NULL,
+ ORDER_NUM INTEGER NOT NULL,
+ CONSTRAINT JCR_PK_SREF PRIMARY KEY(NODE_ID, PROPERTY_ID, ORDER_NUM)
+);
+CREATE UNIQUE INDEX JCR_IDX_SREF_PROPERTY ON JCR_SREF(PROPERTY_ID, ORDER_NUM);
\ No newline at end of file