use of org.wso2.carbon.registry.core.Registry in project carbon-business-process by wso2.
the class BPELPackageManagementServiceSkeleton method listProcessesInPackage.
public PackageType listProcessesInPackage(String packageName) throws PackageManagementException {
TenantProcessStoreImpl tenantProcessStore = getTenantProcessStore();
BPELPackageRepository packageRepo = tenantProcessStore.getBPELPackageRepository();
try {
return getPackageInfo(packageRepo.getBPELPackageInfoForPackage(packageName.substring(0, packageName.lastIndexOf("-"))));
} catch (Exception e) {
String errMsg = "BPEL package: " + packageName + " failed to load from registry.";
log.error(errMsg, e);
throw new PackageManagementException(errMsg, e);
}
}
use of org.wso2.carbon.registry.core.Registry in project carbon-business-process by wso2.
the class PublishProcessVariablesService method saveDASconfigInfo.
/**
* Save DAS configuration details (received from PC), in config registry
*
* @param dasConfigDetailsJSONString Details of analytics configuration with WSO2 DAS as a JSON string
* @throws RegistryException Throws RegistryException if error occurred in accessing registry
* @throws IOException Throws IOException if an error occurred in hadling json content
*/
private void saveDASconfigInfo(String dasConfigDetailsJSONString) throws RegistryException, IOException {
PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
Registry configRegistry = carbonContext.getRegistry(RegistryType.SYSTEM_CONFIGURATION);
ObjectMapper objectMapper = new ObjectMapper();
JsonNode dasConfigDetailsJOb = objectMapper.readTree(dasConfigDetailsJSONString);
String processDefinitionId = dasConfigDetailsJOb.get(AnalyticsPublisherConstants.PROCESS_DEFINITION_ID).textValue();
// create a new resource (text file) to keep process variables
Resource procVariableJsonResource = configRegistry.newResource();
procVariableJsonResource.setContent(dasConfigDetailsJSONString);
procVariableJsonResource.setMediaType(MediaType.APPLICATION_JSON);
configRegistry.put(AnalyticsPublisherConstants.REG_PATH_BPMN_ANALYTICS + processDefinitionId + "/" + AnalyticsPublisherConstants.ANALYTICS_CONFIG_FILE_NAME, procVariableJsonResource);
}
use of org.wso2.carbon.registry.core.Registry in project carbon-business-process by wso2.
the class PublishProcessVariablesService method deleteDASConfigInfo.
/**
* Delete DAS configuration details (received from PC), from config registry
*
* @param processDefinitionIdJSONString JSON string contains process definition id
* @throws RegistryException Throws RegistryException if error occurred in accessing registry
* @throws IOException Throws IOException if an error occurred in hadling json content
*/
private void deleteDASConfigInfo(String processDefinitionIdJSONString) throws RegistryException, IOException {
PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
Registry configRegistry = carbonContext.getRegistry(RegistryType.SYSTEM_CONFIGURATION);
ObjectMapper objectMapper = new ObjectMapper();
JsonNode dasConfigDetailsJOb = objectMapper.readTree(processDefinitionIdJSONString);
String processDefinitionId = dasConfigDetailsJOb.get(AnalyticsPublisherConstants.PROCESS_DEFINITION_ID).textValue();
configRegistry.delete(AnalyticsPublisherConstants.REG_PATH_BPMN_ANALYTICS + processDefinitionId + "/" + AnalyticsPublisherConstants.ANALYTICS_CONFIG_FILE_NAME);
}
use of org.wso2.carbon.registry.core.Registry in project carbon-business-process by wso2.
the class ServiceConfigurationUtil method loadOMElement.
private static OMElement loadOMElement(Registry registry, String location) {
OMElement serviceElement = null;
ByteArrayInputStream bis = null;
try {
if (registry.resourceExists(location)) {
Resource resource = registry.get(location);
String resourceContent = new String((byte[]) resource.getContent());
bis = new ByteArrayInputStream(resourceContent.getBytes());
serviceElement = new StAXOMBuilder(bis).getDocumentElement();
serviceElement.build();
} else {
String errMsg = "The resource: " + location + " does not exist.";
log.warn(errMsg);
}
} catch (RegistryException | XMLStreamException e) {
String errMsg = "Error occurred while creating the OMElement out of service.xml " + location;
log.warn(errMsg, e);
}
// }
return serviceElement;
}
use of org.wso2.carbon.registry.core.Registry in project carbon-business-process by wso2.
the class BPMNDeployer method isWorkerNode.
/**
* Whether a bps node is worker ( a node that does not participate in archive deployment and only handles
* input/output . This is determined by looking at the registry read/only property
* @return
*/
private boolean isWorkerNode() {
RegistryService registryService = BPMNServerHolder.getInstance().getRegistryService();
boolean isWorker = true;
try {
isWorker = (registryService.getConfigSystemRegistry().getRegistryContext().isReadOnly());
} catch (RegistryException e) {
log.error("Error accessing the configuration registry");
}
return isWorker;
}
Aggregations