Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[bpel-dev] Using BPELReader Class

Hello,

I have been trying to use the BPELReader class to read a .bpel file and obtain the BPEL process it defines, using the getProcess() method from that class.

Unfortunately, I haven't been able to make it work yet.

I am using the following code. I took most of it from some test cases I found and I have to admit, I don't really know what I am doing :)


File inputFile = new File("/home/damien/Workspaces/BPEL/org.example.loadbpel/bpel/ldiplom.bpel");

ResourceSet fResourceSet;

// Create the Quasi-Eclipse environment ...
AdapterRegistry.INSTANCE.registerAdapterFactory( new org.eclipse.bpel.validator.factory.AdapterFactory() ); AdapterRegistry.INSTANCE.registerAdapterFactory( BPELPackage.eINSTANCE, BasicBPELAdapterFactory.INSTANCE );

//      Create a resource set.
fResourceSet = new BPELResourceSetImpl();

// Register the resource factories for .bpel, .wsdl, and .xsd resources.
//   - bpel reads BPEL resources (our model)

fResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
  "bpel", new BPELResourceFactoryImpl()
);

fResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
  "wsdl", new WSDLResourceFactoryImpl()
);
//   - wsdl reads WSDL resources (from wst project)

// WSDL also needs to know about the extensions to WSDl that we provide, namely
// partner links, variable properties, etc.
// We need to register them someplace here ...

fResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
  "xsd", new XSDResourceFactoryImpl()
);
//   - xsd reads WSDL resources (from wst project)


fResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
  "fnmeta", new FMResourceFactoryImpl ()
);

// Register the real model query interface, that knows about EMF world as well.
ModelQueryImpl.register( new ModelQuery() );

// The function library is late bound. When eclipse is running, this information / / is registered via the plugin's descriptor. On its own, we have to do it another way.

FunctionLibrary.INSTANCE.registerLoader( new ClasspathFunctionRegistryLoader (fResourceSet) );

// To have a valid logger
BPELPlugin foo = new BPELPlugin();
BPELPlugin.Implementation impl = new BPELPlugin.Implementation();
//
//Step 1. Read the BPEL process using the Model API.
BPELReader reader = new BPELReader();

reader.read(inputFile, fResourceSet );
Process process = reader.getProcess();





Unfortunately, when I run this, it returns a null process and when looking into it, the parsing ends with the following error message "Fatal Error in file:/home/damien/Workspaces/BPEL/org.example.loadbpel/bpel/ldiplom.bpel [778:21] XML document structures must start and end within the same entity."

That surprises me since I can open this file without any problem using the BPEL Eclipse project.

Does anyone have any idea what I am doing wrong?

I would like to be able to manipulate the "process" of my BPEL file.

Many thanks in advance,

--
Damien Thivolle                   |     INRIA Rhone-Alpes / VASY
PHD Student                       |     655, Avenue de l'Europe
damien.thivolle@xxxxxxxx          |     Montbonnot
http://www.inrialpes.fr/vasy      |     38 334 Saint Ismier Cedex France


Back to the top