Skip to content

Instantly share code, notes, and snippets.

<shiro:security-manager>
<shiro:delegate-security-provider name="in-memory" delegate-ref="securityManager"/>
</shiro:security-manager>
<spring:bean id="securityManager" class="org.apache.shiro.mgt.DefaultSecurityManager">
<spring:property name="realm" ref="myRealm"/>
</spring:bean>
<spring:bean id="myRealm" class="org.mule.module.shiro.TextConfigurationRealm">
<spring:property name="userDefinitions">
<flow name="test">
<inbound-endpoint address="http://localhost/edit/something" exchange-pattern="request-response"/>
<http:basic-security-filter realm="mule-realm"/>
<shiro:authorization-filter permission="write"/>
... logic which requires write access
</flow>
/**
* Honor semantics of chmod as best we can in pure Java. Note, this uses reflection to be
* more tolerant of different Java versions.
*/
public class Chmod {
private static final boolean CHMOD_API_AVAILABLE;
private static final Method setWritable;
private static final Method setReadable;
private static final Method setExecutable;
import com.mulesoft.jockey.*;
@Command("test")
@Options([
@Option(name="n",longName="name",description="Your name",optional=false)
])
public class TestCommand extends GroovyCommand {
void execute() {
println "Hello " + name;
}
}
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mulesoft.ion</groupId>
<artifactId>testcli</artifactId>
<name>Test CLI tools</name>
<version>1.0</version>
<dependencies>
<dependency>
import java.util.Map;
@Command("public-tweets")
public class PublicTweetsCommand extends GroovyCommand {
void execute() {
def response = client.resource("http://api.twitter.com/1/statuses/public_timeline.json")
.get(Map[].class);
// print the text field of each tweet object
response.each {
def request = new Expando();
request.status= 'my tweet'
request.in_reply_to_status_id = 123;
... fill in your object properties
def response = client.resource("http://api.twitter.com/1/statuses/update.json").post(Map.class, request.properties);
@dandiep
dandiep / gist:1090760
Created July 18, 2011 21:52
Filter Data
from userManager.users
where division = ‘Sales’ and
(email like ‘mulesoft.com’ or email like ‘mulesource.com’)
@dandiep
dandiep / gist:1090764
Created July 18, 2011 21:55
MQL transform data
from userManager.users as u
select new {
href = 'http://localhost/users/' + u.id,
name = u.firstName + ' ' + u.lastName,
division = u.division
}
@dandiep
dandiep / gist:1090766
Created July 18, 2011 21:55
MQL join data from salesforce
from userManager.users as user
join salesforce.query('SELECT Company, MobilePhone
FROM Lead
WHERE Email = \'' + user.email + '\'', 1)
as sfuser
select new {
name = user.name,
email = user.email,
company = sfuser[0].?Company,
mobilePhone = sfuser[0].?MobilePhone