Author: nzamosenchuk
Date: 2009-08-28 03:47:54 -0400 (Fri, 28 Aug 2009)
New Revision: 27
Modified:
jcr/trunk/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/LocationFactory.java
jcr/trunk/component/core/src/test/java/conf/standalone/test-jcr-config-sjdbc.xml
jcr/trunk/component/core/src/test/java/conf/standalone/test-jcr-config.xml
jcr/trunk/component/core/src/test/java/org/exoplatform/services/jcr/impl/core/TestLocationFactory.java
Log:
EXOJCR-11: Merging fixes for JCR-1171(Read values are not removed in some cases) and also
JCR-1175 (Empty string is not valid path).
Modified:
jcr/trunk/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/LocationFactory.java
===================================================================
---
jcr/trunk/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/LocationFactory.java 2009-08-28
07:09:44 UTC (rev 26)
+++
jcr/trunk/component/core/src/main/java/org/exoplatform/services/jcr/impl/core/LocationFactory.java 2009-08-28
07:47:54 UTC (rev 27)
@@ -234,7 +234,7 @@
}
path.addEntry(namespaces.getNamespaceURIByPrefix(prefix), someName, prefix,
index);
- return (JCRPath.PathElement) path.getName();
+ return (JCRPath.PathElement)path.getName();
}
catch (Exception e)
@@ -246,7 +246,7 @@
private JCRPath parseNames(String path, boolean absolute) throws RepositoryException
{
- if (path == null)
+ if ((path == null) || (path.equals("")))
{
throw new RepositoryException("Illegal relPath " + path);
}
@@ -309,7 +309,7 @@
}
return !((ch == '\t') || (ch == '\n') || (ch == '\f') ||
(ch == '\r') || (ch == ' ') || (ch == '/')
- || (ch == ':') || (ch == '[') || (ch == ']') ||
(ch == '\'') || (ch == '\"') || (ch == '*'));
+ || (ch == ':') || (ch == '[') || (ch == ']') || (ch ==
'\'') || (ch == '\"') || (ch == '*'));
}
private boolean isSimpleString(String str)
@@ -343,11 +343,11 @@
char ch0 = str.charAt(0);
char ch1 = str.charAt(1);
return (((ch0 == '.') && (isNonspace(str, ch1) &&
(ch1 != '.')))
- || ((isNonspace(str, ch0) && (ch0 != '.'))
&& (ch1 == '.')) || ((isNonspace(str, ch0) && (ch0 !=
'.')) && (isNonspace(
- str, ch1) && (ch1 != '.'))));
+ || ((isNonspace(str, ch0) && (ch0 != '.')) && (ch1
== '.')) || ((isNonspace(str, ch0) && (ch0 != '.')) &&
(isNonspace(
+ str, ch1) && (ch1 != '.'))));
default :
return isNonspace(str, str.charAt(0)) &&
isSimpleString(str.substring(1, strLen - 1))
- && isNonspace(str, str.charAt(strLen - 1));
+ && isNonspace(str, str.charAt(strLen - 1));
}
}
@@ -365,13 +365,13 @@
return isNonspace(str, str.charAt(0)) && isNonspace(str,
str.charAt(1));
default :
return isNonspace(str, str.charAt(0)) &&
isSimpleString(str.substring(1, strLen - 1))
- && isNonspace(str, str.charAt(strLen - 1));
+ && isNonspace(str, str.charAt(strLen - 1));
}
}
private boolean isValidName(String str, boolean prefixed)
{
return (prefixed ? isLocalName(str) : isSimpleName(str) ||
str.equals(JCRPath.THIS_RELPATH)
- || str.equals(JCRPath.PARENT_RELPATH) || str.equals("*"));
+ || str.equals(JCRPath.PARENT_RELPATH) || str.equals("*"));
}
}
Modified:
jcr/trunk/component/core/src/test/java/conf/standalone/test-jcr-config-sjdbc.xml
===================================================================
---
jcr/trunk/component/core/src/test/java/conf/standalone/test-jcr-config-sjdbc.xml 2009-08-28
07:09:44 UTC (rev 26)
+++
jcr/trunk/component/core/src/test/java/conf/standalone/test-jcr-config-sjdbc.xml 2009-08-28
07:47:54 UTC (rev 27)
@@ -169,6 +169,79 @@
</properties>
</query-handler>
</workspace>
+
+ <workspace name="ws3">
+ <!-- for system storage -->
+ <container
+ class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr3" />
+ <property name="dialect" value="hsqldb" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory"
value="target/temp/swap/ws3" />
+ </properties>
+ <value-storages>
+ <!--
+ This storage is used to check whether properties are removed
+ correctly from each value-storage in case of complex value storage.
+ (TestRemoveFromValueStorage.java)
+ -->
+ <value-storage id="ws3_big"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3_big"
/>
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="1024K"
/>
+ </filters>
+ </value-storage>
+ <value-storage id="ws3"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3"
/>
+ <property name="digest-algo" value="MD5" />
+ <property name="vcas-type"
+ value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl"
/>
+ <property name="jdbc-source-name" value="jdbcjcr" />
+ <property name="jdbc-dialect" value="hsqldb" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer
+ class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured"
/>
+ </properties>
+ </initializer>
+ <cache enabled="true"
+ class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler
+ class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir"
value="target/temp/index/db1/ws3" />
+ <property name="synonymprovider-class"
+ value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider"
/>
+ <property name="synonymprovider-config-path"
value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path"
value="../../indexing-configuration.xml" />
+ <property name="query-class"
+ value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class"
+ value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval"
/>
+ </properties>
+ </query-handler>
+ </workspace>
</workspaces>
</repository>
Modified: jcr/trunk/component/core/src/test/java/conf/standalone/test-jcr-config.xml
===================================================================
--- jcr/trunk/component/core/src/test/java/conf/standalone/test-jcr-config.xml 2009-08-28
07:09:44 UTC (rev 26)
+++ jcr/trunk/component/core/src/test/java/conf/standalone/test-jcr-config.xml 2009-08-28
07:47:54 UTC (rev 27)
@@ -63,7 +63,8 @@
<property name="restore-path"
value="./sv_export_root.xml" />
<property name="restore-path"
value="./src/test/resources/import-export/restore_db1_ws1.xml" />
</properties>
- </initializer -->
+ </initializer
+-->
<cache enabled="true"
class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
<properties>
<property name="max-size" value="2k" />
@@ -172,6 +173,79 @@
</properties>
</query-handler>
</workspace>
+
+ <workspace name="ws3">
+ <!-- for system storage -->
+ <container
+ class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr3" />
+ <property name="dialect" value="hsqldb" />
+ <property name="multi-db" value="true" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory"
value="target/temp/swap/ws3" />
+ </properties>
+ <value-storages>
+ <!--
+ This storage is used to check whether properties are removed
+ correctly from each value-storage
+ (TestRemoveFromValueStorage.java)
+ -->
+ <value-storage id="ws3_big"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3_big"
/>
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="1024K"
/>
+ </filters>
+ </value-storage>
+ <value-storage id="ws3"
+ class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws3"
/>
+ <property name="digest-algo" value="MD5" />
+ <property name="vcas-type"
+ value="org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImpl"
/>
+ <property name="jdbc-source-name" value="jdbcjcr" />
+ <property name="jdbc-dialect" value="hsqldb" />
+ </properties>
+ <filters>
+ <filter property-type="Binary" />
+ </filters>
+ </value-storage>
+ </value-storages>
+ </container>
+ <initializer
+ class="org.exoplatform.services.jcr.impl.core.ScratchWorkspaceInitializer">
+ <properties>
+ <property name="root-nodetype" value="nt:unstructured"
/>
+ </properties>
+ </initializer>
+ <cache enabled="true"
+ class="org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl">
+ <properties>
+ <property name="max-size" value="2k" />
+ <property name="live-time" value="20m" />
+ </properties>
+ </cache>
+ <query-handler
+ class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir"
value="target/temp/index/db1/ws3" />
+ <property name="synonymprovider-class"
+ value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider"
/>
+ <property name="synonymprovider-config-path"
value="../../synonyms.properties" />
+ <property name="support-highlighting" value="true" />
+ <property name="indexing-configuration-path"
value="../../indexing-configuration.xml" />
+ <property name="query-class"
+ value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ <property name="spellchecker-class"
+ value="org.exoplatform.services.jcr.impl.core.query.lucene.spell.LuceneSpellChecker$FiveSecondsRefreshInterval"
/>
+ </properties>
+ </query-handler>
+ </workspace>
</workspaces>
</repository>
Modified:
jcr/trunk/component/core/src/test/java/org/exoplatform/services/jcr/impl/core/TestLocationFactory.java
===================================================================
---
jcr/trunk/component/core/src/test/java/org/exoplatform/services/jcr/impl/core/TestLocationFactory.java 2009-08-28
07:09:44 UTC (rev 26)
+++
jcr/trunk/component/core/src/test/java/org/exoplatform/services/jcr/impl/core/TestLocationFactory.java 2009-08-28
07:47:54 UTC (rev 27)
@@ -48,7 +48,7 @@
{"..", "jcr:ig[2]/aaa", "v/d/...", "/path",
"/vv/fff", "ff", "/", "..", "|fff"};
private static String testJCRPathInvalid[] =
- {"/.:./uuu", "/ ", "/./xml:name[0]",
"xxx//fff", "//", " sdfas/"};
+ {"/.:./uuu", "/ ", "/./xml:name[0]",
"xxx//fff", "//", " sdfas/", ""};
private LocationFactory factory;