当前位置: 首页>>代码示例>>Java>>正文


Java RegistryException.getCause方法代码示例

本文整理汇总了Java中org.wso2.carbon.registry.core.exceptions.RegistryException.getCause方法的典型用法代码示例。如果您正苦于以下问题:Java RegistryException.getCause方法的具体用法?Java RegistryException.getCause怎么用?Java RegistryException.getCause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.wso2.carbon.registry.core.exceptions.RegistryException的用法示例。


在下文中一共展示了RegistryException.getCause方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入方法依赖的package包/类
public static void process(String pathToDelete, UserRegistry registry) throws Exception {
    try {
        if (RegistryConstants.ROOT_PATH.equals(pathToDelete) ||
                RegistryConstants.SYSTEM_COLLECTION_BASE_PATH.equals(pathToDelete) ||
                RegistryConstants.GOVERNANCE_REGISTRY_BASE_PATH.equals(pathToDelete) ||
                RegistryConstants.CONFIG_REGISTRY_BASE_PATH.equals(pathToDelete) ||
                RegistryConstants.LOCAL_REPOSITORY_BASE_PATH.equals(pathToDelete)) {
            throw new RegistryException("Unable to delete system collection at " + pathToDelete
                    + ".");
        }
        registry.delete(pathToDelete);
    } catch (RegistryException e) {
        String msg = "Failed to delete " + pathToDelete + ". " + ((e.getCause() instanceof SQLException) ?
                "" : e.getMessage());
        log.error(msg, e);
        throw new RegistryException(msg, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:19,代码来源:DeleteUtil.java

示例2: addRemoteLink

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入方法依赖的package包/类
public static void addRemoteLink (
        UserRegistry userRegistry,
        String parentPath,
        String name,
        String instance,
        String targetPath) throws Exception {

    String linkResourcePath;
    if (RegistryConstants.ROOT_PATH.equals(parentPath)) {
        linkResourcePath = RegistryConstants.ROOT_PATH + name;
    } else {
        linkResourcePath = parentPath + RegistryConstants.PATH_SEPARATOR + name;
    }

    try {
        userRegistry.createLink(linkResourcePath, instance, targetPath);

    } catch (RegistryException e) {
        String msg = "Failed to add symbolic link to path " +
                linkResourcePath + ". " + ((e.getCause() instanceof SQLException) ?
                "" : e.getMessage());
        log.error(msg, e);
        throw new RegistryException(msg, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:26,代码来源:AddRemoteLinkUtil.java

示例3: getProperty

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入方法依赖的package包/类
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 "";
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:27,代码来源:GetPropertyUtil.java

示例4: process

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入方法依赖的package包/类
public static void process(String path, long snapshotId, UserRegistry registry) throws Exception {
    try {            
        registry.removeVersionHistory(path, snapshotId);
    } catch (RegistryException e) {
        String msg = "Failed to delete the version of the " + snapshotId + " shapshot of " + path + ". " + ((e.getCause() instanceof SQLException) ?
                "" : e.getMessage());
        log.error(msg, e);
        throw new RegistryException(msg, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:11,代码来源:DeleteVersionUtil.java

示例5: moveResource

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入方法依赖的package包/类
public static void moveResource(
        UserRegistry registry,String parentPath,
        String oldResourcePath, String destinationPath, String resourceName)
        throws Exception {

    if (!destinationPath.startsWith(RegistryConstants.PATH_SEPARATOR)) {
        destinationPath = RegistryConstants.PATH_SEPARATOR + destinationPath;
    }

    String newResourcePath;
    if (destinationPath.endsWith(RegistryConstants.PATH_SEPARATOR)) {
        newResourcePath = destinationPath + resourceName;
    } else {
        newResourcePath=destinationPath + "/" +resourceName;
    }

    try {
        if (registry.resourceExists(destinationPath) &&
                !(registry.get(destinationPath) instanceof CollectionImpl)) {
            throw new RegistryException("A resource can't be moved to a resource");
        }
        registry.move(oldResourcePath, newResourcePath);

    } catch (RegistryException e) {
        String msg = "Failed to move the resource: " + oldResourcePath + " to Destination: " +
                newResourcePath + ". Caused by: " +
                ((e.getCause() instanceof SQLException) ?
                "" : e.getMessage());
        log.error(msg, e);
        throw new RegistryException(msg, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:33,代码来源:MoveResourceUtil.java

示例6: addTextResource

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入方法依赖的package包/类
public static void addTextResource(
        String parentPath,
        String resourceName,
        String mediaType,
        String description,
        String contentString,
        UserRegistry userRegistry) throws Exception {

    String resourcePath;
    if (RegistryConstants.ROOT_PATH.equals(parentPath)) {
        resourcePath = RegistryConstants.ROOT_PATH + resourceName;
    } else {
        resourcePath = parentPath + RegistryConstants.PATH_SEPARATOR + resourceName;
    }

    byte[] content = null;
    if (contentString != null) {
        content = RegistryUtils.encodeString(contentString);
    }

    try {
        Resource resource = userRegistry.newResource();
        resource.setProperty(CommonConstants.SOURCE_PROPERTY, CommonConstants.SOURCE_ADMIN_CONSOLE);
        resource.setMediaType(mediaType);
        resource.setDescription(description);
        resource.setContent(RegistryUtils.decodeBytes(content));

        userRegistry.put(resourcePath, resource);
        resource.discard();

    } catch (RegistryException e) {
        String msg = "Failed to add resource with text based content to path " +
                resourcePath + ". " + ((e.getCause() instanceof SQLException) ?
                "" : e.getMessage());
        log.error(msg, e);
        throw new RegistryException(msg, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:39,代码来源:AddTextResourceUtil.java

示例7: updateTextContent

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入方法依赖的package包/类
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);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:30,代码来源:UpdateTextContentUtil.java

示例8: getTextContent

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入方法依赖的package包/类
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);
        }
    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:28,代码来源:GetTextContentUtil.java

示例9: renameResource

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入方法依赖的package包/类
public static void renameResource(
        String parentPath, String oldResourcePath, String newResourceName, UserRegistry registry)
        throws Exception {

    if (!parentPath.endsWith(RegistryConstants.PATH_SEPARATOR)) {
        parentPath = parentPath + RegistryConstants.PATH_SEPARATOR;
    }

    String newResourcePath;
    if (newResourceName.startsWith(RegistryConstants.ROOT_PATH)) {
        newResourcePath = newResourceName;
    } else {
        newResourcePath = parentPath + newResourceName;
    }

    try {
        registry.rename(oldResourcePath, newResourcePath);

    } catch (RegistryException e) {
        String msg = "Failed to rename the resource: " + oldResourcePath + " to name: " +
                newResourcePath + ". Caused by: " +
                ((e.getCause() instanceof SQLException) ?
                "" : e.getMessage());
        log.error(msg, e);
        throw new RegistryException(msg, e);
    }
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:28,代码来源:RenameResourceUtil.java

示例10: importResource

import org.wso2.carbon.registry.core.exceptions.RegistryException; //导入方法依赖的package包/类
public static String importResource(
            String parentPath,
            String resourceName,
            String mediaType,
            String description,
            String fetchURL,
            String symlinkLocation,
            UserRegistry userRegistry,
            String[][] properties) throws Exception {

    String resourcePath;
    if (RegistryConstants.ROOT_PATH.equals(parentPath)) {
        resourcePath = RegistryConstants.ROOT_PATH + resourceName;
    } else {
        resourcePath = parentPath + RegistryConstants.PATH_SEPARATOR + resourceName;
    }

    try {
        Resource metadataResource = userRegistry.newResource();

        metadataResource.setMediaType(mediaType);
        metadataResource.setDescription(description);

        if (symlinkLocation != null) {
            if (!symlinkLocation.endsWith(RegistryConstants.PATH_SEPARATOR)) {
                symlinkLocation += RegistryConstants.PATH_SEPARATOR;
            }
            metadataResource.setProperty(RegistryConstants.SYMLINK_PROPERTY_NAME, symlinkLocation);
        }

        if (properties != null && properties.length > 0) {
            for (String[] p : properties) {
                metadataResource.setProperty(p[0], p[1]);
            }
        }
        metadataResource.setProperty(CommonConstants.SOURCE_PROPERTY, CommonConstants.SOURCE_ADMIN_CONSOLE);
        String path = userRegistry.importResource(resourcePath, fetchURL, metadataResource);
       /* if (properties != null && properties.length > 0) {
            Resource resource = userRegistry.get(path);
            for (String[] p : properties) {
                resource.setProperty(p[0], p[1]);
            }
            userRegistry.put(path, resource);
        }*/
        metadataResource.discard();

        return path;

    } catch (RegistryException e) {
        String msg = "Failed to import resource from the URL " + fetchURL + " to path " +
                resourcePath + ". " + ((e.getCause() instanceof SQLException) ?
                "" : e.getMessage());
        log.error(msg, e);
        throw new RegistryException(msg, e);
    }

}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:58,代码来源:ImportResourceUtil.java


注:本文中的org.wso2.carbon.registry.core.exceptions.RegistryException.getCause方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。