Sho SHIMIZU

Apply more functional style

Change-Id: Ief6349fdb84e96d0cf2c432e3a6905fd403a87f3
...@@ -21,9 +21,9 @@ import org.apache.felix.scr.annotations.Deactivate; ...@@ -21,9 +21,9 @@ import org.apache.felix.scr.annotations.Deactivate;
21 import org.apache.felix.scr.annotations.Reference; 21 import org.apache.felix.scr.annotations.Reference;
22 import org.apache.felix.scr.annotations.ReferenceCardinality; 22 import org.apache.felix.scr.annotations.ReferenceCardinality;
23 import org.apache.felix.scr.annotations.Service; 23 import org.apache.felix.scr.annotations.Service;
24 -import org.onosproject.event.AbstractListenerManager;
25 import org.onosproject.core.CoreService; 24 import org.onosproject.core.CoreService;
26 import org.onosproject.core.IdGenerator; 25 import org.onosproject.core.IdGenerator;
26 +import org.onosproject.event.AbstractListenerManager;
27 import org.onosproject.net.flow.FlowRule; 27 import org.onosproject.net.flow.FlowRule;
28 import org.onosproject.net.flow.FlowRuleOperations; 28 import org.onosproject.net.flow.FlowRuleOperations;
29 import org.onosproject.net.flow.FlowRuleOperationsContext; 29 import org.onosproject.net.flow.FlowRuleOperationsContext;
...@@ -59,12 +59,19 @@ import static com.google.common.base.Preconditions.checkNotNull; ...@@ -59,12 +59,19 @@ import static com.google.common.base.Preconditions.checkNotNull;
59 import static java.util.concurrent.Executors.newFixedThreadPool; 59 import static java.util.concurrent.Executors.newFixedThreadPool;
60 import static java.util.concurrent.Executors.newSingleThreadExecutor; 60 import static java.util.concurrent.Executors.newSingleThreadExecutor;
61 import static org.onlab.util.Tools.groupedThreads; 61 import static org.onlab.util.Tools.groupedThreads;
62 -import static org.onosproject.net.intent.IntentState.*; 62 +import static org.onosproject.net.intent.IntentState.CORRUPT;
63 +import static org.onosproject.net.intent.IntentState.FAILED;
64 +import static org.onosproject.net.intent.IntentState.INSTALLED;
65 +import static org.onosproject.net.intent.IntentState.INSTALL_REQ;
66 +import static org.onosproject.net.intent.IntentState.WITHDRAWING;
67 +import static org.onosproject.net.intent.IntentState.WITHDRAWN;
68 +import static org.onosproject.net.intent.IntentState.WITHDRAW_REQ;
63 import static org.onosproject.net.intent.constraint.PartialFailureConstraint.intentAllowsPartialFailure; 69 import static org.onosproject.net.intent.constraint.PartialFailureConstraint.intentAllowsPartialFailure;
64 import static org.onosproject.net.intent.impl.phase.IntentProcessPhase.newInitialPhase; 70 import static org.onosproject.net.intent.impl.phase.IntentProcessPhase.newInitialPhase;
65 import static org.onosproject.security.AppGuard.checkPermission; 71 import static org.onosproject.security.AppGuard.checkPermission;
72 +import static org.onosproject.security.AppPermission.Type.INTENT_READ;
73 +import static org.onosproject.security.AppPermission.Type.INTENT_WRITE;
66 import static org.slf4j.LoggerFactory.getLogger; 74 import static org.slf4j.LoggerFactory.getLogger;
67 -import static org.onosproject.security.AppPermission.Type.*;
68 75
69 76
70 /** 77 /**
...@@ -471,10 +478,10 @@ public class IntentManager ...@@ -471,10 +478,10 @@ public class IntentManager
471 478
472 if (log.isTraceEnabled()) { 479 if (log.isTraceEnabled()) {
473 log.trace("applying intent {} -> {} with {} rules: {}", 480 log.trace("applying intent {} -> {} with {} rules: {}",
474 - toUninstall.isPresent() ? toUninstall.get().key() : "<empty>", 481 + toUninstall.map(x -> x.key().toString()).orElse("<empty>"),
475 - toInstall.isPresent() ? toInstall.get().key() : "<empty>", 482 + toInstall.map(x -> x.key().toString()).orElse("<empty>"),
476 - operations.stages().stream().mapToLong(i -> i.size()).sum(), 483 + operations.stages().stream().mapToLong(i -> i.size()).sum(),
477 - operations.stages()); 484 + operations.stages());
478 } 485 }
479 486
480 flowRuleService.apply(operations); 487 flowRuleService.apply(operations);
......