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


Java UserRegistry.put方法代码示例

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


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

示例1: getTopicTree

import org.wso2.carbon.registry.core.session.UserRegistry; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public TopicNode getTopicTree() throws EventBrokerException {
    try {
        UserRegistry userRegistry =
                this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance().getTenantId());
        if (!userRegistry.resourceExists(topicStoragePath)) {
            userRegistry.put(topicStoragePath, userRegistry.newCollection());
        }
        Resource root = userRegistry.get(this.topicStoragePath);
        TopicNode rootTopic = new TopicNode("/", "/");
        buildTopicTree(rootTopic, (Collection) root, userRegistry);
        return rootTopic;
    } catch (RegistryException e) {
        throw new EventBrokerException(e.getMessage(), e);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:20,代码来源:RegistryTopicManager.java

示例2: getPaginatedTopicTree

import org.wso2.carbon.registry.core.session.UserRegistry; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public TopicNode getPaginatedTopicTree(String topicPath, int startIndex, int numberOfTopicsPerRound) throws
        EventBrokerException {
    try {
        UserRegistry userRegistry =
                this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance().getTenantId());
        if (!userRegistry.resourceExists(topicPath)) {
            userRegistry.put(topicPath, userRegistry.newCollection());
        }
        Collection collection = (Collection) userRegistry.get(topicPath);
        String[] paths = collection.getChildren(startIndex, numberOfTopicsPerRound);
        TopicNode rootTopic = new TopicNode("/", "/");
        buildTopicTree(rootTopic, paths);
        return rootTopic;
    } catch (RegistryException e) {
        throw new EventBrokerException(e.getMessage(), e);
    }
}
 
开发者ID:wso2,项目名称:carbon-business-messaging,代码行数:22,代码来源:TopicManagerServiceImpl.java

示例3: addLogEntryForResourceUpdate

import org.wso2.carbon.registry.core.session.UserRegistry; //导入方法依赖的package包/类
/**
 * Method to add new log entry for the resource update.
 * @param userRegistry user registry to add logs
 * @param resourcePath updated resource path
 * @param action log action
 * @param actionData additional details about the action
 * @throws RegistryException
 */
