Package org.andromda.core.configuration

Examples of org.andromda.core.configuration.Transformation


                    final TransformerFactory factory = TransformerFactory.newInstance();
                    final TransformerURIResolver resolver = new TransformerURIResolver();
                    factory.setURIResolver(resolver);
                    for (final Iterator xsltIterator = xslts.iterator(); xsltIterator.hasNext();)
                    {
                        final Transformation transformation = (Transformation)xsltIterator.next();
                        final URL xslt = new URL(transformation.getUri());
                        resolver.setLocation(xslt);
                        if (xslt != null)
                        {
                            AndroMDALogger.info("Applying transformation --> '" + xslt + "'");
                            final Source xsltSource = new StreamSource(xslt.openStream());
                            final javax.xml.transform.Transformer transformer = factory.newTransformer(xsltSource);
                            final ByteArrayOutputStream output = new ByteArrayOutputStream();
                            final Result result = new StreamResult(output);
                            transformer.transform(modelSource, result);
                            final byte[] outputResult = output.toByteArray();
                            stream = new ByteArrayInputStream(outputResult);
   
                            // if we have an output location specified, write the result
                            final String outputLocation = transformation.getOutputLocation();
                            if (StringUtils.isNotBlank(outputLocation))
                            {
                                final File fileOutput = new File(outputLocation);
                                final File parent = fileOutput.getParentFile();
                                if (parent != null)
View Full Code Here


        assertNotNull(modelUrl);
        URL transformation1Uri = XslTransformerTest.class.getResource("transformation1.xsl");
        assertNotNull(transformation1Uri);
        URL transformation2Uri = XslTransformerTest.class.getResource("transformation2.xsl");
        assertNotNull(transformation2Uri);
        Transformation transformation1 = new Transformation();
        transformation1.setUri(transformation1Uri.toString());
        Transformation transformation2 = new Transformation();
        transformation2.setUri(transformation2Uri.toString());
        Transformation[] transformations = new Transformation[] {transformation1, transformation2};
        InputStream stream = transformer.transform(modelUrl.toString(), transformations);
        assertNotNull(stream);
    }
View Full Code Here

TOP

Related Classes of org.andromda.core.configuration.Transformation

Copyright © 2018 www.massapicom. 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.