2016/05/28 - Apache Tuscany has been retired.

For more information, please explore the Attic.

 
 Apache Tuscany > Home > SDO Overview > SDO CPP > SDO CPP FAQ User List | Dev List | Issue Tracker  

Tuscany SDO - Frequently Asked Questions

  1. Does SDO for C++ provide a static interface as the Java implementation does?
    No. It is not clear that this is a useful feature in a language like C++ so we have no plans to implement it.
  2. How do I load an XML file using SDO static type?
    The basic pattern is fairly simple.
      // Get hold of a helper context. This holds an XMLHelper instance
      HelperContext scope = SDOUtil.createHelperContext();
       
      // Register all of the types we have generated into the HelperContext
      GenerateFactory.INSTANCE.register(scope);
    
      // A normal input stream to read the XML file
      fis = new FileInputStream("some.xml");
     
      // Use the HelperContext to get and XMLHelper and use this to load the XML
      XMLDocument xmlDoc = scope.getXMLHelper().load(fis);
    
      // Now we have a document we can get the root object and cast it to the expected type
      GenerateType generateType = (GenerateType)xmlDoc.getRootObject();
    

    There are some unit tests that show how to do this. You have to look in the tools tests cases as the Java static generator is in the tools project. Try looking in sdo\tools\src\test\java\org\apache\tuscany\sdo\test*.java.

website stats