private static void addLogEntryForResourceUpdate(UserRegistry userRegistry, String resourcePath, int action, String actionData) throws RegistryException {
    try {
        CurrentSession.setTenantId(userRegistry.getTenantId());
        CurrentSession.setUser(userRegistry.getUserName());
        if (userRegistry.getRegistryContext() != null) {
            userRegistry.getRegistryContext().getLogWriter().addLog(resourcePath, userRegistry.getUserName(), action, actionData);
        } else {
            Resource resource = userRegistry.get(resourcePath);
            userRegistry.put(resourcePath, resource);
        }
        if (log.isDebugEnabled()) {
            log.debug("add new role authorization of the resource: " + resourcePath);
        }
    } finally {
        CurrentSession.removeTenantId();
        CurrentSession.removeUser();
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:27,代码来源:AddRolePermissionUtil.java

示例4: addLogEntryForResourceUpdate

import org.wso2.carbon.registry.core.session.UserRegistry; //导入方法依赖的package包/类
/**
 * Method to add new log entry for the resource update.
 * @param userRegistry user registry to add logs
 * @param resourcePath updated resource path
 * @param action log action
 * @param actionData additional details about the action
 * @throws RegistryException
 */
private static void addLogEntryForResourceUpdate(UserRegistry userRegistry, String resourcePath, int action, String actionData) throws RegistryException {
    try {
        CurrentSession.setTenantId(userRegistry.getTenantId());
        CurrentSession.setUser(userRegistry.getUserName());
        if (userRegistry.getRegistryContext() != null) {
            userRegistry.getRegistryContext().getLogWriter().addLog(resourcePath, userRegistry.getUserName(), action, actionData);
        } else {
            Resource resource = userRegistry.get(resourcePath);
            userRegistry.put(resourcePath, resource);
        }
        if (log.isDebugEnabled()) {
            log.debug("update role authorizations of the resource: " + resourcePath);
        }
    } finally {
        CurrentSession.removeTenantId();
        CurrentSession.removeUser();
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:27,代码来源:ChangeRolePermissionsUtil.java

示例5: getTopicTree

import org.wso2.carbon.registry.core.session.UserRegistry; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public TopicNode getTopicTree() throws EventBrokerException {
    try {
        UserRegistry userRegistry =
                this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance().getTenantId());
        if (!userRegistry.resourceExists(topicStoragePath)) {
            userRegistry.put(topicStoragePath, userRegistry.newCollection());
        }
        Resource root = userRegistry.get(this.topicStoragePath);
        TopicNode rootTopic = new TopicNode("/", "/");
        buildTopicTree(rootTopic, ((Collection) root).getChildren());
        return rootTopic;
    } catch (RegistryException e) {
        throw new EventBrokerException(e.getMessage(), e);
    }
}
 
开发者ID:wso2,项目名称:carbon-business-messaging,代码行数:20,代码来源:TopicManagerServiceImpl.java

示例6: write

import org.wso2.carbon.registry.core.session.UserRegistry; //导入方法依赖的package包/类
@Override
public void write(int tenantId, Properties props, String resourcePath)
        throws IdentityMgtConfigException {

    if(log.isDebugEnabled()) {
        log.debug("Writing data to registry path : " + resourcePath);
    }
    
    RegistryService registry = IdentityMgtServiceComponent.getRegistryService();
    try {
        UserRegistry userReg = registry.getConfigSystemRegistry(tenantId);
        Resource resource = userReg.newResource();
        Set<String> names = props.stringPropertyNames();
        // Only key value pairs exists and no multiple values exists a key.
        for (String keyName : names) {
            List<String> value = new ArrayList<String>();
            String valueStr = props.getProperty(keyName);
            
            if(log.isDebugEnabled()) {
                log.debug("Write key : " + keyName + " value : " + value);
            }
            
            // This is done due to casting to List in JDBCRegistryDao
            value.add(valueStr);
            resource.setProperty(keyName, value);
        }
        userReg.put(resourcePath, resource);

    } catch (RegistryException e) {
        throw new IdentityMgtConfigException(
                "Error occurred while writing data to registry path : " + resourcePath, e);
    }

}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:35,代码来源:RegistryConfigWriter.java

示例7: defineQueries

import org.wso2.carbon.registry.core.session.UserRegistry; //导入方法依赖的package包/类
private void defineQueries(String queryPath, String queryContent) throws RegistryException {
    UserRegistry registry =
            (UserRegistry) Utils.getRegistry();

    Resource q1 = registry.newResource();
    q1.setContent(queryContent);
    q1.setMediaType(RegistryConstants.SQL_QUERY_MEDIA_TYPE);
    q1.addProperty(RegistryConstants.RESULT_TYPE_PROPERTY_NAME,
            RegistryConstants.RESOURCES_RESULT_TYPE);
    registry.put(queryPath, q1);

}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:13,代码来源:AdvancedResourceQuery.java

示例8: init

import org.wso2.carbon.registry.core.session.UserRegistry; //导入方法依赖的package包/类
public void init(int tenantId) throws DeploymentSynchronizerException {

        try {
            UserRegistry configRegistry = getConfigurationRegistry(tenantId);
            String tenantRegistryPath = getRegistryPath(tenantId);

            this.registry = configRegistry;
            this.registryPath = tenantRegistryPath;
            this.basePath = RegistryConstants.CONFIG_REGISTRY_BASE_PATH;

            if (!configRegistry.resourceExists(tenantRegistryPath)) {
                Collection collection = configRegistry.newCollection();
                configRegistry.put(tenantRegistryPath, collection);
                collection.discard();
            }

        } catch (RegistryException e) {
            throw new DeploymentSynchronizerException("Error while accessing registry for " +
                    "tenant: " + tenantId, e);
        }

//        try {
//            if (!registry.resourceExists(registryPath)) {
//                Collection collection = registry.newCollection();
//                registry.put(registryPath, collection);
//                collection.discard();
//            }
//        } catch (RegistryException e) {
//            handleException("Error while creating the registry collection at: " + registryPath, e);
//        }
    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:32,代码来源:RegistryBasedArtifactRepository.java

示例9: defineQueries

import org.wso2.carbon.registry.core.session.UserRegistry; //导入方法依赖的package包/类
private void defineQueries(Registry configSystemRegistry, String queryPath,
		String queryContent) throws RegistryException {
	UserRegistry registry = (UserRegistry) configSystemRegistry;

	Resource q1 = registry.newResource();
	q1.setContent(queryContent);
	q1.setMediaType(RegistryConstants.SQL_QUERY_MEDIA_TYPE);
	q1.addProperty(RegistryConstants.RESULT_TYPE_PROPERTY_NAME,
			RegistryConstants.RESOURCES_RESULT_TYPE);
	registry.put(queryPath, q1);

}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:13,代码来源:AdvancedResourceQuery.java

示例10: deleteQueue

import org.wso2.carbon.registry.core.session.UserRegistry; //导入方法依赖的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

示例11: unSubscribe

import org.wso2.carbon.registry.core.session.UserRegistry; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void unSubscribe(String subscriptionID) throws EventBrokerException {
    try {
        UserRegistry userRegistry =
                this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance()
                                                                         .getTenantId());
        String fullPath = this.indexStoragePath;
        if (userRegistry.resourceExists(fullPath)) {
            Resource topicIndexResource = userRegistry.get(fullPath);

            String topicName = topicIndexResource.getProperty(subscriptionID);
            // delete the subscriptions resource
            // if the registry is read only there can be situations where the the subscriptions
            // is not saved to registry and hence the topic name
            if (topicName != null) {
                String resourcePath =  getResourcePath(subscriptionID, topicName);
                if (userRegistry.resourceExists(resourcePath)) {
                    userRegistry.delete(resourcePath);
                }
                String jMSResourcePath =  getJMSSubResourcePath(subscriptionID, topicName);
                if (userRegistry.resourceExists(jMSResourcePath)) {
                    userRegistry.delete(jMSResourcePath);
                }
            }

            topicIndexResource.removeProperty(subscriptionID);

            userRegistry.put(fullPath, topicIndexResource);
        }

    } catch (RegistryException e) {
        throw new EventBrokerException("Cannot access the registry ", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-business-messaging,代码行数:38,代码来源:RegistrySubscriptionManager.java

示例12: updateMediaType

import org.wso2.carbon.registry.core.session.UserRegistry; //导入方法依赖的package包/类
public static void updateMediaType(UserRegistry userRegistry, String path, String mediaType)
        throws RegistryException {

    try {
        Resource currentResource = userRegistry.get(path);
        currentResource.setMediaType(mediaType);
        userRegistry.put(path, currentResource);
    } catch (RegistryException e) {
        throw new RegistryException("Failed to update media type of the  resource : "+path);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:12,代码来源:MediaTypeUtil.java

示例13: RegistrySubscriptionManager

import org.wso2.carbon.registry.core.session.UserRegistry; //导入方法依赖的package包/类
/**
 * Adds topic storage path and index storage path to user registry.
 *
 * @param topicStoragePath topic storage path. the path where topics will be stored.
 * @param indexStoragePath index storage path.
 * @throws EventBrokerConfigurationException
 */
public RegistrySubscriptionManager(String topicStoragePath, String indexStoragePath)
        throws EventBrokerConfigurationException {

    this.registryService = EventBrokerHolder.getInstance().getRegistryService();
    this.topicStoragePath = topicStoragePath;
    this.indexStoragePath = indexStoragePath;

    // creates the the subscription index
    // when creating subscriptions we going to add entries to this this resource
    try {
        UserRegistry userRegistry =
                this.registryService.getGovernanceSystemRegistry(EventBrokerHolder.getInstance()
                                                                         .getTenantId());

        //create the topic storage path if it does not exists
        if (!userRegistry.resourceExists(this.topicStoragePath)) {
            userRegistry.put(this.topicStoragePath, userRegistry.newCollection());
        }

        // we need to create the index here only it is not exists.
        if (!userRegistry.resourceExists(this.indexStoragePath)) {
            userRegistry.put(this.indexStoragePath, userRegistry.newResource());
        }

    } catch (RegistryException e) {
        throw new EventBrokerConfigurationException("Cannot access the registry ", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-business-messaging,代码行数:36,代码来源:RegistrySubscriptionManager.java

示例14: doEncrypt

import org.wso2.carbon.registry.core.session.UserRegistry; //导入方法依赖的package包/类
public void doEncrypt(String plainTextValue, String alias) {
    try {
        createRegistryResource();
        UserRegistry registry = SecurityServiceHolder.getInstance().getRegistryService().getConfigSystemRegistry();
        Resource registryResource = registry.get(SecureVaultConstants.ENCRYPTED_PROPERTY_STORAGE_PATH);
        String encryptedValue = SecureVaultUtil.encryptValue(plainTextValue);
        registryResource.addProperty(alias, encryptedValue);
        registry.put(SecureVaultConstants.ENCRYPTED_PROPERTY_STORAGE_PATH, registryResource);
    } catch (RegistryException | AxisFault e) {
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:12,代码来源:RegistrySecretRepository.java

示例15: removeProperty

import org.wso2.carbon.registry.core.session.UserRegistry; //导入方法依赖的package包/类
/**
 * Method to remove property.
 *
 * @param path path of the resource.
 * @param name property name.
 *
 * @throws RegistryException throws if there is an error.
 */
public void removeProperty(String path, String name) throws RegistryException {
    UserRegistry registry = (UserRegistry) getRootRegistry();
    if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
        return;
    }
    Resource resource = registry.get(path);
    resource.removeProperty(name);
    registry.put(resource.getPath(), resource);
    resource.discard();
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:19,代码来源:PropertiesAdminService.java


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