org.wso2.carbon.registry.core.Association类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(14.0k)|赞(0)|评价(0)|浏览(88)

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

Association介绍

暂无

代码示例

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

private void persistAssociations(Registry registry, List <Association> associations)
      throws RegistryException {
    Iterator <Association> associationIterator = associations.iterator();

    while(associationIterator.hasNext()) {

      Association association = associationIterator.next();
      registry.addAssociation(association.getSourcePath(), association.getDestinationPath(),
                  association.getAssociationType());
    }
  }
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

private void identifyAssociationsNew(WSDLInfo wsdlInfo) {
  String wsdlPath = wsdlInfo.getProposedRegistryURL();
  for (String association : wsdlInfo.getSchemaDependencies()) {
    String associatedTo = schemaProcessor.getSchemaAssociationPath(association);
    if (associatedTo != null) {
      associations.add(new Association(wsdlPath,
          associatedTo,
          CommonConstants.DEPENDS));
      associations.add(new Association(associatedTo,
          wsdlPath,
          CommonConstants.USED_BY));
    }
  }
  for (String association : wsdlInfo.getWSDLDependencies()) {
    WSDLInfo info = wsdls.get(association);
    if (info != null) {
      String associatedTo = info.getProposedRegistryURL();
      if (associatedTo != null) {
        associations.add(new Association(wsdlPath,
            associatedTo,
            CommonConstants.DEPENDS));
        associations.add(new Association(associatedTo,
            wsdlPath,
            CommonConstants.USED_BY));
      }
    }
  }
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.resource

public static boolean hasAssociations(String path,String type,UserRegistry registry) throws Exception {
  if(type == null || path == null) {
   return false;
  }
  Association [] associations = registry.getAssociations(path,type);
  for(Association association:associations){
    if (association.getAssociationType() != null && association.getAssociationType().equals(type)
        && association.getSourcePath().equals(path)) {
      return true;
    }
  }
 return false;
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.indexing

/**
 *  Method to set the resource Association types and destinations to IndexDocument attribute list.
 */
private void addAssociations() throws RegistryException {
  // Add resource association types and destinations
  Association[] associations;
  try {
    associations = registry.getAllAssociations(resourcePath);
  } catch (RegistryException e) {
    String message = "Error at IndexDocumentCreator when getting Registry Associations.";
    log.error(message, e);
    throw new RegistryException(message, e);
  }
  List<String> associationTypeList = new ArrayList<>();
  List<String> associationDestinationList = new ArrayList<>();
  if (associations != null && associations.length > 0) {
    for (Association association : associations) {
      associationTypeList.add(association.getAssociationType());
      associationDestinationList.add(association.getDestinationPath());
    }
    if (associationTypeList.size() > 0) {
      attributes.put(IndexingConstants.FIELD_ASSOCIATION_TYPES, associationTypeList);
    }
    if (associationDestinationList.size() > 0) {
      attributes.put(IndexingConstants.FIELD_ASSOCIATION_DESTINATIONS, associationDestinationList);
    }
  }
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.relations

public int compare(Association o1, Association o2) {
        int result = RegistryUtils.getResourceName(o1.getDestinationPath()).
            compareToIgnoreCase(
                RegistryUtils.getResourceName(o2.getDestinationPath()));
        if (result != 0) {
          return result;
        }
        return o1.getDestinationPath().compareTo(o2.getDestinationPath());
      }
});

代码示例来源:origin: org.wso2.greg/org.wso2.carbon.governance.samples.shutterbug

if (associations != null && associations.length != 0) {
  for(Association association : associations) {
    String destination = association.getDestinationPath();
    registry.removeAssociation(destination, resourcePath, ASSOCIATION_TYPE_VOTED);
    registry.removeAssociation(resourcePath, destination, ASSOCIATION_TYPE_USED_BY);
    ASSOCIATION_TYPE_THUMBNAIL);
if (thumbnailAssociations != null && thumbnailAssociations.length != 0) {
  registry.removeAssociation(thumbnailAssociations[0].getSourcePath(),
      thumbnailAssociations[0].getDestinationPath(), ASSOCIATION_TYPE_THUMBNAIL);

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

new LinkedHashMap<String, AssociationInteger>();
for (Association relationship : relationshipDefinitions) {
  String type = relationship.getAssociationType();
  String source = relationship.getSourcePath();
  String target = relationship.getDestinationPath();
  if (typeMap.containsKey(type)) {
    AssociationInteger associationInteger = typeMap.get(type);
          GovernanceUtils.getPathsFromPathExpression(target, artifact)) {
        if (registry.resourceExists(targetPath)) {
          associationInteger.getAssociations().add(new Association(path, targetPath, type));
        } else {
          if (log.isDebugEnabled()) {
          GovernanceUtils.getPathsFromPathExpression(source, artifact)) {
        if (registry.resourceExists(sourcePath)) {
          associationInteger.getAssociations().add(new Association(sourcePath, path, type));
        } else {
          if (log.isDebugEnabled()) {
          GovernanceUtils.getPathsFromPathExpression(target, artifact)) {
        if (registry.resourceExists(targetPath)) {
          associationInteger.getAssociations().add(new Association(path, targetPath, type));
        } else {
          if (log.isDebugEnabled()) {
          GovernanceUtils.getPathsFromPathExpression(source, artifact)) {
        if (registry.resourceExists(sourcePath)) {
          associationInteger.getAssociations().add(new Association(sourcePath, path, type));

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

private static Association[] getDependenciesRecursively(Registry registry, String resourcePath, List<String> traversedDependencyPaths)
    throws RegistryException {
  List<Association> dependencies = new ArrayList<Association>();
  if (!traversedDependencyPaths.contains(resourcePath)) {
    traversedDependencyPaths.add(resourcePath);
    List<Association> tempDependencies =
        Arrays.asList(registry.getAssociations(resourcePath, CommonConstants.DEPENDS));
    for (Association association : tempDependencies) {
      if (!traversedDependencyPaths.contains(association.getDestinationPath())) {
        dependencies.add(association);
        List<Association> childDependencies = Arrays.asList(
            getDependenciesRecursively(
                registry, association.getDestinationPath(), traversedDependencyPaths)
        );
        if (!childDependencies.isEmpty()) {
          dependencies.addAll(childDependencies);
        }
      }
    }
  }
  return dependencies.toArray(new Association[dependencies.size()]);
}

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

if ("url".equals(associatedMediaType)) {
  try {
    new URL(association.getDestinationPath());
    association.getSourcePath().equals(path)) {
  String destinationPath = association.getDestinationPath();
  if (systemRegistry.resourceExists(destinationPath)) {
    Resource resource = systemRegistry.get(destinationPath);
    association.getDestinationPath().equals(path)) {
  Resource resource = systemRegistry.get(association.getSourcePath());
  if (associatedMediaType == null ||
      associatedMediaType.equals(resource.getMediaType())) {
} else if (association.getSourcePath().equals(path)) {
  Resource resource = systemRegistry.get(association.getDestinationPath());
  if (associatedMediaType == null ||
      associatedMediaType.equals(resource.getMediaType())) {
  Resource resource = systemRegistry.get(association.getSourcePath());
  if (associatedMediaType == null ||
      associatedMediaType.equals(resource.getMediaType())) {

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.relations

private static String createAssociationTree(Association tmpAsso, AssociationTreeBean associationTreeBean, UserRegistry registry) throws RegistryException {
  String path = tmpAsso.getDestinationPath();
  associationTreeBean.setAssoIndex(associationTreeBean.getAssoIndex() + 1);
  StringBuffer associationTreePart = new StringBuffer();
          if (!path.equals(asso.getDestinationPath())) {
            if (!paths.contains(asso.getDestinationPath())) {
              showChildren = true;
              break;
    if (!associationTreeBean.getAssoType().equals(CommonConstants.ASSOCIATION_TYPE01))
      associationTreePart.append("<li class=\"second\">").append(
          tmpAsso.getAssociationType()).append("</li>");
    associationTreePart.append("</ul></div>");
    if (!foundInfinite && !fatherAsso.isEmpty()) {
        if (!path.equals(asso.getDestinationPath())) {
          if (!paths.contains(asso.getDestinationPath())) {
            associationTreePart.append(createAssociationTree(asso, associationTreeBean, registry));
    if (!associationTreeBean.getAssoType().equals(CommonConstants.ASSOCIATION_TYPE01))
      associationTreePart.append("<li class=\"second\">").append(
          tmpAsso.getAssociationType()).append("</li>");
    associationTreePart.append("</ul></div>");

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.relations

Association tmpAsso = (Association) iAssociations.next();
  if (tmpAsso.getAssociationType().equals(CommonConstants.ASSOCIATION_TYPE01)
      && assoType.equals(CommonConstants.ASSOCIATION_TYPE01) && tmpAsso.getSourcePath().equals(path))
    associations.add(tmpAsso);
  if (!tmpAsso.getAssociationType().equals(CommonConstants.ASSOCIATION_TYPE01)
      && !assoType.equals(CommonConstants.ASSOCIATION_TYPE01) && tmpAsso.getSourcePath().equals(path))
    associations.add(tmpAsso);

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

public void persistAssociations() throws RegistryException {
  Iterator<Association> associationIterator = associationsBuffer.iterator();
  while (associationIterator.hasNext()) {
    Association association = associationIterator.next();
    registry.addAssociation(association.getSourcePath(), association.getDestinationPath(),
                association.getAssociationType());
  }
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.relations

if (a.getDestinationPath() != null &&
    (registry.resourceExists(a.getDestinationPath()) ||
        a.getDestinationPath().matches("^[a-zA-Z]+://.*"))) {
  assoList.add(a);

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

Association[] associations = governanceSystemRegistry.getAssociations(path, "depends");
for(Association association : associations){
  if(association.getSourcePath().equals(path)){
    String destinationPath = association.getDestinationPath();
    dependencies.add(governanceSystemRegistry.get(destinationPath).getUUID());

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

associatedRes.add(association.getDestinationPath());
registry.removeAssociation(resourcePath.getPath(), association.getDestinationPath(), association.getAssociationType());
Association[] allAssociations = registry.getAllAssociations(path);
for (Association association : allAssociations) {
  allAssociatedRes.add(association.getDestinationPath());
  registry.removeAssociation(path, association.getDestinationPath(), association.getAssociationType());

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

private void identifyAssociationsNew(WSDLInfo wsdlInfo) {
  String wsdlPath = wsdlInfo.getProposedRegistryURL();
  for (String association : wsdlInfo.getSchemaDependencies()) {
    String associatedTo = schemaUriProcessor.getSchemaAssociationPath(association);
    if (associatedTo != null) {
      associations.add(new Association(wsdlPath,
          associatedTo,
          CommonConstants.DEPENDS));
      associations.add(new Association(associatedTo,
          wsdlPath,
          CommonConstants.USED_BY));
    }
  }
  for (String association : wsdlInfo.getWSDLDependencies()) {
    WSDLInfo info = wsdls.get(association);
    if (info != null) {
      String associatedTo = info.getProposedRegistryURL();
      if (associatedTo != null) {
        associations.add(new Association(wsdlPath,
            associatedTo,
            CommonConstants.DEPENDS));
        associations.add(new Association(associatedTo,
            wsdlPath,
            CommonConstants.USED_BY));
      }
    }
  }
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.resource

private static boolean isADependency(Association associationBean,UserRegistry registry,String scrPath,String COLLECTION) throws Exception {
  if(associationBean.getDestinationPath() == null ||
      (!registry.resourceExists(associationBean.getDestinationPath()))){
    return false;
  }
  ResourceData resourceData = ContentUtil.getResourceData(new String[]{associationBean.getDestinationPath()}, registry)[0];
   boolean isCollection = resourceData.getResourceType().equals(COLLECTION);
   return (associationBean.getAssociationType() != null && associationBean.getAssociationType().equals("depends")
       && associationBean.getSourcePath().equals(scrPath) && !isCollection);
}

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions

public void checkEndpointDependency(Registry registry, String path) throws RegistryException {
  // here we are getting the associations for the endpoint.
  Association[] endpointDependents = registry.getAssociations(path, CommonConstants.USED_BY);
  // for each endpoint we are checking what the resource type is, if it is service, we check the
  // endpoint service, if it is wsdl, we check the wsdl
  List<String> dependents = new ArrayList<String>();
  for (Association endpointDependent: endpointDependents) {
    String targetPath = endpointDependent.getDestinationPath();
    if (registry.resourceExists(targetPath)) {
      Resource targetResource = registry.get(targetPath);
      String mediaType = targetResource.getMediaType();
      if (CommonConstants.WSDL_MEDIA_TYPE.equals(mediaType)) {
        // so there are dependencies for wsdl media
        dependents.add(targetPath);
      } else if ((CommonConstants.SERVICE_MEDIA_TYPE.equals(mediaType) ||
            CommonConstants.SOAP_SERVICE_MEDIA_TYPE.equals(mediaType))) {
        dependents.add(targetPath);
      }
    }
  }
  if (dependents.size() > 0) {
    // so there are dependencies, we are not allowing to delete endpoints if there are dependents
    String msg = "Error in deleting the endpoint resource. Please make sure detach the associations " +
        "to the services and wsdls manually before deleting the endpoint. " +
        "endpoint path: " + path + ".";
    log.error(msg);
    throw new RegistryException(msg);
  }
}

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

if(association.getSourcePath().equals(wsdlPath)){
  dependeinciesList.add(association.getDestinationPath());

代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.ws.client

public static Association transformWSAssociationToAssociation(WSAssociation wsAsso) {
  return new Association(wsAsso.getSourcePath(),
      wsAsso.getDestinationPath(), wsAsso.getAssociationType());
}

相关文章

微信公众号

最新文章

更多