Skip to content

Commit

Permalink
Minor: adds some javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Edwin Shin committed Feb 23, 2013
1 parent 70df6ff commit dc4f9b1
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 4 deletions.
28 changes: 25 additions & 3 deletions src/main/java/org/fcrepo/example/ReverseContentSequencerProxy.java
@@ -1,3 +1,4 @@

package org.fcrepo.example;

import javax.jcr.Node;
Expand All @@ -8,14 +9,35 @@
import org.modeshape.jcr.api.sequencer.Sequencer;

/**
* A Sequencer proxy for reverse_content_sequencer.rb.
* <p>A proxy/wrapper class for reverse_content_sequencer.rb.
*
* <p>This wrapper/proxy business is unfortunately required because:
* <ol>
* <li> Modeshape's Sequencer is presently an abstract class (rather than an
* interface), and
* <li> because jrubyc-generated Java classes extend org.jruby.RubyObject, so
* from ModeShape's perspective, your JRuby class isn't a Sequencer.
* </ol>
*
* <p>The code is, at least, mostly boilerplate. For your own implementations,
* you should only need to change:
* <ol>
* <li> the name of the proxy class (e.g. MySequencerProxy),
* <li> the filename (e.g. my_sequencer.rb),
* <li> the instantiation of your Ruby class (e.g. "MySequencer.new").
* </ol>
*
*/
public class ReverseContentSequencerProxy extends Sequencer {

/**
* An instance of ReverseContentSequencer.
*/
private Sequencer proxy;

/**
* Class constructor.
*/
public ReverseContentSequencerProxy() {
String filename = "reverse_content_sequencer.rb";

Expand All @@ -29,8 +51,8 @@ public ReverseContentSequencerProxy() {
}

@Override
public boolean execute(Property inputProperty, Node outputNode,
Context context) throws Exception {
public final boolean execute(final Property inputProperty,
final Node outputNode, final Context context) throws Exception {
return proxy.execute(inputProperty, outputNode, context);
}
}
5 changes: 5 additions & 0 deletions src/main/java/org/fcrepo/example/package-info.java
@@ -0,0 +1,5 @@

/**
Example code.
*/
package org.fcrepo.example;
17 changes: 16 additions & 1 deletion src/test/java/org/fcrepo/example/ReverseContentSequencerIT.java
Expand Up @@ -13,15 +13,30 @@
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
*
* Integration test for ReverseContentSequencer that brings up a repository
* instance.
*
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"/spring-test/master.xml"})
public class ReverseContentSequencerIT {

/**
* The injected repository instance.
*/
@Inject
private Repository repository;

/**
* Tests that when we add a {@Node}, and set a property, our sequencer
* adds a "reversed-content" node that has the text reversed.
*
* @throws Exception
*/
@Test
public void test() throws Exception {
public final void test() throws Exception {

Session session = repository.login();
Node root = session.getRootNode().addNode("jruby");
Expand Down

0 comments on commit dc4f9b1

Please sign in to comment.