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

x33g5p2x  于2022-01-18 转载在 其他  
字(13.7k)|赞(0)|评价(0)|浏览(174)

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

Collection介绍

暂无

代码示例

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

  1. private List<String> getSortedChildrenList(String servicePath, Registry registry)
  2. throws RegistryException {
  3. List<String> paths = Arrays.asList(((Collection) registry.get(servicePath)).getChildren());
  4. Collections.sort(paths, new Comparator<String>() {
  5. public int compare(String o1, String o2) {
  6. int n1, n2;
  7. try {
  8. n1 = Integer.parseInt(RegistryUtils.getResourceName(o1));
  9. } catch (NumberFormatException ignored) {
  10. return 1;
  11. }
  12. try {
  13. n2 = Integer.parseInt(RegistryUtils.getResourceName(o2));
  14. } catch (NumberFormatException ignored) {
  15. return -1;
  16. }
  17. return (n1 < n2) ? 1 : (n1 > n2) ? -1 : 0;
  18. }
  19. });
  20. return paths;
  21. }
  22. }

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

  1. private void deleteChildRecursively(String path,Registry registry) throws RegistryException {
  2. Resource currentResource = registry.get(path);
  3. if((currentResource instanceof Collection) && ((Collection)currentResource).getChildCount() == 0 ){
  4. String[] childPaths = ((Collection)currentResource).getChildren();
  5. for (String childPath : childPaths) {
  6. deleteChildRecursively(childPath,registry);
  7. }
  8. registry.delete(path);
  9. } else {
  10. registry.delete(path);
  11. }
  12. }
  13. }

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

  1. if (tenantId == MultitenantConstants.SUPER_TENANT_ID) {
  2. regRoot = (Collection) registry.get(UserMgtConstants.UI_PERMISSION_ROOT);
  3. String displayName = regRoot.getProperty(UserMgtConstants.DISPLAY_NAME);
  4. nodeRoot = new UIPermissionNode(UserMgtConstants.UI_PERMISSION_ROOT, displayName);
  5. } else {
  6. appRoot = (Collection) tenentRegistry.get(APPLICATIONS_PATH);
  7. parent = (Collection) tenentRegistry.newCollection();
  8. parent.setProperty(UserMgtConstants.DISPLAY_NAME, "All Permissions");
  9. parent.setChildren(new String[]{regRoot.getPath(), appRoot.getPath()});
  10. displayName = parent.getProperty(UserMgtConstants.DISPLAY_NAME);
  11. } else {
  12. displayName = regRoot.getProperty(UserMgtConstants.DISPLAY_NAME);

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

  1. /**
  2. * See CMIS 1.0 section 2.2.4.14 deleteObject
  3. *
  4. * @throws CmisRuntimeException
  5. */
  6. @Override
  7. public void delete(boolean allVersions, boolean isPwc) {
  8. try {
  9. if (getNode().getChildCount()>0) {
  10. throw new CmisConstraintException("Folder is not empty!");
  11. } else {
  12. super.delete(allVersions, isPwc);
  13. }
  14. }
  15. catch (RegistryException e) {
  16. String msg = "Failed to delete the object " + getNode().getPath();
  17. log.error(msg, e);
  18. throw new CmisRuntimeException(msg, e);
  19. }
  20. }

代码示例来源:origin: org.wso2.carbon.commons/org.wso2.carbon.event.core

  1. Collection subscriptionCollection = (Collection) userRegistry.get(resourcePath);
  2. subscriptionsArray =
  3. new Subscription[subscriptionCollection.getChildCount()];
  4. for (String subs : subscriptionCollection.getChildren()) {
  5. Collection subscription = (Collection) userRegistry.get(subs);
  6. subscriptionDetails.setId(subscription.getProperty("Name"));
  7. subscriptionDetails.setOwner(subscription.getProperty("Owner"));
  8. subscriptionDetails.setCreatedTime(ConverterUtil.convertToDate(subscription.getProperty("createdTime")));

代码示例来源:origin: org.wso2.carbon.business-process/org.wso2.carbon.bpel

  1. throws RegistryException, IOException, NoSuchAlgorithmException {
  2. Collection bpelPackage = configRegistry.newCollection();
  3. bpelPackage.setProperty(BPELConstants.BPEL_PACKAGE_PROP_LATEST_CHECKSUM,
  4. Utils.getMD5Checksum(deploymentContext.getBpelArchive()));
  5. if (log.isDebugEnabled()) {
  6. bpelPackage.setProperty(BPELConstants.BPEL_PACKAGE_PROP_STATUS,
  7. BPELConstants.STATUS_FAILED);
  8. bpelPackage.setProperty(BPELConstants.BPEL_PACKAGE_PROP_DEPLOYMENT_ERROR_LOG,
  9. deploymentContext.getDeploymentFailureCause());
  10. bpelPackage.setProperty(BPELConstants.BPEL_PACKAGE_PROP_STATUS,
  11. BPELConstants.STATUS_DEPLOYED);
  12. bpelPackage.setProperty(BPELConstants.BPEL_PACKAGE_PROP_LATEST_VERSION,
  13. Long.toString(deploymentContext.getVersion()));

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

  1. @Override
  2. public String getGlobalPolicyAlgorithmName() {
  3. String algorithm = null;
  4. try {
  5. Registry registry = getGovernanceRegistry();
  6. if (registry.resourceExists(policyDataCollection)) {
  7. Collection collection = (Collection) registry.get(policyDataCollection);
  8. algorithm = collection.getProperty("globalPolicyCombiningAlgorithm");
  9. }
  10. } catch (RegistryException e) {
  11. if (log.isDebugEnabled()) {
  12. log.debug(e);
  13. }
  14. } catch (EntitlementException e) {
  15. log.error("Error while getting Global Policy Combining Algorithm Name.", e);
  16. }
  17. // set default
  18. if (algorithm == null) {
  19. algorithm = "deny-overrides";
  20. }
  21. return algorithm;
  22. }

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

  1. String noOfPolicies = policyCollection.getProperty(PDPConstants.MAX_POLICY_ORDER);
  2. if (noOfPolicies != null && Integer.parseInt(noOfPolicies) < policy.getPolicyOrder()) {
  3. policyCollection.setProperty(PDPConstants.MAX_POLICY_ORDER,
  4. Integer.toString(policy.getPolicyOrder()));
  5. registry.put(policyPath, policyCollection);
  6. if (policyCollection != null) {
  7. int policyOrder = 1;
  8. String noOfPolicies = policyCollection.getProperty(PDPConstants.MAX_POLICY_ORDER);
  9. if (noOfPolicies != null) {
  10. policyOrder = policyOrder + Integer.parseInt(noOfPolicies);
  11. policyCollection.setProperty(PDPConstants.MAX_POLICY_ORDER,
  12. Integer.toString(policyOrder));
  13. resource.setProperty(PDPConstants.POLICY_ORDER, Integer.toString(policyOrder));

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.mashup.javascript.hostobjects.registry

  1. public int jsGet_childCount() throws CarbonException {
  2. try {
  3. return ((Collection)this.getResource()).getChildCount();
  4. } catch (RegistryException e) {
  5. throw new CarbonException("Error occurred while creating a new Resource.", e);
  6. }
  7. }

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

  1. @Override
  2. public void setGlobalPolicyAlgorithm(String policyCombiningAlgorithm) throws EntitlementException {
  3. Registry registry = EntitlementServiceComponent.
  4. getGovernanceRegistry(CarbonContext.getThreadLocalCarbonContext().getTenantId());
  5. try {
  6. Collection policyCollection;
  7. if (registry.resourceExists(policyDataCollection)) {
  8. policyCollection = (Collection) registry.get(policyDataCollection);
  9. } else {
  10. policyCollection = registry.newCollection();
  11. }
  12. policyCollection.setMediaType(PDPConstants.REGISTRY_MEDIA_TYPE);
  13. policyCollection.setProperty("globalPolicyCombiningAlgorithm", policyCombiningAlgorithm);
  14. registry.put(policyDataCollection, policyCollection);
  15. } catch (RegistryException e) {
  16. log.error("Error while updating Global combing algorithm in policy store ", e);
  17. throw new EntitlementException("Error while updating combing algorithm in policy store");
  18. }
  19. }

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

  1. /**
  2. * Retrieve all the governance artifact paths which associated with the given lifecycle
  3. *
  4. * @param registry registry instance
  5. * @param lcName lifecycle name
  6. * @param mediaType mediatype of the artifacts
  7. * @return String array of all the artifact paths
  8. * @throws GovernanceException if the operation failed.
  9. */
  10. public static String[] getAllArtifactPathsByLifecycle(Registry registry, String lcName, String mediaType) throws GovernanceException {
  11. String sql = "SELECT R.REG_PATH_ID, R.REG_NAME FROM REG_RESOURCE R, REG_PROPERTY PP, " +
  12. "REG_RESOURCE_PROPERTY RP WHERE R.REG_VERSION=RP.REG_VERSION AND RP.REG_PROPERTY_ID=PP.REG_ID " +
  13. "AND PP.REG_NAME = ? AND PP.REG_VALUE = ? AND R.REG_MEDIA_TYPE = ?";
  14. Map<String, String> parameter = new HashMap<String, String>();
  15. parameter.put("1", "registry.LC.name");
  16. parameter.put("2", lcName);
  17. parameter.put("3", mediaType);
  18. parameter.put("query", sql);
  19. try {
  20. return (String[]) registry.executeQuery(null, parameter).getContent();
  21. } catch (RegistryException e) {
  22. String msg = "Error occured while executing custom query";
  23. throw new GovernanceException(msg, e);
  24. }
  25. }

代码示例来源:origin: org.wso2.carbon/org.wso2.carbon.bam.core

  1. public void updateDataArchivalPeriod(TimeRange timeRange) throws BAMException {
  2. try {
  3. Collection configCollection;
  4. if (registry.resourceExists(BAMRegistryResources.GLOBAL_CONFIG_PATH)) {
  5. configCollection = (Collection)registry.get(BAMRegistryResources.GLOBAL_CONFIG_PATH);
  6. } else {
  7. configCollection = registry.newCollection();
  8. }
  9. configCollection.setProperty(BAMRegistryResources.DATA_RETENTION_PROPERTY, timeRange.toString());
  10. configCollection.setProperty(BAMRegistryResources.DATA_ARCHIVAL_PROPERTY, timeRange.toString());
  11. registry.put(BAMRegistryResources.GLOBAL_CONFIG_PATH, configCollection);
  12. } catch (RegistryException e) {
  13. String msg = "Could not save the data retention policy in registry";
  14. log.error(msg, e);
  15. throw new BAMException(msg, e);
  16. }
  17. }

代码示例来源:origin: wso2/carbon-identity-framework

  1. @Override
  2. public String getGlobalPolicyAlgorithmName() {
  3. String algorithm = null;
  4. try {
  5. Registry registry = getGovernanceRegistry();
  6. if (registry.resourceExists(policyDataCollection)) {
  7. Collection collection = (Collection) registry.get(policyDataCollection);
  8. algorithm = collection.getProperty("globalPolicyCombiningAlgorithm");
  9. }
  10. } catch (RegistryException e) {
  11. if (log.isDebugEnabled()) {
  12. log.debug(e);
  13. }
  14. } catch (EntitlementException e) {
  15. log.error("Error while getting Global Policy Combining Algorithm Name.", e);
  16. }
  17. // set default
  18. if (algorithm == null) {
  19. algorithm = "deny-overrides";
  20. }
  21. return algorithm;
  22. }

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

  1. String noOfPolicies = policyCollection.getProperty(PDPConstants.MAX_POLICY_ORDER);
  2. if (noOfPolicies != null && Integer.parseInt(noOfPolicies) < policy.getPolicyOrder()) {
  3. policyCollection.setProperty(PDPConstants.MAX_POLICY_ORDER,
  4. Integer.toString(policy.getPolicyOrder()));
  5. registry.put(policyPath, policyCollection);
  6. if (policyCollection != null) {
  7. int policyOrder = 1;
  8. String noOfPolicies = policyCollection.getProperty(PDPConstants.MAX_POLICY_ORDER);
  9. if (noOfPolicies != null) {
  10. policyOrder = policyOrder + Integer.parseInt(noOfPolicies);
  11. policyCollection.setProperty(PDPConstants.MAX_POLICY_ORDER,
  12. Integer.toString(policyOrder));
  13. resource.setProperty(PDPConstants.POLICY_ORDER, Integer.toString(policyOrder));

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

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

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

  1. /**
  2. * Retrieve all the governance artifact paths which associated with the given lifecycle in the given lifecycle state
  3. *
  4. * @param registry registry instance
  5. * @param lcName lifecycle name
  6. * @param lcState lifecycle state
  7. * @param mediaType mediatype of the artifacts
  8. * @return String array of all the artifact paths
  9. * @throws GovernanceException if the operation failed.
  10. */
  11. public static String[] getAllArtifactPathsByLifecycleState(
  12. Registry registry, String lcName, String lcState, String mediaType) throws GovernanceException {
  13. String sql = "SELECT R.REG_PATH_ID, R.REG_NAME FROM REG_RESOURCE R, REG_PROPERTY PP, " +
  14. "REG_RESOURCE_PROPERTY RP WHERE R.REG_VERSION=RP.REG_VERSION AND RP.REG_PROPERTY_ID=PP.REG_ID " +
  15. "AND PP.REG_NAME = ? AND PP.REG_VALUE = ? AND R.REG_MEDIA_TYPE = ?";
  16. Map<String, String> parameter = new HashMap<String, String>();
  17. parameter.put("1", "registry.lifecycle." + lcName + ".state");
  18. parameter.put("2", lcState);
  19. parameter.put("3", mediaType);
  20. parameter.put("query", sql);
  21. try {
  22. return (String[]) registry.executeQuery(null, parameter).getContent();
  23. } catch (RegistryException e) {
  24. String msg = "Error occured while executing custom query";
  25. throw new GovernanceException(msg, e);
  26. }
  27. }

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

  1. /**
  2. * This helps to find resources un a recursive manner
  3. *
  4. * @param parentResource parent resource Name
  5. * @param childResources child resource set
  6. * @return child resource set
  7. * @throws RegistryException throws
  8. */
  9. private Set<String> getChildResources(String parentResource, Set<String> childResources)
  10. throws RegistryException {
  11. Resource resource = registry.get(parentResource);
  12. if (resource instanceof Collection) {
  13. Collection collection = (Collection) resource;
  14. String[] resources = collection.getChildren();
  15. for (String res : resources) {
  16. childResources.add(res);
  17. getChildResources(res, childResources);
  18. }
  19. }
  20. return childResources;
  21. }
  22. }

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

  1. public static String[] getLifecycleList(Registry registry) throws RegistryException{
  2. Collection collection;
  3. try {
  4. collection = (Collection)registry.get(getContextRoot());
  5. } catch (Exception e) {
  6. return null;
  7. }
  8. if (collection == null) {
  9. CollectionImpl lifeCycleCollection = new CollectionImpl();
  10. registry.put(getContextRoot(), lifeCycleCollection);
  11. return null;
  12. }
  13. else {
  14. if (collection.getChildCount() == 0) {
  15. return null;
  16. }
  17. String[] childrenList = collection.getChildren();
  18. String[] lifeCycleNameList = new String[collection.getChildCount()];
  19. for (int i = 0; i < childrenList.length; i++) {
  20. String path = childrenList[i];
  21. lifeCycleNameList[i] = path.substring(path.lastIndexOf(RegistryConstants.PATH_SEPARATOR) + 1);
  22. }
  23. return lifeCycleNameList;
  24. }
  25. }

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

  1. String displayName = regRoot.getProperty(UserMgtConstants.DISPLAY_NAME);
  2. nodeRoot = new UIPermissionNode(UserMgtConstants.UI_PERMISSION_ROOT, displayName);
  3. } else {
  4. appRoot = (Collection) tenentRegistry.get(APPLICATIONS_PATH);
  5. parent = (Collection) tenentRegistry.newCollection();
  6. parent.setProperty(UserMgtConstants.DISPLAY_NAME, "All Permissions");
  7. parent.setChildren(new String[]{regRoot.getPath(), appRoot.getPath()});
  8. displayName = parent.getProperty(UserMgtConstants.DISPLAY_NAME);
  9. } else {
  10. displayName = regRoot.getProperty(UserMgtConstants.DISPLAY_NAME);

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

  1. resource.setProperty(UserMgtConstants.DISPLAY_NAME, displayName);
  2. registry.put(resourcePath, resource);

相关文章