[Javamatch-cvs] javamatch/src/net/sourceforge/javamatch/engine JDOMatchEngine.java,NONE,1.1 MatchEng
Status: Pre-Alpha
Brought to you by:
iterson
From: Walter v. I. <it...@us...> - 2004-09-20 08:25:55
|
Update of /cvsroot/javamatch/javamatch/src/net/sourceforge/javamatch/engine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2618/src/net/sourceforge/javamatch/engine Modified Files: MatchEngine.java Added Files: JDOMatchEngine.java Log Message: Added (unoptimized) JDO implementation Index: MatchEngine.java =================================================================== RCS file: /cvsroot/javamatch/javamatch/src/net/sourceforge/javamatch/engine/MatchEngine.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MatchEngine.java 14 Sep 2004 13:29:25 -0000 1.5 --- MatchEngine.java 20 Sep 2004 08:25:46 -0000 1.6 *************** *** 136,141 **** * Retrieves and returns the object or object with the given identifier from * the underlying persistent storage mechanism, if any. By default, returns ! * the same object. This method notifies the registered listeners that the ! * object has been retrieved * @param objectToRetrieve the object or object identifier to retrieve * @return the object that is retrieved --- 136,140 ---- * Retrieves and returns the object or object with the given identifier from * the underlying persistent storage mechanism, if any. By default, returns ! * the same object. * @param objectToRetrieve the object or object identifier to retrieve * @return the object that is retrieved *************** *** 151,156 **** * Discards the given object from memory. After discarding, the match engine * will not call this object again (the calling application might still do ! * so, but that's up to that application. This method notifies the ! * registered listeners that the object is about to be discarded * @param objectToDiscard the object to discard */ --- 150,154 ---- * Discards the given object from memory. After discarding, the match engine * will not call this object again (the calling application might still do ! * so, but that's up to that application. * @param objectToDiscard the object to discard */ --- NEW FILE: JDOMatchEngine.java --- /* JavaMatch: Matching engine for Java runtime data structures * Copyright (C) 2004 Walter van Iterson * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package net.sourceforge.javamatch.engine; import net.sourceforge.javamatch.query.*; import java.util.*; import javax.jdo.*; /** * Class JDOMatchEngine provides the match engine functionality, especially * targeted at JDO implementations */ public class JDOMatchEngine extends MatchEngine { /** The persistance manager, that manges object persistence */ private PersistenceManager persistenceManager; /** * Creates an ew JDOMatchEngine, that uses the given persistenceManager for * managing object persistence * @param persistenceManager the persistence manager */ public JDOMatchEngine(PersistenceManager persistenceManager) { if (persistenceManager == null) { throw new NullPointerException("Can't create JDOMatchEngine without " + "persistence manager"); } this.persistenceManager = persistenceManager; } /** * Executes the specified match query on all objects in the given Extent. * Returns a MatchResult, that contains the best matching items with their * match value. * @param query the query that is executed * @param extent the extent that contains the items to be matched * @return a MatchResult, that contains the best matching ResultItems * @throws MatchException when matching failed */ public MatchResult executeQuery(MatchQuery query, Extent extent) throws MatchException { if (extent == null) { throw new NullPointerException("Match engine can't execute a query " + "on a null extent"); } Iterator iterator1 = extent.iterator(); Iterator iterator2 = extent.iterator(); try { return executeQuery(query, iterator1, iterator2); } finally { extent.close(iterator1); extent.close(iterator2); } } /** * Discards the given object from memory. After discarding, the match engine * will not call this object again (the calling application might still do * so, but that's up to that application. * @param objectToDiscard the object to discard */ protected void discardObject(Object objectToDiscard) { // Give a hint to the persistence manager that this object isn't used // any more persistenceManager.evict(objectToDiscard); } } |