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


Java RoleList类代码示例

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


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

示例1: testNotWritable

import javax.management.relation.RoleList; //导入依赖的package包/类
public Result testNotWritable() throws Exception {

        MBeanServer server = MBeanServerFactory.createMBeanServer();

        ObjectName unitName = new ObjectName("a:b=c");
        server.registerMBean(new Unit(), unitName);

        RelationService rService = new RelationService(true);
        server.registerMBean(rService, new ObjectName("a:b=d"));

        /* Role is not readable */
        RoleInfo[] rInfo = { new RoleInfo("role", classPath, true, false) };
        rService.createRelationType("relationType", rInfo);

        RoleList unitRoles = new RoleList();
        unitRoles.add(new Role("role", Collections.singletonList(unitName)));

        try {
            rService.createRelation("relation", "relationType", unitRoles);
            return passed();
        } catch (Throwable t) {
            return failed(t.toString());
        }
    }
 
开发者ID:freeVM,项目名称:freeVM,代码行数:25,代码来源:StructureTest.java

示例2: testAllAccessQueries

import javax.management.relation.RoleList; //导入依赖的package包/类
private void testAllAccessQueries(String relationId)
{
   Logger logger = getLogger();
   // retrieve all roles
   try
   {
      Object[] params = {relationId};
      String[] signature = {"java.lang.String"};
      RoleResult roleResult = (RoleResult)(m_server.invoke(m_relationObjectName, "getAllRoles", params, signature));
      RoleList roleList = roleResult.getRoles();
      for (Iterator i = roleList.iterator(); i.hasNext();)
      {
         Role currentRole = (Role)i.next();
         System.out.println(">>>> role name: " + currentRole.getRoleName());
         System.out.println(">>>> role values: " + currentRole.getRoleValue().toString());
      }
      System.out.println("No unresolved Roles roleUnresolved size: " + roleResult.getRolesUnresolved().size());
   }
   catch (Exception ex)
   {
      logger.error("Exception printing the results from relationId: " + relationId);
      System.out.println("Printing the Exception message to validate exception: " + ex.getMessage());
   }

}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:26,代码来源:RelationServiceExample.java

示例3: testNotRegisteredException

import javax.management.relation.RoleList; //导入依赖的package包/类
public Result testNotRegisteredException() throws Exception {

        /* Initialisation without registering */
        MBeanServer server = MBeanServerFactory.createMBeanServer();

        ObjectName unitName = new ObjectName("a:b=c");
        server.registerMBean(new Unit(), unitName);

        RelationService rService = new RelationService(true);
        RoleInfo[] rInfo = { new RoleInfo("role", classPath) };
        rService.createRelationType("relationType", rInfo);

        RoleList unitRoles = new RoleList();
        unitRoles.add(new Role("role", Collections.singletonList(unitName)));

        /* catch RelationServiceNotRegisteredException */
        try {
            rService.createRelation("relation", "relationType", unitRoles);
            return failed("");
        } catch (RelationServiceNotRegisteredException e) {
            return passed();
        } catch (Throwable t) {
            return failed(t.toString());
        }
    }
 
开发者ID:freeVM,项目名称:freeVM,代码行数:26,代码来源:StructureTest.java

示例4: testNullRelationName

import javax.management.relation.RoleList; //导入依赖的package包/类
public Result testNullRelationName() throws Exception {

        MBeanServer server = MBeanServerFactory.createMBeanServer();

        ObjectName unitName = new ObjectName("a:b=c");
        server.registerMBean(new Unit(), unitName);

        RelationService rService = new RelationService(true);
        server.registerMBean(rService, new ObjectName("a:b=d"));

        RoleInfo[] rInfo = { new RoleInfo("role", classPath) };
        rService.createRelationType("relationType", rInfo);

        RoleList unitRoles = new RoleList();
        unitRoles.add(new Role("role", Collections.singletonList(unitName)));

        /* set null relation name */
        try {
            rService.createRelation(null, "relationType", unitRoles);
            return failed("");
        } catch (IllegalArgumentException e) {
            return passed();
        } catch (Throwable t) {
            return failed(t.toString());
        }
    }
 
开发者ID:freeVM,项目名称:freeVM,代码行数:27,代码来源:StructureTest.java

示例5: testNullRelationType

