Simples Assim

Java Open Source BPEL Engines

leave a comment »

Written by Fernando Ribeiro

January 22, 2012 at 2:52 pm

Posted in Software

Tagged with

How to Generate Serializable JAXB Classes

leave a comment »

<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings version="2.1" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" schemaLocation="sample.xsd">
  <jaxb:globalBindings>
    <jaxb:serializable uid="1" />
  </jaxb:globalBindings>
</jaxb:bindings>

Written by Fernando Ribeiro

January 20, 2012 at 12:15 am

Posted in Software

Tagged with ,

OSGi Extension Bundles

leave a comment »

Written by Fernando Ribeiro

January 19, 2012 at 11:51 pm

Posted in Software

Tagged with

How to Deserialize Objects with Apache Camel 2.8

leave a comment »

import org.apache.camel.builder.RouteBuilder;

public final class SampleRouteBuilder extends RouteBuilder {

    @Override
    public void configure() {
        from(...).unmarshal().serialization();
    }

}

If you need to unmarshal an object that isn’t available to the camel-core bundle, you need enabling dynamic-import for it with the dev:dynamic-import command or using a custom processor.

http://camel.apache.org/serialization.html

Written by Fernando Ribeiro

January 19, 2012 at 11:08 pm

How to Serialize Objects with Apache Camel 2.8

leave a comment »

import org.apache.camel.builder.RouteBuilder;

public final class SampleRouteBuilder extends RouteBuilder {

    @Override
    public void configure() {
        from(...).marshal().serialization();
    }

}

http://camel.apache.org/serialization.html

Written by Fernando Ribeiro

January 19, 2012 at 10:58 pm

Posted in Software

Tagged with , ,

jBPM 5.2 Human Task Service Data Model

leave a comment »

Written by Fernando Ribeiro

January 19, 2012 at 10:47 pm

Posted in Software

Tagged with

How to Attach an Object to a Task in jBPM 5.1

leave a comment »

import static java.lang.System.out;

import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
import java.util.Date;

import org.drools.SystemEventListenerFactory;
import org.jbpm.task.AccessType;
import org.jbpm.task.Attachment;
import org.jbpm.task.Content;
import org.jbpm.task.User;
import org.jbpm.task.service.TaskClient;
import org.jbpm.task.service.mina.MinaTaskClientConnector;
import org.jbpm.task.service.mina.MinaTaskClientHandler;
import org.jbpm.task.service.responsehandlers.BlockingAddAttachmentResponseHandler;

public final class JbpmSample {

  public static void main(final String[] args) throws Exception {
    final TaskClient client = new TaskClient(new MinaTaskClientConnector("SampleClient", new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));

    if (client.connect("localhost", 9123)) {
      final BlockingAddAttachmentResponseHandler handler = new BlockingAddAttachmentResponseHandler();

      final Attachment attachment = new Attachment();

      attachment.setAccessType(AccessType.Inline); // required

      attachment.setAttachedAt(new Date(System.currentTimeMillis())); // required

      attachment.setAttachedBy(new User("krisv")); // required

      attachment.setContentType(""); // required

      attachment.setName(""); // required

      final ByteArrayOutputStream baos = new ByteArrayOutputStream();

      final ObjectOutputStream oos = new ObjectOutputStream(baos);

      oos.writeObject("Simples Assim");

      baos.close();

      final Content content = new Content();

      content.setContent(baos.toByteArray()); // required

      client.addAttachment(1, attachment, content, handler);

      out.println(handler.getAttachmentId());

      client.disconnect();
    }

  }

}

Written by Fernando Ribeiro

January 19, 2012 at 10:42 pm

Posted in Software

Tagged with

How to Create a Macro in FreeMarker 2.3.18

leave a comment »

<#macro sample param1 param2>
    <Item>
        <Field1>${param1}</Field1>
        <Field2>${param2}</Field2>
    </Item>
</#macro>
<?xml version="1.0" encoding="UTF-8"?>
<List>
    <#list list as item>
        <@sample param1="${...}" param2="SampleTemplateMethodModel"?new()() />
    </#list>
</List>

http://freemarker.sourceforge.net/docs/ref_directive_macro.html

Written by Fernando Ribeiro

January 19, 2012 at 7:48 pm

Posted in Software

Tagged with

Improvement to jBPM 5.2

leave a comment »

The OrderColumn annotation would be a nice addition to the Human Task Service classes.

https://issues.jboss.org/browse/JBPM-3510 (vote for it!)

Written by Fernando Ribeiro

January 19, 2012 at 7:09 pm

Posted in Software

Tagged with

Serializable vs. Externalizable

leave a comment »

According to the Java Object Serialization Specification 6.0, for Externalizable objects, only the identity of the class of the object is saved by the container; the class must save and restore the contents.

http://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html

http://docs.oracle.com/javase/6/docs/api/java/io/Externalizable.html

Written by Fernando Ribeiro

January 19, 2012 at 6:41 pm

Posted in Software

Tagged with

Follow

Get every new post delivered to your Inbox.

Join 784 other followers