本文整理汇总了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);
}
}
示例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);
}
}
示例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();
}
}
示例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();
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
// }
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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) {
}
}
示例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();
}