blob: 5a4865b533bf6d480c865aa2cdea425a4867e0cf [file] [log] [blame]
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07001/*
2 * Copyright 2014 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
Brian O'Connorabafb502014-12-02 22:26:20 -080016package org.onosproject.net.intent.impl;
Brian O'Connor66630c82014-10-02 21:08:19 -070017
Brian O'Connor64a0369d2015-02-20 22:02:59 -080018import com.google.common.collect.ImmutableList;
Brian O'Connor66630c82014-10-02 21:08:19 -070019import org.apache.felix.scr.annotations.Activate;
20import org.apache.felix.scr.annotations.Component;
21import org.apache.felix.scr.annotations.Deactivate;
22import org.apache.felix.scr.annotations.Reference;
23import org.apache.felix.scr.annotations.ReferenceCardinality;
24import org.apache.felix.scr.annotations.Service;
Brian O'Connorabafb502014-12-02 22:26:20 -080025import org.onosproject.core.CoreService;
26import org.onosproject.core.IdGenerator;
27import org.onosproject.event.AbstractListenerRegistry;
28import org.onosproject.event.EventDeliveryService;
Brian O'Connor0e271dc2015-02-04 18:20:25 -080029import org.onosproject.net.flow.FlowRuleOperations;
Brian O'Connorabafb502014-12-02 22:26:20 -080030import org.onosproject.net.flow.FlowRuleService;
31import org.onosproject.net.intent.Intent;
32import org.onosproject.net.intent.IntentBatchDelegate;
Brian O'Connorabafb502014-12-02 22:26:20 -080033import org.onosproject.net.intent.IntentCompiler;
Brian O'Connorcff03322015-02-03 15:28:59 -080034import org.onosproject.net.intent.IntentData;
Brian O'Connorabafb502014-12-02 22:26:20 -080035import org.onosproject.net.intent.IntentEvent;
Brian O'Connorabafb502014-12-02 22:26:20 -080036import org.onosproject.net.intent.IntentExtensionService;
Brian O'Connorabafb502014-12-02 22:26:20 -080037import org.onosproject.net.intent.IntentInstaller;
38import org.onosproject.net.intent.IntentListener;
Brian O'Connorabafb502014-12-02 22:26:20 -080039import org.onosproject.net.intent.IntentService;
40import org.onosproject.net.intent.IntentState;
41import org.onosproject.net.intent.IntentStore;
Brian O'Connorabafb502014-12-02 22:26:20 -080042import org.onosproject.net.intent.IntentStoreDelegate;
Ray Milkeyf9af43c2015-02-09 16:45:48 -080043import org.onosproject.net.intent.Key;
Sho SHIMIZU36a8a6e2015-02-13 15:38:45 -080044import org.onosproject.net.intent.impl.phase.FinalIntentProcessPhase;
Sho SHIMIZU662c3db2015-02-23 16:59:01 -080045import org.onosproject.net.intent.impl.phase.IntentWorker;
Brian O'Connor66630c82014-10-02 21:08:19 -070046import org.slf4j.Logger;
47
Brian O'Connor64a0369d2015-02-20 22:02:59 -080048import java.util.Collection;
Brian O'Connor64a0369d2015-02-20 22:02:59 -080049import java.util.EnumSet;
Brian O'Connor64a0369d2015-02-20 22:02:59 -080050import java.util.List;
51import java.util.Map;
Brian O'Connor64a0369d2015-02-20 22:02:59 -080052import java.util.concurrent.ExecutionException;
53import java.util.concurrent.ExecutorService;
54import java.util.concurrent.Future;
55import java.util.stream.Collectors;
Brian O'Connorfa81eae2014-10-30 13:20:05 -070056
Brian O'Connorfa81eae2014-10-30 13:20:05 -070057import static com.google.common.base.Preconditions.checkNotNull;
Yuta HIGUCHIc2bf3d82014-11-28 18:50:41 -080058import static java.util.concurrent.Executors.newFixedThreadPool;
Brian O'Connordb15b042015-02-04 14:59:28 -080059import static java.util.concurrent.Executors.newSingleThreadExecutor;
Brian O'Connorbdc7f002015-02-18 20:49:41 -080060import static org.onlab.util.Tools.groupedThreads;
Sho SHIMIZUb0a47d42015-02-19 13:26:30 -080061import static org.onosproject.net.intent.IntentState.FAILED;
62import static org.onosproject.net.intent.IntentState.INSTALL_REQ;
Sho SHIMIZUb0a47d42015-02-19 13:26:30 -080063import static org.onosproject.net.intent.IntentState.WITHDRAW_REQ;
Brian O'Connorfa81eae2014-10-30 13:20:05 -070064import static org.slf4j.LoggerFactory.getLogger;
Brian O'Connor66630c82014-10-02 21:08:19 -070065
66/**
67 * An implementation of Intent Manager.
68 */
69@Component(immediate = true)
70@Service
71public class IntentManager
72 implements IntentService, IntentExtensionService {
Sho SHIMIZU8b5051d2014-11-05 11:24:13 -080073 private static final Logger log = getLogger(IntentManager.class);
Brian O'Connor66630c82014-10-02 21:08:19 -070074
75 public static final String INTENT_NULL = "Intent cannot be null";
Ray Milkeyf9af43c2015-02-09 16:45:48 -080076 public static final String INTENT_ID_NULL = "Intent key cannot be null";
Brian O'Connor66630c82014-10-02 21:08:19 -070077
Yuta HIGUCHIc2bf3d82014-11-28 18:50:41 -080078 private static final int NUM_THREADS = 12;
79
Brian O'Connor7a71d5d2014-12-02 00:12:27 -080080 private static final EnumSet<IntentState> RECOMPILE
81 = EnumSet.of(INSTALL_REQ, FAILED, WITHDRAW_REQ);
Brian O'Connor7a71d5d2014-12-02 00:12:27 -080082
Brian O'Connor66630c82014-10-02 21:08:19 -070083 private final AbstractListenerRegistry<IntentEvent, IntentListener>
tom95329eb2014-10-06 08:40:06 -070084 listenerRegistry = new AbstractListenerRegistry<>();
Brian O'Connor66630c82014-10-02 21:08:19 -070085
Brian O'Connor520c0522014-11-23 23:50:47 -080086 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
87 protected CoreService coreService;
Brian O'Connor66630c82014-10-02 21:08:19 -070088
89 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
90 protected IntentStore store;
91
92 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
tom85258ee2014-10-07 00:10:02 -070093 protected ObjectiveTrackerService trackerService;
tom95329eb2014-10-06 08:40:06 -070094
95 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
Brian O'Connor66630c82014-10-02 21:08:19 -070096 protected EventDeliveryService eventDispatcher;
97
Sho SHIMIZU36a8a6e2015-02-13 15:38:45 -080098 // TODO: make this protected due to short term hack for ONOS-1051
Brian O'Connorf2dbde52014-10-10 16:20:24 -070099 @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
Sho SHIMIZU36a8a6e2015-02-13 15:38:45 -0800100 public FlowRuleService flowRuleService;
Brian O'Connorf2dbde52014-10-10 16:20:24 -0700101
Brian O'Connor520c0522014-11-23 23:50:47 -0800102
Brian O'Connordb15b042015-02-04 14:59:28 -0800103 private ExecutorService batchExecutor;
104 private ExecutorService workerExecutor;
Brian O'Connor520c0522014-11-23 23:50:47 -0800105
Sho SHIMIZUb0a47d42015-02-19 13:26:30 -0800106 private final CompilerRegistry compilerRegistry = new CompilerRegistry();
107 private final InstallerRegistry installerRegistry = new InstallerRegistry();
108 private final InternalIntentProcessor processor = new InternalIntentProcessor();
Brian O'Connor520c0522014-11-23 23:50:47 -0800109 private final IntentStoreDelegate delegate = new InternalStoreDelegate();
110 private final TopologyChangeDelegate topoDelegate = new InternalTopoChangeDelegate();
111 private final IntentBatchDelegate batchDelegate = new InternalBatchDelegate();
112 private IdGenerator idGenerator;
113
Brian O'Connorb499b352015-02-03 16:46:15 -0800114 private final IntentAccumulator accumulator = new IntentAccumulator(batchDelegate);
Brian O'Connorcff03322015-02-03 15:28:59 -0800115
Brian O'Connor66630c82014-10-02 21:08:19 -0700116 @Activate
117 public void activate() {
118 store.setDelegate(delegate);
tom95329eb2014-10-06 08:40:06 -0700119 trackerService.setDelegate(topoDelegate);
Brian O'Connor66630c82014-10-02 21:08:19 -0700120 eventDispatcher.addSink(IntentEvent.class, listenerRegistry);
Brian O'Connorbdc7f002015-02-18 20:49:41 -0800121 batchExecutor = newSingleThreadExecutor(groupedThreads("onos/intent", "batch"));
122 workerExecutor = newFixedThreadPool(NUM_THREADS, groupedThreads("onos/intent", "worker-%d"));
Brian O'Connor520c0522014-11-23 23:50:47 -0800123 idGenerator = coreService.getIdGenerator("intent-ids");
124 Intent.bindIdGenerator(idGenerator);
Brian O'Connor66630c82014-10-02 21:08:19 -0700125 log.info("Started");
126 }
127
128 @Deactivate
129 public void deactivate() {
130 store.unsetDelegate(delegate);
tom95329eb2014-10-06 08:40:06 -0700131 trackerService.unsetDelegate(topoDelegate);
Brian O'Connor66630c82014-10-02 21:08:19 -0700132 eventDispatcher.removeSink(IntentEvent.class);
Brian O'Connordb15b042015-02-04 14:59:28 -0800133 batchExecutor.shutdown();
Brian O'Connor520c0522014-11-23 23:50:47 -0800134 Intent.unbindIdGenerator(idGenerator);
Brian O'Connor66630c82014-10-02 21:08:19 -0700135 log.info("Stopped");
136 }
137
138 @Override
139 public void submit(Intent intent) {
140 checkNotNull(intent, INTENT_NULL);
Brian O'Connorcff03322015-02-03 15:28:59 -0800141 IntentData data = new IntentData(intent, IntentState.INSTALL_REQ, null);
Brian O'Connorcff03322015-02-03 15:28:59 -0800142 store.addPending(data);
Brian O'Connor66630c82014-10-02 21:08:19 -0700143 }
144
145 @Override
146 public void withdraw(Intent intent) {
147 checkNotNull(intent, INTENT_NULL);
Brian O'Connorcff03322015-02-03 15:28:59 -0800148 IntentData data = new IntentData(intent, IntentState.WITHDRAW_REQ, null);
Brian O'Connorcff03322015-02-03 15:28:59 -0800149 store.addPending(data);
Brian O'Connor66630c82014-10-02 21:08:19 -0700150 }
151
Brian O'Connor66630c82014-10-02 21:08:19 -0700152 @Override
Ray Milkeyf9af43c2015-02-09 16:45:48 -0800153 public Intent getIntent(Key key) {
154 return store.getIntent(key);
155 }
156
157 @Override
Brian O'Connor66630c82014-10-02 21:08:19 -0700158 public Iterable<Intent> getIntents() {
159 return store.getIntents();
160 }
161
162 @Override
163 public long getIntentCount() {
164 return store.getIntentCount();
165 }
166
167 @Override
Ray Milkeyf9af43c2015-02-09 16:45:48 -0800168 public IntentState getIntentState(Key intentKey) {
169 checkNotNull(intentKey, INTENT_ID_NULL);
170 return store.getIntentState(intentKey);
Brian O'Connor66630c82014-10-02 21:08:19 -0700171 }
172
173 @Override
Ray Milkeyf9af43c2015-02-09 16:45:48 -0800174 public List<Intent> getInstallableIntents(Key intentKey) {
175 checkNotNull(intentKey, INTENT_ID_NULL);
176 return store.getInstallableIntents(intentKey);
Thomas Vachuska10d4abc2014-10-21 12:47:26 -0700177 }
178
179 @Override
Brian O'Connorbe28a872015-02-19 21:44:37 -0800180 public boolean isLocal(Key intentKey) {
181 return store.isMaster(intentKey);
182 }
183
184 @Override
Brian O'Connor66630c82014-10-02 21:08:19 -0700185 public void addListener(IntentListener listener) {
186 listenerRegistry.addListener(listener);
187 }
188
189 @Override
190 public void removeListener(IntentListener listener) {
191 listenerRegistry.removeListener(listener);
192 }
193
194 @Override
195 public <T extends Intent> void registerCompiler(Class<T> cls, IntentCompiler<T> compiler) {
Sho SHIMIZUb0a47d42015-02-19 13:26:30 -0800196 compilerRegistry.registerCompiler(cls, compiler);
Brian O'Connor66630c82014-10-02 21:08:19 -0700197 }
198
199 @Override
200 public <T extends Intent> void unregisterCompiler(Class<T> cls) {
Sho SHIMIZUb0a47d42015-02-19 13:26:30 -0800201 compilerRegistry.unregisterCompiler(cls);
Brian O'Connor66630c82014-10-02 21:08:19 -0700202 }
203
204 @Override
205 public Map<Class<? extends Intent>, IntentCompiler<? extends Intent>> getCompilers() {
Sho SHIMIZUb0a47d42015-02-19 13:26:30 -0800206 return compilerRegistry.getCompilers();
Brian O'Connor66630c82014-10-02 21:08:19 -0700207 }
208
209 @Override
Thomas Vachuskab97cf282014-10-20 23:31:12 -0700210 public <T extends Intent> void registerInstaller(Class<T> cls, IntentInstaller<T> installer) {
Sho SHIMIZUb0a47d42015-02-19 13:26:30 -0800211 installerRegistry.registerInstaller(cls, installer);
Brian O'Connor66630c82014-10-02 21:08:19 -0700212 }
213
214 @Override
Thomas Vachuskab97cf282014-10-20 23:31:12 -0700215 public <T extends Intent> void unregisterInstaller(Class<T> cls) {
Sho SHIMIZUb0a47d42015-02-19 13:26:30 -0800216 installerRegistry.unregisterInstaller(cls);
Brian O'Connor66630c82014-10-02 21:08:19 -0700217 }
218
219 @Override
Thomas Vachuskab97cf282014-10-20 23:31:12 -0700220 public Map<Class<? extends Intent>, IntentInstaller<? extends Intent>> getInstallers() {
Sho SHIMIZUb0a47d42015-02-19 13:26:30 -0800221 return installerRegistry.getInstallers();
Brian O'Connor66630c82014-10-02 21:08:19 -0700222 }
223
Brian O'Connor66630c82014-10-02 21:08:19 -0700224 // Store delegate to re-post events emitted from the store.
225 private class InternalStoreDelegate implements IntentStoreDelegate {
226 @Override
227 public void notify(IntentEvent event) {
tom85258ee2014-10-07 00:10:02 -0700228 eventDispatcher.post(event);
Brian O'Connor66630c82014-10-02 21:08:19 -0700229 }
Brian O'Connorea4d7d12015-01-28 16:37:46 -0800230
231 @Override
Brian O'Connorcff03322015-02-03 15:28:59 -0800232 public void process(IntentData data) {
233 accumulator.add(data);
Brian O'Connorea4d7d12015-01-28 16:37:46 -0800234 }
Brian O'Connor66630c82014-10-02 21:08:19 -0700235 }
236
Ray Milkeyf9af43c2015-02-09 16:45:48 -0800237 private void buildAndSubmitBatches(Iterable<Key> intentKeys,
Brian O'Connor72a034c2014-11-26 18:24:23 -0800238 boolean compileAllFailed) {
Brian O'Connor72a034c2014-11-26 18:24:23 -0800239 // Attempt recompilation of the specified intents first.
Ray Milkeyf9af43c2015-02-09 16:45:48 -0800240 for (Key key : intentKeys) {
241 Intent intent = store.getIntent(key);
Brian O'Connor72a034c2014-11-26 18:24:23 -0800242 if (intent == null) {
243 continue;
244 }
Brian O'Connor03406a42015-02-03 17:28:57 -0800245 submit(intent);
Brian O'Connor72a034c2014-11-26 18:24:23 -0800246 }
247
248 if (compileAllFailed) {
249 // If required, compile all currently failed intents.
250 for (Intent intent : getIntents()) {
Ray Milkeyf9af43c2015-02-09 16:45:48 -0800251 IntentState state = getIntentState(intent.key());
Brian O'Connor7a71d5d2014-12-02 00:12:27 -0800252 if (RECOMPILE.contains(state)) {
Brian O'Connor7a71d5d2014-12-02 00:12:27 -0800253 if (state == WITHDRAW_REQ) {
Brian O'Connor03406a42015-02-03 17:28:57 -0800254 withdraw(intent);
Brian O'Connor7a71d5d2014-12-02 00:12:27 -0800255 } else {
Brian O'Connor03406a42015-02-03 17:28:57 -0800256 submit(intent);
Brian O'Connor7a71d5d2014-12-02 00:12:27 -0800257 }
Brian O'Connor72a034c2014-11-26 18:24:23 -0800258 }
259 }
260 }
261
Brian O'Connorb499b352015-02-03 16:46:15 -0800262 //FIXME
263// for (ApplicationId appId : batches.keySet()) {
264// if (batchService.isLocalLeader(appId)) {
265// execute(batches.get(appId).build());
266// }
267// }
Brian O'Connor72a034c2014-11-26 18:24:23 -0800268 }
269
tom95329eb2014-10-06 08:40:06 -0700270 // Topology change delegate
271 private class InternalTopoChangeDelegate implements TopologyChangeDelegate {
272 @Override
Ray Milkeyf9af43c2015-02-09 16:45:48 -0800273 public void triggerCompile(Iterable<Key> intentKeys,
tom85258ee2014-10-07 00:10:02 -0700274 boolean compileAllFailed) {
Ray Milkeyf9af43c2015-02-09 16:45:48 -0800275 buildAndSubmitBatches(intentKeys, compileAllFailed);
tom95329eb2014-10-06 08:40:06 -0700276 }
tom95329eb2014-10-06 08:40:06 -0700277 }
tom85258ee2014-10-07 00:10:02 -0700278
Sho SHIMIZU36a8a6e2015-02-13 15:38:45 -0800279 private Future<FinalIntentProcessPhase> submitIntentData(IntentData data) {
Sho SHIMIZU0cb6fe62015-02-23 16:39:57 -0800280 IntentData current = store.getIntentData(data.key());
Sho SHIMIZUe38adb32015-02-23 16:48:41 -0800281 return workerExecutor.submit(new IntentWorker(processor, data, current));
Sho SHIMIZU8d9d1362015-02-04 12:28:15 -0800282 }
283
Sho SHIMIZUadf8c482014-12-12 18:23:29 -0800284 private class IntentBatchPreprocess implements Runnable {
285
286 // TODO make this configurable
287 private static final int TIMEOUT_PER_OP = 500; // ms
288 protected static final int MAX_ATTEMPTS = 3;
289
Sho SHIMIZU5f281a42015-02-04 15:29:11 -0800290 protected final Collection<IntentData> data;
Sho SHIMIZUadf8c482014-12-12 18:23:29 -0800291
292 // future holding current FlowRuleBatch installation result
293 protected final long startTime = System.currentTimeMillis();
294 protected final long endTime;
295
Sho SHIMIZU5f281a42015-02-04 15:29:11 -0800296 private IntentBatchPreprocess(Collection<IntentData> data, long endTime) {
297 this.data = checkNotNull(data);
Sho SHIMIZUadf8c482014-12-12 18:23:29 -0800298 this.endTime = endTime;
299 }
300
Sho SHIMIZU5f281a42015-02-04 15:29:11 -0800301 public IntentBatchPreprocess(Collection<IntentData> data) {
302 this(data, System.currentTimeMillis() + data.size() * TIMEOUT_PER_OP);
Sho SHIMIZUadf8c482014-12-12 18:23:29 -0800303 }
304
305 // FIXME compute reasonable timeouts
306 protected long calculateTimeoutLimit() {
Sho SHIMIZU5f281a42015-02-04 15:29:11 -0800307 return System.currentTimeMillis() + data.size() * TIMEOUT_PER_OP;
Sho SHIMIZUadf8c482014-12-12 18:23:29 -0800308 }
309
310 @Override
311 public void run() {
312 try {
Brian O'Connor0e271dc2015-02-04 18:20:25 -0800313 /*
314 1. wrap each intentdata in a runnable and submit
315 2. wait for completion of all the work
316 3. accumulate results and submit batch write of IntentData to store
317 (we can also try to update these individually)
318 */
319 submitUpdates(waitForFutures(createIntentUpdates()));
Sho SHIMIZUadf8c482014-12-12 18:23:29 -0800320 } catch (Exception e) {
321 log.error("Error submitting batches:", e);
322 // FIXME incomplete Intents should be cleaned up
323 // (transition to FAILED, etc.)
324
Sho SHIMIZUadf8c482014-12-12 18:23:29 -0800325 // the batch has failed
326 // TODO: maybe we should do more?
327 log.error("Walk the plank, matey...");
Brian O'Connorb499b352015-02-03 16:46:15 -0800328 //FIXME
Sho SHIMIZU5f281a42015-02-04 15:29:11 -0800329// batchService.removeIntentOperations(data);
Sho SHIMIZUadf8c482014-12-12 18:23:29 -0800330 }
331 }
332
Sho SHIMIZU36a8a6e2015-02-13 15:38:45 -0800333 private List<Future<FinalIntentProcessPhase>> createIntentUpdates() {
Sho SHIMIZU5f281a42015-02-04 15:29:11 -0800334 return data.stream()
Brian O'Connor0e271dc2015-02-04 18:20:25 -0800335 .map(IntentManager.this::submitIntentData)
336 .collect(Collectors.toList());
337 }
338
Sho SHIMIZU36a8a6e2015-02-13 15:38:45 -0800339 private List<FinalIntentProcessPhase> waitForFutures(List<Future<FinalIntentProcessPhase>> futures) {
340 ImmutableList.Builder<FinalIntentProcessPhase> updateBuilder = ImmutableList.builder();
341 for (Future<FinalIntentProcessPhase> future : futures) {
Brian O'Connor0e271dc2015-02-04 18:20:25 -0800342 try {
343 updateBuilder.add(future.get());
344 } catch (InterruptedException | ExecutionException e) {
345 //FIXME
346 log.warn("Future failed: {}", e);
347 }
348 }
349 return updateBuilder.build();
350 }
351
Sho SHIMIZU36a8a6e2015-02-13 15:38:45 -0800352 private void submitUpdates(List<FinalIntentProcessPhase> updates) {
Brian O'Connor0e271dc2015-02-04 18:20:25 -0800353 store.batchWrite(updates.stream()
Sho SHIMIZU36a8a6e2015-02-13 15:38:45 -0800354 .map(FinalIntentProcessPhase::data)
Brian O'Connor0e271dc2015-02-04 18:20:25 -0800355 .collect(Collectors.toList()));
Sho SHIMIZUadf8c482014-12-12 18:23:29 -0800356 }
Sho SHIMIZUadf8c482014-12-12 18:23:29 -0800357 }
Yuta HIGUCHIc2bf3d82014-11-28 18:50:41 -0800358
Brian O'Connorfa81eae2014-10-30 13:20:05 -0700359 private class InternalBatchDelegate implements IntentBatchDelegate {
360 @Override
Brian O'Connorb499b352015-02-03 16:46:15 -0800361 public void execute(Collection<IntentData> operations) {
Brian O'Connorab8ef822015-02-17 18:08:54 -0800362 log.debug("Execute {} operation(s).", operations.size());
363 log.trace("Execute operations: {}", operations);
Brian O'Connordb15b042015-02-04 14:59:28 -0800364 batchExecutor.execute(new IntentBatchPreprocess(operations));
365 // TODO ensure that only one batch is in flight at a time
Brian O'Connorfa81eae2014-10-30 13:20:05 -0700366 }
Brian O'Connorfa81eae2014-10-30 13:20:05 -0700367 }
Sho SHIMIZUb0a47d42015-02-19 13:26:30 -0800368
369 private class InternalIntentProcessor implements IntentProcessor {
370 @Override
371 public List<Intent> compile(Intent intent, List<Intent> previousInstallables) {
372 return compilerRegistry.compile(intent, previousInstallables);
373 }
374
375 @Override
376 public FlowRuleOperations coordinate(IntentData current, IntentData pending) {
377 return installerRegistry.coordinate(current, pending, store, trackerService);
378 }
379
380 @Override
381 public FlowRuleOperations uninstallCoordinate(IntentData current, IntentData pending) {
382 return installerRegistry.uninstallCoordinate(current, pending, store, trackerService);
383 }
384
385 @Override
386 public void applyFlowRules(FlowRuleOperations flowRules) {
387 flowRuleService.apply(flowRules);
388 }
389 }
Brian O'Connor66630c82014-10-02 21:08:19 -0700390}