Examples of HelperContext


Examples of commonj.sdo.helper.HelperContext

   */
  public static List getMetaObjectInstanceProperties(EModelElement metaObject)
  {
    // Use the default helper context for now
  // TypeHelper typeHelper = HelperProvider.getDefaultContext().getTypeHelper();
      HelperContext hc = HelperProvider.getDefaultContext();
     
    List result = new UniqueEList();
    List annotations = metaObject.getEAnnotations();
    int size = annotations.size();
    for (int i=0; i<size; i++)
View Full Code Here

Examples of commonj.sdo.helper.HelperContext

        List children = handler.getChildren(document, op, true);
        assertEquals(5, children.size());
    }
   
    public void testCreate() {
        HelperContext context = HelperProvider.getDefaultContext();
        XSDHelper xsdHelper = context.getXSDHelper();
        xsdHelper.define(getClass().getResourceAsStream("/wrapper.xsd"), null);
        ElementInfo element = new ElementInfo(new QName("http://www.example.com/wrapper", "op"), null);
        Operation op = new OperationImpl();
        WrapperInfo wrapperInfo = new WrapperInfo(SDODataBinding.NAME, element, null, null, null);
        op.setWrapper(wrapperInfo);
View Full Code Here

Examples of commonj.sdo.helper.HelperContext

    @Override
    public boolean introspect(DataType dataType, final Operation operation) {
        final Class javaType = dataType.getPhysical();
        // Allow privileged access to read system properties. Requires PropertyPermission
        // java.specification.version read in security policy.
        final HelperContext context = AccessController.doPrivileged(new PrivilegedAction<HelperContext>() {
            public HelperContext run() {
                return SDOContextHelper.getHelperContext(operation);
            }
        });

        final Type type = context.getTypeHelper().getType(javaType);
        if (type == null) {
            // FIXME: Need a better to test dynamic SDO
            if (DataObject.class.isAssignableFrom(javaType)) {
                // Dynamic SDO
                dataType.setDataBinding(getName());
                if (dataType.getLogical() == null) {
                    dataType.setLogical(XMLType.UNKNOWN);
                }
                return true;
            }
            return false;
        }
        if (type.isDataType()) {
            // FIXME: Ignore simple types?
            return false;
        }

        // Found a SDO type, replace the default context with a private one
        AccessController.doPrivileged(new PrivilegedAction<Object>() {
            public Object run() {
                if (context == SDOContextHelper.getDefaultHelperContext()) {
                    HelperContext newContext = SDOUtil.createHelperContext();
                    SDOContextHelper.register(newContext, type);
                    if (operation != null) {
                        operation.getInputType().setMetaData(HelperContext.class, newContext);
                    }
                } else {
View Full Code Here

Examples of commonj.sdo.helper.HelperContext

        return xmlTypeHelper;
    }

    @Override
    public Object copy(Object arg, DataType dataType, DataType targetDataType, Operation operation, Operation targetOperation) {
        HelperContext context = SDOContextHelper.getHelperContext(operation);
        CopyHelper copyHelper = context.getCopyHelper();
        if (arg instanceof XMLDocument) {
            XMLDocument document = (XMLDocument)arg;
            DataObject dataObject = copyHelper.copy(document.getRootObject());
            return context.getXMLHelper().createDocument(dataObject,
                                                         document.getRootElementURI(),
                                                         document.getRootElementName());
        } else if (arg instanceof DataObject) {
            return context.getCopyHelper().copy((DataObject)arg);
        } else {
            return super.copy(arg, dataType, targetDataType, operation, targetOperation);
        }
    }
View Full Code Here

Examples of commonj.sdo.helper.HelperContext

       

        ElementInfo element = input ? wrapperInfo.getInputWrapperElement() :
            wrapperInfo.getOutputWrapperElement();
       
        HelperContext helperContext = SDOContextHelper.getHelperContext(operation);
        Type sdoType = getSDOType(helperContext, element);
        if (sdoType != null) {
            DataFactory dataFactory = helperContext.getDataFactory();
            return dataFactory.create(sdoType);
        }
        return null;
    }
View Full Code Here

Examples of commonj.sdo.helper.HelperContext

      

        ElementInfo element = input ? wrapperInfo.getInputWrapperElement() :
            wrapperInfo.getOutputWrapperElement();
       
        HelperContext helperContext = SDOContextHelper.getHelperContext(operation);
        Type sdoType = getSDOType(helperContext, element);
        if (sdoType != null) {
            // Check if child elements matches
            Class physical = sdoType.getInstanceClass();
            DataType<XMLType> wrapperType =
View Full Code Here

Examples of commonj.sdo.helper.HelperContext

        ElementInfo element = input ? wrapperInfo.getInputWrapperElement() :
            wrapperInfo.getOutputWrapperElement();
       
        //        List<ElementInfo> childElements =
        //            input ? wrapperInfo.getInputChildElements() : wrapperInfo.getOutputChildElements();
        HelperContext helperContext = SDOContextHelper.getHelperContext(operation);
        Type sdoType = getSDOType(helperContext, element);
        if (sdoType != null) {
            return sdoType.isInstance(wrapper);
        }
        return false;
View Full Code Here

Examples of commonj.sdo.helper.HelperContext

        argList.add(""); //bogus arg
        String[] args = argList.toArray(new String[argList.size()]);

        packageRegistry = new EPackageRegistryImpl(EPackage.Registry.INSTANCE);
        extendedMetaData = new BasicExtendedMetaData(packageRegistry);
        HelperContext hc = new HelperContextImpl(extendedMetaData, false);
        xsdHelper = hc.getXSDHelper();
        typeHelper = hc.getTypeHelper();

   
        processArguments(args);

        ((XSDHelperImpl)xsdHelper).setRedefineBuiltIn(generateBuiltIn);
View Full Code Here

Examples of commonj.sdo.helper.HelperContext

            // Load the config file into a stream
            fis = new FileInputStream(projectBuildDir + "/classes/generate/generate.xml");

            // Load the stream into SDO
            // We are just using SDO as a convenient way to parse the XML config file
            HelperContext scope       = SDOUtil.createHelperContext();
            GenerateFactory.INSTANCE.register(scope);
            XMLDocument xmlDoc        = scope.getXMLHelper().load(fis);
            GenerateType generateType = (GenerateType)xmlDoc.getRootObject();

            // Get the file list. This is the list of XSD that is passed into the
            // the velocity templates. Each configured file holds a list of types
            // that the velocity templates expand into appropriate methods and method calls          
View Full Code Here

Examples of commonj.sdo.helper.HelperContext

            // Load the config file into a stream
            fis = new FileInputStream(projectBuildDir + "/classes/generate/generate.xml");

            // Load the stream into SDO
            // We are just using SDO as a convenient way to parse the XML config file
            HelperContext scope       = SDOUtil.createHelperContext();
            GenerateFactory.INSTANCE.register(scope);
            XMLDocument xmlDoc        = scope.getXMLHelper().load(fis);
            GenerateType generateType = (GenerateType)xmlDoc.getRootObject();

            // Get the file list. This is the list of XSD that is passed into the
            // the velocity templates. Each configured file holds a list of types
            // that the velocity templates expand into appropriate methods and method calls          
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.