r1292 - in trunk: src/site/rst wikitty-api/src/main/java/org/nuiton/wikitty/query/conditions wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr
Author: bpoussin Date: 2012-01-07 11:37:00 +0100 (Sat, 07 Jan 2012) New Revision: 1292 Url: http://nuiton.org/repositories/revision/wikitty/1292 Log: reelle suppression de fichier qui ne devrait plus exister Removed: trunk/src/site/rst/DevDoc.rst trunk/wikitty-api/src/main/java/org/nuiton/wikitty/query/conditions/ConditionNary.java trunk/wikitty-api/src/main/java/org/nuiton/wikitty/query/conditions/ConditionUnary.java trunk/wikitty-api/src/main/java/org/nuiton/wikitty/query/conditions/Join.java trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittyQueryParser.java Deleted: trunk/src/site/rst/DevDoc.rst =================================================================== --- trunk/src/site/rst/DevDoc.rst 2012-01-06 17:09:23 UTC (rev 1291) +++ trunk/src/site/rst/DevDoc.rst 2012-01-07 10:37:00 UTC (rev 1292) @@ -1,51 +0,0 @@ -.. - -.. * #%L -.. * Wikitty -.. * -.. * $Id$ -.. * $HeadURL$ -.. * %% -.. * Copyright (C) 2009 - 2010 CodeLutin -.. * %% -.. * This program is free software: you can redistribute it and/or modify -.. * it under the terms of the GNU Lesser General Public License as -.. * published by the Free Software Foundation, either version 3 of the -.. * License, or (at your option) any later version. -.. * -.. * This program is distributed in the hope that it will be useful, -.. * but WITHOUT ANY WARRANTY; without even the implied warranty of -.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -.. * GNU General Lesser Public License for more details. -.. * -.. * You should have received a copy of the GNU General Lesser Public -.. * License along with this program. If not, see -.. * <http://www.gnu.org/licenses/lgpl-3.0.html>. -.. * #L% -.. - -========================= -Documentation développeur -========================= - -Si vous souhaitez utiliser le module de cache en même temps que le module -de sécurité, cela implique une bonne utilisation et de faire attention à certaine -chose. Il faut faire attention qu'un utilisateur qui a récupéré un objet ne le -rende pas disponible à un autre utilisateur au travers du cache. -Il faut donc que la couche de sécurité soit toujours au dessus de la couche de -cache. - -De la même façon, si l'on a mis du cache côté client dans certain cas, il faudra -aussi remettre la couche de sécurité. Cela arrive si le côté client est -multi-utilisateur. Si ce n'est pas le cas, il n'est pas nécessaire de le faire. - -:: - - +--------------+ +--------------+ - proxy ------->| sécurité |<----+ | sécurité |<------ Proxy - +--------------+ | +--------------+ - | cache | | | cache | - +--------------+ | +--------------+ - | notification | | | notification | - +--------------+ | +--------------+ - | WS Impl | +----| WS Hessian | - +--------------+ +--------------+ - serveur client Deleted: trunk/wikitty-api/src/main/java/org/nuiton/wikitty/query/conditions/ConditionNary.java =================================================================== --- trunk/wikitty-api/src/main/java/org/nuiton/wikitty/query/conditions/ConditionNary.java 2012-01-06 17:09:23 UTC (rev 1291) +++ trunk/wikitty-api/src/main/java/org/nuiton/wikitty/query/conditions/ConditionNary.java 2012-01-07 10:37:00 UTC (rev 1292) @@ -1,114 +0,0 @@ -/* - * #%L - * Wikitty :: api - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 CodeLutin, Benjamin Poussin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ -package org.nuiton.wikitty.query.conditions; - -import java.util.LinkedList; -import java.util.List; -import org.apache.commons.lang.ObjectUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.wikitty.query.WikittyQueryVisitor; - -/** - * Cette classe est la classe parente de tous les objets ayant en interne - * une liste de restrictions non terminale (ex: And, Or) - * - * @author poussin - * @version $Revision$ - * @since 3.3 - * - * Last update: $Date$ - * by : $Author$ - */ -public abstract class ConditionNary extends Condition { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private Log log = LogFactory.getLog(ConditionNary.class); - - protected List<Condition> conditions; - - public ConditionNary() { - } - - /** - * Initialyse condition with list passed in argument, parameter list is - * copied internaly to prevent extern modification - * - * @param c - */ - public ConditionNary(List<Condition> c) { - this.conditions = new LinkedList<Condition>(c); - } - - @Override - public void accept(WikittyQueryVisitor visitor) { - boolean walk = visitor.visitEnter(this); - if (walk && conditions != null) { - boolean notFirst = false; - for (Condition r : conditions) { - if (notFirst) { - walk = visitor.visitMiddle(this); - if (!walk) { - // le visiteur demande l'arret de la visite - break; - } - } else { - notFirst = true; - } - r.accept(visitor); - } - } - visitor.visitLeave(this, walk); - } - - @Override - boolean equalsDeep(Object other) { - ConditionNary op = (ConditionNary)other; - boolean result = ObjectUtils.equals( - this.getConditions(), op.getConditions()); - return result; - } - - /** - * Return Restriction list. This list is never null, but can be empty - * @return - */ - public List<Condition> getConditions() { - if (conditions == null) { - conditions = new LinkedList<Condition>(); - } - return conditions; - } - - @Override - public void addCondition(Condition c) { - if (c != null) { - checkAddCondition(c); - getConditions().add(c); - } - } - - -} Deleted: trunk/wikitty-api/src/main/java/org/nuiton/wikitty/query/conditions/ConditionUnary.java =================================================================== --- trunk/wikitty-api/src/main/java/org/nuiton/wikitty/query/conditions/ConditionUnary.java 2012-01-06 17:09:23 UTC (rev 1291) +++ trunk/wikitty-api/src/main/java/org/nuiton/wikitty/query/conditions/ConditionUnary.java 2012-01-07 10:37:00 UTC (rev 1292) @@ -1,90 +0,0 @@ -/* - * #%L - * Wikitty :: api - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 CodeLutin, Benjamin Poussin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ -package org.nuiton.wikitty.query.conditions; - -import org.apache.commons.lang.ObjectUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.wikitty.WikittyException; -import org.nuiton.wikitty.query.WikittyQueryVisitor; - -/** - * Cette classe est la classe parente de tous les objets ayant en interne - * une restriction non terminale (ex: Not) - * - * @author poussin - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ - */ -public abstract class ConditionUnary extends Condition { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private Log log = LogFactory.getLog(ConditionUnary.class); - - protected Condition subCondition; - - public ConditionUnary() { - } - - public ConditionUnary(Condition restriction) { - this.subCondition = restriction; - } - - @Override - public void addCondition(Condition c) { - checkAddCondition(c); - if (subCondition == null) { - this.subCondition = c; - } else { - throw new WikittyException(String.format( - "ConditionUnary (%s) can't have more than one condition", - getClass().getSimpleName())); - } - } - - @Override - public void accept(WikittyQueryVisitor visitor) { - boolean walk = visitor.visitEnter(this); - if (walk && subCondition != null) { - subCondition.accept(visitor); - } - visitor.visitLeave(this, walk); - } - - @Override - boolean equalsDeep(Object other) { - ConditionUnary op = (ConditionUnary)other; - boolean result = ObjectUtils.equals( - this.getSubCondition(), op.getSubCondition()); - return result; - } - - public Condition getSubCondition() { - return subCondition; - } - -} Deleted: trunk/wikitty-api/src/main/java/org/nuiton/wikitty/query/conditions/Join.java =================================================================== --- trunk/wikitty-api/src/main/java/org/nuiton/wikitty/query/conditions/Join.java 2012-01-06 17:09:23 UTC (rev 1291) +++ trunk/wikitty-api/src/main/java/org/nuiton/wikitty/query/conditions/Join.java 2012-01-07 10:37:00 UTC (rev 1292) @@ -1,75 +0,0 @@ -/* - * #%L - * Wikitty :: api - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 CodeLutin, Benjamin Poussin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ -package org.nuiton.wikitty.query.conditions; - -import org.apache.commons.lang.ObjectUtils; - -/** - * Join is used to join to Wikitty type. - * - * ex: - * <li> {@link WikittyQueryMaker}.join(myfield).eq(otherwikittyfield, "toto") - * is equivalent to - * <li> {@link WikittyQueryMaker}.containsOne(myfield, id1, id2, id3) - * where [id1, id2, id3] is id retrieved by query eq(otherwikittyfield, "toto") - * - * @author poussin - * @version $Revision$ - * @since 3.3 - * - * Last update: $Date$ - * by : $Author$ - */ -public class Join extends ConditionUnary { - - private static final long serialVersionUID = 1L; - - protected Element element; - - public Join(Element element) { - this.element = element; - } - - public Join(Element element, Condition restriction) { - super(restriction); - this.element = element; - } - - public Element getElement() { - return element; - } - - @Override - boolean equalsDeep(Object other) { - boolean result = super.equalsDeep(other); - if (result) { - Join op = (Join)other; - result = ObjectUtils.equals(this.getElement(), op.getElement()); - } - return result; - } - - -} Deleted: trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittyQueryParser.java =================================================================== --- trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittyQueryParser.java 2012-01-06 17:09:23 UTC (rev 1291) +++ trunk/wikitty-solr/src/main/java/org/nuiton/wikitty/storage/solr/WikittyQueryParser.java 2012-01-07 10:37:00 UTC (rev 1292) @@ -1,102 +0,0 @@ -/* - * #%L - * Wikitty :: wikitty-solr-impl - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ -package org.nuiton.wikitty.storage.solr; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.lucene.queryParser.ParseException; -import org.apache.lucene.queryParser.QueryParser; -import org.apache.lucene.search.Query; -import org.apache.solr.common.params.CommonParams; -import org.apache.solr.common.params.SolrParams; -import org.apache.solr.common.util.NamedList; -import org.apache.solr.request.SolrQueryRequest; -import org.apache.solr.search.LuceneQParserPlugin; -import org.apache.solr.search.QParser; -import org.apache.solr.search.QueryParsing; -import org.apache.solr.search.SolrQueryParser; - -/** - * Add allow leading wildcard - * setAllowLeadingWildcard(true); - * <br>Example: <code>{!wikitty q.op=AND df=text sort='price asc'}myfield:foo +bar -baz</code> - * More information @see LuceneQParserPlugin - */ -public class WikittyQueryParser extends LuceneQParserPlugin { - - public static String NAME = "wikitty"; - - @Override - public void init(NamedList args) { - } - - @Override - public QParser createParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { - return new SolrQParser(qstr, localParams, params, req); - } - - static public class SolrQParser extends QParser { - - static private Log log = LogFactory.getLog(SolrQParser.class); - String sortStr; - SolrQueryParser lparser; - - public SolrQParser(String qstr, SolrParams localParams, SolrParams params, SolrQueryRequest req) { - super(qstr, localParams, params, req); - } - - @Override - public Query parse() throws ParseException { - - String defaultField = getParam(CommonParams.DF); - if (defaultField == null) { - // TODO poussin 20101216 normalement on devrait retrouver cette - // valeur dans la config. Mais en fait a chaque fois on passe - // ici car defaultField est null :( alors que dans schema.xml - // on a bien defini le defaultField :( - defaultField = WikittySolrConstant.SOLR_FULLTEXT; - } - - lparser = new SolrQueryParser(this, defaultField); - lparser.setAllowLeadingWildcard(true); - - String opParam = getParam(QueryParsing.OP); - if (opParam != null) { - lparser.setDefaultOperator("AND".equals(opParam) ? QueryParser.Operator.AND : QueryParser.Operator.OR); - } - - String qstr = getString(); - if (log.isDebugEnabled()) { - log.debug("Query parse : " + qstr); - } - return lparser.parse(qstr); - } - - @Override - public String[] getDefaultHighlightFields() { - return new String[]{lparser.getField()}; - } - } -}
participants (1)
-
bpoussin@users.nuiton.org