use of org.wso2.carbon.registry.api.Registry in project ballerina by ballerina-lang.
the class CodeGenerator method visitXMLTagName.
/**
* Visit XML tag name and return the index of the tag name in the reference registry.
*
* @param tagName Tag name expression
* @param xmlElementEnv Environment of the XML element of the tag
* @param xmlElementLiteral XML element literal to which the tag name belongs to
* @return Index of the tag name, in the reference registry
*/
private RegIndex visitXMLTagName(BLangExpression tagName, SymbolEnv xmlElementEnv, BLangXMLElementLiteral xmlElementLiteral) {
genNode(tagName, xmlElementEnv);
RegIndex startTagNameRegIndex = tagName.regIndex;
// If this is a string representation of element name, generate the namespace lookup instructions
if (tagName.getKind() != NodeKind.XML_QNAME) {
RegIndex localNameRegIndex = getRegIndex(TypeTags.STRING);
RegIndex uriRegIndex = getRegIndex(TypeTags.STRING);
emit(InstructionCodes.S2QNAME, startTagNameRegIndex, localNameRegIndex, uriRegIndex);
startTagNameRegIndex = getRegIndex(TypeTags.XML);
generateURILookupInstructions(xmlElementLiteral.namespacesInScope, localNameRegIndex, uriRegIndex, startTagNameRegIndex, xmlElementLiteral.pos, xmlElementEnv);
tagName.regIndex = startTagNameRegIndex;
}
return startTagNameRegIndex;
}
use of org.wso2.carbon.registry.api.Registry in project carbon-business-process by wso2.
the class BPMNDataPublisher method getKPIConfiguration.
/**
* 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);
}
}
use of org.wso2.carbon.registry.api.Registry in project carbon-business-process by wso2.
the class BPELPackageRepository method createPropertiesForUpdatedDeploymentInfo.
/**
* Creates new properties for the details of updated deployment descriptor information
* for a process in the package location of the registry
*
* @param processConfiguration - Process's configuration details after updated
* @throws RegistryException on registry rollback error case, we'll init the cause to the
* original exception we got when accessing registry
* @throws IOException if file access error occurred during MD5 checksum generation
* @throws NoSuchAlgorithmException when there is a error during MD5 generation
* @throws ProcessManagementException
*/
public void createPropertiesForUpdatedDeploymentInfo(ProcessConfigurationImpl processConfiguration) throws RegistryException, IOException, NoSuchAlgorithmException, ProcessManagementException {
String versionlessPackageName = BPELPackageRepositoryUtils.getVersionlessPackageName(processConfiguration.getPackage());
String packageLocation = BPELPackageRepositoryUtils.getResourcePathForDeployInfoUpdatedBPELPackage(processConfiguration.getPackage(), versionlessPackageName);
Resource bpelPackage = configRegistry.get(packageLocation);
bpelPackage.setProperty(BPELConstants.BPEL_INSTANCE_CLEANUP_FAILURE + processConfiguration.getProcessId(), BPELPackageRepositoryUtils.getBPELPackageFailureCleanUpsAsString(processConfiguration.getCleanupCategories(false)));
bpelPackage.setProperty(BPELConstants.BPEL_INSTANCE_CLEANUP_SUCCESS + processConfiguration.getProcessId(), BPELPackageRepositoryUtils.getBPELPackageSuccessCleanUpsInList(processConfiguration.getCleanupCategories(true)));
bpelPackage.setProperty(BPELConstants.BPEL_PROCESS_EVENT_GENERATE + processConfiguration.getProcessId(), BPELPackageRepositoryUtils.getBPELPackageProcessGenerateType(processConfiguration.getGenerateType()));
bpelPackage.setProperty(BPELConstants.BPEL_PROCESS_EVENTS + processConfiguration.getProcessId(), BPELPackageRepositoryUtils.getBPELPackageProcessEventsInList(processConfiguration.getEvents()));
bpelPackage.setProperty(BPELConstants.BPEL_PROCESS_INMEMORY + processConfiguration.getProcessId(), String.valueOf(processConfiguration.isTransient()));
bpelPackage.setProperty(BPELConstants.BPEL_PROCESS_STATE + processConfiguration.getProcessId(), processConfiguration.getState().name());
// ScopeLevelEnabledEvents list of a process in a bpel package
List<String> scopeEvents;
scopeEvents = BPELPackageRepositoryUtils.getBPELPackageScopeEventsInList(processConfiguration.getEvents());
if (!scopeEvents.isEmpty()) {
for (int k = 0; k < scopeEvents.size(); k++) {
bpelPackage.setProperty(BPELConstants.BPEL_PROCESS_SCOPE_EVENT + (k + 1) + processConfiguration.getProcessId(), scopeEvents.get(k));
}
}
configRegistry.put(packageLocation, bpelPackage);
}
use of org.wso2.carbon.registry.api.Registry in project carbon-business-process by wso2.
the class BPELPackageRepository method handleExceptionWithRollback.
/**
* Handles exception and rollbacks an already started transaction. Don't use this method if
* you haven't already started a registry transaction
*
* @param msg - Message to log
* @param e - original exception
* @throws RegistryException on registry rollback error case, we'll init the cause to the
* original exception we got when accessing registry
*/
protected void handleExceptionWithRollback(String msg, Exception e) throws Exception {
Exception cachedException = null;
log.error(msg, e);
try {
configRegistry.rollbackTransaction();
} catch (RegistryException re) {
cachedException = re;
log.error("Transaction rollback failed", re);
}
if (cachedException != null) {
cachedException.initCause(e);
throw cachedException;
} else {
throw e;
}
}
use of org.wso2.carbon.registry.api.Registry in project carbon-business-process by wso2.
the class BPELPackageRepository method getVersionsOfPackage.
private List<String> getVersionsOfPackage(String packageLocation) throws RegistryException {
List<String> versions = new ArrayList<String>();
String versionsLocation = packageLocation + BPELConstants.BPEL_PACKAGE_VERSIONS;
// version
if (configRegistry.resourceExists(versionsLocation)) {
Resource versionsResource = configRegistry.get(versionsLocation);
// The above registry resource we retrieve only contains set of child collections.
// So we can directly cast the returned object to a string array.
String[] children = (String[]) versionsResource.getContent();
for (String child : children) {
versions.add(child.substring(child.lastIndexOf("/") + 1));
}
Collections.sort(versions, Utils.BY_VERSION);
}
return versions;
}
Aggregations