ONOS-1993 Implement API-level permission checking + security util code location replacement

Change-Id: I7bf20eda9c12ed2a44334504333b093057764cd2
diff --git a/core/security/impl/pom.xml b/core/security/impl/pom.xml
index dd6e8db..ea7a645 100644
--- a/core/security/impl/pom.xml
+++ b/core/security/impl/pom.xml
@@ -47,14 +47,19 @@
             <artifactId>onos-api</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.onosproject</groupId>
-            <artifactId>onos-security-util</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
             <groupId>org.apache.karaf.features</groupId>
             <artifactId>org.apache.karaf.features.core</artifactId>
         </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
+
 </project>
\ No newline at end of file
diff --git a/core/security/impl/src/main/java/org/onosproject/security/impl/PolicyBuilder.java b/core/security/impl/src/main/java/org/onosproject/security/impl/PolicyBuilder.java
index 436ed0f..ddf720b 100644
--- a/core/security/impl/src/main/java/org/onosproject/security/impl/PolicyBuilder.java
+++ b/core/security/impl/src/main/java/org/onosproject/security/impl/PolicyBuilder.java
@@ -5,7 +5,7 @@
 import com.google.common.collect.Sets;
 import org.apache.commons.collections.FastHashMap;
 import org.onosproject.core.Permission;
-import org.onosproject.security.util.AppPermission;
+import org.onosproject.security.AppPermission;
 import org.osgi.service.permissionadmin.PermissionInfo;
 
 import org.onosproject.app.ApplicationAdminService;
diff --git a/core/security/impl/src/main/java/org/onosproject/security/impl/SecurityModeManager.java b/core/security/impl/src/main/java/org/onosproject/security/impl/SecurityModeManager.java
index dcca07c..792ea79 100644
--- a/core/security/impl/src/main/java/org/onosproject/security/impl/SecurityModeManager.java
+++ b/core/security/impl/src/main/java/org/onosproject/security/impl/SecurityModeManager.java
@@ -17,7 +17,7 @@
 import org.onosproject.core.Application;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.Permission;
-import org.onosproject.security.util.AppPermission;
+import org.onosproject.security.AppPermission;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
@@ -109,7 +109,6 @@
 
         permissionAdmin.setPermissions(bundle.getLocation(), allPerm);
         log.warn("Security-Mode Started");
-
     }
 
 
diff --git a/core/security/pom.xml b/core/security/pom.xml
index 984b04b..bf4a2ef 100644
--- a/core/security/pom.xml
+++ b/core/security/pom.xml
@@ -14,7 +14,6 @@
     <artifactId>onos-security</artifactId>
     <packaging>pom</packaging>
     <modules>
-        <module>util</module>
         <module>impl</module>
     </modules>
 
diff --git a/core/security/util/pom.xml b/core/security/util/pom.xml
deleted file mode 100644
index a92beb6..0000000
--- a/core/security/util/pom.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <artifactId>onos-security</artifactId>
-        <groupId>org.onosproject</groupId>
-        <version>1.2.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>onos-security-util</artifactId>
-    <packaging>bundle</packaging>
-
-</project>
diff --git a/core/security/util/src/main/java/org/onosproject/security/util/AppGuard.java b/core/security/util/src/main/java/org/onosproject/security/util/AppGuard.java
deleted file mode 100644
index f6808f6..0000000
--- a/core/security/util/src/main/java/org/onosproject/security/util/AppGuard.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.security.util;
-
-/**
- * Checks if the caller has the required permission to call each API.
- */
-public final class AppGuard {
-
-    private AppGuard() {
-    }
-
-    public static boolean check(String perm) {
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            System.getSecurityManager().checkPermission(new AppPermission(perm));
-        }
-        return true;
-    }
-}
diff --git a/core/security/util/src/main/java/org/onosproject/security/util/AppPermission.java b/core/security/util/src/main/java/org/onosproject/security/util/AppPermission.java
deleted file mode 100644
index c502764..0000000
--- a/core/security/util/src/main/java/org/onosproject/security/util/AppPermission.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.security.util;
-
-import java.security.BasicPermission;
-
-/**
- * Implementation of API access permission.
- */
-public class AppPermission extends BasicPermission {
-
-    public AppPermission(String name) {
-        super(name.toUpperCase(), "");
-    }
-
-    public AppPermission(String name, String actions) {
-        super(name.toUpperCase(), actions);
-    }
-
-}
diff --git a/core/security/util/src/main/java/org/onosproject/security/util/package-info.java b/core/security/util/src/main/java/org/onosproject/security/util/package-info.java
deleted file mode 100644
index 6f974d4..0000000
--- a/core/security/util/src/main/java/org/onosproject/security/util/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * Security mode utilities.
- */
-package org.onosproject.security.util;
\ No newline at end of file