Skip to content

Instantly share code, notes, and snippets.

View ullgren's full-sized avatar

Pontus Ullgren ullgren

View GitHub Profile

Keybase proof

I hereby claim:

  • I am ullgren on github.
  • I am ullgren (https://keybase.io/ullgren) on keybase.
  • I have a public key whose fingerprint is CF09 BB99 656F 6430 5777 5CA6 0BDB 53B1 A2CF 8A38

To claim this, I am signing this object:

@ullgren
ullgren / affirmation
Created October 18, 2016 15:07
MuleSoft Contributor Agreement Acceptance by Pontus Ullgren
I, Pontus Ullgren, have read and do accept the MuleSoft Contributor Agreement
at http://www.mulesoft.org/legal/contributor-agreement.html
Accepted on Tue Oct 18 2016 17:07:38 GMT+0200 (CEST)
@ullgren
ullgren / CacheInterceptor.java
Created February 9, 2016 23:04
CacheInterceptor.java
package com.redpill_linpro.mule.cache;
import java.io.NotSerializableException;
import java.io.Serializable;
import org.mule.DefaultMuleEvent;
import org.mule.DefaultMuleMessage;
import org.mule.api.MessagingException;
import org.mule.api.MuleEvent;
import org.mule.api.MuleEventKeyGenerator;
@ullgren
ullgren / 1UnzipTransformer.java
Last active May 25, 2020 15:26
Mule transformer to extract a zip file into a List of InputStream
/*
* Licensed to the soi-toolkit project under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The soi-toolkit project licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@ullgren
ullgren / PropertiesAccessor.java
Created January 5, 2015 20:00
Dynamic lookup of properties from a secure-property-placeholder in a Mule flow
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.support.AbstractBeanFactory;
/**
* Helper bean to allow indirect access to properties loaded by Spring property placeholders.
* Code taken from StackOverflow (http://stackoverflow.com/a/17697586)
*/
@ullgren
ullgren / FilterProxy.java
Last active June 15, 2016 18:25
Mule custom filter with a prototype filter
import org.mule.api.MuleMessage;
import org.mule.api.routing.filter.Filter;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
public class FilterProxy implements Filter, ApplicationContextAware {
private ApplicationContext context;
private String realFilterId;
package com.ullgren.pontus.camel;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@ullgren
ullgren / testflow.xml
Created July 30, 2013 16:12
Example of printing Russian characters with Mule ESB.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd ">
<flow name="testFlow1" doc:name="testFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<set-payload value="привет мир" doc:name="Set Payload" />
import org.mule.api.MuleMessage;
import org.mule.api.transformer.TransformerException;
import org.mule.api.transport.PropertyScope;
import org.mule.transformer.AbstractMessageTransformer;
public class InsertProperty extends AbstractMessageTransformer {
@Override
public Object transformMessage(MuleMessage message, String outputEncoding)
@ullgren
ullgren / PollRootDirTest.java
Created August 22, 2012 17:35
Testing polling of root directory
import org.apache.camel.CamelContext;
import org.apache.camel.EndpointInject;
import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
public class PollRootDirTest extends CamelTestSupport{