Java Code Examples for org.wso2.carbon.registry.api.RegistryException#getMessage()

The following examples show how to use org.wso2.carbon.registry.api.RegistryException#getMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfigurationManagerUtil.java    From carbon-device-mgt with Apache License 2.0 6 votes vote down vote up
public static boolean putRegistryResource(String path,
                                          Resource resource)
		throws ConfigurationManagementException {
	boolean status;
	try {
		ConfigurationManagerUtil.getConfigurationRegistry().beginTransaction();
		ConfigurationManagerUtil.getConfigurationRegistry().put(path, resource);
		ConfigurationManagerUtil.getConfigurationRegistry().commitTransaction();
		status = true;
	} catch (RegistryException e) {
		throw new ConfigurationManagementException(
				"Error occurred while persisting registry resource : " +
				e.getMessage(), e);
	}
	return status;
}
 
Example 2
Source File: DeviceTypeUtils.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
public static Registry getConfigurationRegistry() throws DeviceTypeMgtPluginException {
    try {
        int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
        org.wso2.carbon.registry.core.service.RegistryService registryService = DeviceTypeExtensionDataHolder
                .getInstance().getRegistryService();
        if (registryService == null) {
            throw new DeviceTypeMgtPluginException("Registry Service is not initialized properly");
        }
        return registryService.getConfigSystemRegistry(tenantId);
    } catch (RegistryException e) {
        throw new DeviceTypeMgtPluginException("Error in retrieving conf registry instance: " + e.getMessage(), e);
    }
}
 
Example 3
Source File: DeviceTypeUtils.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
public static boolean putRegistryResource(String path, Resource resource) throws DeviceTypeMgtPluginException {
    try {
        Registry registry = getConfigurationRegistry();
        registry.beginTransaction();
        registry.put(path, resource);
        registry.commitTransaction();
        return true;
    } catch (RegistryException e) {
        throw new DeviceTypeMgtPluginException(
                "Error occurred while persisting registry resource : " + e.getMessage(), e);
    }
}
 
Example 4
Source File: DeviceTypeUtils.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
public static Resource getRegistryResource(String path) throws DeviceTypeMgtPluginException {
    try {
        if(DeviceTypeUtils.getConfigurationRegistry().resourceExists(path)){
            return DeviceTypeUtils.getConfigurationRegistry().get(path);
        }
        return null;
    } catch (RegistryException e) {
        throw new DeviceTypeMgtPluginException("Error in retrieving registry resource : " + e.getMessage(), e);
    }
}
 
Example 5
Source File: GeoLocationProviderServiceImpl.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
private Registry getGovernanceRegistry() throws GeoLocationBasedServiceException {
    try {
        int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
        return DeviceManagementDataHolder.getInstance().getRegistryService()
                .getGovernanceSystemRegistry(
                        tenantId);
    } catch (RegistryException e) {
        throw new GeoLocationBasedServiceException(
                "Error in retrieving governance registry instance: " +
                        e.getMessage(), e);
    }
}
 
Example 6
Source File: PermissionUtils.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
public static Registry getGovernanceRegistry() throws PermissionManagementException {
    try {
        int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
        return DeviceManagementDataHolder.getInstance().getRegistryService()
                .getGovernanceSystemRegistry(
                        tenantId);
    } catch (RegistryException e) {
        throw new PermissionManagementException(
                "Error in retrieving governance registry instance: " +
                        e.getMessage(), e);
    }
}
 
Example 7
Source File: PermissionUtils.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
public static Permission getPermission(String path) throws PermissionManagementException {
    try {
        Resource resource = PermissionUtils.getGovernanceRegistry().get(path);
        Permission permission = new Permission();
        permission.setName(resource.getProperty(PERMISSION_PROPERTY_NAME));
        permission.setPath(resource.getPath());
        return permission;
    } catch (RegistryException e) {
        throw new PermissionManagementException("Error in retrieving registry resource : " +
                e.getMessage(), e);
    }
}
 
Example 8
Source File: ConfigurationManagerUtil.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
public static Registry getConfigurationRegistry() throws ConfigurationManagementException {
	try {
		int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
		return DeviceManagementDataHolder.getInstance().getRegistryService()
		                                 .getConfigSystemRegistry(
				                                 tenantId);
	} catch (RegistryException e) {
		throw new ConfigurationManagementException(
				"Error in retrieving governance registry instance: " +
				e.getMessage(), e);
	}
}
 
Example 9
Source File: ConfigurationManagerUtil.java    From carbon-device-mgt with Apache License 2.0 5 votes vote down vote up
public static Resource getRegistryResource(String path) throws ConfigurationManagementException {
	try {
		if(ConfigurationManagerUtil.getConfigurationRegistry().resourceExists(path)){
			return ConfigurationManagerUtil.getConfigurationRegistry().get(path);
		}
		return null;
	} catch (RegistryException e) {
		throw new ConfigurationManagementException("Error in retrieving registry resource : " +
		                                         e.getMessage(), e);
	}
}