import javax.management.relation.RoleList; //导入依赖的package包/类
public Result testNullRelationType() throws Exception {

        MBeanServer server = MBeanServerFactory.createMBeanServer();

        ObjectName unitName = new ObjectName("a:b=c");
        server.registerMBean(new Unit(), unitName);

        RelationService rService = new RelationService(true);
        server.registerMBean(rService, new ObjectName("a:b=d"));

        RoleList unitRoles = new RoleList();
        unitRoles.add(new Role("role", Collections.singletonList(unitName)));

        /* set null relation type */
        try {
            rService.createRelation("relation", null, unitRoles);
            return failed("");
        } catch (IllegalArgumentException e) {
            return passed();
        } catch (Throwable t) {
            return failed(t.toString());
        }
    }
 
开发者ID:freeVM,项目名称:freeVM,代码行数:24,代码来源:StructureTest.java

示例6: testUnknownRelationType

import javax.management.relation.RoleList; //导入依赖的package包/类
public Result testUnknownRelationType() throws Exception {

        MBeanServer server = MBeanServerFactory.createMBeanServer();

        ObjectName unitName = new ObjectName("a:b=c");
        server.registerMBean(new Unit(), unitName);

        RelationService rService = new RelationService(true);
        server.registerMBean(rService, new ObjectName("a:b=d"));

        RoleList unitRoles = new RoleList();
        unitRoles.add(new Role("role", Collections.singletonList(unitName)));

        /* Try to create relation with unknown relation type */
        try {
            rService.createRelation("relation", "relationType", unitRoles);
            return failed("");
        } catch (RelationTypeNotFoundException e) {
            return passed();
        } catch (Throwable t) {
            return failed(t.toString());
        }
    }
 
开发者ID:freeVM,项目名称:freeVM,代码行数:24,代码来源:StructureTest.java

示例7: testNumberOfMBeanLessThanNeed

import javax.management.relation.RoleList; //导入依赖的package包/类
public Result testNumberOfMBeanLessThanNeed() throws Exception {

        MBeanServer server = MBeanServerFactory.createMBeanServer();

        ObjectName unitName = new ObjectName("a:b=c");
        server.registerMBean(new Unit(), unitName);

        RelationService rService = new RelationService(true);
        server.registerMBean(rService, new ObjectName("a:b=d"));

        RoleInfo[] rInfo = { new RoleInfo("role", classPath) };
        rService.createRelationType("relationType", rInfo);

        RoleList unitRoles = new RoleList();
        /* The Number of MBeans is less than default (1) */
        unitRoles.add(new Role("role", new ArrayList()));
        try {
            rService.createRelation("relation", "relationType", unitRoles);
            return failed("");
        } catch (InvalidRoleValueException e) {
            return passed();
        } catch (Throwable t) {
            return failed(t.toString());
        }
    }
 
开发者ID:freeVM,项目名称:freeVM,代码行数:26,代码来源:StructureTest.java

示例8: testMBeanNotRegistered

import javax.management.relation.RoleList; //导入依赖的package包/类
public Result testMBeanNotRegistered() throws Exception {

        MBeanServer server = MBeanServerFactory.createMBeanServer();

        ObjectName unitName = new ObjectName("a:b=c");

        RelationService rService = new RelationService(true);
        server.registerMBean(rService, new ObjectName("a:b=d"));

        RoleInfo[] rInfo = { new RoleInfo("role", classPath) };
        rService.createRelationType("relationType", rInfo);

        RoleList unitRoles = new RoleList();

        /* Referenced MBean hasn't registered */
        unitRoles.add(new Role("role", Collections.singletonList(unitName)));

        try {
            rService.createRelation("relation", "relationType", unitRoles);
            return failed("");
        } catch (InvalidRoleValueException e) {
            return passed();
        } catch (Throwable t) {
            return failed(t.toString());
        }
    }
 
开发者ID:freeVM,项目名称:freeVM,代码行数:27,代码来源:StructureTest.java

示例9: testNotReadable

