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


Java Collection.setProperty方法代码示例

本文整理汇总了Java中org.wso2.carbon.registry.core.Collection.setProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Collection.setProperty方法的具体用法?Java Collection.setProperty怎么用?Java Collection.setProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.wso2.carbon.registry.core.Collection的用法示例。


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

示例1: createHumanTaskPackageParentCollectionWithProperties

import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
/**
 * Create parent collection to persisting human task package information. For example, if you deploy
 * a human task archive called 'ClaimsApprovalTask.zip', we store information of that package in collection
 * named 'ClaimsApprovalTask'. This will be the root for 'ClaimsApprovalTask' human task package information and
 * there will several versions of this human task package in this registry collection which relates
 * to the versions deployed in human task engine.
 *
 * @param humanTaskDeploymentUnit containing information on current deployment
 * @throws RegistryException when there is a error accessing registry
 */
private void createHumanTaskPackageParentCollectionWithProperties(HumanTaskDeploymentUnit humanTaskDeploymentUnit)
        throws RegistryException {
    Collection humanPackage = configRegistry.newCollection();
    humanPackage.setProperty(HumanTaskConstants.HUMANTASK_PACKAGE_PROP_LATEST_CHECKSUM, humanTaskDeploymentUnit
            .getMd5sum());
    if (log.isDebugEnabled()) {
        log.debug(humanTaskDeploymentUnit.getPackageName() + " updating checksum: " + humanTaskDeploymentUnit
                .getMd5sum() + " in registry");
    }
    humanPackage.setProperty(HumanTaskConstants.HUMANTASK_PACKAGE_PROP_STATUS, String.valueOf
            (humanTaskDeploymentUnit.getTaskPackageStatus()));
    humanPackage.setProperty(HumanTaskConstants.HUMANTASK_PACKAGE_PROP_LATEST_VERSION,
                             Long.toString(humanTaskDeploymentUnit.getVersion()));
    configRegistry.put(HumanTaskPackageRepositoryUtils.getResourcePathForHumanTaskPackage
            (humanTaskDeploymentUnit), humanPackage);
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:27,代码来源:HumanTaskPackageRepository.java

示例2: testSetCollectionDetails

import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
public void testSetCollectionDetails() throws Exception {
    Collection r1 = registry.newCollection();
    r1.setDescription("C3 collection description");
    r1.setProperty("key1", "value5");
    r1.setProperty("key2", "value3");

    String path_collection = "/c1/c2/c3";

    registry.put(path_collection, r1);

    Resource r1_actual = registry.get("/c1/c2/c3");

    assertTrue(r1_actual instanceof Collection);
    assertEquals("LastUpdatedUser is not Equal", "admin", r1_actual.getLastUpdaterUserName());
    assertEquals("Can not get Resource path", path_collection, r1_actual.getPath());
    assertEquals("Can not get Resource parent path", "/c1/c2", r1_actual.getParentPath());
    assertEquals("Resource description is not equal", r1.getDescription(),
            r1_actual.getDescription());
    assertEquals("Authour is not equal", "admin", r1_actual.getAuthorUserName());
    assertEquals("Resource properties are not equal", r1.getProperty("key1"),
            r1_actual.getProperty("key1"));
    assertEquals("Resource properties are not equal", r1.getProperty("key2"),
            r1_actual.getProperty("key2"));
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:25,代码来源:TestResources.java

示例3: createBPELPackageParentCollectionWithProperties

import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
/**
     * Create parent collection to persisting BPEL package information. For example, if you deploy
     * a BPEL archive called 'HelloWorld.zip', we store information of that package in collection
     * named 'HelloWorld'. This will be the root for 'HelloWorld' BPEL package information and
     * there will several versions of this BPEL package in this registry collection which relates
     * to the versions deployed in BPEL engine.
     *
     * @param deploymentContext containing information on current deployment
     * @throws RegistryException        when there is a error accessing registry
     * @throws IOException              if file access error occurred during MD5 checksum generation
     * @throws NoSuchAlgorithmException when there is a error during MD5 generation
     */
    private void createBPELPackageParentCollectionWithProperties(
            BPELDeploymentContext deploymentContext)
            throws RegistryException, IOException, NoSuchAlgorithmException {
        Collection bpelPackage = configRegistry.newCollection();
        bpelPackage.setProperty(BPELConstants.BPEL_PACKAGE_PROP_LATEST_CHECKSUM,
                Utils.getMD5Checksum(deploymentContext.getBpelArchive()));
        if (log.isDebugEnabled()) {
            log.debug(deploymentContext.getBpelPackageName() + " updating checksum: " +
                    Utils.getMD5Checksum(deploymentContext.getBpelArchive()) + " in registry");
        }
        if (deploymentContext.isFailed()) {
            bpelPackage.setProperty(BPELConstants.BPEL_PACKAGE_PROP_STATUS,
                    BPELConstants.STATUS_FAILED);
            bpelPackage.setProperty(BPELConstants.BPEL_PACKAGE_PROP_DEPLOYMENT_ERROR_LOG,
                    deploymentContext.getDeploymentFailureCause());
//            bpelPackage.setProperty(BPELConstants.BPEL_PACKAGE_PROP_DEPLOYMENT_STACK_TRACE,
//                    ExceptionUtils.getStackTrace(deploymentContext.getStackTrace()));
        } else {
            bpelPackage.setProperty(BPELConstants.BPEL_PACKAGE_PROP_STATUS,
                    BPELConstants.STATUS_DEPLOYED);
        }
        bpelPackage.setProperty(BPELConstants.BPEL_PACKAGE_PROP_LATEST_VERSION,
                Long.toString(deploymentContext.getVersion()));

        configRegistry.put(
                BPELPackageRepositoryUtils.getResourcePathForBPELPackage(deploymentContext),
                bpelPackage);
    }
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:41,代码来源:BPELPackageRepository.java

示例4: testAddSpacesinCollName

import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
public void testAddSpacesinCollName() throws Exception {

        Collection c1 = registry.newCollection();
        c1.setDescription("this is a collection name with spaces");
        c1.setProperty("key1", "value5");
        c1.setProperty("key2", "value3");
        String path = "/col1/col2/col30 space45";

        String actualPath = null;
        try {
            actualPath = registry.put(path, c1);
        } catch (Exception e) {
            fail("Couldn't put collection /col1/col2/col3 space");
        }

//        Resource r1_actual = null;
//        try {
//            r1_actual = registry.get(path);
//        } catch (Exception e) {
//            fail("Couldn't get collecion of path " + path);
//        }
//        assertEquals("LastUpdatedUser is not Equal", "admin", r1_actual.getLastUpdaterUserName());
//        assertEquals("Can not get Resource path", actualPath, r1_actual.getPath());
//        assertEquals("Can not get Resource parent path", "/col1/col2", r1_actual.getParentPath());
//        assertEquals("Resource description is not equal", c1.getDescription(),
//                     r1_actual.getDescription());
//        assertEquals("Authour is not equal", "admin", r1_actual.getAuthorUserName());
//        assertEquals("Resource properties are equal", c1.getProperty("key1"),
//                     r1_actual.getProperty("key1"));
//        assertEquals("Resource properties are equal", c1.getProperty("key2"),
//                     r1_actual.getProperty("key2"));
    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:33,代码来源:TestResources.java

示例5: deleteQueue

import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
/**
 * Delete the entry for a queue from the Registry
 *
 * @param queueName Name of the queue to be deleted
 * @throws RegistryClientException
 */
public static void deleteQueue(String queueName)
        throws RegistryClientException {
    try {
        RegistryService registryService = CommonsDataHolder.getInstance().getRegistryService();
        if (registryService != null) {
            UserRegistry registry = registryService.getGovernanceSystemRegistry();

            // Delete queue
            String queueID = CommonsUtil.getQueueID(queueName);

            if (registry.resourceExists(queueID)) {
                String createdFrom = registry.get(queueID).getProperty(CREATED_FROM);

                if ((null != createdFrom) && (CREATED_FROM_AMQP.equals(createdFrom))) {
                    Collection queue = (Collection) registry.get(queueID);

                    String userCount = queue.getProperty(USER_COUNT);
                    if (null != userCount) {
                        int count = Integer.parseInt(userCount);

                        if (count > 1) {
                            queue.setProperty(USER_COUNT, Integer.toString(--count));
                            registry.put(queueID, queue);
                        } else {
                            registry.delete(queueID);
                        }
                    }
                }
            }
        }

    } catch (RegistryException e) {
        throw new RegistryClientException(e);
    }
}
 
开发者ID:wso2,项目名称:carbon-business-messaging,代码行数:42,代码来源:RegistryClient.java

示例6: addUIPermissionFromBundle

import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
public void addUIPermissionFromBundle(Bundle bundle) throws Exception {
    BundleContext bundleContext = bundle.getBundleContext();
    if (bundleContext == null) { // If the bundle got uninstalled, the bundleContext will be null
        return;
    }

    URL url = bundleContext.getBundle().getEntry("META-INF/component.xml");
    if (url == null) {
        return;
    }

    InputStream xmlStream = url.openStream();
    if (xmlStream == null) {
        return;
    }

    if (log.isDebugEnabled()) {
        log.debug("Adding permissions in bundle" + 
                bundle.getSymbolicName());
    }

    Component component = ComponentConfigFactory.build(xmlStream);
    ManagementPermission[] uiPermissions = null;
    if (component != null) {
        uiPermissions = (ManagementPermission[]) component
                .getComponentConfig(ManagementPermissionsBuilder.LOCALNAME_MGT_PERMISSIONS);
    }

    if (uiPermissions != null) {
        // at the starup we are only adding permission only to tenant 0
        Registry registry = UserMgtDSComponent.getRegistryService().getGovernanceSystemRegistry();
        for (ManagementPermission uiPermission : uiPermissions) {
            if (registry.resourceExists(uiPermission.getResourceId())) {
                Resource existingResource = registry.get(uiPermission.getResourceId());
                if (existingResource.getProperty(UserMgtConstants.DISPLAY_NAME) == null) {
                    existingResource.setProperty(UserMgtConstants.DISPLAY_NAME, uiPermission.getDisplayName());
                    registry.put(uiPermission.getResourceId(), existingResource);
                }
                continue;
            }
            Collection resource = registry.newCollection();
            resource.setProperty(UserMgtConstants.DISPLAY_NAME, uiPermission.getDisplayName());
            registry.put(uiPermission.getResourceId(), resource);
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:47,代码来源:ManagementPermissionsAdder.java

示例7: addUIPermissionFromBundle

import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
public void addUIPermissionFromBundle(Bundle bundle) throws Exception {
    BundleContext bundleContext = bundle.getBundleContext();
    if (bundleContext == null) { // If the bundle got uninstalled, the bundleContext will be null
        return;
    }

    URL url = bundleContext.getBundle().getEntry("META-INF/component.xml");
    if (url == null) {
        return;
    }

    InputStream xmlStream = url.openStream();
    if (xmlStream == null) {
        return;
    }

    if (log.isDebugEnabled()) {
        log.debug("Adding permissions in bundle" + 
                bundle.getSymbolicName());
    }

    Component component = ComponentConfigFactory.build(xmlStream);
    ManagementPermission[] uiPermissions = null;
    if (component != null) {
        uiPermissions = (ManagementPermission[]) component
                .getComponentConfig(ManagementPermissionsBuilder.LOCALNAME_MGT_PERMISSIONS);
    }

    if (uiPermissions != null) {
        // at the starup we are only adding permission only to tenant 0
        Registry registry = UserMgtDSComponent.getRegistryService().getGovernanceSystemRegistry();
        for (ManagementPermission uiPermission : uiPermissions) {
            if (registry.resourceExists(uiPermission.getResourceId())) {
                continue;
            }
            Collection resource = registry.newCollection();
            resource.setProperty(UserMgtConstants.DISPLAY_NAME, uiPermission.getDisplayName());
            registry.put(uiPermission.getResourceId(), resource);
        }
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:42,代码来源:ManagementPermissionsAdder.java

示例8: setCloudServiceActive

import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
public static void setCloudServiceActive(boolean active,
                                         String cloudServiceName,
                                         int tenantId, CloudServiceConfig cloudServiceConfig)
                                                                                             throws Exception {
    if (cloudServiceConfig.getLabel() == null) {
        // for the non-labled services, we are not setting/unsetting the
        // service active
        return;
    }

    UserRegistry govRegistry =
            CloudCommonServiceComponent.getGovernanceSystemRegistry(
                    MultitenantConstants.SUPER_TENANT_ID);
    UserRegistry configRegistry = CloudCommonServiceComponent.getConfigSystemRegistry(tenantId);
    String cloudServiceInfoPath = StratosConstants.CLOUD_SERVICE_INFO_STORE_PATH +
                                  RegistryConstants.PATH_SEPARATOR + tenantId +
                                  RegistryConstants.PATH_SEPARATOR + cloudServiceName;
    
    Resource cloudServiceInfoResource;
    if (govRegistry.resourceExists(cloudServiceInfoPath)) {
        cloudServiceInfoResource = govRegistry.get(cloudServiceInfoPath);
    } else {
        cloudServiceInfoResource = govRegistry.newCollection();
    }
    cloudServiceInfoResource.setProperty(StratosConstants.CLOUD_SERVICE_IS_ACTIVE_PROP_KEY,
                                         active ? "true" : "false");
    govRegistry.put(cloudServiceInfoPath, cloudServiceInfoResource);

    // then we will copy the permissions
    List<PermissionConfig> permissionConfigs = cloudServiceConfig.getPermissionConfigs();
    for (PermissionConfig permissionConfig : permissionConfigs) {
        String path = permissionConfig.getPath();
        String name = permissionConfig.getName();
        if (active) {
            if (!configRegistry.resourceExists(path)) {
                Collection collection = configRegistry.newCollection();
                collection.setProperty(StratosConstants.DISPLAY_NAME, name);
                configRegistry.put(path, collection);
            }
        } else {
            if (configRegistry.resourceExists(path)) {
                configRegistry.delete(path);
            }
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-commons,代码行数:47,代码来源:CloudServicesUtil.java

示例9: setCloudServiceActive

import org.wso2.carbon.registry.core.Collection; //导入方法依赖的package包/类
public static void setCloudServiceActive(boolean active,
                                         String cloudServiceName,
                                         int tenantId, CloudServiceConfig cloudServiceConfig)
        throws Exception {
    if (cloudServiceConfig.getLabel() == null) {
        // for the non-labled services, we are not setting/unsetting the
        // service active
        return;
    }

    UserRegistry govRegistry =
            ServiceReferenceHolder.getInstance().getRegistryService().getGovernanceSystemRegistry(
                    MultitenantConstants.SUPER_TENANT_ID);
    UserRegistry configRegistry = ServiceReferenceHolder.getInstance().getRegistryService().getConfigSystemRegistry(tenantId);
    String cloudServiceInfoPath = StratosConstants.CLOUD_SERVICE_INFO_STORE_PATH +
            RegistryConstants.PATH_SEPARATOR + tenantId +
            RegistryConstants.PATH_SEPARATOR + cloudServiceName;

    Resource cloudServiceInfoResource;
    if (govRegistry.resourceExists(cloudServiceInfoPath)) {
        cloudServiceInfoResource = govRegistry.get(cloudServiceInfoPath);
    } else {
        cloudServiceInfoResource = govRegistry.newCollection();
    }
    cloudServiceInfoResource.setProperty(StratosConstants.CLOUD_SERVICE_IS_ACTIVE_PROP_KEY,
            active ? "true" : "false");
    govRegistry.put(cloudServiceInfoPath, cloudServiceInfoResource);

    // then we will copy the permissions
    List<PermissionConfig> permissionConfigs = cloudServiceConfig.getPermissionConfigs();
    for (PermissionConfig permissionConfig : permissionConfigs) {
        String path = permissionConfig.getPath();
        String name = permissionConfig.getName();
        if (active) {
            if (!configRegistry.resourceExists(path)) {
                Collection collection = configRegistry.newCollection();
                collection.setProperty(UserMgtConstants.DISPLAY_NAME, name);
                configRegistry.put(path, collection);
            }
        } else {
            if (configRegistry.resourceExists(path)) {
                configRegistry.delete(path);
            }
        }
    }
}
 
开发者ID:apache,项目名称:stratos,代码行数:47,代码来源:CloudServicesUtil.java


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