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.gps.spi;
018:
019: import org.compass.core.Compass;
020: import org.compass.core.CompassCallback;
021: import org.compass.core.CompassException;
022: import org.compass.core.mapping.CascadeMapping;
023: import org.compass.core.mapping.ResourceMapping;
024: import org.compass.gps.CompassGps;
025:
026: /**
027: * An extension to the {@link org.compass.gps.CompassGps} interface
028: * which should be used by devices. Provides abstraction from the actual
029: * <code>Compass</code> instances management.
030: *
031: * @author kimchy
032: */
033: public interface CompassGpsInterfaceDevice extends CompassGps {
034:
035: /**
036: * Returns <code>true</code> if there is mapping for the given class when
037: * performing the mirror operation.
038: */
039: boolean hasMappingForEntityForMirror(Class clazz,
040: CascadeMapping.Cascade cascade) throws CompassException;
041:
042: /**
043: * Returns <code>true</code> if there is mapping for the given name (alias
044: * or class name) when performing the mirror operation.
045: */
046: boolean hasMappingForEntityForMirror(String name,
047: CascadeMapping.Cascade cascade) throws CompassException;
048:
049: /**
050: * Returns <code>true</code> if there is mapping for the given class when
051: * performing the index operation.
052: */
053: boolean hasMappingForEntityForIndex(Class clazz)
054: throws CompassException;
055:
056: /**
057: * Returns <code>true</code> if there is mapping for the given name (alias
058: * or class name) when performing the index operation.
059: */
060: boolean hasMappingForEntityForIndex(String name)
061: throws CompassException;
062:
063: /**
064: * Returns the mapping of the given name (alias or class name) when performing
065: * the index operation.
066: */
067: ResourceMapping getMappingForEntityForIndex(String name)
068: throws CompassException;
069:
070: /**
071: * Returns the mapping for the given class name when performing the index operation.
072: */
073: ResourceMapping getMappingForEntityForIndex(Class clazz)
074: throws CompassException;
075:
076: /**
077: * Executes the given callback for index operations.
078: */
079: void executeForIndex(CompassCallback callback)
080: throws CompassException;
081:
082: /**
083: * Executes the given callback for mirror operations.
084: */
085: void executeForMirror(CompassCallback callback)
086: throws CompassException;
087:
088: /**
089: * Returns the <code>Compass</code> instance used for indexing. Note that
090: * no operations that will affect the index should be made using it, use
091: * {@link #executeForIndex(CompassCallback)} operation instead.
092: */
093: Compass getIndexCompass();
094:
095: /**
096: * Returns the <code>Compass</code> instance used for mirroring. Note that
097: * no operations that will affect the index should be made using it, use
098: * {@link #executeForMirror(CompassCallback)} operation instead.
099: */
100: Compass getMirrorCompass();
101: }
|