Java 类org.osgi.framework.ServicePermission 实例源码

项目:gemini.blueprint    文件:BaseIntegrationTest.java   
/**
 * Returns the list of permissions for the running test.
 * 
 * @return
 */
protected List<Permission> getTestPermissions() {
    List<Permission> perms = new ArrayList<Permission>();
    perms.add(new PackagePermission("*", PackagePermission.EXPORT));
    perms.add(new PackagePermission("*", PackagePermission.IMPORT));
    perms.add(new BundlePermission("*", BundlePermission.HOST));
    perms.add(new BundlePermission("*", BundlePermission.PROVIDE));
    perms.add(new BundlePermission("*", BundlePermission.REQUIRE));
    perms.add(new ServicePermission("*", ServicePermission.REGISTER));
    perms.add(new ServicePermission("*", ServicePermission.GET));
    perms.add(new PropertyPermission("*", "read,write"));
    // required by Spring
    perms.add(new RuntimePermission("*", "accessDeclaredMembers"));
    perms.add(new ReflectPermission("*", "suppressAccessChecks"));
    // logging permission
    perms.add(new FilePermission("-", "write"));
    perms.add(new FilePermission("-", "read"));
    return perms;
}
项目:gemini.blueprint    文件:BaseIntegrationTest.java   
protected List<Permission> getIAndTPermissions() {
    List<Permission> perms = new ArrayList<Permission>();
    // export package
    perms.add(new PackagePermission("*", PackagePermission.EXPORT));
    perms.add(new PackagePermission("*", PackagePermission.IMPORT));
    perms.add(new BundlePermission("*", BundlePermission.FRAGMENT));
    perms.add(new BundlePermission("*", BundlePermission.PROVIDE));
    perms.add(new ServicePermission("*", ServicePermission.REGISTER));
    perms.add(new ServicePermission("*", ServicePermission.GET));
    perms.add(new PropertyPermission("*", "read,write"));

    // required by Spring
    perms.add(new RuntimePermission("*", "accessDeclaredMembers"));
    perms.add(new ReflectPermission("*", "suppressAccessChecks"));

    // logging permission
    perms.add(new FilePermission("-", "write"));
    perms.add(new FilePermission("-", "read"));

    return perms;
}
项目:onos    文件:DefaultPolicyBuilderTest.java   
@Before
public void setUp() throws Exception {
    List<Permission> permSet = Lists.newArrayList();
    permSet.add(new PackagePermission("*", PackagePermission.EXPORTONLY));
    permSet.add(new PackagePermission("*", PackagePermission.IMPORT));
    permSet.add(new AdaptPermission("*", AdaptPermission.ADAPT));
    permSet.add(new ConfigurationPermission("*", ConfigurationPermission.CONFIGURE));
    permSet.add(new AdminPermission("*", AdminPermission.METADATA));
    defaultPermissions = permSet;

    List<Permission> adminPermSet = Lists.newArrayList();
    adminPermSet.add(new ServicePermission(ApplicationAdminService.class.getName(), ServicePermission.GET));
    adminServicePermissions = adminPermSet;

    testPermission = new org.onosproject.security.Permission("testClass", "APP_READ", "testActions");
    testPermissions = new HashSet<org.onosproject.security.Permission>();
    testPermissions.add(testPermission);

    testJavaPerm = new AppPermission("testName");
    testJavaPerms = new HashSet<Permission>();
    testJavaPerms.add(testJavaPerm);
}
项目:onos    文件:DefaultPolicyBuilderTest.java   
@Test
public void testConvertToJavaPermissions() {
    List<Permission> result = Lists.newArrayList();
    for (org.onosproject.security.Permission perm : testPermissions) {
        Permission javaPerm = new AppPermission(perm.getName());
        if (javaPerm != null) {
            if (javaPerm instanceof AppPermission) {
                if (((AppPermission) javaPerm).getType() != null) {
                    AppPermission ap = (AppPermission) javaPerm;
                    result.add(ap);
                }
            } else if (javaPerm instanceof ServicePermission) {
                if (!javaPerm.getName().contains(SecurityAdminService.class.getName())) {
                    result.add(javaPerm);
                }
            } else {
                result.add(javaPerm);
            }

        }
    }
    assertTrue(!result.isEmpty());
    assertEquals("APP_READ", result.get(0).getName());
}
项目:spring-osgi    文件:BaseIntegrationTest.java   
/**
 * Returns the list of permissions for the running test.
 * 
 * @return
 */
