本文整理汇总了Java中org.wso2.carbon.registry.api.RegistryException类的典型用法代码示例。如果您正苦于以下问题:Java RegistryException类的具体用法?Java RegistryException怎么用?Java RegistryException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RegistryException类属于org.wso2.carbon.registry.api包,在下文中一共展示了RegistryException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: renameAppPermissionPathNode
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
/**
* Rename the registry path node name for a deleted Service provider role.
*
* @param oldName
* @param newName
* @throws IdentityApplicationManagementException
*/
public static void renameAppPermissionPathNode(String oldName, String newName)
throws IdentityApplicationManagementException {
List<ApplicationPermission> loadPermissions = loadPermissions(oldName);
String newApplicationNode = ApplicationMgtUtil.getApplicationPermissionPath() + PATH_CONSTANT + oldName;
Registry tenantGovReg = CarbonContext.getThreadLocalCarbonContext().getRegistry(
RegistryType.USER_GOVERNANCE);
//creating new application node
try {
for (ApplicationPermission applicationPermission : loadPermissions) {
tenantGovReg.delete(newApplicationNode + PATH_CONSTANT + applicationPermission.getValue());
}
tenantGovReg.delete(newApplicationNode);
Collection permissionNode = tenantGovReg.newCollection();
permissionNode.setProperty("name", newName);
newApplicationNode = ApplicationMgtUtil.getApplicationPermissionPath() + PATH_CONSTANT + newName;
ApplicationMgtUtil.applicationNode = newApplicationNode;
tenantGovReg.put(newApplicationNode, permissionNode);
addPermission(loadPermissions.toArray(new ApplicationPermission[loadPermissions.size()]), tenantGovReg);
} catch (RegistryException e) {
throw new IdentityApplicationManagementException("Error while renaming permission node "
+ oldName + "to " + newName, e);
}
}
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:32,代码来源:ApplicationMgtUtil.java
示例2: addPermission
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
private static void addPermission(ApplicationPermission[] permissions, Registry tenantGovReg) throws
RegistryException {
for (ApplicationPermission permission : permissions) {
String permissionValue = permission.getValue();
if ("/".equals(permissionValue.substring(0, 1))) { //if permissions are starts with slash remove that
permissionValue = permissionValue.substring(1);
}
String[] splitedPermission = permissionValue.split("/");
String permissinPath = applicationNode + PATH_CONSTANT;
for (int i = 0; i < splitedPermission.length; i++) {
permissinPath = permissinPath + splitedPermission[i] + PATH_CONSTANT;
Collection permissionNode = tenantGovReg.newCollection();
permissionNode.setProperty("name", splitedPermission[i]);
tenantGovReg.put(permissinPath, permissionNode);
}
}
}
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:21,代码来源:ApplicationMgtUtil.java
示例3: deletePermissions
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
/**
* Delete the resource
*
* @param applicationName
* @throws IdentityApplicationManagementException
*/
public static void deletePermissions(String applicationName) throws IdentityApplicationManagementException {
String applicationNode = getApplicationPermissionPath() + PATH_CONSTANT + applicationName;
Registry tenantGovReg = CarbonContext.getThreadLocalCarbonContext().getRegistry(
RegistryType.USER_GOVERNANCE);
try {
boolean exist = tenantGovReg.resourceExists(applicationNode);
if (exist) {
tenantGovReg.delete(applicationNode);
}
} catch (RegistryException e) {
throw new IdentityApplicationManagementException("Error while storing permissions", e);
}
}
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:24,代码来源:ApplicationMgtUtil.java
示例4: removeTrustedService
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
/**
* Remove trusted service
*
* @param groupName Group name
* @param serviceName Service name
* @param trustedService Trusted service name
* @throws org.wso2.carbon.registry.api.RegistryException
*/
private void removeTrustedService(String groupName, String serviceName,
String trustedService) throws RegistryException {
String resourcePath = RegistryResources.SERVICE_GROUPS + groupName +
RegistryResources.SERVICES + serviceName + "/trustedServices";
Registry registry = getConfigSystemRegistry();
if (registry != null) {
if (registry.resourceExists(resourcePath)) {
Resource resource = registry.get(resourcePath);
if (resource.getProperty(trustedService) != null) {
resource.removeProperty(trustedService);
}
registry.put(resourcePath, resource);
}
}
}
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:25,代码来源:ApplicationManagementServiceImpl.java
示例5: buildUIPermissionNode
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
private void buildUIPermissionNode(Collection parent, UIPermissionNode parentNode,
Registry registry, Registry tenantRegistry, AuthorizationManager authMan,
String roleName, String userName)
throws RegistryException, UserStoreException {
boolean isSelected = false;
if (roleName != null) {
isSelected = authMan.isRoleAuthorized(roleName, parentNode.getResourcePath(),
UserMgtConstants.EXECUTE_ACTION);
} else if (userName != null) {
isSelected = authMan.isUserAuthorized(userName, parentNode.getResourcePath(),
UserMgtConstants.EXECUTE_ACTION);
}
if (isSelected) {
buildUIPermissionNodeAllSelected(parent, parentNode, registry, tenantRegistry);
parentNode.setSelected(true);
} else {
buildUIPermissionNodeNotAllSelected(parent, parentNode, registry, tenantRegistry,
authMan, roleName, userName);
}
}
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:22,代码来源:UserRealmProxy.java
示例6: buildUIPermissionNodeAllSelected
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
private void buildUIPermissionNodeAllSelected(Collection parent, UIPermissionNode parentNode,
Registry registry, Registry tenantRegistry) throws RegistryException,
UserStoreException {
String[] children = parent.getChildren();
UIPermissionNode[] childNodes = new UIPermissionNode[children.length];
for (int i = 0; i < children.length; i++) {
String child = children[i];
Resource resource = null;
if (registry.resourceExists(child)) {
resource = registry.get(child);
} else if (tenantRegistry != null) {
resource = tenantRegistry.get(child);
} else {
throw new RegistryException("Permission resource not found in the registry.");
}
childNodes[i] = getUIPermissionNode(resource, true);
if (resource instanceof Collection) {
buildUIPermissionNodeAllSelected((Collection) resource, childNodes[i], registry,
tenantRegistry);
}
}
parentNode.setNodeList(childNodes);
}
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:27,代码来源:UserRealmProxy.java
示例7: getSpeedAlerts
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
@Override
public String getSpeedAlerts(DeviceIdentifier identifier) throws GeoLocationBasedServiceException {
try {
Registry registry = getGovernanceRegistry();
Resource resource = registry.get(GeoServices.REGISTRY_PATH_FOR_ALERTS +
GeoServices.ALERT_TYPE_SPEED + "/" + identifier.getId());
if (resource == null) {
return "{'content': false}";
}
InputStream inputStream = resource.getContentStream();
StringWriter writer = new StringWriter();
IOUtils.copy(inputStream, writer, "UTF-8");
return "{'speedLimit':" + writer.toString() + "}";
} catch (RegistryException | IOException e) {
return "{'content': false}";
}
}
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:18,代码来源:GeoLocationProviderServiceImpl.java
示例8: getProximityAlerts
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
@Override
public String getProximityAlerts(DeviceIdentifier identifier) throws GeoLocationBasedServiceException {
try {
Registry registry = getGovernanceRegistry();
Resource resource = registry.get(GeoServices.REGISTRY_PATH_FOR_ALERTS +
GeoServices.ALERT_TYPE_PROXIMITY
+ "/" + identifier.getId());
if (resource != null) {
Properties props = resource.getProperties();
List proxDisObj = (List) props.get(GeoServices.PROXIMITY_DISTANCE);
List proxTimeObj = (List) props.get(GeoServices.PROXIMITY_TIME);
return String.format("{proximityDistance:\"%s\", proximityTime:\"%s\"}",
proxDisObj != null ? proxDisObj.get(0).toString() : "",
proxTimeObj != null ? proxTimeObj.get(0).toString() : "");
} else {
return "{'content': false}";
}
} catch (RegistryException e) {
return "{'content': false}";
}
}
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:24,代码来源:GeoLocationProviderServiceImpl.java
示例9: updateRegistry
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
private void updateRegistry(String path, DeviceIdentifier identifier, Object content, Map<String, String> options)
throws GeoLocationBasedServiceException {
try {
Registry registry = getGovernanceRegistry();
Resource newResource = registry.newResource();
newResource.setContent(content);
newResource.setMediaType("application/json");
for (Map.Entry<String, String> option : options.entrySet()) {
newResource.addProperty(option.getKey(), option.getValue());
}
registry.put(path, newResource);
} catch (RegistryException e) {
throw new GeoLocationBasedServiceException(
"Error occurred while setting the Within Alert for " + identifier.getType() + " with id: " +
identifier.getId(), e);
}
}
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:19,代码来源:GeoLocationProviderServiceImpl.java
示例10: putPermission
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
public static boolean putPermission(Permission permission) throws PermissionManagementException {
boolean status;
try {
StringTokenizer tokenizer = new StringTokenizer(permission.getPath(), "/");
String lastToken = "", currentToken, tempPath;
while (tokenizer.hasMoreTokens()) {
currentToken = tokenizer.nextToken();
tempPath = lastToken + "/" + currentToken;
if (!checkResourceExists(tempPath)) {
createRegistryCollection(tempPath, currentToken);
}
lastToken = tempPath;
}
status = true;
} catch (RegistryException e) {
throw new PermissionManagementException("Error occurred while persisting permission : " +
permission.getName(), e);
}
return status;
}
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:21,代码来源:PermissionUtils.java
示例11: putRegistryResource
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
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;
}
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:17,代码来源:ConfigurationManagerUtil.java
示例12: getResourceStream
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
@Override
public InputStream getResourceStream(String name) throws ResourceNotFoundException {
try {
Registry registry =
CarbonContext.getThreadLocalCarbonContext().getRegistry(RegistryType.SYSTEM_CONFIGURATION);
if (registry == null) {
throw new IllegalStateException("No valid registry instance is attached to the current carbon context");
}
if (!registry.resourceExists(EMAIL_CONFIG_BASE_LOCATION + "/" + name)) {
throw new ResourceNotFoundException("Resource '" + name + "' does not exist");
}
org.wso2.carbon.registry.api.Resource resource =
registry.get(EMAIL_CONFIG_BASE_LOCATION + "/" + name);
resource.setMediaType("text/plain");
return resource.getContentStream();
} catch (RegistryException e) {
throw new ResourceNotFoundException("Error occurred while retrieving resource", e);
}
}
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:20,代码来源:RegistryBasedResourceLoader.java
示例13: write
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
@Override
public void write(String outPath, InputStream in) throws MLOutputAdapterException {
if (in == null || outPath == null) {
throw new MLOutputAdapterException(String.format(
"Null argument values detected. Input stream: %s Out Path: %s", in, outPath));
}
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
IOUtils.copy(in, byteArrayOutputStream);
byte[] array = byteArrayOutputStream.toByteArray();
PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
Registry registry = carbonContext.getRegistry(RegistryType.SYSTEM_GOVERNANCE);
Resource resource = registry.newResource();
resource.setContent(array);
registry.put(outPath, resource);
} catch (RegistryException | IOException e) {
throw new MLOutputAdapterException(
String.format("Failed to save the model to registry %s: %s", outPath, e), e);
}
}
开发者ID:wso2-attic,项目名称:carbon-ml,代码行数:24,代码来源:RegistryOutputAdapter.java
示例14: getKPIConfiguration
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
/**
* Get DAS config details of given certain process which are configured for analytics from the config registry
*
* @param processDefinitionId Process definition ID
* @return KPI configuration details in JSON format. Ex:<p>
* {"processDefinitionId":"myProcess3:1:32518","eventStreamName":"t_666_process_stream","eventStreamVersion":"1.0.0"
* ,"eventStreamDescription":"This is the event stream generated to configure process analytics with DAS, for the
* processt_666","eventStreamNickName":"t_666_process_stream","eventStreamId":"t_666_process_stream:1.0.0",
* "eventReceiverName":"t_666_process_receiver","pcProcessId":"t:666",
* "processVariables":[{"name":"processInstanceId","type":"string","isAnalyzeData":"false",
* "isDrillDownData":"false"}
* ,{"name":"valuesAvailability","type":"string","isAnalyzeData":"false","isDrillDownData":"false"}
* ,{"name":"custid","type":"string","isAnalyzeData":false,"isDrillDownData":false}
* ,{"name":"amount","type":"long","isAnalyzeData":false,"isDrillDownData":false}
* ,{"name":"confirm","type":"bool","isAnalyzeData":false,"isDrillDownData":false}]}
* @throws RegistryException
*/
public JsonNode getKPIConfiguration(String processDefinitionId) throws RegistryException, IOException {
String resourcePath = AnalyticsPublisherConstants.REG_PATH_BPMN_ANALYTICS + processDefinitionId + "/"
+ AnalyticsPublisherConstants.ANALYTICS_CONFIG_FILE_NAME;
try {
RegistryService registryService = BPMNAnalyticsHolder.getInstance().getRegistryService();
Registry configRegistry = registryService.getConfigSystemRegistry();
if (configRegistry.resourceExists(resourcePath)) {
Resource processRegistryResource = configRegistry.get(resourcePath);
String dasConfigDetailsJSONStr = new String((byte[]) processRegistryResource.getContent(),
StandardCharsets.UTF_8);
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.readTree(dasConfigDetailsJSONStr);
}
return null;
} catch (RegistryException e) {
String errMsg = "Error in Getting DAS config details of given process definition id :" + processDefinitionId
+ " from the BPS Config registry-" + resourcePath;
throw new RegistryException(errMsg, e);
}
}
开发者ID:wso2,项目名称:carbon-business-process,代码行数:40,代码来源:BPMNDataPublisher.java
示例15: getLatestChecksum
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
/**
* Get the checksum of latest deployment for given deployment name
*
* @param deploymentName
* @return
* @throws BPSFault
*/
public String getLatestChecksum(String deploymentName) throws BPSFault {
try {
Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
RegistryService registryService = BPMNServerHolder.getInstance().getRegistryService();
Registry tenantRegistry = registryService.getConfigSystemRegistry(tenantId);
String deploymentRegistryPath = BPMNConstants.BPMN_REGISTRY_PATH + BPMNConstants.REGISTRY_PATH_SEPARATOR
+ deploymentName;
if (tenantRegistry.resourceExists(deploymentRegistryPath)) {
Resource deploymentEntry = tenantRegistry.get(deploymentRegistryPath);
return deploymentEntry.getProperty(BPMNConstants.LATEST_CHECKSUM_PROPERTY);
} else {
return null;
}
} catch (RegistryException e) {
String msg = "Error while accessing registry to get latest checksum for package : " + deploymentName;
throw new BPSFault(msg, e);
}
}
开发者ID:wso2,项目名称:carbon-business-process,代码行数:27,代码来源:BPMNDeploymentService.java
示例16: publishProcessVariables
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
/**
* Enables the process variable publishing from BPS to DAS by, receiving (from WSO2 PC) and saving analytics
* configuration details in config registry.
*
* @param processId process name_version
* @param dasConfigDetailsJson Details of analytics configuration with WSO2 DAS
* @return http response of this service
*/
@POST
@Path("/{processId}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN })
public Response publishProcessVariables(@PathParam("processId") String processId, String dasConfigDetailsJson)
throws IOException {
if (log.isDebugEnabled()) {
log.debug("Recieved analytics configuration details to from PC to BPS for Process ID:" + processId
+ "\nRecieved Date:" + dasConfigDetailsJson);
}
try {
saveDASconfigInfo(dasConfigDetailsJson);
} catch (RegistryException e) {
String errMsg =
"Error in saving DAS Analytics Configuratios in BPS Config-Registry for process :" + processId
+ "\n Details tried to save:" + dasConfigDetailsJson;
throw new IllegalArgumentException(errMsg, e);
}
return Response.ok().build();
}
开发者ID:wso2,项目名称:carbon-business-process,代码行数:29,代码来源:PublishProcessVariablesService.java
示例17: deleteProcessVariables
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
/**
* Removing published process variable publishing from BPS to DAS
*
* @param processId process name_version
* @param processDefinitionIdJSONString JSON string contains process definition id
* @return http response of this service
*/
@DELETE
@Path("/{processId}")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN })
public Response deleteProcessVariables(@PathParam("processId") String processId, String processDefinitionIdJSONString)
throws IOException {
if (log.isDebugEnabled()) {
log.debug("Recieved analytics configuration delete request from PC to BPS for Process ID:" + processId);
}
try {
deleteDASConfigInfo(processDefinitionIdJSONString);
} catch (RegistryException e) {
String errMsg =
"Error in deleting DAS Analytics Configuratios from BPS Config-Registry for process :" + processId;
log.error(errMsg, e);
return Response.status(500).entity(errMsg + " : " + e.getMessage()).build();
}
return Response.ok().build();
}
开发者ID:wso2,项目名称:carbon-business-process,代码行数:27,代码来源:PublishProcessVariablesService.java
示例18: readLogEntries
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
public static LogEntry[] readLogEntries(String logFile) throws RegistryException {
Path csvFilePath = TestUtils.getResourcePath(logFile);
assert csvFilePath != null;
LogEntry[] resultEntries = new LogEntry[0];
try (BufferedReader br = new BufferedReader(new FileReader(csvFilePath.toFile()))) {
List<LogEntry> logEntries = new ArrayList<>();
String line;
while ((line = br.readLine()) != null) {
// use comma as separator
String[] logData = line.split(cvsSplitBy);
LogEntry logEntry = new LogEntry();
logEntry.setResourcePath(logData[0]);
logEntry.setUserName(logData[1]);
logEntry.setDate(new Date(Long.parseLong(logData[2])));
logEntry.setAction(Integer.parseInt(logData[3]));
logEntry.setActionData(logData[4]);
logEntries.add(logEntry);
}
resultEntries = logEntries.toArray(new LogEntry[logEntries.size()]);
} catch (IOException e) {
throw new RegistryException("Error while reading the log entry file", e);
}
return resultEntries;
}
开发者ID:wso2,项目名称:carbon-registry,代码行数:25,代码来源:TestUtils.java
示例19: removeServiceGroup
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
@Override
public boolean removeServiceGroup(String groupName) throws CartridgeGroupNotFoundException {
try {
if (log.isInfoEnabled()) {
log.info(String.format("Starting to remove cartridge group: [group-name] %s", groupName));
}
if (RegistryManager.getInstance().serviceGroupExist(groupName)) {
RegistryManager.getInstance().removeServiceGroup(groupName);
if (log.isInfoEnabled()) {
log.info(String.format("Cartridge group removed: [group-name] %s", groupName));
}
} else {
String msg = String.format("Cartridge group not found: [group-name] %s", groupName);
if (log.isWarnEnabled()) {
log.warn(msg);
}
throw new CartridgeGroupNotFoundException(msg);
}
} catch (org.wso2.carbon.registry.core.exceptions.RegistryException e) {
String message = "Could not remove cartridge group: " + groupName;
log.error(message, e);
throw new RuntimeException(message, e);
}
return true;
}
开发者ID:apache,项目名称:stratos,代码行数:26,代码来源:AutoscalerServiceImpl.java
示例20: hasOverviewProviderElement
import org.wso2.carbon.registry.api.RegistryException; //导入依赖的package包/类
/**
* This method checks whether there is a overview_provider in the overview table.
* @param governanceArtifactConfiguration
* @return
* @throws RegistryException
* @throws XMLStreamException
*/
private boolean hasOverviewProviderElement(GovernanceArtifactConfiguration governanceArtifactConfiguration)
throws RegistryException, XMLStreamException {
OMElement rxtContentOM = governanceArtifactConfiguration.getContentDefinition();
Iterator tableNodes = rxtContentOM.getChildrenWithLocalName(Constants.TABLE);
while (tableNodes.hasNext()) {
OMElement tableOMElement = (OMElement) tableNodes.next();
if (Constants.OVERVIEW.equalsIgnoreCase(tableOMElement.getAttributeValue(new QName(Constants.NAME)))) {
Iterator fieldNodes = tableOMElement.getChildrenWithLocalName(Constants.FIELD);
while (fieldNodes.hasNext()) {
OMElement fieldElement = (OMElement) fieldNodes.next();
OMElement nameElement = fieldElement.getFirstChildWithName(new QName(Constants.NAME));
if (nameElement != null) {
if (Constants.PROVIDER.equalsIgnoreCase(nameElement.getText())) {
return true;
}
}
}
}
}
return false;
}
开发者ID:wso2,项目名称:product-es,代码行数:30,代码来源:EmailUserNameMigrationClient.java
注:本文中的org.wso2.carbon.registry.api.RegistryException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论