1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/*******************************************************************************
* Copyright (c) 2012 Boeing.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
package org.eclipse.osee.orcs.core.internal.search;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsSession;
import org.eclipse.osee.orcs.core.ds.QueryEngine;
import org.eclipse.osee.orcs.core.internal.HasStatistics;
import org.eclipse.osee.orcs.core.internal.graph.GraphBuilderFactory;
import org.eclipse.osee.orcs.core.internal.graph.GraphProvider;
import org.eclipse.osee.orcs.core.internal.proxy.ExternalArtifactManager;
import org.eclipse.osee.orcs.data.ArtifactTypes;
import org.eclipse.osee.orcs.data.AttributeTypes;
import org.eclipse.osee.orcs.search.QueryFactory;
import org.eclipse.osee.orcs.statistics.QueryStatistics;
/**
* @author Roberto E. Escobar
*/
public class QueryModule implements HasStatistics<QueryStatistics> {
private final QueryStatisticsImpl statistics = new QueryStatisticsImpl();
private final CriteriaFactory criteriaFctry;
private final CallableQueryFactory artQueryFactory;
private final BranchCallableQueryFactory branchQueryFactory;
private final BranchCriteriaFactory branchCriteriaFactory;
public QueryModule(Log logger, QueryEngine queryEngine, GraphBuilderFactory builderFactory, GraphProvider provider, ArtifactTypes artifactTypeCache, AttributeTypes attributeTypeCache, ExternalArtifactManager proxyManager) {
QueryStatsCollectorImpl queryStatsCollector = new QueryStatsCollectorImpl(statistics);
criteriaFctry = new CriteriaFactory(artifactTypeCache, attributeTypeCache);
artQueryFactory =
new CallableQueryFactory(logger, queryEngine, queryStatsCollector, builderFactory, provider, proxyManager);
branchCriteriaFactory = new BranchCriteriaFactory();
branchQueryFactory = new BranchCallableQueryFactory(logger, queryEngine, queryStatsCollector);
}
public QueryFactory createQueryFactory(OrcsSession session) {
return new QueryFactoryImpl(session, criteriaFctry, artQueryFactory, branchCriteriaFactory, branchQueryFactory);
}
@Override
public QueryStatistics getStatistics(OrcsSession session) {
return statistics.clone();
}
@Override
public void clearStatistics(OrcsSession session) {
statistics.clear();
}
}
|