001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/search/tags/sakai_2-4-1/search-api/api/src/java/org/sakaiproject/search/api/SearchIndexBuilder.java $
003: * $Id: SearchIndexBuilder.java 29315 2007-04-20 14:28:12Z ajpoland@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.search.api;
021:
022: import java.util.List;
023:
024: import org.sakaiproject.event.api.Event;
025: import org.sakaiproject.event.api.Notification;
026: import org.sakaiproject.search.model.SearchWriterLock;
027:
028: /**
029: * A SearchIndexBuilder builds a search index, it must manage its own list of
030: * pending documents and should probably do this in a seperate thread
031: *
032: * @author ieb
033: */
034: public interface SearchIndexBuilder extends Diagnosable {
035:
036: /**
037: * Adds a resource to the index builder
038: *
039: * @param notification
040: * @param event
041: */
042: void addResource(Notification notification, Event event);
043:
044: /**
045: * EntityProducers that want their content indexed on full text must
046: * register an EntityContentProducer with the SearchIndexBuilder
047: *
048: * @param ecp
049: */
050: void registerEntityContentProducer(EntityContentProducer ecp);
051:
052: /**
053: * Refresh the index based on the registered entities
054: */
055: void refreshIndex();
056:
057: /**
058: * rebuild the index completely from scratch
059: */
060: void rebuildIndex();
061:
062: /**
063: * Does the Queue contain work to do.
064: *
065: * @return
066: */
067: boolean isBuildQueueEmpty();
068:
069: /**
070: * get all the producers registerd, as a clone to avoid concurrent
071: * modification exceptions
072: *
073: * @return
074: */
075: List getContentProducers();
076:
077: /**
078: * Close down the entire search infrastructure
079: */
080: void destroy();
081:
082: /**
083: * get the number of pending documents
084: *
085: * @return
086: */
087: int getPendingDocuments();
088:
089: /**
090: * Rebuild the index for the supplied siteId
091: * @param currentSiteId
092: */
093: void rebuildIndex(String currentSiteId);
094:
095: /**
096: * Refresh the index for the supplied siteId
097: * @param currentSiteId
098: */
099: void refreshIndex(String currentSiteId);
100:
101: /**
102: * get a list of all entitied in the search index
103: * @return
104: */
105: List getAllSearchItems();
106:
107: /**
108: * get an entity content producer that can handle the event
109: * @param event
110: * @return
111: */
112: EntityContentProducer newEntityContentProducer(Event event);
113:
114: /**
115: * get an entity content procuder that can handle the reference
116: * @param ref
117: * @return
118: */
119: EntityContentProducer newEntityContentProducer(String ref);
120:
121: /**
122: * get a list of Master Search Items that control the search operation for the
123: * Site (current site)
124: * @return
125: */
126: List getSiteMasterSearchItems();
127:
128: /**
129: * get a list of global search items
130: * @return
131: */
132: List getGlobalMasterSearchItems();
133:
134: /**
135: * get the current search lock
136: * @return
137: */
138: SearchWriterLock getCurrentLock();
139:
140: /**
141: * provide a list of node statuses for all indexer nodes in a cluster
142: * @return
143: */
144: List getNodeStatus();
145:
146: /**
147: * force the removal of a worker lock
148: * @return
149: */
150: boolean removeWorkerLock();
151:
152: String getLastDocument();
153:
154: String getLastElapsed();
155:
156: String getCurrentDocument();
157:
158: String getCurrentElapsed();
159:
160: boolean isOnlyIndexSearchToolSites();
161:
162: /**
163: * @return
164: */
165: boolean isLocalLock();
166:
167: }
|