ONOS-1896 : enum Permission added, DefaultPermission removed

Change-Id: Ie75313acc9adeaee9c5a55978b5ec8e8fb5bf9b6
diff --git a/core/api/src/main/java/org/onosproject/core/DefaultPermission.java b/core/api/src/main/java/org/onosproject/core/DefaultPermission.java
deleted file mode 100644
index 512aca3..0000000
--- a/core/api/src/main/java/org/onosproject/core/DefaultPermission.java
+++ /dev/null
@@ -1,95 +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.core;
-
-import java.security.BasicPermission;
-
-/**
- * Default implementation of ONOS application permissions for API-level access control.
- */
-public class DefaultPermission extends BasicPermission implements Permission {
-
-    public enum Type {
-        APP_READ,
-        APP_EVENT,
-        CONFIG_READ,
-        CONFIG_WRITE,
-        CLUSTER_READ,
-        CLUSTER_WRITE,
-        CLUSTER_EVENT,
-        DEVICE_READ,
-        DEVICE_EVENT,
-        DRIVER_READ,
-        DRIVER_WRITE,
-        FLOWRULE_READ,
-        FLOWRULE_WRITE,
-        FLOWRULE_EVENT,
-        GROUP_READ,
-        GROUP_WRITE,
-        GROUP_EVENT,
-        HOST_READ,
-        HOST_WRITE,
-        HOST_EVENT,
-        INTENT_READ,
-        INTENT_WRITE,
-        INTENT_EVENT,
-        LINK_READ,
-        LINK_WRITE,
-        LINK_EVENT,
-        PACKET_READ,
-        PACKET_WRITE,
-        PACKET_EVENT,
-        STATISTIC_READ,
-        TOPOLOGY_READ,
-        TOPOLOGY_EVENT,
-        TUNNEL_READ,
-        TUNNEL_WRITE,
-        TUNNEL_EVENT,
-        STORAGE_WRITE
-    }
-
-    /**
-     * Creates a new DefaultPermission.
-     * @param name      name of the permission
-     * @param actions   optional action field
-     */
-    public DefaultPermission(String name, String actions) {
-        super(name, actions);
-    }
-
-    /**
-     * Creates a new DefaultPermission.
-     * @param name      name of the permission
-     */
-    public DefaultPermission(String name) {
-        super(name, "");
-    }
-
-    public DefaultPermission(Type permtype) {
-        super(permtype.name(), "");
-    }
-
-    @Override
-    public String name() {
-        return super.getName();
-    }
-
-    @Override
-    public String actions() {
-        return super.getActions();
-    }
-}
diff --git a/core/api/src/main/java/org/onosproject/core/Permission.java b/core/api/src/main/java/org/onosproject/core/Permission.java
index 98ec6c7..282388c 100644
--- a/core/api/src/main/java/org/onosproject/core/Permission.java
+++ b/core/api/src/main/java/org/onosproject/core/Permission.java
@@ -18,17 +18,41 @@
 /**
  * Representation of an application permission.
  */
-public interface Permission {
-
-    /**
-     * Returns the name of the permission.
-     * @return a string value
-     */
-    String name();
-
-    /**
-     * Returns the actions string of the permission if specified.
-     * @return a string value
-     */
-    String actions();
+public enum Permission {
+    APP_READ,
+    APP_EVENT,
+    CONFIG_READ,
+    CONFIG_WRITE,
+    CLUSTER_READ,
+    CLUSTER_WRITE,
+    CLUSTER_EVENT,
+    DEVICE_READ,
+    DEVICE_EVENT,
+    DRIVER_READ,
+    DRIVER_WRITE,
+    FLOWRULE_READ,
+    FLOWRULE_WRITE,
+    FLOWRULE_EVENT,
+    GROUP_READ,
+    GROUP_WRITE,
+    GROUP_EVENT,
+    HOST_READ,
+    HOST_WRITE,
+    HOST_EVENT,
+    INTENT_READ,
+    INTENT_WRITE,
+    INTENT_EVENT,
+    LINK_READ,
+    LINK_WRITE,
+    LINK_EVENT,
+    PACKET_READ,
+    PACKET_WRITE,
+    PACKET_EVENT,
+    STATISTIC_READ,
+    TOPOLOGY_READ,
+    TOPOLOGY_EVENT,
+    TUNNEL_READ,
+    TUNNEL_WRITE,
+    TUNNEL_EVENT,
+    STORAGE_WRITE
 }
diff --git a/core/api/src/test/java/org/onosproject/app/DefaultApplicationDescriptionTest.java b/core/api/src/test/java/org/onosproject/app/DefaultApplicationDescriptionTest.java
index 6325395..b45035e 100644
--- a/core/api/src/test/java/org/onosproject/app/DefaultApplicationDescriptionTest.java
+++ b/core/api/src/test/java/org/onosproject/app/DefaultApplicationDescriptionTest.java
@@ -19,7 +19,6 @@
 import com.google.common.collect.ImmutableSet;
 import org.junit.Test;
 import org.onosproject.core.ApplicationRole;
-import org.onosproject.core.DefaultPermission;
 import org.onosproject.core.Permission;
 import org.onosproject.core.Version;
 
@@ -29,8 +28,6 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.onosproject.core.DefaultPermission.Type.FLOWRULE_WRITE;
-import static org.onosproject.core.DefaultPermission.Type.FLOWRULE_READ;
 
 
 /**
@@ -43,8 +40,7 @@
     public static final String DESC = "Awesome application from Circus";
     public static final String ORIGIN = "Circus";
     public static final ApplicationRole ROLE = ApplicationRole.ADMIN;
-    public static final Set<Permission> PERMS = ImmutableSet.of(new DefaultPermission(FLOWRULE_WRITE),
-                    new DefaultPermission(FLOWRULE_READ));
+    public static final Set<Permission> PERMS = ImmutableSet.of(Permission.FLOWRULE_WRITE, Permission.FLOWRULE_READ);
     public static final URI FURL = URI.create("mvn:org.foo-features/1.2a/xml/features");
     public static final List<String> FEATURES = ImmutableList.of("foo", "bar");