Examples of ModelObject


Examples of org.apache.tuscany.spi.model.ModelObject

        mockMonitor = EasyMock.createMock(LoaderRegistryImpl.Monitor.class);
        registry.setMonitor(mockMonitor);

        mockLoader = EasyMock.createMock(StAXElementLoader.class);
        mockReader = EasyMock.createMock(XMLStreamReader.class);
        modelObject = new ModelObject() {
        };
    }
View Full Code Here

Examples of org.apache.tuscany.spi.model.ModelObject

        Binding binding = null;
        ServiceContract serviceContract = null;
        while (true) {
            switch (reader.next()) {
                case START_ELEMENT:
                    ModelObject o = registry.load(parent, reader, deploymentContext);
                    if (o instanceof ServiceContract) {
                        serviceContract = (ServiceContract) o;
                    } else if (o instanceof Binding) {
                        binding = (Binding) o;
                    }
View Full Code Here

Examples of org.apache.tuscany.spi.model.ModelObject

                    if (REFERENCE.equals(reader.getName())) {
                        String text = reader.getElementText();
                        target = text != null ? text.trim() : null;
                    } else {

                        ModelObject o = registry.load(parent, reader, deploymentContext);
                        if (o instanceof ServiceContract) {
                            serviceContract = (ServiceContract) o;
                        } else if (o instanceof Binding) {
                            binding = (Binding) o;
                        }
View Full Code Here

Examples of org.apache.tuscany.spi.model.ModelObject

    protected Implementation<?> loadImplementation(CompositeComponent parent,
                                                   XMLStreamReader reader,
                                                   DeploymentContext deploymentContext)
        throws XMLStreamException, LoaderException {
        reader.nextTag();
        ModelObject o = registry.load(parent, reader, deploymentContext);
        if (!(o instanceof Implementation)) {
            throw new MissingImplementationException();
        }
        return (Implementation<?>) o;
    }
View Full Code Here

Examples of org.apache.tuscany.spi.model.ModelObject

                XMLInputFactory factory = ctx.getXmlFactory();
                reader = factory.createXMLStreamReader(is);
                try {
                    reader.nextTag();
                    QName name = reader.getName();
                    ModelObject mo = load(parent, reader, ctx);
                    if (type.isInstance(mo)) {
                        return type.cast(mo);
                    } else {
                        UnrecognizedElementException e = new UnrecognizedElementException(name);
                        e.setResourceURI(url.toString());
View Full Code Here

Examples of org.apache.tuscany.spi.model.ModelObject

            = new ComponentType<ServiceDefinition, ReferenceDefinition, Property<?>>();

        while (true) {
            switch (reader.next()) {
                case START_ELEMENT:
                    ModelObject o = registry.load(parent, reader, deploymentContext);
                    if (o instanceof ServiceDefinition) {
                        componentType.add((ServiceDefinition) o);
                    } else if (o instanceof ReferenceDefinition) {
                        componentType.add((ReferenceDefinition) o);
                    } else if (o instanceof Property) {
View Full Code Here

Examples of org.apache.tuscany.spi.model.ModelObject

        composite.setName(reader.getAttributeValue(null, "name"));
        boolean done = false;
        while (!done) {
            switch (reader.next()) {
                case START_ELEMENT:
                    ModelObject o = registry.load(parent, reader, deploymentContext);
                    if (o instanceof ServiceDefinition) {
                        composite.add((ServiceDefinition) o);
                    } else if (o instanceof ReferenceDefinition) {
                        composite.add((ReferenceDefinition) o);
                    } else if (o instanceof Property<?>) {
                        composite.add((Property<?>) o);
                    } else if (o instanceof ComponentDefinition<?>) {
                        composite.add((ComponentDefinition<? extends Implementation<?>>) o);
                    } else if (o instanceof Include) {
                        composite.add((Include) o);
                    } else if (o instanceof Dependency) {
                        Artifact artifact = ((Dependency) o).getArtifact();
                        if (artifactRepository != null) {
                            // default to jar type if not specified
                            if (artifact.getType() == null) {
                                artifact.setType("jar");
                            }
                            artifactRepository.resolve(artifact);
                        }
                        if (artifact.getUrl() != null) {
                            ClassLoader classLoader = deploymentContext.getClassLoader();
                            if (classLoader instanceof CompositeClassLoader) {
                                CompositeClassLoader ccl = (CompositeClassLoader)classLoader;
                                for (URL dep : artifact.getUrls()) {
                                    ccl.addURL(dep);
                                }
                            }
                        }
                    } else {
                        // HACK: [rfeng] Add as an unknown model extension
                        if (o != null) {
                            composite.getExtensions().put(o.getClass(), o);
                        }
                    }
                    reader.next();
                    break;
                case END_ELEMENT:
View Full Code Here

Examples of org.apache.tuscany.spi.model.ModelObject

        EasyMock.expect(reader.getName()).andReturn(DataTypeLoader.DATA_BINDING);
        EasyMock.expect(reader.getAttributeValue(null, "name")).andReturn("ABC");
        EasyMock.expect(reader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
        EasyMock.replay(reader);

        ModelObject mo = new DataTypeLoader(null).load(null, reader, null);
        Assert.assertTrue(mo instanceof DataType);
        Assert.assertEquals("ABC", ((DataType<?>)mo).getDataBinding());
        EasyMock.verify(reader);

        EasyMock.reset(reader);
View Full Code Here

Examples of org.dcarew.model.core.ModelObject

  public Object[] getChildren(Object parentElement)
  {
    if (parentElement instanceof ModelObject)
    {
      ModelObject modelObject = (ModelObject)parentElement;
     
      IModelClass modelClass = modelObject.getModelClass();
     
      IModelProperty[] properties = modelClass.getProperties();
     
      Object[] children = new Object[properties.length];
     
      for (int i = 0; i < properties.length; i++)
      {
        children[i] = modelObject.getPropertyValue(properties[i]);
      }
     
      return children;
    }
    else if (parentElement instanceof Collection)
View Full Code Here

Examples of org.exoplatform.portal.config.model.ModelObject

    protected static final Log log = ExoLogger.getLogger("portal:PortalDataMapper");

    @SuppressWarnings("unchecked")
    public static ModelObject buildModelObject(UIComponent uiComponent) {
        ModelObject model = null;
        if (uiComponent instanceof UIPortal) {
            model = toPortal((UIPortal) uiComponent);
        } else if (uiComponent instanceof UIPageBody) {
            model = new PageBody(((UIPageBody) uiComponent).getStorageId());
        } else if (uiComponent instanceof UIPage) {
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.