protected List getTestPermissions() {
    List perms = new ArrayList();
    perms.add(new PackagePermission("*", PackagePermission.EXPORT));
    perms.add(new PackagePermission("*", PackagePermission.IMPORT));
    perms.add(new BundlePermission("*", BundlePermission.HOST));
    perms.add(new BundlePermission("*", BundlePermission.PROVIDE));
    perms.add(new BundlePermission("*", BundlePermission.REQUIRE));
    perms.add(new ServicePermission("*", ServicePermission.REGISTER));
    perms.add(new ServicePermission("*", ServicePermission.GET));
    perms.add(new PropertyPermission("org.springframework.osgi.*", "read"));
    perms.add(new PropertyPermission("org.springframework.osgi.iandt.*", "write"));
    // required by Spring
    perms.add(new RuntimePermission("*", "accessDeclaredMembers"));
    perms.add(new ReflectPermission("*", "suppressAccessChecks"));
    return perms;
}
项目:spring-osgi    文件:BaseIntegrationTest.java   
protected List getIAndTPermissions() {
    List perms = new ArrayList();
    // export package
    perms.add(new PackagePermission("*", PackagePermission.EXPORT));
    perms.add(new PackagePermission("*", PackagePermission.IMPORT));
    perms.add(new BundlePermission("*", BundlePermission.FRAGMENT));
    perms.add(new BundlePermission("*", BundlePermission.PROVIDE));
    perms.add(new ServicePermission("*", ServicePermission.REGISTER));
    perms.add(new ServicePermission("*", ServicePermission.GET));
    perms.add(new PropertyPermission("*", "read,write"));

    // required by Spring
    perms.add(new RuntimePermission("*", "accessDeclaredMembers"));
    perms.add(new ReflectPermission("*", "suppressAccessChecks"));

    return perms;
}
项目:athena    文件:DefaultPolicyBuilder.java   
public static List<Permission> convertToJavaPermissions(Set<org.onosproject.security.Permission> permissions) {
    List<Permission> result = Lists.newArrayList();
    for (org.onosproject.security.Permission perm : permissions) {
        Permission javaPerm = getPermission(perm);
        if (javaPerm != null) {
            if (javaPerm instanceof AppPermission) {
                if (((AppPermission) javaPerm).getType() != null) {
                    AppPermission ap = (AppPermission) javaPerm;
                    result.add(ap);
                    if (serviceDirectory.containsKey(ap.getType())) {
                        for (String service : serviceDirectory.get(ap.getType())) {
                            result.add(new ServicePermission(service, ServicePermission.GET));
                        }
                    }
                }
            } else if (javaPerm instanceof ServicePermission) {
                if (!javaPerm.getName().contains(SecurityAdminService.class.getName())) {
                    result.add(javaPerm);
                }
            } else {
                result.add(javaPerm);
            }

        }
    }
    return result;
}
项目:athena    文件:SecurityModeManager.java   
/**
 * TYPES.
 * 0 - APP_PERM
 * 1 - ADMIN SERVICE
 * 2 - NB_SERVICE
 * 3 - ETC_SERVICE
 * 4 - ETC
 * @param perms
 */
