本文整理汇总了Java中org.wso2.carbon.registry.core.Resource.removeProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.removeProperty方法的具体用法?Java Resource.removeProperty怎么用?Java Resource.removeProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.carbon.registry.core.Resource
的用法示例。
在下文中一共展示了Resource.removeProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeTrustedService
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
* Remove trusted service
*
* @param groupName Group name
* @param serviceName Service name
* @param trustedService Trusted service name
* @throws org.wso2.carbon.registry.api.RegistryException
*/
private void removeTrustedService(String groupName, String serviceName,
String trustedService) throws RegistryException {
String resourcePath = RegistryResources.SERVICE_GROUPS + groupName +
RegistryResources.SERVICES + serviceName + "/trustedServices";
Registry registry = getConfigSystemRegistry();
if (registry != null) {
if (registry.resourceExists(resourcePath)) {
Resource resource = registry.get(resourcePath);
if (resource.getProperty(trustedService) != null) {
resource.removeProperty(trustedService);
}
registry.put(resourcePath, resource);
}
}
}
示例2: removeTrustedService
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
private void removeTrustedService(String groupName, String serviceName, String trustedService)
throws SecurityConfigException {
Registry registry;
String resourcePath;
Resource resource;
try {
resourcePath = RegistryResources.SERVICE_GROUPS + groupName
+ RegistryResources.SERVICES + serviceName + "/trustedServices";
registry = getConfigSystemRegistry(); //TODO: Multitenancy
if (registry != null && registry.resourceExists(resourcePath)) {
resource = registry.get(resourcePath);
if (resource.getProperty(trustedService) != null) {
resource.removeProperty(trustedService);
}
registry.put(resourcePath, resource);
}
} catch (Exception e) {
log.error("Error occured while removing trusted service for STS", e);
throw new SecurityConfigException("Error occured while adding trusted service for STS",
e);
}
}
示例3: removeParameter
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
* @param parameterDO
* @throws IdentityException
*/
public void removeParameter(ParameterDO parameterDO) throws IdentityException {
String path = null;
Resource resource = null;
if (log.isDebugEnabled()) {
log.debug("Removing parameter");
}
try {
path = IdentityRegistryResources.CARD_ISSUER;
if (registry.resourceExists(path)) {
resource = registry.get(path);
if (resource != null) {
resource.removeProperty(parameterDO.getName());
registry.put(path, resource);
}
}
} catch (RegistryException e) {
log.error("Error while removing parameter", e);
throw IdentityException.error("Error while removing parameter", e);
}
}
示例4: testRemovingProperties
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void testRemovingProperties() throws Exception {
Resource r1 = registry.newResource();
r1.setContent("r1 content");
r1.setProperty("p1", "v1");
r1.setProperty("p2", "v2");
registry.put("/props/t1/r1", r1);
Resource r1e1 = registry.get("/props/t1/r1");
r1e1.setContent("r1 content");
r1e1.removeProperty("p1");
registry.put("/props/t1/r1", r1e1);
Resource r1e2 = registry.get("/props/t1/r1");
assertEquals("Property is not removed.", r1e2.getProperty("p1"), null);
assertNotNull("Wrong property is removed.", r1e2.getProperty("p2"));
}
示例5: removeProperty
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void removeProperty(String path, String key) {
try {
PrivilegedCarbonContext.startTenantFlow();
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(MultitenantConstants.SUPER_TENANT_ID);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
Resource resource = registry.get(path);
resource.removeProperty(key);
registry.put(path, resource);
} catch (RegistryException e) {
String msg = "Unable to remove property.";
log.error(msg, e);
// we are unable to throw a customized exception or an exception with the cause or if
// not, JConsole needs additional Jars to marshall exceptions.
throw new RuntimeException(Utils.buildMessageForRuntimeException(e, msg));
} finally {
PrivilegedCarbonContext.endTenantFlow();
}
}
示例6: remove
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void remove() throws VersionException, LockException, ConstraintViolationException, AccessDeniedException, RepositoryException {
RegistryJCRItemOperationUtil.validateReadOnlyItemOpr(session);
RegistryJCRItemOperationUtil.checkRetentionPolicy(session, getNodePath());
RegistryJCRItemOperationUtil.checkRetentionHold(session, getNodePath());
try {
if (isResource) {
session.getUserRegistry().delete(path);
} else {
Resource node = session.getUserRegistry().get(path);
node.removeProperty(name);
session.getUserRegistry().put(path, node);
}
} catch (RegistryException e) {
String msg = "failed to remove the property " + this;
log.debug(msg);
throw new RepositoryException(msg, e);
}
}
示例7: deletePersonData
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
* Deletes data for the specified user and group
*
* @param userId The userId of the person whose app data to be removed
* @param groupId The group
* @param appId The app
* @param fields The fields to delete. Empty implies all
* @throws SocialDataException
*/
public void deletePersonData(String userId, String groupId, String appId, Set<String> fields)
throws SocialDataException {
try {
registry = getRegistry();
Resource appDataResource;
String appDataResourcePath = SocialImplConstants.APP_DATA_REGISTRY_ROOT +
SocialImplConstants.SEPARATOR + appId +
SocialImplConstants.SEPARATOR + userId;
if (registry.resourceExists(appDataResourcePath)) {
appDataResource = registry.get(appDataResourcePath);
for (String key : fields) {
appDataResource.removeProperty(key);
}
registry.put(appDataResourcePath, appDataResource);
}
} catch (RegistryException e) {
log.error(e.getMessage(), e);
throw new SocialDataException(
"Error while deleting app data with id " + appId + " for user " + userId, e);
}
}
示例8: persistTrustedService
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
private void persistTrustedService(String groupName, String serviceName, String trustedService,
String certAlias) throws SecurityConfigException {
Registry registry;
String resourcePath;
Resource resource;
try {
resourcePath = RegistryResources.SERVICE_GROUPS + groupName
+ RegistryResources.SERVICES + serviceName + "/trustedServices";
registry = getConfigSystemRegistry(); //TODO: Multitenancy
if (registry != null) {
if (registry.resourceExists(resourcePath)) {
resource = registry.get(resourcePath);
} else {
resource = registry.newResource();
}
if (resource.getProperty(trustedService) != null) {
resource.removeProperty(trustedService);
}
resource.addProperty(trustedService, certAlias);
registry.put(resourcePath, resource);
}
} catch (Exception e) {
log.error("Error occured while adding trusted service for STS", e);
throw new SecurityConfigException("Error occured while adding trusted service for STS",
e);
}
}
示例9: createOrUpdate
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
* Create or update the OpenID admin.
*
* @param opAdmin openID admin
* @throws IdentityException if error occurs while creating or updating the OpenID admin
*/
public void createOrUpdate(OpenIDAdminDO opAdmin) throws IdentityException {
String path = null;
Resource resource = null;
try {
path = IdentityRegistryResources.OPEN_ID_ADMIN_SETTINGS;
if (!registry.resourceExists(path)) {
if (log.isDebugEnabled()) {
log.debug("Creating new openid admin");
}
resource = registry.newResource();
} else {
if (log.isDebugEnabled()) {
log.debug("Updating openid admin");
}
resource = registry.get(path);
resource.removeProperty(IdentityRegistryResources.SUB_DOMAIN);
resource.removeProperty(IdentityRegistryResources.OPENID_PATTERN);
}
resource.addProperty(IdentityRegistryResources.SUB_DOMAIN, opAdmin.getSubDomain());
resource.addProperty(IdentityRegistryResources.OPENID_PATTERN, opAdmin
.getTenantOpenIDPattern());
registry.put(path, resource);
} catch (RegistryException e) {
log.error("Error while creating/updating openid admin", e);
throw IdentityException.error("Error while creating/updating openid admin", e);
}
}
示例10: createOrUpdateParameter
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
* @param parameterDO
* @throws IdentityException
*/
public void createOrUpdateParameter(ParameterDO parameterDO) throws IdentityException {
String path = null;
Resource resource = null;
if (log.isDebugEnabled()) {
log.debug("Creating or updating parameter");
}
try {
path = IdentityRegistryResources.CARD_ISSUER;
if (registry.resourceExists(path)) {
resource = registry.get(path);
} else {
resource = registry.newResource();
}
if (resource.getProperty(parameterDO.getName()) != null) {
resource.removeProperty(parameterDO.getName());
}
resource.addProperty(parameterDO.getName(), parameterDO.getValue());
registry.put(path, resource);
} catch (RegistryException e) {
log.error("Error while creating or updating parameter", e);
throw IdentityException.error("Error while creating or updating parameter", e);
}
}
示例11: updateCheckpointProperties
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
/**
* This method is used to update checkpoint current state duration information.
*
* @param resource registry resource.
* @param nextState next lifecycle state.
* @throws RegistryException
*/
private void updateCheckpointProperties(Resource resource, String nextState)
throws RegistryException {
String checkpointProperty = LifecycleConstants.REGISTRY_LIFECYCLE + aspectName + LifecycleConstants.CHECKPOINT;
List<String> checkpoints = resource.getPropertyValues(checkpointProperty);
if (checkpoints != null && !checkpoints.isEmpty()) {
for (String checkpoint : checkpoints) {
resource.removeProperty(checkpointProperty + LifecycleConstants.DOT + checkpoint);
}
}
resource.removeProperty(checkpointProperty);
addCheckPointProperties(resource, nextState);
}
示例12: clearTransitionApprovals
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public static void clearTransitionApprovals(Resource resource, String aspectName) {
Properties properties = (Properties) resource.getProperties().clone();
for (Object o : properties.keySet()) {
String key = (String) o;
if (key.startsWith(LifecycleConstants.REGISTRY_CUSTOM_LIFECYCLE_VOTES_OPTION + aspectName)) {
resource.removeProperty(key);
} else if (key.startsWith(LifecycleConstants.REGISTRY_CUSTOM_LIFECYCLE_USER_VOTE + aspectName)) {
resource.removeProperty(key);
}
}
}
示例13: unSubscribe
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的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);
}
}
示例14: dissociate
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void dissociate(RequestContext context) {
Resource resource = context.getResource();
if (resource != null) {
resource.removeProperty(stateProperty);
resource.removeProperty(lifecyleProperty);
}
}
示例15: dissociate
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void dissociate(RequestContext context) {
Resource resource = context.getResource();
if (resource != null) {
resource.removeProperty(stateProperty);
resource.removeProperty(lifecycleProperty);
}
}