You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Description

Several actors and workflows were developed to test Fedora's REST API from within Kepler. In particular, they test the basic functionality of the JyFedoREST and FCRepoKepler packages. The source for the actors and workflows in this project are attached to this page and can be downloaded from https://fedora-commons.svn.sourceforge.net/svnroot/fedora-commons/incubator/kepler/trunk/jython/workflows/fcrepo.

Kepler Actors

The PythonActor was used extensively in this project. It is based on the Jython interpreter which provides standard Python functionality within a Java application. Because Jython is implemented in Java, it also provides access to any Java class or class library available to the JVM. In this way, it provides a rapid prototyping tool that supports coding in both Java and Python.

FCRepoGETActor

This actor establishes a connection to a Fedora Repository and sends a request using the Fedora REST API.

Required Packages :
  • JyFedoREST
Source file :

FCRepoGETActor.py

Input ports :
  • repository : StringToken containing the base URL of the Fedora Repository.
  • method_uri : StringToken containing the URI for the REST API method to be executed.
  • username : StringToken containing the name of a Fedora Repository user with sufficient access authority to execute the method.
  • password : StringToken containing the password corresponding to the username.
Output ports:
  • out - ObjectToken - a Jython object containing the results of the method execution.

The "FCRepo REST GET" PythonActor is used in the following workflows:

  • REST API Test1
  • REST API Test2
  • REST API Test3
  • REST API Test4

FormatSerializerActor

This actor is a helper that determines the type of object returned by a GET request and reformats the output so that other Kepler actors can handle it.

Source file :

FormatSerializerActor.py

Input port:
  • in : ObjectToken containing the results of the method executed by a "FCRepo REST GET" actor.
Output ports:
  • image_out : AWTImageToken containg an AWT Image. It is broadcast only if the an image was supplied to the "in" port.
  • string_out : StringToken. It is broadcast only if a string was supplied to the "in" port.

The "Format Serialzer" PythonActor is used in the following workflows:

  • REST API Test1
  • REST API Test2
  • REST API Test3
  • REST API Test4
  • REST API Test5

FCRepoDialogActor

This actor displays a SWING dialog that allows the user to enter parameters required to connect to a Fedora Repository.

Required Packages :
  • FCRepoKepler
Source file :

FCRepoDialogActor.py

Input ports :
  • None
Output port :
  • out : ObjectToken containing a Jython dictionary with name/value pairs for all input fields in the form. This object contains the following keys:
    • passalong = name of button pressed.
    • fcrepoURL = base URL of the Fedora Repository.
    • username = name of a Fedora Repository user.
    • password = password corresponding to the username.

The "FC Repository Dialog" PythonActor is used in the following workflows:

  • REST API Test3
  • REST API Test4

FCRepoDatastreamDialogActor

This actor displays a SWING dialog that allows the user to enter parameters required to connect to a Fedora Repository and access a particular datastream.

Required Packages :
  • FCRepoKepler
Source file :

FCRepoDatastreamDialogActor.py

Input port :
  • None
Output port:
  • out : ObjectToken containing a Jython dictionary with name/value pairs for all input fields in the form. This object contains the following keys:
    • passalong = name of button pressed.
    • fcrepoURL = base URL of the Fedora Repository.
    • username = name of a Fedora Repository user.
    • password = password corresponding to the username.
    • pid = identifier for object to be accessed.
    • dsid = identifier of datastream to be accessed.

The "FCRepo Datastream Dialog" PythonActor is used in the following workflows:

  • REST API Test5

DatastreamDisseminationActor

This actor connects to a Fedora Respoitory and retrieves a datastream dissemination.

Required Packages :
  • JyFedoREST
Source file :
Input port:
  • dialog_info : ObjectToken containing a Jython dictionary containing data from a form usbmitted via "FCRepo Datastream Dialog". Alternately, any Jython dictionary with the following keys:
    • fcrepoURL = base URL of the Fedora Repository.
    • username = name of a Fedora Repository user.
    • password = password corresponding to the username.
    • pid = identifier for object to be queried.
    • dsid = identifier of datastream to be queried.
Output port:
  • out : ObjectToken containing a Jython object with the data returned by the request for a dissemnation.

The "FCRepo Dissemination" PythonActor is used in the following workflows:

  • REST API Test5

Kepler Workflows

REST API Test1

A simple workflow to retrieve an XML string from a Fedora Repository containing the 'Smiley' demo data set.

Source file :

REST-API-Test1.xml

REST API Test2

A simple workflow to retrieve an image from a Fedora Repository containing the 'Smiley' demo data set.

Source file :

REST-API-Test2.xml

REST API Test3

A workflow to retrieve a list of all objects in a Fedora Repository.

Source file :

REST-API-Test3.xml

REST API Test4

A variation of REST-API-Test4.xml to be customized to retrieve a datastream dissemination from a local repository.

Source file :

REST-API-Test4.xml

h3, REST API Test5
A workflow thast uses the fcrepo.http.restapi client code to retrieve a datastream dissemenation.

This is a four step workflow:

  1. Display a form dialog for entering parameters to be used to retrieve a datastream dissemination. Uses SimpleHTMLDialog
    from fcrepo.kepler to display and manage the form.
  2. Use fcrepo.http.restapi to get a datastream dissemnination.
  3. Serialize the dissemination into a displayable format.
  4. Display results.
Source file :

REST-API-Test5.xml

  • No labels