本文整理了Java中org.wso2.carbon.registry.core.Resource.discard
方法的一些代码示例,展示了Resource.discard
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Resource.discard
方法的具体详情如下:
包路径:org.wso2.carbon.registry.core.Resource
类名称:Resource
方法名:discard
暂无
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.resource
public void close() throws IOException {
inputStream.close();
resource.discard();
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.resource
public static void setDescription(UserRegistry registry,
String path, String description) throws Exception {
Resource resource = registry.get(path);
resource.setDescription(description);
registry.put(path, resource);
resource.discard();
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.relations
resource.discard();
代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.interceptor
} finally {
try {
resource.discard();
if (result != null && result.getParent() != null) {
result.detach();
代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.interceptor
} finally {
try {
resource.discard();
if (result != null && result.getParent() != null) {
result.detach();
代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.gateway
} finally {
try {
resource.discard();
if (result != null && result.getParent() != null) {
result.detach();
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.resource
public static String getProperty(UserRegistry registry,
String resourcePath, String key) throws RegistryException {
try {
if (registry.resourceExists(resourcePath)) {
Resource resource = registry.get(resourcePath);
if (resource != null) {
String value = resource.getProperty(key);
resource.discard();
return value;
}
}
} catch (RegistryException e) {
String msg = "Failed to get the resource information of resource " + resourcePath +
" for retrieving a property with key : " + key + ". Error :" +
((e.getCause() instanceof SQLException) ?
"" : e.getMessage());
log.error(msg, e);
throw e;
}
return "";
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.resource
public static String getTextContent(String path, Registry registry) throws Exception {
try {
if (path != null && path.contains("..")) {
path = FilenameUtils.normalize(path);
}
Resource resource = registry.get(path);
byte[] content = (byte[]) resource.getContent();
String contentString = "";
if (content != null) {
contentString = RegistryUtils.decodeBytes(content);
}
resource.discard();
return contentString;
} catch (RegistryException e) {
String msg = "Could not get the content of the resource " +
path + ". Caused by: " + ((e.getCause() instanceof SQLException) ?
"" : e.getMessage());
log.error(msg, e);
throw new RegistryException(msg, e);
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.properties
resource.discard();
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.properties
/**
* Method to add a property, if there already exist a property with the same name, this
* will add the value to the existing property name. (So please remove the old property with
* the same name before calling this method).
*
* @param path path of the resource.
* @param name property name.
* @param value property value.
*
* @throws RegistryException throws if there is an error.
*/
public void setProperty(String path, String name, String value) throws RegistryException {
if(name != null && name.startsWith("registry.")) {
throw new RegistryException("Property cannot start with the \"registry.\" prefix. " +
"Property name " + name + ". Resource path = " + path);
}
UserRegistry registry = (UserRegistry) getRootRegistry();
if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
return;
}
Resource resource = registry.get(path);
if(resource.getProperties().keySet().contains(name)) {
throw new RegistryException("Cannot duplicate property name. Please choose a different name. " +
"Property name " + name + ". Resource path = " + path);
}
resource.addProperty(name, value);
registry.put(resource.getPath(), resource);
resource.discard();
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.resource
public static void updateTextContent(String path, String contentText, Registry registry)
throws Exception {
try {
Resource resource = registry.get(path);
String mediaType = resource.getMediaType();
if (resource.getProperty(RegistryConstants.REGISTRY_LINK) != null &&
(CommonConstants.WSDL_MEDIA_TYPE.equals(mediaType) ||
CommonConstants.SCHEMA_MEDIA_TYPE.equals(mediaType))) {
String description = resource.getDescription();
Properties properties = (Properties) resource.getProperties().clone();
resource = registry.newResource();
resource.setMediaType(mediaType);
resource.setDescription(description);
resource.setProperties(properties);
}
resource.setContent(RegistryUtils.encodeString(contentText));
registry.put(path, resource);
resource.discard();
} catch (RegistryException e) {
String msg = "Could not update the content of the resource " +
path + ". Caused by: " + ((e.getCause() instanceof SQLException) ?
"" : e.getMessage());
log.error(msg, e);
throw new RegistryException(msg, e);
}
}
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.indexing
child.discard();
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.properties
/**
* 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();
}
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.resource
resource.discard();
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.indexing
CommonUtil.populateAverageStars(resourceData);
child.discard();
代码示例来源:origin: org.wso2.carbon.commons/org.wso2.carbon.deployment.synchronizer
resource.discard();
代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.gateway
resource.removeProperty(propertyName);
registry.put(resource.getPath(), resource);
resource.discard();
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.indexing
child.discard();
代码示例来源:origin: org.wso2.carbon.apimgt/org.wso2.carbon.apimgt.gateway
resource.discard();
} catch (RegistryException e) {
throw new APIManagementException("Error while reading registry resource " + path + " for tenant " +
代码示例来源:origin: org.wso2.carbon.registry/org.wso2.carbon.registry.resource
resource.discard();
内容来源于网络,如有侵权,请联系作者删除!