Examples of TypeHelper


Examples of commonj.sdo.helper.TypeHelper

  }
 
  public void testDefineSequencedType() throws Exception
  {
   
    TypeHelper types = SDOUtil.createTypeHelper();
    DataFactory factory = SDOUtil.createDataFactory(types);
    XMLHelper xmlHelper = SDOUtil.createXMLHelper(types);
   
    Type stringType = types.getType("commonj.sdo", "String");
    Type decimalType = types.getType("commonj.sdo", "Decimal");
   
    // Define a new mixed type - MixedQuote
    DataObject mixedQuoteType = factory.create("commonj.sdo", "Type");
    mixedQuoteType.set("uri", "http://www.example.com/mixed");
    mixedQuoteType.set("name", "MixedQuote");
    mixedQuoteType.set("sequenced", Boolean.TRUE);
   
    DataObject symbolProperty = mixedQuoteType.createDataObject("property");
    symbolProperty.set("name", "symbol");
    symbolProperty.set("type", stringType);
   
    DataObject companyNameProperty = mixedQuoteType.createDataObject("property");
    companyNameProperty.set("name", "companyName");
    companyNameProperty.set("type", stringType);
   
    DataObject priceProperty = mixedQuoteType.createDataObject("property");
    priceProperty.set("name", "price");
    priceProperty.set("type", decimalType);
   
    DataObject quotesProperty = mixedQuoteType.createDataObject("property");
    quotesProperty.set("name", "quotes");
    quotesProperty.set("type", mixedQuoteType);
    quotesProperty.set("many", Boolean.TRUE);
    quotesProperty.set("containment", Boolean.TRUE);
   
    types.define(mixedQuoteType);
   
    DataObject quote = factory.create("http://www.example.com/mixed", "MixedQuote");

    assertTrue(quote.getType().isSequenced());
   
View Full Code Here

Examples of commonj.sdo.helper.TypeHelper

  }
 
  public void testDefineSequencedOpenType() throws Exception
  {
   
    TypeHelper types = SDOUtil.createTypeHelper();
    DataFactory factory = SDOUtil.createDataFactory(types);
    XMLHelper xmlHelper = SDOUtil.createXMLHelper(types);
   
    Type stringType = types.getType("commonj.sdo", "String");
    Type decimalType = types.getType("commonj.sdo", "Decimal");
   
    // Define a new mixed type - MixedQuote
    DataObject mixedQuoteType = factory.create("commonj.sdo", "Type");
    mixedQuoteType.set("uri", "http://www.example.com/mixed");
    mixedQuoteType.set("name", "MixedOpenQuote");
    mixedQuoteType.set("sequenced", Boolean.TRUE);
    mixedQuoteType.set("open", Boolean.TRUE);
   
//    DataObject symbolProperty = mixedQuoteType.createDataObject("property");
//    symbolProperty.set("name", "symbol");
//    symbolProperty.set("type", stringType);
   
    DataObject companyNameProperty = mixedQuoteType.createDataObject("property");
    companyNameProperty.set("name", "companyName");
    companyNameProperty.set("type", stringType);
   
    DataObject priceProperty = mixedQuoteType.createDataObject("property");
    priceProperty.set("name", "price");
    priceProperty.set("type", decimalType);
   
    DataObject quotesProperty = mixedQuoteType.createDataObject("property");
    quotesProperty.set("name", "quotes");
    quotesProperty.set("type", mixedQuoteType);
    quotesProperty.set("many", Boolean.TRUE);
    quotesProperty.set("containment", Boolean.TRUE);
   
    types.define(mixedQuoteType);
   
    // Define a global type
    DataObject globalType = factory.create("commonj.sdo", "Type");
    globalType.set("uri", "http://www.example.com/open");
    // Don't set the type's name - null is used for types containing global properties.
   
    DataObject symbolProperty = globalType.createDataObject("property");
    symbolProperty.set("name", "symbol");
    symbolProperty.set("type", stringType);
    symbolProperty.set("containment", Boolean.TRUE);
   
    types.define(globalType);
   
    DataObject quote = factory.create("http://www.example.com/mixed", "MixedOpenQuote");

    assertTrue(quote.getType().isSequenced());
   
    Sequence sequence = quote.getSequence();

    sequence.add("\n  ");

    Type definedGlobalType = types.getType("http://www.example.com/open", null);
   
    Property definedSymbolProperty = definedGlobalType.getProperty("symbol");
    quote.setString(definedSymbolProperty, "fbnt");

    sequence.add("\n  ");
View Full Code Here

Examples of commonj.sdo.helper.TypeHelper

  }

 
  public void testDefineOpenType() throws Exception
  {
    TypeHelper types = SDOUtil.createTypeHelper();
    DataFactory factory = SDOUtil.createDataFactory(types);
    XMLHelper xmlHelper = SDOUtil.createXMLHelper(types);
   
    Type stringType = types.getType("commonj.sdo", "String");
    Type decimalType = types.getType("commonj.sdo", "Decimal");
   
    // Define a new open type - OpenQuote
    DataObject openQuoteType = factory.create("commonj.sdo", "Type");
    openQuoteType.set("uri", "http://www.example.com/open");
    openQuoteType.set("name", "OpenQuote");
    openQuoteType.set("open", Boolean.TRUE);
    openQuoteType.setBoolean("open", true);
   
    types.define(openQuoteType);
   
    // Define new type - CompanyType
    DataObject companyType = factory.create("commonj.sdo", "Type");
    companyType.set("uri", "http://www.example.com/open");
    companyType.set("name", "CompanyType");
   
    // Create CompanyType property - "name"
    DataObject nameProperty = companyType.createDataObject("property");
    nameProperty.set("name", "name");
    nameProperty.set("type", stringType);
    nameProperty.set("containment", Boolean.TRUE);
   
    types.define(companyType);
   
    // Define a global type
    DataObject globalType = factory.create("commonj.sdo", "Type");
    globalType.set("uri", "http://www.example.com/open");
    // Don't set the type's name - null is used for types containing global properties.
   
    DataObject symbolProperty = globalType.createDataObject("property");
    symbolProperty.set("name", "symbol");
    symbolProperty.set("type", stringType);
    symbolProperty.set("containment", Boolean.TRUE);
   
    // Define a global property - company
    DataObject companyProperty = globalType.createDataObject("property");
    companyProperty.set("name", "company");
    companyProperty.set("type", companyType);
    companyProperty.set("containment", Boolean.TRUE);
   
    // Define a global property - price
    DataObject priceProperty = globalType.createDataObject("property");
    priceProperty.set("name", "price");
    priceProperty.set("type", decimalType);
   
    types.define(globalType);
   
    // Create DataObject instances
    DataObject openQuote = factory.create("http://www.example.com/open", "OpenQuote");
   
    assertTrue(openQuote.getType().isOpen());
   
    // Get global type
    Type definedGlobalType = types.getType("http://www.example.com/open", null);
   
    Property definedSymbolProperty = definedGlobalType.getProperty("symbol");
    openQuote.set(definedSymbolProperty, "s1");
   
    Property definedCompanyProperty = definedGlobalType.getProperty("company");
View Full Code Here

Examples of commonj.sdo.helper.TypeHelper

        Definition wsdlDefinition = wsBinding.getWSDLDefinition();
        WebServicePortMetaData wsPortMetaData = new WebServicePortMetaData(wsdlDefinition, wsBinding.getWSDLPort(), wsBinding.getURI(), false);

        ServiceClient serviceClient = createServiceClient(externalService.getName(), wsdlDefinition, wsPortMetaData);

        TypeHelper typeHelper = wsBinding.getTypeHelper();
        ClassLoader cl = wsBinding.getResourceLoader().getClassLoader();
        Class serviceInterface = externalService.getConfiguredService().getPort().getServiceContract().getInterface();
        Map<String, Axis2OperationInvoker> invokers = createOperationInvokers(serviceInterface, typeHelper, cl, wsPortMetaData);

        Axis2ServiceInvoker axis2Client = new Axis2ServiceInvoker(serviceClient, invokers);
View Full Code Here

Examples of commonj.sdo.helper.TypeHelper

        axisService.setName(entryPointName);
        // axisService.setParent(serviceGroup);
        axisService.setServiceDescription("Tuscany configured AxisService for EntryPoint: '" + entryPointName + '\'');

        TypeHelper typeHelper = wsBinding.getTypeHelper();
        ClassLoader cl = wsBinding.getResourceLoader().getClassLoader();

        Class<?> serviceInterface = entryPointContext.getServiceInterface();

        PortType wsdlPortType = wsdlPortInfo.getPortType();
View Full Code Here

Examples of commonj.sdo.helper.TypeHelper

    private E4XDataBinding dataBinding;

    protected void setUp() throws Exception {
        super.setUp();
        this.script = readResource(scriptName);
        TypeHelper th = SDOUtil.createTypeHelper();
        XSDHelper xsdHelper = new XSDHelperImpl(th);
        URL url = getClass().getResource("helloworld.wsdl");
        xsdHelper.define(url.openStream(), null);

        dataBinding = new E4XDataBinding(getClass().getClassLoader(),th);
View Full Code Here

Examples of commonj.sdo.helper.TypeHelper

    /**
     * Create the data binding for the component initialized for each operation in the service
     */
    protected E4XDataBinding createDataBinding(JavaScriptImplementation jsImplementation) {
        ClassLoader classLoader = jsImplementation.getResourceLoader().getClassLoader();
        TypeHelper typeHelper = jsImplementation.getTypeHelper();
        E4XDataBinding dataBinding = new E4XDataBinding(classLoader, typeHelper);
        for (Service service : jsImplementation.getComponentType().getServices()) {
            ServiceContract sc = service.getServiceContract();
            if (sc instanceof WSDLServiceContract) {
                PortType pt = ((WSDLServiceContract) sc).getPortType();
View Full Code Here

Examples of commonj.sdo.helper.TypeHelper

   */
  private void createTypesViaAPI(HelperContext scope) throws Exception {

    List typeDeclarations = new ArrayList();

    TypeHelper typeHelper = scope.getTypeHelper();

    Type stringType = typeHelper.getType(sdoApiUri, "String");
    Type dateType = typeHelper.getType(sdoApiUri, "Date");
    Type booleanType = typeHelper.getType(sdoApiUri, "Boolean");

    // <complexType name="Person">
    // <sequence>
    // <element name="dob" type="date"/>
    // <element name="relative" maxOccurs="unbounded" type="tns:Relative"/>
    // <any namespace="##other" processContents="lax" maxOccurs="unbounded"/>
    // </sequence>
    // <attribute name="id" type="ID"/>
    // <attribute name="name" type="string"/>
    // <attribute name="gender" type = "tns:Gender"/>
    // </complexType>

    DataObject personTypeDesc = createTypeDescription(scope, peopleURI,
        "Person");
    typeDeclarations.add(personTypeDesc);

    addPropertyDescription(personTypeDesc, stringType, "name");
    addPropertyDescription(personTypeDesc, dateType, "dob");
    addPropertyDescription(personTypeDesc, stringType, "id"); // set to unique
    // identifier?
    addPropertyDescription(personTypeDesc, stringType, "gender"); // restrict?

    DataObject relativeType = createTypeDescription(scope, peopleURI,
        "Relative"); // forward declare the Relative type
    typeDeclarations.add(relativeType);

    DataObject rp = addPropertyDescription(personTypeDesc, relativeType,
        "relative");
    rp.setBoolean("many", true);
    personTypeDesc.set("open", Boolean.TRUE);

    // <complexType name="Relative">
    // <attribute name="target" type="IDREF" sdoxml:propertyType="tns:Person"
    // use="required"/>
    // <attribute name="relationship" type="string" />
    // <attribute name="genetic" use="optional" type="boolean"/>
    // </complexType>

    addPropertyDescription(relativeType, stringType, "relationship");
    addPropertyDescription(relativeType, booleanType, "genetic");
    DataObject targetPersonProp = addPropertyDescription(relativeType,
        personTypeDesc, "target");
    targetPersonProp.setBoolean("containment", false);

    // <complexType name="PersonSet">
    // <sequence>
    // <element name="person" type="tns:Person" maxOccurs="unbounded"/>
    // </sequence>
    // </complexType>

    DataObject pSet = createTypeDescription(scope, peopleURI, "PersonSet");
    typeDeclarations.add(pSet);
    DataObject pSetProperty = addPropertyDescription(pSet, personTypeDesc,
        "person");
    pSetProperty.setBoolean("many", true);

    // <complexType name="Condition">
    // <sequence>
    // <element name="diagnosed" type="date" />
    // </sequence>
    // <attribute name="name" type="tns:ConditionName" />
    // </complexType>

    DataObject condition = createTypeDescription(scope, medicalURI, "Condition");
    typeDeclarations.add(condition);
    addPropertyDescription(condition, booleanType, "diagnosed");
    addPropertyDescription(condition, stringType, "name"); // constrain?

    // <complexType name="Test">
    // <sequence>
    // <element name="referrals" type="people:PersonSet" />
    // <element name="patients" type="people:PersonSet" />
    // <element name="relatives" type="people:PersonSet" />
    // </sequence>
    // </complexType>

    DataObject testType = createTypeDescription(scope, medicalURI, "Test");
    typeDeclarations.add(testType);
    addPropertyDescription(testType, pSet, "referrals");
    addPropertyDescription(testType, pSet, "patients");
    addPropertyDescription(testType, pSet, "relatives");

    List types = typeHelper.define(typeDeclarations);

    DataObject p = scope.getDataFactory().create("commonj.sdo", "Property");
    p.set("type", typeHelper.getType(medicalURI, "Condition"));
    p.set("name", "condition");
    p.setBoolean("many", true);
    p.setBoolean("containment", true); // why is this not the default?

    typeHelper.defineOpenContentProperty(medicalURI, p);

  }
View Full Code Here

Examples of commonj.sdo.helper.TypeHelper

            types[i - 1] = typeMap.getType(metadata.getColumnType(i), true);
        }
    }

    public ResultSetShape(List resultDescriptor) {
        TypeHelper helper = TypeHelper.INSTANCE;
        int size = resultDescriptor.size();
        columns = new String[size];
        tables = new String[size];
        types = new Type[size];

        for (int i = 0; i < size; i++) {
            ResultDescriptor desc = (ResultDescriptor) resultDescriptor.get(i);
            tables[i] = desc.getTableName();
            columns[i] = desc.getColumnName();

            int idx = desc.getColumnType().lastIndexOf('.');
            String uri = desc.getColumnType().substring(0, idx);
            String typeName = desc.getColumnType().substring(idx + 1);

            types[i] = helper.getType(uri, typeName);
            if (types[i] == null) {
                throw new RuntimeException("Could not find type " + desc.getColumnType()
                        + " for column " + desc.getColumnName());
            }
        }
View Full Code Here

Examples of commonj.sdo.helper.TypeHelper

        if (config.getDataObjectModel() == null) {
            throw new RuntimeException("DataObjectModel must be specified in the Config");
        }

        String uri = "http:///org.apache.tuscany.das.rdb/das";
        TypeHelper typeHelper = SDOUtil.createTypeHelper();
        Type rootType = SDOUtil.createType(typeHelper, uri + "/DataGraphRoot", "DataGraphRoot", false);

        List types = SDOUtil.getTypes(typeHelper, config.getDataObjectModel());
        if (types == null) {
            throw new RuntimeException("SDO Types have not been registered for URI " + config.getDataObjectModel());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.