The Object Model for Arara

This is our recomendation for the model of arara.

Sugestions are very welcome preferably before release: 2.0-a1-fine - Fine tunning.

To send suggestions, either send an email to any of the mailing lists or post an issue to our issue tracker by clicking on the "Issue Tracking" link on the menu.

Introduction

The first idea was to use torque as our persistnce layer. Torque works very well so this shouldn't be a problem. The thing is, if we want to change persistence layer, we must re-write loads of code.

We added a new layer (tire for n-tire) by acessing our model via interfaces. We will still stick to torque for our persistence layer, but acess it via the set of interfaces defined.

Interface layer

We provide a layer to our object model to enable the abstraction of the real persistence layer.

So, taking the example of an Object in our model representing Artifact we need to provide:

  • Artifact - An interface defining all necessary methods used on that item's persistent object which extends InterfaceObject
  • A class that implements that interface (ie: ArtifactImpl)

On the diagram bellow you can view the model for this layer using a torque implementation of Artifact

Simple example diagram for Artifact using torque

Our model resides on the br.usp.ime.arca.arara.om package. A listing of our objects and a short description is provided below.

Implementation using torque

Althought we are free of the implementation for the persistence layer, we still need to provide one. We stick with the initial idea of using torque.

The schema used for torque can be viewed in html format arara-schema.html or inline xml pasted in on: May-02-2002.

You can also refer to the cvs file arara-schema.xml for the latest updates.

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!DOCTYPE database SYSTEM 
 "http://jakarta.apache.org/turbine/dtd/database.dtd">

<database 
    name="arara" 
    >

    <table 
           name="ARARA_ARTIFACT"
           javaName="Artifact" 
           interface="InterfaceArtifact"
	   idMethod="idbroker"
           description="Artifact"
	   >

      <column 
               name="ARTIFACT_ID" 
               required="true" 
	       primaryKey="true" 
	       type="INTEGER" 	   
	       description="Unique identifier"
	       >
      </column>

	
    </table>

    <table 
           name="ARARA_ATTACHMENT" 
	   javaName="Attachment"
	   interface="InterfaceAttachment"
           idMethod="idbroker" 
	   description="Piece of information associated to an artifact"
	   >

      <column 
              name="ATTACHMENT_ID" 
	      primaryKey="true" 
	      required="true" 
	      type="INTEGER"
	      description="Unique identifier"
	      >
      </column>
 
      <column 
              name="ARTIFACT_ID" 
	      required="false" 
	      type="INTEGER"
	      description="Artifact this attachment is related to"
	      >
      </column>

      <column 
              name="ATTACHMENT_TYPE_ID" 
	      javaName="TypeId" 
	      required="true" 
	      type="INTEGER"
	      description="Type of attachment"	      
	      >
      </column>

      <column 
              name="ATTACHMENT_NAME" 
	      javaName="Name" 
	      required="true" 
	      type="VARCHAR" 
	      size="255"
	      description="Name displayed on the UI"
	      >
      </column>

      <column 
              name="ATTACHMENT_DATA" 
	      javaName="Data" 
	      required="false" 
	      type="VARBINARY"
	      description="Actual information constitutin the attachment"
	      >
      </column>

      <column 
              name="ATTACHMENT_FILE_PATH" 
	      javaName="FileName" 
	      required="false" 
	      type="VARCHAR" 
	      size="255"
	      description="Server side location of the file (relative to the central file storage"
	      >
      </column>

      <column 
              name="ATTACHMENT_MIME_TYPE" 
	      javaName="MimeType" 
	      required="true" 
	      type="VARCHAR" 
	      size="25"
	      description="MIME type of attachment"
	      >
       </column>

       <column 
               name="MODIFIED_BY" 
	       required="false" 
	       type="INTEGER"
	       description="Person that made last modification"
	       >
       </column>

       <column 
                name="CREATED_BY" 
		required="false" 
		type="INTEGER"
		description="person that created the attachment"
		>
       </column>

       <column 
               name="MODIFIED_DATE" 
	       required="false" 
	       type="TIMESTAMP"
	       description="Last modification date"
	       >
       </column>

       <column 
               name="CREATED_DATE" 
	       required="false" 
	       type="TIMESTAMP"
	       description="Creation date"
	       >
       </column>

       <column 
               name="DELETED" 
	       required="false" 
	       type="BOOLEANINT" 
	       default="0" 
	       size="1"
	       description="Flag marking if it was deleted"
	       >
       </column>

       <foreign-key 
                    foreignTable="ARARA_ARTIFACT"
		    name="ARTIFACT_FK"
		    onUpdate="none"
		    onDelete="none"
		    >
         <reference 
	            local="ARTIFACT_ID" 
		    foreign="ARTIFACT_ID"
		    />
       </foreign-key>

       <foreign-key 
                    foreignTable="ARARA_ATTACHMENT_TYPE"
		    name="ATTACHMENT_TYPE_FK"
		    onUpdate="none"
		    onDelete="none"
		    >
         <reference 
	            local="ATTACHMENT_TYPE_ID" 
		    foreign="ATTACHMENT_TYPE_ID"
		    />
       </foreign-key>

       <foreign-key 
                    foreignTable="ARARA_USER"
		    name="CREATED_BY_FK"
		    onUpdate="none"
		    onDelete="none"
		   >
         <reference 
	            local="CREATED_BY" 
		    foreign="USER_ID"
		    />
      </foreign-key>

      <foreign-key 
                    foreignTable="ARARA_USER"
		    name="MODIFIED_BY_FK"
		    onUpdate="none"
		    onDelete="none"
		   >
        <reference 
	           local="MODIFIED_BY" 
		   foreign="USER_ID"
		   />
      </foreign-key>

  </table>

  <table 
         name="ARARA_USER" 
	 javaName="AraraUser" 
	 alias="TurbineUser" 
	 baseClass="org.apache.fulcrum.security.impl.db.entity.TurbineUser"
         basePeer="org.apache.fulcrum.security.impl.db.entity.TurbineUserPeer"
	 interface="InterfaceAraraUser"
	 description="User"
	 >

    <column 
            name="USER_ID" 
	    primaryKey="true" 
	    required="true" 
	    type="INTEGER"
	    description="Unique identifier"
	    >
    </column>

  </table>

  <table 
         name="ARARA_ATTACHMENT_TYPE" 
	 idMethod="idbroker" 
	 javaName="AttachmentType"
	 interface="InterfaceAttachmentType"
	 description="Possible types of attachments (ie: Comment, File)"
	 >

    <column 
            name="ATTACHMENT_TYPE_ID" 
	    primaryKey="true" 
	    required="true" 
	    type="INTEGER" 
	    description="Unique identifier"
	    >
    </column>

    <column 
            name="ATTACHMENT_TYPE_NAME" 
	    javaName="Name" 
	    required="true" 
	    type="VARCHAR" 
	    size="255" 
	    description="type name"
	    >
    </column>

    <column 
            name="SEARCHABLE" 
	    default="0" 
	    type="BOOLEANINT" 
	    size="1" 
	    description="Flag marking a text searchable attachment"
	    >
    </column>

  </table>

</database>