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

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

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

Registry.get介绍

暂无

代码示例

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

/**
 * Factory method creating a new <code>RegistryNode</code> from a node at a given Registry path.
 *
 * @param path  Registry path of the node
 * @return  A new instance representing the Registry node at <code>path</code>
 * @throws CmisObjectNotFoundException  if <code>path</code> does not identify a Registry node
 * @throws CmisRuntimeException
 */
public RegistryObject getNode(String path) throws RegistryException {
  return create(repository.get(path));
}

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

private static void removeEndpointDependencies(String servicePath, Registry registry) throws RegistryException {
  // update lock check removed from for loop to prevent the database lock
    Association[] associations = registry.getAllAssociations(servicePath);
    for (Association association : associations) {
      String path = association.getDestinationPath();
      if (registry.resourceExists(path)) {
        Resource endpointResource = registry.get(path);
        if (CommonConstants.ENDPOINT_MEDIA_TYPE.equals(endpointResource.getMediaType())) {
          registry.removeAssociation(servicePath, path, CommonConstants.DEPENDS);
          registry.removeAssociation(path, servicePath, CommonConstants.USED_BY);
        }
      }
    }
}

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

protected List<String> getServersToDiscover(Registry registry) throws RegistryException, IOException {
  Resource resource = registry.get(serverIdPropertyFilePath);
  if (resource != null) {
    Properties serverProperties = new Properties();
    serverProperties.load(resource.getContentStream());
    String serverStr = serverProperties.getProperty(SERVERS_PROPERTY);
    if (serverStr != null) {
      String[] servers = serverStr.split(SERVER_ID_SEPARATOR);
      return Arrays.asList(servers);
    }
  }
  return Collections.emptyList();
}

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

public RegistryObject next() {
  try {
    return create(getRepository().get(newListIterator.next()));
  } catch (RegistryException e) {
    String msg = "Error while iterating the node list ";
    log.error(msg, e);
    throw new CmisRuntimeException(msg, e);
  }
}

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

public static Resource getResourceById(Registry repository, String resourceId){
  Resource resource = null;
  try {
    resource = repository.get(getPathById(resourceId));
  } catch (RegistryException e) {
    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
  }
  return resource;
}

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

/**
 * Method to make an aspect to default.
 * @param path path of the resource
 * @param aspect   the aspect to be removed.
 * @param registry registry instance to be used
 */
public static void setDefaultLifeCycle(String path, String aspect, Registry registry) throws RegistryException {
  Resource resource = registry.get(path);
  if(resource != null) {
    resource.setProperty("registry.LC.name", aspect);
    registry.put(path, resource);
  }
}

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

public static String getLifecycleConfigurationVersion(String name, Registry registry) throws RegistryException, XMLStreamException {
  String path = getContextRoot() + name;
  Resource resource;
  if (lifeCycleExists(name, registry)) {
    resource = registry.get(path);
    return String.valueOf(((ResourceImpl)resource).getVersionNumber());
  }
  return null;
}

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

public RegistryVersion next() {
  String nextVersion = iterator.next();
  try {
    return new RegistryVersion(getRepository(), getRepository().get(nextVersion), nextVersion, typeManager, pathManager);
  } catch (RegistryException e) {
    throw new CmisRuntimeException("Error iterating over versions");
  }
}

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

@Override
  public boolean handleCreateLink(RequestContext requestContext) throws RegistryException {
    String targetPath = requestContext.getTargetPath();
    if (!requestContext.getRegistry().resourceExists(targetPath)) {
      return false;
    }
    Resource targetResource = requestContext.getRegistry().get(targetPath);
    String mType = targetResource.getMediaType();
    return mType != null && (invert != (mType.matches(
        "application/vnd\\.[a-zA-Z0-9.-]+\\+xml") & !mType.matches(
        "application/vnd.wso2-service\\+xml")));
  }
},

代码示例来源:origin: org.wso2.carbon.identity/org.wso2.carbon.identity.entitlement

public PublisherDataHolder retrieveSubscriber(String id, boolean returnSecrets) throws EntitlementException {
  try {
    if (registry.resourceExists(PDPConstants.ENTITLEMENT_POLICY_PUBLISHER +
        RegistryConstants.PATH_SEPARATOR + id)) {
      Resource resource = registry.get(PDPConstants.ENTITLEMENT_POLICY_PUBLISHER +
          RegistryConstants.PATH_SEPARATOR + id);
      return new PublisherDataHolder(resource, returnSecrets);
    }
  } catch (RegistryException e) {
    log.error("Error while retrieving subscriber detail of id : " + id, e);
    throw new EntitlementException("Error while retrieving subscriber detail of id : " + id, e);
  }
  throw new EntitlementException("No Subscriber is defined for given Id");
}

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

