Hi All,
I have some ecore models that I want to load directly, rather than
exporting them to a schema and using XSDHelper to load them in.
I have experimented with the Tuscany SDO 1.0rc2 (May 2007 ) to and
loaded + used the model successfully...
The code I was using stopped working in Tuscany SDO 1.0 release (August
2007). and I made the changes below..
Anyway, I get the model loaded and when I call
somedo.getInstanceProperty("name") it fails and their are no attributes ?
When I dump somedo.getInstanceProperties() I see only Reference and
no Attributes ?
I am unable to share my models but I can make some sample models+code if
someone is willing to help ?
//////////////////////////////////////////////////////////
For 1.0 rc2
//////////////////////////////////////////////////////////
public class CreateSDODatagraph {
// TODO this is a hack need to figure out how to properly initialize
// SDOEcoreFactory...
// thepack is hack something change in the initialization code that
cuased problems...
private static EcorePackage thepack = EcorePackage.eINSTANCE;
static {
EPackage.Registry.INSTANCE.put(EcorePackage.eNS_URI,
new EPackage.Descriptor() {
public EPackage getEPackage() {
return thepack;
}
public EFactory getEFactory() {
return new SDOFactoryImpl.SDOEcoreFactory();
}
});
}
public void loadModel(URI uri) {
Resource r =
datagraph.getResourceSet().getResource(uriConverter.normalize(uri), true);
EPackage pack = getEPackage(r);
//String prefix = pack.getNsPrefix();
String namespace = pack.getNsURI();
// Do both just in case ...
EPackage.Registry.INSTANCE.put(namespace, pack);
datagraph.getResourceSet().getPackageRegistry().put(namespace,
pack);
pack.setEFactoryInstance(new DynamicDataObjectImpl.FactoryImpl());
}
............
}
/////////////////////////////////
For 1.0
///////////////////////////////
public void init(){
....
EcorePackage.eINSTANCE.setEFactoryInstance(new
SDOFactoryImpl.SDOEcoreFactory());
....
}
public void loadModel(URI uri) {
// internally the normalized URI is used to resolve
inter-related models
Resource r = datagraph.getResourceSet().getResource(
uriconverter.normalize(uri), true);
EPackage pack = getEPackage(r);
String prefix = pack.getNsPrefix();
String namespace = pack.getNsURI();
// EPackage.Registry.INSTANCE.put(namespace, pack);
HelperContextImpl.getBuiltInModelRegistry().put(namespace, pack);
pack.setEFactoryInstance(new DynamicDataObjectImpl.FactoryImpl());
prefix2namespace.put(prefix, namespace);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]