Move CompilingFailed to upper level to reduce IntentManager's size

Change-Id: Ia75d91ff7f4de01c74f4ca6dac0d15b1d772ed69
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/CompilingFailed.java b/core/net/src/main/java/org/onosproject/net/intent/impl/CompilingFailed.java
new file mode 100644
index 0000000..34469ff
--- /dev/null
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/CompilingFailed.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.intent.impl;
+
+import org.onosproject.net.intent.BatchWrite;
+import org.onosproject.net.intent.Intent;
+
+import java.util.Optional;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static org.onosproject.net.intent.IntentState.FAILED;
+
+/**
+ * A processing phase after compilation failure.
+ */
+class CompilingFailed implements CompletedIntentUpdate {
+
+    private final Intent intent;
+
+    /**
+     * Create an instance from the submitted intent.
+     *
+     * @param intent submitted intent.
+     */
+    CompilingFailed(Intent intent) {
+        this.intent = checkNotNull(intent);
+    }
+
+    @Override
+    public Optional<IntentUpdate> execute() {
+        return Optional.empty();
+    }
+
+    @Override
+    public void writeAfterExecution(BatchWrite batchWrite) {
+        batchWrite.setState(intent, FAILED);
+        batchWrite.removeInstalledIntents(intent.id());
+    }
+}
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
index 2d08ac3..2d1efee 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
@@ -626,9 +626,11 @@
                 // intents with the top-level intent and proceed to install.
                 return Optional.of(new Installing(intent, compileIntent(intent, null)));
             } catch (PathNotFoundException e) {
-                return Optional.of(new CompilingFailed(intent, e));
+                log.debug("Path not found for intent {}", intent);
+                return Optional.of(new CompilingFailed(intent));
             } catch (IntentException e) {
-                return Optional.of(new CompilingFailed(intent, e));
+                log.warn("Unable to compile intent {} due to:", intent.id(), e);
+                return Optional.of(new CompilingFailed(intent));
             }
         }
     }
@@ -921,34 +923,6 @@
         }
     }
 
-    private class CompilingFailed implements CompletedIntentUpdate {
-
-        private final Intent intent;
-        private final IntentException exception;
-
-        CompilingFailed(Intent intent, IntentException exception) {
-            this.intent = checkNotNull(intent);
-            this.exception = checkNotNull(exception);
-        }
-
-        @Override
-        public Optional<IntentUpdate> execute() {
-            if (exception instanceof PathNotFoundException) {
-                log.debug("Path not found for intent {}", intent);
-            } else {
-                log.warn("Unable to compile intent {} due to:", intent.id(), exception);
-            }
-
-            return Optional.empty();
-        }
-
-        @Override
-        public void writeAfterExecution(BatchWrite batchWrite) {
-            batchWrite.setState(intent, FAILED);
-            batchWrite.removeInstalledIntents(intent.id());
-        }
-    }
-
     private class InstallingFailed implements CompletedIntentUpdate {
 
         private final Intent intent;