org.wso2.carbon.registry.core.Resource.getAspects()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(72)

本文整理了Java中org.wso2.carbon.registry.core.Resource.getAspects方法的一些代码示例,展示了Resource.getAspects的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.getAspects方法的具体详情如下:
包路径:org.wso2.carbon.registry.core.Resource
类名称:Resource
方法名:getAspects

Resource.getAspects介绍

暂无

代码示例

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.api

if(resource.getAspects().size() > 0) {
  resource.setProperty("registry.LC.name", resource.getAspects().get(0));

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.api

/**
 * Method to associate an aspect with a given resource on the registry.
 *
 * @param path     the path of the resource.
 * @param aspect   the aspect to add.
 * @param registry the registry instance on which the resource is available.
 * @throws RegistryException if the operation failed.
 */
public static void associateAspect(String path, String aspect, Registry registry)
    throws RegistryException {
  try {
    registry.associateAspect(path, aspect);
    Resource resource = registry.get(path);
    if(resource.getAspects().size() == 1) {
      // Since this is the first life-cycle we make it default
      resource.setProperty("registry.LC.name", aspect);
      registry.put(path, resource);
    }
  } catch (RegistryException e) {
    String msg = "Failed to associate aspect with the resource " +
        path + ". " + e.getMessage();
    log.error(msg, e);
    throw new RegistryException(msg, e);
  }
}

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.api

/**
 * Associates the named lifecycle with the artifact
 *
 * @param name the name of the lifecycle to be associated with this artifact.
 * @throws GovernanceException if an error occurred.
 */
@Override
public void attachLifecycle(String name) throws GovernanceException {
  try {
    String path = getPath();
    if(name != null && path != null) {
      registry.associateAspect(path, name);
      Resource resource = registry.get(path);
      if(resource.getAspects().size() == 1) {
        // Since this is the first life-cycle we make it default
        resource.setProperty("registry.LC.name", name);
        registry.put(path, resource);
      }
    }
  } catch (RegistryException e) {
    String msg = "Error in associating lifecycle for the artifact. id: " + id +
        ", path: " + path + ".";
    log.error(msg, e);
    throw new GovernanceException(msg, e);
  }
}

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.lcm

if (path != null) {
  Resource resource = registry.get(path);
  List<String> aspects = resource.getAspects();
  if (aspects != null) {
    for (String aspect : aspects) {

相关文章