当前位置: 首页>>代码示例>>Java>>正文


Java PackagePermission类代码示例

本文整理汇总了Java中org.osgi.framework.PackagePermission的典型用法代码示例。如果您正苦于以下问题:Java PackagePermission类的具体用法?Java PackagePermission怎么用?Java PackagePermission使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PackagePermission类属于org.osgi.framework包,在下文中一共展示了PackagePermission类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTestPermissions

import org.osgi.framework.PackagePermission; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:24,代码来源:BaseIntegrationTest.java

示例2: getIAndTPermissions

import org.osgi.framework.PackagePermission; //导入依赖的package包/类
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;
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:22,代码来源:BaseIntegrationTest.java

示例3: setUp

import org.osgi.framework.PackagePermission; //导入依赖的package包/类
@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);
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:23,代码来源:DefaultPolicyBuilderTest.java

示例4: getTestPermissions

import org.osgi.framework.PackagePermission; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:BeamFoundry,项目名称:spring-osgi,代码行数:22,代码来源:BaseIntegrationTest.java

示例5: getIAndTPermissions

import org.osgi.framework.PackagePermission; //导入依赖的package包/类
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;
}
 
开发者ID:BeamFoundry,项目名称:spring-osgi,代码行数:18,代码来源:BaseIntegrationTest.java

示例6: getDefaultPerms

import org.osgi.framework.PackagePermission; //导入依赖的package包/类
public static List<Permission> getDefaultPerms() {
    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));
    return permSet;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:10,代码来源:DefaultPolicyBuilder.java

示例7: testGetDefaultPerms

import org.osgi.framework.PackagePermission; //导入依赖的package包/类
@Test
public void testGetDefaultPerms() {
    List<Permission> permSet = Lists.newArrayList();
    assertTrue(permSet.isEmpty());
    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));
    assertEquals(5, permSet.size());
}
 
开发者ID:opennetworkinglab,项目名称:onos,代码行数:12,代码来源:DefaultPolicyBuilderTest.java

示例8: getOnosPermission

import org.osgi.framework.PackagePermission; //导入依赖的package包/类
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;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:71,代码来源:DefaultPolicyBuilder.java

示例9: getPermission

import org.osgi.framework.PackagePermission; //导入依赖的package包/类
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;

    }
 
开发者ID:shlee89,项目名称:athena,代码行数:67,代码来源:DefaultPolicyBuilder.java


注:本文中的org.osgi.framework.PackagePermission类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。