Index: topia2/src/java/org/codelutin/topia/TopiaContext.java diff -u topia2/src/java/org/codelutin/topia/TopiaContext.java:1.17 topia2/src/java/org/codelutin/topia/TopiaContext.java:1.18 --- topia2/src/java/org/codelutin/topia/TopiaContext.java:1.17 Fri Oct 13 12:20:00 2006 +++ topia2/src/java/org/codelutin/topia/TopiaContext.java Mon Oct 16 15:38:20 2006 @@ -23,9 +23,9 @@ * Created: 3 janv. 2006 21:18:34 * * @author poussin - * @version $Revision: 1.17 $ + * @version $Revision: 1.18 $ * - * Last update: $Date: 2006/10/13 12:20:00 $ + * Last update: $Date: 2006/10/16 15:38:20 $ * by : $Author: bpoussin $ */ @@ -236,12 +236,16 @@ */ public void restore(File file) throws TopiaException; + public boolean isHistoryEnabled(); + + public TopiaHistoryService getHistoryService(); + public boolean isIndexEnabled(); /** * Renvoie le moteur d'indexation, s'il n'y en a pas retourne null */ - public IndexEnginService getIndexEngin(); + public TopiaIndexService getIndexService(); /** * Renvoie le TopiaSecurityManager indiqué dans les propriétés. Si le type de Index: topia2/src/java/org/codelutin/topia/TopiaHistoryService.java diff -u /dev/null topia2/src/java/org/codelutin/topia/TopiaHistoryService.java:1.1 --- /dev/null Mon Oct 16 15:38:25 2006 +++ topia2/src/java/org/codelutin/topia/TopiaHistoryService.java Mon Oct 16 15:38:20 2006 @@ -0,0 +1,81 @@ +/* *##% + * Copyright (C) 2006 + * Code Lutin, Cédric Pineau, Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * TopiaHistoryService.java + * + * Created: 14 oct. 06 00:58:13 + * + * @author poussin + * @version $Revision: 1.1 $ + * + * Last update: $Date: 2006/10/16 15:38:20 $ + * by : $Author: bpoussin $ + */ + +package org.codelutin.topia; + +import java.io.Writer; +import java.util.Date; +import java.util.List; + +import org.codelutin.topia.framework.TopiaService; + + +/** + * @author poussin + */ +public interface TopiaHistoryService extends TopiaService { + + /** + * Supprime tout l'historique jusqu'a la date passé en parametre + * @param toDate la derniere date effacé inclue + */ + public void clear(Date toDate) throws Exception; + + /** + * Ne garde dans l'historique que les number dernier elements + * @param number le nombre d'element a conserver dans l'historique + */ + public void keep(int number) throws Exception; + + /** + * Permet de stocker l'historique dans un writer (par exemple un fichier) + * + * @param toDate l'historique est sauve jusqu'a cette date incluse + * @param out le flux sur lequel il faut ecrire l'historique + */ + public void store(Date toDate, Writer out) throws Exception; + + /** + * Search TopiaId targeted by action and user. Results are ordered by + * date last is oldest + * + * @param limit maximum number of result, -1 for all + * @param user TopiaId of user, can be null for all user + * @param type type of target search (fqn class) can be null for all object + * @param Action action as int that we want to search, can be an sum of + * action wanted LOAD + UPDATE + DELETE + CREATE for all action + * @return TopiaId of target object + */ + public List findLastAction(int limit, String user, String type, int ... action) throws Exception; + +} + + Index: topia2/src/java/org/codelutin/topia/TopiaIndexService.java diff -u /dev/null topia2/src/java/org/codelutin/topia/TopiaIndexService.java:1.1 --- /dev/null Mon Oct 16 15:38:25 2006 +++ topia2/src/java/org/codelutin/topia/TopiaIndexService.java Mon Oct 16 15:38:20 2006 @@ -0,0 +1,85 @@ +/* *##% + * Copyright (C) 2006 + * Code Lutin, Cédric Pineau, Benjamin Poussin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * 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 Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + *##%*/ + +/* * + * IndexEngin.java + * + * Created: 8 oct. 06 17:15:00 + * + * @author poussin + * @version $Revision: 1.1 $ + * + * Last update: $Date: 2006/10/16 15:38:20 $ + * by : $Author: bpoussin $ + */ + +package org.codelutin.topia; + +import java.util.Map; +import java.util.SortedSet; + +import org.codelutin.topia.framework.TopiaService; +import org.codelutin.topia.index.IndexEntry; + + +/** + * User visible interface for indexation engin + * + * To use indexer you must have properties defined in config file: + *
  • topia.index.engin=[class used to indexation] + *
  • possible specific property for index engin used + * + * Usage example: + *
    + * SortedSet<IndexEntry> result = context.getIndexEngin().search("quelque chose")
    + * SortedSet<IndexEntry> result = context.getIndexEngin().search("class:org.codelutin.chorem.entities.Person name:poussin")
    + * // or with map 
    + * Map m = new HashMap();
    + * m.put("class", "org.codelutin.chorem.entities.Person");
    + * m.put("name", "poussin");
    + * SortedSet<IndexEntry> result = context.getIndexEngin().search(m);
    + * 
    + * + + * @author poussin + */ +public interface TopiaIndexService extends TopiaService { + + /** + * Permet de faire une recherche, par exemple: + * + * class:org.codelutin.chorem.entities.Person name:poussin + * + * @param queryText + * @return une list triée, le premier élement a le plus gros score + */ + public SortedSet search(String queryText); + + /** + * Permet de faire une recherche + * + * @param query la cle de la map est le nom du champ sur lequel faire la + * recherche, et la valeur la valeur souhaitée pour ce champs + * @return une list triée, le premier élement a le plus gros score + */ + public SortedSet search(Map query); + +} + +