import javax.management.relation.RoleList; //导入依赖的package包/类
public Result testNotReadable() throws Exception {

        MBeanServer server = MBeanServerFactory.createMBeanServer();

        ObjectName unitName = new ObjectName("a:b=c");
        server.registerMBean(new Unit(), unitName);

        RelationService rService = new RelationService(true);
        server.registerMBean(rService, new ObjectName("a:b=d"));

        /* Role is not readable */
        RoleInfo[] rInfo = { new RoleInfo("role", classPath, false, true) };
        rService.createRelationType("relationType", rInfo);

        RoleList unitRoles = new RoleList();
        unitRoles.add(new Role("role", Collections.singletonList(unitName)));

        try {
            rService.createRelation("relation", "relationType", unitRoles);
            return passed();
        } catch (Throwable t) {
            return failed(t.toString());
        }
    }
 
开发者ID:freeVM,项目名称:freeVM,代码行数:25,代码来源:StructureTest.java

示例10: createLibraryRelation

import javax.management.relation.RoleList; //导入依赖的package包/类
private void createLibraryRelation(String personalLibraryId, String libraryTypeName, RoleList libraryList)
{
   Logger logger = getLogger();
   try
   {
      Object[] params = {personalLibraryId, libraryTypeName, libraryList};
      String[] signature = {"java.lang.String", "java.lang.String", "javax.management.relation.RoleList"};
      m_server.invoke(m_relationObjectName, "createRelation", params, signature);
   }
   catch (Exception ex)
   {
      logger.error("Exception creating Library Relation: " + ex.getMessage());
      ex.printStackTrace();
   }
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:16,代码来源:RelationServiceExample.java

示例11: testObjectToKind

import javax.management.relation.RoleList; //导入依赖的package包/类
public void testObjectToKind() {
    assertEquals(Kind.objectToKind(null), Kind.NOT_A_COLLECTION);

    /* let's try with some set implementation */
    assertEquals(Kind.objectToKind(new HashSet()), Kind.SET);
    assertEquals(Kind.objectToKind(new CopyOnWriteArraySet()), Kind.SET);
    assertEquals(Kind.objectToKind(new ConcurrentSkipListSet()), Kind.SET);
    assertEquals(Kind.objectToKind(new LinkedHashSet()), Kind.SET);
    assertEquals(Kind.objectToKind(new TreeSet()), Kind.SET);

    /* let's try with some list implementation */
    assertEquals(Kind.objectToKind(new ArrayList()), Kind.LIST);
    assertEquals(Kind.objectToKind(new CopyOnWriteArrayList<>()), Kind.LIST);
    assertEquals(Kind.objectToKind(new LinkedList<>()), Kind.LIST);
    assertEquals(Kind.objectToKind(new RoleList()), Kind.LIST);
    assertEquals(Kind.objectToKind(new RoleUnresolvedList()), Kind.LIST);
    assertEquals(Kind.objectToKind(new Stack()), Kind.LIST);
    assertEquals(Kind.objectToKind(new Vector<>()), Kind.LIST);

    /* let's try with some map implementation */
    assertEquals(Kind.objectToKind(new HashMap()), Kind.MAP);
    assertEquals(Kind.objectToKind(new ConcurrentHashMap<>()), Kind.MAP);
    assertEquals(Kind.objectToKind(new ConcurrentSkipListMap<>()), Kind.MAP);
    assertEquals(Kind.objectToKind(new Hashtable<>()), Kind.MAP);
    assertEquals(Kind.objectToKind(new IdentityHashMap<>()), Kind.MAP);
    assertEquals(Kind.objectToKind(new LinkedHashMap<>()), Kind.MAP);
    assertEquals(Kind.objectToKind(new PrinterStateReasons()), Kind.MAP);
    assertEquals(Kind.objectToKind(new Properties()), Kind.MAP);
    assertEquals(Kind.objectToKind(new TreeMap<>()), Kind.MAP);
    assertEquals(Kind.objectToKind(new WeakHashMap<>()), Kind.MAP);
}
 
开发者ID:Stratio,项目名称:deep-spark,代码行数:32,代码来源:CellValidatorTest.java

示例12: testRoleNotFound

import javax.management.relation.RoleList; //导入依赖的package包/类
public Result testRoleNotFound() throws Exception {

        MBeanServer server = MBeanServerFactory.createMBeanServer();

        ObjectName unitName = new ObjectName("a:b=c");
        server.registerMBean(new Unit(), unitName);

        RelationService rService = new RelationService(true);
        server.registerMBean(rService, new ObjectName("a:b=d"));

        RoleInfo[] rInfo = { new RoleInfo("role", classPath) };
        rService.createRelationType("relationType", rInfo);

        RoleList unitRoles = new RoleList();
        /* role name differs from role info contains */
        unitRoles.add(new Role("another role", Collections
                .singletonList(unitName)));

        /* catch RoleNotFoundException */
        try {
            rService.createRelation("relation", "relationType", unitRoles);
            return failed("");
        } catch (RoleNotFoundException e) {
            return passed();
        } catch (Throwable t) {
            return failed(t.toString());
        }
    }
 
开发者ID:freeVM,项目名称:freeVM,代码行数:29,代码来源:StructureTest.java

示例13: testIdAlreadyUsed

import javax.management.relation.RoleList; //导入依赖的package包/类
public Result testIdAlreadyUsed() throws Exception {

        MBeanServer server = MBeanServerFactory.createMBeanServer();

        ObjectName unitName = new ObjectName("a:b=c");
        server.registerMBean(new Unit(), unitName);

        RelationService rService = new RelationService(true);
        server.registerMBean(rService, new ObjectName("a:b=d"));

        RoleInfo[] rInfo = { new RoleInfo("role", classPath) };
        rService.createRelationType("relationType", rInfo);

        RoleList unitRoles = new RoleList();
        unitRoles.add(new Role("role", Collections.singletonList(unitName)));

        rService.createRelation("relation", "relationType", unitRoles);

        /* now try to create another relation with the same name */
        /* create another relation type for clearance */
        rService.createRelationType("another relationType", rInfo);

        try {
            rService.createRelation("relation", "another relationType",
                    unitRoles);
            return failed("");
        } catch (InvalidRelationIdException e) {
            return passed();
        } catch (Throwable t) {
            return failed(t.toString());
        }
    }
 
开发者ID:freeVM,项目名称:freeVM,代码行数:33,代码来源:StructureTest.java

示例14: testTheSameRoleName

import javax.management.relation.RoleList; //导入依赖的package包/类
public Result testTheSameRoleName() throws Exception {

        MBeanServer server = MBeanServerFactory.createMBeanServer();

        ObjectName unitName = new ObjectName("a:b=c");
        ObjectName unitName2 = new ObjectName("a:b=c2");
        server.registerMBean(new Unit(), unitName);
        server.registerMBean(new Unit(), unitName2);

        RelationService rService = new RelationService(true);
        server.registerMBean(rService, new ObjectName("a:b=d"));

        RoleInfo[] rInfo = { new RoleInfo("role", classPath) };
        rService.createRelationType("relationType", rInfo);

        RoleList unitRoles = new RoleList();

        /* Add 2 roles with the same name */
        unitRoles.add(new Role("role", Collections.singletonList(unitName)));
        unitRoles.add(new Role("role", Collections.singletonList(unitName2)));

        try {
            rService.createRelation("relation", "relationType", unitRoles);
            return failed("");
        } catch (InvalidRoleValueException e) {
            return passed();
        } catch (Throwable t) {
            return failed(t.toString());
        }
    }
 
开发者ID:freeVM,项目名称:freeVM,代码行数:31,代码来源:StructureTest.java

示例15: testNumberOfMBeanMoreThanNeed

import javax.management.relation.RoleList; //导入依赖的package包/类
public Result testNumberOfMBeanMoreThanNeed() throws Exception {

        MBeanServer server = MBeanServerFactory.createMBeanServer();

        ObjectName unitName = new ObjectName("a:b=c");
        ObjectName unitName2 = new ObjectName("a:b=c2");
        server.registerMBean(new Unit(), unitName);
        server.registerMBean(new Unit(), unitName2);

        RelationService rService = new RelationService(true);
        server.registerMBean(rService, new ObjectName("a:b=d"));

        RoleInfo[] rInfo = { new RoleInfo("role", classPath) };
        rService.createRelationType("relationType", rInfo);

        RoleList unitRoles = new RoleList();
        /* The Number of MBeans is more than default (1) */
        ArrayList units = new ArrayList();
        units.add(unitName);
        units.add(unitName2);

        unitRoles.add(new Role("role", units));

        try {
            rService.createRelation("relation", "relationType", unitRoles);
            return failed("");
        } catch (InvalidRoleValueException e) {
            return passed();
        } catch (Throwable t) {
            return failed(t.toString());
        }
    }
 
开发者ID:freeVM,项目名称:freeVM,代码行数:33,代码来源:StructureTest.java


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