private Map<Integer, List<Permission>> getPrintablePermissionMap(List<Permission> perms) {
    ConcurrentHashMap<Integer, List<Permission>> sortedMap = new ConcurrentHashMap<>();
    sortedMap.put(0, new ArrayList());
    sortedMap.put(1, new ArrayList());
    sortedMap.put(2, new ArrayList());
    sortedMap.put(3, new ArrayList());
    sortedMap.put(4, new ArrayList());
    for (Permission perm : perms) {
        if (perm instanceof ServicePermission) {
            if (DefaultPolicyBuilder.getNBServiceList().contains(perm.getName())) {
                if (perm.getName().contains("Admin")) {
                    sortedMap.get(1).add(perm);
                } else {
                    sortedMap.get(2).add(perm);
                }
            } else {
                sortedMap.get(3).add(perm);
            }
        } else if (perm instanceof AppPermission) {
            sortedMap.get(0).add(perm);
        } else {
            sortedMap.get(4).add(perm);
        }
    }
    return sortedMap;
}
项目:ACDD    文件:BundleLifecycleHandler.java   
private boolean isLewaOS() {
    try {
        return StringUtils.isNotEmpty((String) Class
                .forName("android.os.SystemProperties")
                .getDeclaredMethod(ServicePermission.GET,
                        new Class[]{String.class})
                .invoke(null, "ro.lewa.version"));
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}
项目:AtlasForAndroid    文件:BundleLifecycleHandler.java   
private boolean isLewaOS() {
    try {
        return StringUtils.isNotEmpty((String) Class.forName("android.os.SystemProperties").getDeclaredMethod(ServicePermission.GET, new Class[]{String.class}).invoke(null, new Object[]{"ro.lewa.version"}));
    } catch (Exception e) {
        e.printStackTrace();
        return false;
    }
}
项目:onos    文件:DefaultPolicyBuilder.java   
public static List<Permission> convertToJavaPermissions(Set<org.onosproject.security.Permission> permissions) {
    List<Permission> result = Lists.newArrayList();
    for (org.onosproject.security.Permission perm : permissions) {
        Permission javaPerm = getPermission(perm);
        if (javaPerm != null) {
            if (javaPerm instanceof AppPermission) {
                if (((AppPermission) javaPerm).getType() != null) {
                    AppPermission ap = (AppPermission) javaPerm;
                    result.add(ap);
                    if (serviceDirectory.containsKey(ap.getType())) {
                        for (String service : serviceDirectory.get(ap.getType())) {
                            result.add(new ServicePermission(service, ServicePermission.GET));
                        }
                    }
                }
            } else if (javaPerm instanceof ServicePermission) {
                if (!javaPerm.getName().contains(SecurityAdminService.class.getName())) {
                    result.add(javaPerm);
                }
            } else {
                result.add(javaPerm);
            }

        }
    }
    return result;
}
项目:onos    文件:SecurityModeManager.java   
/**
 * TYPES.
 * 0 - APP_PERM
 * 1 - ADMIN SERVICE
 * 2 - NB_SERVICE
 * 3 - ETC_SERVICE
 * 4 - ETC
 * @param perms
 */
private Map<Integer, List<Permission>> getPrintablePermissionMap(List<Permission> perms) {
    ConcurrentHashMap<Integer, List<Permission>> sortedMap = new ConcurrentHashMap<>();
    sortedMap.put(0, new ArrayList());
    sortedMap.put(1, new ArrayList());
    sortedMap.put(2, new ArrayList());
    sortedMap.put(3, new ArrayList());
    sortedMap.put(4, new ArrayList());
    for (Permission perm : perms) {
        if (perm instanceof ServicePermission) {
            if (DefaultPolicyBuilder.getNBServiceList().contains(perm.getName())) {
                if (perm.getName().contains("Admin")) {
                    sortedMap.get(1).add(perm);
                } else {
                    sortedMap.get(2).add(perm);
                }
            } else {
                sortedMap.get(3).add(perm);
            }
        } else if (perm instanceof AppPermission) {
            sortedMap.get(0).add(perm);
        } else {
            sortedMap.get(4).add(perm);
        }
    }
    return sortedMap;
}
项目:onos    文件:DefaultPolicyBuilderTest.java   
@Test
public void testGetNBServiceList() {
    Set<String> permString = new HashSet<>();
    permString.add(new ServicePermission(ApplicationAdminService.class.getName(), ServicePermission.GET).getName());
    assertEquals(1, permString.size());
    assertEquals("org.onosproject.app.ApplicationAdminService", permString.toArray()[0]);
}
项目:athena    文件:DefaultPolicyBuilder.java   
private static List<Permission> getAdminDefaultPerms() {
        List<Permission> permSet = Lists.newArrayList();
        permSet.add(new ServicePermission(ApplicationAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ClusterAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(LeadershipAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ClusterMetadataAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(MastershipAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(DeviceAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(DriverAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(HostAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(DeviceKeyAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(LinkAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ResourceAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(RegionAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(PartitionAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(StorageAdminService.class.getName(), ServicePermission.GET));

        permSet.add(new ServicePermission(ApplicationService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ComponentConfigService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ClusterMetadataService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ClusterService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(LeadershipService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(CodecService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(CoreService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(EventDeliveryService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(MastershipService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(MastershipTermService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(BasicNetworkConfigService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(NetworkConfigService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(DeviceService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(DeviceClockService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(DriverService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(EdgePortService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(FlowRuleService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(FlowObjectiveService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(GroupService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(HostService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(IntentService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(IntentClockService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(IntentExtensionService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(IntentPartitionService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(DeviceKeyService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(LinkService.class.getName(), ServicePermission.GET));
//        permSet.add(new ServicePermission(MulticastRouteService.class.getName(), ServicePermission.GET));
//        permSet.add(new ServicePermission(MeterService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ResourceService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(PacketService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ProxyArpService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(RegionService.class.getName(), ServicePermission.GET));
//      permSet.add(new ServicePermission(LinkResourceService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(FlowStatisticService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(StatisticService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(PathService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(TopologyService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(PersistenceService.class.getName(), ServicePermission.GET));
//        permSet.add(new ServicePermission(ApiDocService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ClusterCommunicationService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(MessagingService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(PartitionService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(LogicalClockService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(StorageService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(UiExtensionService.class.getName(), ServicePermission.GET));

        return permSet;
    }
项目:athena    文件:DefaultPolicyBuilder.java   
public static org.onosproject.security.Permission getOnosPermission(Permission permission) {
    if (permission instanceof AppPermission) {
        return new org.onosproject.security.Permission(AppPermission.class.getName(), permission.getName(), "");
    } else if (permission instanceof FilePermission) {
        return new org.onosproject.security.Permission(
                FilePermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof SerializablePermission) {
        return new org.onosproject.security.Permission(
                SerializablePermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof NetPermission) {
        return new org.onosproject.security.Permission(
                NetPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof RuntimePermission) {
        return new org.onosproject.security.Permission(
                RuntimePermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof SocketPermission) {
        return new org.onosproject.security.Permission(
                SocketPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof SQLPermission) {
        return new org.onosproject.security.Permission(
                SQLPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof PropertyPermission) {
        return new org.onosproject.security.Permission(
                PropertyPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof LoggingPermission) {
        return new org.onosproject.security.Permission(
                LoggingPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof SSLPermission) {
        return new org.onosproject.security.Permission(
                SSLPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof AuthPermission) {
        return new org.onosproject.security.Permission(
                AuthPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof PrivateCredentialPermission) {
        return new org.onosproject.security.Permission(
                PrivateCredentialPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof DelegationPermission) {
        return new org.onosproject.security.Permission(
                DelegationPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof javax.security.auth.kerberos.ServicePermission) {
        return new org.onosproject.security.Permission(
                javax.security.auth.kerberos.ServicePermission.class.getName(), permission.getName(),
                permission.getActions());
    } else if (permission instanceof AudioPermission) {
        return new org.onosproject.security.Permission(
                AudioPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof AdaptPermission) {
        return new org.onosproject.security.Permission(
                AdaptPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof BundlePermission) {
        return new org.onosproject.security.Permission(
                BundlePermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof CapabilityPermission) {
        return new org.onosproject.security.Permission(
                CapabilityPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof PackagePermission) {
        return new org.onosproject.security.Permission(
                PackagePermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof ServicePermission) {
        return new org.onosproject.security.Permission(
                ServicePermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof AdminPermission) {
        return new org.onosproject.security.Permission(
                AdminPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof ConfigurationPermission) {
        return new org.onosproject.security.Permission(
                ConfigurationPermission.class.getName(), permission.getName(), permission.getActions());
    }
    return null;
}
项目:athena    文件:DefaultPolicyBuilder.java   
private static Permission getPermission(org.onosproject.security.Permission permission) {

        String classname = permission.getClassName();
        String name = permission.getName();
        String actions = permission.getActions();

        if (classname == null || name == null) {
            return null;
        }
        classname = classname.trim();
        name = name.trim();
        actions = actions.trim();

        if (AppPermission.class.getName().equals(classname)) {
            return new AppPermission(name);
        } else if (FilePermission.class.getName().equals(classname)) {
            return new FilePermission(name, actions);
        } else if (SerializablePermission.class.getName().equals(classname)) {
            return new SerializablePermission(name, actions);
        } else if (NetPermission.class.getName().equals(classname)) {
            return new NetPermission(name, actions);
        } else if (RuntimePermission.class.getName().equals(classname)) {
            return new RuntimePermission(name, actions);
        } else if (SocketPermission.class.getName().equals(classname)) {
            return new SocketPermission(name, actions);
        } else if (SQLPermission.class.getName().equals(classname)) {
            return new SQLPermission(name, actions);
        } else if (PropertyPermission.class.getName().equals(classname)) {
            return new PropertyPermission(name, actions);
        } else if (LoggingPermission.class.getName().equals(classname)) {
            return new LoggingPermission(name, actions);
        } else if (SSLPermission.class.getName().equals(classname)) {
            return new SSLPermission(name, actions);
        } else if (AuthPermission.class.getName().equals(classname)) {
            return new AuthPermission(name, actions);
        } else if (PrivateCredentialPermission.class.getName().equals(classname)) {
            return new PrivateCredentialPermission(name, actions);
        } else if (DelegationPermission.class.getName().equals(classname)) {
            return new DelegationPermission(name, actions);
        } else if (javax.security.auth.kerberos.ServicePermission.class.getName().equals(classname)) {
            return new javax.security.auth.kerberos.ServicePermission(name, actions);
        } else if (AudioPermission.class.getName().equals(classname)) {
            return new AudioPermission(name, actions);
        } else if (AdaptPermission.class.getName().equals(classname)) {
            return new AdaptPermission(name, actions);
        } else if (BundlePermission.class.getName().equals(classname)) {
            return new BundlePermission(name, actions);
        } else if (CapabilityPermission.class.getName().equals(classname)) {
            return new CapabilityPermission(name, actions);
        } else if (PackagePermission.class.getName().equals(classname)) {
            return new PackagePermission(name, actions);
        } else if (ServicePermission.class.getName().equals(classname)) {
            return new ServicePermission(name, actions);
        } else if (AdminPermission.class.getName().equals(classname)) {
            return new AdminPermission(name, actions);
        } else if (ConfigurationPermission.class.getName().equals(classname)) {
            return new ConfigurationPermission(name, actions);
        } else if (ReflectPermission.class.getName().equals(classname)) {
            return new ReflectPermission(name, actions);
        }

        //AllPermission, SecurityPermission, UnresolvedPermission
        //AWTPermission,  ReflectPermission not allowed
        return null;

    }
项目:onos    文件:DefaultPolicyBuilder.java   
private static List<Permission> getAdminDefaultPerms() {
        List<Permission> permSet = Lists.newArrayList();
        permSet.add(new ServicePermission(ApplicationAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ClusterAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(LeadershipAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ClusterMetadataAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(MastershipAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(DeviceAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(DriverAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(HostAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(DeviceKeyAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(LinkAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ResourceAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(RegionAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(PartitionAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(StorageAdminService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ApplicationService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ComponentConfigService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ClusterMetadataService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ClusterService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(LeadershipService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(CodecService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(CoreService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(EventDeliveryService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(MastershipService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(MastershipTermService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(BasicNetworkConfigService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(NetworkConfigService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(DeviceService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(DeviceClockService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(DriverService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(EdgePortService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(FlowRuleService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(FlowObjectiveService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(GroupService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(HostService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(IntentService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(IntentClockService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(IntentExtensionService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(WorkPartitionService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(DeviceKeyService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(LinkService.class.getName(), ServicePermission.GET));
//        permSet.add(new ServicePermission(MulticastRouteService.class.getName(), ServicePermission.GET));
//        permSet.add(new ServicePermission(MeterService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ResourceService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(PacketService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(RegionService.class.getName(), ServicePermission.GET));
//      permSet.add(new ServicePermission(LinkResourceService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(FlowStatisticService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(StatisticService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(PathService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(TopologyService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(PersistenceService.class.getName(), ServicePermission.GET));
//        permSet.add(new ServicePermission(ApiDocService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(ClusterCommunicationService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(MessagingService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(PartitionService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(LogicalClockService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(StorageService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(UiExtensionService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(UpgradeService.class.getName(), ServicePermission.GET));
        permSet.add(new ServicePermission(UpgradeAdminService.class.getName(), ServicePermission.GET));
        return permSet;
    }
项目:onos    文件:DefaultPolicyBuilder.java   
public static org.onosproject.security.Permission getOnosPermission(Permission permission) {
    if (permission instanceof AppPermission) {
        return new org.onosproject.security.Permission(AppPermission.class.getName(), permission.getName(), "");
    } else if (permission instanceof FilePermission) {
        return new org.onosproject.security.Permission(
                FilePermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof SerializablePermission) {
        return new org.onosproject.security.Permission(
                SerializablePermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof NetPermission) {
        return new org.onosproject.security.Permission(
                NetPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof RuntimePermission) {
        return new org.onosproject.security.Permission(
                RuntimePermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof SocketPermission) {
        return new org.onosproject.security.Permission(
                SocketPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof SQLPermission) {
        return new org.onosproject.security.Permission(
                SQLPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof PropertyPermission) {
        return new org.onosproject.security.Permission(
                PropertyPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof LoggingPermission) {
        return new org.onosproject.security.Permission(
                LoggingPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof SSLPermission) {
        return new org.onosproject.security.Permission(
                SSLPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof AuthPermission) {
        return new org.onosproject.security.Permission(
                AuthPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof PrivateCredentialPermission) {
        return new org.onosproject.security.Permission(
                PrivateCredentialPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof DelegationPermission) {
        return new org.onosproject.security.Permission(
                DelegationPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof javax.security.auth.kerberos.ServicePermission) {
        return new org.onosproject.security.Permission(
                javax.security.auth.kerberos.ServicePermission.class.getName(), permission.getName(),
                permission.getActions());
    } else if (permission instanceof AudioPermission) {
        return new org.onosproject.security.Permission(
                AudioPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof AdaptPermission) {
        return new org.onosproject.security.Permission(
                AdaptPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof BundlePermission) {
        return new org.onosproject.security.Permission(
                BundlePermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof CapabilityPermission) {
        return new org.onosproject.security.Permission(
                CapabilityPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof PackagePermission) {
        return new org.onosproject.security.Permission(
                PackagePermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof ServicePermission) {
        return new org.onosproject.security.Permission(
                ServicePermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof AdminPermission) {
        return new org.onosproject.security.Permission(
                AdminPermission.class.getName(), permission.getName(), permission.getActions());
    } else if (permission instanceof ConfigurationPermission) {
        return new org.onosproject.security.Permission(
                ConfigurationPermission.class.getName(), permission.getName(), permission.getActions());
    }
    return null;
}
项目:onos    文件:DefaultPolicyBuilder.java   
private static Permission getPermission(org.onosproject.security.Permission permission) {

        String classname = permission.getClassName();
        String name = permission.getName();
        String actions = permission.getActions();

        if (classname == null || name == null) {
            return null;
        }
        classname = classname.trim();
        name = name.trim();
        actions = actions.trim();

        if (AppPermission.class.getName().equals(classname)) {
            return new AppPermission(name);
        } else if (FilePermission.class.getName().equals(classname)) {
            return new FilePermission(name, actions);
        } else if (SerializablePermission.class.getName().equals(classname)) {
            return new SerializablePermission(name, actions);
        } else if (NetPermission.class.getName().equals(classname)) {
            return new NetPermission(name, actions);
        } else if (RuntimePermission.class.getName().equals(classname)) {
            return new RuntimePermission(name, actions);
        } else if (SocketPermission.class.getName().equals(classname)) {
            return new SocketPermission(name, actions);
        } else if (SQLPermission.class.getName().equals(classname)) {
            return new SQLPermission(name, actions);
        } else if (PropertyPermission.class.getName().equals(classname)) {
            return new PropertyPermission(name, actions);
        } else if (LoggingPermission.class.getName().equals(classname)) {
            return new LoggingPermission(name, actions);
        } else if (SSLPermission.class.getName().equals(classname)) {
            return new SSLPermission(name, actions);
        } else if (AuthPermission.class.getName().equals(classname)) {
            return new AuthPermission(name, actions);
        } else if (PrivateCredentialPermission.class.getName().equals(classname)) {
            return new PrivateCredentialPermission(name, actions);
        } else if (DelegationPermission.class.getName().equals(classname)) {
            return new DelegationPermission(name, actions);
        } else if (javax.security.auth.kerberos.ServicePermission.class.getName().equals(classname)) {
            return new javax.security.auth.kerberos.ServicePermission(name, actions);
        } else if (AudioPermission.class.getName().equals(classname)) {
            return new AudioPermission(name, actions);
        } else if (AdaptPermission.class.getName().equals(classname)) {
            return new AdaptPermission(name, actions);
        } else if (BundlePermission.class.getName().equals(classname)) {
            return new BundlePermission(name, actions);
        } else if (CapabilityPermission.class.getName().equals(classname)) {
            return new CapabilityPermission(name, actions);
        } else if (PackagePermission.class.getName().equals(classname)) {
            return new PackagePermission(name, actions);
        } else if (ServicePermission.class.getName().equals(classname)) {
            return new ServicePermission(name, actions);
        } else if (AdminPermission.class.getName().equals(classname)) {
            return new AdminPermission(name, actions);
        } else if (ConfigurationPermission.class.getName().equals(classname)) {
            return new ConfigurationPermission(name, actions);
        } else if (ReflectPermission.class.getName().equals(classname)) {
            return new ReflectPermission(name, actions);
        }

        //AllPermission, SecurityPermission, UnresolvedPermission
        //AWTPermission,  ReflectPermission not allowed
        return null;

    }