Skip to content

Instantly share code, notes, and snippets.

View nialdarbey's full-sized avatar

Nial Darbey nialdarbey

View GitHub Profile
@nialdarbey
nialdarbey / gist:3886939
Created October 14, 2012 01:43
devkit configurable
/**
* The connection URL to the LDAP server with the following syntax: <code>ldap[s]://hostname:port/base_dn</code>.
*/
@Configurable
@Placement(group = "Connection", order = 0)
@FriendlyName("URL")
private String url;
@nialdarbey
nialdarbey / gist:3886931
Created October 14, 2012 01:40
devkit sample ref
/**
* Performs a LDAP search returning a list with all the resulting LDAP entries.
* <p/>
* For queries returning large results it is recommended to use pagination (not all LDAP servers support this or are configured to support it).
* For that you need to provide a page size value that should be less or equal than max results (count limit). If you are getting a
* Sizelimit Exceeded exception then you should check that the authenticated user has enough privileges or the LDAP server is not
* limited by configuration.
* <p/>
* <h4>Returning all attributes for all persons that have Doe as surname</h4>
* {@sample.xml ../../../doc/mule-module-ldap.xml.sample ldap:search-1}
@nialdarbey
nialdarbey / gist:3886949
Created October 14, 2012 01:46
devkit processor
@Processor
@InvalidateConnectionOn(exception = CommunicationException.class)
public LDAPEntry lookup(@FriendlyName("DN") String dn, @Optional List<String> attributes) throws Exception
{
@nialdarbey
nialdarbey / gist:3886942
Created October 14, 2012 01:45
devkit connect annt
@Connect
public void connect(@ConnectionKey @FriendlyName("Principal DN") String authDn, @Optional @FriendlyName("Password") String authPassword, @Optional String authentication) throws ConnectionException
{
@nialdarbey
nialdarbey / gist:3886935
Created October 14, 2012 01:43
devkit connect
@Connector(name = "ldap", schemaVersion = "3.3", friendlyName="LDAP", minMuleVersion="3.2.0", description="LDAP Connector that allows you to connect to any LDAP server and perform every LDAP operation")
@nialdarbey
nialdarbey / gist:3886925
Created October 14, 2012 01:38
devkit sample
<!-- BEGIN_INCLUDE(ldap:search-1) -->
<!-- Case 1: Simple SUB_TREE search -->
<ldap:search baseDn="ou=people,dc=mulesoft,dc=org" filter="(&amp;(objectClass=person)(sn=Doe))" scope="SUB_TREE"/>
<!-- END_INCLUDE(ldap:search-1) -->
<project name="hello" default="deploy">
<taskdef resource="org/mule/mulePackagingTasks.properties" />
<property name="dir.java" value="src" />
<property name="dir.conf" value="conf" />
<property name="dir.build" value="target" />
<property name="dir.classes" value="${dir.build}/classes" />
<property name="app.name" value="nialdarbey" />
<property name="app.jar" value="${dir.build}/${app.name}.jar" />
private String cloudHubUrl = "https://cloudhub.io";
@Override
public void execute() throws BuildException {
FileChecker checker = new FileChecker(getLocation());
checker.checkFile(applicationFile, "application file", false, false);
try {
Client client = Client.create();
client.addFilter(new HTTPBasicAuthFilter(username, password));
WebResource webResource = client.resource(cloudHubUrl);
<cloudHubDeploy username="myUsername" password="myPassword" domain="${app.name}" applicationFile="${app.file}" />
when
$elementDocument : DefaultDocument ( $element : rootElement, $element.qName.name == "element" )
not ( Attribute ( qName.name == "type" ) from $element.attributes )
then
ElementSummary elementSummary = new ElementSummary($elementDocument, null);
Map map = new HashMap();
map.put("schemaName", $elementDocument.getName());
mule.generateMessage("vm://queue.elements", elementSummary, map, MessageExchangePattern.ONE_WAY);
end