Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

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 Workflows

REST API Test1

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

...

Screenshot :

...

Image Added

...

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.

...

Screenshot :

...

Image Added

...

Source file :

...

REST-API-Test2.xml

REST API Test3

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

...

Screenshots :

...

Image Added Image Added

...

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.

...

Screenshots :

...

Image Added Image Added

...

Source file :

...

REST-API-Test4.xml

REST API Test5

A workflow that 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.
  2. Use fcrepo.http.restapi to get a datastream dissemnination.
  3. Serialize the dissemination into a displayable format.
  4. Display results.

...

Screenshots :

...

Image Added Image Added

...

Source file :

...

REST-API-Test5.xml

Anchor
IngestWithDatastream
IngestWithDatastream
Ingest With Datastream

A workflow that uses the fcrepo.http.restapi client code to create a new object with a single datastream.

This is a three step workflow:

  1. Display a form dialog for entering parameters that can be used to create a new object with a single datastream.
  2. Use fcrepo.http.restapi to create the new object. Display results.
  3. Use fcrepo.http.restapi to add a datastream. Display results.

...

Screenshots :

...

Image Added Image Added

...

Source file :

...

IngestWithDatastream.xml

Update Datastream

A workflow that uses the fcrepo.http.restapi client code to update a workflow in an existing object.

...

Screenshots :

...

Image Added Image Added

...

Source file :

...

UpdateDatastream.xml

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.

...

FCRepo Add Datastream Actor

This actor establishes a connection to a Fedora Repository and sends a request using the Fedora REST APIconnects to a Fedora Respoitory and adds a datastream to an existing object.

...

Required Packages :

...

  • JyFedoREST

...

Source file :

...

AddDatastreamActor.py

...

Input port:

...

  • ingest_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.
    • dsLabel = label for datastream to be created.
    • dsLocation = URL of file containing datastream content.
    • mimeType = mime type of datastream content.
    • controlGroup = datastream control group, optional, defaults to 'M'.
    • dsState = datastream state, optional, defaults to 'A'.
    • versionable = whether datastream is versionable, optional, defaults to True.
    • formatURI = URI of datastream format description, optional, no default.
    • checksumType = datastream checksum type, optional, no default.
    • altIDs = list of alternate IDs for datastream, optional, no default.

...

Output port:

...

  • result : StringToken containing results of the request to add a dissemination.

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

  • Ingest With Datastream

FCRepo Datastream Dialog Actor

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.

...

Screenshot :

...

Image Added

...

Required Packages :

...

  • FCRepoKepler - Uses SimpleHTMLFormDialog to display and manage the form.

...

Source file :

...

FCRepoGETActorFCRepoDatastreamDialogActor.py

Input

...

port :
  • None

...

Output port:

...

  • repository out : StringToken containing the 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.
  • method_uri : StringToken containing the URI for the REST API method to be executed.
    • 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

FCRepo Datastream Update Dialog Actor

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

...

Screenshot :

...

Image Added

...

Required Packages :

...

  • FCRepoKepler - Uses SimpleHTMLFormDialog to display and manage the form.

...

Source file :

...

DatastreamUpdateDialogActor.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:
    • fcrepoURL = base URL of the Fedora Repository.
    • username =
    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.
    • .
    • password = password corresponding to the username.
    • pid = identifier for object to be updated.
    • dsid = identifier of datastream to be updated.
    • dsLabel = label for datastream to be updated.
    • dsLocation = URL of file containing datastream content.
    • mimeType = mime type of datastream content.

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

  • Update Datastream

FCRepo Dialog Actor

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

...

Screenshot :

...

Image Added

...

Required Packages :

...

  • FCRepoKepler - Uses SimpleHTMLFormDialog to display and manage the form.

...

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 "FCRepo DialogThe "FCRepo REST GET" PythonActor is used in the following workflows:

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

...

FCRepo Dissemination Actor

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.connects to a Fedora Respoitory and retrieves a datastream dissemination.

...

Required Packages :

