KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > repo > search > IndexerComponent


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.repo.search;
18
19 import org.alfresco.service.cmr.repository.ChildAssociationRef;
20 import org.alfresco.service.cmr.repository.NodeRef;
21
22 /**
23  * Component API for indexing. Delegates to the real index retrieved from the
24  * {@link #indexerAndSearcherFactory}
25  *
26  * Transactional support is free.
27  *
28  * @see Indexer
29  *
30  * @author andyh
31  *
32  */

33 public class IndexerComponent implements Indexer
34 {
35     private IndexerAndSearcher indexerAndSearcherFactory;
36
37     public void setIndexerAndSearcherFactory(IndexerAndSearcher indexerAndSearcherFactory)
38     {
39         this.indexerAndSearcherFactory = indexerAndSearcherFactory;
40     }
41
42     public void createNode(ChildAssociationRef relationshipRef)
43     {
44         Indexer indexer = indexerAndSearcherFactory.getIndexer(
45                 relationshipRef.getChildRef().getStoreRef());
46         indexer.createNode(relationshipRef);
47     }
48
49     public void updateNode(NodeRef nodeRef)
50     {
51         Indexer indexer = indexerAndSearcherFactory.getIndexer(nodeRef.getStoreRef());
52         indexer.updateNode(nodeRef);
53     }
54
55     public void deleteNode(ChildAssociationRef relationshipRef)
56     {
57         Indexer indexer = indexerAndSearcherFactory.getIndexer(
58                 relationshipRef.getChildRef().getStoreRef());
59         indexer.deleteNode(relationshipRef);
60     }
61
62     public void createChildRelationship(ChildAssociationRef relationshipRef)
63     {
64         Indexer indexer = indexerAndSearcherFactory.getIndexer(
65                 relationshipRef.getChildRef().getStoreRef());
66         indexer.createChildRelationship(relationshipRef);
67     }
68
69     public void updateChildRelationship(ChildAssociationRef relationshipBeforeRef, ChildAssociationRef relationshipAfterRef)
70     {
71         Indexer indexer = indexerAndSearcherFactory.getIndexer(
72                 relationshipBeforeRef.getChildRef().getStoreRef());
73         indexer.updateChildRelationship(relationshipBeforeRef, relationshipAfterRef);
74     }
75
76     public void deleteChildRelationship(ChildAssociationRef relationshipRef)
77     {
78         Indexer indexer = indexerAndSearcherFactory.getIndexer(
79                 relationshipRef.getChildRef().getStoreRef());
80         indexer.deleteChildRelationship(relationshipRef);
81     }
82
83 }
84
Popular Tags