001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/search/tags/sakai_2-4-1/search-api/api/src/java/org/sakaiproject/search/model/SearchBuilderItem.java $
003: * $Id: SearchBuilderItem.java 29180 2007-04-19 02:27:58Z 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.model;
021:
022: import java.util.Date;
023:
024: /**
025: * Represents an operation or stat of a document in the search engine. This
026: * Object is used as a communication and persisntance mechanism between the
027: * changes made to entities and the thread processing the indec updates
028: *
029: * @author ieb
030: */
031: public interface SearchBuilderItem {
032: String getId();
033:
034: void setId(String id);
035:
036: /**
037: * Name of the resource in the search index
038: *
039: * @return
040: */
041: String getName();
042:
043: /**
044: * The name of the resource in the search index
045: *
046: * @param name
047: */
048: void setName(String name);
049:
050: /**
051: * A master record is used to override the indexer threa operation and avoid
052: * hude updates to the database in the request cycle.
053: */
054: public static final String INDEX_MASTER = "_master_control";
055:
056: /**
057: * The action being performent
058: *
059: * @return
060: */
061: Integer getSearchaction();
062:
063: /**
064: * The action being performed
065: *
066: * @param action
067: */
068: void setSearchaction(Integer searchaction);
069:
070: /**
071: * Action Unknown, usually becuase the record has just been created
072: */
073: public static final Integer ACTION_UNKNOWN = new Integer(0);
074:
075: /**
076: * Action ADD the record to the search engine, if the doc ID is set, then
077: * remove first, if not set, check its not there.
078: */
079: public static final Integer ACTION_ADD = new Integer(1);
080:
081: /**
082: * Action DELETE the record from the search engine, once complete delete the
083: * record
084: */
085: public static final Integer ACTION_DELETE = new Integer(2);
086:
087: /**
088: * The action REBUILD causes the indexer thread to rebuild the index from
089: * scratch, refetching all entities This sould only ever appear on the
090: * master record
091: */
092: public static final Integer ACTION_REBUILD = new Integer(11);
093:
094: /**
095: * The action REFRESH causes the indexer thread to refresh the search index
096: * from the current set of entities. If a Rebuild is in progress, the
097: * refresh will not overrise the rebuild
098: */
099: public static final Integer ACTION_REFRESH = new Integer(10);
100:
101: /**
102: * The state of the record
103: *
104: * @return
105: */
106: Integer getSearchstate();
107:
108: /**
109: * The state of the record
110: *
111: * @param state
112: */
113: void setSearchstate(Integer searchstate);
114:
115: /**
116: * Unknown state
117: */
118: public static final Integer STATE_UNKNOWN = new Integer(0);
119:
120: /**
121: * Operation pending
122: */
123: public static final Integer STATE_PENDING = new Integer(1);
124:
125: /**
126: * Operation completed
127: */
128: public static final Integer STATE_COMPLETED = new Integer(2);
129:
130: public static final Integer STATE_PENDING_2 = new Integer(3);
131:
132: /**
133: * Locked for processng
134: */
135: public static final Integer STATE_LOCKED = new Integer(5);
136:
137: /**
138: * The last update to the record
139: *
140: * @return
141: */
142: Date getVersion();
143:
144: /**
145: * The last update to the record
146: *
147: * @param lastupdate
148: */
149: void setVersion(Date version);
150:
151: /**
152: * The context of the index item
153: * @return
154: */
155: String getContext();
156:
157: /**
158: * The context of the index item
159: * @param context
160: */
161: void setContext(String context);
162:
163: public static final String GLOBAL_CONTEXT = "global";
164:
165: public static final String GLOBAL_MASTER = SearchBuilderItem.INDEX_MASTER
166: + "_" + SearchBuilderItem.GLOBAL_CONTEXT;
167:
168: public static final String SITE_MASTER_FORMAT = SearchBuilderItem.INDEX_MASTER
169: + "_{0}";
170:
171: public static final String SITE_MASTER_PATTERN = SearchBuilderItem.INDEX_MASTER
172: + "_%";
173:
174: public static final String[] states = new String[] { "Unknown",
175: "Pending", "Complete", "Pending2", "Locked" };
176: public static final String[] actions = new String[] { "Unknown",
177: "Add", "Delete", "-", "-", "-", "-", "-", "-", "-",
178: "Refresh", "Rebuild" };
179:
180: }
|