_oprocess.constants = makeConstants();
_oprocess.debugInfo = createDebugInfo(process, "process");
if (process.getTargetNamespace() == null) {
_oprocess.targetNamespace = "--UNSPECIFIED--";
recoveredFromError(process, new CompilationException(__cmsgs.errProcessNamespaceNotSpecified()));
} else {
_oprocess.targetNamespace = _processDef.getTargetNamespace();
}
if (process.getName() == null) {
_oprocess.processName = "--UNSPECIFIED--";
recoveredFromError(process, new CompilationException(__cmsgs.errProcessNameNotSpecified()));
} else {
_oprocess.processName = _processDef.getName();
}
_oprocess.compileDate = _generatedDate;
_konstExprLang = new OExpressionLanguage(_oprocess, null);
_konstExprLang.debugInfo = createDebugInfo(_processDef, "Constant Value Expression Language");
_konstExprLang.expressionLanguageUri = "uri:www.fivesight.com/konstExpression";
_konstExprLang.properties.put("runtime-class",
"org.apache.ode.bpel.runtime.explang.konst.KonstExpressionLanguageRuntimeImpl");
_oprocess.expressionLanguages.add(_konstExprLang);
// Process the imports. Note, we expect all processes (Event BPEL 1.1)
// to have an import declaration. This should be automatically generated
// by the 1.1 parser.
for (Import imprt : _processDef.getImports()) {
try {
compile(_processURI, imprt);
} catch (CompilationException bce) {
// We try to recover from import problems by continuing
recoveredFromError(imprt, bce);
}
}
switch (_processDef.getSuppressJoinFailure()) {
case NO:
case NOTSET:
_supressJoinFailure = false;
break;
case YES:
_supressJoinFailure = true;
break;
}
// compile ALL wsdl properties; needed for property extraction
Definition4BPEL[] defs = _wsdlRegistry.getDefinitions();
for (Definition4BPEL def : defs) {
for (Property property : def.getProperties()) {
compile(property);
}
}
// compile ALL wsdl property aliases
for (Definition4BPEL def1 : defs) {
for (PropertyAlias propertyAlias : def1.getPropertyAliases()) {
compile(propertyAlias);
}
}
OScope procesScope = new OScope(_oprocess, null);
procesScope.name = "__PROCESS_SCOPE:" + process.getName();
procesScope.debugInfo = createDebugInfo(process, null);
_oprocess.procesScope = compileScope(procesScope, process, new Runnable() {
public void run() {
if (process.getRootActivity() == null) {
throw new CompilationException(__cmsgs.errNoRootActivity());
}
// Process custom properties are created as variables associated
// with the top scope
if (_customProcessProperties != null) {
for (Map.Entry<QName, Node> customVar : _customProcessProperties.entrySet()) {
final OScope oscope = _structureStack.topScope();
OVarType varType = new OConstantVarType(_oprocess, customVar.getValue());
OScope.Variable ovar = new OScope.Variable(_oprocess, varType);
ovar.name = customVar.getKey().getLocalPart();
ovar.declaringScope = oscope;
ovar.debugInfo = createDebugInfo(null, "Process custom property variable");
oscope.addLocalVariable(ovar);
if (__log.isDebugEnabled())
__log.debug("Compiled custom property variable " + ovar);
}
}
_structureStack.topScope().activity = compile(process.getRootActivity());
}
});
assert _structureStack.size() == 0;
boolean hasErrors = false;
StringBuffer sb = new StringBuffer();
for (CompilationMessage msg : _errors) {
if (msg.severity >= CompilationMessage.ERROR) {
hasErrors = true;
sb.append('\t');
sb.append(msg.toErrorString());
sb.append('\n');
}
}
if (hasErrors) {
throw new CompilationException(__cmsgs.errCompilationErrors(_errors.size(), sb.toString()));
}
return _oprocess;
}