exo-jcr SVN: r1898 - in jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load: query and 1 other directories.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2010-02-18 08:25:20 -0500 (Thu, 18 Feb 2010)
New Revision: 1898
Added:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractAvgResponseTimeTest.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponseTimeTest.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavAvgResponseTimeTest.java
Removed:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractAvgResponceTimeTest.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponceTimeTest.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavAvgResponceTimeTest.java
Modified:
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractTestAgent.java
jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavTestAgent.java
Log:
EXOJCR-510 : Added more statistical information to the result: now it shows, ammount of work minimum, maximum, average, stddev of response time. E
Deleted: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractAvgResponceTimeTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractAvgResponceTimeTest.java 2010-02-18 13:23:36 UTC (rev 1897)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractAvgResponceTimeTest.java 2010-02-18 13:25:20 UTC (rev 1898)
@@ -1,140 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.cluster.load;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Random;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey Kabashnyuk</a>
- * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
- *
- */
-public abstract class AbstractAvgResponceTimeTest
-{
-
- private final int iterationGrowingPoll;
-
- private final int iterationTime;
-
- private final int initialSize;
-
- private final int readValue;
-
- /**
- * @param iterationGrowingPoll
- * @param iterationTime
- * @param initialSize
- */
- public AbstractAvgResponceTimeTest(int iterationGrowingPoll, int iterationTime, int initialSize, int readValue)
- {
- super();
- this.iterationGrowingPoll = iterationGrowingPoll;
- this.iterationTime = iterationTime;
- this.initialSize = initialSize;
- this.readValue = readValue;
- }
-
- public void testResponce() throws Exception
- {
- final List<NodeInfo> nodesPath = new ArrayList<NodeInfo>();
- //start from 1 thread
- int threadCount = initialSize;
-
- Random random = new Random();
-
- while (true)
- {
-
- final List<WorkerResult> responceResults = Collections.synchronizedList(new ArrayList<WorkerResult>());
-
- ExecutorService threadPool = Executors.newFixedThreadPool(threadCount);
- CountDownLatch startSignal = new CountDownLatch(1);
- AbstractTestAgent[] testAgents = new AbstractTestAgent[threadCount];
- //pool initialization
- for (int i = 0; i < threadCount; i++)
- {
- testAgents[i] = getAgent(nodesPath, responceResults, startSignal, readValue, random);
- threadPool.execute(testAgents[i]);
-
- }
- responceResults.clear();
- startSignal.countDown();//let all threads proceed
-
- Thread.sleep(iterationTime);
-
- threadPool.shutdown();
- for (int i = 0; i < testAgents.length; i++)
- {
- testAgents[i].setShouldStop(true);
- }
- //wait 10 minutes
- threadPool.awaitTermination(60 * 10, TimeUnit.SECONDS);
- dumpResults(responceResults, threadCount);
- threadCount += iterationGrowingPoll;
- }
- }
-
- /**
- * Create new agent
- * @param nodesPath
- * @param responceResults
- * @param startSignal
- * @param READ_VALUE
- * @param random
- * @return
- */
- protected abstract AbstractTestAgent getAgent(List<NodeInfo> nodesPath, List<WorkerResult> responceResults,
- CountDownLatch startSignal, int readValue, Random random);
-
- private void dumpResults(List<WorkerResult> responceResults, int threadCount)
- {
- long sum_read = 0;
- long sum_write = 0;
- long read = 0;
- long write = 0;
- for (WorkerResult workerResult : responceResults)
- {
-
- if (workerResult.isRead())
- {
- read++;
- sum_read += workerResult.getResponceTime();
- }
- else
- {
- write++;
- sum_write += workerResult.getResponceTime();
- }
- }
- if ((read + write) > 0)
- {
- System.out.println(" ThreadCount= " + threadCount + " Read=" + read + " Write=" + write + " value "
- + (read * 100 / (read + write)) + " Avg read resp=" + (read > 0 ? (sum_read / read) : 0)
- + " Avg write resp=" + (write > 0 ? (sum_write / write) : 0));
- }
- responceResults.clear();
- }
-}
Copied: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractAvgResponseTimeTest.java (from rev 1827, jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractAvgResponceTimeTest.java)
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractAvgResponseTimeTest.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractAvgResponseTimeTest.java 2010-02-18 13:25:20 UTC (rev 1898)
@@ -0,0 +1,331 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.cluster.load;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey Kabashnyuk</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
+ *
+ */
+public abstract class AbstractAvgResponseTimeTest
+{
+
+ private final int iterationGrowingPoll;
+
+ private final int iterationTime;
+
+ private final int initialSize;
+
+ private final int readValue;
+
+ private final DecimalFormat df = new DecimalFormat("#####.##");
+
+ /**
+ * @param iterationGrowingPoll
+ * @param iterationTime
+ * @param initialSize
+ */
+ public AbstractAvgResponseTimeTest(int iterationGrowingPoll, int iterationTime, int initialSize, int readValue)
+ {
+ super();
+ this.iterationGrowingPoll = iterationGrowingPoll;
+ this.iterationTime = iterationTime;
+ this.initialSize = initialSize;
+ this.readValue = readValue;
+ }
+
+ public void testResponce() throws Exception
+ {
+ final List<NodeInfo> nodesPath = new LinkedList<NodeInfo>();
+ //start from 1 thread
+ int threadCount = initialSize;
+
+ Random random = new Random();
+
+ while (true)
+ {
+ //test init
+ setUp();
+
+ final List<WorkerResult> responceResults = new LinkedList<WorkerResult>();
+
+ ExecutorService threadPool = Executors.newFixedThreadPool(threadCount);
+ CountDownLatch startSignal = new CountDownLatch(1);
+ AbstractTestAgent[] testAgents = new AbstractTestAgent[threadCount];
+
+ //pool initialization
+ for (int i = 0; i < threadCount; i++)
+ {
+ testAgents[i] = getAgent(nodesPath, responceResults, startSignal, readValue, random);
+ //init agent
+ testAgents[i].prepare();
+ threadPool.execute(testAgents[i]);
+
+ }
+ responceResults.clear();
+ startSignal.countDown();//let all threads proceed
+
+ Thread.sleep(iterationTime);
+
+ threadPool.shutdown();
+ for (int i = 0; i < testAgents.length; i++)
+ {
+ testAgents[i].setShouldStop(true);
+ }
+ //wait 10 minutes
+ threadPool.awaitTermination(60 * 10, TimeUnit.SECONDS);
+ dumpResults(responceResults, threadCount, iterationTime);
+ threadCount += iterationGrowingPoll;
+ tearDown();
+ }
+ }
+
+ /**
+ * Made some actions before iteration run
+ * @throws Exception
+ */
+ protected void setUp() throws Exception
+ {
+
+ }
+
+ /**
+ * Made some actions after iteration finished
+ * @throws Exception
+ */
+ protected void tearDown() throws Exception
+ {
+
+ }
+
+ /**
+ * Create new agent
+ * @param nodesPath
+ * @param responceResults
+ * @param startSignal
+ * @param READ_VALUE
+ * @param random
+ * @return
+ */
+ protected abstract AbstractTestAgent getAgent(List<NodeInfo> nodesPath, List<WorkerResult> responceResults,
+ CountDownLatch startSignal, int readValue, Random random);
+
+ private void dumpResults(List<WorkerResult> responceResults, int threadCount, int iterationTime)
+ {
+
+ List<Double> readResult = new ArrayList<Double>();
+ List<Double> writeResult = new ArrayList<Double>();
+
+ for (WorkerResult workerResult : responceResults)
+ {
+ if (workerResult == null)
+ {
+ continue;
+ }
+ if (workerResult.isRead())
+ {
+ // read++;
+ // sum_read += workerResult.getResponceTime();
+ readResult.add(new Double(workerResult.getResponceTime()));
+ }
+ else
+ {
+ writeResult.add(new Double(workerResult.getResponceTime()));
+ }
+ }
+ ResultInfo readResultInfo = new ResultInfo(readResult);
+ readResultInfo.calculate();
+
+ ResultInfo writeResultInfo = new ResultInfo(writeResult);
+ writeResultInfo.calculate();
+
+ StringBuffer result = new StringBuffer();
+ result.append("ThreadCount= ").append(threadCount);
+ result.append(" TPS = ").append(
+ Math.round(((readResultInfo.getResultCount() + writeResultInfo.getResultCount()) * 1000) / iterationTime));
+ result.append(" Total read= ").append(df.format(readResultInfo.getResultCount()));
+ result.append(" Max= ").append(df.format(readResultInfo.getMaxValue()));
+ result.append(" Min= ").append(df.format(readResultInfo.getMinValue()));
+ result.append(" Avg= ").append(df.format(readResultInfo.getAvgValue()));
+ result.append(" StdDev= ").append(df.format(readResultInfo.getStdDevValue()));
+ result.append(" Total write= ").append(writeResultInfo.getResultCount());
+ result.append(" Max= ").append(df.format(writeResultInfo.getMaxValue()));
+ result.append(" Min= ").append(df.format(writeResultInfo.getMinValue()));
+ result.append(" Avg= ").append(df.format(writeResultInfo.getAvgValue()));
+ result.append(" StdDev= ").append(df.format(writeResultInfo.getStdDevValue()));
+
+ System.out.println(result.toString());
+ // long sum_read = 0;
+ // long sum_write = 0;
+ // long read = 0;
+ // long write = 0;
+ // for (WorkerResult workerResult : responceResults)
+ // {
+ // if (workerResult == null)
+ // {
+ // continue;
+ // }
+ // if (workerResult.isRead())
+ // {
+ // read++;
+ // sum_read += workerResult.getResponceTime();
+ // }
+ // else
+ // {
+ // write++;
+ // sum_write += workerResult.getResponceTime();
+ // }
+ // }
+ // if ((read + write) > 0)
+ // {
+ // StringBuffer result = new StringBuffer();
+ // result.append("ThreadCount= ").append(threadCount);
+ // result.append(" TPS = ").append(Math.round(((read + write) * 1000) / iterationTime));
+ // if (read > 0)
+ // {
+ // result.append(" Total read = ").append(read);
+ //
+ // result.append(" Avg read response = ").append((sum_read / read));
+ // }
+ // if (write > 0)
+ // {
+ // result.append(" Total write = ").append(write);
+ //
+ // result.append(" Avg write response = ").append((sum_write / write));
+ // }
+ //
+ // System.out.println(result.toString());
+ // }
+ responceResults.clear();
+ }
+
+ public class ResultInfo
+ {
+ private double maxValue;
+
+ private double minValue;
+
+ private double avgValue;
+
+ private double stdDevValue;
+
+ private List<Double> data;
+
+ /**
+ * @param data
+ */
+ public ResultInfo(List<Double> data)
+ {
+ super();
+ this.data = data;
+ }
+
+ private void calculate()
+ {
+ final int n = data.size();
+ if (n < 2)
+ {
+ this.stdDevValue = Double.NaN;
+ this.avgValue = data.get(0);
+ this.maxValue = data.get(0);
+ this.minValue = data.get(0);
+ }
+ else
+ {
+ this.avgValue = data.get(0);
+ this.maxValue = data.get(0);
+ this.minValue = data.get(0);
+ double sum = 0;
+ for (int i = 1; i < data.size(); i++)
+ {
+ Double currValue = data.get(i);
+ if (currValue > maxValue)
+ {
+ maxValue = currValue;
+ }
+ if (currValue < minValue)
+ {
+ minValue = currValue;
+ }
+ double newavg = avgValue + (currValue - avgValue) / (i + 1);
+ sum += (currValue - avgValue) * (currValue - newavg);
+ this.avgValue = newavg;
+ }
+ // Change to ( n - 1 ) to n if you have complete data instead of a sample.
+ this.stdDevValue = Math.sqrt(sum / (n - 1));
+ }
+ }
+
+ /**
+ * @return the stdDevValue
+ */
+ public double getStdDevValue()
+ {
+ return stdDevValue;
+ }
+
+ /**
+ * @return the maxValue
+ */
+ public double getMaxValue()
+ {
+ return maxValue;
+ }
+
+ /**
+ * @return the minValue
+ */
+ public double getMinValue()
+ {
+ return minValue;
+ }
+
+ /**
+ * @return the avgValue
+ */
+ public double getAvgValue()
+ {
+ return avgValue;
+ }
+
+ /**
+ * @return the data
+ */
+ public List<Double> getData()
+ {
+ return data;
+ }
+
+ public long getResultCount()
+ {
+ return data.size();
+ }
+
+ }
+}
Property changes on: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractAvgResponseTimeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractTestAgent.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractTestAgent.java 2010-02-18 13:23:36 UTC (rev 1897)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/AbstractTestAgent.java 2010-02-18 13:25:20 UTC (rev 1898)
@@ -59,15 +59,23 @@
* Do read
* @return
*/
- public abstract List<WorkerResult> doRead(List<NodeInfo> nodesPath);
+ public abstract void doRead(List<NodeInfo> nodesPath, List<WorkerResult> responseResults);
/**
* Do write
* @return
*/
- public abstract List<WorkerResult> doWrite(List<NodeInfo> nodesPath);
+ public abstract void doWrite(List<NodeInfo> nodesPath, List<WorkerResult> responseResults);
/**
+ * Prepare agent
+ */
+ protected void prepare()
+ {
+
+ }
+
+ /**
* @see java.lang.Runnable#run()
*/
public void run()
@@ -75,16 +83,17 @@
try
{
startSignal.await();
+
while (!shouldStop)
{
- if (random.nextInt(100) > readValue)
+ if (nodesPath.size() < 10 || random.nextInt(100) > readValue)
{
- responceResults.addAll(doWrite(nodesPath));
+ doWrite(nodesPath, responceResults);
}
else
{
- responceResults.addAll(doRead(nodesPath));
+ doRead(nodesPath, responceResults);
}
}
}
Deleted: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponceTimeTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponceTimeTest.java 2010-02-18 13:23:36 UTC (rev 1897)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponceTimeTest.java 2010-02-18 13:25:20 UTC (rev 1898)
@@ -1,344 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.cluster.load.query;
-
-import org.exoplatform.services.jcr.JcrImplBaseTest;
-import org.exoplatform.services.jcr.cluster.load.AbstractAvgResponceTimeTest;
-import org.exoplatform.services.jcr.cluster.load.AbstractTestAgent;
-import org.exoplatform.services.jcr.cluster.load.NodeInfo;
-import org.exoplatform.services.jcr.cluster.load.WorkerResult;
-import org.exoplatform.services.jcr.core.CredentialsImpl;
-import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
-import org.jboss.cache.CacheException;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-import java.util.UUID;
-import java.util.concurrent.CountDownLatch;
-
-import javax.jcr.AccessDeniedException;
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.ItemExistsException;
-import javax.jcr.LoginException;
-import javax.jcr.NoSuchWorkspaceException;
-import javax.jcr.Node;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.lock.LockException;
-import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.query.Query;
-import javax.jcr.query.QueryResult;
-import javax.jcr.version.VersionException;
-
-/**
- * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey Kabashnyuk</a>
- * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
- *
- */
-public class JcrQueryAvgResponceTimeTest extends JcrImplBaseTest
-{
-
- /**
- * 2min default time of work of one iteration.
- */
- private static final int ITERATION_TIME = 60 * 1000;
-
- /**
- * How much thread will be added on the next iteration.
- */
- private static final int ITERATION_GROWING_POLL = 15;
-
- /**
- * Number between 0 and 100 show % how many read operations.
- */
- private static final int READ_VALUE = 90;
-
- private static final String[] words =
- new String[]{"private", "branch", "final", "string", "logging", "bottle", "property", "node", "repository",
- "exception", "cycle", "value", "index", "meaning", "strange", "words", "hello", "outline", "finest",
- "basetest", "writer"};
-
- public static final String FIELDNAME_COUNT = "count";
-
- public static final String FIELDNAME_CONTENT = "Content";
-
- public static final String FIELDNAME_STATISTIC = "Statistic";
-
- private static final String TEST_ROOT = "JcrQueryAvgResponceTimeTest";
-
- public void testname() throws Exception
- {
- QueryAvgResponceTimeTest test =
- new QueryAvgResponceTimeTest(repository, ITERATION_GROWING_POLL, ITERATION_TIME, 5, READ_VALUE);
- test.testResponce();
-
- }
-
- private class QueryAvgResponceTimeTest extends AbstractAvgResponceTimeTest
- {
-
- private final RepositoryImpl repository;
-
- /**
- * @param iterationGrowingPoll
- * @param iterationTime
- * @param initialSize
- * @param readValue
- */
- public QueryAvgResponceTimeTest(RepositoryImpl repository, int iterationGrowingPoll, int iterationTime,
- int initialSize, int readValue)
- {
- super(iterationGrowingPoll, iterationTime, initialSize, readValue);
- this.repository = repository;
- }
-
- /**
- * @see org.exoplatform.services.jcr.cluster.load.AbstractAvgResponceTimeTest#getAgent(java.util.List, java.util.List, java.util.concurrent.CountDownLatch, int, java.util.Random)
- */
- @Override
- protected AbstractTestAgent getAgent(List<NodeInfo> nodesPath, List<WorkerResult> responceResults,
- CountDownLatch startSignal, int readValue, Random random)
- {
- return new QueryTestAgent(repository, nodesPath, responceResults, startSignal, readValue, random);
- }
-
- }
-
- private class QueryTestAgent extends AbstractTestAgent
- {
- private final RepositoryImpl repository;
-
- private UUID threadUUID;
-
- /**
- * @param repository
- * @param nodesPath
- * @param responceResults
- * @param startSignal
- * @param READ_VALUE
- * @param random
- */
- public QueryTestAgent(RepositoryImpl repository, List<NodeInfo> nodesPath, List<WorkerResult> responceResults,
- CountDownLatch startSignal, int readValue, Random random)
- {
- super(nodesPath, responceResults, startSignal, readValue, random);
- this.threadUUID = UUID.randomUUID();
- this.repository = repository;
- initRoot();
- }
-
- /**
- * @param repository
- * @throws LoginException
- * @throws NoSuchWorkspaceException
- * @throws RepositoryException
- * @throws ItemExistsException
- * @throws PathNotFoundException
- * @throws VersionException
- * @throws ConstraintViolationException
- * @throws LockException
- * @throws AccessDeniedException
- * @throws InvalidItemStateException
- * @throws NoSuchNodeTypeException
- */
- private void initRoot()
- {
- int maxAttempts = 10;
- CredentialsImpl credentials = new CredentialsImpl("admin", "admin".toCharArray());
- for (int i = 0; i < maxAttempts; i++)
- {
- boolean isSuccessful = false;
- Session sessionLocal = null;
- try
- {
-
- sessionLocal = repository.login(credentials, "ws");
- // prepare nodes
- Node wsRoot = sessionLocal.getRootNode();
- Node threadNode = getOrCreateNode(getOrCreateNode(TEST_ROOT, wsRoot), threadUUID);
- sessionLocal.save();
- sessionLocal.logout();
- sessionLocal = null;
- isSuccessful = true;
- }
- catch (CacheException e)
- {
- log.error("error on creating root attempt " + i + " from " + maxAttempts);
- //ignore
- }
- catch (RepositoryException e)
- {
- log.error("error on creating root attempt " + i + " from " + maxAttempts);
- }
- finally
- {
- if (sessionLocal != null)
- {
- try
- {
- sessionLocal.refresh(false);
- sessionLocal.logout();
- }
- catch (RepositoryException e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- if (isSuccessful)
- {
- break;
- }
- }
-
- }
-
- /**
- * @see org.exoplatform.services.jcr.cluster.load.AbstractTestAgent#doRead(java.util.List)
- */
- @Override
- public List<WorkerResult> doRead(List<NodeInfo> nodesPath)
- {
- List<WorkerResult> result = new ArrayList<WorkerResult>();
- Session sessionLocal = null;
- try
- {
- // login
- CredentialsImpl credentials = new CredentialsImpl("admin", "admin".toCharArray());
-
- sessionLocal = repository.login(credentials, "ws");
- Node testRoot = sessionLocal.getRootNode().getNode(TEST_ROOT);
- // prepare nodes
- int i = random.nextInt(words.length);
- String word = words[i];
- Query q =
- sessionLocal.getWorkspace().getQueryManager().createQuery(
- "SELECT * FROM nt:base WHERE " + FIELDNAME_CONTENT + "='" + word + "' AND jcr:path LIKE '"
- + testRoot.getPath() + "/%'", Query.SQL);
- long start = System.currentTimeMillis();
- QueryResult res = q.execute();
- long sqlsize = res.getNodes().getSize();
- result.add(new WorkerResult(true, System.currentTimeMillis() - start));
- //log.info(word + " found:" + sqlsize + " time=" + (System.currentTimeMillis() - start));
-
- }
- catch (Exception e)
- {
- log.error(e);
- }
- finally
- {
- if (sessionLocal != null)
- {
- sessionLocal.logout();
- sessionLocal = null;
- }
- }
- return result;
- }
-
- /**
- * @see org.exoplatform.services.jcr.cluster.load.AbstractTestAgent#doWrite(java.util.List)
- */
- @Override
- public List<WorkerResult> doWrite(List<NodeInfo> nodesPath)
- {
- List<WorkerResult> result = new ArrayList<WorkerResult>();
- // get any word
- int i = random.nextInt(words.length);
- String word = words[i];
-
- Session sessionLocal = null;
- try
- {
- CredentialsImpl credentials = new CredentialsImpl("admin", "admin".toCharArray());
- sessionLocal = repository.login(credentials, "ws");
- long start = System.currentTimeMillis();
- Node threadNode = getOrCreateNode(getOrCreateNode(TEST_ROOT, sessionLocal.getRootNode()), threadUUID);
- addCountent(threadNode, UUID.randomUUID(), word);
- sessionLocal.save();
- result.add(new WorkerResult(false, System.currentTimeMillis() - start));
- //log.info(word + " time : " + (System.currentTimeMillis() - start));
- }
- catch (Exception e1)
- {
- if (sessionLocal != null)
- {
- // discard session changes
- try
- {
- sessionLocal.refresh(false);
- }
- catch (RepositoryException e)
- {
- log.error("An error occurs", e);
- }
- }
- log.error("An error occurs", e1);
- }
- finally
- {
- if (sessionLocal != null)
- {
- sessionLocal.logout();
- sessionLocal = null;
- }
- }
- return result;
- }
-
- private void addCountent(Node testRoot, UUID nodePath, String content) throws RepositoryException
- {
- Node l5 = getOrCreateNode(testRoot, nodePath);
- l5.setProperty(FIELDNAME_CONTENT, content);
- }
-
- private Node getOrCreateNode(Node testRoot, UUID nodePath) throws RepositoryException
- {
- String uuidPath = nodePath.toString();
- Node l1 = getOrCreateNode(uuidPath.substring(0, 8), testRoot);
- Node l2 = getOrCreateNode(uuidPath.substring(9, 13), l1);
- Node l3 = getOrCreateNode(uuidPath.substring(14, 18), l2);
- Node l4 = getOrCreateNode(uuidPath.substring(19, 23), l3);
- return getOrCreateNode(uuidPath.substring(24), l4);
-
- }
-
- /**
- * Gets or creates node
- *
- * @param name
- * @param parent
- * @return
- * @throws RepositoryException
- */
- private Node getOrCreateNode(String name, Node parent) throws RepositoryException
- {
- if (parent.hasNode(name))
- {
- return parent.getNode(name);
- }
- return parent.addNode(name);
- }
- }
-}
Copied: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponseTimeTest.java (from rev 1827, jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponceTimeTest.java)
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponseTimeTest.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponseTimeTest.java 2010-02-18 13:25:20 UTC (rev 1898)
@@ -0,0 +1,339 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.cluster.load.query;
+
+import org.exoplatform.services.jcr.JcrImplBaseTest;
+import org.exoplatform.services.jcr.cluster.load.AbstractAvgResponseTimeTest;
+import org.exoplatform.services.jcr.cluster.load.AbstractTestAgent;
+import org.exoplatform.services.jcr.cluster.load.NodeInfo;
+import org.exoplatform.services.jcr.cluster.load.WorkerResult;
+import org.exoplatform.services.jcr.core.CredentialsImpl;
+import org.exoplatform.services.jcr.impl.core.RepositoryImpl;
+import org.jboss.cache.CacheException;
+
+import java.util.List;
+import java.util.Random;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.LoginException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.query.Query;
+import javax.jcr.query.QueryResult;
+import javax.jcr.version.VersionException;
+
+/**
+ * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey Kabashnyuk</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
+ *
+ */
+public class JcrQueryAvgResponseTimeTest extends JcrImplBaseTest
+{
+
+ /**
+ * 2min default time of work of one iteration.
+ */
+ private static final int ITERATION_TIME = 60 * 1000;
+
+ /**
+ * How much thread will be added on the next iteration.
+ */
+ private static final int ITERATION_GROWING_POLL = 15;
+
+ /**
+ * Number between 0 and 100 show % how many read operations.
+ */
+ private static final int READ_VALUE = 90;
+
+ private static final String[] words =
+ new String[]{"private", "branch", "final", "string", "logging", "bottle", "property", "node", "repository",
+ "exception", "cycle", "value", "index", "meaning", "strange", "words", "hello", "outline", "finest",
+ "basetest", "writer"};
+
+ public static final String FIELDNAME_COUNT = "count";
+
+ public static final String FIELDNAME_CONTENT = "Content";
+
+ public static final String FIELDNAME_STATISTIC = "Statistic";
+
+ private static final String TEST_ROOT = "JcrQueryAvgResponceTimeTest";
+
+ public void testname() throws Exception
+ {
+ QueryAvgResponceTimeTest test =
+ new QueryAvgResponceTimeTest(repository, ITERATION_GROWING_POLL, ITERATION_TIME, 5, READ_VALUE);
+ test.testResponce();
+
+ }
+
+ private class QueryAvgResponceTimeTest extends AbstractAvgResponseTimeTest
+ {
+
+ private final RepositoryImpl repository;
+
+ /**
+ * @param iterationGrowingPoll
+ * @param iterationTime
+ * @param initialSize
+ * @param readValue
+ */
+ public QueryAvgResponceTimeTest(RepositoryImpl repository, int iterationGrowingPoll, int iterationTime,
+ int initialSize, int readValue)
+ {
+ super(iterationGrowingPoll, iterationTime, initialSize, readValue);
+ this.repository = repository;
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.cluster.load.AbstractAvgResponseTimeTest#getAgent(java.util.List, java.util.List, java.util.concurrent.CountDownLatch, int, java.util.Random)
+ */
+ @Override
+ protected AbstractTestAgent getAgent(List<NodeInfo> nodesPath, List<WorkerResult> responceResults,
+ CountDownLatch startSignal, int readValue, Random random)
+ {
+ return new QueryTestAgent(repository, nodesPath, responceResults, startSignal, readValue, random);
+ }
+
+ }
+
+ private class QueryTestAgent extends AbstractTestAgent
+ {
+ private final RepositoryImpl repository;
+
+ private UUID threadUUID;
+
+ /**
+ * @param repository
+ * @param nodesPath
+ * @param responceResults
+ * @param startSignal
+ * @param READ_VALUE
+ * @param random
+ */
+ public QueryTestAgent(RepositoryImpl repository, List<NodeInfo> nodesPath, List<WorkerResult> responceResults,
+ CountDownLatch startSignal, int readValue, Random random)
+ {
+ super(nodesPath, responceResults, startSignal, readValue, random);
+ this.threadUUID = UUID.randomUUID();
+ this.repository = repository;
+ initRoot();
+ }
+
+ /**
+ * @param repository
+ * @throws LoginException
+ * @throws NoSuchWorkspaceException
+ * @throws RepositoryException
+ * @throws ItemExistsException
+ * @throws PathNotFoundException
+ * @throws VersionException
+ * @throws ConstraintViolationException
+ * @throws LockException
+ * @throws AccessDeniedException
+ * @throws InvalidItemStateException
+ * @throws NoSuchNodeTypeException
+ */
+ private void initRoot()
+ {
+ int maxAttempts = 10;
+ CredentialsImpl credentials = new CredentialsImpl("admin", "admin".toCharArray());
+ for (int i = 0; i < maxAttempts; i++)
+ {
+ boolean isSuccessful = false;
+ Session sessionLocal = null;
+ try
+ {
+
+ sessionLocal = repository.login(credentials, "ws");
+ // prepare nodes
+ Node wsRoot = sessionLocal.getRootNode();
+ Node threadNode = getOrCreateNode(getOrCreateNode(TEST_ROOT, wsRoot), threadUUID);
+ sessionLocal.save();
+ sessionLocal.logout();
+ sessionLocal = null;
+ isSuccessful = true;
+ }
+ catch (CacheException e)
+ {
+ log.error("error on creating root attempt " + i + " from " + maxAttempts);
+ //ignore
+ }
+ catch (RepositoryException e)
+ {
+ log.error("error on creating root attempt " + i + " from " + maxAttempts);
+ }
+ finally
+ {
+ if (sessionLocal != null)
+ {
+ try
+ {
+ sessionLocal.refresh(false);
+ sessionLocal.logout();
+ }
+ catch (RepositoryException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ if (isSuccessful)
+ {
+ break;
+ }
+ }
+
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.cluster.load.AbstractTestAgent#doRead(java.util.List)
+ */
+ @Override
+ public void doRead(List<NodeInfo> nodesPath, List<WorkerResult> responseResults)
+ {
+ Session sessionLocal = null;
+ try
+ {
+ // login
+ CredentialsImpl credentials = new CredentialsImpl("admin", "admin".toCharArray());
+
+ sessionLocal = repository.login(credentials, "ws");
+ Node testRoot = sessionLocal.getRootNode().getNode(TEST_ROOT);
+ // prepare nodes
+ int i = random.nextInt(words.length);
+ String word = words[i];
+ Query q =
+ sessionLocal.getWorkspace().getQueryManager().createQuery(
+ "SELECT * FROM nt:base WHERE " + FIELDNAME_CONTENT + "='" + word + "' AND jcr:path LIKE '"
+ + testRoot.getPath() + "/%'", Query.SQL);
+ long start = System.currentTimeMillis();
+ QueryResult res = q.execute();
+ long sqlsize = res.getNodes().getSize();
+ responseResults.add(new WorkerResult(true, System.currentTimeMillis() - start));
+ //log.info(word + " found:" + sqlsize + " time=" + (System.currentTimeMillis() - start));
+
+ }
+ catch (Exception e)
+ {
+ log.error(e);
+ }
+ finally
+ {
+ if (sessionLocal != null)
+ {
+ sessionLocal.logout();
+ sessionLocal = null;
+ }
+ }
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.cluster.load.AbstractTestAgent#doWrite(java.util.List)
+ */
+ @Override
+ public void doWrite(List<NodeInfo> nodesPath, List<WorkerResult> responseResults)
+ {
+ // get any word
+ int i = random.nextInt(words.length);
+ String word = words[i];
+
+ Session sessionLocal = null;
+ try
+ {
+ CredentialsImpl credentials = new CredentialsImpl("admin", "admin".toCharArray());
+ sessionLocal = repository.login(credentials, "ws");
+ long start = System.currentTimeMillis();
+ Node threadNode = getOrCreateNode(getOrCreateNode(TEST_ROOT, sessionLocal.getRootNode()), threadUUID);
+ addCountent(threadNode, UUID.randomUUID(), word);
+ sessionLocal.save();
+ responseResults.add(new WorkerResult(false, System.currentTimeMillis() - start));
+ //log.info(word + " time : " + (System.currentTimeMillis() - start));
+ }
+ catch (Exception e1)
+ {
+ if (sessionLocal != null)
+ {
+ // discard session changes
+ try
+ {
+ sessionLocal.refresh(false);
+ }
+ catch (RepositoryException e)
+ {
+ log.error("An error occurs", e);
+ }
+ }
+ log.error("An error occurs", e1);
+ }
+ finally
+ {
+ if (sessionLocal != null)
+ {
+ sessionLocal.logout();
+ sessionLocal = null;
+ }
+ }
+ }
+
+ private void addCountent(Node testRoot, UUID nodePath, String content) throws RepositoryException
+ {
+ Node l5 = getOrCreateNode(testRoot, nodePath);
+ l5.setProperty(FIELDNAME_CONTENT, content);
+ }
+
+ private Node getOrCreateNode(Node testRoot, UUID nodePath) throws RepositoryException
+ {
+ String uuidPath = nodePath.toString();
+ Node l1 = getOrCreateNode(uuidPath.substring(0, 8), testRoot);
+ Node l2 = getOrCreateNode(uuidPath.substring(9, 13), l1);
+ Node l3 = getOrCreateNode(uuidPath.substring(14, 18), l2);
+ Node l4 = getOrCreateNode(uuidPath.substring(19, 23), l3);
+ return getOrCreateNode(uuidPath.substring(24), l4);
+
+ }
+
+ /**
+ * Gets or creates node
+ *
+ * @param name
+ * @param parent
+ * @return
+ * @throws RepositoryException
+ */
+ private Node getOrCreateNode(String name, Node parent) throws RepositoryException
+ {
+ if (parent.hasNode(name))
+ {
+ return parent.getNode(name);
+ }
+ return parent.addNode(name);
+ }
+ }
+}
Property changes on: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/query/JcrQueryAvgResponseTimeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavAvgResponceTimeTest.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavAvgResponceTimeTest.java 2010-02-18 13:23:36 UTC (rev 1897)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavAvgResponceTimeTest.java 2010-02-18 13:25:20 UTC (rev 1898)
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.services.jcr.cluster.load.webdav;
-
-import junit.framework.TestCase;
-
-import org.exoplatform.services.jcr.cluster.load.AbstractAvgResponceTimeTest;
-import org.exoplatform.services.jcr.cluster.load.AbstractTestAgent;
-import org.exoplatform.services.jcr.cluster.load.NodeInfo;
-import org.exoplatform.services.jcr.cluster.load.WorkerResult;
-
-import java.util.List;
-import java.util.Random;
-import java.util.concurrent.CountDownLatch;
-
-/**
- * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey Kabashnyuk</a>
- * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
- *
- */
-public class WebDavAvgResponceTimeTest extends TestCase
-{
-
- /**
- * 2min default time of work of one iteration.
- */
- private static final int ITERATION_TIME = 60 * 1000;
-
- /**
- * How much thread will be added on the next iteration.
- */
- private static final int ITERATION_GROWING_POLL = 5;
-
- /**
- * Number between 0 and 100 show % how many read operations.
- */
- private static final int READ_VALUE = 90;
-
- public void testWebDav() throws Exception
- {
- WebDavTest test = new WebDavTest(ITERATION_GROWING_POLL, ITERATION_TIME, 1, READ_VALUE);
- test.testResponce();
- }
-
- private class WebDavTest extends AbstractAvgResponceTimeTest
- {
- /**
- * @param iterationGrowingPoll
- * @param iterationTime
- * @param initialSize
- * @param readValue
- */
- public WebDavTest(int iterationGrowingPoll, int iterationTime, int initialSize, int readValue)
- {
- super(iterationGrowingPoll, iterationTime, initialSize, readValue);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @see org.exoplatform.services.jcr.cluster.load.AbstractAvgResponceTimeTest#getAgent(java.util.List, java.util.List, java.util.concurrent.CountDownLatch, int, java.util.Random)
- */
- @Override
- protected AbstractTestAgent getAgent(List<NodeInfo> nodesPath, List<WorkerResult> responceResults,
- CountDownLatch startSignal, int readValue, Random random)
- {
- return new WebDavTestAgent(nodesPath, responceResults, startSignal, readValue, random);
- }
-
- }
-}
Copied: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavAvgResponseTimeTest.java (from rev 1827, jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavAvgResponceTimeTest.java)
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavAvgResponseTimeTest.java (rev 0)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavAvgResponseTimeTest.java 2010-02-18 13:25:20 UTC (rev 1898)
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.jcr.cluster.load.webdav;
+
+import junit.framework.TestCase;
+
+import org.exoplatform.services.jcr.cluster.load.AbstractAvgResponseTimeTest;
+import org.exoplatform.services.jcr.cluster.load.AbstractTestAgent;
+import org.exoplatform.services.jcr.cluster.load.NodeInfo;
+import org.exoplatform.services.jcr.cluster.load.WorkerResult;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+
+/**
+ * @author <a href="mailto:Sergey.Kabashnyuk@exoplatform.org">Sergey Kabashnyuk</a>
+ * @version $Id: exo-jboss-codetemplates.xml 34360 2009-07-22 23:58:59Z ksm $
+ *
+ */
+public class WebDavAvgResponseTimeTest extends TestCase
+{
+
+ /**
+ * 2min default time of work of one iteration.
+ */
+ private static final int ITERATION_TIME = 60 * 1000;
+
+ /**
+ * How much thread will be added on the next iteration.
+ */
+ private static final int ITERATION_GROWING_POLL = 10;
+
+ /**
+ * Number between 0 and 100 show % how many read operations.
+ */
+ private static final int READ_VALUE = 90;
+
+ private static final String TEST_ROOT = "WebDavAvgResponseTimeTestRoot";
+
+ public void testWebDav() throws Exception
+ {
+ WebDavTest test = new WebDavTest(ITERATION_GROWING_POLL, ITERATION_TIME, 10, READ_VALUE);
+ test.testResponce();
+ }
+
+ private class WebDavTest extends AbstractAvgResponseTimeTest
+ {
+ private String iterationRoot;
+
+ private int counter;
+
+ /**
+ * @param iterationGrowingPoll
+ * @param iterationTime
+ * @param initialSize
+ * @param readValue
+ */
+ public WebDavTest(int iterationGrowingPoll, int iterationTime, int initialSize, int readValue)
+ {
+ super(iterationGrowingPoll, iterationTime, initialSize, readValue);
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.cluster.load.AbstractAvgResponseTimeTest#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception
+ {
+ // TODO Auto-generated method stub
+ super.setUp();
+ WebDavTestAgent setUpAgent = new WebDavTestAgent(null, null, null, null, 0, null);
+
+ String testRoot = setUpAgent.createDirIfAbsent("", TEST_ROOT, new ArrayList<WorkerResult>());
+ iterationRoot =
+ setUpAgent.createDirIfAbsent(testRoot, UUID.randomUUID().toString(), new ArrayList<WorkerResult>());
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.cluster.load.AbstractAvgResponseTimeTest#tearDown()
+ */
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+
+ }
+
+ /**
+ * @see org.exoplatform.services.jcr.cluster.load.AbstractAvgResponseTimeTest#getAgent(java.util.List, java.util.List, java.util.concurrent.CountDownLatch, int, java.util.Random)
+ */
+ @Override
+ protected AbstractTestAgent getAgent(List<NodeInfo> nodesPath, List<WorkerResult> responceResults,
+ CountDownLatch startSignal, int readValue, Random random)
+ {
+ return new WebDavTestAgent(iterationRoot, nodesPath, responceResults, startSignal, readValue, random);
+ }
+
+ }
+}
Property changes on: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavAvgResponseTimeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavTestAgent.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavTestAgent.java 2010-02-18 13:23:36 UTC (rev 1897)
+++ jcr/trunk/exo.jcr.component.core/src/test/java/org/exoplatform/services/jcr/cluster/load/webdav/WebDavTestAgent.java 2010-02-18 13:25:20 UTC (rev 1898)
@@ -18,6 +18,7 @@
*/
package org.exoplatform.services.jcr.cluster.load.webdav;
+import org.exoplatform.common.http.HTTPStatus;
import org.exoplatform.common.http.client.HTTPResponse;
import org.exoplatform.services.jcr.cluster.JCRWebdavConnection;
import org.exoplatform.services.jcr.cluster.load.NodeInfo;
@@ -26,6 +27,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
+import java.util.UUID;
import java.util.concurrent.CountDownLatch;
/**
@@ -36,12 +38,8 @@
public class WebDavTestAgent extends AbstractWebDavTestAgent
{
- private volatile static long l1FolderCount = 0;
+ private String testRoot;
- private String l1FolderName;
-
- private long l2FolderCount;
-
/**
* @param nodesPath
* @param responceResults
@@ -49,19 +47,20 @@
* @param READ_VALUE
* @param random
*/
- public WebDavTestAgent(List<NodeInfo> nodesPath, List<WorkerResult> responceResults, CountDownLatch startSignal,
- int READ_VALUE, Random random)
+ public WebDavTestAgent(String testRoot, List<NodeInfo> nodesPath, List<WorkerResult> responceResults,
+ CountDownLatch startSignal, int READ_VALUE, Random random)
{
super(nodesPath, responceResults, startSignal, READ_VALUE, random);
+ this.testRoot = testRoot;
}
/**
* @see org.exoplatform.services.jcr.cluster.load.AbstractTestAgent#doRead(java.util.List)
*/
@Override
- public List<WorkerResult> doRead(List<NodeInfo> nodesPath)
+ public void doRead(List<NodeInfo> nodesPath, List<WorkerResult> responseResults)
{
- List<WorkerResult> result = new ArrayList<WorkerResult>();
+ //List<WorkerResult> result = new ArrayList<WorkerResult>();
if (nodesPath.size() > 0)
{
@@ -76,14 +75,20 @@
}
long start = System.currentTimeMillis();
- JCRWebdavConnection conn = getNewConnection();
+ JCRWebdavConnection conn = null;
try
{
+ conn = getNewConnection();
HTTPResponse response = conn.getNode(readNodePath);
- if (response.getStatusCode() != 200)
+ if (response.getStatusCode() == HTTPStatus.OK)
{
+ responseResults.add(new WorkerResult(true, System.currentTimeMillis() - start));
+ }
+ else
+ {
System.out.println("Can not get (response code " + response.getStatusCode()
+ new String(response.getData()) + " ) node with path : " + readNodePath);
+
}
}
@@ -93,47 +98,52 @@
}
finally
{
- conn.stop();
+ if (conn != null)
+ {
+ conn.stop();
+ }
}
- result.add(new WorkerResult(true, System.currentTimeMillis() - start));
-
}
- return result;
}
/**
+ * @see org.exoplatform.services.jcr.cluster.load.AbstractTestAgent#prepare()
+ */
+ @Override
+ protected void prepare()
+ {
+ testRoot = createDirIfAbsent(testRoot, UUID.randomUUID().toString(), new ArrayList<WorkerResult>());
+ }
+
+ /**
* @see org.exoplatform.services.jcr.cluster.load.AbstractTestAgent#doWrite(java.util.List)
*/
@Override
- public List<WorkerResult> doWrite(List<NodeInfo> nodesPath)
+ public void doWrite(List<NodeInfo> nodesPath, List<WorkerResult> responseResults)
{
- List<WorkerResult> result = new ArrayList<WorkerResult>();
- long start = 0;
+
JCRWebdavConnection connection = null;
try
{
connection = getNewConnection();
+ String putFile =
+ createDirIfAbsent(testRoot, UUID.randomUUID().toString(), new ArrayList<WorkerResult>()) + "/file";
+ long start = System.currentTimeMillis();
+ HTTPResponse response = connection.addNode(putFile, ("__the_data_in_nt+file__").getBytes());
- if (l1FolderName == null || l2FolderCount == 100)
+ if (response.getStatusCode() == HTTPStatus.CREATED)
{
- l1FolderName = "folder" + (l1FolderCount++);
- start = System.currentTimeMillis();
- connection.addDir(l1FolderName);
- l2FolderCount = 0;
- result.add(new WorkerResult(false, System.currentTimeMillis() - start));
+ responseResults.add(new WorkerResult(false, System.currentTimeMillis() - start));
+ nodesPath.add(new NodeInfo(putFile, System.currentTimeMillis()));
}
- String path = l1FolderName + "/" + "node" + l2FolderCount++;
- start = System.currentTimeMillis();
- HTTPResponse response = connection.addNode(path, ("__the_data_in_nt+file__" + l2FolderCount).getBytes());
-
- if (response.getStatusCode() != 201)
+ else
{
System.out.println(Thread.currentThread().getName() + " : Can not add (response code "
- + response.getStatusCode() + new String(response.getData()) + " ) node with path : " + path);
+ + response.getStatusCode() + new String(response.getData()) + " ) file with path : " + putFile);
+
}
- result.add(new WorkerResult(false, System.currentTimeMillis() - start));
- nodesPath.add(new NodeInfo(path, System.currentTimeMillis()));
+
}
catch (Exception e)
{
@@ -146,6 +156,74 @@
connection.stop();
}
}
- return result;
}
+
+ /**
+ * Create WebDav node if not exist
+ * @param root
+ * @param name
+ * @param data
+ * @return
+ */
+ public String createDirIfAbsent(String root, String name, List<WorkerResult> result)
+ {
+ String path = root.length() == 0 ? name : root + "/" + name;
+ JCRWebdavConnection connection = null;
+ try
+ {
+ connection = getNewConnection();
+
+ long start = System.currentTimeMillis();
+ HTTPResponse nodeResponce = connection.getNode(path);
+ //add information about read
+ result.add(new WorkerResult(true, System.currentTimeMillis() - start));
+ if (nodeResponce.getStatusCode() != HTTPStatus.OK)
+ {
+ start = System.currentTimeMillis();
+ HTTPResponse addResponce = connection.addDir(path);
+ //add information about write
+
+ if (addResponce.getStatusCode() == HTTPStatus.CREATED)
+ {
+ result.add(new WorkerResult(false, System.currentTimeMillis() - start));
+ }
+ else
+ {
+ System.out.println(Thread.currentThread().getName() + " : Can not add (response code "
+ + addResponce.getStatusCode() + new String(addResponce.getData()) + " ) node with path : " + path);
+
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ System.out.println(e.getLocalizedMessage());
+ }
+ finally
+ {
+ if (connection != null)
+ {
+ connection.stop();
+ }
+ }
+ return path;
+ }
+
+ /**
+ * Create WebDav node if not exist
+ * @param root
+ * @param uuid
+ * @param data
+ * @return
+ */
+ public String createDirIfAbsent(String root, UUID uuid, List<WorkerResult> result)
+ {
+ String uuidPath = uuid.toString();
+ String l1 = createDirIfAbsent(root, uuidPath.substring(0, 8), result);
+ // String l2 = createDirIfAbsent(l1, uuidPath.substring(9, 13), result);
+ // String l3 = createDirIfAbsent(l2, uuidPath.substring(14, 18), result);
+ // String l4 = createDirIfAbsent(l3, uuidPath.substring(19, 23), result);
+ return createDirIfAbsent(l1, uuidPath.substring(9), result);
+
+ }
}
16 years, 2 months
exo-jcr SVN: r1897 - in ws/branches/2.2.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext: service and 1 other directory.
by do-not-reply@jboss.org
Author: max_shaposhnik
Date: 2010-02-18 08:23:36 -0500 (Thu, 18 Feb 2010)
New Revision: 1897
Added:
ws/branches/2.2.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/
ws/branches/2.2.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesList.java
ws/branches/2.2.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesListApplication.java
Log:
EXOJCR-525 Get all bindig path of REST services on server
Added: ws/branches/2.2.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesList.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesList.java (rev 0)
+++ ws/branches/2.2.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesList.java 2010-02-18 13:23:36 UTC (rev 1897)
@@ -0,0 +1,201 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.rest.ext.service;
+
+import org.exoplatform.services.rest.ObjectFactory;
+import org.exoplatform.services.rest.impl.ResourceBinder;
+import org.exoplatform.services.rest.resource.AbstractResourceDescriptor;
+
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @author <a href="mailto:andrey.parfonov@exoplatform.com">Andrey Parfonov</a>
+ * @version $Id$
+ */
+@Path("/")
+// NOTE : Class do not implement org.exoplatform.services.rest.resource.ResourceContainer
+// and must never be binded to RESTful framework by using eXoContainer.
+// This service must works as per-request resource.
+public class RestServicesList
+{
+
+ //
+ public static class RootResource
+ {
+ private String fqn;
+
+ private String path;
+
+ private String regex;
+
+ public RootResource(String fqn, String path, String regex)
+ {
+ this.fqn = fqn;
+ this.path = path;
+ this.regex = regex;
+ }
+
+ public String getFqn()
+ {
+ return fqn;
+ }
+
+ public String getPath()
+ {
+ return path;
+ }
+
+ public String getRegex()
+ {
+ return regex;
+ }
+ }
+
+ //
+
+ public static class RootResourcesList
+ {
+ private List<RootResource> rootResources;
+
+ public RootResourcesList(List<RootResource> rootResources)
+ {
+ this.rootResources = rootResources;
+ }
+
+ public List<RootResource> getRootResources()
+ {
+ return rootResources;
+ }
+ }
+
+ //
+
+ private final ResourceBinder binder;
+
+ public RestServicesList(ResourceBinder resources)
+ {
+ this.binder = resources;
+ }
+
+ @GET
+ @Produces({MediaType.TEXT_HTML})
+ public byte[] listHTML()
+ {
+ XMLOutputFactory factory = XMLOutputFactory.newInstance();
+ factory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ try
+ {
+ XMLStreamWriter xsw = factory.createXMLStreamWriter(output, "UTF-8");
+ xsw.writeStartDocument("UTF-8", "1.0");
+ xsw.writeDTD("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" "
+ + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
+ xsw.writeCharacters("\n");
+ xsw.writeStartElement("html");
+ xsw.writeDefaultNamespace("http://www.w3.org/1999/xhtml");
+ xsw.writeStartElement("head");
+ xsw.writeStartElement("title");
+ xsw.writeCharacters("eXo JAXRS Implementation");
+ xsw.writeEndElement(); // </title>
+ xsw.writeEndElement(); // </head>
+ xsw.writeStartElement("body");
+ //
+ xsw.writeStartElement("h3");
+ xsw.writeAttribute("style", "text-align:center;");
+ xsw.writeCharacters("Root resources");
+ xsw.writeEndElement();
+ // table
+ xsw.writeStartElement("table");
+ xsw.writeAttribute("width", "90%");
+ xsw.writeAttribute("style", "table-layout:fixed;");
+ // table header
+ xsw.writeStartElement("tr");
+ xsw.writeStartElement("th");
+ xsw.writeCharacters("Path");
+ xsw.writeEndElement(); // </th>
+ xsw.writeStartElement("th");
+ xsw.writeCharacters("Regex");
+ xsw.writeEndElement(); // </th>
+ xsw.writeStartElement("th");
+ xsw.writeCharacters("FQN");
+ xsw.writeEndElement(); // </th>
+ xsw.writeEndElement(); // </tr>
+ // end table header
+ for (RootResource r : rootResources().getRootResources())
+ {
+ xsw.writeStartElement("tr");
+ xsw.writeStartElement("td");
+ xsw.writeCharacters(r.getPath());
+ xsw.writeEndElement(); // </td>
+ xsw.writeStartElement("td");
+ xsw.writeCharacters(r.getRegex());
+ xsw.writeEndElement(); // </td>
+ xsw.writeStartElement("td");
+ xsw.writeCharacters(r.getFqn());
+ xsw.writeEndElement(); // </td>
+ xsw.writeEndElement(); // </tr>
+ }
+ xsw.writeEndElement(); // </table>
+ xsw.writeEndElement(); // </body>
+ xsw.writeEndDocument();
+ }
+ catch (XMLStreamException xmle)
+ {
+ throw new WebApplicationException(xmle, //
+ Response.status(500) //
+ .entity("Unable write to output stream. " + xmle.getMessage()) //
+ .type(MediaType.TEXT_PLAIN) //
+ .build());
+ }
+ return output.toByteArray();
+ }
+
+ @GET
+ @Produces({MediaType.APPLICATION_JSON})
+ public RootResourcesList listJSON()
+ {
+ return rootResources();
+ }
+
+ protected RootResourcesList rootResources()
+ {
+ List<RootResource> resources = new ArrayList<RootResource>();
+ for (ObjectFactory<AbstractResourceDescriptor> om : binder.getResources())
+ {
+ AbstractResourceDescriptor descriptor = om.getObjectModel();
+ resources.add(new RootResource(descriptor.getObjectClass().getName(), //
+ descriptor.getPathValue().getPath(), //
+ descriptor.getUriPattern().getRegex()));
+ }
+ return new RootResourcesList(resources);
+ }
+
+}
Property changes on: ws/branches/2.2.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesList.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: ws/branches/2.2.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesListApplication.java
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesListApplication.java (rev 0)
+++ ws/branches/2.2.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesListApplication.java 2010-02-18 13:23:36 UTC (rev 1897)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.rest.ext.service;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.core.Application;
+
+/**
+ * @author <a href="mailto:andrey.parfonov@exoplatform.com">Andrey Parfonov</a>
+ * @version $Id$
+ */
+public class RestServicesListApplication extends Application
+{
+
+ @Override
+ public Set<Class<?>> getClasses()
+ {
+ Set<Class<?>> cls = new HashSet<Class<?>>();
+ cls.add(RestServicesList.class);
+ return cls;
+ }
+
+}
Property changes on: ws/branches/2.2.x/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesListApplication.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
16 years, 2 months
exo-jcr SVN: r1896 - jcr/trunk/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2010-02-18 08:23:33 -0500 (Thu, 18 Feb 2010)
New Revision: 1896
Modified:
jcr/trunk/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java
Log:
EXOJCR-510 : addDir return response
Modified: jcr/trunk/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java
===================================================================
--- jcr/trunk/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java 2010-02-18 13:22:26 UTC (rev 1895)
+++ jcr/trunk/applications/cluster.test.client/src/main/java/org/exoplatform/services/jcr/cluster/JCRWebdavConnection.java 2010-02-18 13:23:33 UTC (rev 1896)
@@ -274,9 +274,17 @@
response.getStatusCode();
}
- public void addDir(String path) throws IOException, ModuleException
+ /**
+ * Return true if create successfully
+ * @param path
+ * @throws IOException
+ * @throws ModuleException
+ */
+ public HTTPResponse addDir(String path) throws IOException, ModuleException
{
- MkCol(workspacePath + path).getStatusCode();
+ HTTPResponse mkCol = MkCol(workspacePath + path);
+ mkCol.getStatusCode();
+ return mkCol;
}
public HTTPResponse restore(String node, String version) throws IOException, ModuleException
16 years, 2 months
exo-jcr SVN: r1895 - in ws/branches/2.2.x/exo.ws.rest.ext/src/test: resources and 1 other directories.
by do-not-reply@jboss.org
Author: max_shaposhnik
Date: 2010-02-18 08:22:26 -0500 (Thu, 18 Feb 2010)
New Revision: 1895
Added:
ws/branches/2.2.x/exo.ws.rest.ext/src/test/resources/
ws/branches/2.2.x/exo.ws.rest.ext/src/test/resources/standalone/
ws/branches/2.2.x/exo.ws.rest.ext/src/test/resources/standalone/test-configuration.xml
Log:
EXOJCR-525 Get all bindig path of REST services on server tests
Added: ws/branches/2.2.x/exo.ws.rest.ext/src/test/resources/standalone/test-configuration.xml
===================================================================
--- ws/branches/2.2.x/exo.ws.rest.ext/src/test/resources/standalone/test-configuration.xml (rev 0)
+++ ws/branches/2.2.x/exo.ws.rest.ext/src/test/resources/standalone/test-configuration.xml 2010-02-18 13:22:26 UTC (rev 1895)
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+ <component>
+ <key>org.exoplatform.services.log.LogConfigurationInitializer</key>
+ <type>org.exoplatform.services.log.LogConfigurationInitializer</type>
+ <init-params>
+ <value-param>
+ <name>logger</name>
+ <value>org.slf4j.Logger</value>
+ </value-param>
+ <value-param>
+ <name>configurator</name>
+ <value>org.exoplatform.services.log.impl.Log4JConfigurator</value>
+ </value-param>
+ <properties-param>
+ <name>properties</name>
+ <description>Log4J properties</description>
+ <property name="log4j.rootLogger" value="INFO, stdout" />
+
+ <property name="log4j.appender.stdout" value="org.apache.log4j.ConsoleAppender" />
+ <property name="log4j.appender.stdout.threshold" value="DEBUG" />
+ <property name="log4j.appender.stdout.layout" value="org.apache.log4j.PatternLayout" />
+ <property name="log4j.appender.stdout.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
+ <property name="log4j.appender.file" value="org.apache.log4j.FileAppender" />
+ <property name="log4j.appender.file.File" value="target/container.log" />
+ <property name="log4j.appender.file.layout" value="org.apache.log4j.PatternLayout" />
+ <property name="log4j.appender.file.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
+
+ </properties-param>
+ </init-params>
+ </component>
+
+ <component>
+ <type>org.exoplatform.services.rest.impl.RequestHandlerImpl</type>
+ </component>
+ <component>
+ <type>org.exoplatform.services.rest.impl.RequestDispatcher</type>
+ </component>
+ <component>
+ <type>org.exoplatform.services.rest.impl.ResourceBinder</type>
+ </component>
+ <component>
+ <type>org.exoplatform.services.rest.impl.provider.JAXBContextResolver</type>
+ </component>
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.rest.impl.provider.JAXBContextResolver</target-component>
+ <component-plugin>
+ <name>ws.rs.jaxb.context</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.rest.impl.provider.JAXBContextComponentPlugin</type>
+ <init-params>
+ <!-- ======== example ======= -->
+ <value-param>
+ <name>book</name>
+ <value>org.exoplatform.services.rest.generated.Book</value>
+ </value-param>
+ <!-- ======================== -->
+ <value-param>
+ <name>wadl.application</name>
+ <value>org.exoplatform.services.rest.wadl.research.Application</value>
+ </value-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.rest.impl.RequestHandlerImpl</target-component>
+ <component-plugin>
+ <name>ws.rs.entity.provider</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.rest.impl.provider.EntityProviderComponentPlugin</type>
+ <!-- NOTE it is just example of configuration. -->
+ <!-- StringEntityProvider is part of REST framework, not needs to add it from configuration -->
+ <!--
+ <init-params>
+ <value-param>
+ <name>strings</name>
+ <value>org.exoplatform.services.rest.impl.provider.StringEntityProvider</value>
+ </value-param>
+ </init-params>
+ -->
+ </component-plugin>
+ <component-plugin>
+ <name>ws.rs.method.filter</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.rest.impl.method.MethodInvokerFilterComponentPlugin</type>
+ <!--
+ <init-params>
+ <value-param>
+ <name>name</name>
+ <value>filter class</value>
+ </value-param>
+ </init-params>
+ -->
+ </component-plugin>
+ <component-plugin>
+ <name>ws.rs.request.filter</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.rest.impl.RequestFilterComponentPlugin</type>
+ <!--
+ <init-params>
+ <value-param>
+ <name>name</name>
+ <value>filter class</value>
+ </value-param>
+ </init-params>
+ -->
+ </component-plugin>
+ <component-plugin>
+ <name>ws.rs.response.filter</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.rest.impl.ResponseFilterComponentPlugin</type>
+ <!--
+ <init-params>
+ <value-param>
+ <name>name</name>
+ <value>filter class</value>
+ </value-param>
+ </init-params>
+ -->
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
16 years, 2 months
exo-jcr SVN: r1894 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache.
by do-not-reply@jboss.org
Author: skabashnyuk
Date: 2010-02-18 08:20:19 -0500 (Thu, 18 Feb 2010)
New Revision: 1894
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java
Log:
EXOJCR-510 : add log error exception in index
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java 2010-02-18 12:58:57 UTC (rev 1893)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/jbosscache/JBossCacheIndexChangesFilter.java 2010-02-18 13:20:19 UTC (rev 1894)
@@ -22,7 +22,6 @@
import org.exoplatform.services.jcr.config.QueryHandlerEntry;
import org.exoplatform.services.jcr.config.QueryHandlerParams;
import org.exoplatform.services.jcr.config.RepositoryConfigurationException;
-import org.exoplatform.services.jcr.config.TemplateConfigurationHelper;
import org.exoplatform.services.jcr.impl.core.query.IndexerChangesFilter;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoMode;
import org.exoplatform.services.jcr.impl.core.query.IndexerIoModeHandler;
@@ -35,15 +34,12 @@
import org.exoplatform.services.log.Log;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheException;
-import org.jboss.cache.CacheFactory;
import org.jboss.cache.CacheSPI;
-import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.config.CacheLoaderConfig;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig;
import org.jboss.cache.config.CacheLoaderConfig.IndividualCacheLoaderConfig.SingletonStoreConfig;
import java.io.IOException;
-import java.io.InputStream;
import java.io.Serializable;
import java.util.Properties;
import java.util.Set;
@@ -157,6 +153,7 @@
}
catch (CacheException e)
{
+ log.error(e.getLocalizedMessage(), e);
logErrorChanges(handler, removedNodes, addedNodes);
logErrorChanges(parentHandler, parentRemovedNodes, parentAddedNodes);
}
16 years, 2 months
exo-jcr SVN: r1893 - in jcr/trunk/docs/reference/en/src/main/docbook/en-US: modules and 1 other directory.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-02-18 07:58:57 -0500 (Thu, 18 Feb 2010)
New Revision: 1893
Modified:
jcr/trunk/docs/reference/en/src/main/docbook/en-US/master.xml
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/search-configuration.xml
Log:
EXOJCR-490: search-configuration added
Modified: jcr/trunk/docs/reference/en/src/main/docbook/en-US/master.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/master.xml 2010-02-18 12:58:07 UTC (rev 1892)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/master.xml 2010-02-18 12:58:57 UTC (rev 1893)
@@ -78,5 +78,8 @@
<xi:include href="modules/external-value-storages.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="modules/search-configuration.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
</book>
Modified: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/search-configuration.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/search-configuration.xml 2010-02-18 12:58:07 UTC (rev 1892)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/search-configuration.xml 2010-02-18 12:58:57 UTC (rev 1893)
@@ -1,14 +1,774 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<chapter>
- <?dbhtml filename="search-configuration.html"?>
-
- <title>Search Configuration</title>
-
- <section>
- <title></title>
-
- <para></para>
- </section>
-</chapter>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<chapter>
+ <?dbhtml filename="search-configuration.html"?>
+
+ <title>Search Configuration</title>
+
+ <section>
+ <title>XML Configuration</title>
+
+ <para>JCR index configuration. You can find this file here:
+ <filename>.../portal/WEB-INF/conf/jcr/repository-configuration.xml</filename></para>
+
+ <programlisting><repository-service default-repository="db1">
+ <repositories>
+ <repository name="db1" system-workspace="ws" default-workspace="ws">
+ ....
+ <workspaces>
+ <workspace name="ws">
+ ....
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="${java.io.tmpdir}/temp/index/db1/ws" />
+ <property name="synonymprovider-class" value="org.exoplatform.services.jcr.impl.core.query.lucene.PropertiesSynonymProvider" />
+ <property name="synonymprovider-config-path" value="/synonyms.properties" />
+ <property name="indexing-config-path" value="/indexing-configuration.xml" />
+ <property name="query-class" value="org.exoplatform.services.jcr.impl.core.query.QueryImpl" />
+ </properties>
+ </query-handler>
+ ...
+ </workspace>
+ </workspaces>
+ </repository>
+ </repositories>
+</repository-service></programlisting>
+ </section>
+
+ <section>
+ <title>Configuration parameters</title>
+
+ <table>
+ <title></title>
+
+ <tgroup cols="4">
+ <thead>
+ <row>
+ <entry>Parameter</entry>
+
+ <entry>Default</entry>
+
+ <entry>Description</entry>
+
+ <entry>Since</entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry>index-dir</entry>
+
+ <entry>none</entry>
+
+ <entry>The location of the index directory. This parameter is
+ mandatory. Up to 1.9 this parameter called "indexDir"</entry>
+
+ <entry>1.0</entry>
+ </row>
+
+ <row>
+ <entry>use-compoundfile</entry>
+
+ <entry>true</entry>
+
+ <entry>Advises lucene to use compound files for the index
+ files.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>min-merge-docs</entry>
+
+ <entry>100</entry>
+
+ <entry>Minimum number of nodes in an index until segments are
+ merged.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>volatile-idle-time</entry>
+
+ <entry>3</entry>
+
+ <entry>Idle time in seconds until the volatile index part is moved
+ to a persistent index even though minMergeDocs is not
+ reached.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>max-merge-docs</entry>
+
+ <entry>Integer.MAX_VALUE</entry>
+
+ <entry>Maximum number of nodes in segments that will be merged.
+ The default value changed in JCR 1.9 to Integer.MAX_VALUE.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>merge-factor</entry>
+
+ <entry>10</entry>
+
+ <entry>Determines how often segment indices are merged.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>max-field-length</entry>
+
+ <entry>10000</entry>
+
+ <entry>The number of words that are fulltext indexed at most per
+ property.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>cache-size</entry>
+
+ <entry>1000</entry>
+
+ <entry>Size of the document number cache. This cache maps uuids to
+ lucene document numbers</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>force-consistencycheck</entry>
+
+ <entry>false</entry>
+
+ <entry>Runs a consistency check on every startup. If false, a
+ consistency check is only performed when the search index detects
+ a prior forced shutdown.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>auto-repair</entry>
+
+ <entry>true</entry>
+
+ <entry>Errors detected by a consistency check are automatically
+ repaired. If false, errors are only written to the log.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>query-class</entry>
+
+ <entry>QueryImpl</entry>
+
+ <entry>Class name that implements the javax.jcr.query.Query
+ interface.This class must also extend from the class:
+ org.exoplatform.services.jcr.impl.core.query.AbstractQueryImpl.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>document-order</entry>
+
+ <entry>true</entry>
+
+ <entry>If true and the query does not contain an 'order by'
+ clause, result nodes will be in document order. For better
+ performance when queries return a lot of nodes set to
+ 'false'.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>result-fetch-size</entry>
+
+ <entry>Integer.MAX_VALUE</entry>
+
+ <entry>The number of results when a query is executed. Default
+ value: Integer.MAX_VALUE (-> all).</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>excerptprovider-class</entry>
+
+ <entry>DefaultXMLExcerpt</entry>
+
+ <entry>The name of the class that implements
+ org.exoplatform.services.jcr.impl.core.query.lucene.ExcerptProvider
+ and should be used for the rep:excerpt() function in a
+ query.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>support-highlighting</entry>
+
+ <entry>false</entry>
+
+ <entry>If set to true additional information is stored in the
+ index to support highlighting using the rep:excerpt()
+ function.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>synonymprovider-class</entry>
+
+ <entry>none</entry>
+
+ <entry>The name of a class that implements
+ org.exoplatform.services.jcr.impl.core.query.lucene.SynonymProvider.
+ The default value is null (-> not set).</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>synonymprovider-config-path</entry>
+
+ <entry>none</entry>
+
+ <entry>The path to the synonym provider configuration file. This
+ path interpreted relative to the path parameter. If there is a
+ path element inside the SearchIndex element, then this path is
+ interpreted relative to the root path of the path. Whether this
+ parameter is mandatory depends on the synonym provider
+ implementation. The default value is null (-> not set).</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>indexing-configuration-path</entry>
+
+ <entry>none</entry>
+
+ <entry>The path to the indexing configuration file.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>indexing-configuration-class</entry>
+
+ <entry>IndexingConfigurationImpl</entry>
+
+ <entry>The name of the class that implements
+ org.exoplatform.services.jcr.impl.core.query.lucene.IndexingConfiguration.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>force-consistencycheck</entry>
+
+ <entry>false</entry>
+
+ <entry>If set to true a consistency check is performed depending
+ on the parameter forceConsistencyCheck. If set to false no
+ consistency check is performed on startup, even if a redo log had
+ been applied.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>spellchecker-class</entry>
+
+ <entry>none</entry>
+
+ <entry>The name of a class that implements
+ org.exoplatform.services.jcr.impl.core.query.lucene.SpellChecker.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>errorlog-size</entry>
+
+ <entry>50(Kb)</entry>
+
+ <entry>The default size of error log file in Kb.</entry>
+
+ <entry>1.9</entry>
+ </row>
+
+ <row>
+ <entry>upgrade-index</entry>
+
+ <entry>false</entry>
+
+ <entry>Allows JCR to convert an existing index into the new
+ format. Also it is possible to set this property via system
+ property, for example: -Dupgrade-index=true Indexes before JCR
+ 1.12 will not run with JCR 1.12. Hence you have to run an
+ automatic migration: Start JCR with -Dupgrade-index=true. The old
+ index format is then converted in the new index format. After the
+ conversion the new format is used. On the next start you don't
+ need this option anymore. The old index is replaced and a back
+ conversion is not possible - therefore better take a backup of the
+ index before. (Only for migrations from JCR 1.9 and
+ later.)</entry>
+
+ <entry>1.12</entry>
+ </row>
+
+ <row>
+ <entry>analyzer</entry>
+
+ <entry>org.apache.lucene.analysis.standard.StandardAnalyzer</entry>
+
+ <entry>Class name of a lucene analyzer to use for fulltext
+ indexing of text.</entry>
+
+ <entry>1.12</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+
+ <section>
+ <title>Global Search Index</title>
+
+ <section>
+ <title>Global Search Index Configuration</title>
+
+ <para>The global search index is configured in the above-mentioned
+ configuration file
+ (<filename>portal/WEB-INF/conf/jcr/repository-configuration.xml</filename>)
+ in the tag "query-handler".</para>
+
+ <programlisting><query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex"></programlisting>
+
+ <para>In fact when using Lucene you always should use the same analyzer
+ for indexing and for querying - otherwise the results are unpredictable.
+ You don't have to worry about this, eXo JCR does this for you
+ automatically. If you don't like the StandardAnalyzer configured by
+ default just replace it by your own.</para>
+
+ <para>If you don't have a handy QueryHandler you will learn how create a
+ customized Handler in 5 minutes.</para>
+ </section>
+
+ <section>
+ <title>Customized Search Indexes and Analyzers</title>
+
+ <para>By default Exo JCR uses the Lucene standard Analyzer to index
+ contents. This analyzer uses some standard filters in the method that
+ analyzes the content:<programlisting>public TokenStream tokenStream(String fieldName, Reader reader) {
+ StandardTokenizer tokenStream = new StandardTokenizer(reader, replaceInvalidAcronym);
+ tokenStream.setMaxTokenLength(maxTokenLength);
+ TokenStream result = new StandardFilter(tokenStream);
+ result = new LowerCaseFilter(result);
+ result = new StopFilter(result, stopSet);
+ return result;
+ }</programlisting><itemizedlist>
+ <listitem>
+ <para>The first one (StandardFilter) removes 's (as 's in
+ "Peter's") from the end of words and removes dots from
+ acronyms.</para>
+ </listitem>
+
+ <listitem>
+ <para>The second one (LowerCaseFilter) normalizes token text to
+ lower case.</para>
+ </listitem>
+
+ <listitem>
+ <para>The last one (StopFilter) removes stop words from a token
+ stream. The stop set is defined in the analyzer.</para>
+ </listitem>
+ </itemizedlist></para>
+
+ <para>For specific cases, you may wish to use additional filters like
+ <phrase>ISOLatin1AccentFilter</phrase>, which replaces accented
+ characters in the ISO Latin 1 character set (ISO-8859-1) by their
+ unaccented equivalents.</para>
+
+ <para>In order to use a different filter, you have to create a new
+ analyzer, and a new search index to use the analyzer. You put it in a
+ jar, which is deployed with your application.</para>
+
+ <section>
+ <title>Create the filter</title>
+
+ <para>The ISOLatin1AccentFilter is not present in the current Lucene
+ version used by Exo. You can use the attached file. You can also
+ create your own filter, the relevant method is<programlisting>public final Token next(final Token reusableToken) throws java.io.IOException</programlisting>which
+ defines how chars are read and used by the filter.</para>
+ </section>
+
+ <section>
+ <title>Create the analyzer</title>
+
+ <para>The analyzer have to extends
+ org.apache.lucene.analysis.standard.StandardAnalyzer, and overload the
+ method<programlisting>public TokenStream tokenStream(String fieldName, Reader reader)</programlisting>to
+ put your own filters. You can have a glance at the example analyzer
+ attached to this article.</para>
+ </section>
+
+ <section>
+ <title>Create the search index</title>
+
+ <para>Now, we have the analyzer, we have to write the SearchIndex,
+ which will use the analyzer. Your have to extends
+ org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex. You
+ have to write the constructor, to set the right analyzer, and the
+ method<programlisting>public Analyzer getAnalyzer() {
+ return MyAnalyzer;
+ }</programlisting>to return your analyzer. You can see the attached
+ SearchIndex.</para>
+
+ <note>
+ <para>Since 1.12 version we can set Analyzer directly in
+ configuration. So, creation new SearchIndex only for new Analyzer is
+ redundant.</para>
+ </note>
+ </section>
+
+ <section>
+ <title>Configure your application to use your SearchIndex</title>
+
+ <para>In
+ <filename>portal/WEB-INF/conf/jcr/repository-configuration.xml</filename>,
+ you have to replace each<programlisting><query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex"></programlisting>by
+ your own class<programlisting><query-handler class="mypackage.indexation.MySearchIndex"></programlisting></para>
+ </section>
+
+ <section>
+ <title>Configure your application to use your Analyzer</title>
+
+ <para>In
+ <filename>portal/WEB-INF/conf/jcr/repository-configuration.xml</filename>,
+ you have to add parameter "analyzer" to each query-handler
+ config:<programlisting><query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ ...
+ <property name="analyzer" value="org.exoplatform.services.jcr.impl.core.MyAnalyzer"/>
+ ...
+ </properties>
+</query-handler></programlisting></para>
+
+ <para>When you start exo, your SearchIndex will start to index
+ contents with the specified filters.</para>
+ </section>
+ </section>
+ </section>
+
+ <section>
+ <title>Index Adjustments</title>
+
+ <section>
+ <title>IndexingConfiguration</title>
+
+ <para>Starting with version 1.9, the default search index implementation
+ in JCR allows you to control which properties of a node are indexed. You
+ also can define different analyzers for different nodes.</para>
+
+ <para>The configuration parameter is called indexingConfiguration and
+ per default is not set. This means all properties of a node are
+ indexed.</para>
+
+ <para>If you wish to configure the indexing behavior you need to add a
+ parameter to the query-handler element in your configuration
+ file.</para>
+
+ <programlisting><param name="indexing-configuration-path" value="/indexing_configuration.xml"/></programlisting>
+ </section>
+
+ <section>
+ <title>Index rules</title>
+
+ <section>
+ <title>Node Scope Limit</title>
+
+ <para>To optimize the index size you can limit the node scope so that
+ <phrase>only certain properties</phrase> of a node type are
+ indexed.</para>
+
+ <para>With the below configuration only properties named Text are
+ indexed for nodes of type nt:unstructured. This configuration also
+ applies to all nodes whose type extends from nt:unstructured.</para>
+
+ <programlisting><?xml version="1.0"?>
+<!DOCTYPE configuration SYSTEM "http://www.exoplatform.org/dtd/indexing-configuration-1.0.dtd">
+<configuration xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
+ <index-rule nodeType="nt:unstructured">
+ <property>Text</property>
+ </index-rule>
+</configuration></programlisting>
+
+ <para>Please note that you have to declare the <phrase>namespace
+ prefixes</phrase> in the configuration element that you are using
+ throughout the XML file!</para>
+ </section>
+
+ <section>
+ <title>Index Boost Value</title>
+
+ <para>It is also possible to configure a <phrase>boost value</phrase>
+ for the nodes that match the index rule. The default boost value is
+ 1.0. Higher boost values (a reasonable range is 1.0 - 5.0) will yield
+ a higher score value and appear as more relevant.</para>
+
+ <programlisting><?xml version="1.0"?>
+<!DOCTYPE configuration SYSTEM "http://www.exoplatform.org/dtd/indexing-configuration-1.0.dtd">
+<configuration xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
+ <index-rule nodeType="nt:unstructured"
+ boost="2.0">
+ <property>Text</property>
+ </index-rule>
+</configuration></programlisting>
+
+ <para>If you do not wish to boost the complete node but only certain
+ properties you can also provide a boost value for the listed
+ properties:<programlisting><?xml version="1.0"?>
+<!DOCTYPE configuration SYSTEM "http://www.exoplatform.org/dtd/indexing-configuration-1.0.dtd">
+<configuration xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
+ <index-rule nodeType="nt:unstructured">
+ <property boost="3.0">Title</property>
+ <property boost="1.5">Text</property>
+ </index-rule>
+</configuration></programlisting></para>
+ </section>
+
+ <section>
+ <title>Conditional Index Rules</title>
+
+ <para>You may also add a <phrase>condition</phrase> to the index rule
+ and have multiple rules with the same nodeType. The first index rule
+ that matches will apply and all remaining ones are
+ ignored:<programlisting><?xml version="1.0"?>
+<!DOCTYPE configuration SYSTEM "http://www.exoplatform.org/dtd/indexing-configuration-1.0.dtd">
+<configuration xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
+ <index-rule nodeType="nt:unstructured"
+ boost="2.0"
+ condition="@priority = 'high'">
+ <property>Text</property>
+ </index-rule>
+ <index-rule nodeType="nt:unstructured">
+ <property>Text</property>
+ </index-rule>
+</configuration></programlisting></para>
+
+ <para>In the above example the first rule only applies if the
+ nt:unstructured node has a priority property with a value 'high'. The
+ condition syntax supports only the equals operator and a string
+ literal.</para>
+
+ <para>You may also reference properties in the condition that are not
+ on the current node:<programlisting><?xml version="1.0"?>
+<!DOCTYPE configuration SYSTEM "http://www.exoplatform.org/dtd/indexing-configuration-1.0.dtd">
+<configuration xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
+ <index-rule nodeType="nt:unstructured"
+ boost="2.0"
+ condition="ancestor::*/@priority = 'high'">
+ <property>Text</property>
+ </index-rule>
+ <index-rule nodeType="nt:unstructured"
+ boost="0.5"
+ condition="parent::foo/@priority = 'low'">
+ <property>Text</property>
+ </index-rule>
+ <index-rule nodeType="nt:unstructured"
+ boost="1.5"
+ condition="bar/@priority = 'medium'">
+ <property>Text</property>
+ </index-rule>
+ <index-rule nodeType="nt:unstructured">
+ <property>Text</property>
+ </index-rule>
+</configuration></programlisting></para>
+
+ <para>The indexing configuration also allows you to specify the type
+ of a node in the condition. Please note however that the type match
+ must be exact. It does not consider sub types of the specified node
+ type.</para>
+
+ <programlisting><?xml version="1.0"?>
+<!DOCTYPE configuration SYSTEM "http://www.exoplatform.org/dtd/indexing-configuration-1.0.dtd">
+<configuration xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
+ <index-rule nodeType="nt:unstructured"
+ boost="2.0"
+ condition="element(*, nt:unstructured)/@priority = 'high'">
+ <property>Text</property>
+ </index-rule>
+</configuration></programlisting>
+ </section>
+
+ <section>
+ <title>Exclusion from the Node Scope Index</title>
+
+ <para>Per default all configured properties are fulltext indexed if
+ they are of type STRING and included in the node scope index. A node
+ scope search finds normally all nodes of an index. That is, the select
+ jcr:contains(., 'foo') returns all nodes that have a string property
+ containing the word 'foo'. You can exclude explicitly a property from
+ the node scope index:<programlisting><?xml version="1.0"?>
+<!DOCTYPE configuration SYSTEM "http://www.exoplatform.org/dtd/indexing-configuration-1.0.dtd">
+<configuration xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
+ <index-rule nodeType="nt:unstructured">
+ <property nodeScopeIndex="false">Text</property>
+ </index-rule>
+</configuration></programlisting></para>
+ </section>
+ </section>
+
+ <section>
+ <title>Index Aggregates</title>
+
+ <para>Sometimes it is useful to include the contents of descendant nodes
+ into a single node to easier search on content that is scattered across
+ multiple nodes.</para>
+
+ <para>JCR allows you to define index aggregates based on relative path
+ patterns and primary node types.</para>
+
+ <para>The following example creates an index aggregate on nt:file that
+ includes the content of the jcr:content node:<programlisting><?xml version="1.0"?>
+<!DOCTYPE configuration SYSTEM "http://www.exoplatform.org/dtd/indexing-configuration-1.0.dtd">
+<configuration xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
+ <aggregate primaryType="nt:file">
+ <include>jcr:content</include>
+ </aggregate>
+</configuration></programlisting></para>
+
+ <para>You can also restrict the included nodes to a certain
+ type:<programlisting><?xml version="1.0"?>
+<!DOCTYPE configuration SYSTEM "http://www.exoplatform.org/dtd/indexing-configuration-1.0.dtd">
+<configuration xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
+ <aggregate primaryType="nt:file">
+ <include primaryType="nt:resource">jcr:content</include>
+ </aggregate>
+</configuration></programlisting></para>
+
+ <para>You may also use the * to match all child nodes:<programlisting><?xml version="1.0"?>
+<!DOCTYPE configuration SYSTEM "http://www.exoplatform.org/dtd/indexing-configuration-1.0.dtd">
+<configuration xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
+ <aggregate primaryType="nt:file">http://wiki.exoplatform.com/xwiki/bin/edit/JCR/Search+Configuration
+ <include primaryType="nt:resource">*</include>
+ </aggregate>
+</configuration></programlisting></para>
+
+ <para>If you wish to include nodes up to a certain depth below the
+ current node you can add multiple include elements. E.g. the nt:file
+ node may contain a complete XML document under
+ jcr:content:<programlisting><?xml version="1.0"?>
+<!DOCTYPE configuration SYSTEM "http://www.exoplatform.org/dtd/indexing-configuration-1.0.dtd">
+<configuration xmlns:jcr="http://www.jcp.org/jcr/1.0"
+ xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
+ <aggregate primaryType="nt:file">
+ <include>*</include>
+ <include>*/*</include>
+ <include>*/*/*</include>
+ </aggregate>
+</configuration></programlisting></para>
+ </section>
+
+ <section>
+ <title>Property-Level Analyzers</title>
+
+ <section>
+ <title>Example</title>
+
+ <para>In this configuration section you define how a property has to
+ be analyzed. If there is an analyzer configuration for a property,
+ this analyzer is used for indexing and searching of this property. For
+ example:<programlisting><?xml version="1.0"?>
+<!DOCTYPE configuration SYSTEM "http://www.exoplatform.org/dtd/indexing-configuration-1.0.dtd">
+<configuration xmlns:nt="http://www.jcp.org/jcr/nt/1.0">
+ <analyzers>
+ <analyzer class="org.apache.lucene.analysis.KeywordAnalyzer">
+ <property>mytext</property>
+ </analyzer>
+ <analyzer class="org.apache.lucene.analysis.WhitespaceAnalyzer">
+ <property>mytext2</property>
+ </analyzer>
+ </analyzers>
+</configuration></programlisting></para>
+
+ <para>The configuration above means that the property "mytext" for the
+ entire workspace is indexed (and searched) with the Lucene
+ KeywordAnalyzer, and property "mytext2" with the WhitespaceAnalyzer.
+ Using different analyzers for different languages is particularly
+ useful.</para>
+
+ <para>The WhitespaceAnalyzer tokenizes a property, the KeywordAnalyzer
+ takes the property as a whole.</para>
+ </section>
+
+ <section>
+ <title>Characteristics of Node Scope Searches</title>
+
+ <para>When using analyzers, you may encounter an unexpected behavior
+ when searching within a property compared to searching within a node
+ scope. The reason is that the node scope always uses the global
+ analyzer.</para>
+
+ <para>Let's suppose that the property "mytext" contains the text :
+ "testing my analyzers" and that you haven't configured any analyzers
+ for the property "mytext" (and not changed the default analyzer in
+ SearchIndex).</para>
+
+ <para>If your query is for example:<programlisting>xpath = "//*[jcr:contains(mytext,'analyzer')]"</programlisting></para>
+
+ <para>This xpath does not return a hit in the node with the property
+ above and default analyzers.</para>
+
+ <para>Also a search on the node scope<programlisting>xpath = "//*[jcr:contains(.,'analyzer')]"</programlisting>won't
+ give a hit. Realize, that you can only set specific analyzers on a
+ node property, and that the node scope indexing/analyzing is always
+ done with the globally defined analyzer in the SearchIndex
+ element.</para>
+
+ <para>Now, if you change the analyzer used to index the "mytext"
+ property above to<programlisting><analyzer class="org.apache.lucene.analysis.Analyzer.GermanAnalyzer">
+ <property>mytext</property>
+</analyzer></programlisting>and you do the same search again, then
+ for<programlisting>xpath = "//*[jcr:contains(mytext,'analyzer')]"</programlisting>you
+ would get a hit because of the word stemming (analyzers -
+ analyzer).</para>
+
+ <para>The other search,<programlisting>xpath = "//*[jcr:contains(.,'analyzer')]"</programlisting>still
+ would not give a result, since the node scope is indexed with the
+ global analyzer, which in this case does not take into account any
+ word stemming.</para>
+
+ <para>In conclusion, be aware that when using analyzers for specific
+ properties, you might find a hit in a property for some search text,
+ and you do not find a hit with the same search text in the node scope
+ of the property!</para>
+
+ <note>
+ <para>Both index rules and index aggregates influence how content is
+ indexed in JCR. If you change the configuration the existing content
+ is not automatically re-indexed according to the new rules. You
+ therefore have to manually re-index the content when you change the
+ configuration!</para>
+ </note>
+ </section>
+ </section>
+ </section>
+</chapter>
16 years, 2 months
exo-jcr SVN: r1892 - in ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext: service and 1 other directory.
by do-not-reply@jboss.org
Author: max_shaposhnik
Date: 2010-02-18 07:58:07 -0500 (Thu, 18 Feb 2010)
New Revision: 1892
Added:
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesList.java
ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesListApplication.java
Log:
EXOJCR-525 Get all bindig path of REST services on server tests
Added: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesList.java
===================================================================
--- ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesList.java (rev 0)
+++ ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesList.java 2010-02-18 12:58:07 UTC (rev 1892)
@@ -0,0 +1,201 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.rest.ext.service;
+
+import org.exoplatform.services.rest.ObjectFactory;
+import org.exoplatform.services.rest.impl.ResourceBinder;
+import org.exoplatform.services.rest.resource.AbstractResourceDescriptor;
+
+import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @author <a href="mailto:andrey.parfonov@exoplatform.com">Andrey Parfonov</a>
+ * @version $Id$
+ */
+@Path("/")
+// NOTE : Class do not implement org.exoplatform.services.rest.resource.ResourceContainer
+// and must never be binded to RESTful framework by using eXoContainer.
+// This service must works as per-request resource.
+public class RestServicesList
+{
+
+ //
+ public static class RootResource
+ {
+ private String fqn;
+
+ private String path;
+
+ private String regex;
+
+ public RootResource(String fqn, String path, String regex)
+ {
+ this.fqn = fqn;
+ this.path = path;
+ this.regex = regex;
+ }
+
+ public String getFqn()
+ {
+ return fqn;
+ }
+
+ public String getPath()
+ {
+ return path;
+ }
+
+ public String getRegex()
+ {
+ return regex;
+ }
+ }
+
+ //
+
+ public static class RootResourcesList
+ {
+ private List<RootResource> rootResources;
+
+ public RootResourcesList(List<RootResource> rootResources)
+ {
+ this.rootResources = rootResources;
+ }
+
+ public List<RootResource> getRootResources()
+ {
+ return rootResources;
+ }
+ }
+
+ //
+
+ private final ResourceBinder binder;
+
+ public RestServicesList(ResourceBinder resources)
+ {
+ this.binder = resources;
+ }
+
+ @GET
+ @Produces({MediaType.TEXT_HTML})
+ public byte[] listHTML()
+ {
+ XMLOutputFactory factory = XMLOutputFactory.newInstance();
+ factory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ try
+ {
+ XMLStreamWriter xsw = factory.createXMLStreamWriter(output, "UTF-8");
+ xsw.writeStartDocument("UTF-8", "1.0");
+ xsw.writeDTD("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" "
+ + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
+ xsw.writeCharacters("\n");
+ xsw.writeStartElement("html");
+ xsw.writeDefaultNamespace("http://www.w3.org/1999/xhtml");
+ xsw.writeStartElement("head");
+ xsw.writeStartElement("title");
+ xsw.writeCharacters("eXo JAXRS Implementation");
+ xsw.writeEndElement(); // </title>
+ xsw.writeEndElement(); // </head>
+ xsw.writeStartElement("body");
+ //
+ xsw.writeStartElement("h3");
+ xsw.writeAttribute("style", "text-align:center;");
+ xsw.writeCharacters("Root resources");
+ xsw.writeEndElement();
+ // table
+ xsw.writeStartElement("table");
+ xsw.writeAttribute("width", "90%");
+ xsw.writeAttribute("style", "table-layout:fixed;");
+ // table header
+ xsw.writeStartElement("tr");
+ xsw.writeStartElement("th");
+ xsw.writeCharacters("Path");
+ xsw.writeEndElement(); // </th>
+ xsw.writeStartElement("th");
+ xsw.writeCharacters("Regex");
+ xsw.writeEndElement(); // </th>
+ xsw.writeStartElement("th");
+ xsw.writeCharacters("FQN");
+ xsw.writeEndElement(); // </th>
+ xsw.writeEndElement(); // </tr>
+ // end table header
+ for (RootResource r : rootResources().getRootResources())
+ {
+ xsw.writeStartElement("tr");
+ xsw.writeStartElement("td");
+ xsw.writeCharacters(r.getPath());
+ xsw.writeEndElement(); // </td>
+ xsw.writeStartElement("td");
+ xsw.writeCharacters(r.getRegex());
+ xsw.writeEndElement(); // </td>
+ xsw.writeStartElement("td");
+ xsw.writeCharacters(r.getFqn());
+ xsw.writeEndElement(); // </td>
+ xsw.writeEndElement(); // </tr>
+ }
+ xsw.writeEndElement(); // </table>
+ xsw.writeEndElement(); // </body>
+ xsw.writeEndDocument();
+ }
+ catch (XMLStreamException xmle)
+ {
+ throw new WebApplicationException(xmle, //
+ Response.status(500) //
+ .entity("Unable write to output stream. " + xmle.getMessage()) //
+ .type(MediaType.TEXT_PLAIN) //
+ .build());
+ }
+ return output.toByteArray();
+ }
+
+ @GET
+ @Produces({MediaType.APPLICATION_JSON})
+ public RootResourcesList listJSON()
+ {
+ return rootResources();
+ }
+
+ protected RootResourcesList rootResources()
+ {
+ List<RootResource> resources = new ArrayList<RootResource>();
+ for (ObjectFactory<AbstractResourceDescriptor> om : binder.getResources())
+ {
+ AbstractResourceDescriptor descriptor = om.getObjectModel();
+ resources.add(new RootResource(descriptor.getObjectClass().getName(), //
+ descriptor.getPathValue().getPath(), //
+ descriptor.getUriPattern().getRegex()));
+ }
+ return new RootResourcesList(resources);
+ }
+
+}
Property changes on: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesList.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesListApplication.java
===================================================================
--- ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesListApplication.java (rev 0)
+++ ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesListApplication.java 2010-02-18 12:58:07 UTC (rev 1892)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.services.rest.ext.service;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.core.Application;
+
+/**
+ * @author <a href="mailto:andrey.parfonov@exoplatform.com">Andrey Parfonov</a>
+ * @version $Id$
+ */
+public class RestServicesListApplication extends Application
+{
+
+ @Override
+ public Set<Class<?>> getClasses()
+ {
+ Set<Class<?>> cls = new HashSet<Class<?>>();
+ cls.add(RestServicesList.class);
+ return cls;
+ }
+
+}
Property changes on: ws/trunk/exo.ws.rest.ext/src/main/java/org/exoplatform/services/rest/ext/service/RestServicesListApplication.java
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
16 years, 2 months
exo-jcr SVN: r1891 - in ws/trunk/exo.ws.rest.ext/src/test: resources and 1 other directories.
by do-not-reply@jboss.org
Author: max_shaposhnik
Date: 2010-02-18 07:57:42 -0500 (Thu, 18 Feb 2010)
New Revision: 1891
Added:
ws/trunk/exo.ws.rest.ext/src/test/resources/
ws/trunk/exo.ws.rest.ext/src/test/resources/standalone/
ws/trunk/exo.ws.rest.ext/src/test/resources/standalone/test-configuration.xml
Log:
EXOJCR-525 Get all bindig path of REST services on server tests
Added: ws/trunk/exo.ws.rest.ext/src/test/resources/standalone/test-configuration.xml
===================================================================
--- ws/trunk/exo.ws.rest.ext/src/test/resources/standalone/test-configuration.xml (rev 0)
+++ ws/trunk/exo.ws.rest.ext/src/test/resources/standalone/test-configuration.xml 2010-02-18 12:57:42 UTC (rev 1891)
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+ Copyright (C) 2009 eXo Platform SAS.
+
+ This is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of
+ the License, or (at your option) any later version.
+
+ This software is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this software; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+
+-->
+<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd http://www.exoplaform.org/xml/ns/kernel_1_0.xsd"
+ xmlns="http://www.exoplaform.org/xml/ns/kernel_1_0.xsd">
+ <component>
+ <key>org.exoplatform.services.log.LogConfigurationInitializer</key>
+ <type>org.exoplatform.services.log.LogConfigurationInitializer</type>
+ <init-params>
+ <value-param>
+ <name>logger</name>
+ <value>org.slf4j.Logger</value>
+ </value-param>
+ <value-param>
+ <name>configurator</name>
+ <value>org.exoplatform.services.log.impl.Log4JConfigurator</value>
+ </value-param>
+ <properties-param>
+ <name>properties</name>
+ <description>Log4J properties</description>
+ <property name="log4j.rootLogger" value="INFO, stdout" />
+
+ <property name="log4j.appender.stdout" value="org.apache.log4j.ConsoleAppender" />
+ <property name="log4j.appender.stdout.threshold" value="DEBUG" />
+ <property name="log4j.appender.stdout.layout" value="org.apache.log4j.PatternLayout" />
+ <property name="log4j.appender.stdout.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
+ <property name="log4j.appender.file" value="org.apache.log4j.FileAppender" />
+ <property name="log4j.appender.file.File" value="target/container.log" />
+ <property name="log4j.appender.file.layout" value="org.apache.log4j.PatternLayout" />
+ <property name="log4j.appender.file.layout.ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* [%t] %c{1}: %m (%F, line %L) %n" />
+
+ </properties-param>
+ </init-params>
+ </component>
+
+ <component>
+ <type>org.exoplatform.services.rest.impl.RequestHandlerImpl</type>
+ </component>
+ <component>
+ <type>org.exoplatform.services.rest.impl.RequestDispatcher</type>
+ </component>
+ <component>
+ <type>org.exoplatform.services.rest.impl.ResourceBinder</type>
+ </component>
+ <component>
+ <type>org.exoplatform.services.rest.impl.provider.JAXBContextResolver</type>
+ </component>
+
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.rest.impl.provider.JAXBContextResolver</target-component>
+ <component-plugin>
+ <name>ws.rs.jaxb.context</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.rest.impl.provider.JAXBContextComponentPlugin</type>
+ <init-params>
+ <!-- ======== example ======= -->
+ <value-param>
+ <name>book</name>
+ <value>org.exoplatform.services.rest.generated.Book</value>
+ </value-param>
+ <!-- ======================== -->
+ <value-param>
+ <name>wadl.application</name>
+ <value>org.exoplatform.services.rest.wadl.research.Application</value>
+ </value-param>
+ </init-params>
+ </component-plugin>
+ </external-component-plugins>
+ <external-component-plugins>
+ <target-component>org.exoplatform.services.rest.impl.RequestHandlerImpl</target-component>
+ <component-plugin>
+ <name>ws.rs.entity.provider</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.rest.impl.provider.EntityProviderComponentPlugin</type>
+ <!-- NOTE it is just example of configuration. -->
+ <!-- StringEntityProvider is part of REST framework, not needs to add it from configuration -->
+ <!--
+ <init-params>
+ <value-param>
+ <name>strings</name>
+ <value>org.exoplatform.services.rest.impl.provider.StringEntityProvider</value>
+ </value-param>
+ </init-params>
+ -->
+ </component-plugin>
+ <component-plugin>
+ <name>ws.rs.method.filter</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.rest.impl.method.MethodInvokerFilterComponentPlugin</type>
+ <!--
+ <init-params>
+ <value-param>
+ <name>name</name>
+ <value>filter class</value>
+ </value-param>
+ </init-params>
+ -->
+ </component-plugin>
+ <component-plugin>
+ <name>ws.rs.request.filter</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.rest.impl.RequestFilterComponentPlugin</type>
+ <!--
+ <init-params>
+ <value-param>
+ <name>name</name>
+ <value>filter class</value>
+ </value-param>
+ </init-params>
+ -->
+ </component-plugin>
+ <component-plugin>
+ <name>ws.rs.response.filter</name>
+ <set-method>addPlugin</set-method>
+ <type>org.exoplatform.services.rest.impl.ResponseFilterComponentPlugin</type>
+ <!--
+ <init-params>
+ <value-param>
+ <name>name</name>
+ <value>filter class</value>
+ </value-param>
+ </init-params>
+ -->
+ </component-plugin>
+ </external-component-plugins>
+</configuration>
16 years, 2 months
exo-jcr SVN: r1890 - jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-02-18 07:06:33 -0500 (Thu, 18 Feb 2010)
New Revision: 1890
Added:
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/search-configuration.xml
Modified:
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/cluster-config.xml
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/configuration.xml
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/external-value-storages.xml
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/intro.xml
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jbosscache-configuration-templates.xml
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/lock-manager-config.xml
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/query-handler-config.xml
Log:
EXOJCR-490: articles changed to chapter
Modified: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/cluster-config.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/cluster-config.xml 2010-02-18 11:45:30 UTC (rev 1889)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/cluster-config.xml 2010-02-18 12:06:33 UTC (rev 1890)
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<article>
- <articleinfo>
- <title>Configuring JBoss AS with eXo JCR in cluster</title>
- </articleinfo>
+<chapter>
+ <?dbhtml filename="cluster-config.html"?>
+ <title>Configuring JBoss AS with eXo JCR in cluster</title>
+
<section>
<title>Launching Cluster</title>
@@ -182,7 +182,7 @@
<programlisting><value-storages>
<value-storage id="system" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
<properties>
- <property name="path" value="/mnt/tornado/temp/values/production" /> - path within NFS where ValueStorage will hold it's data
+ <property name="path" value="/mnt/tornado/temp/values/production" /> <!--path within NFS where ValueStorage will hold it's data-->
</properties>
<filters>
<filter property-type="Binary" />
@@ -196,9 +196,9 @@
<programlisting><cache enabled="true" class="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.JBossCacheWorkspaceStorageCache">
<properties>
- <property name="jbosscache-configuration" value="jar:/conf/portal/test-jbosscache-data.xml" /> - path to JBoss Cache configuration for data storage
- <property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" /> - path to JGroups configuration
- <property name="jbosscache-cluster-name" value="JCR_Cluster_cache_production" /> - JBoss Cache data storage cluster name
+ <property name="jbosscache-configuration" value="jar:/conf/portal/test-jbosscache-data.xml" /> <!-- path to JBoss Cache configuration for data storage -->
+ <property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" /> <!-- path to JGroups configuration -->
+ <property name="jbosscache-cluster-name" value="JCR_Cluster_cache_production" /> <!-- JBoss Cache data storage cluster name -->
<property name="jgroups-multiplexer-stack" value="true" />
</properties>
</cache> </programlisting>
@@ -210,10 +210,10 @@
<programlisting><query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
<properties>
<property name="changesfilter-class" value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter" />
- <property name="index-dir" value="/mnt/tornado/temp/jcrlucenedb/production" /> - path within NFS where ValueStorage will hold it's data
- <property name="jbosscache-configuration" value="jar:/conf/portal/test-jbosscache-indexer.xml" /> - path to JBoss Cache configuration for indexer
- <property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" /> - path to JGroups configuration
- <property name="jbosscache-cluster-name" value="JCR_Cluster_indexer_production" /> - JBoss Cache indexer cluster name
+ <property name="index-dir" value="/mnt/tornado/temp/jcrlucenedb/production" /> <!-- path within NFS where ValueStorage will hold it's data -->
+ <property name="jbosscache-configuration" value="jar:/conf/portal/test-jbosscache-indexer.xml" /> <!-- path to JBoss Cache configuration for indexer -->
+ <property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" /> <!-- path to JGroups configuration -->
+ <property name="jbosscache-cluster-name" value="JCR_Cluster_indexer_production" /> <!-- JBoss Cache indexer cluster name -->
<property name="jgroups-multiplexer-stack" value="true" />
</properties>
</query-handler> </programlisting>
@@ -225,12 +225,12 @@
<programlisting><lock-manager class="org.exoplatform.services.jcr.impl.core.lock.jbosscache.CacheableLockManagerImpl">
<properties>
<property name="time-out" value="15m" />
- <property name="jbosscache-configuration" value="jar:/conf/portal/test-jbosscache-lock.xml" /> - path to JBoss Cache configuration for lock manager
- <property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" /> - path to JGroups configuration
+ <property name="jbosscache-configuration" value="jar:/conf/portal/test-jbosscache-lock.xml" /> <!-- path to JBoss Cache configuration for lock manager -->
+ <property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" /> <!-- path to JGroups configuration -->
<property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR_Cluster_lock_production" /> - JBoss Cache locks cluster name
+ <property name="jbosscache-cluster-name" value="JCR_Cluster_lock_production" /> <!-- JBoss Cache locks cluster name -->
- <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_production"/> - the name of the DB table where lock's data will be stored
+ <property name="jbosscache-cl-cache.jdbc.table.name" value="jcrlocks_production"/> <!-- the name of the DB table where lock's data will be stored -->
<property name="jbosscache-cl-cache.jdbc.table.create" value="true"/>
<property name="jbosscache-cl-cache.jdbc.table.drop" value="false"/>
<property name="jbosscache-cl-cache.jdbc.table.primarykey" value="jcrlocks_production_pk"/>
@@ -244,4 +244,4 @@
</itemizedlist>
</section>
</section>
-</article>
+</chapter>
Modified: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/configuration.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/configuration.xml 2010-02-18 11:45:30 UTC (rev 1889)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/configuration.xml 2010-02-18 12:06:33 UTC (rev 1890)
@@ -1,447 +1,435 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<article>
- <articleinfo>
- <title>eXo JCR configuration</title>
-
- <author>
- <firstname></firstname>
-
- <surname></surname>
-
- <affiliation>
- <orgname></orgname>
- </affiliation>
- </author>
-
- <pubdate></pubdate>
- </articleinfo>
-
- <section>
- <title>Related documents</title>
-
- <para></para>
-
- <itemizedlist>
- <listitem>
- <para>Search Configuration</para>
- </listitem>
-
- <listitem>
- <para>JDBC Data Container config</para>
- </listitem>
-
- <listitem>
- <para>External Value Storages</para>
- </listitem>
- </itemizedlist>
- </section>
-
- <section>
- <title>Portal and Standalone configuration</title>
-
- <para>Like other eXo services eXo JCR can be configured and used in portal
- or embedded mode (as a service embedded in eXo Portal) and in standalone
- mode.</para>
-
- <para>In Embedded mode, JCR services are registered in the Portal
- container and the second option is to use a Standalone container. The main
- difference between these container types is that the first one is intended
- to be used in a Portal (Web) environment, while the second one can be used
- standalone (TODO see the comprehensive page Service Configuration for
- Beginners for more details).</para>
-
- <para>The following setup procedure is used to obtain a Standalone
- configuration (TODO find more in Container configuration):</para>
-
- <itemizedlist>
- <listitem>
- <para>Configuration that is set explicitly using
- StandaloneContainer.addConfigurationURL(String url) or
- StandaloneContainer.addConfigurationPath(String path) before
- getInstance()</para>
- </listitem>
-
- <listitem>
- <para>Configuration from $base:directory/exo-configuration.xml or
- $base:directory/conf/exo-configuration.xml file. Where $base:directory
- is either AS's home directory in case of J2EE AS environment or just
- the current directory in case of a standalone application.</para>
- </listitem>
-
- <listitem>
- <para>/conf/exo-configuration.xml in the current classloader (e.g.
- war, ear archive)</para>
- </listitem>
-
- <listitem>
- <para>Configuration from
- $service_jar_file/conf/portal/configuration.xml. WARNING: do not rely
- on some concrete jar's configuration if you have more than one jar
- containing conf/portal/configuration.xml file. In this case choosing a
- configuration is unpredictable.</para>
- </listitem>
- </itemizedlist>
-
- <para>JCR service configuration looks like:</para>
-
- <programlisting><component>
- <key>org.exoplatform.services.jcr.RepositoryService</key>
- <type>org.exoplatform.services.jcr.impl.RepositoryServiceImpl</type>
- </component>
- <component>
- <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
- <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
- <init-params>
- <value-param>
- <name>conf-path</name>
- <description>JCR repositories configuration file</description>
- <value>jar:/conf/standalone/exo-jcr-config.xml</value>
- </value-param>
- <properties-param>
- <name>working-conf</name>
- <description>working-conf</description>
- <property name="source-name" value="jdbcjcr" />
- <property name="dialect" value="hsqldb" />
- <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister" />
- </properties-param>
- </init-params>
- </component></programlisting>
-
- <para>conf-path : a path to a RepositoryService JCR Configuration</para>
-
- <para>working-conf : optional; JCR configuration persister configuration.
- If there isn't a working-conf the persister will be disabled</para>
-
- <section>
- <title>JCR Configuration</title>
-
- <para>The Configuration is defined in an XML file (see DTD
- below).</para>
-
- <para>JCR Service can use multiple Repositories and each repository can
- have multiple Workspaces.</para>
-
- <para>Repositories configuration parameters support human-readable
- formats of values. They are all case-insensitive:</para>
-
- <itemizedlist>
- <listitem>
- <para>Numbers formats: K,KB - kilobytes, M,MB - megabytes, G,GB -
- gigabytes, T,TB - terabytes.</para>
-
- <para>Examples: 100.5 - digit 100.5, 200k - 200 Kbytes, 4m - 4
- Mbytes, 1.4G - 1.4 Gbytes, 10T - 10 Tbytes</para>
- </listitem>
-
- <listitem>
- <para>Time format endings: ms - milliseconds, s - seconds, m -
- minutes, h - hours, d - days, w - weeks, if no ending -
- seconds.</para>
-
- <para>Examples: 500ms - 500 milliseconds, 20 or 20s - 20 seconds,
- 30m - 30 minutes, 12h - 12 hours, 5d - 5 days, 4w - 4 weeks.</para>
- </listitem>
- </itemizedlist>
-
- <para></para>
- </section>
-
- <section id="sect_repository_service_configuration">
- <title>Repository service configuration</title>
-
- <para>Default configuration of the Repository Service located in
- jar:/conf/portal/exo-jcr-config.xml, it will be available for portal and
- standalone modes.</para>
-
- <para>In portal mode it is overriden and located in the portal web
- application portal/WEB-INF/conf/jcr/repository-configuration.xml.</para>
-
- <para>Example of Repository Service configuration for standalone
- mode:</para>
-
- <programlisting><repository-service default-repository="repository">
- <repositories>
- <repository name="db1" system-workspace="ws" default-workspace="ws">
- <security-domain>exo-domain</security-domain>
- <access-control>optional</access-control>
- <session-max-age>1h</session-max-age>
- <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
- <workspaces>
- <workspace name="production">
- <!-- for system storage -->
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr" />
- <property name="multi-db" value="false" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="../temp/swap/production" />
- </properties>
- <value-storages>
- <value-storage id="system" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="../temp/values/production" />
- </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="10k" />
- <property name="live-time" value="1h" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="../temp/jcrlucenedb/production" />
- </properties>
- </query-handler>
- <lock-manager>
- <time-out>15m</time-out>
- <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
- <properties>
- <property name="path" value="../temp/lock/system" />
- </properties>
- </persister>
- </lock-manager>
- </workspace>
-
- <workspace name="backup">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr" />
- <property name="multi-db" value="false" />
- <property name="update-storage" value="false" />
- <property name="max-buffer-size" value="200k" />
- <property name="swap-directory" value="../temp/swap/backup" />
- </properties>
- <value-storages>
- <value-storage id="draft" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="../temp/values/backup" />
- </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="10k" />
- <property name="live-time" value="1h" />
- </properties>
- </cache>
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="../temp/jcrlucenedb/backup" />
- </properties>
- </query-handler>
- </workspace>
- </workspaces>
- </repository>
- </repositories>
-</repository-service>
-</programlisting>
-
- <para>Repository Service configuration:</para>
-
- <para>default-repository - the name of a default repository (one
- returned by RepositoryService.getRepository())</para>
-
- <para>repositories - the list of repositories</para>
-
- <para>Repository configuration:</para>
-
- <para>name - the name of a repository</para>
-
- <para>default-workspace - the name of a workspace obtained using
- Session's login() or login(Credentials) methods (ones without an
- explicit workspace name)</para>
-
- <para>system-workspace - name of workspace where /jcr:system node is
- placed</para>
-
- <para>security-domain - the name of a security domain for JAAS
- authentication</para>
-
- <para>access-control - the name of an access control policy. There can
- be 3 types: optional - ACL is created on-demand(default), disable - no
- access control, mandatory - an ACL is created for each added node(not
- supported yet)</para>
-
- <para>authentication-policy - the name of an authentication policy
- class</para>
-
- <para>workspaces - the list of workspaces</para>
-
- <para>session-max-age - the time after which an idle session will be
- removed (called logout). If not set, the idle session will never be
- removed.</para>
-
- <para>Workspace configuration:</para>
-
- <para>name - the name of a workspace</para>
-
- <para>auto-init-root-nodetype - DEPRECATED in JCR 1.9 (use initializer).
- The node type for root node initialization</para>
-
- <para>container - workspace data container (physical storage)
- configuration</para>
-
- <para>initializer - workspace initializer configuration</para>
-
- <para>cache - workspace storage cache configuration</para>
-
- <para>query-handler - query handler configuration</para>
-
- <para>Workspace data container configuration:</para>
-
- <para>class - A workspace data container class name</para>
-
- <para>properties - the list of properties (name-value pairs) for the
- concrete Workspace data container</para>
-
- <para>value-storages - the list of value storage plugins</para>
-
- <para>Value Storage plugin configuration (optional feature):</para>
-
- <note>
- <para>The value-storage element is optional. If you don't include it,
- the values will be stored as BLOBs inside the database.</para>
- </note>
-
- <para>value-storage - Optional value Storage plugin definition</para>
-
- <para>class- a value storage plugin class name (attribute)</para>
-
- <para>properties - the list of properties (name-value pairs) for a
- concrete Value Storage plugin</para>
-
- <para>filters - the list of filters defining conditions when this plugin
- is applicable</para>
-
- <para>Initializer configuration (optional):</para>
-
- <para>class - initializer implementation class.</para>
-
- <para>properties - the list of properties (name-value pairs). Properties
- are supported:</para>
-
- <para>root-nodetype - The node type for root node initialization</para>
-
- <para>root-permissions - Default permissions of the root node. It is
- defined as a set of semicolon-delimited permissions containing a group
- of space-delimited identities (user, group etc, see Organization service
- documentation for details) and the type of permission. For example any
- read;:/admin read;:/admin add_node;:/admin set_property;:/admin remove
- means that users from group admin have all permissions and other users
- have only a 'read' permission.</para>
-
- <para>Configurable initializer adds a capability to override workspace
- initial startup procedure.</para>
-
- <para>Cache configuration:</para>
-
- <para>enabled - if workspace cache is enabled</para>
-
- <para>class - cache implementation class, optional from 1.9. Default
- value is
- org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl.</para>
-
- <para>Cache can be configured to use concrete implementation of
- WorkspaceStorageCache interface. JCR core has two implementation to use:
- * LinkedWorkspaceStorageCacheImpl - default, with configurable read
- behavior and statistic. * WorkspaceStorageCacheImpl - pre 1.9, still can
- be used.</para>
-
- <para>properties - the list of properties (name-value pairs) for
- Workspace cache:</para>
-
- <para>max-size - cache maximum size.</para>
-
- <para>live-time - cached item live time.</para>
-
- <para>LinkedWorkspaceStorageCacheImpl supports additional optional
- parameters TODO</para>
-
- <para>Query Handler configuration:</para>
-
- <para>class - A Query Handler class name</para>
-
- <para>properties - the list of properties (name-value pairs) for a Query
- Handler (indexDir) properties and advanced features described in *Search
- Configuration*</para>
-
- <para>Lock Manager configuration:</para>
-
- <para>time-out - time after which the unused global lock will be
- removed.</para>
-
- <para>persister - a class for storing lock information for future use.
- For example, remove lock after jcr restart.</para>
-
- <para>path - a lock folder, each workspace has its own.</para>
-
- <para></para>
-
- <para>Configuration definition:</para>
-
- <programlisting><!ELEMENT repository-service (repositories)>
- <!ATTLIST repository-service default-repository NMTOKEN #REQUIRED>
- <!ELEMENT repositories (repository)>
- <!ELEMENT repository (security-domain,access-control,session-max-age,authentication-policy,workspaces)>
- <!ATTLIST repository
- default-workspace NMTOKEN #REQUIRED
- name NMTOKEN #REQUIRED
- system-workspace NMTOKEN #REQUIRED
- >
- <!ELEMENT security-domain (#PCDATA)>
- <!ELEMENT access-control (#PCDATA)>
- <!ELEMENT session-max-age (#PCDATA)>
- <!ELEMENT authentication-policy (#PCDATA)>
- <!ELEMENT workspaces (workspace+)>
- <!ELEMENT workspace (container,initializer,cache,query-handler)>
- <!ATTLIST workspace name NMTOKEN #REQUIRED>
- <!ELEMENT container (properties,value-storages)>
- <!ATTLIST container class NMTOKEN #REQUIRED>
- <!ELEMENT value-storages (value-storage+)>
- <!ELEMENT value-storage (properties,filters)>
- <!ATTLIST value-storage class NMTOKEN #REQUIRED>
- <!ELEMENT filters (filter+)>
- <!ELEMENT filter EMPTY>
- <!ATTLIST filter property-type NMTOKEN #REQUIRED>
- <!ELEMENT initializer (properties)>
- <!ATTLIST initializer class NMTOKEN #REQUIRED>
- <!ELEMENT cache (properties)>
- <!ATTLIST cache
- enabled NMTOKEN #REQUIRED
- class NMTOKEN #REQUIRED
- >
- <!ELEMENT query-handler (properties)>
- <!ATTLIST query-handler class NMTOKEN #REQUIRED>
- <!ELEMENT access-manager (properties)>
- <!ATTLIST access-manager class NMTOKEN #REQUIRED>
- <!ELEMENT lock-manager (time-out,persister)>
- <!ELEMENT time-out (#PCDATA)>
- <!ELEMENT persister (properties)>
- <!ELEMENT properties (property+)>
- <!ELEMENT property EMPTY></programlisting>
- </section>
- </section>
-</article>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<chapter>
+ <?dbhtml filename="configuration.html"?>
+
+ <title>eXo JCR configuration</title>
+
+ <section>
+ <title>Related documents</title>
+
+ <para></para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Search Configuration</para>
+ </listitem>
+
+ <listitem>
+ <para>JDBC Data Container config</para>
+ </listitem>
+
+ <listitem>
+ <para>External Value Storages</para>
+ </listitem>
+ </itemizedlist>
+ </section>
+
+ <section>
+ <title>Portal and Standalone configuration</title>
+
+ <para>Like other eXo services eXo JCR can be configured and used in portal
+ or embedded mode (as a service embedded in eXo Portal) and in standalone
+ mode.</para>
+
+ <para>In Embedded mode, JCR services are registered in the Portal
+ container and the second option is to use a Standalone container. The main
+ difference between these container types is that the first one is intended
+ to be used in a Portal (Web) environment, while the second one can be used
+ standalone (TODO see the comprehensive page Service Configuration for
+ Beginners for more details).</para>
+
+ <para>The following setup procedure is used to obtain a Standalone
+ configuration (TODO find more in Container configuration):</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Configuration that is set explicitly using
+ StandaloneContainer.addConfigurationURL(String url) or
+ StandaloneContainer.addConfigurationPath(String path) before
+ getInstance()</para>
+ </listitem>
+
+ <listitem>
+ <para>Configuration from $base:directory/exo-configuration.xml or
+ $base:directory/conf/exo-configuration.xml file. Where $base:directory
+ is either AS's home directory in case of J2EE AS environment or just
+ the current directory in case of a standalone application.</para>
+ </listitem>
+
+ <listitem>
+ <para>/conf/exo-configuration.xml in the current classloader (e.g.
+ war, ear archive)</para>
+ </listitem>
+
+ <listitem>
+ <para>Configuration from
+ $service_jar_file/conf/portal/configuration.xml. WARNING: do not rely
+ on some concrete jar's configuration if you have more than one jar
+ containing conf/portal/configuration.xml file. In this case choosing a
+ configuration is unpredictable.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>JCR service configuration looks like:</para>
+
+ <programlisting><component>
+ <key>org.exoplatform.services.jcr.RepositoryService</key>
+ <type>org.exoplatform.services.jcr.impl.RepositoryServiceImpl</type>
+ </component>
+ <component>
+ <key>org.exoplatform.services.jcr.config.RepositoryServiceConfiguration</key>
+ <type>org.exoplatform.services.jcr.impl.config.RepositoryServiceConfigurationImpl</type>
+ <init-params>
+ <value-param>
+ <name>conf-path</name>
+ <description>JCR repositories configuration file</description>
+ <value>jar:/conf/standalone/exo-jcr-config.xml</value>
+ </value-param>
+ <properties-param>
+ <name>working-conf</name>
+ <description>working-conf</description>
+ <property name="source-name" value="jdbcjcr" />
+ <property name="dialect" value="hsqldb" />
+ <property name="persister-class-name" value="org.exoplatform.services.jcr.impl.config.JDBCConfigurationPersister" />
+ </properties-param>
+ </init-params>
+ </component></programlisting>
+
+ <para>conf-path : a path to a RepositoryService JCR Configuration</para>
+
+ <para>working-conf : optional; JCR configuration persister configuration.
+ If there isn't a working-conf the persister will be disabled</para>
+
+ <section>
+ <title>JCR Configuration</title>
+
+ <para>The Configuration is defined in an XML file (see DTD
+ below).</para>
+
+ <para>JCR Service can use multiple Repositories and each repository can
+ have multiple Workspaces.</para>
+
+ <para>Repositories configuration parameters support human-readable
+ formats of values. They are all case-insensitive:</para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Numbers formats: K,KB - kilobytes, M,MB - megabytes, G,GB -
+ gigabytes, T,TB - terabytes.</para>
+
+ <para>Examples: 100.5 - digit 100.5, 200k - 200 Kbytes, 4m - 4
+ Mbytes, 1.4G - 1.4 Gbytes, 10T - 10 Tbytes</para>
+ </listitem>
+
+ <listitem>
+ <para>Time format endings: ms - milliseconds, s - seconds, m -
+ minutes, h - hours, d - days, w - weeks, if no ending -
+ seconds.</para>
+
+ <para>Examples: 500ms - 500 milliseconds, 20 or 20s - 20 seconds,
+ 30m - 30 minutes, 12h - 12 hours, 5d - 5 days, 4w - 4 weeks.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para></para>
+ </section>
+
+ <section id="sect_repository_service_configuration">
+ <title>Repository service configuration</title>
+
+ <para>Default configuration of the Repository Service located in
+ jar:/conf/portal/exo-jcr-config.xml, it will be available for portal and
+ standalone modes.</para>
+
+ <para>In portal mode it is overriden and located in the portal web
+ application portal/WEB-INF/conf/jcr/repository-configuration.xml.</para>
+
+ <para>Example of Repository Service configuration for standalone
+ mode:</para>
+
+ <programlisting><repository-service default-repository="repository">
+ <repositories>
+ <repository name="db1" system-workspace="ws" default-workspace="ws">
+ <security-domain>exo-domain</security-domain>
+ <access-control>optional</access-control>
+ <session-max-age>1h</session-max-age>
+ <authentication-policy>org.exoplatform.services.jcr.impl.core.access.JAASAuthenticator</authentication-policy>
+ <workspaces>
+ <workspace name="production">
+ <!-- for system storage -->
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr" />
+ <property name="multi-db" value="false" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="../temp/swap/production" />
+ </properties>
+ <value-storages>
+ <value-storage id="system" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="../temp/values/production" />
+ </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="10k" />
+ <property name="live-time" value="1h" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="../temp/jcrlucenedb/production" />
+ </properties>
+ </query-handler>
+ <lock-manager>
+ <time-out>15m</time-out>
+ <persister class="org.exoplatform.services.jcr.impl.core.lock.FileSystemLockPersister">
+ <properties>
+ <property name="path" value="../temp/lock/system" />
+ </properties>
+ </persister>
+ </lock-manager>
+ </workspace>
+
+ <workspace name="backup">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr" />
+ <property name="multi-db" value="false" />
+ <property name="update-storage" value="false" />
+ <property name="max-buffer-size" value="200k" />
+ <property name="swap-directory" value="../temp/swap/backup" />
+ </properties>
+ <value-storages>
+ <value-storage id="draft" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="../temp/values/backup" />
+ </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="10k" />
+ <property name="live-time" value="1h" />
+ </properties>
+ </cache>
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="../temp/jcrlucenedb/backup" />
+ </properties>
+ </query-handler>
+ </workspace>
+ </workspaces>
+ </repository>
+ </repositories>
+</repository-service>
+</programlisting>
+
+ <para>Repository Service configuration:</para>
+
+ <para>default-repository - the name of a default repository (one
+ returned by RepositoryService.getRepository())</para>
+
+ <para>repositories - the list of repositories</para>
+
+ <para>Repository configuration:</para>
+
+ <para>name - the name of a repository</para>
+
+ <para>default-workspace - the name of a workspace obtained using
+ Session's login() or login(Credentials) methods (ones without an
+ explicit workspace name)</para>
+
+ <para>system-workspace - name of workspace where /jcr:system node is
+ placed</para>
+
+ <para>security-domain - the name of a security domain for JAAS
+ authentication</para>
+
+ <para>access-control - the name of an access control policy. There can
+ be 3 types: optional - ACL is created on-demand(default), disable - no
+ access control, mandatory - an ACL is created for each added node(not
+ supported yet)</para>
+
+ <para>authentication-policy - the name of an authentication policy
+ class</para>
+
+ <para>workspaces - the list of workspaces</para>
+
+ <para>session-max-age - the time after which an idle session will be
+ removed (called logout). If not set, the idle session will never be
+ removed.</para>
+
+ <para>Workspace configuration:</para>
+
+ <para>name - the name of a workspace</para>
+
+ <para>auto-init-root-nodetype - DEPRECATED in JCR 1.9 (use initializer).
+ The node type for root node initialization</para>
+
+ <para>container - workspace data container (physical storage)
+ configuration</para>
+
+ <para>initializer - workspace initializer configuration</para>
+
+ <para>cache - workspace storage cache configuration</para>
+
+ <para>query-handler - query handler configuration</para>
+
+ <para>Workspace data container configuration:</para>
+
+ <para>class - A workspace data container class name</para>
+
+ <para>properties - the list of properties (name-value pairs) for the
+ concrete Workspace data container</para>
+
+ <para>value-storages - the list of value storage plugins</para>
+
+ <para>Value Storage plugin configuration (optional feature):</para>
+
+ <note>
+ <para>The value-storage element is optional. If you don't include it,
+ the values will be stored as BLOBs inside the database.</para>
+ </note>
+
+ <para>value-storage - Optional value Storage plugin definition</para>
+
+ <para>class- a value storage plugin class name (attribute)</para>
+
+ <para>properties - the list of properties (name-value pairs) for a
+ concrete Value Storage plugin</para>
+
+ <para>filters - the list of filters defining conditions when this plugin
+ is applicable</para>
+
+ <para>Initializer configuration (optional):</para>
+
+ <para>class - initializer implementation class.</para>
+
+ <para>properties - the list of properties (name-value pairs). Properties
+ are supported:</para>
+
+ <para>root-nodetype - The node type for root node initialization</para>
+
+ <para>root-permissions - Default permissions of the root node. It is
+ defined as a set of semicolon-delimited permissions containing a group
+ of space-delimited identities (user, group etc, see Organization service
+ documentation for details) and the type of permission. For example any
+ read;:/admin read;:/admin add_node;:/admin set_property;:/admin remove
+ means that users from group admin have all permissions and other users
+ have only a 'read' permission.</para>
+
+ <para>Configurable initializer adds a capability to override workspace
+ initial startup procedure.</para>
+
+ <para>Cache configuration:</para>
+
+ <para>enabled - if workspace cache is enabled</para>
+
+ <para>class - cache implementation class, optional from 1.9. Default
+ value is
+ org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl.</para>
+
+ <para>Cache can be configured to use concrete implementation of
+ WorkspaceStorageCache interface. JCR core has two implementation to use:
+ * LinkedWorkspaceStorageCacheImpl - default, with configurable read
+ behavior and statistic. * WorkspaceStorageCacheImpl - pre 1.9, still can
+ be used.</para>
+
+ <para>properties - the list of properties (name-value pairs) for
+ Workspace cache:</para>
+
+ <para>max-size - cache maximum size.</para>
+
+ <para>live-time - cached item live time.</para>
+
+ <para>LinkedWorkspaceStorageCacheImpl supports additional optional
+ parameters TODO</para>
+
+ <para>Query Handler configuration:</para>
+
+ <para>class - A Query Handler class name</para>
+
+ <para>properties - the list of properties (name-value pairs) for a Query
+ Handler (indexDir) properties and advanced features described in *Search
+ Configuration*</para>
+
+ <para>Lock Manager configuration:</para>
+
+ <para>time-out - time after which the unused global lock will be
+ removed.</para>
+
+ <para>persister - a class for storing lock information for future use.
+ For example, remove lock after jcr restart.</para>
+
+ <para>path - a lock folder, each workspace has its own.</para>
+
+ <para></para>
+
+ <para>Configuration definition:</para>
+
+ <programlisting><!ELEMENT repository-service (repositories)>
+ <!ATTLIST repository-service default-repository NMTOKEN #REQUIRED>
+ <!ELEMENT repositories (repository)>
+ <!ELEMENT repository (security-domain,access-control,session-max-age,authentication-policy,workspaces)>
+ <!ATTLIST repository
+ default-workspace NMTOKEN #REQUIRED
+ name NMTOKEN #REQUIRED
+ system-workspace NMTOKEN #REQUIRED
+ >
+ <!ELEMENT security-domain (#PCDATA)>
+ <!ELEMENT access-control (#PCDATA)>
+ <!ELEMENT session-max-age (#PCDATA)>
+ <!ELEMENT authentication-policy (#PCDATA)>
+ <!ELEMENT workspaces (workspace+)>
+ <!ELEMENT workspace (container,initializer,cache,query-handler)>
+ <!ATTLIST workspace name NMTOKEN #REQUIRED>
+ <!ELEMENT container (properties,value-storages)>
+ <!ATTLIST container class NMTOKEN #REQUIRED>
+ <!ELEMENT value-storages (value-storage+)>
+ <!ELEMENT value-storage (properties,filters)>
+ <!ATTLIST value-storage class NMTOKEN #REQUIRED>
+ <!ELEMENT filters (filter+)>
+ <!ELEMENT filter EMPTY>
+ <!ATTLIST filter property-type NMTOKEN #REQUIRED>
+ <!ELEMENT initializer (properties)>
+ <!ATTLIST initializer class NMTOKEN #REQUIRED>
+ <!ELEMENT cache (properties)>
+ <!ATTLIST cache
+ enabled NMTOKEN #REQUIRED
+ class NMTOKEN #REQUIRED
+ >
+ <!ELEMENT query-handler (properties)>
+ <!ATTLIST query-handler class NMTOKEN #REQUIRED>
+ <!ELEMENT access-manager (properties)>
+ <!ATTLIST access-manager class NMTOKEN #REQUIRED>
+ <!ELEMENT lock-manager (time-out,persister)>
+ <!ELEMENT time-out (#PCDATA)>
+ <!ELEMENT persister (properties)>
+ <!ELEMENT properties (property+)>
+ <!ELEMENT property EMPTY></programlisting>
+ </section>
+ </section>
+</chapter>
Modified: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/external-value-storages.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/external-value-storages.xml 2010-02-18 11:45:30 UTC (rev 1889)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/external-value-storages.xml 2010-02-18 12:06:33 UTC (rev 1890)
@@ -1,248 +1,247 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<article>
- <articleinfo>
- <title>External Value Storages</title>
- </articleinfo>
-
- <section>
- <title>Introduction</title>
-
- <para>By default JCR Values are stored in the Workspace Data container
- along with the JCR structure (i.e. Nodes and Properties). eXo JCR offers
- an additional option of storing JCR Values separately from Workspace Data
- container, which can be extremely helpful to keep Binary Large Objects
- (BLOBs) for example (see [TODOBinary values processing link]).</para>
-
- <para>Value storage configuration is a part of Repository configuration,
- find more details <link
- linkend="sect_repository_service_configuration">there</link>.</para>
-
- <para>Tree-based storage is recommended for most of cases. If you run an
- application on Amazon EC2 - the S3 option may be interesting for
- architecture. Simple 'flat' storage is good in speed of creation/deletion
- of values, it might be a compromise for a small storages.</para>
- </section>
-
- <section>
- <title>Tree File Value Storage</title>
-
- <para>Holds Values in tree-like FileSystem files.
- <property>path</property> property points to the root directory to store
- the files.</para>
-
- <para>This is a recommended type of external storage, it can contain large
- amount of files limited only by disk/volume free space.</para>
-
- <para>A disadvantage it's a higher time on Value deletion due to unused
- tree-nodes remove.</para>
-
- <programlisting><value-storage id="Storage #1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="data/values"/>
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="1M"/>
- </filters></programlisting>
-
- <para>Where :<simplelist>
- <member><parameter>id</parameter> - the value storage unique
- identifier, used for linking with properties stored in workspace
- container</member>
-
- <member><parameter>path</parameter> - a location where value files
- will be stored</member>
- </simplelist></para>
-
- <para>Each file value storage can have the <function>filter(s)</function>
- for incoming values. A filter can match values by property type
- (<property>property-type</property>), property name
- (<property>property-name</property>), ancestor path
- (<property>ancestor-path</property>) and/or size of values stored
- (<property>min-value-size</property>, in bytes). In code sample we use a
- filter with property-type and min-value-size only. I.e. storage for binary
- values with size greater of 1MB. It's recommended to store properties with
- large values in file value storage only.</para>
-
- <para>Another example shows a value storage with different locations for
- large files (<property>min-value-size</property> a 20Mb-sized filter). A
- value storage uses ORed logic in the process of filter selection. That
- means the first filter in the list will be asked first and if not matched
- the next will be called etc. Here a value matches the 20 MB-sized filter
- <property>min-value-size</property> and will be stored in the path
- "data/20Mvalues", all other in "data/values".</para>
-
- <programlisting><value-storages>
- <value-storage id="Storage #1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="data/20Mvalues"/>
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="20M"/>
- </filters>
- <value-storage>
- <value-storage id="Storage #2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
- <properties>
- <property name="path" value="data/values"/>
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="1M"/>
- </filters>
- <value-storage>
-<value-storages></programlisting>
- </section>
-
- <section>
- <title>S3 File Value Storage</title>
-
- <para>Holds Values at Amazon S3 storage. For more about S3 see <ulink
- url="http://www.amazon.com/S3-AWS-home-page-Money/b/ref=sc_fe_l_2/103-7720231-...">http://www.amazon.com/S3-AWS-home-page-Money/b/ref=sc_fe_l_2/103-7720231-...</ulink>.</para>
-
- <para>This type of storage saves all matching Values on Amazon S3 service.
- That is very useful for <phrase>cloud computing</phrase> (like Amazon EC2
- hosted repositories). But can be used in any environment and storages
- combinations. It's often used in combined with Workspace Simple DB storage
- [TODO Workspace Simple DB storage].</para>
-
- <para>It's networked storage with RESTbased access (via HTTP) that makes a
- footprint on performance of the Repository.</para>
-
- <programlisting><value-storage id="Storage #1" class="org.exoplatform.services.jcr.impl.storage.value.s3.SimpleS3ValueStorage">
- <properties>
- <property name="bucket" value="BUCKET NAME HERE"/>
- <property name="aws-access-key" value="INSERT YOUR AWS ACCESS KEY ID HERE"/>
- <property name="aws-secret-access-key" value="INSERT YOUR AWS SECRET ACCESS KEY HERE"/>
- <property name="s3-swap-directory" value="s3swap_directory_name"/>
- </properties>
- <filters>
- <filter property-type="Binary"/>
- </filters>
-</value-storage></programlisting>
- </section>
-
- <section>
- <title>Simple File Value Storage</title>
-
- <note>
- <para>Not recommended to use in production due to low capacity
- capabilities on most file systems.</para>
-
- <para>But if you're sure in your file-system or data amount is small it
- may be useful for you as haves a faster speed of Value removal.</para>
- </note>
-
- <para>Holds Values in flat FileSystem files. <property>path</property>
- property points to root directory in order to store files</para>
-
- <programlisting><value-storage id="Storage #1" class="org.exoplatform.services.jcr.impl.storage.value.fs.SimpleFileValueStorage">
- <properties>
- <property name="path" value="data/values"/>
- </properties>
- <filters>
- <filter property-type="Binary" min-value-size="1M"/>
- </filters></programlisting>
- </section>
-
- <section>
- <title>Content Addressable Value storage (CAS) support</title>
-
- <remark>Available from version 1.9.3</remark>
-
- <para>eXo JCR supports <phrase>Content-addressable storage</phrase>
- feature for <phrase>Values</phrase> storing.</para>
-
- <note>
- <para>Content-addressable storage, also referred to as associative
- storage and abbreviated CAS, is a mechanism for storing information that
- can be retrieved based on its content, not its storage location. It is
- typically used for high-speed storage and retrieval of fixed content,
- such as documents stored for compliance with government
- regulations.</para>
- </note>
-
- <para>Content Addressable Value storage stores unique content once.
- Different properties (values) with same content will be stored as one data
- file shared between those values. We can tell the Value content will be
- shared across some Values in storage and will be stored on one physical
- file.</para>
-
- <para>Storage size will be decreased for application which governs
- potentially same data in the content.</para>
-
- <note>
- <para>For example: if you have 100 different properties containing the
- same data (e.g. mail attachment) the storage stores only one single
- file. The file will be shared with all referencing properties.</para>
- </note>
-
- <para>If property Value changes it is stored in an additional file.
- Alternatively the file is shared with other values, pointing to the same
- content.</para>
-
- <para>The storage calculates Value content address each time the property
- was changed. CAS write operations are much more expensive compared to the
- non-CAS storages.</para>
-
- <para>Content address calculation based on java.security.MessageDigest
- hash computation and tested with <abbrev>MD5</abbrev> and
- <abbrev>SHA1</abbrev> algorithms.</para>
-
- <note>
- <para>CAS storage works most efficiently on data that does not change
- often. For data that changes frequently, CAS is not as efficient as
- location-based addressing.</para>
- </note>
-
- <para>CAS support can be enabled for <phrase>Tree</phrase> and
- <phrase>Simple File Value Storage</phrase> types.</para>
-
- <para>To enable CAS support just configure it in JCR Repositories
- configuration like we do for other Value Storages.</para>
-
- <programlisting><workspaces>
- <workspace name="ws">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
- <properties>
- <property name="source-name" value="jdbcjcr"/>
- <property name="dialect" value="oracle"/>
- <property name="multi-db" value="false"/>
- <property name="update-storage" value="false"/>
- <property name="max-buffer-size" value="200k"/>
- <property name="swap-directory" value="target/temp/swap/ws"/>
- </properties>
- <value-storages>
-<!------------------- here ----------------------->
- <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
- <properties>
- <property name="path" value="target/temp/values/ws"/>
- <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="oracle"/>
- </properties>
- <filters>
- <filter property-type="Binary"/>
- </filters>
- </value-storage>
- </value-storages></programlisting>
-
- <para>Properties:<simplelist>
- <member><parameter>digest-algo</parameter> - digest hash algorithm
- (MD5 and SHA1 were tested);</member>
-
- <member><parameter>vcas-type</parameter> - Value CAS internal data
- type, JDBC backed is currently implemented
- org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImp;l</member>
-
- <member><parameter>jdbc-source-name</parameter> -
- JDBCValueContentAddressStorageImpl specific parameter, database will
- be used to save CAS metadata. It's simple to use same as in workspace
- container;</member>
-
- <member><parameter>jdbc-dialect</parameter> -
- JDBCValueContentAddressStorageImpl specific parameter, database
- dialect. It's simple to use same as in workspace container;</member>
- </simplelist></para>
- </section>
-</article>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<chapter>
+ <?dbhtml filename="external-value-storages.html"?>
+ <title>External Value Storages</title>
+
+ <section>
+ <title>Introduction</title>
+
+ <para>By default JCR Values are stored in the Workspace Data container
+ along with the JCR structure (i.e. Nodes and Properties). eXo JCR offers
+ an additional option of storing JCR Values separately from Workspace Data
+ container, which can be extremely helpful to keep Binary Large Objects
+ (BLOBs) for example (see [TODOBinary values processing link]).</para>
+
+ <para>Value storage configuration is a part of Repository configuration,
+ find more details <link
+ linkend="sect_repository_service_configuration">there</link>.</para>
+
+ <para>Tree-based storage is recommended for most of cases. If you run an
+ application on Amazon EC2 - the S3 option may be interesting for
+ architecture. Simple 'flat' storage is good in speed of creation/deletion
+ of values, it might be a compromise for a small storages.</para>
+ </section>
+
+ <section>
+ <title>Tree File Value Storage</title>
+
+ <para>Holds Values in tree-like FileSystem files.
+ <property>path</property> property points to the root directory to store
+ the files.</para>
+
+ <para>This is a recommended type of external storage, it can contain large
+ amount of files limited only by disk/volume free space.</para>
+
+ <para>A disadvantage it's a higher time on Value deletion due to unused
+ tree-nodes remove.</para>
+
+ <programlisting><value-storage id="Storage #1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="data/values"/>
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="1M"/>
+ </filters></programlisting>
+
+ <para>Where :<simplelist>
+ <member><parameter>id</parameter> - the value storage unique
+ identifier, used for linking with properties stored in workspace
+ container</member>
+
+ <member><parameter>path</parameter> - a location where value files
+ will be stored</member>
+ </simplelist></para>
+
+ <para>Each file value storage can have the <function>filter(s)</function>
+ for incoming values. A filter can match values by property type
+ (<property>property-type</property>), property name
+ (<property>property-name</property>), ancestor path
+ (<property>ancestor-path</property>) and/or size of values stored
+ (<property>min-value-size</property>, in bytes). In code sample we use a
+ filter with property-type and min-value-size only. I.e. storage for binary
+ values with size greater of 1MB. It's recommended to store properties with
+ large values in file value storage only.</para>
+
+ <para>Another example shows a value storage with different locations for
+ large files (<property>min-value-size</property> a 20Mb-sized filter). A
+ value storage uses ORed logic in the process of filter selection. That
+ means the first filter in the list will be asked first and if not matched
+ the next will be called etc. Here a value matches the 20 MB-sized filter
+ <property>min-value-size</property> and will be stored in the path
+ "data/20Mvalues", all other in "data/values".</para>
+
+ <programlisting><value-storages>
+ <value-storage id="Storage #1" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="data/20Mvalues"/>
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="20M"/>
+ </filters>
+ <value-storage>
+ <value-storage id="Storage #2" class="org.exoplatform.services.jcr.impl.storage.value.fs.TreeFileValueStorage">
+ <properties>
+ <property name="path" value="data/values"/>
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="1M"/>
+ </filters>
+ <value-storage>
+<value-storages></programlisting>
+ </section>
+
+ <section>
+ <title>S3 File Value Storage</title>
+
+ <para>Holds Values at Amazon S3 storage. For more about S3 see <ulink
+ url="http://www.amazon.com/S3-AWS-home-page-Money/b/ref=sc_fe_l_2/103-7720231-...">http://www.amazon.com/S3-AWS-home-page-Money/b/ref=sc_fe_l_2/103-7720231-...</ulink>.</para>
+
+ <para>This type of storage saves all matching Values on Amazon S3 service.
+ That is very useful for <phrase>cloud computing</phrase> (like Amazon EC2
+ hosted repositories). But can be used in any environment and storages
+ combinations. It's often used in combined with Workspace Simple DB storage
+ [TODO Workspace Simple DB storage].</para>
+
+ <para>It's networked storage with RESTbased access (via HTTP) that makes a
+ footprint on performance of the Repository.</para>
+
+ <programlisting><value-storage id="Storage #1" class="org.exoplatform.services.jcr.impl.storage.value.s3.SimpleS3ValueStorage">
+ <properties>
+ <property name="bucket" value="BUCKET NAME HERE"/>
+ <property name="aws-access-key" value="INSERT YOUR AWS ACCESS KEY ID HERE"/>
+ <property name="aws-secret-access-key" value="INSERT YOUR AWS SECRET ACCESS KEY HERE"/>
+ <property name="s3-swap-directory" value="s3swap_directory_name"/>
+ </properties>
+ <filters>
+ <filter property-type="Binary"/>
+ </filters>
+</value-storage></programlisting>
+ </section>
+
+ <section>
+ <title>Simple File Value Storage</title>
+
+ <note>
+ <para>Not recommended to use in production due to low capacity
+ capabilities on most file systems.</para>
+
+ <para>But if you're sure in your file-system or data amount is small it
+ may be useful for you as haves a faster speed of Value removal.</para>
+ </note>
+
+ <para>Holds Values in flat FileSystem files. <property>path</property>
+ property points to root directory in order to store files</para>
+
+ <programlisting><value-storage id="Storage #1" class="org.exoplatform.services.jcr.impl.storage.value.fs.SimpleFileValueStorage">
+ <properties>
+ <property name="path" value="data/values"/>
+ </properties>
+ <filters>
+ <filter property-type="Binary" min-value-size="1M"/>
+ </filters></programlisting>
+ </section>
+
+ <section>
+ <title>Content Addressable Value storage (CAS) support</title>
+
+ <remark>Available from version 1.9.3</remark>
+
+ <para>eXo JCR supports <phrase>Content-addressable storage</phrase>
+ feature for <phrase>Values</phrase> storing.</para>
+
+ <note>
+ <para>Content-addressable storage, also referred to as associative
+ storage and abbreviated CAS, is a mechanism for storing information that
+ can be retrieved based on its content, not its storage location. It is
+ typically used for high-speed storage and retrieval of fixed content,
+ such as documents stored for compliance with government
+ regulations.</para>
+ </note>
+
+ <para>Content Addressable Value storage stores unique content once.
+ Different properties (values) with same content will be stored as one data
+ file shared between those values. We can tell the Value content will be
+ shared across some Values in storage and will be stored on one physical
+ file.</para>
+
+ <para>Storage size will be decreased for application which governs
+ potentially same data in the content.</para>
+
+ <note>
+ <para>For example: if you have 100 different properties containing the
+ same data (e.g. mail attachment) the storage stores only one single
+ file. The file will be shared with all referencing properties.</para>
+ </note>
+
+ <para>If property Value changes it is stored in an additional file.
+ Alternatively the file is shared with other values, pointing to the same
+ content.</para>
+
+ <para>The storage calculates Value content address each time the property
+ was changed. CAS write operations are much more expensive compared to the
+ non-CAS storages.</para>
+
+ <para>Content address calculation based on java.security.MessageDigest
+ hash computation and tested with <abbrev>MD5</abbrev> and
+ <abbrev>SHA1</abbrev> algorithms.</para>
+
+ <note>
+ <para>CAS storage works most efficiently on data that does not change
+ often. For data that changes frequently, CAS is not as efficient as
+ location-based addressing.</para>
+ </note>
+
+ <para>CAS support can be enabled for <phrase>Tree</phrase> and
+ <phrase>Simple File Value Storage</phrase> types.</para>
+
+ <para>To enable CAS support just configure it in JCR Repositories
+ configuration like we do for other Value Storages.</para>
+
+ <programlisting><workspaces>
+ <workspace name="ws">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <properties>
+ <property name="source-name" value="jdbcjcr"/>
+ <property name="dialect" value="oracle"/>
+ <property name="multi-db" value="false"/>
+ <property name="update-storage" value="false"/>
+ <property name="max-buffer-size" value="200k"/>
+ <property name="swap-directory" value="target/temp/swap/ws"/>
+ </properties>
+ <value-storages>
+<!------------------- here ----------------------->
+ <value-storage id="ws" class="org.exoplatform.services.jcr.impl.storage.value.fs.CASableTreeFileValueStorage">
+ <properties>
+ <property name="path" value="target/temp/values/ws"/>
+ <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="oracle"/>
+ </properties>
+ <filters>
+ <filter property-type="Binary"/>
+ </filters>
+ </value-storage>
+ </value-storages></programlisting>
+
+ <para>Properties:<simplelist>
+ <member><parameter>digest-algo</parameter> - digest hash algorithm
+ (MD5 and SHA1 were tested);</member>
+
+ <member><parameter>vcas-type</parameter> - Value CAS internal data
+ type, JDBC backed is currently implemented
+ org.exoplatform.services.jcr.impl.storage.value.cas.JDBCValueContentAddressStorageImp;l</member>
+
+ <member><parameter>jdbc-source-name</parameter> -
+ JDBCValueContentAddressStorageImpl specific parameter, database will
+ be used to save CAS metadata. It's simple to use same as in workspace
+ container;</member>
+
+ <member><parameter>jdbc-dialect</parameter> -
+ JDBCValueContentAddressStorageImpl specific parameter, database
+ dialect. It's simple to use same as in workspace container;</member>
+ </simplelist></para>
+ </section>
+</chapter>
Modified: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/intro.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/intro.xml 2010-02-18 11:45:30 UTC (rev 1889)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/intro.xml 2010-02-18 12:06:33 UTC (rev 1890)
@@ -1,84 +1,70 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<article>
- <articleinfo>
- <title>Introduction in eXoJCR</title>
-
- <author>
- <firstname></firstname>
-
- <surname></surname>
-
- <affiliation>
- <orgname></orgname>
- </affiliation>
- </author>
-
- <pubdate></pubdate>
- </articleinfo>
-
- <section>
- <title>JCR (JSR-170) API main concepts</title>
-
- <para>Java Content Repository API as well as other Java language related
- standards is created within the Java Community Process http://jcp.org/ as
- a result of collaboration of an expert group and the Java community and
- known as JSR-170 (Java Specification Request)
- http://www.jcp.org/en/jsr/detail?id=170.</para>
-
- <para></para>
-
- <section>
- <title>Data model</title>
-
- <para>As the main purpose of content repository is to maintain the data
- - the heart of CR is the data model:</para>
-
- <para><itemizedlist>
- <listitem>
- <para>The main data storage abstraction of JCR's data model is a
- workspace</para>
- </listitem>
-
- <listitem>
- <para>Each repository should have one or more workspaces</para>
- </listitem>
-
- <listitem>
- <para>The content is stored in a workspace as a hierarchy of
- items</para>
- </listitem>
-
- <listitem>
- <para>Each workspace has its own hierarchy of items</para>
- </listitem>
- </itemizedlist></para>
-
- <figure>
- <title>Item hierarchy</title>
-
- <mediaobject>
- <imageobject>
- <imagedata fileref="images/item-hierarchy.gif" />
- </imageobject>
- </mediaobject>
- </figure>
-
- <para>Node is intended to support the data hierarchy. They are typed
- using namespaced names which allows the content to be structured
- according to standardized constraints. A node may be versioned through
- an associated version graph (optional feature)</para>
-
- <para>Property stored data are values of predefined types (String,
- Binary, Long, Boolean, Double, Date, Reference, Path).</para>
-
- <para>It is important to note that the data model for the interface (the
- repository model) is rarely the same as the data models used by the
- repository's underlying storage subsystems. The repository knows how to
- make the client's changes persistent because that is part of the
- repository configuration, rather than part of the application
- programming task.</para>
- </section>
- </section>
-</article>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<chapter>
+ <?dbhtml filename="intro.html"?>
+ <title>Introduction in eXoJCR</title>
+ <section>
+ <title>JCR (JSR-170) API main concepts</title>
+
+ <para>Java Content Repository API as well as other Java language related
+ standards is created within the Java Community Process http://jcp.org/ as
+ a result of collaboration of an expert group and the Java community and
+ known as JSR-170 (Java Specification Request)
+ http://www.jcp.org/en/jsr/detail?id=170.</para>
+
+ <para></para>
+
+ <section>
+ <title>Data model</title>
+
+ <para>As the main purpose of content repository is to maintain the data
+ - the heart of CR is the data model:</para>
+
+ <para><itemizedlist>
+ <listitem>
+ <para>The main data storage abstraction of JCR's data model is a
+ workspace</para>
+ </listitem>
+
+ <listitem>
+ <para>Each repository should have one or more workspaces</para>
+ </listitem>
+
+ <listitem>
+ <para>The content is stored in a workspace as a hierarchy of
+ items</para>
+ </listitem>
+
+ <listitem>
+ <para>Each workspace has its own hierarchy of items</para>
+ </listitem>
+ </itemizedlist></para>
+
+ <figure>
+ <title>Item hierarchy</title>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/item-hierarchy.gif" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ <para>Node is intended to support the data hierarchy. They are typed
+ using namespaced names which allows the content to be structured
+ according to standardized constraints. A node may be versioned through
+ an associated version graph (optional feature)</para>
+
+ <para>Property stored data are values of predefined types (String,
+ Binary, Long, Boolean, Double, Date, Reference, Path).</para>
+
+ <para>It is important to note that the data model for the interface (the
+ repository model) is rarely the same as the data models used by the
+ repository's underlying storage subsystems. The repository knows how to
+ make the client's changes persistent because that is part of the
+ repository configuration, rather than part of the application
+ programming task.</para>
+ </section>
+ </section>
+</chapter>
Modified: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jbosscache-configuration-templates.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jbosscache-configuration-templates.xml 2010-02-18 11:45:30 UTC (rev 1889)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/jbosscache-configuration-templates.xml 2010-02-18 12:06:33 UTC (rev 1890)
@@ -1,265 +1,265 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<article>
- <articleinfo>
- <title>JBoss Cache configuration</title>
- </articleinfo>
-
- <section>
- <title>JBoss cache configuration for indexer, lock manager and data
- container</title>
-
- <para>Each mentioned components uses instances of JBoss Cache product for
- caching in clustered environment. So every element has it's own transport
- and has to be configured in proper way. As usual, workspaces has similar
- configuration but with different cluster-names and may-be some other
- parameters. The simplest way to configure them is to define their's own
- configuration files for each component in each workspace: </para>
-
- <programlisting><property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-lock-db1-ws1.xml" /></programlisting>
-
- <para>But if there are few workspaces, configuring them in such a way can
- be painful and hard-manageable. eXo JCR offers a template-based
- configuration for JBoss Cache instances. You can have one template for
- Lock Manager, one for Indexer and one for data container and use them in
- all the workspaces, defining the map of substitution parameters in main
- configuration file. Just simply define ${jbosscache-<parameter
- name>} inside xml-template and list correct value in JCR configuration
- file just below "jbosscache-configuration", as shown:</para>
-
- <para>template: </para>
-
- <programlisting>...
-<clustering mode="replication" clusterName="${jbosscache-cluster-name}">
- <stateRetrieval timeout="20000" fetchInMemoryState="false" />
-...</programlisting>
-
- <para>and JCR configuration file: </para>
-
- <programlisting>...
-<property name="jbosscache-configuration" value="jar:/conf/portal/jbosscache-lock.xml" />
-<property name="jbosscache-cluster-name" value="JCR-cluster-locks-db1-ws" />
-...</programlisting>
- </section>
-
- <section>
- <title>JGroups configuration</title>
-
- <para>JGroups is used by JBoss Cache for network communications and
- transport in clustered environment. If property "jgroups-configuration" is
- defined in component configuration, it will be injected into the JBoss
- Cache instance on startup. </para>
-
- <programlisting><property name="jgroups-configuration" value="your/path/to/modified-udp.xml" /></programlisting>
-
- <para>As mentioned above, each component (lock manager, data container and
- query handler) for each workspace requires it's own clustered environment.
- Saying with another words, they have their own clusters with unique names.
- By default each cluster should perform multi-casts on separate port. This
- configuration leads to great unnecessary overhead on cluster. Thats why
- JGroups offers multiplexer feature, providing ability to use one single
- channel for set of clusters. This feature reduces network overheads
- increasing performance and stability of application. To enable multiplexer
- stack, You should define appropriate configuration file (upd-mux.xml is
- pre-shipped one with eXo JCR) and set "jgroups-multiplexer-stack" into
- "true".</para>
-
- <programlisting><property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" />
-<property name="jgroups-multiplexer-stack" value="true" /></programlisting>
- </section>
-
- <section>
- <title>Shipped JBoss Cache configuration templates</title>
-
- <para>Exo JCR implementation is shipped with ready-to-use JBoss Cache
- configuration templates for JCR's components. They are situated in
- application package in /conf/porta/ folder.</para>
-
- <section>
- <title>Data container template</title>
-
- <para>Data container template is "jbosscache-data.xml" It's</para>
-
- <programlisting><?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
-
- <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false"
- lockAcquisitionTimeout="20000" />
-
- <clustering mode="replication" clusterName="${jbosscache-cluster-name}">
- <stateRetrieval timeout="20000" fetchInMemoryState="false" />
- <jgroupsConfig multiplexerStack="jcr.stack" />
- <sync />
- </clustering>
-
- <!-- Eviction configuration -->
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
- actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy"
- eventQueueSize="1000000">
- <property name="maxNodes" value="1000000" />
- <property name="timeToLive" value="120000" />
- </default>
- </eviction>
-</jbosscache></programlisting>
-
- <table>
- <title>Template variables</title>
-
- <tgroup cols="1">
- <thead>
- <row>
- <entry align="center">Variable</entry>
- </row>
- </thead>
-
- <tbody>
- <row>
- <entry>jbosscache-cluster-name</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
-
- <para> </para>
- </section>
-
- <section>
- <title>Lock manager template</title>
-
- <para>It's template name is "jbosscache-lock.xml" </para>
-
- <programlisting><?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
-
- <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false"
- lockAcquisitionTimeout="20000" />
- <clustering mode="replication" clusterName="${jbosscache-cluster-name}">
- <stateRetrieval timeout="20000" fetchInMemoryState="false" />
- <jgroupsConfig multiplexerStack="jcr.stack" />
- <sync />
- </clustering>
- <loaders passivation="false" shared="true">
- <preload>
- <node fqn="/" />
- </preload>
- <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="false" fetchPersistentState="false"
- ignoreModifications="false" purgeOnStartup="false">
- <properties>
- cache.jdbc.table.name=${jbosscache-cl-cache.jdbc.table.name}
- cache.jdbc.table.create=${jbosscache-cl-cache.jdbc.table.create}
- cache.jdbc.table.drop=${jbosscache-cl-cache.jdbc.table.drop}
- cache.jdbc.table.primarykey=${jbosscache-cl-cache.jdbc.table.primarykey}
- cache.jdbc.fqn.column=${jbosscache-cl-cache.jdbc.fqn.column}
- cache.jdbc.fqn.type=${jbosscache-cl-cache.jdbc.fqn.type}
- cache.jdbc.node.column=${jbosscache-cl-cache.jdbc.node.column}
- cache.jdbc.node.type=${jbosscache-cl-cache.jdbc.node.type}
- cache.jdbc.parent.column=${jbosscache-cl-cache.jdbc.parent.column}
- cache.jdbc.datasource=${jbosscache-cl-cache.jdbc.datasource}
- </properties>
- </loader>
- </loaders>
-</jbosscache></programlisting>
-
- <table>
- <title>Template variables</title>
-
- <tgroup cols="1">
- <thead>
- <row>
- <entry align="center">Variable</entry>
- </row>
- </thead>
-
- <tbody>
- <row>
- <entry>jbosscache-cluster-name</entry>
- </row>
-
- <row>
- <entry>jbosscache-cl-cache.jdbc.table.name</entry>
- </row>
-
- <row>
- <entry>jbosscache-cl-cache.jdbc.table.create</entry>
- </row>
-
- <row>
- <entry>jbosscache-cl-cache.jdbc.table.drop</entry>
- </row>
-
- <row>
- <entry>jbosscache-cl-cache.jdbc.table.primarykey</entry>
- </row>
-
- <row>
- <entry>jbosscache-cl-cache.jdbc.fqn.column</entry>
- </row>
-
- <row>
- <entry>jbosscache-cl-cache.jdbc.fqn.type</entry>
- </row>
-
- <row>
- <entry>jbosscache-cl-cache.jdbc.node.column</entry>
- </row>
-
- <row>
- <entry>jbosscache-cl-cache.jdbc.node.type</entry>
- </row>
-
- <row>
- <entry>jbosscache-cl-cache.jdbc.parent.column</entry>
- </row>
-
- <row>
- <entry>jbosscache-cl-cache.jdbc.datasource</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
-
- <section>
- <title>Query handler (indexer) template</title>
-
- <para>Have a look at "jbosscache-indexer.xml" </para>
-
- <programlisting><?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
- <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false"
- lockAcquisitionTimeout="20000" />
- <clustering mode="replication" clusterName="${jbosscache-cluster-name}">
- <stateRetrieval timeout="20000" fetchInMemoryState="false" />
- <jgroupsConfig multiplexerStack="jcr.stack" />
- <sync />
- </clustering>
- <!-- Eviction configuration -->
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm" eventQueueSize="1000000">
- <property name="maxNodes" value="10000" />
- <property name="minTimeToLive" value="60000" />
- </default>
- </eviction>
-</jbosscache></programlisting>
- <table>
- <title>Template variables</title>
-
- <tgroup cols="1">
- <thead>
- <row>
- <entry align="center">Variable</entry>
- </row>
- </thead>
-
- <tbody>
- <row>
- <entry>jbosscache-cluster-name</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </section>
- </section>
-</article>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<chapter>
+ <?dbhtml filename="jbosscache-configuration-templates.html"?>
+
+ <title>JBoss Cache configuration</title>
+
+ <section>
+ <title>JBoss cache configuration for indexer, lock manager and data
+ container</title>
+
+ <para>Each mentioned components uses instances of JBoss Cache product for
+ caching in clustered environment. So every element has it's own transport
+ and has to be configured in proper way. As usual, workspaces has similar
+ configuration but with different cluster-names and may-be some other
+ parameters. The simplest way to configure them is to define their's own
+ configuration files for each component in each workspace: </para>
+
+ <programlisting><property name="jbosscache-configuration" value="conf/standalone/test-jbosscache-lock-db1-ws1.xml" /></programlisting>
+
+ <para>But if there are few workspaces, configuring them in such a way can
+ be painful and hard-manageable. eXo JCR offers a template-based
+ configuration for JBoss Cache instances. You can have one template for
+ Lock Manager, one for Indexer and one for data container and use them in
+ all the workspaces, defining the map of substitution parameters in main
+ configuration file. Just simply define ${jbosscache-<parameter
+ name>} inside xml-template and list correct value in JCR configuration
+ file just below "jbosscache-configuration", as shown:</para>
+
+ <para>template: </para>
+
+ <programlisting>...
+<clustering mode="replication" clusterName="${jbosscache-cluster-name}">
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" />
+...</programlisting>
+
+ <para>and JCR configuration file: </para>
+
+ <programlisting>...
+<property name="jbosscache-configuration" value="jar:/conf/portal/jbosscache-lock.xml" />
+<property name="jbosscache-cluster-name" value="JCR-cluster-locks-db1-ws" />
+...</programlisting>
+ </section>
+
+ <section>
+ <title>JGroups configuration</title>
+
+ <para>JGroups is used by JBoss Cache for network communications and
+ transport in clustered environment. If property "jgroups-configuration" is
+ defined in component configuration, it will be injected into the JBoss
+ Cache instance on startup. </para>
+
+ <programlisting><property name="jgroups-configuration" value="your/path/to/modified-udp.xml" /></programlisting>
+
+ <para>As mentioned above, each component (lock manager, data container and
+ query handler) for each workspace requires it's own clustered environment.
+ Saying with another words, they have their own clusters with unique names.
+ By default each cluster should perform multi-casts on separate port. This
+ configuration leads to great unnecessary overhead on cluster. Thats why
+ JGroups offers multiplexer feature, providing ability to use one single
+ channel for set of clusters. This feature reduces network overheads
+ increasing performance and stability of application. To enable multiplexer
+ stack, You should define appropriate configuration file (upd-mux.xml is
+ pre-shipped one with eXo JCR) and set "jgroups-multiplexer-stack" into
+ "true".</para>
+
+ <programlisting><property name="jgroups-configuration" value="jar:/conf/portal/udp-mux.xml" />
+<property name="jgroups-multiplexer-stack" value="true" /></programlisting>
+ </section>
+
+ <section>
+ <title>Shipped JBoss Cache configuration templates</title>
+
+ <para>Exo JCR implementation is shipped with ready-to-use JBoss Cache
+ configuration templates for JCR's components. They are situated in
+ application package in /conf/porta/ folder.</para>
+
+ <section>
+ <title>Data container template</title>
+
+ <para>Data container template is "jbosscache-data.xml" It's</para>
+
+ <programlisting><?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
+
+ <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false"
+ lockAcquisitionTimeout="20000" />
+
+ <clustering mode="replication" clusterName="${jbosscache-cluster-name}">
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" />
+ <jgroupsConfig multiplexerStack="jcr.stack" />
+ <sync />
+ </clustering>
+
+ <!-- Eviction configuration -->
+ <eviction wakeUpInterval="5000">
+ <default algorithmClass="org.jboss.cache.eviction.LRUAlgorithm"
+ actionPolicyClass="org.exoplatform.services.jcr.impl.dataflow.persistent.jbosscache.ParentNodeEvictionActionPolicy"
+ eventQueueSize="1000000">
+ <property name="maxNodes" value="1000000" />
+ <property name="timeToLive" value="120000" />
+ </default>
+ </eviction>
+</jbosscache></programlisting>
+
+ <table>
+ <title>Template variables</title>
+
+ <tgroup cols="1">
+ <thead>
+ <row>
+ <entry align="center">Variable</entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry>jbosscache-cluster-name</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para> </para>
+ </section>
+
+ <section>
+ <title>Lock manager template</title>
+
+ <para>It's template name is "jbosscache-lock.xml" </para>
+
+ <programlisting><?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
+
+ <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false"
+ lockAcquisitionTimeout="20000" />
+ <clustering mode="replication" clusterName="${jbosscache-cluster-name}">
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" />
+ <jgroupsConfig multiplexerStack="jcr.stack" />
+ <sync />
+ </clustering>
+ <loaders passivation="false" shared="true">
+ <preload>
+ <node fqn="/" />
+ </preload>
+ <loader class="org.jboss.cache.loader.JDBCCacheLoader" async="false" fetchPersistentState="false"
+ ignoreModifications="false" purgeOnStartup="false">
+ <properties>
+ cache.jdbc.table.name=${jbosscache-cl-cache.jdbc.table.name}
+ cache.jdbc.table.create=${jbosscache-cl-cache.jdbc.table.create}
+ cache.jdbc.table.drop=${jbosscache-cl-cache.jdbc.table.drop}
+ cache.jdbc.table.primarykey=${jbosscache-cl-cache.jdbc.table.primarykey}
+ cache.jdbc.fqn.column=${jbosscache-cl-cache.jdbc.fqn.column}
+ cache.jdbc.fqn.type=${jbosscache-cl-cache.jdbc.fqn.type}
+ cache.jdbc.node.column=${jbosscache-cl-cache.jdbc.node.column}
+ cache.jdbc.node.type=${jbosscache-cl-cache.jdbc.node.type}
+ cache.jdbc.parent.column=${jbosscache-cl-cache.jdbc.parent.column}
+ cache.jdbc.datasource=${jbosscache-cl-cache.jdbc.datasource}
+ </properties>
+ </loader>
+ </loaders>
+</jbosscache></programlisting>
+
+ <table>
+ <title>Template variables</title>
+
+ <tgroup cols="1">
+ <thead>
+ <row>
+ <entry align="center">Variable</entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry>jbosscache-cluster-name</entry>
+ </row>
+
+ <row>
+ <entry>jbosscache-cl-cache.jdbc.table.name</entry>
+ </row>
+
+ <row>
+ <entry>jbosscache-cl-cache.jdbc.table.create</entry>
+ </row>
+
+ <row>
+ <entry>jbosscache-cl-cache.jdbc.table.drop</entry>
+ </row>
+
+ <row>
+ <entry>jbosscache-cl-cache.jdbc.table.primarykey</entry>
+ </row>
+
+ <row>
+ <entry>jbosscache-cl-cache.jdbc.fqn.column</entry>
+ </row>
+
+ <row>
+ <entry>jbosscache-cl-cache.jdbc.fqn.type</entry>
+ </row>
+
+ <row>
+ <entry>jbosscache-cl-cache.jdbc.node.column</entry>
+ </row>
+
+ <row>
+ <entry>jbosscache-cl-cache.jdbc.node.type</entry>
+ </row>
+
+ <row>
+ <entry>jbosscache-cl-cache.jdbc.parent.column</entry>
+ </row>
+
+ <row>
+ <entry>jbosscache-cl-cache.jdbc.datasource</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+
+ <section>
+ <title>Query handler (indexer) template</title>
+
+ <para>Have a look at "jbosscache-indexer.xml" </para>
+
+ <programlisting><?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
+ <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false"
+ lockAcquisitionTimeout="20000" />
+ <clustering mode="replication" clusterName="${jbosscache-cluster-name}">
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" />
+ <jgroupsConfig multiplexerStack="jcr.stack" />
+ <sync />
+ </clustering>
+ <!-- Eviction configuration -->
+ <eviction wakeUpInterval="5000">
+ <default algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm" eventQueueSize="1000000">
+ <property name="maxNodes" value="10000" />
+ <property name="minTimeToLive" value="60000" />
+ </default>
+ </eviction>
+</jbosscache></programlisting>
+ <table>
+ <title>Template variables</title>
+
+ <tgroup cols="1">
+ <thead>
+ <row>
+ <entry align="center">Variable</entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry>jbosscache-cluster-name</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </section>
+ </section>
+</chapter>
Modified: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/lock-manager-config.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/lock-manager-config.xml 2010-02-18 11:45:30 UTC (rev 1889)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/lock-manager-config.xml 2010-02-18 12:06:33 UTC (rev 1890)
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<article>
- <articleinfo>
- <title>LockManager configuration</title>
- </articleinfo>
+<chapter>
+ <?dbhtml filename="lock-manager-config.html"?>
+ <title>LockManager configuration</title>
+
<section>
<title>Introduction</title>
@@ -437,4 +437,4 @@
</table>
</section>
</section>
-</article>
+</chapter>
Modified: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/query-handler-config.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/query-handler-config.xml 2010-02-18 11:45:30 UTC (rev 1889)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/query-handler-config.xml 2010-02-18 12:06:33 UTC (rev 1890)
@@ -1,188 +1,187 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
-"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<article>
- <articleinfo>
- <title>QueryHandler configuration</title>
- </articleinfo>
-
- <section>
- <title>How does it work?</title>
-
- <para>Lets talk about indexing content in cluster.</para>
-
- <para>For couple of reasons, we can't replicate index. That's means, some
- data added and indexed on one cluster node, will be replicated to another
- cluster node, but will not be indexed on that node.</para>
-
- <para><citetitle>So, how do the indexing works in cluster
- environment?</citetitle></para>
-
- <para>As, we can not index same data on all nodes of cluster, we must
- index it on one node. Node, that can index data and do changes on lucene
- index, is called "coordinator". Coordinator-node is choosen automaticaly,
- so we do not need special configuration for coordinator.</para>
-
- <para>But, how can another nodes save their changes to lucene
- index?</para>
-
- <para>First of all, data is already saved and replicated to another
- cluster-nodes, so we need only deliver message like "we need to index this
- data" to coordinator. Thats why Jboss-cache is used.</para>
-
- <para>All nodes of cluster writes messages into JBoss-cache but only
- coordinator takes those messages and makes changes Lucene index.</para>
-
- <para><citetitle>How do the search works in cluster
- environment?</citetitle></para>
-
- <para>Search engine do not works with indexer, coordinator, etc. Search
- needs only lucene index. But only one cluster node can change lucene index
- - asking you. Yes - lucene index is shared. So, all cluster nodes must be
- configured to use lucene index from shared directory.</para>
-
- <para>A little bit about indexing process (no matter, cluster or not)
- Indexer do not writes changes to FS lucene index immediately. At first,
- Indexer writes changes to Volatile index. If Volatile index size become
- 1Mb or more it is flushed to FS. Also there is timer, that flushes
- volatile index by timeout. Volatile index timeout configured by
- "max-volatile-time" paremeter.</para>
-
- <para>Common scheme of Shared Index<mediaobject>
- <imageobject>
- <imagedata fileref="images/diagram-shared-index.png" />
- </imageobject>
- </mediaobject></para>
- </section>
-
- <section>
- <title>Configuration</title>
-
- <section>
- <title>Common requirements</title>
-
- <para>Now, lets see what we need to run Search engine in cluster
- environment.<itemizedlist>
- <listitem>
- <para>shared directory for storing Lucene index (i.e. NFS);</para>
- </listitem>
-
- <listitem>
- <para>changes filter configured as
- org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter;</para>
-
- <note>
- <para>This filter ignore changes on non-coordinator nodes, and
- index changes on coordinator node.</para>
- </note>
- </listitem>
-
- <listitem>
- <para>configure JBoss-cache, course;</para>
- </listitem>
- </itemizedlist></para>
- </section>
-
- <section>
- <title>Query-handler configuration</title>
-
- <para>Configuration example:<programlisting><workspace name="ws">
- <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
- <properties>
- <property name="index-dir" value="shareddir/index/db1/ws" />
- <property name="changesfilter-class"
- value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter" />
- <property name="jbosscache-configuration" value="jbosscache-indexer.xml" />
- <property name="jgroups-configuration" value="udp-mux.xml" />
- <property name="jgroups-multiplexer-stack" value="true" />
- <property name="jbosscache-cluster-name" value="JCR-cluster-indexer-ws" />
- <property name="max-volatile-time" value="60" />
- </properties>
- </query-handler>
-</workspace></programlisting> <table>
- <title>Config properties description</title>
-
- <tgroup cols="2">
- <thead>
- <row>
- <entry>Property name</entry>
-
- <entry>Description</entry>
- </row>
- </thead>
-
- <tbody>
- <row>
- <entry>index-dir</entry>
-
- <entry>path to index</entry>
- </row>
-
- <row>
- <entry>jbosscache-configuration</entry>
-
- <entry>template of JBoss-cache configuration for all
- query-handlers in repository</entry>
- </row>
-
- <row>
- <entry>jgroups-configuration</entry>
-
- <entry>jgroups-configuration is template configuration for all
- components (search, cache, locks) [Add link to document
- describing template configurations]</entry>
- </row>
-
- <row>
- <entry>jgroups-multiplexer-stack</entry>
-
- <entry>[TODO about jgroups-multiplexer-stack - add link to
- JBoss doc]</entry>
- </row>
-
- <row>
- <entry>jbosscache-cluster-name</entry>
-
- <entry>cluster name (must be unique)</entry>
- </row>
-
- <row>
- <entry>max-volatile-time</entry>
-
- <entry>max time to live for Volatile Index</entry>
- </row>
- </tbody>
- </tgroup>
- </table></para>
- </section>
-
- <section>
- <title>JBoss-Cache template configuration</title>
-
- <para>JBoss-Cache template configuration for query handler.</para>
-
- <para>jbosscache-indexer.xml<programlisting><?xml version="1.0" encoding="UTF-8"?>
-<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
-
- <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false"
- lockAcquisitionTimeout="20000" />
- <!-- Configure the TransactionManager -->
- <transaction transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
-
- <clustering mode="replication" clusterName="${jbosscache-cluster-name}">
- <stateRetrieval timeout="20000" fetchInMemoryState="false" />
- <jgroupsConfig multiplexerStack="jcr.stack" />
- <sync />
- </clustering>
- <!-- Eviction configuration -->
- <eviction wakeUpInterval="5000">
- <default algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm" eventQueueSize="1000000">
- <property name="maxNodes" value="10000" />
- <property name="minTimeToLive" value="60000" />
- </default>
- </eviction>
-
-</jbosscache></programlisting></para>
- </section>
- </section>
-</article>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<chapter>
+ <?dbhtml filename="query-handler-config.html"?>
+ <title>QueryHandler configuration</title>
+
+ <section>
+ <title>How does it work?</title>
+
+ <para>Lets talk about indexing content in cluster.</para>
+
+ <para>For couple of reasons, we can't replicate index. That's means, some
+ data added and indexed on one cluster node, will be replicated to another
+ cluster node, but will not be indexed on that node.</para>
+
+ <para><citetitle>So, how do the indexing works in cluster
+ environment?</citetitle></para>
+
+ <para>As, we can not index same data on all nodes of cluster, we must
+ index it on one node. Node, that can index data and do changes on lucene
+ index, is called "coordinator". Coordinator-node is choosen automaticaly,
+ so we do not need special configuration for coordinator.</para>
+
+ <para>But, how can another nodes save their changes to lucene
+ index?</para>
+
+ <para>First of all, data is already saved and replicated to another
+ cluster-nodes, so we need only deliver message like "we need to index this
+ data" to coordinator. Thats why Jboss-cache is used.</para>
+
+ <para>All nodes of cluster writes messages into JBoss-cache but only
+ coordinator takes those messages and makes changes Lucene index.</para>
+
+ <para><citetitle>How do the search works in cluster
+ environment?</citetitle></para>
+
+ <para>Search engine do not works with indexer, coordinator, etc. Search
+ needs only lucene index. But only one cluster node can change lucene index
+ - asking you. Yes - lucene index is shared. So, all cluster nodes must be
+ configured to use lucene index from shared directory.</para>
+
+ <para>A little bit about indexing process (no matter, cluster or not)
+ Indexer do not writes changes to FS lucene index immediately. At first,
+ Indexer writes changes to Volatile index. If Volatile index size become
+ 1Mb or more it is flushed to FS. Also there is timer, that flushes
+ volatile index by timeout. Volatile index timeout configured by
+ "max-volatile-time" paremeter.</para>
+
+ <para>Common scheme of Shared Index<mediaobject>
+ <imageobject>
+ <imagedata fileref="images/diagram-shared-index.png" />
+ </imageobject>
+ </mediaobject></para>
+ </section>
+
+ <section>
+ <title>Configuration</title>
+
+ <section>
+ <title>Common requirements</title>
+
+ <para>Now, lets see what we need to run Search engine in cluster
+ environment.<itemizedlist>
+ <listitem>
+ <para>shared directory for storing Lucene index (i.e. NFS);</para>
+ </listitem>
+
+ <listitem>
+ <para>changes filter configured as
+ org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter;</para>
+
+ <note>
+ <para>This filter ignore changes on non-coordinator nodes, and
+ index changes on coordinator node.</para>
+ </note>
+ </listitem>
+
+ <listitem>
+ <para>configure JBoss-cache, course;</para>
+ </listitem>
+ </itemizedlist></para>
+ </section>
+
+ <section>
+ <title>Query-handler configuration</title>
+
+ <para>Configuration example:<programlisting><workspace name="ws">
+ <query-handler class="org.exoplatform.services.jcr.impl.core.query.lucene.SearchIndex">
+ <properties>
+ <property name="index-dir" value="shareddir/index/db1/ws" />
+ <property name="changesfilter-class"
+ value="org.exoplatform.services.jcr.impl.core.query.jbosscache.JBossCacheIndexChangesFilter" />
+ <property name="jbosscache-configuration" value="jbosscache-indexer.xml" />
+ <property name="jgroups-configuration" value="udp-mux.xml" />
+ <property name="jgroups-multiplexer-stack" value="true" />
+ <property name="jbosscache-cluster-name" value="JCR-cluster-indexer-ws" />
+ <property name="max-volatile-time" value="60" />
+ </properties>
+ </query-handler>
+</workspace></programlisting> <table>
+ <title>Config properties description</title>
+
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Property name</entry>
+
+ <entry>Description</entry>
+ </row>
+ </thead>
+
+ <tbody>
+ <row>
+ <entry>index-dir</entry>
+
+ <entry>path to index</entry>
+ </row>
+
+ <row>
+ <entry>jbosscache-configuration</entry>
+
+ <entry>template of JBoss-cache configuration for all
+ query-handlers in repository</entry>
+ </row>
+
+ <row>
+ <entry>jgroups-configuration</entry>
+
+ <entry>jgroups-configuration is template configuration for all
+ components (search, cache, locks) [Add link to document
+ describing template configurations]</entry>
+ </row>
+
+ <row>
+ <entry>jgroups-multiplexer-stack</entry>
+
+ <entry>[TODO about jgroups-multiplexer-stack - add link to
+ JBoss doc]</entry>
+ </row>
+
+ <row>
+ <entry>jbosscache-cluster-name</entry>
+
+ <entry>cluster name (must be unique)</entry>
+ </row>
+
+ <row>
+ <entry>max-volatile-time</entry>
+
+ <entry>max time to live for Volatile Index</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table></para>
+ </section>
+
+ <section>
+ <title>JBoss-Cache template configuration</title>
+
+ <para>JBoss-Cache template configuration for query handler.</para>
+
+ <para>jbosscache-indexer.xml<programlisting><?xml version="1.0" encoding="UTF-8"?>
+<jbosscache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:jboss:jbosscache-core:config:3.1">
+
+ <locking useLockStriping="false" concurrencyLevel="50000" lockParentForChildInsertRemove="false"
+ lockAcquisitionTimeout="20000" />
+ <!-- Configure the TransactionManager -->
+ <transaction transactionManagerLookupClass="org.jboss.cache.transaction.JBossStandaloneJTAManagerLookup" />
+
+ <clustering mode="replication" clusterName="${jbosscache-cluster-name}">
+ <stateRetrieval timeout="20000" fetchInMemoryState="false" />
+ <jgroupsConfig multiplexerStack="jcr.stack" />
+ <sync />
+ </clustering>
+ <!-- Eviction configuration -->
+ <eviction wakeUpInterval="5000">
+ <default algorithmClass="org.jboss.cache.eviction.FIFOAlgorithm" eventQueueSize="1000000">
+ <property name="maxNodes" value="10000" />
+ <property name="minTimeToLive" value="60000" />
+ </default>
+ </eviction>
+
+</jbosscache></programlisting></para>
+ </section>
+ </section>
+</chapter>
Added: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/search-configuration.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/search-configuration.xml (rev 0)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/search-configuration.xml 2010-02-18 12:06:33 UTC (rev 1890)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
+<chapter>
+ <?dbhtml filename="search-configuration.html"?>
+
+ <title>Search Configuration</title>
+
+ <section>
+ <title></title>
+
+ <para></para>
+ </section>
+</chapter>
16 years, 2 months
exo-jcr SVN: r1889 - in jcr/trunk/docs/reference/en/src/main/docbook/en-US: modules and 1 other directory.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-02-18 06:45:30 -0500 (Thu, 18 Feb 2010)
New Revision: 1889
Modified:
jcr/trunk/docs/reference/en/src/main/docbook/en-US/master.xml
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/configuration.xml
jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/external-value-storages.xml
Log:
EXOJCR-490: links updated
Modified: jcr/trunk/docs/reference/en/src/main/docbook/en-US/master.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/master.xml 2010-02-18 11:08:34 UTC (rev 1888)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/master.xml 2010-02-18 11:45:30 UTC (rev 1889)
@@ -75,5 +75,8 @@
<xi:include href="modules/query-handler-config.xml"
xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="modules/external-value-storages.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude" />
+
</book>
Modified: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/configuration.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/configuration.xml 2010-02-18 11:08:34 UTC (rev 1888)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/configuration.xml 2010-02-18 11:45:30 UTC (rev 1889)
@@ -117,14 +117,14 @@
<section>
<title>JCR Configuration</title>
- <para> The Configuration is defined in an XML file (see DTD below).
- </para>
+ <para>The Configuration is defined in an XML file (see DTD
+ below).</para>
<para>JCR Service can use multiple Repositories and each repository can
- have multiple Workspaces. </para>
+ have multiple Workspaces.</para>
<para>Repositories configuration parameters support human-readable
- formats of values. They are all case-insensitive: </para>
+ formats of values. They are all case-insensitive:</para>
<itemizedlist>
<listitem>
@@ -137,8 +137,8 @@
<listitem>
<para>Time format endings: ms - milliseconds, s - seconds, m -
- minutes, h - hours, d - days, w - weeks, if no ending - seconds.
- </para>
+ minutes, h - hours, d - days, w - weeks, if no ending -
+ seconds.</para>
<para>Examples: 500ms - 500 milliseconds, 20 or 20s - 20 seconds,
30m - 30 minutes, 12h - 12 hours, 5d - 5 days, 4w - 4 weeks.</para>
@@ -148,12 +148,12 @@
<para></para>
</section>
- <section>
- <title>Repository service configuration </title>
+ <section id="sect_repository_service_configuration">
+ <title>Repository service configuration</title>
<para>Default configuration of the Repository Service located in
jar:/conf/portal/exo-jcr-config.xml, it will be available for portal and
- standalone modes. </para>
+ standalone modes.</para>
<para>In portal mode it is overriden and located in the portal web
application portal/WEB-INF/conf/jcr/repository-configuration.xml.</para>
@@ -272,7 +272,7 @@
<para>default-workspace - the name of a workspace obtained using
Session's login() or login(Credentials) methods (ones without an
- explicit workspace name) </para>
+ explicit workspace name)</para>
<para>system-workspace - name of workspace where /jcr:system node is
placed</para>
@@ -308,7 +308,7 @@
<para>cache - workspace storage cache configuration</para>
- <para>query-handler - query handler configuration </para>
+ <para>query-handler - query handler configuration</para>
<para>Workspace data container configuration:</para>
@@ -338,15 +338,14 @@
<para>Initializer configuration (optional):</para>
- <para>class - initializer implementation class. </para>
+ <para>class - initializer implementation class.</para>
<para>properties - the list of properties (name-value pairs). Properties
are supported:</para>
- <para> root-nodetype - The node type for root node initialization
- </para>
+ <para>root-nodetype - The node type for root node initialization</para>
- <para> root-permissions - Default permissions of the root node. It is
+ <para>root-permissions - Default permissions of the root node. It is
defined as a set of semicolon-delimited permissions containing a group
of space-delimited identities (user, group etc, see Organization service
documentation for details) and the type of permission. For example any
@@ -363,21 +362,20 @@
<para>class - cache implementation class, optional from 1.9. Default
value is
- org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl.
- </para>
+ org.exoplatform.services.jcr.impl.dataflow.persistent.LinkedWorkspaceStorageCacheImpl.</para>
<para>Cache can be configured to use concrete implementation of
WorkspaceStorageCache interface. JCR core has two implementation to use:
* LinkedWorkspaceStorageCacheImpl - default, with configurable read
behavior and statistic. * WorkspaceStorageCacheImpl - pre 1.9, still can
- be used. </para>
+ be used.</para>
<para>properties - the list of properties (name-value pairs) for
- Workspace cache: </para>
+ Workspace cache:</para>
- <para> max-size - cache maximum size. </para>
+ <para>max-size - cache maximum size.</para>
- <para> live-time - cached item live time.</para>
+ <para>live-time - cached item live time.</para>
<para>LinkedWorkspaceStorageCacheImpl supports additional optional
parameters TODO</para>
@@ -393,10 +391,10 @@
<para>Lock Manager configuration:</para>
<para>time-out - time after which the unused global lock will be
- removed. </para>
+ removed.</para>
<para>persister - a class for storing lock information for future use.
- For example, remove lock after jcr restart. </para>
+ For example, remove lock after jcr restart.</para>
<para>path - a lock folder, each workspace has its own.</para>
Modified: jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/external-value-storages.xml
===================================================================
--- jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/external-value-storages.xml 2010-02-18 11:08:34 UTC (rev 1888)
+++ jcr/trunk/docs/reference/en/src/main/docbook/en-US/modules/external-value-storages.xml 2010-02-18 11:45:30 UTC (rev 1889)
@@ -16,7 +16,8 @@
(BLOBs) for example (see [TODOBinary values processing link]).</para>
<para>Value storage configuration is a part of Repository configuration,
- find more details there [TODO link to repository configuration].</para>
+ find more details <link
+ linkend="sect_repository_service_configuration">there</link>.</para>
<para>Tree-based storage is recommended for most of cases. If you run an
application on Amazon EC2 - the S3 option may be interesting for
16 years, 2 months