Skip to content

Commit

Permalink
Changing logging fully to slf4j
Browse files Browse the repository at this point in the history
  • Loading branch information
ajs6f committed Feb 4, 2013
1 parent 29714bf commit 4922f6c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 39 deletions.
6 changes: 0 additions & 6 deletions src/main/java/org/fcrepo/modeshape/FedoraNamespaces.java
Expand Up @@ -16,7 +16,6 @@

import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.modeshape.jcr.ConfigurationException;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
Expand All @@ -26,11 +25,6 @@
@Path("/namespaces")
public class FedoraNamespaces extends AbstractResource {

public FedoraNamespaces() throws ConfigurationException,
RepositoryException, IOException {
super();
}

@POST
@Path("/{ns}")
public Response registerObjectNamespace(@PathParam("ns") final String ns)
Expand Down
60 changes: 29 additions & 31 deletions src/main/java/org/fcrepo/modeshape/FedoraObjects.java
Expand Up @@ -4,7 +4,12 @@
import java.io.InputStream;
import java.util.Calendar;

import javax.jcr.*;
import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.Property;
import javax.jcr.PropertyIterator;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
Expand All @@ -13,8 +18,8 @@
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;

import org.modeshape.common.logging.Logger;
import org.modeshape.jcr.ConfigurationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.collect.ImmutableMap;

Expand All @@ -23,31 +28,26 @@
@Path("/objects")
public class FedoraObjects extends AbstractResource {

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

public FedoraObjects() throws ConfigurationException, RepositoryException,
IOException {
super();
}


@GET
public Response getObjects() throws RepositoryException {
final Session session = repo.login();
Node root = session.getRootNode();
StringBuffer nodes = new StringBuffer();
@GET
public Response getObjects() throws RepositoryException {
final Session session = repo.login();
Node root = session.getRootNode();
StringBuffer nodes = new StringBuffer();

for (NodeIterator i = root.getNodes(); i.hasNext();) {
Node n = i.nextNode();
nodes.append("Name: " + n.getName() + ", Path:" + n.getPath()
+ "\n");
}
session.logout();
return Response.ok().entity(nodes.toString()).build();
for (NodeIterator i = root.getNodes(); i.hasNext();) {
Node n = i.nextNode();
nodes.append("Name: " + n.getName() + ", Path:" + n.getPath()
+ "\n");
}
session.logout();
return Response.ok().entity(nodes.toString()).build();

}
}

@POST
@POST
@Path("/new")
public Response ingestAndMint() throws RepositoryException {
return ingest(pidMinter.mintPid());
Expand All @@ -66,8 +66,6 @@ public Response ingest(@PathParam("pid") final String pid)
final Node obj = jcrTools.findOrCreateNode(session, "/" + pid,
"nt:folder");
obj.addMixin("fedora:object");
/* ws.getLockManager()
.lock("/" + pid, false, true, Long.MAX_VALUE, ""); */
obj.addMixin("fedora:owned");
obj.setProperty("fedora:ownerId", "Fedo Radmin");
obj.setProperty("jcr:lastModified", Calendar.getInstance());
Expand All @@ -76,6 +74,7 @@ public Response ingest(@PathParam("pid") final String pid)
logger.debug("Finished ingest with pid: " + pid);
return Response.status(Response.Status.CREATED).entity(pid).build();
} else {
session.logout();
return four01;
}
}
Expand All @@ -96,13 +95,12 @@ public Response getObjectInXML(@PathParam("pid") final String pid)
Property p = i.nextProperty();
b.put(p.getName(), p.toString());
}
InputStream content = renderTemplate("objectProfile.ftl", ImmutableMap
.of("obj", obj, "properties", b.build()));
InputStream content = renderTemplate("objectProfile.ftl",
ImmutableMap.of("obj", obj, "properties", b.build()));
session.logout();
return Response
.ok()
.entity(content).build();
return Response.ok().entity(content).build();
} else {
session.logout();
return four04;
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/fcrepo/modeshape/FedoraRepository.java
Expand Up @@ -14,8 +14,9 @@

import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.modeshape.common.logging.Logger;
import org.slf4j.Logger;
import org.modeshape.jcr.api.nodetype.NodeTypeManager;
import org.slf4j.LoggerFactory;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableMap.Builder;
Expand All @@ -31,7 +32,8 @@
@Path("")
public class FedoraRepository extends AbstractResource {

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

@GET
@Path("/describe/modeshape")
Expand Down

0 comments on commit 4922f6c

Please sign in to comment.