...

  • JyFedoREST

...

Source file :

...

    ...

    ...

    Input port:

    ...

    • in dialog_info : 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.
    • 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 dissemination.

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

    • REST API Test5

    FCRepo GET Actor

    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 GETThe "FCRepo Serialzer" PythonActor is used in the following workflows:

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

    FCRepoDialogActor

    FCRepo Ingest Dialog Actor

    This actor displays a SWING dialog that allows the user to enter parameters required to connect to a Fedora Repository and create a new object with a single datastream.

    ...

    Screenshot :

    ...

    Image Added

    ...

    Required Packages :

    ...

    • FCRepoKepler - Uses SimpleHTMLFormDialog to display and manage the form.

    ...

    Source file :

    ...

    FCRepoDialogActorIngestDialogActor.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.
      • pid = identifier of object to create.
      • objLabel = label for object to create.
      • dsid = identifier of datastream to be created.
      • dsLabel = label for datastream to be created.
      • dsLocation = URL of file containing datastream content.
      • mimeType = mime type of datastream content.

    The "FCRepo Ingest 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.

    • Ingest With Datastream

    FCRepo Object Create Actor

    This actor connects to a Fedora Respoitory and creates a new object.

    ...

    Required Packages :

    ...

    • JyFedoREST

    ...

    Source file :

    ...

    FCRepoDatastreamDialogActorObjectCreateActor.py

    ...

    Input port:

    ...

    • None

    ...

    Output port:

    ...

    • injest_info : ObjectToken containing a Jython dictionary containing data from a form usbmitted via "FCRepo Ingest 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.
      • objLabel = label for object to be created.
      • dsid = identifier of datastream to be queried.
      • dsLabel = label for datastream to be created.
      • dsLocation = URL of file containing datastream content.
      • mimeType = mime type of datastream content.

    ...

    Output ports:

    ...

    • result : StringToken containing results of the request to add a dissemination.
    • datastream
    • out : ObjectToken containing a Jython dictionary with name/value pairs for all from 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 of object to be accessedcreate.
      • dsid = identifier of datastream to be accessedqueried.
      • dsLabel = label for datastream to be created.
      • dsLocation = URL of file containing datastream content.
      • mimeType = mime type of datastream content.

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

    • REST-API-Test5
    • Ingest With Datastream

    FCRepo Update Datastream Actor

    This actor connects to a Fedora Respoitory and updates a datastream in an existing object.

    ...

    Required Packages :

    ...

    • JyFedoREST

    ...

    ...

    Source file :

    ...

    ...

    DatastreamUpdateActor.py

    ...

    Input port:

    ...

    • dialogfcrepo_info : ObjectToken containing a Jython dictionary containing data from a form usbmitted submitted via "FCRepo Datastream Dialog". Alternately, any a 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.
      • dsLabel = label for datastream to be created.
      • dsLocation = URL of file containing datastream content.
      • mimeType = mime type of datastream content.
      • controlGroup = datastream control group, optional, defaults to 'M'.
      • dsState = datastream state, optional, defaults to 'A'.
      • versionable = whether datastream is versionable, optional, defaults to True.
      • formatURI = URI of datastream format description, optional, no default.
      • checksumType = datastream checksum type, optional, no default.
      • altIDs = list of alternate IDs for datastream, optional, no default.

    ...

    Other inputs :

    ...

    The "Datastream Update" script also needs to get name of the action to be performed. This can be done in one of two ways:
        A string parameter on the PythonActor named 'action'.
        OR
        A port on the PythonActor named 'action' containing a StringToken.

    ...

    Output port:

    ...

    • out result : ObjectToken containing a Jython object with the data returned by the request for a dissemnation.StringToken containing results of the request to update a datastream.

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

    • Update Datastream

    Format Serializer Actor

    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 SerialzerThe "FCRepo Dissemination" PythonActor is used in the following workflows:

    • REST API Test1
    • REST -API-Test5

    Kepler Workflows

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

    ...

    ...