Poonam Anthony
Poonam Anthony

Reputation: 1998

Adding a new class to DSpace 4.2 xmlui

I want to add a new java class to DSpace. I've followed this link for adding a static page. I made all the necessary changes. After rebuilding the package and running ant update, I'm still not being able to see any change. I checked my dspace installation directory, and found that the class added by me in not there in it. It would be very helpful if I find a tutorial which explains step by step how to incorporate a new java class in DSpace 4.2. Could someone help me out or share some useful links. Thanks in advance.

I used the cocoon based method.These are the steps which I followed:

  1. I created a java file TestPage.java in [dspace-src]/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/discovery/.

  2. Then I made changes to the sitemap as specified in the instructions in the link in [dspace-src]/dspace-xmlui/src/main/resources/aspects/Discovery.

I added this under <map:transformers>

<map:transformer name="TestPage" src="org.dspace.app.xmlui.aspect.discovery.TestPage" />

This was added under <map:pipelines> <map:pipeline>

<map:match pattern="test">
  <map:transform type="TestPage"/>
  <map:serialize type="xml" />
</map:match>

And finally I changed page-structure.xsl to include a link to the new page which I created, within <xsl:template match="dri:body">

<a>
    <xsl:attribute name="href">
        <xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='contextPath'][not(@qualifier)]"/>
        <xsl:text>/test</xsl:text>
     </xsl:attribute>
     <i18n:text>Test</i18n:text>
</a><br/>

Upvotes: 0

Views: 288

Answers (1)

schweerelos
schweerelos

Reputation: 2189

Unfortunately, the instructions you were using are out of date for DSpace 4.2. The directory structure has changed. You will need to put your file into [dspace-src]/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/discovery/ instead.

The rest of your approach should be fine (at a cursory glance).

Upvotes: 0

Related Questions