
throws BPELException {
super(tag, elmt, parent);
//Some specific stuff related to MyExtendedActivityImpl
}
@Override
public void validate(BPELStaticAnalysis analyzer) {
//Some specific stuff related to MyExtendedActivityImpl
}
@Override
public Node generate(Scope scope) throws CoreException {
//Some specific stuff related to MyExtendedActivityImpl
}
@Override
protected TMyExtendedActivity convertElementToModel(Element elmt)
throws BPELException {
TMyExtendedActivity res = null;
try {
JAXBElement<TMyExtendedActivity> jaxb = this.getJaxbContext().createUnmarshaller().unmarshal(elmt, TMyExtendedActivity.class);
res = jaxb.getValue();
} catch (JAXBException e) {
throw new BPELException(e);
} catch(SchemaException e){
throw new BPELException(e);
}
return res;
}
}
{code}
You have to fill the constructor (at least with a {{super()}} method), the {{convertElementToModel()}}, {{validate()}} and {{generate()}} methods.
The {{validate}} method SHOULD be filled whereas the {{generate}} method MUST be filled. It consists basically in instantiating the extended behavior developed at EasyVIPER level. Here is an example of {{generate}} method:
{code:title=MyExtendedActivityImpl.java excerpt|borderStyle=solid}
@Override
public Node generate(Scope scope) throws CoreException {
MyExtendedBehavior myExtendedBehavior = new MyExtendedBehaviorImpl();
// myExtendedBehavior.foo()
Node behaviourNode = scope.createNode(this.model.getName(), myExtendedBehavior);
return behaviourNode;
}
{code}
Your extended activity is completed. You only needs to add it in dependency of your BPEL engine and to set or create an ExtendedActivityInitialization.xml file that can be found for instance in the src/main/jbi of the JBI component that embeds EasyBPEL.
{code:xml|title=ExtendedActivityInitialization.xml|borderStyle=solid}
<?xml version="1.0" encoding="UTF-8"?>
<tns:ExtendedActivitiesInitialization
xmlns:tns="http://com.ebmwebsourcing.easybpel/ExtendedActivityInitialization"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://com.ebmwebsourcing.easybpel/ExtendedActivityInitialization
../../main/resources/ExtendedActivityInitialization.xsd ">
<tns:extendedActivityInitialization>
<tns:definition>MyExtendedActivityPackageConfiguration.xml</tns:definition>
<tns:implementation>mypackage.MyExtendedActivityImpl-....jar</tns:implementation>
</tns:extendedActivityInitialization>
</tns:ExtendedActivitiesInitialization>
{code}
You can see in {{definition}} a file is set, that must be present in the extended activity project and that contains configuration. This configuratioon file details what is the namespace of the extended activity, and for each activity of this namespace, the tag associated to the extended activity (in the taken example, there was only one extended activity).
{code:xml|title=MyExtendedActivityPackageConfiguration.xml|borderStyle=solid}
<?xml version="1.0" encoding="UTF-8"?>
<tns:ExtendedActivityConfigurationList
xmlns:tns="http://com.ebmwebsourcing.easybpel/ExtendedActivityConfiguration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:my="http://mynamespace/mypackage/MyExtendedActivity">
<tns:extendedActivityConf>
<tns:tag>my:myactivity</tns:tag>
<tns:className>mypackage.MyExtendedActivityImpl</tns:className>
</tns:extendedActivityConf>
[...]
</tns:ExtendedActivityConfigurationList>
{code}