|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 * Plug-in formatter / parser management |
|
17 * |
|
18 */ |
|
19 package com.nokia.tracecompiler.engine.rules; |
|
20 |
|
21 import java.util.ArrayList; |
|
22 import java.util.Iterator; |
|
23 |
|
24 import com.nokia.tracecompiler.engine.plugin.TraceAPIPluginManager; |
|
25 import com.nokia.tracecompiler.model.TraceModel; |
|
26 import com.nokia.tracecompiler.model.TraceObject; |
|
27 import com.nokia.tracecompiler.plugin.TraceAPIFormatter; |
|
28 import com.nokia.tracecompiler.plugin.TraceAPIParser; |
|
29 import com.nokia.tracecompiler.project.TraceProjectAPI; |
|
30 import com.nokia.tracecompiler.project.TraceProjectAPIList; |
|
31 |
|
32 /** |
|
33 * Plug-in formatter / parser management |
|
34 * |
|
35 */ |
|
36 final class RulesEnginePluginManager implements TraceAPIPluginManager, |
|
37 TraceProjectAPIList { |
|
38 |
|
39 /** |
|
40 * Rules engine |
|
41 */ |
|
42 private RulesEngine engine; |
|
43 |
|
44 /** |
|
45 * Trace model |
|
46 */ |
|
47 private TraceModel model; |
|
48 |
|
49 /** |
|
50 * List of API's |
|
51 */ |
|
52 private ArrayList<TraceProjectAPI> apis = new ArrayList<TraceProjectAPI>(); |
|
53 |
|
54 /** |
|
55 * Constructor |
|
56 * |
|
57 * @param engine |
|
58 * the plug-in engine |
|
59 */ |
|
60 RulesEnginePluginManager(RulesEngine engine) { |
|
61 this.engine = engine; |
|
62 } |
|
63 |
|
64 /* |
|
65 * (non-Javadoc) |
|
66 * |
|
67 * @see com.nokia.tracecompiler.engine.plugin.TraceAPIPluginManager# |
|
68 * addFormatters(com.nokia.tracecompiler.plugin.TraceAPIFormatter[]) |
|
69 */ |
|
70 public void addFormatters(TraceAPIFormatter[] formatters) { |
|
71 } |
|
72 |
|
73 /* |
|
74 * (non-Javadoc) |
|
75 * |
|
76 * @see com.nokia.tracecompiler.engine.plugin.TraceAPIPluginManager# |
|
77 * addParsers(com.nokia.tracecompiler.plugin.TraceAPIParser[]) |
|
78 */ |
|
79 public void addParsers(TraceAPIParser[] parsers) { |
|
80 } |
|
81 |
|
82 /* |
|
83 * (non-Javadoc) |
|
84 * |
|
85 * @see com.nokia.tracecompiler.engine.plugin.TraceAPIPluginManager#createDefaultAPI() |
|
86 */ |
|
87 public void createDefaultAPI() { |
|
88 engine.setDefaultTraceAPI(); |
|
89 } |
|
90 |
|
91 /* |
|
92 * (non-Javadoc) |
|
93 * |
|
94 * @see com.nokia.tracecompiler.model.TraceModelExtension#getOwner() |
|
95 */ |
|
96 public TraceObject getOwner() { |
|
97 return model; |
|
98 } |
|
99 |
|
100 /* |
|
101 * (non-Javadoc) |
|
102 * |
|
103 * @see com.nokia.tracecompiler.model.TraceModelExtension# |
|
104 * setOwner(com.nokia.tracecompiler.model.TraceObject) |
|
105 */ |
|
106 public void setOwner(TraceObject owner) { |
|
107 model = (TraceModel) owner; |
|
108 } |
|
109 |
|
110 /* |
|
111 * (non-Javadoc) |
|
112 * |
|
113 * @see com.nokia.tracecompiler.project.TraceProjectAPIList#getAPIs() |
|
114 */ |
|
115 public Iterator<TraceProjectAPI> getAPIs() { |
|
116 return apis.iterator(); |
|
117 } |
|
118 |
|
119 /** |
|
120 * Adds an API to the list |
|
121 * |
|
122 * @param api |
|
123 * the API |
|
124 */ |
|
125 void addAPI(TraceProjectAPI api) { |
|
126 apis.add(api); |
|
127 } |
|
128 |
|
129 } |