use of org.wso2.siddhi.core.stream.input.source.Source in project ballerina by ballerina-lang.
the class CodeGenerator method getWorkerDataChannelInfo.
private WorkerDataChannelInfo getWorkerDataChannelInfo(CallableUnitInfo callableUnit, String source, String target) {
WorkerDataChannelInfo workerDataChannelInfo = callableUnit.getWorkerDataChannelInfo(WorkerDataChannelInfo.generateChannelName(source, target));
if (workerDataChannelInfo == null) {
UTF8CPEntry sourceCPEntry = new UTF8CPEntry(source);
int sourceCPIndex = this.currentPkgInfo.addCPEntry(sourceCPEntry);
UTF8CPEntry targetCPEntry = new UTF8CPEntry(target);
int targetCPIndex = this.currentPkgInfo.addCPEntry(targetCPEntry);
workerDataChannelInfo = new WorkerDataChannelInfo(sourceCPIndex, source, targetCPIndex, target);
workerDataChannelInfo.setUniqueName(workerDataChannelInfo.getChannelName() + this.workerChannelCount);
String uniqueName = workerDataChannelInfo.getUniqueName();
UTF8CPEntry uniqueNameCPEntry = new UTF8CPEntry(uniqueName);
int uniqueNameCPIndex = this.currentPkgInfo.addCPEntry(uniqueNameCPEntry);
workerDataChannelInfo.setUniqueNameCPIndex(uniqueNameCPIndex);
callableUnit.addWorkerDataChannelInfo(workerDataChannelInfo);
this.workerChannelCount++;
}
return workerDataChannelInfo;
}
use of org.wso2.siddhi.core.stream.input.source.Source in project ballerina by ballerina-lang.
the class ASTBuilderUtil method generateArgExprs.
static List<BLangExpression> generateArgExprs(DiagnosticPos pos, List<BLangVariable> args, List<BVarSymbol> formalParams, SymbolResolver symResolver) {
List<BLangExpression> argsExpr = new ArrayList<>();
final List<BLangSimpleVarRef> variableRefList = createVariableRefList(pos, args);
for (int i = 0; i < variableRefList.size(); i++) {
BLangSimpleVarRef varRef = variableRefList.get(i);
BType target = formalParams.get(i).type;
BType source = varRef.symbol.type;
if (source != target) {
argsExpr.add(generateConversionExpr(varRef, target, symResolver));
continue;
}
argsExpr.add(varRef);
}
return argsExpr;
}
use of org.wso2.siddhi.core.stream.input.source.Source in project carbon-business-process by wso2.
the class BPELServerImpl method initDataSource.
/**
* Initialize the data source.
*
* @throws BPELEngineException If error occured while initializing datasource
*/
private void initDataSource() throws BPELEngineException {
db = new Database(odeConfigurationProperties);
db.setTransactionManager(transactionManager);
if (System.getProperty("setup") != null) {
BPELDatabaseCreator bpelDBCreator;
try {
bpelDBCreator = new BPELDatabaseCreator(db.<DataSource>lookupInJndi(odeConfigurationProperties.getDbDataSource()));
} catch (Exception e) {
String errMsg = "Error creating BPELDatabaseCreator";
log.error(errMsg, e);
throw new BPELEngineException(errMsg, e);
}
if (!bpelDBCreator.isDatabaseStructureCreated("SELECT * FROM ODE_SCHEMA_VERSION")) {
try {
// TODO rename following method
bpelDBCreator.createRegistryDatabase();
} catch (Exception e) {
String errMsg = "Error creating BPEL database";
log.error(errMsg, e);
throw new BPELEngineException(errMsg, e);
}
} else {
if (log.isDebugEnabled()) {
log.debug("BPEL database already exists. Using the old database.");
}
}
}
// In carbon, embedded H2 database for ODE is located at CARBON_HOME/repository/database
String dbRoot = CarbonUtils.getCarbonHome() + File.separator + "repository" + File.separator + "database";
File dbRootDir = new File(dbRoot);
if (dbRootDir.exists() && dbRootDir.isDirectory()) {
db.setWorkRoot(dbRootDir);
} else {
db.setWorkRoot(null);
}
try {
db.start();
} catch (Exception e) {
String errMsg = "Error starting database connections, check the database configuration!";
log.error(errMsg, e);
throw new BPELEngineException(errMsg, e);
}
}
use of org.wso2.siddhi.core.stream.input.source.Source in project carbon-business-process by wso2.
the class BPELServerConfiguration method populateDataSourceConfigFields.
private void populateDataSourceConfigFields() {
TDataBaseConfig databaseConfig = bpsConfigDocument.getWSO2BPS().getDataBaseConfig();
if (databaseConfig != null) {
// Now we do not have concept called EMBEDDED. All the DBs are configured as EXTERNAL.
// This way users can modify the default db config as well. And also support the
// -Dsetup
dsType = DataSourceType.EXTERNAL;
if (databaseConfig.getDataSource().getName() != null && databaseConfig.getDataSource().getName().length() > 0) {
dataSourceName = databaseConfig.getDataSource().getName();
} else {
throw new RuntimeException("Data Source name cannot be null, " + "when data source mode is external.");
}
if (databaseConfig.getDataSource().isSetJNDI()) {
TDataBaseConfig.DataSource.JNDI jndiConfig = databaseConfig.getDataSource().getJNDI();
if (jndiConfig.getContextFactory() != null && jndiConfig.getContextFactory().length() > 0 && jndiConfig.getProviderURL() != null && jndiConfig.getProviderURL().length() > 0) {
dataSourceJNDIRepoInitialContextFactory = jndiConfig.getContextFactory().trim();
dataSourceJNDIRepoProviderURL = jndiConfig.getProviderURL().trim();
// Read Port Offset
int portOffset = readPortOffset();
// applying port offset operation
String urlWithoutPort = dataSourceJNDIRepoProviderURL.substring(0, dataSourceJNDIRepoProviderURL.lastIndexOf(':') + 1);
int dataSourceJNDIRepoProviderPort = Integer.parseInt(dataSourceJNDIRepoProviderURL.substring(urlWithoutPort.length())) + portOffset;
dataSourceJNDIRepoProviderURL = urlWithoutPort + dataSourceJNDIRepoProviderPort;
}
}
}
}
use of org.wso2.siddhi.core.stream.input.source.Source in project carbon-business-process by wso2.
the class ProcessImpl method getLinkArrows.
/**
* Gets the Link arrow coordinates when there is a FLOW activity in the process
*
* @param doc SVG document which defines the components including shapes, gradients etc. of the process
* @return An element which contains the link arrow coordinates of the Process
*/
private Element getLinkArrows(SVGDocument doc) {
Element group = doc.createElementNS(SVGNamespace.SVG_NAMESPACE, "g");
// Checks whether the any links exist
if (links != null && !links.isEmpty()) {
// Returns a collection-view of the map with the link names, sources(starting activity) and the target
// (ending activity)
Set linksSet = links.entrySet();
Iterator linksIterator = linksSet.iterator();
// Iterates through the links
while (linksIterator.hasNext()) {
Map.Entry<String, Link> link = (Map.Entry<String, Link>) linksIterator.next();
// Gets the source/start activity of the link
ActivityInterface startActivity = link.getValue().getSource();
// Gets the target/end activity of the link
ActivityInterface endActivity = link.getValue().getTarget();
// Get the link name
String linkName = link.getKey();
// Check if the source and the target of the link contains a value
if (endActivity != null && startActivity != null) {
// Define the link flow/path by giving the coordinates of the start and end activity
group.appendChild(drawLink(doc, startActivity.getExitArrowCoords().getXLeft(), startActivity.getExitArrowCoords().getYTop(), endActivity.getEntryArrowCoords().getXLeft(), endActivity.getEntryArrowCoords().getYTop(), startActivity.getStartIconWidth(), link.getKey(), linkName));
}
}
}
return group;
}
Aggregations