Examples of StreamSource


Examples of javax.xml.transform.stream.StreamSource

            if (StringUtils.isNotBlank(modelUri))
            {
                final URL modelUrl = new URL(modelUri);
                if (xsltTransformations != null && xsltTransformations.length > 0)
                {
                    Source modelSource = new StreamSource(modelUrl.openStream());
                    final List xslts = Arrays.asList(xsltTransformations);
                    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)
                                {
                                    parent.mkdirs();
                                }
                                FileOutputStream outputStream = new FileOutputStream(fileOutput);
                                AndroMDALogger.info("Transformation output: '" + outputLocation + "'");
                                outputStream.write(outputResult);
                                outputStream.flush();
                                outputStream.close();
                                outputStream = null;
                            }
                            if (xsltIterator.hasNext())
                            {
                                modelSource = new StreamSource(stream);
                            }
                        }
                    }
                }
                else if (modelUrl != null)
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

            Source source = null;
            if (this.location != null)
            {
                String locationUri = ResourceUtils.normalizePath(this.location.toString());
                locationUri = locationUri.substring(0, locationUri.lastIndexOf('/') + 1);
                source = new StreamSource(locationUri + href);
            }
            return source;
        }
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

        //TODO Set Request/Response Context like Transport Attributes.
        updateRequestContext(dispatch.getRequestContext());

        //TODO Use Async API
        StreamSource resp = dispatch.invoke(request);
       
        updateWebServiceContext(dispatch.getResponseContext());
        return resp;
    }
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

        channel.sendSync(exchange);
        EasyMock.expectLastCall().andReturn(Boolean.TRUE);
        exchange.getOutMessage();                       
        EasyMock.expectLastCall().andReturn(message);
        message.getContent();
        EasyMock.expectLastCall().andReturn(new StreamSource(messageStream));
                               
        EasyMock.replay(channel);
        EasyMock.replay(factory);
        EasyMock.replay(exchange);
        EasyMock.replay(message);
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

        assert context instanceof JBIOutputStreamMessageContext
            : "context must be of type JBIOutputStreamMessageContext";
   
        JBIOutputStreamMessageContext ctx = (JBIOutputStreamMessageContext)context;
        ByteArrayOutputStream bos = (ByteArrayOutputStream)ctx.getOutputStream();
        return new StreamSource(new ByteArrayInputStream(bos.toByteArray()));
    }
View Full Code Here

Examples of javax.xml.transform.stream.StreamSource

        return props;
    }

    private List<Source> createMetadata() {
        List<Source> metadata = new ArrayList<Source>();
        metadata.add(new StreamSource(wsdlModel.getDocumentBaseURI()));
        return metadata;
    }
View Full Code Here

Examples of mf.javax.xml.transform.stream.StreamSource

        InputStream inputStream;
        Reader reader;
        for (int i = 0; i < schemas.length; ++i) {
            Source source = schemas[i];
            if (source instanceof StreamSource) {
                StreamSource streamSource = (StreamSource) source;
                String publicId = streamSource.getPublicId();
                String systemId = streamSource.getSystemId();
                inputStream = streamSource.getInputStream();
                reader = streamSource.getReader();
                XMLInputSource xmlInputSource = new XMLInputSource(publicId, systemId, null);
                xmlInputSource.setByteStream(inputStream);
                xmlInputSource.setCharacterStream(reader);              
                xmlInputSources[i] = xmlInputSource;
            }
View Full Code Here

Examples of org.activiti.engine.impl.util.io.StreamSource

    return "org/activiti/standalone/parsing/chinese.bpmn";
  }
 
  protected BpmnModel readXMLFile() throws Exception {
    InputStream xmlStream = this.getClass().getClassLoader().getResourceAsStream(getResource());
    StreamSource xmlSource = new InputStreamSource(xmlStream);
    BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xmlSource, false, false, processEngineConfiguration.getXmlEncoding());
    return bpmnModel;
  }
View Full Code Here

Examples of org.apache.stanbol.enhancer.servicesapi.impl.StreamSource

        blob = createBlob(cs);
        Assert.assertEquals("text/plain", blob.getMimeType());
        Assert.assertTrue(blob.getParameter().containsKey("charset"));
        Assert.assertEquals(ISO8859_4.name(), blob.getParameter().get("charset"));
        //3rd as Stream
        cs = new StreamSource(new ByteArrayInputStream(data), "text/plain; charset="+ISO8859_4.name());
        blob = createBlob(cs);
        Assert.assertEquals("text/plain", blob.getMimeType());
        Assert.assertTrue(blob.getParameter().containsKey("charset"));
        Assert.assertEquals(ISO8859_4.name(), blob.getParameter().get("charset"));
        cs = new StreamSource(new ByteArrayInputStream(data), "text/plain; "+ISO8859_4.name());
    }
View Full Code Here

Examples of org.netbeans.api.diff.StreamSource

            rightFileRevision = org.openide.util.NbBundle.getMessage(ResolveConflictsExecutor.class, "Diff.titleWorkingFile"); // NOI18N
        } else {
            rightFileRevision = org.openide.util.NbBundle.getMessage(ResolveConflictsExecutor.class, "Diff.titleRevision", rightFileRevision); // NOI18N
        }

        final StreamSource s1;
        final StreamSource s2;
        Charset encoding = FileEncodingQuery.getEncoding(fo);
        s1 = StreamSource.createSource(file.getName(), leftFileRevision, mimeType, f1);
        s2 = StreamSource.createSource(file.getName(), rightFileRevision, mimeType, f2);
        final StreamSource result = new MergeResultWriterInfo(f1, f2, f3, file, mimeType,
                originalLeftFileRevision,
                originalRightFileRevision,
                fo, lock, encoding);

        try {
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.