Wikitty-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
September 2010
- 6 participants
- 98 discussions
r338 - in trunk/wikitty-api/src: main/java/org/nuiton/wikitty/importexport test/java/org/nuiton/wikitty/importexport test/resources test/resources/csv
by echatellier@users.nuiton.org 23 Sep '10
by echatellier@users.nuiton.org 23 Sep '10
23 Sep '10
Author: echatellier
Date: 2010-09-23 12:12:47 +0200 (Thu, 23 Sep 2010)
New Revision: 338
Url: http://nuiton.org/repositories/revision/wikitty/338
Log:
Check non existant linked wikitty id during import (actually skipped)
Added:
trunk/wikitty-api/src/test/resources/csv/
trunk/wikitty-api/src/test/resources/csv/importclient.csv
trunk/wikitty-api/src/test/resources/csv/importtree.csv
trunk/wikitty-api/src/test/resources/csv/importtree2.csv
Modified:
trunk/wikitty-api/src/main/java/org/nuiton/wikitty/importexport/ImportExportCSV.java
trunk/wikitty-api/src/test/java/org/nuiton/wikitty/importexport/ImportExportCSVTest.java
Modified: trunk/wikitty-api/src/main/java/org/nuiton/wikitty/importexport/ImportExportCSV.java
===================================================================
--- trunk/wikitty-api/src/main/java/org/nuiton/wikitty/importexport/ImportExportCSV.java 2010-09-23 10:11:58 UTC (rev 337)
+++ trunk/wikitty-api/src/main/java/org/nuiton/wikitty/importexport/ImportExportCSV.java 2010-09-23 10:12:47 UTC (rev 338)
@@ -20,6 +20,7 @@
import java.io.Reader;
import java.io.Writer;
import java.util.Collection;
+import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.regex.Matcher;
@@ -32,6 +33,7 @@
import org.nuiton.wikitty.Criteria;
import org.nuiton.wikitty.FacetTopic;
import org.nuiton.wikitty.FieldType;
+import org.nuiton.wikitty.FieldType.TYPE;
import org.nuiton.wikitty.PagedResult;
import org.nuiton.wikitty.Wikitty;
import org.nuiton.wikitty.WikittyException;
@@ -162,10 +164,29 @@
if (multiplesValue.startsWith("(") && multiplesValue.endsWith(")")) {
multiplesValue = multiplesValue.substring(1, multiplesValue.length() - 1);
}
- currentWikitty.addToField(extName, fieldName, multiplesValue);
+
+ // remove non existant wikitty on Wikitty type field
+ if (fieldType.getType().equals(TYPE.WIKITTY)) {
+ List<Wikitty> wikitties = ws.restore(securityToken, transaction, Collections.singletonList(multiplesValue));
+ if ( wikitties != null && wikitties.size() == 1) {
+ currentWikitty.addToField(extName, fieldName, multiplesValue);
+ }
+ }
+ else {
+ currentWikitty.addToField(extName, fieldName, multiplesValue);
+ }
}
} else {
- currentWikitty.setField(extName, fieldName, value);
+ // remove non existant wikitty on Wikitty type field
+ if (fieldType.getType().equals(TYPE.WIKITTY)) {
+ List<Wikitty> wikitties = ws.restore(securityToken, transaction, Collections.singletonList(value));
+ if ( wikitties != null && wikitties.size() == 1) {
+ currentWikitty.setField(extName, fieldName, value);
+ }
+ }
+ else {
+ currentWikitty.setField(extName, fieldName, value);
+ }
}
}
}
Modified: trunk/wikitty-api/src/test/java/org/nuiton/wikitty/importexport/ImportExportCSVTest.java
===================================================================
--- trunk/wikitty-api/src/test/java/org/nuiton/wikitty/importexport/ImportExportCSVTest.java 2010-09-23 10:11:58 UTC (rev 337)
+++ trunk/wikitty-api/src/test/java/org/nuiton/wikitty/importexport/ImportExportCSVTest.java 2010-09-23 10:12:47 UTC (rev 338)
@@ -18,12 +18,28 @@
package org.nuiton.wikitty.importexport;
+import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.nuiton.util.StringUtil;
+import org.nuiton.wikitty.Criteria;
+import org.nuiton.wikitty.PagedResult;
+import org.nuiton.wikitty.TreeNode;
+import org.nuiton.wikitty.TreeNodeImpl;
+import org.nuiton.wikitty.WikittyExtension;
+import org.nuiton.wikitty.WikittyImportExportService;
+import org.nuiton.wikitty.WikittyProxy;
+import org.nuiton.wikitty.WikittyService;
+import org.nuiton.wikitty.WikittyUtil;
+import org.nuiton.wikitty.search.Element;
+import org.nuiton.wikitty.search.Search;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* Test for CSV import export class
@@ -34,8 +50,31 @@
* Last update : $Date$
* By : $Author$
*/
+(a)RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations="classpath:META-INF/spring/wikitty-test.xml")
public class ImportExportCSVTest {
+ @Autowired
+ protected WikittyService ws ;
+
+ public WikittyService getWikittyService() {
+ return ws;
+ }
+
+ public void setWikittyService(WikittyService wikittyService) {
+ this.ws = wikittyService;
+ }
+
+ protected static final WikittyExtension extensionClient =
+ new WikittyExtension("Client", "1.0", null,
+ WikittyUtil.buildFieldMapExtension(
+ "String name"));
+
+ protected static final WikittyExtension extensionTag =
+ new WikittyExtension("Tag", "1.0", null,
+ WikittyUtil.buildFieldMapExtension(
+ "String tags"));
+
/**
* Test que le pattern match les bonnes choses.
*/
@@ -107,4 +146,49 @@
Assert.assertEquals(1, result.length);
Assert.assertEquals("toto ?", result[0]);
}
+
+ /**
+ * Test l'import export.
+ */
+ @Test
+ public void testImport() {
+
+ // store required import extension
+ WikittyProxy proxy = new WikittyProxy(ws);
+ proxy.storeExtension(extensionClient);
+ proxy.storeExtension(TreeNodeImpl.extensionTreeNode);
+ proxy.storeExtension(extensionTag);
+
+ // declare import service
+ WikittyImportExportService wsImport = new WikittyImportExportService(null, ws);
+ String[] importFiles = {"/csv/importclient.csv", "/csv/importtree.csv", "/csv/importtree2.csv"};
+ for (String importFile : importFiles) {
+ URL importFileURL = ImportExportCSVTest.class.getResource(importFile);
+ wsImport.syncImportFromUri(WikittyImportExportService.FORMAT.CSV, importFileURL.toExternalForm());
+ }
+
+ // test extension support
+ Criteria criteria = Search.query().eq(Element.ELT_EXTENSION, extensionTag.getName()).criteria();
+ PagedResult<String> pagedResult = ws.findAllByCriteria(null, criteria);
+ Assert.assertEquals(1, pagedResult.getNumFound());
+
+ // test normal import
+ Criteria criteria2 = Search.query().eq(extensionClient.getName() + ".name", "Toto").criteria();
+ PagedResult<String> pagedResult2 = ws.findAllByCriteria(null, criteria2);
+ Assert.assertEquals(1, pagedResult2.getNumFound());
+
+ // test non existant wikitty tree node childreen deletion
+ Criteria criteria3 = Search.query().eq(TreeNode.FQ_FIELD_TREENODE_NAME, "MyTreeNode").criteria();
+ PagedResult<TreeNode> pagedResult3 = proxy.findAllByCriteria(TreeNode.class, criteria3);
+ Assert.assertEquals(1, pagedResult3.getNumFound());
+ TreeNode myTreeNode = pagedResult3.getFirst();
+ Assert.assertEquals(1, myTreeNode.getChildren().size());
+
+ // test des requetes imbriquées
+ Criteria criteria4 = Search.query().eq(TreeNode.FQ_FIELD_TREENODE_PARENT, myTreeNode.getWikittyId()).criteria();
+ PagedResult<TreeNode> pagedResult4 = proxy.findAllByCriteria(TreeNode.class, criteria4);
+ Assert.assertEquals(1, pagedResult4.getNumFound());
+ TreeNode mySubNode = pagedResult4.getFirst();
+ Assert.assertEquals("MySubNode", mySubNode.getName());
+ }
}
Added: trunk/wikitty-api/src/test/resources/csv/importclient.csv
===================================================================
--- trunk/wikitty-api/src/test/resources/csv/importclient.csv (rev 0)
+++ trunk/wikitty-api/src/test/resources/csv/importclient.csv 2010-09-23 10:12:47 UTC (rev 338)
@@ -0,0 +1,2 @@
+"Wikitty.Id","Client.name"
+"fbcc8aed-7f67-4e3c-a9aa-221373765f8d","Toto"
Added: trunk/wikitty-api/src/test/resources/csv/importtree.csv
===================================================================
--- trunk/wikitty-api/src/test/resources/csv/importtree.csv (rev 0)
+++ trunk/wikitty-api/src/test/resources/csv/importtree.csv 2010-09-23 10:12:47 UTC (rev 338)
@@ -0,0 +1,3 @@
+"Wikitty.Id","Wikitty.Ext","TreeNode.name","TreeNode.parent","TreeNode.children"
+"4f6fc798-41f8-48d7-9398-119ef6ab02b6",,"MyRootNode",,
+"1142aa4c-af5a-4264-9918-9f72d9ef9d59","Tag","MyTreeNode","4f6fc798-41f8-48d7-9398-119ef6ab02b6","(fbcc8aed-7f67-4e3c-a9aa-221373765f8d),(677ee1e7-239f-416c-a353-6e56bc0451e2)"
Added: trunk/wikitty-api/src/test/resources/csv/importtree2.csv
===================================================================
--- trunk/wikitty-api/src/test/resources/csv/importtree2.csv (rev 0)
+++ trunk/wikitty-api/src/test/resources/csv/importtree2.csv 2010-09-23 10:12:47 UTC (rev 338)
@@ -0,0 +1,2 @@
+"TreeNode.name","TreeNode.parent"
+"MySubNode","TreeNode.name=MyTreeNode"
1
0
r337 - in trunk/wikitty-api: . src/main src/main/xmi src/test/java/org/nuiton/wikitty/api
by echatellier@users.nuiton.org 23 Sep '10
by echatellier@users.nuiton.org 23 Sep '10
23 Sep '10
Author: echatellier
Date: 2010-09-23 12:11:58 +0200 (Thu, 23 Sep 2010)
New Revision: 337
Url: http://nuiton.org/repositories/revision/wikitty/337
Log:
Move topcased model to argoUML
Added:
trunk/wikitty-api/src/main/xmi/
trunk/wikitty-api/src/main/xmi/wikitty.zargo
Removed:
trunk/wikitty-api/src/main/uml/
Modified:
trunk/wikitty-api/pom.xml
trunk/wikitty-api/src/test/java/org/nuiton/wikitty/api/CommonTest.java
Modified: trunk/wikitty-api/pom.xml
===================================================================
--- trunk/wikitty-api/pom.xml 2010-09-23 09:57:29 UTC (rev 336)
+++ trunk/wikitty-api/pom.xml 2010-09-23 10:11:58 UTC (rev 337)
@@ -123,18 +123,6 @@
<artifactId>wikitty-generators</artifactId>
<version>${project.version}</version>
</dependency>
- <!-- Meta model uml d'eclipse -->
- <dependency>
- <groupId>org.eclipse.uml2.uml</groupId>
- <artifactId>resources</artifactId>
- <version>2.1.0-v200706251652</version>
- <exclusions>
- <exclusion>
- <groupId>org.eclipse.uml2</groupId>
- <artifactId>uml</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
</dependencies>
</plugin>
<!-- Create a jar that includes all tests -->
@@ -162,8 +150,7 @@
<phase>generate-sources</phase>
<configuration>
<inputs>
- <input>zargo:src/main/uml/wikitty-api:*.zargo</input>
- <input>xmi:src/main/uml/wikitty-api:*.uml</input>
+ <input>zargo:src/main/xmi:*.zargo</input>
</inputs>
<fullPackagePath>org.nuiton.wikitty</fullPackagePath>
<defaultPackage>org.nuiton.wikitty</defaultPackage>
Copied: trunk/wikitty-api/src/main/xmi/wikitty.zargo (from rev 333, trunk/wikitty-api/src/main/uml/wikitty-api/wikitty-security.zargo)
===================================================================
(Binary files differ)
Modified: trunk/wikitty-api/src/test/java/org/nuiton/wikitty/api/CommonTest.java
===================================================================
--- trunk/wikitty-api/src/test/java/org/nuiton/wikitty/api/CommonTest.java 2010-09-23 09:57:29 UTC (rev 336)
+++ trunk/wikitty-api/src/test/java/org/nuiton/wikitty/api/CommonTest.java 2010-09-23 10:11:58 UTC (rev 337)
@@ -16,6 +16,8 @@
import org.nuiton.wikitty.ExtensionFactory;
import org.nuiton.wikitty.FieldType;
import org.nuiton.wikitty.FieldType.TYPE;
+import org.nuiton.wikitty.TreeNode;
+import org.nuiton.wikitty.TreeNodeAbstract;
import org.nuiton.wikitty.Wikitty;
import org.nuiton.wikitty.WikittyException;
import org.nuiton.wikitty.WikittyExtension;
@@ -413,4 +415,16 @@
log.info("Time w set: " + timeSetW + " Time w get: " + timeGetW);
log.info("Time z set: " + timeSetZ + " Time z get: " + timeGetZ);
}
+
+ /**
+ * Test que les entités générées sont dans les types attendus.
+ */
+ @Test
+ public void testGeneratedExtensionType() {
+
+ WikittyExtension wikittyExtension = TreeNodeAbstract.extensionTreeNode;
+ Assert.assertEquals(TYPE.WIKITTY, wikittyExtension.getFieldType(TreeNode.FIELD_TREENODE_PARENT).getType());
+ Assert.assertEquals(TYPE.STRING, wikittyExtension.getFieldType(TreeNode.FIELD_TREENODE_NAME).getType());
+ Assert.assertEquals(TYPE.WIKITTY, wikittyExtension.getFieldType(TreeNode.FIELD_TREENODE_CHILDREN).getType());
+ }
}
1
0
r336 - trunk/wikitty-generators/src/main/java/org/nuiton/wikitty/generator
by echatellier@users.nuiton.org 23 Sep '10
by echatellier@users.nuiton.org 23 Sep '10
23 Sep '10
Author: echatellier
Date: 2010-09-23 11:57:29 +0200 (Thu, 23 Sep 2010)
New Revision: 336
Url: http://nuiton.org/repositories/revision/wikitty/336
Log:
Fix wikitty extension generation (WikittyType)
Modified:
trunk/wikitty-generators/src/main/java/org/nuiton/wikitty/generator/BusinessEntityAbstractGenerator.java
Modified: trunk/wikitty-generators/src/main/java/org/nuiton/wikitty/generator/BusinessEntityAbstractGenerator.java
===================================================================
--- trunk/wikitty-generators/src/main/java/org/nuiton/wikitty/generator/BusinessEntityAbstractGenerator.java 2010-09-23 08:41:44 UTC (rev 335)
+++ trunk/wikitty-generators/src/main/java/org/nuiton/wikitty/generator/BusinessEntityAbstractGenerator.java 2010-09-23 09:57:29 UTC (rev 336)
@@ -247,7 +247,11 @@
private void generateAttribute(Writer output, ObjectModelAttribute attr)
throws IOException {
String attrType = computeType(attr);
- if (EugengoUtils.notEmpty(attrType)) {
+ // temp fix, si le type est Wikitty, il doit rester Wikitty dans
+ // la définition de l'extension
+ if ("org.nuiton.wikitty.Wikitty".equals(attr.getType()) || "Wikitty".equals(attr.getType())) {
+ attrType = "Wikitty";
+ } else if (EugengoUtils.notEmpty(attrType)) {
attrType = getType(attrType);
} else {
return;
1
0
r335 - trunk/wikitty-api/src/main/java/org/nuiton/wikitty
by echatellier@users.nuiton.org 23 Sep '10
by echatellier@users.nuiton.org 23 Sep '10
23 Sep '10
Author: echatellier
Date: 2010-09-23 10:41:44 +0200 (Thu, 23 Sep 2010)
New Revision: 335
Url: http://nuiton.org/repositories/revision/wikitty/335
Log:
Fix :
- restriction on element extension
- paged result count
- wikitty restriction error when wikitty doesn't contains entension
Modified:
trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyServiceInMemory.java
Modified: trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyServiceInMemory.java
===================================================================
--- trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyServiceInMemory.java 2010-09-23 07:58:47 UTC (rev 334)
+++ trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyServiceInMemory.java 2010-09-23 08:41:44 UTC (rev 335)
@@ -244,15 +244,24 @@
if ( restriction instanceof BinaryOperator ) {
BinaryOperator binOp = (BinaryOperator) restriction;
- if ( binOp.getElement().equals(Element.ELT_EXTENSION) ) {
+ if ( binOp.getElement().getName().equals(Element.ELT_EXTENSION) ) {
return w.hasExtension(binOp.getValue());
}
-
+
+ // FIXME: 20091104 jru manage search on extension and id
String fqfieldName = binOp.getElement().getName();
if(Element.ELT_EXTENSION.equals(fqfieldName) ||
Element.ELT_ID.equals(fqfieldName)) {
- return true; // FIXME: 20091104 jru manage search on extension and id
+ return true;
}
+
+ // Le check restriction, ne doit pas tester les champs
+ // si les wikitty n'ont meme pas l'extension concerné
+ String[] extName = fqfieldName.split("\\.");
+ if (!w.hasField(extName[0], extName[1])) {
+ return false;
+ }
+
Object o = w.getFqField( fqfieldName );
FieldType t = w.getFieldType(fqfieldName);
Object value = t.getValidValue( binOp.getValue() );
@@ -333,7 +342,7 @@
}
- return new PagedResult<String>(firstIndex, endIndex, criteria.getRestriction().toString(), null, ids );
+ return new PagedResult<String>(firstIndex, ids.size(), criteria.getRestriction().toString(), null, ids );
}
@Override
1
0
r334 - trunk/wikitty-api/src/main/java/org/nuiton/wikitty
by echatellier@users.nuiton.org 23 Sep '10
by echatellier@users.nuiton.org 23 Sep '10
23 Sep '10
Author: echatellier
Date: 2010-09-23 09:58:47 +0200 (Thu, 23 Sep 2010)
New Revision: 334
Url: http://nuiton.org/repositories/revision/wikitty/334
Log:
Fix message confusant
Modified:
trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyImpl.java
Modified: trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyImpl.java
===================================================================
--- trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyImpl.java 2010-09-22 12:36:37 UTC (rev 333)
+++ trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyImpl.java 2010-09-23 07:58:47 UTC (rev 334)
@@ -298,7 +298,7 @@
WikittyExtension ext = getExtension(field[0]);
if (ext == null) {
throw new WikittyException(String.format(
- "extension '%s' doesn't exists", field[0]));
+ "Extension '%s' doesn't exists on wikitty '%s'", field[0], id));
} else {
String fieldName = field[1];
int crochet = fieldName.indexOf("[");
1
0
r333 - trunk/wikitty-api/src/main/java/org/nuiton/wikitty
by echatellier@users.nuiton.org 22 Sep '10
by echatellier@users.nuiton.org 22 Sep '10
22 Sep '10
Author: echatellier
Date: 2010-09-22 14:36:37 +0200 (Wed, 22 Sep 2010)
New Revision: 333
Url: http://nuiton.org/repositories/revision/wikitty/333
Log:
Clarification des messages de log lorsque qu'un evenement ne doit pas ?\195?\170tre envoy?\195?\169
Modified:
trunk/wikitty-api/src/main/java/org/nuiton/wikitty/JGroupsNotifier.java
Modified: trunk/wikitty-api/src/main/java/org/nuiton/wikitty/JGroupsNotifier.java
===================================================================
--- trunk/wikitty-api/src/main/java/org/nuiton/wikitty/JGroupsNotifier.java 2010-09-22 12:30:43 UTC (rev 332)
+++ trunk/wikitty-api/src/main/java/org/nuiton/wikitty/JGroupsNotifier.java 2010-09-22 12:36:37 UTC (rev 333)
@@ -29,7 +29,6 @@
import org.jgroups.JChannel;
import org.jgroups.Message;
import org.jgroups.ReceiverAdapter;
-import org.jgroups.stack.IpAddress;
/**
* JGroups notifier.
@@ -199,7 +198,7 @@
}
else {
if (log.isDebugEnabled()) {
- log.debug("Put wikitty event skipped");
+ log.debug("Not master cache, do not propagate putWikitty event");
}
}
}
@@ -214,7 +213,7 @@
}
else {
if (log.isDebugEnabled()) {
- log.debug("Remove wikitty event skipped");
+ log.debug("Not master cache, do not propagate removeWikitty event");
}
}
}
@@ -229,7 +228,7 @@
}
else {
if (log.isDebugEnabled()) {
- log.debug("Clear wikitty event skipped");
+ log.debug("Not master cache, do not propagate clearWikitty event");
}
}
}
@@ -244,7 +243,7 @@
}
else {
if (log.isDebugEnabled()) {
- log.debug("Put extension event skipped");
+ log.debug("Not master cache, do not propagate putExtension event");
}
}
}
@@ -259,7 +258,7 @@
}
else {
if (log.isDebugEnabled()) {
- log.debug("Remove extension event skipped");
+ log.debug("Not master cache, do not propagate removeExtension event");
}
}
}
@@ -274,7 +273,7 @@
}
else {
if (log.isDebugEnabled()) {
- log.debug("Clear extension event skipped");
+ log.debug("Not master cache, do not propagate clearExtension event");
}
}
}
1
0
r332 - trunk/wikitty-api/src/main/java/org/nuiton/wikitty
by echatellier@users.nuiton.org 22 Sep '10
by echatellier@users.nuiton.org 22 Sep '10
22 Sep '10
Author: echatellier
Date: 2010-09-22 14:30:43 +0200 (Wed, 22 Sep 2010)
New Revision: 332
Url: http://nuiton.org/repositories/revision/wikitty/332
Log:
Move log to info level and add more information
Modified:
trunk/wikitty-api/src/main/java/org/nuiton/wikitty/JGroupsNotifier.java
Modified: trunk/wikitty-api/src/main/java/org/nuiton/wikitty/JGroupsNotifier.java
===================================================================
--- trunk/wikitty-api/src/main/java/org/nuiton/wikitty/JGroupsNotifier.java 2010-09-22 08:32:07 UTC (rev 331)
+++ trunk/wikitty-api/src/main/java/org/nuiton/wikitty/JGroupsNotifier.java 2010-09-22 12:30:43 UTC (rev 332)
@@ -29,6 +29,7 @@
import org.jgroups.JChannel;
import org.jgroups.Message;
import org.jgroups.ReceiverAdapter;
+import org.jgroups.stack.IpAddress;
/**
* JGroups notifier.
@@ -111,8 +112,9 @@
// don't receive messages sent by myself
channel.setOpt(Channel.LOCAL, false);
- if (log.isDebugEnabled()) {
- log.debug("JGroup communication channel initialized to " + channel.getAddressAsString());
+ if (log.isInfoEnabled()) {
+ log.info("JGroup communication channel initialized to " + channel.getAddressAsString() + " (" + channel.getClusterName() + ")");
+ log.info("Channel view: " + channel.getView());
}
}
catch (ChannelException eee) {
1
0
r331 - in branches/wikitty-eugene-migration/wikitty-api/src: main/java/org/nuiton/wikitty test/java/org/nuiton/wikitty/layers test/resources
by bleny@users.nuiton.org 22 Sep '10
by bleny@users.nuiton.org 22 Sep '10
22 Sep '10
Author: bleny
Date: 2010-09-22 10:32:07 +0200 (Wed, 22 Sep 2010)
New Revision: 331
Url: http://nuiton.org/repositories/revision/wikitty/331
Log:
start of wikitty security layer implementation + test
Modified:
branches/wikitty-eugene-migration/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyService.java
branches/wikitty-eugene-migration/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyServiceSecurity.java
branches/wikitty-eugene-migration/wikitty-api/src/test/java/org/nuiton/wikitty/layers/AbstractWikittyServiceTest.java
branches/wikitty-eugene-migration/wikitty-api/src/test/java/org/nuiton/wikitty/layers/WikittyServiceCachedTest.java
branches/wikitty-eugene-migration/wikitty-api/src/test/java/org/nuiton/wikitty/layers/WikittyServiceSecurityTest.java
branches/wikitty-eugene-migration/wikitty-api/src/test/resources/log4j.properties
Modified: branches/wikitty-eugene-migration/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyService.java
===================================================================
--- branches/wikitty-eugene-migration/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyService.java 2010-09-22 08:14:49 UTC (rev 330)
+++ branches/wikitty-eugene-migration/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyService.java 2010-09-22 08:32:07 UTC (rev 331)
@@ -392,8 +392,8 @@
String wikittyId, Criteria filter);
/**
- * Retrieve all wikitties children with count (no recursively) of an other one
- * Wikitty reference by wikittyId MUST include the 'Node' extension
+ * Retrieve all wikitties children (no recursively) with count (recursively)
+ * of an other one Wikitty reference by wikittyId MUST include the 'Node' extension
*
* @param wikittyId
* @return
Modified: branches/wikitty-eugene-migration/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyServiceSecurity.java
===================================================================
--- branches/wikitty-eugene-migration/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyServiceSecurity.java 2010-09-22 08:14:49 UTC (rev 330)
+++ branches/wikitty-eugene-migration/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyServiceSecurity.java 2010-09-22 08:32:07 UTC (rev 331)
@@ -156,15 +156,11 @@
public String getUserWikittyId(String securityToken, String login) {
String userId = getUserId(securityToken);
String userWikittyId = null;
-// if (isAppAdmin(securityToken, userId)) {
- Wikitty user = ws.findByCriteria(null, Search.query().eq(
- WikittyUser.FQ_FIELD_WIKITTYUSER_LOGIN, login).criteria());
- if (user != null) {
- userWikittyId = user.getId();
- }
-// } else {
-// throw new SecurityException("Only admin can do that");
-// }
+ Wikitty user = ws.findByCriteria(null, Search.query().eq(
+ WikittyUser.FQ_FIELD_WIKITTYUSER_LOGIN, login).criteria());
+ if (user != null) {
+ userWikittyId = user.getId();
+ }
return userWikittyId;
}
@@ -237,7 +233,19 @@
}
return wikittyAuthorisation;
}
+
+ public void storeExtensionAuthorisation(String securityToken,
+ Wikitty extensionPolicy) {
+ String userId = getUserId(securityToken);
+
+ // check rights to modify rights on this extension
+
+ // check that the wikitty does not have
+
+
+ }
+
/** true if userId has the right to write on extension */
protected boolean canRead(String securityToken, String userId, Wikitty extensionRights) {
boolean canRead = isReader(securityToken, userId, extensionRights)
@@ -283,23 +291,36 @@
@Override
public UpdateResponse store(String securityToken, Wikitty wikitty) {
Collection<Wikitty> wikitties = Arrays.asList(wikitty);
- return store(securityToken, wikitties);
+ wikitties = removeUnauthorizedModifications(securityToken, wikitties);
+ UpdateResponse result = ws.store(securityToken, wikitties);
+ return result;
}
@Override
public UpdateResponse store(String securityToken, Collection<Wikitty> wikitties) {
- return store(securityToken, wikitties, false);
+ Collection<Wikitty> wikittiesToStore = removeUnauthorizedModifications(securityToken, wikitties);
+ UpdateResponse result = ws.store(securityToken, wikittiesToStore);
+ return result;
}
@Override
public UpdateResponse store(String securityToken, Collection<Wikitty> wikitties, boolean disableAutoVersionIncrement) {
+ Collection<Wikitty> wikittiesToStore = removeUnauthorizedModifications(securityToken, wikitties);
+ UpdateResponse result = ws.store(securityToken, wikittiesToStore, disableAutoVersionIncrement);
+ return result;
+ }
+
+ /**
+ *
+ */
+ protected Collection<Wikitty> removeUnauthorizedModifications(String securityToken, Collection<Wikitty> wikitties) {
String userId = getUserId(securityToken);
List<Wikitty> wikittiesToStore = new ArrayList<Wikitty>(wikitties);
for (Wikitty wikitty : wikitties) {
- Wikitty oldVersion = ws.restore(securityToken, wikitty.getId());
+ Wikitty oldVersion = ws.restore(null, wikitty.getId());
// check that the wikitty does not have
if (WikittyAuthorisationHelper.isExtension(wikitty)) {
@@ -307,37 +328,26 @@
if (oldVersion == null) {
// if this exception is raised, you should use addWikittyAuthorisation()
throw new IllegalArgumentException("you can't store an authorisation for the fist time");
+
} else {
if ( canAdmin(securityToken, userId, oldVersion)) {
- System.out.println("!!!" + oldVersion);
-
- // admin can't change owner, admin or parent
- // putting back old values
- Object oldValue;
+ if (isAdmin(securityToken, userId, oldVersion)) {
+ // admin can't change owner, admin or parent
+ // putting back old values
+ Object oldValue = oldVersion.getFieldAsObject(
+ WikittyAuthorisation.EXT_WIKITTYAUTHORISATION,
+ WikittyAuthorisation.FIELD_WIKITTYAUTHORISATION_OWNER);
+ wikitty.setField(WikittyAuthorisation.EXT_WIKITTYAUTHORISATION,
+ WikittyAuthorisation.FIELD_WIKITTYAUTHORISATION_OWNER,
+ oldValue);
- oldValue = oldVersion.getFieldAsObject(
- WikittyAuthorisation.EXT_WIKITTYAUTHORISATION,
- WikittyAuthorisation.FIELD_WIKITTYAUTHORISATION_OWNER);
- wikitty.setField(WikittyAuthorisation.EXT_WIKITTYAUTHORISATION,
- WikittyAuthorisation.FIELD_WIKITTYAUTHORISATION_OWNER,
- oldValue);
- /*
- oldValue = oldVersion.getFieldAsObject(
- WikittyAuthorisation.EXT_WIKITTYAUTHORISATION,
- WikittyAuthorisation.FIELD_WIKITTYAUTHORISATION_ADMIN);
- System.out.println("will preserve" + oldValue);
- wikitty.setField(WikittyAuthorisation.EXT_WIKITTYAUTHORISATION,
- WikittyAuthorisation.FIELD_WIKITTYAUTHORISATION_ADMIN,
- oldValue);
- /*
- oldValue = oldVersion.getFieldAsObject(
- WikittyAuthorisation.EXT_WIKITTYAUTHORISATION,
- WikittyAuthorisation.FIELD_WIKITTYAUTHORISATION_PARENT);
- wikitty.setField(WikittyAuthorisation.EXT_WIKITTYAUTHORISATION,
- WikittyAuthorisation.FIELD_WIKITTYAUTHORISATION_PARENT,
- oldValue);*/
+ WikittyAuthorisationHelper.setOwner(wikitty,
+ WikittyAuthorisationHelper.getOwner(oldVersion));
+ WikittyAuthorisationHelper.setParent(wikitty,
+ WikittyAuthorisationHelper.getParent(oldVersion));
+ }
} else {
// if not admin, ignore this wikitty, this user has no right to modify rights
@@ -345,20 +355,25 @@
}
}
} else {
-
- if (oldVersion == null) {
- // it's a creation
+ // usual case, a user want to store a wikitty
+
+ if (oldVersion == null) { // it's a creation
// check that **reader** right on Security for all extension
- } else {
- // it's an update
+
+ } else { // it's an update
+
for (WikittyExtension extension : wikitty.getExtensions()) {
Wikitty extensionRights = restoreExtensionAuthorisation(securityToken, extension);
-
+
if (extensionRights != null) {
if ( ! canWrite(securityToken, userId, extensionRights)) {
-
+
+ // the user doesn't have the rights to write
+ // on the fields of extension. Moving back
+ // values to the old one
+
for (String fieldName : extension.getFieldNames()) {
if (oldVersion == null) {
wikitty.setField(extension.getName(), fieldName, null);
@@ -373,14 +388,15 @@
}
}
}
- UpdateResponse result = ws.store(securityToken, wikittiesToStore, disableAutoVersionIncrement);
- return result;
+
+ return wikittiesToStore;
}
@Override
public UpdateResponse store(String securityToken, WikittyTransaction transaction, Collection<Wikitty> wikitties, boolean disableAutoVersionIncrement) {
- // FIXME 20100825 bleny implement it without copy/paste code
- throw new UnsupportedOperationException();
+ Collection<Wikitty> wikittiesToStore = removeUnauthorizedModifications(securityToken, wikitties);
+ UpdateResponse result = ws.store(securityToken, transaction, wikittiesToStore, disableAutoVersionIncrement);
+ return result;
}
@Override
@@ -443,6 +459,7 @@
secureDelete(securityToken, idsAsList);
}
+ /** delete wikitties only if user has right to */
protected void secureDelete(String securityToken, List<String> ids) {
String userId = getUserId(securityToken);
@@ -500,6 +517,10 @@
public UpdateResponse storeExtension(String securityToken,
Collection<WikittyExtension> exts) {
// TODO poussin 20100607 check security, mais qui a le droit ?
+
+
+
+
return ws.storeExtension(securityToken, exts);
}
Modified: branches/wikitty-eugene-migration/wikitty-api/src/test/java/org/nuiton/wikitty/layers/AbstractWikittyServiceTest.java
===================================================================
--- branches/wikitty-eugene-migration/wikitty-api/src/test/java/org/nuiton/wikitty/layers/AbstractWikittyServiceTest.java 2010-09-22 08:14:49 UTC (rev 330)
+++ branches/wikitty-eugene-migration/wikitty-api/src/test/java/org/nuiton/wikitty/layers/AbstractWikittyServiceTest.java 2010-09-22 08:32:07 UTC (rev 331)
@@ -8,7 +8,7 @@
import org.nuiton.wikitty.WikittyImpl;
import org.nuiton.wikitty.WikittyService;
-public class AbstractWikittyServiceTest {
+public abstract class AbstractWikittyServiceTest {
/** a wikitty service (in memory) with a cache */
protected WikittyService service;
@@ -28,7 +28,6 @@
/** create a service, an extension, a wikitty, login, and store wikitty */
@Before
public void setUp() throws Exception {
-
extension = ExtensionFactory.create(EXT_NAME, "1")
.addField(FIELD_NAME, TYPE.STRING)
.extension();
Modified: branches/wikitty-eugene-migration/wikitty-api/src/test/java/org/nuiton/wikitty/layers/WikittyServiceCachedTest.java
===================================================================
--- branches/wikitty-eugene-migration/wikitty-api/src/test/java/org/nuiton/wikitty/layers/WikittyServiceCachedTest.java 2010-09-22 08:14:49 UTC (rev 330)
+++ branches/wikitty-eugene-migration/wikitty-api/src/test/java/org/nuiton/wikitty/layers/WikittyServiceCachedTest.java 2010-09-22 08:32:07 UTC (rev 331)
@@ -15,19 +15,19 @@
/** test {@link WikittyServiceCached} */
public class WikittyServiceCachedTest extends AbstractWikittyServiceTest {
-
+
@Before
public void setUpWikittyServiceCachedTest() {
service = new WikittyServiceCached(new WikittyServiceInMemory());
token = service.login(null, null);
- service.store(token, aWikitty);
+ service.store(token, aWikitty);
}
/** setting a field value doesn't corrupt cache */
@Test
public void testRestore() throws Exception {
Wikitty anotherWikitty = service.restore(token, aWikitty.getId());
-
+
// we set the value of a field
anotherWikitty.setField(EXT_NAME, FIELD_NAME, "myothervalue");
@@ -79,5 +79,5 @@
assertEquals(anotherWikitty, yetAnotherWikitty);
assertNotSame(anotherWikitty, yetAnotherWikitty); // two different objects
}
-
+
}
Modified: branches/wikitty-eugene-migration/wikitty-api/src/test/java/org/nuiton/wikitty/layers/WikittyServiceSecurityTest.java
===================================================================
--- branches/wikitty-eugene-migration/wikitty-api/src/test/java/org/nuiton/wikitty/layers/WikittyServiceSecurityTest.java 2010-09-22 08:14:49 UTC (rev 330)
+++ branches/wikitty-eugene-migration/wikitty-api/src/test/java/org/nuiton/wikitty/layers/WikittyServiceSecurityTest.java 2010-09-22 08:32:07 UTC (rev 331)
@@ -1,10 +1,13 @@
package org.nuiton.wikitty.layers;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.junit.Before;
import org.junit.Test;
import org.nuiton.wikitty.TreeNodeAbstract;
@@ -17,6 +20,8 @@
/** test {@link org.nuiton.wikitty.WikittyServiceSecurity} */
public class WikittyServiceSecurityTest extends AbstractWikittyServiceTest {
+
+ private static final Log log = LogFactory.getLog(WikittyServiceSecurityTest.class);
protected static final String APPADMIN_LOGIN = WikittyServiceSecurity.APPADMIN_LOGIN;
protected static final String APPADMIN_PASSWORD = WikittyServiceSecurity.APPADMIN_PASSWORD;
@@ -44,23 +49,28 @@
securityService.createAccount(token, "writer", "");
securityService.createAccount(token, "admin", "");
securityService.createAccount(token, "owner", "");
-
-
+
Wikitty authorizations = securityService.addWikittyAuthorisation(token, extension);
WikittyAuthorisationHelper.addReader(authorizations, securityService.getUserWikittyId(token, "reader"));
WikittyAuthorisationHelper.addWriter(authorizations, securityService.getUserWikittyId(token, "writer"));
WikittyAuthorisationHelper.addAdmin(authorizations, securityService.getUserWikittyId(token, "admin"));
WikittyAuthorisationHelper.setOwner(authorizations, securityService.getUserWikittyId(token, "owner"));
+
+ log.debug("initial wikitty rights" + authorizations);
+
service.store(token, authorizations);
-
+
+ Wikitty extensionAuthorisation = securityService.restoreExtensionAuthorisation(token, extension);
+ log.debug("restored initial rights " + extensionAuthorisation);
+
service.logout(token);
token = null;
-
+
+ ownerToken = service.login("owner", "");
+ adminToken = service.login("admin", "");
+ writerToken = service.login("writer", "");
+ readerToken = service.login("reader", "");
noRightsToken = service.login("i have no rights", "");
- readerToken = service.login("reader", "");
- writerToken = service.login("writer", "");
- adminToken = service.login("admin", "");
- ownerToken = service.login("owner", "");
}
@Test
@@ -150,24 +160,46 @@
assertEquals(VALUE + VALUE, service.restore(readerToken, aWikittyId)
.getFieldAsString(EXT_NAME, FIELD_NAME));
}
-
+
@Test
public void testAdmin() {
- // FIXME 20108027 assertions missing, test fail
-
Wikitty extensionAuthorisation = securityService.restoreExtensionAuthorisation(adminToken, extension);
- System.out.println("before " + extensionAuthorisation);
+ log.debug("initial rights " + extensionAuthorisation);
+ // set no reader, ID1 as single writer and ID2 as owner
WikittyAuthorisationHelper.clearReader(extensionAuthorisation);
WikittyAuthorisationHelper.clearWriter(extensionAuthorisation);
- WikittyAuthorisationHelper.addWriter(extensionAuthorisation, "ID1"); // securityService.getUserWikittyId(adminToken, "admin"));
- WikittyAuthorisationHelper.setOwner(extensionAuthorisation, "ID2"); // securityService.getUserWikittyId(adminToken, "admin"));
+ WikittyAuthorisationHelper.addWriter(extensionAuthorisation, "ID1");
+ WikittyAuthorisationHelper.setOwner(extensionAuthorisation, "ID2");
+ // FIXME 20100920 bleny this instruction mekes the test fail by clearing
+ // the admin field. There is a side effect on the stored wikitty and restored
+ // wikitty in store (oldVersion) has "admin" field empty
+ // WikittyAuthorisationHelper.clearAdmin(extensionAuthorisation);
+
+ log.debug("will store rights " + extensionAuthorisation);
service.store(adminToken, extensionAuthorisation);
-
- System.out.println("after " + service.restore(adminToken, extensionAuthorisation.getId()));
+
+ // now, restore and check that rights are preserved
+ extensionAuthorisation = service.restore(adminToken, extensionAuthorisation.getId());
+
+ log.debug("restored rights " + extensionAuthorisation);
+
+ // check that reader changes has been saved
+ assertTrue(WikittyAuthorisationHelper.getReader(extensionAuthorisation).isEmpty());
+
+ // check that ID1 is writer
+ assertTrue(WikittyAuthorisationHelper.getWriter(extensionAuthorisation).contains("ID1"));
+ // ... and no one else
+ assertEquals(1, WikittyAuthorisationHelper.getWriter(extensionAuthorisation).size());
+
+ // check that admin is not modified
+ assertFalse(WikittyAuthorisationHelper.getAdmin(extensionAuthorisation).isEmpty());
+
+ // check that ID2 is NOT owner (admin should not be able to change owner)
+ assertFalse(WikittyAuthorisationHelper.getOwner(extensionAuthorisation).equals("ID2"));
}
}
Modified: branches/wikitty-eugene-migration/wikitty-api/src/test/resources/log4j.properties
===================================================================
--- branches/wikitty-eugene-migration/wikitty-api/src/test/resources/log4j.properties 2010-09-22 08:14:49 UTC (rev 330)
+++ branches/wikitty-eugene-migration/wikitty-api/src/test/resources/log4j.properties 2010-09-22 08:32:07 UTC (rev 331)
@@ -9,3 +9,4 @@
log4j.logger.org.nuiton.wikitty=WARN
log4j.logger.org.nuiton.wikitty.WikittyServiceSecurity=TRACE
+log4j.logger.org.nuiton.wikitty.layers=TRACE
\ No newline at end of file
1
0
r330 - in branches/wikitty-eugene-migration/wikitty-solr-impl: . src/main/java/org/nuiton/wikitty/solr src/test/java/org/nuiton/wikitty/solr/test src/test/resources
by bleny@users.nuiton.org 22 Sep '10
by bleny@users.nuiton.org 22 Sep '10
22 Sep '10
Author: bleny
Date: 2010-09-22 10:14:49 +0200 (Wed, 22 Sep 2010)
New Revision: 330
Url: http://nuiton.org/repositories/revision/wikitty/330
Log:
removed Spring dependency (code+pom), fix solrconfig for tests, added a non-regression test (child not removed in index)
Added:
branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/resources/solrconfig.xml
Removed:
branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/resources/META-INF/
Modified:
branches/wikitty-eugene-migration/wikitty-solr-impl/pom.xml
branches/wikitty-eugene-migration/wikitty-solr-impl/src/main/java/org/nuiton/wikitty/solr/WikittySearchEnginSolr.java
branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/solr/test/AbstractTestSolr.java
branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/solr/test/SolrSearchTest.java
branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/solr/test/SolrServerTest.java
branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/solr/test/TreeTest.java
Modified: branches/wikitty-eugene-migration/wikitty-solr-impl/pom.xml
===================================================================
--- branches/wikitty-eugene-migration/wikitty-solr-impl/pom.xml 2010-09-21 15:40:14 UTC (rev 329)
+++ branches/wikitty-eugene-migration/wikitty-solr-impl/pom.xml 2010-09-22 08:14:49 UTC (rev 330)
@@ -60,21 +60,6 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
Modified: branches/wikitty-eugene-migration/wikitty-solr-impl/src/main/java/org/nuiton/wikitty/solr/WikittySearchEnginSolr.java
===================================================================
--- branches/wikitty-eugene-migration/wikitty-solr-impl/src/main/java/org/nuiton/wikitty/solr/WikittySearchEnginSolr.java 2010-09-21 15:40:14 UTC (rev 329)
+++ branches/wikitty-eugene-migration/wikitty-solr-impl/src/main/java/org/nuiton/wikitty/solr/WikittySearchEnginSolr.java 2010-09-22 08:14:49 UTC (rev 330)
@@ -130,7 +130,7 @@
if (searchField.length >= 3) {
String fieldNameType = searchField[2];
- TYPE type = FieldType.TYPE.valueOf(fieldNameType);
+ TYPE type = FieldType.TYPE.valueOf(fieldNameType);
result = WikittySearchEnginSolr.getSolrFieldName(fqfieldname, type);
return result;
}
@@ -165,13 +165,18 @@
/**
* Helper to get information nodes and elements for reindexation.
*/
- protected class ReindexChildTreeNode {
+ static protected class ReindexChildTreeNode {
+ protected SolrResource solrResource;
+ protected SolrServer solrServer;
+
protected Map<String, Collection<String>> includedNodeIds;
protected Map<String, Collection<String>> excludedNodeIds;
protected Map<String, String> parents;
- public ReindexChildTreeNode() {
+ public ReindexChildTreeNode(SolrServer solrServer, SolrResource solrResource) {
+ this.solrServer = solrServer;
+ this.solrResource = solrResource;
includedNodeIds = new HashMap<String, Collection<String>>();
excludedNodeIds = new HashMap<String, Collection<String>>();
parents = new HashMap<String, String>();
@@ -235,7 +240,7 @@
// If not found in map, search in index
if(parentId == null) {
- SolrDocument doc = WikittySearchEnginSolr.this.findById(nodeId);
+ SolrDocument doc = findById(solrServer, nodeId);
if(doc == null) {
// is root
return null;
@@ -278,19 +283,25 @@
doc = new SolrInputDocument();
// Copy old field value
- SolrDocument found = findById(id);
- Collection<String> fieldNames = found.getFieldNames();
- for (String fieldName : fieldNames) {
- Collection<Object> fieldValues = found.getFieldValues(fieldName);
+ SolrDocument found = findById(solrServer, id);
+ if (found != null) {
+ Collection<String> fieldNames = found.getFieldNames();
+ for (String fieldName : fieldNames) {
+ Collection<Object> fieldValues = found.getFieldValues(fieldName);
+
+ if(!fieldName.startsWith(TREENODE_PREFIX)) {
+ for (Object fieldValue : fieldValues) {
+ doc.addField(fieldName, fieldValue);
+ }
+ }
+ }
- if(!fieldName.startsWith(TREENODE_PREFIX)) {
- for (Object fieldValue : fieldValues) {
- doc.addField(fieldName, fieldValue);
- }
+ solrResource.addDoc(id, doc);
+ } else {
+ if (log.isWarnEnabled()) {
+ log.warn("Can't find wikitty id '" + id + "' in index. Skip this wikitty.");
}
}
-
- solrResource.addDoc(id, doc);
}
// Add tree node fields
@@ -298,7 +309,8 @@
Collection<String> excludedChildNodeIds = getExcludedNodeIds(id);
// Find all node contain child
- SolrQuery query = new SolrQuery(SOLR_QUERY_PARSER + TreeNode.FQ_FIELD_TREENODE_CHILDREN + "_s:" + id);
+ SolrQuery query = new SolrQuery(SOLR_QUERY_PARSER
+ + TreeNode.FQ_FIELD_TREENODE_CHILDREN + "_s:" + id);
QueryResponse response = solrServer.query(query);
SolrDocumentList updateDocs = response.getResults();
@@ -346,12 +358,14 @@
/**
* Use to plug solr indexation in JTA transaction.
*/
- protected class SolrResource implements OnePhaseResource {
+ static protected class SolrResource implements OnePhaseResource {
+ protected SolrServer solrServer;
protected ThreadLocal<Map<String, SolrInputDocument>> addedDocs;
protected ThreadLocal<List<String>> deletedDocs;
- public SolrResource() {
+ public SolrResource(SolrServer solrServer) {
+ this.solrServer = solrServer;
addedDocs = new ThreadLocal<Map<String, SolrInputDocument>>();
deletedDocs = new ThreadLocal<List<String>>();
@@ -482,7 +496,7 @@
solrServer = new EmbeddedSolrServer(coreContainer, "");
fieldModifier = new TypeFieldModifer(extensionStorage);
- solrResource = new SolrResource();
+ solrResource = new SolrResource(solrServer);
} catch (Exception eee) {
throw new WikittyException(eee);
@@ -503,7 +517,8 @@
public UpdateResponse store(WikittyTransaction transaction, Collection<Wikitty> wikitties) {
try {
solrResource.init();
- ReindexChildTreeNode reindexChildTreeNode = new ReindexChildTreeNode();
+ ReindexChildTreeNode reindexChildTreeNode =
+ new ReindexChildTreeNode(solrServer, solrResource);
for (Wikitty w : wikitties) {
String id = w.getId();
@@ -513,7 +528,7 @@
reindexChildTreeNode.putIncludedChildren(id, children);
// Search deleted children
- SolrDocument treeNodeDoc = findById(id);
+ SolrDocument treeNodeDoc = findById(solrServer, id);
if(treeNodeDoc != null) {
Collection oldChildren = treeNodeDoc.getFieldValues(TreeNode.FQ_FIELD_TREENODE_CHILDREN + "_s");
if(oldChildren != null) {
@@ -557,7 +572,8 @@
public UpdateResponse delete(WikittyTransaction transaction, Collection<String> ids) throws WikittyException {
try {
solrResource.init();
- ReindexChildTreeNode reindexChildTreeNode = new ReindexChildTreeNode();
+ ReindexChildTreeNode reindexChildTreeNode =
+ new ReindexChildTreeNode(solrServer, solrResource);
for (String id : ids) {
// Find child in node id
@@ -753,7 +769,7 @@
parent = TREENODE_PREFIX + parent;
}
- // Find count with facet, if the node not contain recurcively content,
+ // Find count with facet, if the node not contain recursively content,
// the node not found with facet
Criteria criteria = Search.query(filter).eq(parent, wikittyId).criteria()
.setFirstIndex(0).setEndIndex(0)
@@ -862,7 +878,7 @@
/**
* Find solr document by id
*/
- protected SolrDocument findById(String id) {
+ static protected SolrDocument findById(SolrServer solrServer, String id) {
SolrQuery query = new SolrQuery("id:" + id);
QueryResponse response;
try {
Modified: branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/solr/test/AbstractTestSolr.java
===================================================================
--- branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/solr/test/AbstractTestSolr.java 2010-09-21 15:40:14 UTC (rev 329)
+++ branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/solr/test/AbstractTestSolr.java 2010-09-22 08:14:49 UTC (rev 330)
@@ -1,31 +1,12 @@
package org.nuiton.wikitty.solr.test;
-import org.junit.runner.RunWith;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
import org.junit.Before;
-import org.nuiton.wikitty.WikittySearchEngin;
import org.nuiton.wikitty.WikittyService;
-import org.springframework.beans.factory.annotation.Autowired;
-(a)RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations="classpath:META-INF/spring/wikitty-test.xml")
public abstract class AbstractTestSolr {
- @Autowired
- protected WikittyService ws;
+ protected WikittyService ws = new WikittyServiceSolr();
- public void setWikittyService(WikittyService service) {
- ws = service;
- }
-
- public WikittyService getWikittyService() {
- return ws;
- }
-
- WikittySearchEngin engine;
-
@Before
public void deleteAll() throws Exception {
WikittyServiceSolr hbaseService = ((WikittyServiceSolr) ws);
Modified: branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/solr/test/SolrSearchTest.java
===================================================================
--- branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/solr/test/SolrSearchTest.java 2010-09-21 15:40:14 UTC (rev 329)
+++ branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/solr/test/SolrSearchTest.java 2010-09-22 08:14:49 UTC (rev 330)
@@ -5,7 +5,6 @@
import java.util.ArrayList;
import java.util.Calendar;
-import java.util.Date;
import java.util.List;
import org.apache.commons.logging.Log;
@@ -29,7 +28,7 @@
public class SolrSearchTest extends AbstractTestSolr {
- static private Log log = LogFactory.getLog(SolrSearchTest.class);
+ private static final Log log = LogFactory.getLog(SolrSearchTest.class);
protected WikittyExtension extCategory;
protected WikittyExtension extProduct;
Modified: branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/solr/test/SolrServerTest.java
===================================================================
--- branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/solr/test/SolrServerTest.java 2010-09-21 15:40:14 UTC (rev 329)
+++ branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/solr/test/SolrServerTest.java 2010-09-22 08:14:49 UTC (rev 330)
@@ -34,7 +34,6 @@
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
-import org.springframework.test.annotation.ExpectedException;
/**
* Test behaviour SolrServer embedded.
@@ -45,12 +44,12 @@
* Last update: $Date$
* by : $Author$
*/
-public class SolrServerTest extends AbstractTestSolr {
+public class SolrServerTest {
/** to use log facility, just put in your code: log.info(\"...\"); */
- static private Log log = LogFactory.getLog(SolrServerTest.class);
+ private static final Log log = LogFactory.getLog(SolrServerTest.class);
- public SolrServer getSolrServer() throws Exception {
+ public SolrServer newSolrServer() throws Exception {
CoreContainer.Initializer initializer = new CoreContainer.Initializer();
CoreContainer coreContainer = initializer.initialize();
SolrServer solrServer = new EmbeddedSolrServer(coreContainer, "");
@@ -112,16 +111,15 @@
@Before
public void clearIndex() throws Exception {
- SolrServer solrServer = getSolrServer();
+ SolrServer solrServer = newSolrServer();
solrServer.deleteByQuery("*:*");
solrServer.commit();
}
- @Test
- @ExpectedException(value=SolrServerException.class)
+ @Test(expected=SolrServerException.class)
public void testLockObtainFailed() throws Exception {
- SolrServer solrServer1 = getSolrServer();
- SolrServer solrServer2 = getSolrServer();
+ SolrServer solrServer1 = newSolrServer();
+ SolrServer solrServer2 = newSolrServer();
addDocument(solrServer1, "1", "1");
addDocument(solrServer2, "2", "2");
@@ -136,9 +134,10 @@
* De plus ce test est la seule cause des erreurs de build de ces derniers temps.
* Et il y a un commentaire laissant planer le doute un peu plus bas.
*/
- //@Test
+ @Ignore
+ @Test
public void test2Threads1SolrServer() throws Exception {
- SolrServer solrServer = getSolrServer();
+ SolrServer solrServer = newSolrServer();
ThreadAddDocument thread1 = new ThreadAddDocument(solrServer, "1", true);
ThreadAddDocument thread2 = new ThreadAddDocument(solrServer, "2", false);
@@ -158,8 +157,8 @@
@Test
public void test2Threads1Writer2SolrServers() throws Exception {
- SolrServer solrServer1 = getSolrServer();
- SolrServer solrServer2 = getSolrServer();
+ SolrServer solrServer1 = newSolrServer();
+ SolrServer solrServer2 = newSolrServer();
ThreadAddDocument thread1 = new ThreadAddDocument(solrServer1, "1", true);
ThreadAddDocument thread2 = new ThreadAddDocument(solrServer2, "2", false);
@@ -175,7 +174,7 @@
result = findById(solrServer2, "2");
assertNull(result);
- SolrServer solrServer3 = getSolrServer();
+ SolrServer solrServer3 = newSolrServer();
result = findById(solrServer3, "1");
assertNotNull(result);
result = findById(solrServer3, "2");
@@ -186,8 +185,8 @@
@Ignore
@Test
public void test2Threads2Writers2SolrServers() throws Exception {
- SolrServer solrServer1 = getSolrServer();
- SolrServer solrServer2 = getSolrServer();
+ SolrServer solrServer1 = newSolrServer();
+ SolrServer solrServer2 = newSolrServer();
ThreadAddDocument thread1 = new ThreadAddDocument(solrServer1, "1", true);
ThreadAddDocument thread2 = new ThreadAddDocument(solrServer2, "2", true);
@@ -205,7 +204,7 @@
result = findById(solrServer2, "2");
assertNotNull(result);
- SolrServer solrServer3 = getSolrServer();
+ SolrServer solrServer3 = newSolrServer();
result = findById(solrServer3, "1");
assertNotNull(result);
result = findById(solrServer3, "2");
@@ -215,8 +214,8 @@
@Ignore // FIXME 20100806 bleny randomly fail
@Test
public void testReader() throws Exception {
- SolrServer solrServer1 = getSolrServer();
- SolrServer solrServer2 = getSolrServer();
+ SolrServer solrServer1 = newSolrServer();
+ SolrServer solrServer2 = newSolrServer();
addDocument(solrServer1, "1", "1");
solrServer1.commit();
Modified: branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/solr/test/TreeTest.java
===================================================================
--- branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/solr/test/TreeTest.java 2010-09-21 15:40:14 UTC (rev 329)
+++ branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/java/org/nuiton/wikitty/solr/test/TreeTest.java 2010-09-22 08:14:49 UTC (rev 330)
@@ -35,6 +35,7 @@
import org.nuiton.wikitty.FieldType.TYPE;
import org.nuiton.wikitty.Tree;
import org.nuiton.wikitty.TreeNode;
+import org.nuiton.wikitty.TreeNodeHelper;
import org.nuiton.wikitty.TreeNodeImpl;
import org.nuiton.wikitty.Wikitty;
import org.nuiton.wikitty.WikittyExtension;
@@ -79,11 +80,12 @@
// Create tree as following :
// root
// |_ node 1
- // | |_ node 11
+ // | |_ node 11 (2)
+ // | | |_ node 111 (1)
// | |_ node 12
- // | | |_ node 121
+ // | | |_ node 121 (2)
// | |_ node 13
- // |_ node 2
+ // |_ node 2 (1)
createBranch("root/node1/node11/node111");
createBranch("root/node1/node12/node121");
@@ -172,9 +174,29 @@
String nodeId = node.getId();
Map<TreeNode, Integer> children = ws.restoreChildren(null, nodeId, null);
+ /*
for (Integer count : children.values()) {
sum += count;
}
+ */
+
+ for (Map.Entry<TreeNode, Integer> e : children.entrySet()) {
+ log.debug("*treeNode = " + e.getKey().getName() + " " + e.getValue() +
+ " -> " + e.getKey().getChildren());
+ }
+
+ for (TreeNode treeNode : children.keySet()) {
+ Set<String> treeNodeChildren = treeNode.getChildren();
+ log.debug("+treeNode = " + treeNode.getName() + " " + (treeNodeChildren==null?0:treeNodeChildren.size()) +
+ " -> " + treeNodeChildren);
+// if (treeNodeChildren == null) {
+// sum += 0;
+// } else {
+// sum += treeNodeChildren.size();
+// }
+ sum += sum(((TreeNodeImpl)treeNode).getWikitty());
+ }
+
return sum;
}
@@ -341,18 +363,54 @@
Wikitty root = findNode("root");
int childInit = sum(root);
- // Remove a value on node2
+ // Remove a value on node11
Wikitty node = findNode("node11");
List<String> leafs = node.getFieldAsList(TreeNode.EXT_TREENODE, TreeNode.FIELD_TREENODE_CHILDREN, String.class);
+
+ log.info("leafs = " + leafs);
+
node.removeFromField(TreeNode.EXT_TREENODE, TreeNode.FIELD_TREENODE_CHILDREN, leafs.get(0));
+
+ leafs = node.getFieldAsList(TreeNode.EXT_TREENODE, TreeNode.FIELD_TREENODE_CHILDREN, String.class);
+ log.info("leafs after remove = " + leafs);
+
ws.store(null, node);
+
+ node = ws.restore(null, node.getId());
+ leafs = node.getFieldAsList(TreeNode.EXT_TREENODE, TreeNode.FIELD_TREENODE_CHILDREN, String.class);
+ log.info("leafs after restore = " + leafs);
// now, there is one more value for the root node
int newSum = sum(root);
assertEquals(childInit - 1, newSum);
}
+ /** regression test, for unknown reason the child may not be removed in the index */
@Test
+ public void testSimpleDeleteChild() throws Exception {
+
+ TreeNodeImpl parent = new TreeNodeImpl();
+ ws.store(null, parent.getWikitty());
+
+ TreeNodeImpl child = new TreeNodeImpl();
+ child.setParent(parent.getWikittyId());
+ ws.store(null, child.getWikitty());
+
+ Map<TreeNode, Integer> children = ws.restoreChildren(null, parent.getWikittyId(), null);
+
+ assertEquals(1, children.size());
+ assertEquals(0, children.get(child).intValue());
+
+ child.setParent(null);
+
+ ws.store(null, child.getWikitty());
+
+ children = ws.restoreChildren(null, parent.getWikittyId(), null);
+
+ assertEquals(0, children.size());
+ }
+
+ @Test
public void testDeleteValue() throws Exception {
// Get the initial number of values for Root node
Wikitty root = findNode("root");
Added: branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/resources/solrconfig.xml
===================================================================
--- branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/resources/solrconfig.xml (rev 0)
+++ branches/wikitty-eugene-migration/wikitty-solr-impl/src/test/resources/solrconfig.xml 2010-09-22 08:14:49 UTC (rev 330)
@@ -0,0 +1,700 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<config>
+ <!-- Set this to 'false' if you want solr to continue working after it has
+ encountered an severe configuration error. In a production environment,
+ you may want solr to keep working even if one handler is mis-configured.
+
+ You may also set this to false using by setting the system property:
+ -Dsolr.abortOnConfigurationError=false
+ -->
+ <abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError>
+
+ <!-- Used to specify an alternate directory to hold all index data
+ other than the default ./data under the Solr home.
+ If replication is in use, this should match the replication configuration. -->
+ <dataDir>${solr.data.dir:./target/tests-temp-dir/solr/data}</dataDir>
+
+
+ <indexDefaults>
+ <!-- Values here affect all index writers and act as a default unless overridden. -->
+ <useCompoundFile>false</useCompoundFile>
+
+ <mergeFactor>10</mergeFactor>
+ <!--
+ If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush based on whichever limit is hit first.
+
+ -->
+ <!--<maxBufferedDocs>1000</maxBufferedDocs>-->
+ <!-- Tell Lucene when to flush documents to disk.
+ Giving Lucene more memory for indexing means faster indexing at the cost of more RAM
+
+ If both ramBufferSizeMB and maxBufferedDocs is set, then Lucene will flush based on whichever limit is hit first.
+
+ -->
+ <ramBufferSizeMB>32</ramBufferSizeMB>
+ <maxMergeDocs>2147483647</maxMergeDocs>
+ <maxFieldLength>10000</maxFieldLength>
+ <writeLockTimeout>1000</writeLockTimeout>
+ <commitLockTimeout>10000</commitLockTimeout>
+
+ <!--
+ Expert: Turn on Lucene's auto commit capability.
+ This causes intermediate segment flushes to write a new lucene
+ index descriptor, enabling it to be opened by an external
+ IndexReader.
+ NOTE: Despite the name, this value does not have any relation to Solr's autoCommit functionality
+ -->
+ <!--<luceneAutoCommit>false</luceneAutoCommit>-->
+ <!--
+ Expert:
+ The Merge Policy in Lucene controls how merging is handled by Lucene. The default in 2.3 is the LogByteSizeMergePolicy, previous
+ versions used LogDocMergePolicy.
+
+ LogByteSizeMergePolicy chooses segments to merge based on their size. The Lucene 2.2 default, LogDocMergePolicy chose when
+ to merge based on number of documents
+
+ Other implementations of MergePolicy must have a no-argument constructor
+ -->
+ <!--<mergePolicy>org.apache.lucene.index.LogByteSizeMergePolicy</mergePolicy>-->
+
+ <!--
+ Expert:
+ The Merge Scheduler in Lucene controls how merges are performed. The ConcurrentMergeScheduler (Lucene 2.3 default)
+ can perform merges in the background using separate threads. The SerialMergeScheduler (Lucene 2.2 default) does not.
+ -->
+ <!--<mergeScheduler>org.apache.lucene.index.ConcurrentMergeScheduler</mergeScheduler>-->
+
+ <!--
+ This option specifies which Lucene LockFactory implementation to use.
+
+ single = SingleInstanceLockFactory - suggested for a read-only index
+ or when there is no possibility of another process trying
+ to modify the index.
+ native = NativeFSLockFactory
+ simple = SimpleFSLockFactory
+
+ (For backwards compatibility with Solr 1.2, 'simple' is the default
+ if not specified.)
+ -->
+ <lockType>simple</lockType>
+ </indexDefaults>
+
+ <mainIndex>
+ <!-- options specific to the main on-disk lucene index -->
+ <useCompoundFile>false</useCompoundFile>
+ <ramBufferSizeMB>32</ramBufferSizeMB>
+ <mergeFactor>10</mergeFactor>
+ <!-- Deprecated -->
+ <!--<maxBufferedDocs>1000</maxBufferedDocs>-->
+ <maxMergeDocs>2147483647</maxMergeDocs>
+ <maxFieldLength>10000</maxFieldLength>
+
+ <!-- If true, unlock any held write or commit locks on startup.
+ This defeats the locking mechanism that allows multiple
+ processes to safely access a lucene index, and should be
+ used with care.
+ This is not needed if lock type is 'none' or 'single'
+ -->
+ <unlockOnStartup>true</unlockOnStartup>
+ </mainIndex>
+
+ <!-- Enables JMX if and only if an existing MBeanServer is found, use
+ this if you want to configure JMX through JVM parameters. Remove
+ this to disable exposing Solr configuration and statistics to JMX.
+
+ If you want to connect to a particular server, specify the agentId
+ e.g. <jmx agentId="myAgent" />
+
+ If you want to start a new MBeanServer, specify the serviceUrl
+ e.g <jmx serviceurl="service:jmx:rmi:///jndi/rmi://localhost:9999/solr" />
+
+ For more details see http://wiki.apache.org/solr/SolrJmx
+ -->
+ <jmx />
+
+ <!-- the default high-performance update handler -->
+ <updateHandler class="solr.DirectUpdateHandler2">
+
+ <!-- A prefix of "solr." for class names is an alias that
+ causes solr to search appropriate packages, including
+ org.apache.solr.(search|update|request|core|analysis)
+ -->
+
+ <!-- Perform a <commit/> automatically under certain conditions:
+ maxDocs - number of updates since last commit is greater than this
+ maxTime - oldest uncommited update (in ms) is this long ago
+ <autoCommit>
+ <maxDocs>10000</maxDocs>
+ <maxTime>1000</maxTime>
+ </autoCommit>
+ -->
+
+ <!-- The RunExecutableListener executes an external command.
+ exe - the name of the executable to run
+ dir - dir to use as the current working directory. default="."
+ wait - the calling thread waits until the executable returns. default="true"
+ args - the arguments to pass to the program. default=nothing
+ env - environment variables to set. default=nothing
+ -->
+ <!-- A postCommit event is fired after every commit or optimize command
+ <listener event="postCommit" class="solr.RunExecutableListener">
+ <str name="exe">solr/bin/snapshooter</str>
+ <str name="dir">.</str>
+ <bool name="wait">true</bool>
+ <arr name="args"> <str>arg1</str> <str>arg2</str> </arr>
+ <arr name="env"> <str>MYVAR=val1</str> </arr>
+ </listener>
+ -->
+ <!-- A postOptimize event is fired only after every optimize command, useful
+ in conjunction with index distribution to only distribute optimized indicies
+ <listener event="postOptimize" class="solr.RunExecutableListener">
+ <str name="exe">snapshooter</str>
+ <str name="dir">solr/bin</str>
+ <bool name="wait">true</bool>
+ </listener>
+ -->
+
+ </updateHandler>
+
+
+ <query>
+ <!-- Maximum number of clauses in a boolean query... can affect
+ range or prefix queries that expand to big boolean
+ queries. An exception is thrown if exceeded. -->
+ <maxBooleanClauses>1024</maxBooleanClauses>
+
+
+ <!-- Cache used by SolrIndexSearcher for filters (DocSets),
+ unordered sets of *all* documents that match a query.
+ When a new searcher is opened, its caches may be prepopulated
+ or "autowarmed" using data from caches in the old searcher.
+ autowarmCount is the number of items to prepopulate. For LRUCache,
+ the autowarmed items will be the most recently accessed items.
+ Parameters:
+ class - the SolrCache implementation (currently only LRUCache)
+ size - the maximum number of entries in the cache
+ initialSize - the initial capacity (number of entries) of
+ the cache. (seel java.util.HashMap)
+ autowarmCount - the number of entries to prepopulate from
+ and old cache.
+ -->
+ <filterCache
+ class="solr.LRUCache"
+ size="512"
+ initialSize="512"
+ autowarmCount="128"/>
+
+ <!-- queryResultCache caches results of searches - ordered lists of
+ document ids (DocList) based on a query, a sort, and the range
+ of documents requested. -->
+ <queryResultCache
+ class="solr.LRUCache"
+ size="512"
+ initialSize="512"
+ autowarmCount="32"/>
+
+ <!-- documentCache caches Lucene Document objects (the stored fields for each document).
+ Since Lucene internal document ids are transient, this cache will not be autowarmed. -->
+ <documentCache
+ class="solr.LRUCache"
+ size="512"
+ initialSize="512"
+ autowarmCount="0"/>
+
+ <!-- If true, stored fields that are not requested will be loaded lazily.
+
+ This can result in a significant speed improvement if the usual case is to
+ not load all stored fields, especially if the skipped fields are large compressed
+ text fields.
+ -->
+ <enableLazyFieldLoading>true</enableLazyFieldLoading>
+
+ <!-- Example of a generic cache. These caches may be accessed by name
+ through SolrIndexSearcher.getCache(),cacheLookup(), and cacheInsert().
+ The purpose is to enable easy caching of user/application level data.
+ The regenerator argument should be specified as an implementation
+ of solr.search.CacheRegenerator if autowarming is desired. -->
+ <!--
+ <cache name="myUserCache"
+ class="solr.LRUCache"
+ size="4096"
+ initialSize="1024"
+ autowarmCount="1024"
+ regenerator="org.mycompany.mypackage.MyRegenerator"
+ />
+ -->
+
+ <!-- An optimization that attempts to use a filter to satisfy a search.
+ If the requested sort does not include score, then the filterCache
+ will be checked for a filter matching the query. If found, the filter
+ will be used as the source of document ids, and then the sort will be
+ applied to that.
+ <useFilterForSortedQuery>true</useFilterForSortedQuery>
+ -->
+
+ <!-- An optimization for use with the queryResultCache. When a search
+ is requested, a superset of the requested number of document ids
+ are collected. For example, if a search for a particular query
+ requests matching documents 10 through 19, and queryWindowSize is 50,
+ then documents 0 through 49 will be collected and cached. Any further
+ requests in that range can be satisfied via the cache. -->
+ <queryResultWindowSize>50</queryResultWindowSize>
+
+ <!-- Maximum number of documents to cache for any entry in the
+ queryResultCache. -->
+ <queryResultMaxDocsCached>200</queryResultMaxDocsCached>
+
+ <!-- This entry enables an int hash representation for filters (DocSets)
+ when the number of items in the set is less than maxSize. For smaller
+ sets, this representation is more memory efficient, more efficient to
+ iterate over, and faster to take intersections. -->
+ <HashDocSet maxSize="3000" loadFactor="0.75"/>
+
+ <!-- a newSearcher event is fired whenever a new searcher is being prepared
+ and there is a current searcher handling requests (aka registered). -->
+ <!-- QuerySenderListener takes an array of NamedList and executes a
+ local query request for each NamedList in sequence. -->
+ <listener event="newSearcher" class="solr.QuerySenderListener">
+ <arr name="queries">
+ <lst> <str name="q">solr</str> <str name="start">0</str> <str name="rows">10</str> </lst>
+ <lst> <str name="q">rocks</str> <str name="start">0</str> <str name="rows">10</str> </lst>
+ <lst><str name="q">static newSearcher warming query from solrconfig.xml</str></lst>
+ </arr>
+ </listener>
+
+ <!-- a firstSearcher event is fired whenever a new searcher is being
+ prepared but there is no current registered searcher to handle
+ requests or to gain autowarming data from. -->
+ <listener event="firstSearcher" class="solr.QuerySenderListener">
+ <arr name="queries">
+ <lst> <str name="q">fast_warm</str> <str name="start">0</str> <str name="rows">10</str> </lst>
+ <lst><str name="q">static firstSearcher warming query from solrconfig.xml</str></lst>
+ </arr>
+ </listener>
+
+ <!-- If a search request comes in and there is no current registered searcher,
+ then immediately register the still warming searcher and use it. If
+ "false" then all requests will block until the first searcher is done
+ warming. -->
+ <useColdSearcher>false</useColdSearcher>
+
+ <!-- Maximum number of searchers that may be warming in the background
+ concurrently. An error is returned if this limit is exceeded. Recommend
+ 1-2 for read-only slaves, higher for masters w/o cache warming. -->
+ <maxWarmingSearchers>2</maxWarmingSearchers>
+
+ </query>
+
+ <!--
+ Let the dispatch filter handler /select?qt=XXX
+ handleSelect=true will use consistent error handling for /select and /update
+ handleSelect=false will use solr1.1 style error formatting
+ -->
+ <requestDispatcher handleSelect="true" >
+ <!--Make sure your system has some authentication before enabling remote streaming! -->
+ <requestParsers enableRemoteStreaming="false" multipartUploadLimitInKB="2048" />
+
+ <!-- Set HTTP caching related parameters (for proxy caches and clients).
+
+ To get the behaviour of Solr 1.2 (ie: no caching related headers)
+ use the never304="true" option and do not specify a value for
+ <cacheControl>
+ -->
+ <!-- <httpCaching never304="true"> -->
+ <httpCaching lastModifiedFrom="openTime"
+ etagSeed="Solr">
+ <!-- lastModFrom="openTime" is the default, the Last-Modified value
+ (and validation against If-Modified-Since requests) will all be
+ relative to when the current Searcher was opened.
+ You can change it to lastModFrom="dirLastMod" if you want the
+ value to exactly corrispond to when the physical index was last
+ modified.
+
+ etagSeed="..." is an option you can change to force the ETag
+ header (and validation against If-None-Match requests) to be
+ differnet even if the index has not changed (ie: when making
+ significant changes to your config file)
+
+ lastModifiedFrom and etagSeed are both ignored if you use the
+ never304="true" option.
+ -->
+ <!-- If you include a <cacheControl> directive, it will be used to
+ generate a Cache-Control header, as well as an Expires header
+ if the value contains "max-age="
+
+ By default, no Cache-Control header is generated.
+
+ You can use the <cacheControl> option even if you have set
+ never304="true"
+ -->
+ <!-- <cacheControl>max-age=30, public</cacheControl> -->
+ </httpCaching>
+ </requestDispatcher>
+
+
+ <!-- requestHandler plugins... incoming queries will be dispatched to the
+ correct handler based on the path or the qt (query type) param.
+ Names starting with a '/' are accessed with the a path equal to the
+ registered name. Names without a leading '/' are accessed with:
+ http://host/app/select?qt=name
+ If no qt is defined, the requestHandler that declares default="true"
+ will be used.
+ -->
+ <requestHandler name="standard" class="solr.SearchHandler" default="true">
+ <!-- default values for query parameters -->
+ <lst name="defaults">
+ <str name="echoParams">explicit</str>
+ <!--
+ <int name="rows">10</int>
+ <str name="fl">*</str>
+ <str name="version">2.1</str>
+ -->
+ </lst>
+ </requestHandler>
+
+
+ <!-- DisMaxRequestHandler allows easy searching across multiple fields
+ for simple user-entered phrases. It's implementation is now
+ just the standard SearchHandler with a default query type
+ of "dismax".
+ see http://wiki.apache.org/solr/DisMaxRequestHandler
+ -->
+ <requestHandler name="dismax" class="solr.SearchHandler" >
+ <lst name="defaults">
+ <str name="defType">dismax</str>
+ <str name="echoParams">explicit</str>
+ <float name="tie">0.01</float>
+ <str name="qf">
+ text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4
+ </str>
+ <str name="pf">
+ text^0.2 features^1.1 name^1.5 manu^1.4 manu_exact^1.9
+ </str>
+ <str name="bf">
+ ord(popularity)^0.5 recip(rord(price),1,1000,1000)^0.3
+ </str>
+ <str name="fl">
+ id,name,price,score
+ </str>
+ <str name="mm">
+ 2<-1 5<-2 6<90%
+ </str>
+ <int name="ps">100</int>
+ <str name="q.alt">*:*</str>
+ <!-- example highlighter config, enable per-query with hl=true -->
+ <str name="hl.fl">text features name</str>
+ <!-- for this field, we want no fragmenting, just highlighting -->
+ <str name="f.name.hl.fragsize">0</str>
+ <!-- instructs Solr to return the field itself if no query terms are
+ found -->
+ <str name="f.name.hl.alternateField">name</str>
+ <str name="f.text.hl.fragmenter">regex</str> <!-- defined below -->
+ </lst>
+ </requestHandler>
+
+ <!-- Note how you can register the same handler multiple times with
+ different names (and different init parameters)
+ -->
+ <requestHandler name="partitioned" class="solr.SearchHandler" >
+ <lst name="defaults">
+ <str name="defType">dismax</str>
+ <str name="echoParams">explicit</str>
+ <str name="qf">text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0</str>
+ <str name="mm">2<-1 5<-2 6<90%</str>
+ <!-- This is an example of using Date Math to specify a constantly
+ moving date range in a config...
+ -->
+ <str name="bq">incubationdate_dt:[* TO NOW/DAY-1MONTH]^2.2</str>
+ </lst>
+ <!-- In addition to defaults, "appends" params can be specified
+ to identify values which should be appended to the list of
+ multi-val params from the query (or the existing "defaults").
+
+ In this example, the param "fq=instock:true" will be appended to
+ any query time fq params the user may specify, as a mechanism for
+ partitioning the index, independent of any user selected filtering
+ that may also be desired (perhaps as a result of faceted searching).
+
+ NOTE: there is *absolutely* nothing a client can do to prevent these
+ "appends" values from being used, so don't use this mechanism
+ unless you are sure you always want it.
+ -->
+ <lst name="appends">
+ <str name="fq">inStock:true</str>
+ </lst>
+ <!-- "invariants" are a way of letting the Solr maintainer lock down
+ the options available to Solr clients. Any params values
+ specified here are used regardless of what values may be specified
+ in either the query, the "defaults", or the "appends" params.
+
+ In this example, the facet.field and facet.query params are fixed,
+ limiting the facets clients can use. Faceting is not turned on by
+ default - but if the client does specify facet=true in the request,
+ these are the only facets they will be able to see counts for;
+ regardless of what other facet.field or facet.query params they
+ may specify.
+
+ NOTE: there is *absolutely* nothing a client can do to prevent these
+ "invariants" values from being used, so don't use this mechanism
+ unless you are sure you always want it.
+ -->
+ <lst name="invariants">
+ <str name="facet.field">cat</str>
+ <str name="facet.field">manu_exact</str>
+ <str name="facet.query">price:[* TO 500]</str>
+ <str name="facet.query">price:[500 TO *]</str>
+ </lst>
+ </requestHandler>
+
+
+ <!--
+ Search components are registered to SolrCore and used by Search Handlers
+
+ By default, the following components are avaliable:
+
+ <searchComponent name="query" class="org.apache.solr.handler.component.QueryComponent" />
+ <searchComponent name="facet" class="org.apache.solr.handler.component.FacetComponent" />
+ <searchComponent name="mlt" class="org.apache.solr.handler.component.MoreLikeThisComponent" />
+ <searchComponent name="highlight" class="org.apache.solr.handler.component.HighlightComponent" />
+ <searchComponent name="debug" class="org.apache.solr.handler.component.DebugComponent" />
+
+ Default configuration in a requestHandler would look like:
+ <arr name="components">
+ <str>query</str>
+ <str>facet</str>
+ <str>mlt</str>
+ <str>highlight</str>
+ <str>debug</str>
+ </arr>
+
+ If you register a searchComponent to one of the standard names, that will be used instead.
+ To insert handlers before or after the 'standard' components, use:
+
+ <arr name="first-components">
+ <str>myFirstComponentName</str>
+ </arr>
+
+ <arr name="last-components">
+ <str>myLastComponentName</str>
+ </arr>
+ -->
+
+ <!-- The spell check component can return a list of alternative spelling
+ suggestions. -->
+ <searchComponent name="spellcheck" class="solr.SpellCheckComponent">
+
+ <str name="queryAnalyzerFieldType">textSpell</str>
+
+ <lst name="spellchecker">
+ <str name="name">default</str>
+ <str name="field">spell</str>
+ <str name="spellcheckIndexDir">./spellchecker1</str>
+
+ </lst>
+ <lst name="spellchecker">
+ <str name="name">jarowinkler</str>
+ <str name="field">spell</str>
+ <!-- Use a different Distance Measure -->
+ <str name="distanceMeasure">org.apache.lucene.search.spell.JaroWinklerDistance</str>
+ <str name="spellcheckIndexDir">./spellchecker2</str>
+
+ </lst>
+
+ <lst name="spellchecker">
+ <str name="classname">solr.FileBasedSpellChecker</str>
+ <str name="name">file</str>
+ <str name="sourceLocation">spellings.txt</str>
+ <str name="characterEncoding">UTF-8</str>
+ <str name="spellcheckIndexDir">./spellcheckerFile</str>
+ </lst>
+ </searchComponent>
+
+ <!-- a request handler utilizing the spellcheck component -->
+ <requestHandler name="/spellCheckCompRH" class="solr.SearchHandler">
+ <lst name="defaults">
+ <!-- omp = Only More Popular -->
+ <str name="spellcheck.onlyMorePopular">false</str>
+ <!-- exr = Extended Results -->
+ <str name="spellcheck.extendedResults">false</str>
+ <!-- The number of suggestions to return -->
+ <str name="spellcheck.count">1</str>
+ </lst>
+ <arr name="last-components">
+ <str>spellcheck</str>
+ </arr>
+ </requestHandler>
+
+ <!-- a search component that enables you to configure the top results for
+ a given query regardless of the normal lucene scoring.-->
+
+<!-- poussin 20090902 remove elevate this file is empty, what need ?
+ <searchComponent name="elevator" class="solr.QueryElevationComponent" >
+ <str name="queryFieldType">string</str>
+ <str name="config-file">elevate.xml</str>
+ </searchComponent>
+ -->
+ <!-- a request handler utilizing the elevator component -->
+<!--
+ <requestHandler name="/elevate" class="solr.SearchHandler" startup="lazy">
+ <lst name="defaults">
+ <str name="echoParams">explicit</str>
+ </lst>
+ <arr name="last-components">
+ <str>elevator</str>
+ </arr>
+ </requestHandler>
+ -->
+
+ <!-- Update request handler.
+
+ Note: Since solr1.1 requestHandlers requires a valid content type header if posted in
+ the body. For example, curl now requires: -H 'Content-type:text/xml; charset=utf-8'
+ The response format differs from solr1.1 formatting and returns a standard error code.
+
+ To enable solr1.1 behavior, remove the /update handler or change its path
+ -->
+ <requestHandler name="/update" class="solr.XmlUpdateRequestHandler" />
+
+ <!--
+ Analysis request handler. Since Solr 1.3. Use to returnhow a document is analyzed. Useful
+ for debugging and as a token server for other types of applications
+ -->
+ <requestHandler name="/analysis" class="solr.AnalysisRequestHandler" />
+
+
+ <!-- CSV update handler, loaded on demand -->
+ <requestHandler name="/update/csv" class="solr.CSVRequestHandler" startup="lazy" />
+
+
+ <!--
+ Admin Handlers - This will register all the standard admin RequestHandlers. Adding
+ this single handler is equivolent to registering:
+
+ <requestHandler name="/admin/luke" class="org.apache.solr.handler.admin.LukeRequestHandler" />
+ <requestHandler name="/admin/system" class="org.apache.solr.handler.admin.SystemInfoHandler" />
+ <requestHandler name="/admin/plugins" class="org.apache.solr.handler.admin.PluginInfoHandler" />
+ <requestHandler name="/admin/threads" class="org.apache.solr.handler.admin.ThreadDumpHandler" />
+ <requestHandler name="/admin/properties" class="org.apache.solr.handler.admin.PropertiesRequestHandler" />
+ <requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" >
+
+ If you wish to hide files under ${solr.home}/conf, explicitly register the ShowFileRequestHandler using:
+ <requestHandler name="/admin/file" class="org.apache.solr.handler.admin.ShowFileRequestHandler" >
+ <lst name="invariants">
+ <str name="hidden">synonyms.txt</str>
+ <str name="hidden">anotherfile.txt</str>
+ </lst>
+ </requestHandler>
+ -->
+ <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />
+
+ <!-- ping/healthcheck -->
+ <requestHandler name="/admin/ping" class="PingRequestHandler">
+ <lst name="defaults">
+ <str name="qt">standard</str>
+ <str name="q">solrpingquery</str>
+ <str name="echoParams">all</str>
+ </lst>
+ </requestHandler>
+
+ <!-- Echo the request contents back to the client -->
+ <requestHandler name="/debug/dump" class="solr.DumpRequestHandler" >
+ <lst name="defaults">
+ <str name="echoParams">explicit</str> <!-- for all params (including the default etc) use: 'all' -->
+ <str name="echoHandler">true</str>
+ </lst>
+ </requestHandler>
+
+ <highlighting>
+ <!-- Configure the standard fragmenter -->
+ <!-- This could most likely be commented out in the "default" case -->
+ <fragmenter name="gap" class="org.apache.solr.highlight.GapFragmenter" default="true">
+ <lst name="defaults">
+ <int name="hl.fragsize">100</int>
+ </lst>
+ </fragmenter>
+
+ <!-- A regular-expression-based fragmenter (f.i., for sentence extraction) -->
+ <fragmenter name="regex" class="org.apache.solr.highlight.RegexFragmenter">
+ <lst name="defaults">
+ <!-- slightly smaller fragsizes work better because of slop -->
+ <int name="hl.fragsize">70</int>
+ <!-- allow 50% slop on fragment sizes -->
+ <float name="hl.regex.slop">0.5</float>
+ <!-- a basic sentence pattern -->
+ <str name="hl.regex.pattern">[-\w ,/\n\"']{20,200}</str>
+ </lst>
+ </fragmenter>
+
+ <!-- Configure the standard formatter -->
+ <formatter name="html" class="org.apache.solr.highlight.HtmlFormatter" default="true">
+ <lst name="defaults">
+ <str name="hl.simple.pre"><![CDATA[<em>]]></str>
+ <str name="hl.simple.post"><![CDATA[</em>]]></str>
+ </lst>
+ </formatter>
+ </highlighting>
+
+
+ <!-- queryResponseWriter plugins... query responses will be written using the
+ writer specified by the 'wt' request parameter matching the name of a registered
+ writer.
+ The "default" writer is the default and will be used if 'wt' is not specified
+ in the request. XMLResponseWriter will be used if nothing is specified here.
+ The json, python, and ruby writers are also available by default.
+
+ <queryResponseWriter name="xml" class="org.apache.solr.request.XMLResponseWriter" default="true"/>
+ <queryResponseWriter name="json" class="org.apache.solr.request.JSONResponseWriter"/>
+ <queryResponseWriter name="python" class="org.apache.solr.request.PythonResponseWriter"/>
+ <queryResponseWriter name="ruby" class="org.apache.solr.request.RubyResponseWriter"/>
+ <queryResponseWriter name="php" class="org.apache.solr.request.PHPResponseWriter"/>
+ <queryResponseWriter name="phps" class="org.apache.solr.request.PHPSerializedResponseWriter"/>
+
+ <queryResponseWriter name="custom" class="com.example.MyResponseWriter"/>
+ -->
+
+ <!-- XSLT response writer transforms the XML output by any xslt file found
+ in Solr's conf/xslt directory. Changes to xslt files are checked for
+ every xsltCacheLifetimeSeconds.
+ -->
+ <queryResponseWriter name="xslt" class="org.apache.solr.request.XSLTResponseWriter">
+ <int name="xsltCacheLifetimeSeconds">5</int>
+ </queryResponseWriter>
+
+
+ <queryParser name="wikitty" class="org.nuiton.wikitty.solr.WikittyQueryParser"/>
+
+ <!-- example of registering a query parser
+ <queryParser name="lucene" class="org.apache.solr.search.LuceneQParserPlugin"/>
+ -->
+
+ <!-- example of registering a custom function parser
+ <valueSourceParser name="myfunc" class="com.mycompany.MyValueSourceParser" />
+ -->
+
+ <!-- config for the admin interface -->
+ <admin>
+ <defaultQuery>solr</defaultQuery>
+
+ <!-- configure a healthcheck file for servers behind a loadbalancer
+ <healthcheck type="file">server-enabled</healthcheck>
+ -->
+ </admin>
+
+</config>
1
0
r329 - in trunk: wikitty-api/src/main/java/org/nuiton/wikitty wikitty-hbase-impl/src/main/java/org/nuiton/wikitty/hbase wikitty-jdbc-impl/src/main/java/org/nuiton/wikitty/jdbc wikitty-jpa-impl/src/main/java/org/nuiton/wikitty/jpa
by echatellier@users.nuiton.org 21 Sep '10
by echatellier@users.nuiton.org 21 Sep '10
21 Sep '10
Author: echatellier
Date: 2010-09-21 17:40:14 +0200 (Tue, 21 Sep 2010)
New Revision: 329
Url: http://nuiton.org/repositories/revision/wikitty/329
Log:
Fix exception name WikittyObs*o*leteException
Added:
trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyObsoleteException.java
Removed:
trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyObseleteException.java
Modified:
trunk/wikitty-hbase-impl/src/main/java/org/nuiton/wikitty/hbase/WikittyStorageHBase.java
trunk/wikitty-jdbc-impl/src/main/java/org/nuiton/wikitty/jdbc/WikittyStorageJDBC.java
trunk/wikitty-jpa-impl/src/main/java/org/nuiton/wikitty/jpa/WikittyStorageJPA.java
Deleted: trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyObseleteException.java
===================================================================
--- trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyObseleteException.java 2010-09-21 13:12:03 UTC (rev 328)
+++ trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyObseleteException.java 2010-09-21 15:40:14 UTC (rev 329)
@@ -1,23 +0,0 @@
-package org.nuiton.wikitty;
-
-/**
- * Wikitty exception.
- *
- * @author poussin
- * @version $Revision$
- *
- * Last update: $Date$
- * by : $Author$
- */
-public class WikittyObseleteException extends WikittyException {
-
- private static final long serialVersionUID = 1L;
-
- public WikittyObseleteException(String message) {
- super(message);
- }
-
- public WikittyObseleteException(String message, Throwable cause) {
- super(message, cause);
- }
-}
Copied: trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyObsoleteException.java (from rev 327, trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyObseleteException.java)
===================================================================
--- trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyObsoleteException.java (rev 0)
+++ trunk/wikitty-api/src/main/java/org/nuiton/wikitty/WikittyObsoleteException.java 2010-09-21 15:40:14 UTC (rev 329)
@@ -0,0 +1,23 @@
+package org.nuiton.wikitty;
+
+/**
+ * Wikitty exception.
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class WikittyObsoleteException extends WikittyException {
+
+ private static final long serialVersionUID = 1L;
+
+ public WikittyObsoleteException(String message) {
+ super(message);
+ }
+
+ public WikittyObsoleteException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Modified: trunk/wikitty-hbase-impl/src/main/java/org/nuiton/wikitty/hbase/WikittyStorageHBase.java
===================================================================
--- trunk/wikitty-hbase-impl/src/main/java/org/nuiton/wikitty/hbase/WikittyStorageHBase.java 2010-09-21 13:12:03 UTC (rev 328)
+++ trunk/wikitty-hbase-impl/src/main/java/org/nuiton/wikitty/hbase/WikittyStorageHBase.java 2010-09-21 15:40:14 UTC (rev 329)
@@ -52,7 +52,7 @@
import org.nuiton.wikitty.WikittyExtension;
import org.nuiton.wikitty.WikittyExtensionStorage;
import org.nuiton.wikitty.WikittyImpl;
-import org.nuiton.wikitty.WikittyObseleteException;
+import org.nuiton.wikitty.WikittyObsoleteException;
import org.nuiton.wikitty.WikittyStorage;
import org.nuiton.wikitty.WikittyTransaction;
import org.nuiton.wikitty.WikittyUtil;
@@ -121,7 +121,7 @@
} else if (WikittyUtil.versionGreaterThan(requestedVersion, actualVersion)) { //requested version is newer
newVersion = requestedVersion;
} else { //requested version is obsolete
- throw new WikittyObseleteException(String.format(
+ throw new WikittyObsoleteException(String.format(
"Your wikitty '%s' is obsolete (saving: '%s'; existing: '%s')", wikitty.getId(), requestedVersion, actualVersion));
}
}
Modified: trunk/wikitty-jdbc-impl/src/main/java/org/nuiton/wikitty/jdbc/WikittyStorageJDBC.java
===================================================================
--- trunk/wikitty-jdbc-impl/src/main/java/org/nuiton/wikitty/jdbc/WikittyStorageJDBC.java 2010-09-21 13:12:03 UTC (rev 328)
+++ trunk/wikitty-jdbc-impl/src/main/java/org/nuiton/wikitty/jdbc/WikittyStorageJDBC.java 2010-09-21 15:40:14 UTC (rev 329)
@@ -74,7 +74,7 @@
import org.nuiton.wikitty.WikittyExtension;
import org.nuiton.wikitty.WikittyExtensionStorage;
import org.nuiton.wikitty.WikittyImpl;
-import org.nuiton.wikitty.WikittyObseleteException;
+import org.nuiton.wikitty.WikittyObsoleteException;
import org.nuiton.wikitty.WikittyStorage;
import org.nuiton.wikitty.WikittyTransaction;
import org.nuiton.wikitty.WikittyUtil;
@@ -199,7 +199,7 @@
} else if (WikittyUtil.versionGreaterThan(requestedVersion, actualVersion)) { //requested version is newer
newVersion = requestedVersion;
} else { //requested version is obsolete
- throw new WikittyObseleteException(String.format(
+ throw new WikittyObsoleteException(String.format(
"Your wikitty '%s' is obsolete (saving: '%s'; existing: '%s')", wikitty.getId(), requestedVersion, actualVersion));
}
}
Modified: trunk/wikitty-jpa-impl/src/main/java/org/nuiton/wikitty/jpa/WikittyStorageJPA.java
===================================================================
--- trunk/wikitty-jpa-impl/src/main/java/org/nuiton/wikitty/jpa/WikittyStorageJPA.java 2010-09-21 13:12:03 UTC (rev 328)
+++ trunk/wikitty-jpa-impl/src/main/java/org/nuiton/wikitty/jpa/WikittyStorageJPA.java 2010-09-21 15:40:14 UTC (rev 329)
@@ -35,7 +35,7 @@
import org.nuiton.wikitty.WikittyException;
import org.nuiton.wikitty.WikittyExtension;
import org.nuiton.wikitty.WikittyExtensionStorage;
-import org.nuiton.wikitty.WikittyObseleteException;
+import org.nuiton.wikitty.WikittyObsoleteException;
import org.nuiton.wikitty.WikittyStorage;
import org.nuiton.wikitty.WikittyTransaction;
import org.nuiton.wikitty.WikittyUtil;
@@ -101,7 +101,7 @@
} else if (WikittyUtil.versionGreaterThan(requestedVersion, actualVersion)) { //requested version is newer
newVersion = requestedVersion;
} else { //requested version is obsolete
- throw new WikittyObseleteException(String.format(
+ throw new WikittyObsoleteException(String.format(
"Your wikitty '%s' is obsolete (saving: '%s'; existing: '%s')", wikittyId, requestedVersion, actualVersion));
}
}
1
0