use of org.wso2.carbon.registry.api.Registry in project carbon-business-process by wso2.
the class AnalyticsServerProfileBuilder method build.
/**
* Creates AnalyticsServerProfile for given tenant and Analytic profile.
*
* @return AnalyticsServerProfile instance
*/
public AnalyticsServerProfile build() {
AnalyticsServerProfile analyticsServerProfile = new AnalyticsServerProfile();
Registry registry;
String location;
if (profileLocation.startsWith(UnifiedEndpointConstants.VIRTUAL_CONF_REG)) {
try {
registry = BPELServiceComponent.getRegistryService().getConfigSystemRegistry(tenantId);
location = profileLocation.substring(profileLocation.indexOf(UnifiedEndpointConstants.VIRTUAL_CONF_REG) + UnifiedEndpointConstants.VIRTUAL_CONF_REG.length());
loadAnalyticsProfileFromRegistry(analyticsServerProfile, registry, location);
} catch (RegistryException re) {
String errMsg = "Error while loading Analytic profile from config registry.";
handleError(errMsg, re);
}
} else if (profileLocation.startsWith(UnifiedEndpointConstants.VIRTUAL_GOV_REG)) {
try {
registry = BPELServiceComponent.getRegistryService().getGovernanceSystemRegistry(tenantId);
location = profileLocation.substring(profileLocation.indexOf(UnifiedEndpointConstants.VIRTUAL_GOV_REG) + UnifiedEndpointConstants.VIRTUAL_GOV_REG.length());
loadAnalyticsProfileFromRegistry(analyticsServerProfile, registry, location);
} catch (RegistryException re) {
String errMsg = "Error while loading Analytic profile from governance registry.";
handleError(errMsg, re);
}
} else if (profileLocation.startsWith(UnifiedEndpointConstants.VIRTUAL_REG)) {
try {
registry = BPELServiceComponent.getRegistryService().getLocalRepository(tenantId);
location = profileLocation.substring(profileLocation.indexOf(UnifiedEndpointConstants.VIRTUAL_REG) + UnifiedEndpointConstants.VIRTUAL_REG.length());
loadAnalyticsProfileFromRegistry(analyticsServerProfile, registry, location);
} catch (RegistryException re) {
String errMsg = "Error while loading Analytic profile from local registry";
handleError(errMsg, re);
}
} else if (profileLocation.startsWith(UnifiedEndpointConstants.VIRTUAL_FILE)) {
location = profileLocation.substring(profileLocation.indexOf(UnifiedEndpointConstants.VIRTUAL_FILE) + UnifiedEndpointConstants.VIRTUAL_FILE.length());
loadAnalyticsProfileFromFileSystem(analyticsServerProfile, location);
} else {
String errMsg = "Invalid analytics profile location: " + profileLocation;
handleError(errMsg);
}
return analyticsServerProfile;
}
use of org.wso2.carbon.registry.api.Registry in project carbon-business-process by wso2.
the class BPELUploadExecutor method validateBPELPackage.
public void validateBPELPackage(String directoryPath) throws Exception {
DeploymentUnitDir du;
try {
du = new DeploymentUnitDir(new File(directoryPath));
} catch (IllegalArgumentException iae) {
log.error("BPEL Package Validation Failure.", iae);
throw new Exception("BPEL Package Validation Failure.", iae);
}
// check package for illegal charactors which registry does not support. (~!@#$;%^*()+={}[]|\<>)
List<File> packageFiles = du.allFiles();
for (File packageFile : packageFiles) {
if (!packageFile.getName().matches("[^\\~\\!\\@\\#\\$\\;\\%\\^\\*\\(\\)\\+ " + "/\\=\\{\\}\\[\\]\\\\|\\<\\>\"\\'\\`]+")) {
log.error("BPEL Package Validation Failure: one or many of the following illegal characters are in " + "the package.\n ~!@#$;%^*()+={}[]| \\<>\"'`");
throw new Exception("BPEL Package Validation Failure: one or many of the following illegal characters" + " " + "are in the package. ~!@#$;%^*()+={}[]| \\<>\"'`");
}
}
try {
du.compile();
} catch (RuntimeException ce) {
log.error("BPEL Process Compilation Failure.", ce);
throw new Exception("BPEL Compilation Failure!", ce);
} catch (Exception e) {
log.error("BPEL Process Compilation Failure.", e);
throw new Exception("BPEL Compilation Failure!", e);
}
du.scan();
DeployDocument dd = du.getDeploymentDescriptor();
for (TDeployment.Process processDD : dd.getDeploy().getProcessList()) {
QName processType = processDD.getType() != null ? processDD.getType() : processDD.getName();
DeploymentUnitDir.CBPInfo cbpInfo = du.getCBPInfo(processType);
if (cbpInfo == null) {
// removeDeploymentArtifacts(deploymentContext, du);
String logMessage = "Aborting deployment. Cannot find Process definition for type " + processType + ".";
log.error(logMessage);
throw new Exception(logMessage);
}
for (TProvide tProvide : processDD.getProvideList()) {
if (tProvide.getService() == null) {
String errMsg = "Service element missing for the provide element in deploy.xml";
log.error(errMsg);
throw new Exception(errMsg);
}
}
for (TInvoke tInvoke : processDD.getInvokeList()) {
if (tInvoke.getService() == null) {
String errMsg = "Service element missing for the invoke element in deploy.xml";
log.error(errMsg);
throw new Exception(errMsg);
}
}
}
}
use of org.wso2.carbon.registry.api.Registry in project carbon-business-process by wso2.
the class HumanTaskStore method createAxisServiceBuilder.
// Creates the AxisServiceBuilder object.
private WSDL11ToAxisServiceBuilder createAxisServiceBuilder(HumanTaskBaseConfiguration taskConfig, Definition wsdlDef) {
WSDL11ToAxisServiceBuilder serviceBuilder = new WSDL11ToAxisServiceBuilder(wsdlDef, taskConfig.getServiceName(), taskConfig.getPortName());
String wsdlBaseURI = wsdlDef.getDocumentBaseURI();
serviceBuilder.setBaseUri(wsdlBaseURI);
/*we don't need custom resolvers since registry takes care of it*/
serviceBuilder.setCustomResolver(new DefaultURIResolver());
URI wsdlBase = null;
try {
wsdlBase = new URI(convertToVaildURI(wsdlBaseURI));
} catch (Exception e) {
String error = "Error occurred while creating AxisServiceBuilder.";
log.error(error);
}
serviceBuilder.setCustomWSDLResolver(new HumanTaskWSDLLocator(wsdlBase));
serviceBuilder.setServerSide(true);
return serviceBuilder;
}
use of org.wso2.carbon.registry.api.Registry in project carbon-business-process by wso2.
the class HumanTaskPackageRepository method addLatestArchiveToRegistryCollection.
/**
* Add latest human task package zip to the registry
*
* @param humanTaskDeploymentUnit
* @param humanTaskFile
* @throws HumanTaskStoreException
* @throws RegistryException
*/
private void addLatestArchiveToRegistryCollection(HumanTaskDeploymentUnit humanTaskDeploymentUnit, File humanTaskFile) throws HumanTaskStoreException, RegistryException {
FileInputStream fileInputStream = null;
try {
Resource latestHumanTaskArchive = configRegistry.newResource();
fileInputStream = new FileInputStream(humanTaskFile);
latestHumanTaskArchive.setContent(fileInputStream);
configRegistry.put(HumanTaskPackageRepositoryUtils.getHumanTaskPackageArchiveResourcePath(humanTaskDeploymentUnit.getPackageName()), latestHumanTaskArchive);
} catch (FileNotFoundException ex) {
String errMsg = "HumanTask package zip file couldn't found on given location " + humanTaskFile.getAbsolutePath();
throw new HumanTaskStoreException(errMsg, ex);
} catch (RegistryException ex) {
String errMsg = "Exception occurred while adding latest archive to registry collection";
throw new RegistryException(errMsg, ex);
} finally {
if (fileInputStream != null) {
try {
fileInputStream.close();
} catch (IOException e) {
log.warn("Cannot close file input stream.", e);
}
}
}
}
use of org.wso2.carbon.registry.api.Registry in project carbon-business-process by wso2.
the class HumanTaskPackageRepository method createHumanTaskPackageParentCollectionWithProperties.
/**
* Create parent collection for human task package using DeploymentUnitDAO
*
* @param deploymentUnitDAO
* @throws RegistryException
*/
private void createHumanTaskPackageParentCollectionWithProperties(DeploymentUnitDAO deploymentUnitDAO) throws RegistryException {
Collection humanPackage = configRegistry.newCollection();
humanPackage.setProperty(HumanTaskConstants.HUMANTASK_PACKAGE_PROP_LATEST_CHECKSUM, deploymentUnitDAO.getChecksum());
if (log.isDebugEnabled()) {
log.debug(deploymentUnitDAO.getPackageName() + " updating checksum: " + deploymentUnitDAO.getChecksum() + " in registry");
}
humanPackage.setProperty(HumanTaskConstants.HUMANTASK_PACKAGE_PROP_STATUS, String.valueOf(deploymentUnitDAO.getStatus()));
humanPackage.setProperty(HumanTaskConstants.HUMANTASK_PACKAGE_PROP_LATEST_VERSION, Long.toString(deploymentUnitDAO.getVersion()));
configRegistry.put(HumanTaskPackageRepositoryUtils.getResourcePathForHumanTaskPackage(deploymentUnitDAO), humanPackage);
}
Aggregations