Package org.milyn.container

Examples of org.milyn.container.ExecutionContext


                       PipelineContext context) {
        this.smooks.setClassLoader( context.getClassLoader() );
        Object result = null;
        try {
            JavaResult javaResult = new JavaResult();
            ExecutionContext executionContext = this.smooks.createExecutionContext();

            Source source = null;
            if ( object instanceof Source ) {
                source = ( Source ) object;
            } else if ( object instanceof InputStream ) {
View Full Code Here


                        PipelineContext context) {
        this.smooks.setClassLoader( context.getClassLoader() );
        Object result = null;
        try {
            StringResult stringResult = new StringResult();
            ExecutionContext executionContext = this.smooks.createExecutionContext();

            this.smooks.filter( new JavaSource( object ),
                                stringResult,
                                executionContext );
View Full Code Here

                        PipelineContext context) {
        this.smooks.setClassLoader( context.getClassLoader() );
        Object result = null;
        try {
            StringResult stringResult = new StringResult();
            ExecutionContext executionContext = this.smooks.createExecutionContext();

            this.smooks.filter( new JavaSource( object ),
                                stringResult,
                                executionContext );
View Full Code Here

                       PipelineContext context) {
        this.smooks.setClassLoader( context.getClassLoader() );
        Object result = null;
        try {
            JavaResult javaResult = new JavaResult();
            ExecutionContext executionContext = this.smooks.createExecutionContext();

            Source source = null;
            if ( object instanceof Source ) {
                source = ( Source ) object;
            } else if ( object instanceof InputStream ) {               
View Full Code Here

    public void split(InputStream dataStream) throws IOException {
        Source streamSource = new StreamSource(new InputStreamReader(dataStream, encoding));

        if(reportPath != null) {
            ExecutionContext execContext = smooks.createExecutionContext();

            execContext.setEventListener(new HtmlReportGenerator(reportPath));
            smooks.filterSource(execContext, streamSource);
        } else {
            smooks.filterSource(streamSource);           
        }
    }
View Full Code Here

            if(payload == null) {
                logger.warn("Null message payload.  Returning message unmodified.");
            } else if(payload instanceof String) {
              long start = System.currentTimeMillis();
                ExecutionContext executionContext;

                // Register the message profile with Smooks (if there is one and it's not already registered)...
                messageProfile = registerMessageProfile(message, smooks);

              // Filter and Serialise...
                if(messageProfile == null) {
                    // Not using profiles on this transformation.
                    executionContext = smooks.createExecutionContext();
                } else {
                    executionContext = smooks.createExecutionContext(messageProfile);
                }
               
                StringResult result = new StringResult();
                smooks.filterSource(executionContext, new StringSource((String) payload), result);

                HashMap beanHash = new HashMap(executionContext.getBeanContext().getBeanMap());
              if(beanHash != null) {
                message.getBody().add(EXTRACTED_BEANS_HASH, beanHash); // Backward compatibility.
              } else {
                    message.getBody().remove(EXTRACTED_BEANS_HASH); // Backward compatibility.
                }
View Full Code Here

     */
  public Message process( final Message message) throws ActionProcessingException
  {
        //  Create Smooks ExecutionContext.
        final String messageProfofile = (String) message.getProperties().getProperty(Properties.MESSAGE_PROFILE, defaultMessageProfile);
        final ExecutionContext executionContext = smooks.createExecutionContext(messageProfofile);

        if(reportPath != null) {
            try {
                executionContext.setEventListener(new HtmlReportGenerator(reportPath));
            } catch (IOException e) {
                throw new ActionProcessingException("Failed to create HtmlReportGenerator instance.", e);
            }
        }

        //  Use the Smooks PayloadProcessor to execute the transformation....
        final Object payload;
        try {
            payload = payloadProxy.getPayload(message);
        } catch (MessageDeliverException e) {
            throw new ActionProcessingException("MessgeDeliveryException while trying to retrieve the message payload:", e);
        }
        final Object newPayload = payloadProcessor.process( payload, executionContext );

        //  Set the ExecutionContext's attributes on the message instance so other actions can access them.
        message.getBody().add( EXECUTION_CONTEXT_ATTR_MAP_KEY, getSerializableObjectsMap( executionContext.getAttributes() ) );

        try {
            payloadProxy.setPayload( message, newPayload );
        } catch (MessageDeliverException e) {
            throw new ActionProcessingException("MessgeDeliveryException while trying to retrieve the message payload:", e);
View Full Code Here

          smooks.addConfigurations("smooks-resource", new URIResourceLocator().getResource(smooksResource));
          }
    }
    }
     
  ExecutionContext executionContext = smooks.createExecutionContext();
  // Configure the execution context to generate a report...
  if (this.getSmooksReport() != null) {
      executionContext.setEventListener(new HtmlReportGenerator(this.getSmooksReport()));
  }
  org.milyn.container.plugin.PayloadProcessor payloadProcessor = new PayloadProcessor(smooks, org.milyn.container.plugin.ResultType.JAVA);
  // smooks should return a map
  // TODO: verify with some unit tests
  return (Map<String, Object>) payloadProcessor.process(originalObjects, executionContext);
View Full Code Here

  ByteArrayOutputStream outStream = null;
  ByteArrayInputStream inStream = null;

  try {

      ExecutionContext executionContext = smooks.createExecutionContext();
      StringWriter transResult = new StringWriter();
     
      executionContext.getBeanContext().getBeanMap().putAll(this.beansMap);

      StringWriter buffer;
      outStream = new ByteArrayOutputStream();
      message.writeTo(outStream);
      outStream.flush();
View Full Code Here

     * @return The rewritten WSDL.
     */
    private String applyTransformer(String wsdl, EPR epr, String targetServiceCat, String targetServiceName, String targetProtocol) {
        URI endpointURI = URI.create(epr.getAddr().getAddress());
        StringWriter writer = new StringWriter();
        ExecutionContext execContext = transformer.createExecutionContext();

        execContext.setAttribute(WsdlEndpointTransformer.REWRITE_ENDPOINT_URL, rewriteEndpointUrl);
        execContext.setAttribute(WsdlEndpointTransformer.ENDPOINT_URI, endpointURI);
        execContext.setAttribute(WsdlEndpointTransformer.TARGET_CAT, (targetServiceCat != null?targetServiceCat:""));
        execContext.setAttribute(WsdlEndpointTransformer.TARGET_NAME, (targetServiceName != null?targetServiceName:""));
        execContext.setAttribute(WsdlEndpointTransformer.TARGET_PROTOCOL, (targetProtocol != null?targetProtocol:""));
        transformer.filterSource(execContext, new StreamSource(new StringReader(wsdl)), new StreamResult(writer));

        return writer.toString().trim();
    }
View Full Code Here

TOP

Related Classes of org.milyn.container.ExecutionContext

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.