processi

about processes and engines

Archive for the ‘atom’ Category

new ruote quickstart

picture-11Ruote has a new website, like the one for Rufus, it’s based on the excellent Webby.

I wrote yesterday about renovating the quickstart, I had initially written an example showing a mini todo tool, but this time I switched to a “mechanical turk” like example where a process instance fetches flickr pictures and presents them to human participants for evaluation and choice.

The process definition boils down to :

class PicSelectionProcess < OpenWFE::ProcessDefinition

  sequence do

    get_pictures

    concurrence :merge_type => 'mix' do
      user_alice
      user_bob
      user_charly
    end

    show_results
      # display the pictures chosen by the users
  end
end

the participant for fetching the pictures is called ‘get_pictures’ :

engine.register_participant :get_pictures do |workitem|

feed = Atom::Feed.new(
http://api.flickr.com/services/feeds/photos_public.gne”+
“?tags=#{workitem.tags.join(‘,’)}&format=atom”)
feed.update!
workitem.pictures = feed.entries.inject([]) do |a, entry|
a << [ entry.title, entry.authors.first.name, entry.links.first.href ] end end [/sourcecode] That's it for the quickstart. Now I have to update the tea tasting team example and the japanese website.

Written by John Mettraux

December 16, 2008 at 6:57 am

Posted in atom, bpm, openwferu, ruby, ruote, workflow

pilatus for yahoo pipes

picture-1I just updated the activity page for Ruote (warning it needs some CSS love). It’s populated with the result of a Yahoo Pipe that gathers the feeds of Ruote’s activity, be it on github, the users mailing list or this blog.

It all happens on the client side. I’ve written a small javascript library called Pilatus to which you give the URL of a pipe and the id of the HTML div element to fill and that’s all.

  <script src='/pilatus.js'><script>

  <div id='feed'></div>

  <script>
    Pilatus.loadAndRender(
      "feed",
      "http://pipes.yahoo.com/pipes/pipe.run?_id=XGwyd_LA3RGNSAMs6icw5g");
  </script>

Nothing special. License is MIT, washing my hands.

the js : http://github.com/jmettraux/pilatus/tree/master/public/pilatus.js
the project : http://github.com/jmettraux/pilatus

Written by John Mettraux

December 5, 2008 at 2:06 am

something about gcal

I had a request for creating events in Google Calendar from some business processes. It gave me the opportunity to play with Google Data; it wasn’t too difficult, especially since it’s based on Atom and AtomPub.

I have thus started working on a new rufus library. It’s very limited for now, but I can have code that looks like that :

require 'rubygems'
require 'rufus/gcal'

calendars = Rufus::Google::Calendar.get_calendars(
  :account => ENV['GUSER'],
  :password => ENV['GPASS'])

#calendars.values.each { |c| p [ c.name, c.href ] }

cal = calendars['gwork']

id = cal.post_quick!(
  'Tennis with John November 13 3pm-4:30pm')

cal.events(:q => 'tennis').each do |e|
  puts
  puts e.to_s
end

Behind the scenes, it relies heavily on the fine atom-tools gem by Brendan Taylor.

The only authentication mechanism used is the ClientLogin. For the other mechanisms, one can look at gdata-ruby.

My next step will be to polish the Event class and to allow for manipulation of Calendar resources. Then I will take a look at other Google Data APIs.

source : http://github.com/jmettraux/rufus-google
mailing-list : http://groups.google.com/group/rufus-ruby

Written by John Mettraux

November 13, 2008 at 12:07 am

Posted in atom, atompub, google, ruby, workflow

restful workflow engine

update : the work announced here has been renamed “ruote-kit”, you can find it at http://github.com/tosch/ruote-kit


I’ve been working on this vaporous thing / project for a while, now it’s here, in its first iteration. It’s called Kisha (steam train).

The short designation is “RESTful workflow engine”, the long one is “RESTful Rails® enveloppe for an OpenWFEru engine [and a worklist]”.

Kisha is leveraging Ruby on Rails 2.0.2 to present a RESTful interface to the OpenWFEru workflow engine.

This first iteration implements 2 core use cases via 2 resources.

The use cases are :

  • launching a new instance of a process
  • editing and then proceeding/saving a workitem

quick wiki quote :

A business process or business method is a collection of interrelated tasks, which solve a particular issue

The 2 resources are “processes” and “workitems”. Thus, RESTfully yours, these paths are available :

  • /processes the list of processes currently running in the workflow engine
  • /processes/{process_instance_id} accessing a particular process instance
  • /workitems all the workitems awaiting manipulation/proceeding from an external participant (you)
  • /workitems/{workitem_id} a particular workitem

Launching a process is done by POSTing a process/launchitem representation to /processes, while modifying/proceeding a workitem is by PUTting an updated representation of that workitem at /workitems/{workitem_id}.

(there is a working draft enumerating those resources at kisha.txt)

That’s for the theory.

Kisha is available in its first iteration as a zip download or via the source (see this piece of documentation).

For documentation and test purposes, I took care of providing a well-connected set of HTML representations of the resources, here are a few screenshots :

Kisha screenshot

What’s in this first iteration :

  • well connected HTML representations (learn the interface by playing around)
  • Rails ActiveResource JSON and XML representations
  • Atom representations as well
  • Possibility to post resources (/processes for now) via AtomPub
  • limited Authentication scheme (127.0.0.1 is trusted as well as the canonical “user” user, via basic http authentication)
  • binary Authorization (once you’re authentified, you can do everything)
  • a chart representation for workitems and processes (it’s taken out of densha)
  • a plain model for participants : there is one ‘catch-all’ participant (an expressions with a typo could be mistaken for a participant)

I’ve tried hard to accept a large set of variants for the process/workitem input (json, xml, yaml, atom entries, …), Kisha should be able to accomodate them all, this has proven the most time consuming aspect for now.

What will be in further iterations :

  • more authentication schemes (Pat is petitioning me about them)
  • a better authorization system (who can launch, who can proceed, who can pause)
  • more resources (process errors, process variables, maybe process definitions, …)
  • why not a /participants resource ?
  • more efficient usage of the resources (etag & co)
  • polishing the AtomPub interactions
  • activity [atom] feed
  • more documentation

Over for now.

Feedback is welcome on the OpenWFEru mailing lists.

Written by John Mettraux

December 20, 2007 at 5:52 am

Rest and AtomPub for Rufus

Mark Masterson just posted about RESTafarian Workflow / BPM Ganja, here are my two favourite quotes :

I’m gnawing on the beginnings of the idea that we might be able to implement an entire BPMS on top of a RESTful infrastructure

I’m beginning to suspect that embracing the various aspects of REST might allow us to build the “next generation” of process management systems.

This is great to read, and I’m quite happy that OpenWFEru is just in the middle of that. I hope Mark will post more about his ideas, maybe one day, OpenWFEru could be useful for him.

The old OpenWFE (the java one) featured a RESTlike interface and I was surprised to find out a year ago that the FormsPlayer people were using it, directly from the browser for some of their customers.

The first RESTful business process engine that I know of is the GeoBPMS of Pat Cappelaere, there is OpenWFEru behind it and Pat was always evangelizing to me the need for a RESTful OpenWFEru (with AtomPub for posting resources).

Matt Zukowski, in parallel, was working on Fluxr, a RESTful envelope around OpenWFEru, but unfortunately, he cannot continue the development.

That’s it for the context, so why the title “Rest and AtomPub for Rufus” ?

Rufus is the nickname of OpenWFEru, please use it when you feel that OpenWFEru is too hard to pronounce.

I’ve just implemented a new AtomPubParticipant for Rufus. It posts its workitems to an AtomPub enabled resource.

require
  ('openwfe/extras/participants/atompub_participants')
include OpenWFE::Extras

target_uri = \
  "https://openwferu.wordpress.com/wp-app.php/posts"

params = {
  :username => "x",
  :password => "y",
  :categories => "test, workflow"
}

engine.register_participant(
  "app", 
  AtomPubParticipant.new(target_uri, params))

This example posts to a [dump] wordpress account. By default, it dumps the workitem as YAML, but it’s easy to override or monkey patch the methods of the AtomPubParticipant to have it use other formats.

So why brag about it ?

  • it’s easy to build a publication workflow based upon OpenWFEru and a blog engine like WordPress
  • a blog can be used for holding business activity trace/history

which are just sub-cases of :

  • in a RESTful environment, you can create resources via AtomPub inside of an OpenWFEru driven business process

Next step for me will be the implementation of a BlogParticipant for posting human oriented entries (no big work, it’s just an extension of the class AtomPubParticipant).

And the step after that is quite obvious : reverse the vapor, and expose the OpenWFEru resources for creation and modification via AtomPub.
It has already begun with exposing the activity of the engine, as a feed (rather read-only).

Mark will certainly be better than me at explaining the benefits of such a business process management system.

Written by John Mettraux

November 13, 2007 at 5:58 am

an atom feed for process engine activity

The next release of OpenWFEru’s Densha will feature an atom activity feed.

It’s already available in the trunk and at

http://difference.openwfe.org:3000/activity

to track only the activity for the salesteam participant :

http://difference.openwfe.org:3000/activity?participant=salesteam

to track only replies of that team (when tasks/workitems come back to the process engine) :

http://difference.openwfe.org:3000/activity?participant=salesteam&upon=reply

and so on…

Next releases of this activity feed will require authentication, an open viewpoint on all the business process activity is something process admins don’t usually want, too enterprise 2.0 maybe.

Written by John Mettraux

November 11, 2007 at 1:37 pm

posting to wordpress via ruby and atompub

The ruby script here uploads posts to WordPress blogs via AtomPub.

Once you’ve set your blog coordinates in the script (around line 20), you can post like that :

echo "I love Ruby" | post.rb -t "title" -c "thoughts,ruby"

The script will publish your post and then ouptput the WordPress server reply.

#!/usr/bin/env ruby

# Copyright (c) 2007 John Mettraux
# Released under the MIT license
# http://www.opensource.org/licenses/mit-license.php

require 'optparse'
require 'net/http'

require 'rubygems'
require 'atom/entry' # sudo gem install atom-tools
require 'atom/collection'

    # a great thanks to the devs of all the libs used here

#
# some info about you and your blog

blog = "yourblog"
authorname = "Your Name"
username = "x"
password = "y"


bloguri = "http://#{blog}.wordpress.com"
base = "https://#{blog}.wordpress.com/wp-app.php"

#
# parse options

tags = []
title = nil
type = 'html'

opts = OptionParser.new
opts.banner = "Usage: post.rb [options]"
opts.separator ""
opts.separator "options :"

opts.on(
    "-c", 
    "--categories {list}", 
    "comma separated list of tags/categories") do |v|

    tags = v.split ","
end

opts.on(
    "-t", 
    "--title {title}", 
    "title for the post") do |v|

    title = v
end

opts.on(
    "-T", 
    "--type {html|xhtml|text}", 
    "type of the content. ('html' is the default).") do |v|

    type = v
end

opts.on(
    "-h", 
    "--help", 
    "displays this help") do

    puts
    puts opts.to_s
    puts
    exit 0
end

opts.parse ARGV


raise "please specify a title for the post with the -t option" \
    unless title

#
# gather content

content = ""
loop do
    line = STDIN.gets
    break unless line
    content += line
end

#
# create entry

entry = Atom::Entry.new
entry.title = title
#entry.updated = Time.now.httpdate
entry.updated!

author = Atom::Author.new
author.name = authorname
author.uri = bloguri
entry.authors << author

tags.each do |t|
    c = Atom::Category.new
    c["scheme"] = bloguri
    c["term"] = t.strip
    entry.categories << c
end

entry.content = content
entry.content["type"] = type if type

#puts entry.to_s

h = Atom::HTTP.new
h.user = username
h.pass = password
h.always_auth = :basic

c = Atom::Collection.new(base + "/posts", h)
res = c.post! entry

puts res.read_body

Next step for me, integration of the technique into ruote.

Updated 2007/11/11 : following the suggestions of Brendan Taylor, the author of atom-tools, I simplified the scripts, now relying on atom-tools for posting the entry.

Enjoy.

Written by John Mettraux

November 5, 2007 at 1:25 am

Posted in atom, atompub, rest, ruby, wordpress