本文整理了Java中org.wso2.carbon.registry.core.Resource.setProperty
方法的一些代码示例,展示了Resource.setProperty
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.setProperty
方法的具体详情如下:
包路径:org.wso2.carbon.registry.core.Resource
类名称:Resource
方法名:setProperty
暂无
代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions
private void addSubscriptionAvailableProperty(Resource newResource) throws RegistryException {
newResource.setProperty(GovernanceConstants.REGISTRY_IS_ENVIRONMENT_CHANGE, "true");
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions
public void associate(Resource resource, Registry registry) throws RegistryException {
// We start off in the CREATED phase
resource.setProperty(PHASE_PROPERTY, PHASE_CREATED);
}
代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions
private void addSubscriptionAvailableProperty(Resource newResource) throws RegistryException {
newResource.setProperty(GovernanceConstants.REGISTRY_IS_ENVIRONMENT_CHANGE, "true");
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions
public void associate(Resource resource, Registry registry) throws RegistryException {
resource.setProperty(stateProperty, states.get(0));
resource.setProperty(lifecyleProperty, aspectName);
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions
private void copyAllParameters(String wsdlPath, Resource wsdlResource) throws RegistryException {
if(registry.resourceExists(wsdlPath)){
// we are copying all the properties, rather than using the exisint pointer
Resource oldWsdlResource = registry.get(wsdlPath);
Properties properties = oldWsdlResource.getProperties();
for (Map.Entry<Object, Object> e : properties.entrySet()) {
if (e.getValue() instanceof String) {
wsdlResource.setProperty((String) e.getKey(), (String) e.getValue());
} else {
wsdlResource.setProperty((String) e.getKey(),
(List<String>) e.getValue());
}
}
}}
@SuppressWarnings("unchecked")
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.indexing
private void writeLastAccessTime() {
try {
if (lastAccessTime.size() > 0) {
Resource resource = registry.newResource();
for (Map.Entry<Integer, Date> e : lastAccessTime.entrySet()) {
resource.setProperty(String.valueOf(e.getKey()), String.valueOf(e.getValue().getTime()));
}
registry.put(getLastAccessTimeLocation(), resource);
}
} catch (RegistryException e) {
log.error("Could not write last activity time when stopping indexing", e);
}
}
代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.mashup.javascript.hostobjects.registry
public static void jsFunction_setProperty(Context cx, Scriptable thisObj, Object[] arguments,
Function funObj) throws CarbonException {
ResourceHostObject resourceHostObject = (ResourceHostObject) thisObj;
if (arguments.length == 2) {
if (arguments[0] instanceof String && arguments[1] instanceof String) {
resourceHostObject.resource.setProperty((String) arguments[0], (String) arguments[1]);
} else if (arguments[0] instanceof String && arguments[1] instanceof NativeArray) {
resourceHostObject.resource.setProperty((String) arguments[0], (List) Context.jsToJava(
arguments[1], List.class));
} else {
throw new CarbonException("Invalid argument types for setProperty() method");
}
} else {
throw new CarbonException("Invalid no. of arguments for setProperty() method");
}
}
代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.api
/**
* Method to make an aspect to default.
* @param path path of the resource
* @param aspect the aspect to be removed.
* @param registry registry instance to be used
*/
public static void setDefaultLifeCycle(String path, String aspect, Registry registry) throws RegistryException {
Resource resource = registry.get(path);
if(resource != null) {
resource.setProperty("registry.LC.name", aspect);
registry.put(path, resource);
}
}
代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions
public static void addScripts(String state, Resource resource, List<ScriptBean> scriptList, String aspectName) {
if (scriptList != null) {
for (ScriptBean scriptBean : scriptList) {
if (scriptBean.isConsole()) {
List<String> items = new ArrayList<String>();
items.add(scriptBean.getScript());
items.add(scriptBean.getFunctionName());
String resourcePropertyNameForScript =
LifecycleConstants.REGISTRY_CUSTOM_LIFECYCLE_CHECKLIST_JS_SCRIPT_CONSOLE + aspectName + "." + state
+ "." + scriptBean.getEventName();
resource.setProperty(resourcePropertyNameForScript, items);
}
}
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions
private void encodeProperty(Resource resource, String propKey) {
try {
if (resource.getProperty(propKey) != null) {
resource.setProperty(propKey,
CryptoUtil.getDefaultCryptoUtil().encryptAndBase64Encode(
resource.getProperty(propKey).getBytes()));
}
} catch (CryptoException e) {
log.error("Unable to encrypt property key: " + propKey + " for resource " +
"path: " + resource.getPath(), e);
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions
private void decodeProperty(Resource resource, String propKey) {
try {
if(resource.getProperty(propKey)!=null){
resource.setProperty(propKey,
new String(CryptoUtil.getDefaultCryptoUtil().base64DecodeAndDecrypt(
resource.getProperty(propKey))));
}
} catch (CryptoException e) {
log.error("Unable to decrypt property key: " + propKey + " for resource " +
"path: " + resource.getPath(), e);
}
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr
public void checkout(String s) throws UnsupportedRepositoryOperationException, LockException, RepositoryException {
if (!isNodeTypeVersionable(s)) {
throw new UnsupportedRepositoryOperationException("Cannot apply checkout for non versionalbe nodes .!!!");
}
try {
Resource resource = ((RegistrySession) session).getUserRegistry().get(s);
resource.setProperty("jcr:checkedOut", "true"); // no need both.But as in JCR spec there are two properties to set
resource.setProperty("jcr:isCheckedOut", "true");
((RegistrySession) session).getUserRegistry().put(s, resource);
} catch (RegistryException e) {
throw new RepositoryException("Exception occurred at Registry level");
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr
private static void createSystemConfigNodeTypes(UserRegistry userReg,String workspaceRoot) throws RegistryException {
String confVerPath = workspaceRoot
+ JCR_SYSTEM_CONFIG
+ "/"
+ JCR_SYSTEM_CONFIG_NODE_TYPES;
if (!userReg.resourceExists(confVerPath)) {
Resource resource = (CollectionImpl)userReg.newCollection();
resource.setDescription("sys:config-jcr-storage");
resource.setProperty("sys:config","true");
userReg.put(confVerPath, resource);
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr
private static void createSystemConfigVersionLabelStore(UserRegistry userReg,String workspaceRoot) throws RegistryException {
String confVerPath = workspaceRoot
+ JCR_SYSTEM_CONFIG
+ "/"
+ JCR_SYSTEM_VERSION_LABELS;
if (!userReg.resourceExists(confVerPath)) {
Resource resource = (CollectionImpl)userReg.newCollection();
resource.setDescription("sys:config-jcr-storage");
resource.setProperty("sys:config","true");
userReg.put(confVerPath, resource);
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr
private static void createSystemConfigVersion(UserRegistry userReg,String workspaceRoot) throws RegistryException {
String confVerPath = workspaceRoot
+ JCR_SYSTEM_CONFIG
+ "/"
+ JCR_SYSTEM_CONFIG_VERSION;
if (!userReg.resourceExists(confVerPath)) {
Resource resource = (CollectionImpl)userReg.newCollection();
resource.setDescription("sys:config-jcr-storage");
resource.setProperty("sys:config","true");
userReg.put(confVerPath, resource);
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.extensions
public Resource get(RequestContext requestContext) throws RegistryException {
Resource resource = requestContext.getRepository().get(requestContext.getResourcePath().getPath());
resource.setProperty("registry.externalLink", "true");
requestContext.setProcessingComplete(true);
return resource;
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr
public static void setRetentionPolicyToRegistry(RegistrySession session, String s, RetentionPolicy retentionPolicy) throws RepositoryException {
Resource resource = null;
try {
resource = session.getUserRegistry().get(s);
resource.setProperty("org.wso2.carbon.registry.jcr.retention.policy", retentionPolicy.getName());
session.getUserRegistry().put(s, resource);
} catch (RegistryException e) {
throw new RepositoryException("Registry level exception when setting retention policy at " + s);
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr
public void setPrimaryType(String s) throws NoSuchNodeTypeException, VersionException, ConstraintViolationException, LockException, RepositoryException {
// Check if node type already exists
registrySession.getWorkspace().getNodeTypeManager().getNodeType(s);
// if(s!= null && s.startsWith("mix")) {
// throw new ConstraintViolationException("Cannpot set mixin as primary types");
// }
try {
Resource resource = registrySession.getUserRegistry().get(nodePath);
resource.setProperty("jcr:primaryType", s);
registrySession.getUserRegistry().put(nodePath, resource);
} catch (RegistryException e) {
String msg = "failed to resolve the path of the given node or violation of repository syntax " + this;
log.debug(msg);
throw new RepositoryException(msg, e);
}
}
//TODO overall, always do a registry get on a resource and do stuff other than using the ref
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr
public static void loadRetentionPolicies(RegistrySession session) throws RepositoryException {
try {
if(!session.getUserRegistry().resourceExists("/jcr_system/workspaces/default_workspace/test_policy_holder")){
session.getRootNode().addNode("test_policy_holder");
}
Resource r = session.getUserRegistry().get("/jcr_system/workspaces/default_workspace/test_policy_holder");
r.setProperty("org.wso2.carbon.registry.jcr.retention.policy","fullLocked");
session.getUserRegistry().put("/jcr_system/workspaces/default_workspace/test_policy_holder",r);
} catch (RegistryException e) {
throw new RepositoryException("Unable to load TCK test data");
} catch (RepositoryException e) {
throw new RepositoryException("Unable to load TCK test data");
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.jcr
public void addVersionLabel(String s, String s1, boolean b) throws LabelExistsVersionException, VersionException, RepositoryException {
try {
Resource res = ((RegistrySession) session).getUserRegistry().get(
RegistryJCRSpecificStandardLoderUtil.
getSystemConfigVersionLabelPath((RegistrySession) session));
res.setProperty(s1, s);
((RegistrySession) session).getUserRegistry().put(RegistryJCRSpecificStandardLoderUtil.
getSystemConfigVersionLabelPath((RegistrySession) session), res);
} catch (RegistryException e) {
throw new RepositoryException("Exception occurred in registry level " + s);
}
}
内容来源于网络,如有侵权,请联系作者删除!