本文整理汇总了Java中org.wso2.carbon.registry.core.utils.RegistryUtils.isRegistryReadOnly方法的典型用法代码示例。如果您正苦于以下问题:Java RegistryUtils.isRegistryReadOnly方法的具体用法?Java RegistryUtils.isRegistryReadOnly怎么用?Java RegistryUtils.isRegistryReadOnly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.carbon.registry.core.utils.RegistryUtils
的用法示例。
在下文中一共展示了RegistryUtils.isRegistryReadOnly方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setArtifactUIConfiguration
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public boolean setArtifactUIConfiguration(String key, String update) throws RegistryException {
Registry registry = getConfigSystemRegistry();
if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
return false;
}
try {
Util.validateOMContent(Util.buildOMElement(update));
String path = GOVERNANCE_ARTIFACT_CONFIGURATION_PATH + key;
if(registry.resourceExists(path)) {
Resource resource = registry.get(path);
resource.setContent(update);
registry.put(path, resource);
}
return true;
} catch (Exception e) {
log.error("An error occurred while saving configuration", e);
return false;
}
}
示例2: createHandler
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public boolean createHandler(String payload) throws Exception {
RegistryUtils.recordStatistics(payload);
Registry configSystemRegistry = getConfigSystemRegistry();
String parsedPayload;
try {
parsedPayload = parseHandlerConfiguration(payload);
} catch (Exception e) {
log.error("Unable to parse the given handler configuration.", e);
throw new Exception("Unable to parse the given handler configuration. " +
e.getMessage());
}
if (parsedPayload == null) {
throw new Exception("The provided handler configuration is invalid.");
}
return !RegistryUtils.isRegistryReadOnly(configSystemRegistry.getRegistryContext()) &&
CommonUtil.addHandler(configSystemRegistry, parsedPayload);
}
示例3: updateHandler
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public boolean updateHandler(String oldName, String payload) throws Exception {
RegistryUtils.recordStatistics(oldName, payload);
Registry configSystemRegistry = getConfigSystemRegistry();
String parsedPayload;
try {
parsedPayload = parseHandlerConfiguration(payload);
} catch (Exception e) {
log.error("Unable to parse the given handler configuration.", e);
throw new Exception("Unable to parse the given handler configuration. " +
e.getMessage());
}
if (parsedPayload == null) {
throw new Exception("The provided handler configuration is invalid.");
}
return !RegistryUtils.isRegistryReadOnly(configSystemRegistry.getRegistryContext()) &&
CommonUtil.updateHandler(configSystemRegistry, oldName, parsedPayload);
}
示例4: setDescription
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public void setDescription(String path, String description) throws Exception {
UserRegistry registry = (UserRegistry) getRootRegistry();
if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
return;
}
DescriptionUtil.setDescription(registry, path, description);
}
示例5: addArtifact
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public String addArtifact(String key, String info, String lifecycleAttribute) throws
RegistryException {
RegistryUtils.recordStatistics(key, info, lifecycleAttribute);
Registry registry = getGovernanceUserRegistry();
if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
return null;
}
try {
XMLInputFactory factory = XMLInputFactory.newInstance();
factory.setProperty(XMLInputFactory.IS_COALESCING, true);
XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(info));
GenericArtifactManager manager = new GenericArtifactManager(registry, key);
GenericArtifact artifact = manager.newGovernanceArtifact(new StAXOMBuilder(reader).getDocumentElement());
// want to save original content, so set content here
artifact.setContent(info.getBytes());
artifact.setAttribute("resource.source", "AdminConsole");
manager.addGenericArtifact(artifact);
if (lifecycleAttribute != null) {
String lifecycle = artifact.getAttribute(lifecycleAttribute);
if (lifecycle != null) {
artifact.attachLifecycle(lifecycle);
}
}
return RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH + artifact.getPath();
} catch (Exception e) {
String msg = "Unable to add artifact. ";
if (e instanceof RegistryException) {
throw (RegistryException) e;
} else if (e instanceof OMException) {
msg += "Unexpected character found in input-field name.";
log.error(msg, e);
throw new RegistryException(msg, e);
}
throw new RegistryException(
msg + (e.getCause() instanceof SQLException ? "" : e.getCause().getMessage()),
e);
}
}
示例6: addCollection
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public String addCollection(
String parentPath, String collectionName, String mediaType, String description)
throws Exception {
UserRegistry registry = (UserRegistry) getRootRegistry();
if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
return null;
}
return AddCollectionUtil.process(parentPath, collectionName, mediaType, description, registry);
}
示例7: addTextContent
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public boolean addTextContent(
String parentPath,
String fileName,
String mediaType,
String description,
String content) throws Exception {
UserRegistry registry = (UserRegistry) getRootRegistry(ResourceDataHolder.getInstance().getRegistryService());
if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
return false;
}
AddTextResourceUtil.addTextResource(parentPath, fileName, mediaType, description, content, registry);
return true;
}
示例8: subscribeREST
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public SubscriptionBean subscribeREST(String path, String endpoint, String eventName,
String sessionId) throws RegistryException {
RegistryUtils.recordStatistics(path, endpoint, eventName, sessionId);
UserRegistry registry = (UserRegistry) getRootRegistry();
if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
return null;
}
return SubscriptionBeanPopulator.subscribeAndPopulate(registry, path, endpoint,
eventName, true);
}
示例9: addRemoteLink
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public void addRemoteLink (String parentPath,
String name,
String instance,
String targetPath) throws Exception {
UserRegistry registry = (UserRegistry) getRootRegistry();
if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
return;
}
AddRemoteLinkUtil.addRemoteLink(registry, parentPath, name, instance, targetPath);
}
示例10: importResource
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public boolean importResource(
String parentPath,
String resourceName,
String mediaType,
String description,
String fetchURL,
String symlinkLocation,
String[][] properties) throws Exception {
UserRegistry registry = (UserRegistry) getRootRegistry(ResourceDataHolder.getInstance().getRegistryService());
if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
return false;
}
// Fix for file importation security verification - FileSystemImportationSecurityHotFixTestCase
if (StringUtils.isNotBlank(fetchURL) && fetchURL.toLowerCase().startsWith("file:")) {
String msg = "The source URL must not be file in the server's local file system";
throw new RegistryException(msg);
}
// Adding Source URL as property to end of the properties array.
String[][] newProperties = CommonUtil.setProperties(properties, "sourceURL", fetchURL);
// Data is directed to below AddResourceUtil.addResource from ImportResourceUtil.importResource
// Hence resource upload path will now go through put.
AddResourceUtil.addResource(CommonUtil.calculatePath(parentPath, resourceName),
mediaType, description, GetTextContentUtil.getByteContent(fetchURL),
symlinkLocation, registry, newProperties);
return true;
}
示例11: delete
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public boolean delete(String pathToDelete) throws Exception {
UserRegistry registry = (UserRegistry) getRootRegistry();
if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
return false;
}
DeleteUtil.process(pathToDelete, registry);
return true;
}
示例12: updateTextContent
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public boolean updateTextContent(String resourcePath, String contentText) throws Exception {
UserRegistry registry = (UserRegistry) getRootRegistry();
if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
return false;
}
UpdateTextContentUtil.updateTextContent(resourcePath, contentText, registry);
return true;
}
示例13: addResource
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public boolean addResource(String path, String mediaType, String description, DataHandler content,
String symlinkLocation, String[][] properties)
throws Exception {
UserRegistry registry = (UserRegistry) getRootRegistry(ResourceDataHolder.getInstance().getRegistryService());
if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
return false;
}
AddResourceUtil.addResource(path, mediaType, description, content, symlinkLocation,
registry, properties);
return true;
}
示例14: removeProperty
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的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();
}
示例15: copyResource
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public boolean copyResource(
String parentPath, String oldResourcePath, String destinationPath, String resourceName)
throws Exception {
UserRegistry registry = (UserRegistry) getRootRegistry();
if (RegistryUtils.isRegistryReadOnly(registry.getRegistryContext())) {
return false;
}
CopyResourceUtil.copyResource(registry, parentPath,
oldResourcePath, destinationPath, resourceName);
return true;
}