001: /*
002: * Copyright 2004-2006 the original author or authors.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.compass.core;
018:
019: import java.io.Reader;
020:
021: import org.compass.core.engine.SearchEngineException;
022: import org.compass.core.mapping.ResourcePropertyMapping;
023:
024: /**
025: * @author kimchy
026: */
027: public interface ResourceFactory {
028:
029: /**
030: * Returns a null value that represents no entry in the search engine.
031: * Usefull when the system needs to store an actual data entry, but for it
032: * to represent a business null value.
033: */
034: String getNullValue();
035:
036: /**
037: * Returns true if the value is marked as a null value.
038: */
039: boolean isNullValue(String value);
040:
041: /**
042: * Creates a resource, that is used with the actual Search Engine
043: * implementation.
044: */
045: Resource createResource(String alias) throws SearchEngineException;
046:
047: /**
048: * Creates a Property that is used with the actual Search Engine
049: */
050: Property createProperty(String value,
051: ResourcePropertyMapping mapping)
052: throws SearchEngineException;
053:
054: Property createProperty(String value,
055: ResourcePropertyMapping mapping, Property.Store store,
056: Property.Index index) throws SearchEngineException;
057:
058: /**
059: * Creates a Property that is used with the actual Search Engine
060: */
061: Property createProperty(String name, String value,
062: ResourcePropertyMapping mapping)
063: throws SearchEngineException;
064:
065: /**
066: * Creates a Property that is used with the actual Search Engine
067: */
068: Property createProperty(String name, String value,
069: Property.Store store, Property.Index index)
070: throws SearchEngineException;
071:
072: /**
073: * Creates a Property that is used with the actual Search Engine. The
074: * available values for the store and index parameters are provided in the
075: * Property interface (Property.Store, Property.Index, Property.TermVector).
076: */
077: Property createProperty(String name, String value,
078: Property.Store store, Property.Index index,
079: Property.TermVector termVector)
080: throws SearchEngineException;
081:
082: /**
083: * Creates a property (TEXT type) for the specified reader.
084: */
085: Property createProperty(String name, Reader value)
086: throws SearchEngineException;
087:
088: /**
089: * Creates a property (indexed, and not stored) for the specified reader.
090: */
091: Property createProperty(String name, Reader value,
092: Property.TermVector termVector)
093: throws SearchEngineException;
094:
095: /**
096: * Creates a binary property.
097: */
098: Property createProperty(String name, byte[] value,
099: Property.Store store) throws SearchEngineException;
100: }
|