Introduction#

makumba has a Java API that makes it possible to perform various database-related operations.

org.makumba.Pointer#

A makumba org.makumba.Pointer is an object that uniquely identifies a database record. It can have different forms:
  • the internal form, which is used by makumba to access the object in the database
  • the Java form, as Pointer object
  • the external form, which is a 7 character long string that uniquely identifies the record and its type. This form is mostly used in JSP pages, as CGI parameters.

For instance, let’s consider the following JSP page listProjects.jsp:

<%@ taglib uri="http://www.makumba.org/presentation" prefix="mak"%>

<mak:list from="company.Project p" where="p = $project">
    <mak:value expr="p.name" />, pointer: <mak:value expr="p" /><br />
    <mak:value expr="p" var="projectPointer" />
</mak:list>

This page can then be called with the following URI: listProjects.jsp?projects=nxdcdc2

nxdcdc2 is the external form of the makumba Pointer to a specific record.

The <mak:value expr="p" /> will also print this string, whereas the second mak:value will not result in any printed result, but will make "projectPointer" accessible as a Java page attribute inside the mak:list, having Pointer as its type. It could then be used by casting it to a Pointer, however, this is rarely needed, since the "project" page parameter can be used in all makumba tags through the $project attribute.

org.makumba.Attributes#

The makumba Attributes are a facade to a number of in-memory attributes coming from the form submission, the session, or the business logic.

Request submission Attributes#

These are the GET parameters that are submitted along with the form handled by a form handler. They can be either the form fields (however, those are accessible in the Dictionary of the handler) or additional hidden fields.

Session Attributes#

Those are Attributes bound to the user session.

Business Logic attributes#

It is possible to define special methods in the Business Logic of the following kind:
public Object find_sessPtr_generalPerson(Attributes a, Database db) throws LogicException {
  // code to lookup the Pointer of the Person based on the Attributes
}

This mechanism is most useful for the legacy authentication & authorization mechanism using the mak:login and mak:logout. See the authorization documentation for more information.

Warning

This mechanism of attribute-based authentication & authorization is deprecated. You should use the standard container authentication and actor-based authorization instead.

Warning

makumba Attributes are a legacy object that mixes different scopes (request and session). Until a better Business Logic design is available however, it is currently the only means of accessing these object in form handler methods. It is advised to use a different namespace for session attributes, as otherwise conflicts between form attributes and session attributes may occur.

org.makumba.Transaction#

A makumba Transcation represents a makumba database transaction. The usual way of working with Transactions in an unmanaged environment (i.e. outside of the form handler methods, where transactions are provided and need not to be closed / committed) is the following:
Transaction t = null;
try {
      t = TransactionProvider.getInstance().getConnectionToDefault();
  
      Vector<Dictionary<String, Object>> rows = t.executeQuery("SELECT p.name AS name FROM general.Person p WHERE p.age > $1", new Object[] { "18" });
      for(Dictionary<String, Object> row : rows) {
        System.out.println(row.get("name"));
      }
} finally {
      if(t != null) t.close();
}

Category Usage


Add Comment
« This page was last updated on July 21 2010