private void deleteRecursively(String path,Registry registry) throws RegistryException {
  Resource currentResource = registry.get(path);
  if((currentResource instanceof Collection) && ((Collection)currentResource).getChildCount() == 0 ){
    registry.delete(path);
    deleteRecursively(currentResource.getParentPath(),registry);
  }
}

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

private void deleteRecursively (Registry registry, Resource resource) throws RegistryException {
  if (resource instanceof Collection) {
    for(String childResource : ((Collection) resource).getChildren()){
      deleteRecursively(registry, registry.get(childResource));
    }
  }
  registry.delete(resource.getPath());
}

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

public static String getLifecycleConfiguration(String name, Registry registry) throws RegistryException, XMLStreamException {
  String path = getContextRoot() + name;
  Resource resource;
  if (lifeCycleExists(name, registry)) {
    resource = registry.get(path);
    return RegistryUtils.decodeBytes((byte[])resource.getContent());
  }
  return null;
}
public static String getLifecycleConfigurationVersion(String name, Registry registry) throws RegistryException, XMLStreamException {

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

public ProfilesBean getUserProfile(String path) throws RegistryException,UserStoreException{
    Registry registry = getConfigSystemRegistry();
    Resource resource = registry.get(path);
    String contentString = (String)resource.getContent();

    ProfilesBean profbean = new ProfilesBean();
    profbean.setMainDataString(contentString);
//        profilebean.calculatevalues();
    return profbean;
  }
}

代码示例来源:origin: org.wso2.carbon.devicemgt-plugins/org.wso2.carbon.device.mgt.mobile.impl

public static Resource getRegistryResource(String path) throws MobileDeviceMgtPluginException {
  try {
    if(MobileDeviceManagementUtil.getConfigurationRegistry().resourceExists(path)){
      return MobileDeviceManagementUtil.getConfigurationRegistry().get(path);
    }
    return null;
  } catch (RegistryException e) {
    throw new MobileDeviceMgtPluginException("Error in retrieving registry resource : " +
                         e.getMessage(), e);
  }
}

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

private void deleteChildRecursively(String path,Registry registry) throws RegistryException {
    Resource currentResource = registry.get(path);

    if((currentResource instanceof Collection) && ((Collection)currentResource).getChildCount() == 0 ){
      String[] childPaths = ((Collection)currentResource).getChildren();
      for (String childPath : childPaths) {
        deleteChildRecursively(childPath,registry);
      }
      registry.delete(path);
    } else {
      registry.delete(path);
    }

  }
}

代码示例来源:origin: org.wso2.carbon.analytics/org.wso2.carbon.analytics.dashboard

public static void removeRegistryResource(String resourcePath) throws RegistryException {
  int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
  Registry registry = ServiceHolder.getRegistryService().getConfigSystemRegistry(tenantId);
  if (registry.resourceExists(resourcePath)) {
    Resource resource = registry.get(resourcePath);
    registry.delete(resourcePath);
  }
}

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

public void putChild(RequestContext requestContext) throws RegistryException {
  Registry registry = requestContext.getRegistry();
  String thisCollectionPath = requestContext.getParentPath();
  String thisCollectionName = RegistryUtils.getResourceName(thisCollectionPath);
  String parentContainerPath = RegistryUtils.getParentPath(thisCollectionPath);
  Resource parentContainer = registry.get(parentContainerPath);
  if (thisCollectionName.equals(parentContainer.getProperty(
      CommonConstants.LATEST_VERSION_PROP_NAME))) {
    String resourcePath = requestContext.getResourcePath().getPath();
    String resourceName = RegistryUtils.getResourceName(resourcePath);
    registry.createLink(parentContainerPath + RegistryConstants.PATH_SEPARATOR +
        resourceName, resourcePath);
  }
}

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

public static String getCurrentUserID() throws Exception {
  Registry registry = getRegistryService().getSystemRegistry();
  Resource shutterbugCollection = registry.get(DEFAULT_SHUTTERBUG_HOME);
  UserRegistry userRegistry = CommonUtil.getUserRegistry(Utils.getRegistryService());
  String tenantUser = TENANT_USER_PREFIX + userRegistry.getTenantId() + "." +
      userRegistry.getUserName();
  return shutterbugCollection.getProperty(tenantUser);
}

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

@Override
public void createLink(RequestContext requestContext) throws RegistryException {
  String symlinkPath = requestContext.getResourcePath().getPath();
  String targetResourcePath = requestContext.getTargetPath();
  if (requestContext.getRegistry().resourceExists(targetResourcePath)) {
    Resource r = requestContext.getRegistry().get(targetResourcePath);
    r.addProperty("registry.resource.symlink.path", symlinkPath);
    requestContext.getRegistry().put(targetResourcePath, r);
  }
}

相关文章