exo-jcr SVN: r5159 - in jcr/trunk/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/usecases and 1 other directory.
by do-not-reply@jboss.org
Author: zavizionov
Date: 2011-11-04 05:48:37 -0400 (Fri, 04 Nov 2011)
New Revision: 5159
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestMixin.java
Log:
EXOJCR-1568 Can't remove mixin from node and add mixin again. Fixed formatter.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2011-11-04 08:37:26 UTC (rev 5158)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2011-11-04 09:48:37 UTC (rev 5159)
@@ -1930,7 +1930,8 @@
for (PropertyDefinitionData pd : ntmanager.getAllPropertyDefinitions(removedName))
{
// to skip remove propertyDefinition with existed another nodeType property definition
- if (ntmanager.getPropertyDefinitions(pd.getName(), nodeData().getPrimaryTypeName(), newMixin.toArray(new InternalQName[]{})) == null) {
+ if (ntmanager.getPropertyDefinitions(pd.getName(), nodeData().getPrimaryTypeName(), newMixin.toArray(new InternalQName[]{})) == null)
+ {
ItemData p = dataManager.getItemData(nodeData(), new QPathEntry(pd.getName(), 1), ItemType.PROPERTY, false);
if (p != null && !p.isNode())
{
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestMixin.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestMixin.java 2011-11-04 08:37:26 UTC (rev 5158)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestMixin.java 2011-11-04 09:48:37 UTC (rev 5159)
@@ -88,10 +88,14 @@
folder.addMixin("test:my");
session.save();
folder.removeMixin("test:my");
- try {
+ try
+ {
session.save();
- } catch (Exception e) {
- fail("Shouldn't be removed a property definition, there is existed another node type (primary or mixin) which has the property definition. \n" + e.getMessage());
}
+ catch (Exception e)
+ {
+ fail("Shouldn't be removed a property definition, there is existed another node type (primary or mixin) which has the property definition. \n"
+ + e.getMessage());
+ }
}
}
14 years, 6 months
exo-jcr SVN: r5158 - in jcr/trunk/exo.jcr.component.core/src: test/java/org/exoplatform/services/jcr/usecases and 1 other directory.
by do-not-reply@jboss.org
Author: zavizionov
Date: 2011-11-04 04:37:26 -0400 (Fri, 04 Nov 2011)
New Revision: 5158
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestMixin.java
Log:
EXOJCR-1568 Can't remove mixin from node and add mixin again.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2011-11-04 07:34:42 UTC (rev 5157)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/NodeImpl.java 2011-11-04 08:37:26 UTC (rev 5158)
@@ -1929,11 +1929,14 @@
for (PropertyDefinitionData pd : ntmanager.getAllPropertyDefinitions(removedName))
{
- ItemData p = dataManager.getItemData(nodeData(), new QPathEntry(pd.getName(), 1), ItemType.PROPERTY, false);
- if (p != null && !p.isNode())
- {
- // remove it
- dataManager.delete(p, ancestorToSave);
+ // to skip remove propertyDefinition with existed another nodeType property definition
+ if (ntmanager.getPropertyDefinitions(pd.getName(), nodeData().getPrimaryTypeName(), newMixin.toArray(new InternalQName[]{})) == null) {
+ ItemData p = dataManager.getItemData(nodeData(), new QPathEntry(pd.getName(), 1), ItemType.PROPERTY, false);
+ if (p != null && !p.isNode())
+ {
+ // remove it
+ dataManager.delete(p, ancestorToSave);
+ }
}
}
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestMixin.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestMixin.java 2011-11-04 07:34:42 UTC (rev 5157)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/usecases/TestMixin.java 2011-11-04 08:37:26 UTC (rev 5158)
@@ -16,9 +16,15 @@
*/
package org.exoplatform.services.jcr.usecases;
+import java.io.ByteArrayInputStream;
+
import javax.jcr.Node;
import javax.jcr.Property;
+import javax.jcr.RepositoryException;
+import org.exoplatform.services.jcr.core.nodetype.ExtendedNodeTypeManager;
+import org.exoplatform.services.jcr.core.nodetype.NodeTypeDataManager;
+
/**
* Created by The eXo Platform SAS.
*
@@ -38,7 +44,7 @@
*/
public void testMixin() throws Exception
{
- Node a = session.getRootNode().addNode("a");
+ Node a = root.addNode("a");
a.addMixin("mix:referenceable");
Property p = a.setProperty("prop", "string");
@@ -49,9 +55,43 @@
session.save();
//check result
- Node a2 = session.getRootNode().getNode("a");
+ Node a2 = root.getNode("a");
assertTrue(a2.isNodeType("mix:referenceable"));
assertTrue(a2.isNodeType("mix:versionable"));
assertTrue(a2.isNodeType("mix:lockable"));
}
+
+ /**
+ * This usecase is checking correctness of remove mixin which is declared
+ * extend another node type (primary or mixin one).
+ *
+ * @throws RepositoryException
+ */
+ public void testMixinExtendedNtBase() throws RepositoryException
+ {
+ ExtendedNodeTypeManager manager = (ExtendedNodeTypeManager)workspace.getNodeTypeManager();
+
+ String cnd = "<nodeTypes>" //
+ + "<nodeType name=\"test:my\" isMixin=\"true\" hasOrderableChildNodes=\"false\" primaryItemName=\"\">" //
+ + " <supertypes>" //
+ + " <supertype>nt:base</supertype>" // main configuration part for the test
+ + " </supertypes>" //
+ + " <propertyDefinitions>" //
+ + " </propertyDefinitions>" //
+ + "</nodeType>" //
+ + "</nodeTypes>";
+
+ manager.registerNodeTypes(new ByteArrayInputStream(cnd.getBytes()), ExtendedNodeTypeManager.IGNORE_IF_EXISTS,
+ NodeTypeDataManager.TEXT_XML);
+
+ Node folder = root.addNode("testRemoveMixin", "nt:folder");
+ folder.addMixin("test:my");
+ session.save();
+ folder.removeMixin("test:my");
+ try {
+ session.save();
+ } catch (Exception e) {
+ fail("Shouldn't be removed a property definition, there is existed another node type (primary or mixin) which has the property definition. \n" + e.getMessage());
+ }
+ }
}
14 years, 6 months
exo-jcr SVN: r5157 - in jcr/trunk/exo.jcr.component.core/src: main/resources and 2 other directories.
by do-not-reply@jboss.org
Author: areshetnyak
Date: 2011-11-04 03:34:42 -0400 (Fri, 04 Nov 2011)
New Revision: 5157
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/ConfigurationFormat.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/StringNumberParser.java
jcr/trunk/exo.jcr.component.core/src/main/resources/binding.xml
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestRepositoryManagement.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/TesterConfigurationHelper.java
Log:
EXOJCR-1566 : Problem with configuration from backup was fixed. The cause of problem is absence special serialization method to timeout field.
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/ConfigurationFormat.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/ConfigurationFormat.java 2011-11-03 12:25:50 UTC (rev 5156)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/ConfigurationFormat.java 2011-11-04 07:34:42 UTC (rev 5157)
@@ -93,4 +93,17 @@
}
}
+ public static String serializeTime(long time)
+ {
+ try
+ {
+ return StringNumberParser.serializeTime(time);
+ }
+ catch (Throwable e)
+ {
+ LOG.warn("Unserialable time (as formated time) '" + time + "'. Check StringNumberParser.serializeTime for details.", e);
+ return "";
+ }
+ }
+
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/StringNumberParser.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/StringNumberParser.java 2011-11-03 12:25:50 UTC (rev 5156)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/util/StringNumberParser.java 2011-11-04 07:34:42 UTC (rev 5157)
@@ -186,4 +186,18 @@
return Long.valueOf(text) * 1000;
}
}
+
+ /**
+ * Serialize given time in milliseconds and return a time as formated time in milliseconds (ms).
+ *
+ * @param millisecondTime
+ * - time in milliseconds
+ * @return String
+ * - time as formated time in milliseconds
+ * @throws NumberFormatException
+ */
+ static public String serializeTime(final long millisecondTime) throws NumberFormatException
+ {
+ return String.valueOf(millisecondTime) + "ms";
+ }
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/binding.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/binding.xml 2011-11-03 12:25:50 UTC (rev 5156)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/binding.xml 2011-11-04 07:34:42 UTC (rev 5157)
@@ -17,8 +17,9 @@
<value name="default-workspace" field="defaultWorkspaceName" style="attribute" />
<value name="security-domain" field="securityDomain" />
<value name="access-control" field="accessControl" usage="optional" />
- <value name="session-max-age" field="sessionTimeOut"
- deserializer="org.exoplatform.services.jcr.util.ConfigurationFormat.parseTime" usage="optional" />
+ <value name="session-max-age" field="sessionTimeOut" usage="optional"
+ serializer="org.exoplatform.services.jcr.util.ConfigurationFormat.serializeTime"
+ deserializer="org.exoplatform.services.jcr.util.ConfigurationFormat.parseTime" />
<value name="lock-remover-max-threads" field="lockRemoverMaxThreadCount"
deserializer="org.exoplatform.services.jcr.util.ConfigurationFormat.parseInt" usage="optional" />
<value name="authentication-policy" field="authenticationPolicy" />
@@ -75,9 +76,10 @@
<collection name="properties" field="parameters" usage="optional"
item-type="org.exoplatform.services.jcr.config.SimpleParameterEntry"
factory="org.jibx.runtime.Utility.arrayListFactory" />
- <value name="time-out" field="timeout" usage="optional"
- deserializer="org.exoplatform.services.jcr.util.ConfigurationFormat.parseTime" />
-
+ <value name="time-out" field="timeout" usage="optional"
+ serializer="org.exoplatform.services.jcr.util.ConfigurationFormat.serializeTime"
+ deserializer="org.exoplatform.services.jcr.util.ConfigurationFormat.parseTime" />
+
<structure name="persister" field="persister" usage="optional">
<value name="class" field="type" style="attribute" />
<collection name="properties" field="parameters" usage="optional"
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestRepositoryManagement.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestRepositoryManagement.java 2011-11-03 12:25:50 UTC (rev 5156)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/impl/core/TestRepositoryManagement.java 2011-11-04 07:34:42 UTC (rev 5157)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.impl.core;
+import org.exoplatform.commons.utils.PrivilegedFileHelper;
import org.exoplatform.container.xml.PropertiesParam;
import org.exoplatform.services.jcr.JcrImplBaseTest;
import org.exoplatform.services.jcr.RepositoryService;
@@ -29,8 +30,12 @@
import org.exoplatform.services.jcr.util.TesterConfigurationHelper;
import org.jibx.runtime.BindingDirectory;
import org.jibx.runtime.IBindingFactory;
+import org.jibx.runtime.IMarshallingContext;
import org.jibx.runtime.IUnmarshallingContext;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
/**
@@ -64,6 +69,68 @@
assertNotNull(repository.login(credentials, repository.getConfiguration().getSystemWorkspaceName()).getRootNode());
}
+ public void testMarshalUnmarshalRepositoryConfiguration() throws Exception
+ {
+ ManageableRepository newRepository = helper.createRepository(container, false, null);
+ final long lockManagerTimeOut =
+ newRepository.getConfiguration().getWorkspaceEntries().get(0).getLockManager().getTimeout();
+
+ // 1st marshal configuration
+ File tempFile = PrivilegedFileHelper.createTempFile("test-config", "xml");
+ PrivilegedFileHelper.deleteOnExit(tempFile);
+
+ IBindingFactory factory = BindingDirectory.getFactory(RepositoryServiceConfiguration.class);
+ IMarshallingContext mctx = factory.createMarshallingContext();
+
+ FileOutputStream saveStream = new FileOutputStream(tempFile);
+ ArrayList<RepositoryEntry> repositoryEntries = new ArrayList<RepositoryEntry>();
+ repositoryEntries.add(newRepository.getConfiguration());
+
+ RepositoryServiceConfiguration newRepositoryServiceConfiguration =
+ new RepositoryServiceConfiguration(repositoryService.getConfig().getDefaultRepositoryName(), repositoryEntries);
+ mctx.marshalDocument(newRepositoryServiceConfiguration, "ISO-8859-1", null, saveStream);
+ saveStream.close();
+
+ // 1st unmarshal
+ factory = BindingDirectory.getFactory(RepositoryServiceConfiguration.class);
+ IUnmarshallingContext uctx = factory.createUnmarshallingContext();
+ RepositoryServiceConfiguration conf =
+ (RepositoryServiceConfiguration)uctx.unmarshalDocument(PrivilegedFileHelper.fileInputStream(tempFile), null);
+
+ // 1st check
+ RepositoryEntry unmarshledRepositoryEntry =
+ conf.getRepositoryConfiguration(newRepository.getConfiguration().getName());
+ assertEquals(lockManagerTimeOut, unmarshledRepositoryEntry.getWorkspaceEntries().get(0).getLockManager()
+ .getTimeout());
+
+
+ // 2nd marshal configuration
+ tempFile = PrivilegedFileHelper.createTempFile("test-config", "xml");
+ PrivilegedFileHelper.deleteOnExit(tempFile);
+
+ factory = BindingDirectory.getFactory(RepositoryServiceConfiguration.class);
+ mctx = factory.createMarshallingContext();
+ saveStream = new FileOutputStream(tempFile);
+ repositoryEntries = new ArrayList<RepositoryEntry>();
+ repositoryEntries.add(newRepository.getConfiguration());
+
+ newRepositoryServiceConfiguration =
+ new RepositoryServiceConfiguration(repositoryService.getConfig().getDefaultRepositoryName(), repositoryEntries);
+ mctx.marshalDocument(newRepositoryServiceConfiguration, "ISO-8859-1", null, saveStream);
+ saveStream.close();
+
+ // 2nd unmarshal
+ factory = BindingDirectory.getFactory(RepositoryServiceConfiguration.class);
+ uctx = factory.createUnmarshallingContext();
+ conf = (RepositoryServiceConfiguration)uctx.unmarshalDocument(PrivilegedFileHelper.fileInputStream(tempFile), null);
+
+ // 2nd check
+ unmarshledRepositoryEntry =
+ conf.getRepositoryConfiguration(newRepository.getConfiguration().getName());
+ assertEquals(lockManagerTimeOut, unmarshledRepositoryEntry.getWorkspaceEntries().get(0).getLockManager()
+ .getTimeout());
+ }
+
public void testAddNewRepositoryWithSameName() throws Exception
{
ManageableRepository repository = helper.createRepository(container, false, null);
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/TesterConfigurationHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/TesterConfigurationHelper.java 2011-11-03 12:25:50 UTC (rev 5156)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/util/TesterConfigurationHelper.java 2011-11-04 07:34:42 UTC (rev 5157)
@@ -224,10 +224,21 @@
CacheEntry cacheEntry = new CacheEntry(cacheParams);
cacheEntry.setType("org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl");
+ // Lock
+ LockManagerEntry lockManagerEntry = new LockManagerEntry();
+ lockManagerEntry.setTimeout(900000);
+ LockPersisterEntry lockPersisterEntry = new LockPersisterEntry();
+ lockPersisterEntry.setType("org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister");
+ ArrayList<SimpleParameterEntry> lockPersisterParameters = new ArrayList<SimpleParameterEntry>();
+ lockPersisterParameters.add(new SimpleParameterEntry("path", "target/temp/lock/" + wsName));
+ lockPersisterEntry.setParameters(lockPersisterParameters);
+ lockManagerEntry.setPersister(lockPersisterEntry);
+
WorkspaceEntry workspaceEntry = new WorkspaceEntry();
workspaceEntry.setContainer(containerEntry);
workspaceEntry.setCache(cacheEntry);
workspaceEntry.setQueryHandler(qEntry);
+ workspaceEntry.setLockManager(lockManagerEntry);
workspaceEntry.setName(wsName);
workspaceEntry.setUniqueName(wsName);
14 years, 6 months
exo-jcr SVN: r5156 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-11-03 08:25:50 -0400 (Thu, 03 Nov 2011)
New Revision: 5156
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBBackup.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java
Log:
EXOJCR-1612: remove unnecessary code
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBBackup.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBBackup.java 2011-11-03 10:23:05 UTC (rev 5155)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBBackup.java 2011-11-03 12:25:50 UTC (rev 5156)
@@ -24,7 +24,6 @@
import org.exoplatform.services.jcr.impl.Constants;
import org.exoplatform.services.jcr.impl.backup.BackupException;
import org.exoplatform.services.jcr.impl.dataflow.serialization.ObjectZipWriterImpl;
-import org.exoplatform.services.jcr.impl.storage.jdbc.DBConstants;
import org.exoplatform.services.log.ExoLogger;
import org.exoplatform.services.log.Log;
@@ -76,46 +75,6 @@
public static final String CONTENT_LEN_ZIP_FILE = "dump-len.zip";
/**
- * MySQL dialect.
- */
- public static final int DB_DIALECT_MYSQL = DBConstants.DB_DIALECT_MYSQL.hashCode();
-
- /**
- * MySQL-UTF8 dialect.
- */
- public static final int DB_DIALECT_MYSQL_UTF8 = DBConstants.DB_DIALECT_MYSQL_UTF8.hashCode();
-
- /**
- * MySQL-MYISAM dialect.
- */
- public static final int DB_DIALECT_MYSQL_MYISAM = DBConstants.DB_DIALECT_MYSQL_MYISAM.hashCode();
-
- /**
- * MySQL-MYISAM-UTF8 dialect.
- */
- public static final int DB_DIALECT_MYSQL_MYISAM_UTF8 = DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8.hashCode();
-
- /**
- * DB2 dialect.
- */
- public static final int DB_DIALECT_DB2 = DBConstants.DB_DIALECT_DB2.hashCode();
-
- /**
- * DB2V8 dialect.
- */
- public static final int DB_DIALECT_DB2V8 = DBConstants.DB_DIALECT_DB2V8.hashCode();
-
- /**
- * PGSQL dialect.
- */
- public static final int DB_DIALECT_PGSQL = DBConstants.DB_DIALECT_PGSQL.hashCode();
-
- /**
- * SYBASE dialect.
- */
- public static final int DB_DIALECT_SYBASE = DBConstants.DB_DIALECT_SYBASE.hashCode();
-
- /**
* Backup tables.
*
* @param storageDir
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java 2011-11-03 10:23:05 UTC (rev 5155)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBRestore.java 2011-11-03 12:25:50 UTC (rev 5156)
@@ -30,6 +30,7 @@
import org.exoplatform.services.jcr.impl.backup.DataRestore;
import org.exoplatform.services.jcr.impl.clean.rdbms.DBCleaner;
import org.exoplatform.services.jcr.impl.dataflow.serialization.ObjectZipReaderImpl;
+import org.exoplatform.services.jcr.impl.storage.jdbc.DBConstants;
import org.exoplatform.services.jcr.impl.storage.jdbc.DialectDetecter;
import org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer;
import org.exoplatform.services.jcr.impl.util.io.FileCleaner;
@@ -269,7 +270,7 @@
ResultSet tableMetaData = null;
// switch table name to lower case
- if (dialect.equals(DBBackup.DB_DIALECT_PGSQL))
+ if (dialect.equals(DBConstants.DB_DIALECT_PGSQL))
{
tableName = tableName.toLowerCase();
}
@@ -327,7 +328,8 @@
columnType.add(restoreRule.getNewColumnIndex(), restoreRule.getNewColumnType());
String newColumnName =
- dialect.equals(DBBackup.DB_DIALECT_PGSQL) ? restoreRule.getNewColumnName().toLowerCase() : restoreRule
+ dialect.equals(DBConstants.DB_DIALECT_PGSQL) ? restoreRule.getNewColumnName().toLowerCase()
+ : restoreRule
.getNewColumnName();
columnName.add(restoreRule.getNewColumnIndex(), newColumnName);
}
@@ -468,9 +470,9 @@
ba.read(readBuffer);
String value = new String(readBuffer);
- if (dialect.equals(DBBackup.DB_DIALECT_PGSQL))
+ if (dialect.equals(DBConstants.DB_DIALECT_PGSQL))
{
- insertNode.setBoolean(targetIndex + 1, value.equals("t"));
+ insertNode.setBoolean(targetIndex + 1, value.equalsIgnoreCase("t"));
}
else
{
14 years, 6 months
exo-jcr SVN: r5155 - core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-11-03 06:23:05 -0400 (Thu, 03 Nov 2011)
New Revision: 5155
Modified:
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java
Log:
EXOJCR-1594: remove unnecessary openSession() calls
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java 2011-11-03 09:45:39 UTC (rev 5154)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java 2011-11-03 10:23:05 UTC (rev 5155)
@@ -138,7 +138,6 @@
if (broadcast)
preSave(child, true);
- session = service_.openSession();
session.save(childImpl);
session.flush();
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java 2011-11-03 09:45:39 UTC (rev 5154)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java 2011-11-03 10:23:05 UTC (rev 5155)
@@ -210,7 +210,7 @@
{
if (broadcast)
preDelete(m);
- session = service_.openSession();
+
session.delete(m);
session.flush();
@@ -234,6 +234,7 @@
{
if (broadcast)
preDelete(m);
+
Session session = service_.openSession();
session.delete(m);
session.flush();
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java 2011-11-03 09:45:39 UTC (rev 5154)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java 2011-11-03 10:23:05 UTC (rev 5155)
@@ -152,7 +152,7 @@
if (broadcast)
preDelete(foundUser);
- session = service_.openSession();
+
session.delete(foundUser);
((UserProfileDAOImpl)orgService.getUserProfileHandler()).removeUserProfileEntry(userName, session);
MembershipDAOImpl.removeMembershipEntriesOfUser(userName, session);
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java 2011-11-03 09:45:39 UTC (rev 5154)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java 2011-11-03 10:23:05 UTC (rev 5155)
@@ -109,7 +109,6 @@
if (broadcast)
preSave(profile, true);
- session = service_.openSession();
session.save(profile.getUserName(), upd);
session.flush();
cache_.put(profile.getUserName(), profile);
@@ -123,7 +122,6 @@
if (broadcast)
preSave(profile, false);
- session = service_.openSession();
session.update(upd);
session.flush();
cache_.put(profile.getUserName(), profile);
@@ -146,7 +144,6 @@
if (broadcast)
preDelete(profile);
- session = service_.openSession();
session.delete(upd);
session.flush();
cache_.remove(userName);
14 years, 6 months
exo-jcr SVN: r5154 - core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate.
by do-not-reply@jboss.org
Author: tolusha
Date: 2011-11-03 05:45:39 -0400 (Thu, 03 Nov 2011)
New Revision: 5154
Modified:
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java
core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java
Log:
EXOJCR-1594: do session.flush() before post events
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java 2011-11-02 16:40:39 UTC (rev 5153)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/GroupDAOImpl.java 2011-11-03 09:45:39 UTC (rev 5154)
@@ -93,16 +93,25 @@
listeners_.remove(listener);
}
+ /**
+ * {@inheritDoc}
+ */
final public Group createGroupInstance()
{
return new GroupImpl();
}
+ /**
+ * {@inheritDoc}
+ */
public void createGroup(Group group, boolean broadcast) throws Exception
{
addChild(null, group, broadcast);
}
+ /**
+ * {@inheritDoc}
+ */
public void addChild(Group parent, Group child, boolean broadcast) throws Exception
{
Session session = service_.openSession();
@@ -131,22 +140,31 @@
session = service_.openSession();
session.save(childImpl);
+ session.flush();
+
if (broadcast)
postSave(child, true);
- session.flush();
}
+ /**
+ * {@inheritDoc}
+ */
public void saveGroup(Group group, boolean broadcast) throws Exception
{
if (broadcast)
preSave(group, false);
+
Session session = service_.openSession();
session.update(group);
+ session.flush();
+
if (broadcast)
postSave(group, false);
- session.flush();
}
+ /**
+ * {@inheritDoc}
+ */
public Group removeGroup(Group group, boolean broadcast) throws Exception
{
if (broadcast)
@@ -164,19 +182,17 @@
for (int i = 0; i < entries.size(); i++)
removeGroup((Group)entries.get(i), broadcast);
MembershipDAOImpl.removeMembershipEntriesOfGroup(group, session);
+ session.flush();
+
if (broadcast)
postDelete(group);
- session.flush();
+
return group;
}
- static void removeGroupEntry(String groupName, Session session) throws Exception
- {
- List entries = session.createQuery(queryFindGroupByName).setString(0, groupName).list();
- for (int i = 0; i < entries.size(); i++)
- session.delete(entries.get(i));
- }
-
+ /**
+ * {@inheritDoc}
+ */
public Collection findGroupByMembership(String userName, String membershipType) throws Exception
{
Session session = service_.openSession();
@@ -185,6 +201,9 @@
return groups;
}
+ /**
+ * {@inheritDoc}
+ */
public Group findGroupByName(String groupName) throws Exception
{
Session session = service_.openSession();
@@ -192,6 +211,9 @@
return group;
}
+ /**
+ * {@inheritDoc}
+ */
public Group findGroupById(String groupId) throws Exception
{
Session session = service_.openSession();
@@ -199,6 +221,9 @@
return group;
}
+ /**
+ * {@inheritDoc}
+ */
public Collection findGroups(Group parent) throws Exception
{
Session session = service_.openSession();
@@ -212,6 +237,9 @@
}
+ /**
+ * {@inheritDoc}
+ */
public Collection findGroupsOfUser(String user) throws Exception
{
Session session = service_.openSession();
@@ -219,6 +247,9 @@
return session.createQuery(queryFindGroupsOfUser).setString(0, user).list();
}
+ /**
+ * {@inheritDoc}
+ */
public Collection getAllGroups() throws Exception
{
Session session = service_.openSession();
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java 2011-11-02 16:40:39 UTC (rev 5153)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/MembershipDAOImpl.java 2011-11-03 09:45:39 UTC (rev 5154)
@@ -143,13 +143,12 @@
Session session = service_.openSession();
session.save(m);
+ session.flush();
if (broadcast)
{
postSave(m, true);
}
-
- session.flush();
}
/**
@@ -189,11 +188,14 @@
{
if (broadcast)
preSave(m, false);
+
Session session = service_.openSession();
session.update(m);
+ session.flush();
+
if (broadcast)
postSave(m, false);
- session.flush();
+
}
/**
@@ -210,9 +212,10 @@
preDelete(m);
session = service_.openSession();
session.delete(m);
+ session.flush();
+
if (broadcast)
postDelete(m);
- session.flush();
}
return m;
}
@@ -233,9 +236,11 @@
preDelete(m);
Session session = service_.openSession();
session.delete(m);
+ session.flush();
+
if (broadcast)
postDelete(m);
- session.flush();
+
}
}
return collection;
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java 2011-11-02 16:40:39 UTC (rev 5153)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserDAOImpl.java 2011-11-03 09:45:39 UTC (rev 5154)
@@ -20,7 +20,6 @@
import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.commons.utils.ListAccess;
-import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.services.cache.CacheService;
import org.exoplatform.services.cache.ExoCache;
import org.exoplatform.services.database.HibernateService;
@@ -35,9 +34,7 @@
import org.exoplatform.services.organization.impl.UserImpl;
import org.exoplatform.services.security.PasswordEncrypter;
import org.hibernate.Session;
-import org.hibernate.Transaction;
-import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
@@ -89,56 +86,62 @@
listeners_.remove(listener);
}
+ /**
+ * {@inheritDoc}
+ */
public User createUserInstance()
{
return new UserImpl();
}
+ /**
+ * {@inheritDoc}
+ */
public User createUserInstance(String username)
{
return new UserImpl(username);
}
+ /**
+ * {@inheritDoc}
+ */
public void createUser(User user, boolean broadcast) throws Exception
{
if (broadcast)
preSave(user, true);
final Session session = service_.openSession();
- Transaction transaction = SecurityHelper.doPrivilegedAction(new PrivilegedAction<Transaction>()
- {
- public Transaction run()
- {
- return session.beginTransaction();
- }
- });
UserImpl userImpl = (UserImpl)user;
userImpl.setId(user.getUserName());
session.save(user);
+ session.flush();
+
if (broadcast)
postSave(user, true);
- transaction.commit();
}
+ /**
+ * {@inheritDoc}
+ */
public void saveUser(User user, boolean broadcast) throws Exception
{
if (broadcast)
preSave(user, false);
+
Session session = service_.openSession();
+
session.merge(user);
- // session.update(user);
- if (broadcast)
- postSave(user, false);
session.flush();
cache_.put(user.getUserName(), user);
- }
- void createUserEntry(User user, Session session) throws Exception
- {
- session.save(user);
+ if (broadcast)
+ postSave(user, false);
}
+ /**
+ * {@inheritDoc}
+ */
public User removeUser(String userName, boolean broadcast) throws Exception
{
Session session = service_.openSession();
@@ -153,13 +156,19 @@
session.delete(foundUser);
((UserProfileDAOImpl)orgService.getUserProfileHandler()).removeUserProfileEntry(userName, session);
MembershipDAOImpl.removeMembershipEntriesOfUser(userName, session);
+
+ session.flush();
+ cache_.remove(userName);
+
if (broadcast)
postDelete(foundUser);
- session.flush();
- cache_.remove(userName);
+
return foundUser;
}
+ /**
+ * {@inheritDoc}
+ */
public User findUserByName(String userName) throws Exception
{
User user = (User)cache_.get(userName);
@@ -178,11 +187,17 @@
return user;
}
+ /**
+ * {@inheritDoc}
+ */
public LazyPageList<User> getUserPageList(int pageSize) throws Exception
{
return new LazyPageList<User>(findAllUsers(), 20);
}
+ /**
+ * {@inheritDoc}
+ */
public ListAccess<User> findAllUsers() throws Exception
{
String findQuery = "from o in class " + UserImpl.class.getName();
@@ -191,11 +206,17 @@
return new HibernateListAccess<User>(service_, findQuery, countQuery);
}
+ /**
+ * {@inheritDoc}
+ */
public boolean authenticate(String username, String password) throws Exception
{
return authenticate(username, password, null);
}
+ /**
+ * {@inheritDoc}
+ */
public boolean authenticate(String username, String password, PasswordEncrypter pe) throws Exception
{
User user = findUserByName(username);
@@ -223,11 +244,17 @@
return authenticated;
}
+ /**
+ * {@inheritDoc}
+ */
public LazyPageList<User> findUsers(Query q) throws Exception
{
return new LazyPageList<User>(findUsersByQuery(q), 20);
}
+ /**
+ * {@inheritDoc}
+ */
public ListAccess<User> findUsersByQuery(Query q) throws Exception
{
ObjectQuery oq = new ObjectQuery(UserImpl.class);
@@ -251,11 +278,17 @@
oq.getHibernateCountQueryWithBinding(), oq.getBindingFields());
}
+ /**
+ * {@inheritDoc}
+ */
public LazyPageList<User> findUsersByGroup(String groupId) throws Exception
{
return new LazyPageList<User>(findUsersByGroupId(groupId), 20);
}
+ /**
+ * {@inheritDoc}
+ */
public ListAccess<User> findUsersByGroupId(String groupId) throws Exception
{
String queryFindUsersInGroup =
@@ -270,6 +303,9 @@
return new HibernateListAccess<User>(service_, queryFindUsersInGroup, countUsersInGroup);
}
+ /**
+ * {@inheritDoc}
+ */
public Collection findUsersByGroupAndRole(String groupName, String role) throws Exception
{
String queryFindUsersByGroupAndRole =
Modified: core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java
===================================================================
--- core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java 2011-11-02 16:40:39 UTC (rev 5153)
+++ core/trunk/exo.core.component.organization.jdbc/src/main/java/org/exoplatform/services/organization/hibernate/UserProfileDAOImpl.java 2011-11-03 09:45:39 UTC (rev 5154)
@@ -78,25 +78,25 @@
listeners_.remove(listener);
}
+ /**
+ * {@inheritDoc}
+ */
final public UserProfile createUserProfileInstance()
{
return new UserProfileImpl();
}
+ /**
+ * {@inheritDoc}
+ */
public UserProfile createUserProfileInstance(String userName)
{
return new UserProfileImpl(userName);
}
- void createUserProfileEntry(UserProfile up, Session session) throws Exception
- {
- UserProfileData upd = new UserProfileData();
- upd.setUserProfile(up);
- session.save(upd);
- session.flush();
- cache_.remove(up.getUserName());
- }
-
+ /**
+ * {@inheritDoc}
+ */
public void saveUserProfile(UserProfile profile, boolean broadcast) throws Exception
{
Session session = service_.openSession();
@@ -108,26 +108,34 @@
upd.setUserProfile(profile);
if (broadcast)
preSave(profile, true);
+
session = service_.openSession();
session.save(profile.getUserName(), upd);
+ session.flush();
+ cache_.put(profile.getUserName(), profile);
+
if (broadcast)
postSave(profile, true);
- session.flush();
}
else
{
upd.setUserProfile(profile);
if (broadcast)
preSave(profile, false);
+
session = service_.openSession();
session.update(upd);
+ session.flush();
+ cache_.put(profile.getUserName(), profile);
+
if (broadcast)
postSave(profile, false);
- session.flush();
}
- cache_.put(profile.getUserName(), profile);
}
+ /**
+ * {@inheritDoc}
+ */
public UserProfile removeUserProfile(String userName, boolean broadcast) throws Exception
{
Session session = service_.openSession();
@@ -137,12 +145,15 @@
UserProfile profile = upd.getUserProfile();
if (broadcast)
preDelete(profile);
+
session = service_.openSession();
session.delete(upd);
+ session.flush();
+ cache_.remove(userName);
+
if (broadcast)
postDelete(profile);
- session.flush();
- cache_.remove(userName);
+
return profile;
}
catch (Exception exp)
@@ -151,6 +162,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public UserProfile findUserProfileByName(String userName) throws Exception
{
UserProfile up = (UserProfile)cache_.get(userName);
@@ -169,6 +183,9 @@
return up;
}
+ /**
+ * {@inheritDoc}
+ */
public UserProfile findUserProfileByName(String userName, Session session) throws Exception
{
UserProfileData upd = (UserProfileData)service_.findOne(session, queryFindUserProfileByName, userName);
@@ -189,6 +206,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public Collection findUserProfiles() throws Exception
{
Session session = service_.openSession();
14 years, 6 months
exo-jcr SVN: r5153 - in kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss: mru and 1 other directory.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-11-02 12:40:39 -0400 (Wed, 02 Nov 2011)
New Revision: 5153
Modified:
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/fifo/FIFOExoCacheCreator.java
kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/mru/MRUExoCacheCreator.java
Log:
EXOJCR-1616: Don't use anonymous inner classes when it will be accessed by java-reflection
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/fifo/FIFOExoCacheCreator.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/fifo/FIFOExoCacheCreator.java 2011-11-02 16:18:34 UTC (rev 5152)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/fifo/FIFOExoCacheCreator.java 2011-11-02 16:40:39 UTC (rev 5153)
@@ -27,6 +27,7 @@
import org.exoplatform.services.cache.impl.jboss.AbstractExoCacheCreator;
import org.jboss.cache.Cache;
import org.jboss.cache.Fqn;
+import org.jboss.cache.eviction.FIFOAlgorithm;
import org.jboss.cache.eviction.FIFOAlgorithmConfig;
import java.io.Serializable;
@@ -90,35 +91,49 @@
final FIFOAlgorithmConfig fifo = new FIFOAlgorithmConfig(maxNodes);
fifo.setMinTimeToLive(minTimeToLive);
Fqn<String> rooFqn = addEvictionRegion(config, cache, fifo);
- return new AbstractExoCache<Serializable, Object>(config, cache, rooFqn)
+ return new FIFOExoCache(config, cache, rooFqn, fifo);
+ }
+
+
+ /**
+ * The {@link FIFOAlgorithm} implementation of an ExoCache
+ */
+ public static class FIFOExoCache extends AbstractExoCache<Serializable, Object>
+ {
+
+ private final FIFOAlgorithmConfig fifo;
+
+ public FIFOExoCache(ExoCacheConfig config, Cache<Serializable, Object> cache, Fqn<String> rootFqn, FIFOAlgorithmConfig fifo)
{
+ super(config, cache, rootFqn);
+ this.fifo = fifo;
+ }
- public void setMaxSize(int max)
- {
- fifo.setMaxNodes(max);
- }
+ public void setMaxSize(int max)
+ {
+ fifo.setMaxNodes(max);
+ }
- public void setLiveTime(long period)
- {
- fifo.setMinTimeToLive(period);
- }
+ public void setLiveTime(long period)
+ {
+ fifo.setMinTimeToLive(period);
+ }
- @ManagedName("MaxNodes")
- @ManagedDescription("This is the maximum number of nodes allowed in this region. " +
- "0 denotes immediate expiry, -1 denotes no limit.")
- public int getMaxSize()
- {
- return fifo.getMaxNodes();
- }
+ @ManagedName("MaxNodes")
+ @ManagedDescription("This is the maximum number of nodes allowed in this region. " +
+ "0 denotes immediate expiry, -1 denotes no limit.")
+ public int getMaxSize()
+ {
+ return fifo.getMaxNodes();
+ }
- @ManagedName("MinTimeToLive")
- @ManagedDescription("the minimum amount of time a node must be allowed to live after " +
- "being accessed before it is allowed to be considered for eviction. 0 denotes that " +
- "this feature is disabled, which is the default value.")
- public long getLiveTime()
- {
- return fifo.getMinTimeToLive();
- }
- };
+ @ManagedName("MinTimeToLive")
+ @ManagedDescription("the minimum amount of time a node must be allowed to live after " +
+ "being accessed before it is allowed to be considered for eviction. 0 denotes that " +
+ "this feature is disabled, which is the default value.")
+ public long getLiveTime()
+ {
+ return fifo.getMinTimeToLive();
+ }
}
}
Modified: kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/mru/MRUExoCacheCreator.java
===================================================================
--- kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/mru/MRUExoCacheCreator.java 2011-11-02 16:18:34 UTC (rev 5152)
+++ kernel/trunk/exo.kernel.component.ext.cache.impl.jboss.v3/src/main/java/org/exoplatform/services/cache/impl/jboss/mru/MRUExoCacheCreator.java 2011-11-02 16:40:39 UTC (rev 5153)
@@ -74,36 +74,7 @@
final MRUAlgorithmConfig mru = new MRUAlgorithmConfig(maxNodes);
mru.setMinTimeToLive(minTimeToLive);
Fqn<String> rooFqn = addEvictionRegion(config, cache, mru);
- return new AbstractExoCache<Serializable, Object>(config, cache, rooFqn)
- {
-
- public void setMaxSize(int max)
- {
- mru.setMaxNodes(max);
- }
-
- public void setLiveTime(long period)
- {
- mru.setMinTimeToLive(period);
- }
-
- @ManagedName("MaxNodes")
- @ManagedDescription("This is the maximum number of nodes allowed in this region. " +
- "0 denotes immediate expiry, -1 denotes no limit.")
- public int getMaxSize()
- {
- return mru.getMaxNodes();
- }
-
- @ManagedName("MinTimeToLive")
- @ManagedDescription("the minimum amount of time a node must be allowed to live after " +
- "being accessed before it is allowed to be considered for eviction. " +
- "0 denotes that this feature is disabled, which is the default value.")
- public long getLiveTime()
- {
- return mru.getMinTimeToLive();
- }
- };
+ return new MRUExoCache(config, cache, rooFqn, mru);
}
/**
@@ -121,4 +92,47 @@
{
return EXPECTED_IMPL;
}
+
+ /**
+ * The MRU implementation of an ExoCache
+ */
+ public static class MRUExoCache extends AbstractExoCache<Serializable, Object>
+ {
+
+ private final MRUAlgorithmConfig mru;
+
+ public MRUExoCache(ExoCacheConfig config, Cache<Serializable, Object> cache, Fqn<String> rooFqn,
+ MRUAlgorithmConfig mru)
+ {
+ super(config, cache, rooFqn);
+ this.mru = mru;
+ }
+
+ public void setMaxSize(int max)
+ {
+ mru.setMaxNodes(max);
+ }
+
+ public void setLiveTime(long period)
+ {
+ mru.setMinTimeToLive(period);
+ }
+
+ @ManagedName("MaxNodes")
+ @ManagedDescription("This is the maximum number of nodes allowed in this region. "
+ + "0 denotes immediate expiry, -1 denotes no limit.")
+ public int getMaxSize()
+ {
+ return mru.getMaxNodes();
+ }
+
+ @ManagedName("MinTimeToLive")
+ @ManagedDescription("the minimum amount of time a node must be allowed to live after "
+ + "being accessed before it is allowed to be considered for eviction. "
+ + "0 denotes that this feature is disabled, which is the default value.")
+ public long getLiveTime()
+ {
+ return mru.getMinTimeToLive();
+ }
+ }
}
14 years, 6 months
exo-jcr SVN: r5152 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: clean/rdbms and 1 other directory.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-11-02 12:18:34 -0400 (Wed, 02 Nov 2011)
New Revision: 5152
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBBackup.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
Log:
EXOJCR-1612: Added missing changes
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBBackup.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBBackup.java 2011-11-02 15:13:53 UTC (rev 5151)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/backup/rdbms/DBBackup.java 2011-11-02 16:18:34 UTC (rev 5152)
@@ -86,6 +86,16 @@
public static final int DB_DIALECT_MYSQL_UTF8 = DBConstants.DB_DIALECT_MYSQL_UTF8.hashCode();
/**
+ * MySQL-MYISAM dialect.
+ */
+ public static final int DB_DIALECT_MYSQL_MYISAM = DBConstants.DB_DIALECT_MYSQL_MYISAM.hashCode();
+
+ /**
+ * MySQL-MYISAM-UTF8 dialect.
+ */
+ public static final int DB_DIALECT_MYSQL_MYISAM_UTF8 = DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8.hashCode();
+
+ /**
* DB2 dialect.
*/
public static final int DB_DIALECT_DB2 = DBConstants.DB_DIALECT_DB2.hashCode();
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java 2011-11-02 15:13:53 UTC (rev 5151)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java 2011-11-02 16:18:34 UTC (rev 5152)
@@ -926,6 +926,8 @@
|| dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_ORACLEOCI)
|| dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL)
|| dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8)
|| dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_SYBASE))
{
ArrayList<String> cleanScripts = new ArrayList<String>();
14 years, 6 months
exo-jcr SVN: r5151 - jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-11-02 11:13:53 -0400 (Wed, 02 Nov 2011)
New Revision: 5151
Modified:
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/jdbc-data-container-config.xml
Log:
EXOJCR-1612: Create a specific dialect to allow to use MyISAM instead of InnoDB (doc)
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/jdbc-data-container-config.xml
===================================================================
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/jdbc-data-container-config.xml 2011-11-02 15:13:21 UTC (rev 5150)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/configuration/jdbc-data-container-config.xml 2011-11-02 15:13:53 UTC (rev 5151)
@@ -28,35 +28,57 @@
with eXo JCR implementation.</para>
<para>Currently the data container is tested with the following
- RDBMS:<itemizedlist>
+ configurations:<itemizedlist>
<listitem>
- <para>MySQL 5.1 MYSQL Connector/J 5.1.8</para>
+ <para>MySQL 5.0.18 MYSQL Connector/J 5.0.8</para>
</listitem>
<listitem>
- <para>PostgresSQL 8.3.7 JDBC4 Driver, Version 8.3-605</para>
+ <para>MySQL 5.1.36 MYSQL Connector/J 5.1.14</para>
</listitem>
<listitem>
- <para>Oracle DB 11g (11.0.1.6), JDBC Driver Oracle 11g R1
+ <para>PostgresSQL 8.2.4 JDBC4 Driver, Version 8.2-507</para>
+ </listitem>
+
+ <listitem>
+ <para>PostgresSQL 8.3.7 JDBC4 Driver, Version 8.3-606</para>
+ </listitem>
+
+ <listitem>
+ <para>Oracle DB 10g R2 (10.2.0.4), JDBC Driver Oracle 10g R2
+ (10.2.0.4)</para>
+ </listitem>
+
+ <listitem>
+ <para>Oracle DB 11g R1 (11.1.0.6.0), JDBC Driver Oracle 11g R1
(11.1.0.6.0)</para>
</listitem>
<listitem>
- <para>DB2 9,7 IBM Data Server Driver for JDBC and SQLJ (JCC Driver)
- v.9.1 (fixpack 3a)</para>
+ <para>Oracle DB 11g R2 (11.2.0.1.0), JDBC Driver Oracle 11g R2
+ (11.2.0.1.0)</para>
</listitem>
<listitem>
- <para>MS SQL Server 2005 SP3 JDBC Driver 2.0</para>
+ <para>DB2 9.7.4 IBM Data Server Driver for JDBC and SQLJ (JCC
+ Driver) v.9.7</para>
</listitem>
<listitem>
- <para>Sybase 15.0.3 Driver: Sybase jConnect JDBC driver v7 (Build
- 26502)</para>
+ <para>MS SQL Server 2005 SP3 JDBC Driver 3.0</para>
</listitem>
<listitem>
+ <para>MS SQL Server 2008 JDBC Driver 3.0</para>
+ </listitem>
+
+ <listitem>
+ <para>Sybase 15.0.3 ASE Driver: Sybase jConnect JDBC driver v7
+ (Build 26502)</para>
+ </listitem>
+
+ <listitem>
<para>HSQLDB (2.0.0)</para>
</listitem>
</itemizedlist></para>
@@ -73,16 +95,14 @@
personal needs and requirements, but obligatorily case sensitive. For
more information please refer to Microsoft SQL Server documentation
page "Selecting a SQL Server Collation" <ulink
- url="http://msdn.microsoft.com/en-us/library/ms144250.aspx">here.</ulink>
- </para>
- </note>
- <note>
- <para>
- Be aware that JCR does not support MyISAM storage engine for the MySQL
- relational database management system.
- </para>
- </note>
- Each database software supports ANSI SQL standards but also has
+ url="http://msdn.microsoft.com/en-us/library/ms144250.aspx">here.</ulink></para>
+ </note><note>
+ <para>Be aware that MyISAM is not supported due to its lack of
+ transaction support and integrity check, so use it only if you don't
+ expect any support and if performances in read accesses are more
+ important than the consistency in your use-case. This dialect is only
+ dedicated to the community.</para>
+ </note> Each database software supports ANSI SQL standards but also has
its own specifics. So, each database has its own configuration in eXo JCR
as a database dialect parameter. If you need a more detailed configuration
of the database, it's possible to do that by editing the metadata
@@ -112,6 +132,18 @@
</tr>
<tr>
+ <td>MySQL DB with MyISAM*</td>
+
+ <td>jcr-sjdbc.mysql-myisam.sql</td>
+ </tr>
+
+ <tr>
+ <td>MySQL DB with MyISAM and utf-8*</td>
+
+ <td>jcr-sjdbc.mysql-myisam-utf8.sql</td>
+ </tr>
+
+ <tr>
<td>PostgresSQL</td>
<td>jcr-sjdbc.pqsql.sql</td>
@@ -124,7 +156,7 @@
</tr>
<tr>
- <td>DB2 9.7</td>
+ <td>DB2</td>
<td>jcr-sjdbc.db2.sql</td>
</tr>
@@ -164,6 +196,18 @@
</tr>
<tr>
+ <td>MySQL DB with MyISAM*</td>
+
+ <td>jcr-mjdbc.mysql-myisam.sql</td>
+ </tr>
+
+ <tr>
+ <td>MySQL DB with MyISAM and utf-8*</td>
+
+ <td>jcr-mjdbc.mysql-myisam-utf8.sql</td>
+ </tr>
+
+ <tr>
<td>PostgresSQL</td>
<td>jcr-mjdbc.pqsql.sql</td>
@@ -176,7 +220,7 @@
</tr>
<tr>
- <td>DB2 9.7</td>
+ <td>DB2</td>
<td>jcr-mjdbc.db2.sql</td>
</tr>
@@ -200,6 +244,14 @@
</tr>
</table>
+ <note>
+ <para>* MyISAM is not supported due to its lack of transaction support
+ and integrity check, so use it only if you don't expect any support and
+ if performances in read accesses are more important than the consistency
+ in your use-case. This dialect is only dedicated to the
+ community.</para>
+ </note>
+
<para>In case the non-ANSI node name is used, it's necessary to use a
database with MultiLanguage support[TODO link to MultiLanguage]. Some JDBC
drivers need additional parameters for establishing a Unicode friendly
14 years, 6 months
exo-jcr SVN: r5150 - in jcr/trunk/exo.jcr.component.core/src/main: java/org/exoplatform/services/jcr/impl/config and 7 other directories.
by do-not-reply@jboss.org
Author: nfilotto
Date: 2011-11-02 11:13:21 -0400 (Wed, 02 Nov 2011)
New Revision: 5150
Added:
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql-myisam-utf8.sql
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql-myisam.sql
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql-myisam-utf8.sql
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql-myisam.sql
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/JDBCConfigurationPersister.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java
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/util/jdbc/DBInitializerHelper.java
Log:
EXOJCR-1612: Create a specific dialect to allow to use MyISAM instead of InnoDB
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java 2011-11-02 15:03:01 UTC (rev 5149)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java 2011-11-02 15:13:21 UTC (rev 5150)
@@ -188,6 +188,8 @@
|| dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_ORACLEOCI)
|| dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL)
|| dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8)
|| dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_SYBASE)
|| dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_HSQLDB))
{
@@ -230,7 +232,9 @@
String constraintName;
if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL)
- || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL))
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
{
return dropScript;
}
@@ -318,7 +322,9 @@
}
if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL)
- || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL))
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
{
constraintName = validateConstraintName("JCR_FK_" + multiDb + "VALUE_PROPERTY", dialect);
constraint =
@@ -401,7 +407,9 @@
protected static String dropCommand(boolean isPrimaryKey, String constraintName, String dialect)
{
if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL)
- || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8))
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
{
return isPrimaryKey == true ? "DROP PRIMARY KEY" : "DROP FOREIGN KEY " + constraintName;
}
@@ -503,7 +511,9 @@
+ "REF_PROPERTY" + OLD_OBJECT_SUFFIX);
}
else if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL)
- || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8))
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
{
renameScripts.add("ALTER TABLE JCR_" + isMultiDB + "VALUE RENAME TO JCR_" + isMultiDB + "VALUE"
+ OLD_OBJECT_SUFFIX);
@@ -634,7 +644,9 @@
+ " RENAME TO JCR_IDX_" + isMultiDB + "REF_PROPERTY");
}
else if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL)
- || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8))
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
{
rollbackScripts.add("ALTER TABLE JCR_" + isMultiDB + "ITEM" + OLD_OBJECT_SUFFIX + " RENAME TO JCR_"
+ isMultiDB + "ITEM");
@@ -760,7 +772,9 @@
// Filter scripts
if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL)
- || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8))
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
{
for (int i = 0; i < scripts.size(); i++)
{
@@ -848,7 +862,9 @@
cleanWithHelper = true;
}
else if (dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL)
- || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8))
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM)
+ || dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
{
cleanWithHelper = true;
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/JDBCConfigurationPersister.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/JDBCConfigurationPersister.java 2011-11-02 15:03:01 UTC (rev 5149)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/JDBCConfigurationPersister.java 2011-11-02 15:13:21 UTC (rev 5150)
@@ -185,7 +185,9 @@
binType = "LONG BYTE";
}
else if (DBConstants.DB_DIALECT_MYSQL.equalsIgnoreCase(dialect)
- || DBConstants.DB_DIALECT_MYSQL_UTF8.equalsIgnoreCase(dialect))
+ || DBConstants.DB_DIALECT_MYSQL_UTF8.equalsIgnoreCase(dialect)
+ || DBConstants.DB_DIALECT_MYSQL_MYISAM.equalsIgnoreCase(dialect)
+ || DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8.equalsIgnoreCase(dialect))
{
binType = "LONGBLOB";
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java 2011-11-02 15:03:01 UTC (rev 5149)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/infinispan/ISPNCacheableLockManagerImpl.java 2011-11-02 15:13:21 UTC (rev 5150)
@@ -282,7 +282,8 @@
blobType = "VARBINARY(65535)";
}
// MYSQL
- else if (dialect.equals(DBConstants.DB_DIALECT_MYSQL) || dialect.equals(DBConstants.DB_DIALECT_MYSQL_UTF8))
+ else if (dialect.equals(DBConstants.DB_DIALECT_MYSQL) || dialect.equals(DBConstants.DB_DIALECT_MYSQL_UTF8) ||
+ dialect.equals(DBConstants.DB_DIALECT_MYSQL_MYISAM) || dialect.equals(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
{
blobType = "LONGBLOB";
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2011-11-02 15:03:01 UTC (rev 5149)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/lock/jbosscache/CacheableLockManagerImpl.java 2011-11-02 15:13:21 UTC (rev 5150)
@@ -384,7 +384,8 @@
blobType = "VARBINARY(65535)";
}
// MYSQL
- else if (dialect.equals(DBConstants.DB_DIALECT_MYSQL) || dialect.equals(DBConstants.DB_DIALECT_MYSQL_UTF8))
+ else if (dialect.equals(DBConstants.DB_DIALECT_MYSQL) || dialect.equals(DBConstants.DB_DIALECT_MYSQL_UTF8) ||
+ dialect.equals(DBConstants.DB_DIALECT_MYSQL_MYISAM) || dialect.equals(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
{
blobType = "LONGBLOB";
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java 2011-11-02 15:03:01 UTC (rev 5149)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DBConstants.java 2011-11-02 15:13:21 UTC (rev 5150)
@@ -133,7 +133,7 @@
* FIND_LAST_ORDER_NUMBER_BY_PARENTID.
*/
protected String FIND_LAST_ORDER_NUMBER_BY_PARENTID;
-
+
/**
* FIND_NODES_COUNT_BY_PARENTID.
*/
@@ -271,6 +271,7 @@
* DB_DIALECT_AUTO.
*/
public final static String DB_DIALECT_AUTO = "Auto".intern();
+
/**
* DB_DIALECT_GENERIC.
*/
@@ -302,10 +303,20 @@
public final static String DB_DIALECT_MYSQL_UTF8 = "MySQL-UTF8".intern();
/**
+ * DB_DIALECT_MYSQL_MYISAM.
+ */
+ public final static String DB_DIALECT_MYSQL_MYISAM = "MySQL-MyISAM".intern();
+
+ /**
+ * DB_DIALECT_MYSQL_MYISAM_UTF8.
+ */
+ public final static String DB_DIALECT_MYSQL_MYISAM_UTF8 = "MySQL-MyISAM-UTF8".intern();
+
+ /**
* DB_DIALECT_HSQLDB.
*/
public final static String DB_DIALECT_HSQLDB = "HSQLDB".intern();
-
+
/**
* DB_DIALECT_DB2.
*/
@@ -335,18 +346,18 @@
* DB_DIALECT_INGRES.
*/
public final static String DB_DIALECT_INGRES = "Ingres".intern();
-
+
/**
* DB_DIALECT_H2.
*/
public final static String DB_DIALECT_H2 = "H2".intern();
-
/**
* DB_DIALECTS.
*/
public final static String[] DB_DIALECTS = {DB_DIALECT_GENERIC, DB_DIALECT_ORACLE, DB_DIALECT_ORACLEOCI,
DB_DIALECT_PGSQL, DB_DIALECT_MYSQL, DB_DIALECT_HSQLDB, DB_DIALECT_DB2, DB_DIALECT_DB2V8, DB_DIALECT_MSSQL,
- DB_DIALECT_SYBASE, DB_DIALECT_DERBY, DB_DIALECT_MYSQL_UTF8, DB_DIALECT_INGRES, DB_DIALECT_H2};
+ DB_DIALECT_SYBASE, DB_DIALECT_DERBY, DB_DIALECT_MYSQL_UTF8, DB_DIALECT_INGRES, DB_DIALECT_H2,
+ DB_DIALECT_MYSQL_MYISAM, DB_DIALECT_MYSQL_MYISAM_UTF8};
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2011-11-02 15:03:01 UTC (rev 5149)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/JDBCWorkspaceDataContainer.java 2011-11-02 15:13:21 UTC (rev 5150)
@@ -630,8 +630,8 @@
protected void initDatabase() throws NamingException, RepositoryException, IOException
{
- StorageDBInitializer dbInitilizer = null;
- String sqlPath = null;
+ StorageDBInitializer dbInitializer = null;
+ String sqlPath = DBInitializerHelper.scriptPath(dbDialect, multiDb);
if (dbDialect == DBConstants.DB_DIALECT_ORACLEOCI)
{
LOG.warn(DBConstants.DB_DIALECT_ORACLEOCI + " dialect is experimental!");
@@ -646,46 +646,28 @@
new OracleConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
}
-
- sqlPath = DBInitializerHelper.scriptPath(dbDialect, multiDb);
-
// a particular db initializer may be configured here too
- dbInitilizer = new OracleDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
+ dbInitializer = new OracleDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
}
else if (dbDialect == DBConstants.DB_DIALECT_ORACLE)
{
this.connFactory = defaultConnectionFactory();
- sqlPath = DBInitializerHelper.scriptPath(dbDialect, multiDb);
- dbInitilizer = new OracleDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
+ dbInitializer = new OracleDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
}
else if (dbDialect == DBConstants.DB_DIALECT_PGSQL)
{
this.connFactory = defaultConnectionFactory();
- sqlPath = DBInitializerHelper.scriptPath(dbDialect, multiDb);
- dbInitilizer = new PgSQLDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
+ dbInitializer = new PgSQLDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
}
- else if (dbDialect == DBConstants.DB_DIALECT_MYSQL)
+ else if (dbDialect == DBConstants.DB_DIALECT_MYSQL || dbDialect == DBConstants.DB_DIALECT_MYSQL_UTF8 ||
+ dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM || dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8)
{
- // [PN] 28.06.07
- if (dbSourceName != null)
+ if (dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM || dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8)
{
- this.connFactory =
- new MySQLConnectionFactory(getDataSource(), containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
+ LOG.warn("MyISAM is not supported due to its lack of transaction support and integrity check, so use it only" +
+ " if you don't expect any support and performances in read accesses are more important than the consistency" +
+ " in your use-case. This dialect is only dedicated to the community.");
}
- else
- {
- this.connFactory =
- new MySQLConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
- valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- }
-
- sqlPath = DBInitializerHelper.scriptPath(dbDialect, multiDb);
- dbInitilizer = defaultDBInitializer(sqlPath);
- }
- else if (dbDialect == DBConstants.DB_DIALECT_MYSQL_UTF8)
- {
- // [PN] 13.07.08
if (dbSourceName != null)
{
this.connFactory =
@@ -699,45 +681,38 @@
valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
}
- sqlPath = DBInitializerHelper.scriptPath(dbDialect, multiDb);
- dbInitilizer = defaultDBInitializer(sqlPath);
+ dbInitializer = defaultDBInitializer(sqlPath);
}
else if (dbDialect == DBConstants.DB_DIALECT_MSSQL)
{
this.connFactory = defaultConnectionFactory();
- sqlPath = DBInitializerHelper.scriptPath(dbDialect, multiDb);
- dbInitilizer = defaultDBInitializer(sqlPath);
+ dbInitializer = defaultDBInitializer(sqlPath);
}
else if (dbDialect == DBConstants.DB_DIALECT_DERBY)
{
this.connFactory = defaultConnectionFactory();
- sqlPath = DBInitializerHelper.scriptPath(dbDialect, multiDb);
- dbInitilizer = defaultDBInitializer(sqlPath);
+ dbInitializer = defaultDBInitializer(sqlPath);
}
else if (dbDialect == DBConstants.DB_DIALECT_DB2)
{
this.connFactory = defaultConnectionFactory();
- sqlPath = DBInitializerHelper.scriptPath(dbDialect, multiDb);
- dbInitilizer = defaultDBInitializer(sqlPath);
+ dbInitializer = defaultDBInitializer(sqlPath);
}
else if (dbDialect == DBConstants.DB_DIALECT_DB2V8)
{
this.connFactory = defaultConnectionFactory();
- sqlPath = DBInitializerHelper.scriptPath(dbDialect, multiDb);
- dbInitilizer = defaultDBInitializer(sqlPath);
+ dbInitializer = defaultDBInitializer(sqlPath);
}
else if (dbDialect == DBConstants.DB_DIALECT_SYBASE)
{
this.connFactory = defaultConnectionFactory();
- sqlPath = DBInitializerHelper.scriptPath(dbDialect, multiDb);
- dbInitilizer = defaultDBInitializer(sqlPath);
+ dbInitializer = defaultDBInitializer(sqlPath);
}
else if (dbDialect == DBConstants.DB_DIALECT_INGRES)
{
this.connFactory = defaultConnectionFactory();
- sqlPath = DBInitializerHelper.scriptPath(dbDialect, multiDb);
// using Postgres initializer
- dbInitilizer =
+ dbInitializer =
new IngresSQLDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
}
else if (dbDialect == DBConstants.DB_DIALECT_HSQLDB)
@@ -754,21 +729,19 @@
new HSQLDBConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
}
- sqlPath = DBInitializerHelper.scriptPath(dbDialect, multiDb);
- dbInitilizer = defaultDBInitializer(sqlPath);
+ dbInitializer = defaultDBInitializer(sqlPath);
}
else
{
// generic, DB_HSQLDB
this.connFactory = defaultConnectionFactory();
- sqlPath = DBInitializerHelper.scriptPath(dbDialect, multiDb);
- dbInitilizer = defaultDBInitializer(sqlPath);
+ dbInitializer = defaultDBInitializer(sqlPath);
}
// database type
try
{
- dbInitilizer.init();
+ dbInitializer.init();
}
catch (DBInitializerException e)
{
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2011-11-02 15:03:01 UTC (rev 5149)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/optimisation/CQJDBCWorkspaceDataContainer.java 2011-11-02 15:13:21 UTC (rev 5150)
@@ -39,6 +39,7 @@
import org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.db.SybaseConnectionFactory;
import org.exoplatform.services.jcr.impl.util.io.FileCleanerHolder;
import org.exoplatform.services.jcr.impl.util.jdbc.DBInitializerException;
+import org.exoplatform.services.jcr.impl.util.jdbc.DBInitializerHelper;
import org.exoplatform.services.jcr.storage.value.ValueStoragePluginProvider;
import org.exoplatform.services.jdbc.DataSourceProvider;
import org.exoplatform.services.naming.InitialContextInitializer;
@@ -93,8 +94,8 @@
protected void initDatabase() throws NamingException, RepositoryException, IOException
{
- StorageDBInitializer dbInitilizer = null;
- String sqlPath = null;
+ StorageDBInitializer dbInitializer = null;
+ String sqlPath = DBInitializerHelper.scriptPath(dbDialect, multiDb);
if (dbDialect == DBConstants.DB_DIALECT_ORACLEOCI)
{
LOG.warn(DBConstants.DB_DIALECT_ORACLEOCI + " dialect is experimental!");
@@ -110,10 +111,8 @@
new OracleConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner, useQueryHints);
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.ora.sql";
-
// a particular db initializer may be configured here too
- dbInitilizer = new OracleDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
+ dbInitializer = new OracleDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
}
else if (dbDialect == DBConstants.DB_DIALECT_ORACLE)
{
@@ -128,8 +127,7 @@
this.connFactory =
new DefaultOracleConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner, useQueryHints);
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.ora.sql";
- dbInitilizer = new OracleDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
+ dbInitializer = new OracleDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
}
else if (dbDialect == DBConstants.DB_DIALECT_PGSQL)
@@ -145,32 +143,17 @@
new PostgreConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mysql.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
-
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.pgsql.sql";
- dbInitilizer = new PgSQLDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
+ dbInitializer = new PgSQLDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
}
- else if (dbDialect == DBConstants.DB_DIALECT_MYSQL)
+ else if (dbDialect == DBConstants.DB_DIALECT_MYSQL || dbDialect == DBConstants.DB_DIALECT_MYSQL_UTF8 ||
+ dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM || dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8)
{
- // [PN] 28.06.07
- if (dbSourceName != null)
+ if (dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM || dbDialect == DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8)
{
- this.connFactory =
- new MySQLConnectionFactory(getDataSource(), containerName, multiDb, valueStorageProvider, maxBufferSize,
- swapDirectory, swapCleaner);
+ LOG.warn("MyISAM is not supported due to its lack of transaction support and integrity check, so use it only" +
+ " if you don't expect any support and performances in read accesses are more important than the consistency" +
+ " in your use-case. This dialect is only dedicated to the community.");
}
- else
- this.connFactory =
- new MySQLConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
- valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
-
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mysql.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
- }
- else if (dbDialect == DBConstants.DB_DIALECT_MYSQL_UTF8)
- {
- // [PN] 13.07.08
if (dbSourceName != null)
{
this.connFactory =
@@ -182,8 +165,7 @@
new MySQLConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mysql-utf8.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
+ dbInitializer = defaultDBInitializer(sqlPath);
}
else if (dbDialect == DBConstants.DB_DIALECT_MSSQL)
{
@@ -200,14 +182,12 @@
valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
}
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mssql.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
+ dbInitializer = defaultDBInitializer(sqlPath);
}
else if (dbDialect == DBConstants.DB_DIALECT_DERBY)
{
this.connFactory = defaultConnectionFactory();
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.derby.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
+ dbInitializer = defaultDBInitializer(sqlPath);
}
else if (dbDialect == DBConstants.DB_DIALECT_DB2)
{
@@ -224,8 +204,7 @@
valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
}
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.db2.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
+ dbInitializer = defaultDBInitializer(sqlPath);
}
else if (dbDialect == DBConstants.DB_DIALECT_DB2V8)
{
@@ -242,8 +221,7 @@
valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
}
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.db2v8.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
+ dbInitializer = defaultDBInitializer(sqlPath);
}
else if (dbDialect == DBConstants.DB_DIALECT_SYBASE)
{
@@ -260,15 +238,13 @@
valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
}
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.sybase.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
+ dbInitializer = defaultDBInitializer(sqlPath);
}
else if (dbDialect == DBConstants.DB_DIALECT_INGRES)
{
this.connFactory = defaultConnectionFactory();
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.ingres.sql";
// using Postgres initializer
- dbInitilizer =
+ dbInitializer =
new IngresSQLDBInitializer(containerName, this.connFactory.getJdbcConnection(), sqlPath, multiDb);
}
else if (dbDialect == DBConstants.DB_DIALECT_HSQLDB)
@@ -283,21 +259,19 @@
this.connFactory =
new HSQLDBConnectionFactory(dbDriver, dbUrl, dbUserName, dbPassword, containerName, multiDb,
valueStorageProvider, maxBufferSize, swapDirectory, swapCleaner);
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
+ dbInitializer = defaultDBInitializer(sqlPath);
}
else
{
// generic, DB_HSQLDB
this.connFactory = defaultConnectionFactory();
- sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.sql";
- dbInitilizer = defaultDBInitializer(sqlPath);
+ dbInitializer = defaultDBInitializer(sqlPath);
}
// database type
try
{
- dbInitilizer.init();
+ dbInitializer.init();
}
catch (DBInitializerException e)
{
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 2011-11-02 15:03:01 UTC (rev 5149)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/cas/JDBCValueContentAddressStorageImpl.java 2011-11-02 15:13:21 UTC (rev 5150)
@@ -346,7 +346,9 @@
//
String err = e.toString();
if (DBConstants.DB_DIALECT_MYSQL.equalsIgnoreCase(dialect)
- || DBConstants.DB_DIALECT_MYSQL_UTF8.equalsIgnoreCase(dialect))
+ || DBConstants.DB_DIALECT_MYSQL_UTF8.equalsIgnoreCase(dialect)
+ || DBConstants.DB_DIALECT_MYSQL_MYISAM.equalsIgnoreCase(dialect)
+ || DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8.equalsIgnoreCase(dialect))
{
// for MySQL will search
return MYSQL_PK_CONSTRAINT_DETECT.matcher(err).find();
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java 2011-11-02 15:03:01 UTC (rev 5149)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/util/jdbc/DBInitializerHelper.java 2011-11-02 15:13:21 UTC (rev 5150)
@@ -82,10 +82,18 @@
{
sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mysql.sql";
}
+ else if (dbDialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM))
+ {
+ sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mysql-myisam.sql";
+ }
else if (dbDialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_UTF8))
{
sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mysql-utf8.sql";
}
+ else if (dbDialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MYSQL_MYISAM_UTF8))
+ {
+ sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mysql-myisam-utf8.sql";
+ }
else if (dbDialect.equalsIgnoreCase(DBConstants.DB_DIALECT_MSSQL))
{
sqlPath = "/conf/storage/jcr-" + (multiDb ? "m" : "s") + "jdbc.mssql.sql";
Added: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql-myisam-utf8.sql
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql-myisam-utf8.sql (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql-myisam-utf8.sql 2011-11-02 15:13:21 UTC (rev 5150)
@@ -0,0 +1,39 @@
+CREATE TABLE JCR_MCONTAINER(
+ VERSION VARCHAR(56) NOT NULL,
+ CONSTRAINT JCR_PK_MCONTAINER PRIMARY KEY(VERSION)
+) ENGINE=MyISAM;
+CREATE TABLE JCR_MITEM(
+ ID VARCHAR(56) NOT NULL,
+ PARENT_ID VARCHAR(56) NOT NULL,
+ NAME VARCHAR(512) CHARACTER SET utf8 COLLATE utf8_bin 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)
+) ENGINE=MyISAM;
+CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT ON JCR_MITEM(PARENT_ID, NAME(255), I_INDEX, I_CLASS, VERSION DESC);
+CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT_NAME ON JCR_MITEM(I_CLASS, PARENT_ID, NAME(255), I_INDEX, VERSION DESC);
+CREATE UNIQUE INDEX JCR_IDX_MITEM_PARENT_ID ON JCR_MITEM(I_CLASS, PARENT_ID, ID, VERSION DESC);
+CREATE INDEX JCR_IDX_MITEM_PARENT_N_ORDER_NUM ON JCR_MITEM(I_CLASS, PARENT_ID, N_ORDER_NUM, ID);
+CREATE TABLE JCR_MVALUE(
+ ID SERIAL NOT NULL,
+ DATA LONGBLOB,
+ ORDER_NUM INTEGER NOT NULL,
+ PROPERTY_ID VARCHAR(56) NOT NULL,
+ STORAGE_DESC VARCHAR(512),
+ CONSTRAINT JCR_PK_MVALUE PRIMARY KEY(ID),
+ CONSTRAINT JCR_FK_MVALUE_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES JCR_MITEM(ID)
+) ENGINE=MyISAM;
+CREATE UNIQUE INDEX JCR_IDX_MVALUE_PROPERTY ON JCR_MVALUE(PROPERTY_ID, ORDER_NUM);
+CREATE INDEX JCR_IDX_MVALUE_STORAGE_DESC ON JCR_MVALUE(PROPERTY_ID, STORAGE_DESC);
+CREATE TABLE JCR_MREF(
+ NODE_ID VARCHAR(56) NOT NULL,
+ PROPERTY_ID VARCHAR(56) NOT NULL,
+ ORDER_NUM INTEGER NOT NULL,
+ CONSTRAINT JCR_PK_MREF PRIMARY KEY(NODE_ID, PROPERTY_ID, ORDER_NUM)
+) ENGINE=MyISAM;
+CREATE UNIQUE INDEX JCR_IDX_MREF_PROPERTY ON JCR_MREF(PROPERTY_ID, ORDER_NUM);
\ No newline at end of file
Added: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql-myisam.sql
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql-myisam.sql (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-mjdbc.mysql-myisam.sql 2011-11-02 15:13:21 UTC (rev 5150)
@@ -0,0 +1,39 @@
+CREATE TABLE JCR_MCONTAINER(
+ VERSION VARCHAR(96) NOT NULL,
+ CONSTRAINT JCR_PK_MCONTAINER PRIMARY KEY(VERSION)
+) ENGINE=MyISAM;
+CREATE TABLE JCR_MITEM(
+ ID VARCHAR(96) NOT NULL,
+ PARENT_ID VARCHAR(96) NOT NULL,
+ NAME VARCHAR(512) CHARSET latin1 COLLATE latin1_general_cs 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)
+) ENGINE=MyISAM;
+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 INDEX JCR_IDX_MITEM_PARENT_N_ORDER_NUM ON JCR_MITEM(I_CLASS, PARENT_ID, N_ORDER_NUM, ID);
+CREATE TABLE JCR_MVALUE(
+ ID SERIAL NOT NULL,
+ DATA LONGBLOB,
+ ORDER_NUM INTEGER NOT NULL,
+ PROPERTY_ID VARCHAR(96) NOT NULL,
+ STORAGE_DESC VARCHAR(512),
+ CONSTRAINT JCR_PK_MVALUE PRIMARY KEY(ID),
+ CONSTRAINT JCR_FK_MVALUE_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES JCR_MITEM(ID)
+) ENGINE=MyISAM;
+CREATE UNIQUE INDEX JCR_IDX_MVALUE_PROPERTY ON JCR_MVALUE(PROPERTY_ID, ORDER_NUM);
+CREATE INDEX JCR_IDX_MVALUE_STORAGE_DESC ON JCR_MVALUE(PROPERTY_ID, STORAGE_DESC);
+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)
+) ENGINE=MyISAM;
+CREATE UNIQUE INDEX JCR_IDX_MREF_PROPERTY ON JCR_MREF(PROPERTY_ID, ORDER_NUM);
Added: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql-myisam-utf8.sql
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql-myisam-utf8.sql (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql-myisam-utf8.sql 2011-11-02 15:13:21 UTC (rev 5150)
@@ -0,0 +1,40 @@
+CREATE TABLE JCR_SCONTAINER(
+ VERSION VARCHAR(56) NOT NULL,
+ CONSTRAINT JCR_PK_SCONTAINER PRIMARY KEY(VERSION)
+) ENGINE=MyISAM;
+CREATE TABLE JCR_SITEM(
+ ID VARCHAR(56) NOT NULL,
+ PARENT_ID VARCHAR(56) NOT NULL,
+ NAME VARCHAR(512) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
+ VERSION INTEGER NOT NULL,
+ CONTAINER_NAME VARCHAR(24) 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_SITEM PRIMARY KEY(ID)
+ CONSTRAINT JCR_FK_SITEM_PARENT FOREIGN KEY(PARENT_ID) REFERENCES JCR_SITEM(ID)
+) ENGINE=MyISAM;
+CREATE UNIQUE INDEX JCR_IDX_SITEM_PARENT ON JCR_SITEM(CONTAINER_NAME, PARENT_ID, NAME(255), I_INDEX, I_CLASS, VERSION DESC);
+CREATE UNIQUE INDEX JCR_IDX_SITEM_PARENT_NAME ON JCR_SITEM(I_CLASS, CONTAINER_NAME, PARENT_ID, NAME(255), 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 INDEX JCR_IDX_SITEM_PARENT_N_ORDER_NUM ON JCR_SITEM(I_CLASS, CONTAINER_NAME, PARENT_ID, N_ORDER_NUM, ID);
+CREATE TABLE JCR_SVALUE(
+ ID SERIAL NOT NULL,
+ DATA LONGBLOB,
+ ORDER_NUM INTEGER NOT NULL,
+ PROPERTY_ID VARCHAR(56) NOT NULL,
+ STORAGE_DESC VARCHAR(512),
+ CONSTRAINT JCR_PK_SVALUE PRIMARY KEY(ID)
+ CONSTRAINT JCR_FK_SVALUE_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES JCR_SITEM(ID)
+) ENGINE=MyISAM;
+CREATE UNIQUE INDEX JCR_IDX_SVALUE_PROPERTY ON JCR_SVALUE(PROPERTY_ID, ORDER_NUM);
+CREATE INDEX JCR_IDX_SVALUE_STORAGE_DESC ON JCR_SVALUE(PROPERTY_ID, STORAGE_DESC);
+CREATE TABLE JCR_SREF(
+ NODE_ID VARCHAR(56) NOT NULL,
+ PROPERTY_ID VARCHAR(56) NOT NULL,
+ ORDER_NUM INTEGER NOT NULL,
+ CONSTRAINT JCR_PK_SREF PRIMARY KEY(NODE_ID, PROPERTY_ID, ORDER_NUM)
+) ENGINE=MyISAM;
+CREATE UNIQUE INDEX JCR_IDX_SREF_PROPERTY ON JCR_SREF(PROPERTY_ID, ORDER_NUM);
\ No newline at end of file
Added: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql-myisam.sql
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql-myisam.sql (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/storage/jcr-sjdbc.mysql-myisam.sql 2011-11-02 15:13:21 UTC (rev 5150)
@@ -0,0 +1,40 @@
+CREATE TABLE JCR_SCONTAINER(
+ VERSION VARCHAR(96) NOT NULL,
+ CONSTRAINT JCR_PK_SCONTAINER PRIMARY KEY(VERSION)
+) ENGINE=MyISAM;
+CREATE TABLE JCR_SITEM(
+ ID VARCHAR(96) NOT NULL,
+ PARENT_ID VARCHAR(96) NOT NULL,
+ NAME VARCHAR(512) CHARSET latin1 COLLATE latin1_general_cs 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 BOOLEAN,
+ CONSTRAINT JCR_PK_SITEM PRIMARY KEY(ID),
+ CONSTRAINT JCR_FK_SITEM_PARENT FOREIGN KEY(PARENT_ID) REFERENCES JCR_SITEM(ID)
+) ENGINE=MyISAM;
+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 INDEX JCR_IDX_SITEM_PARENT_N_ORDER_NUM ON JCR_SITEM(I_CLASS, CONTAINER_NAME, PARENT_ID, N_ORDER_NUM, ID);
+CREATE TABLE JCR_SVALUE(
+ ID SERIAL NOT NULL,
+ DATA LONGBLOB,
+ ORDER_NUM INTEGER NOT NULL,
+ PROPERTY_ID VARCHAR(96) NOT NULL,
+ STORAGE_DESC VARCHAR(512),
+ CONSTRAINT JCR_PK_SVALUE PRIMARY KEY(ID),
+ CONSTRAINT JCR_FK_SVALUE_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES JCR_SITEM(ID)
+) ENGINE=MyISAM;
+CREATE UNIQUE INDEX JCR_IDX_SVALUE_PROPERTY ON JCR_SVALUE(PROPERTY_ID, ORDER_NUM);
+CREATE INDEX JCR_IDX_SVALUE_STORAGE_DESC ON JCR_SVALUE(PROPERTY_ID, STORAGE_DESC);
+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)
+) ENGINE=MyISAM;
+CREATE UNIQUE INDEX JCR_IDX_SREF_PROPERTY ON JCR_SREF(PROPERTY_ID, ORDER_NUM);
14 years, 6 months