Skip to content

Commit

Permalink
Added in-line comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ajs6f committed Feb 2, 2013
1 parent db852c7 commit 30af5c2
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main/java/org/fcrepo/modeshape/observer/JMSTopicPublisher.java
Expand Up @@ -53,13 +53,15 @@ public class JMSTopicPublisher {
private Session jmsSession;
private MessageProducer producer;

// Atom engine
final static private Abdera abdera = new Abdera();

// maps JCR mutations to Fedora Classic API method types
private OperationsMappings operationsMappings;

final private Logger logger = LoggerFactory
.getLogger(JMSTopicPublisher.class);

private OperationsMappings operationsMappings;

@Subscribe
public void publishJCREvent(Event jcrEvent) throws JMSException,
RepositoryException, IOException {
Expand All @@ -69,6 +71,7 @@ public void publishJCREvent(Event jcrEvent) throws JMSException,
entry.setTitle(operationsMappings.getFedoraMethodType(jcrEvent), TEXT)
.setBaseUri("http://localhost:8080/rest");

// assume that the PID is the last section of the node path
String path = jcrEvent.getPath();
String pid = path.substring(path.lastIndexOf('/') + 1, path.length());
entry.addCategory("xsd:string", pid, "fedora-types:pid");
Expand All @@ -84,7 +87,7 @@ public void publishJCREvent(Event jcrEvent) throws JMSException,
@PostConstruct
public void acquireConnections() throws JMSException, LoginException,
RepositoryException {
logger.debug("Initializing " + this.getClass().getCanonicalName());
logger.debug("Initializing: " + this.getClass().getCanonicalName());

operationsMappings = new OperationsMappings();

Expand All @@ -97,17 +100,21 @@ public void acquireConnections() throws JMSException, LoginException,

@PreDestroy
public void releaseConnections() throws JMSException {
logger.debug("Tearing down: " + this.getClass().getCanonicalName());

operationsMappings.session.logout();

producer.close();
jmsSession.close();
connection.close();
eventBus.unregister(this);
}

// maps JCR mutations to Fedora Classic API method types
final private class OperationsMappings {

// this actor will never mutate the state of the repo,
// so we keep the jmsSession live for efficiency
// so we keep the session live for efficiency
private javax.jcr.Session session;

public String getFedoraMethodType(Event jcrEvent)
Expand Down

0 comments on commit 30af5c2

Please sign in to comment.