Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Minor code cleanup
  • Loading branch information
ajs6f committed May 15, 2013
1 parent a8193a3 commit 72629b9
Show file tree
Hide file tree
Showing 44 changed files with 567 additions and 508 deletions.
5 changes: 4 additions & 1 deletion fcrepo-kernel/src/main/java/org/fcrepo/Datastream.java
Expand Up @@ -5,7 +5,10 @@
import static org.fcrepo.services.RepositoryService.metrics;
import static org.fcrepo.services.ServiceHelpers.getNodePropertySize;
import static org.fcrepo.utils.FedoraTypesUtils.getBinary;
import static org.modeshape.jcr.api.JcrConstants.*;
import static org.modeshape.jcr.api.JcrConstants.JCR_CONTENT;
import static org.modeshape.jcr.api.JcrConstants.JCR_DATA;
import static org.modeshape.jcr.api.JcrConstants.JCR_MIME_TYPE;
import static org.modeshape.jcr.api.JcrConstants.NT_RESOURCE;
import static org.slf4j.LoggerFactory.getLogger;

import java.io.InputStream;
Expand Down
2 changes: 0 additions & 2 deletions fcrepo-kernel/src/main/java/org/fcrepo/FedoraObject.java
Expand Up @@ -12,8 +12,6 @@
import javax.jcr.Session;
import javax.jcr.nodetype.NodeType;

import org.fcrepo.utils.FedoraJcrTypes;
import org.fcrepo.utils.FedoraTypesUtils;
import org.modeshape.jcr.api.JcrConstants;
import org.slf4j.Logger;

Expand Down
40 changes: 21 additions & 19 deletions fcrepo-kernel/src/main/java/org/fcrepo/FedoraResource.java
@@ -1,9 +1,22 @@
package org.fcrepo;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.update.GraphStore;
import com.hp.hpl.jena.update.GraphStoreFactory;
import com.hp.hpl.jena.update.UpdateAction;
import static org.fcrepo.services.ServiceHelpers.getObjectSize;
import static org.fcrepo.utils.FedoraTypesUtils.getBaseVersion;
import static org.fcrepo.utils.FedoraTypesUtils.getVersionHistory;
import static org.fcrepo.utils.FedoraTypesUtils.map;
import static org.fcrepo.utils.FedoraTypesUtils.nodetype2name;
import static org.slf4j.LoggerFactory.getLogger;

import java.util.Calendar;
import java.util.Collection;
import java.util.Date;

import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.nodetype.NodeType;
import javax.jcr.version.VersionHistory;

import org.fcrepo.utils.FedoraJcrTypes;
import org.fcrepo.utils.JcrPropertyStatementListener;
import org.fcrepo.utils.JcrRdfTools;
Expand All @@ -12,21 +25,10 @@
import org.modeshape.jcr.api.JcrTools;
import org.slf4j.Logger;

import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.nodetype.NodeType;
import javax.jcr.version.VersionHistory;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;

import static org.fcrepo.services.ServiceHelpers.getObjectSize;
import static org.fcrepo.utils.FedoraTypesUtils.getBaseVersion;
import static org.fcrepo.utils.FedoraTypesUtils.getVersionHistory;
import static org.fcrepo.utils.FedoraTypesUtils.map;
import static org.fcrepo.utils.FedoraTypesUtils.nodetype2name;
import static org.slf4j.LoggerFactory.getLogger;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.update.GraphStore;
import com.hp.hpl.jena.update.GraphStoreFactory;
import com.hp.hpl.jena.update.UpdateAction;

public class FedoraResource extends JcrTools implements FedoraJcrTypes {

Expand Down
4 changes: 0 additions & 4 deletions fcrepo-kernel/src/main/java/org/fcrepo/Transaction.java
@@ -1,6 +1,5 @@
package org.fcrepo;

import java.beans.Transient;
import java.util.Date;
import java.util.UUID;

Expand All @@ -10,9 +9,6 @@
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;

import org.codehaus.jackson.annotate.JsonIgnore;

@XmlRootElement(name = "transaction")
@XmlAccessorType(XmlAccessType.FIELD)
Expand Down
@@ -1,8 +1,8 @@

package org.fcrepo.observer;

import static com.google.common.collect.Iterables.filter;
import static com.codahale.metrics.MetricRegistry.name;
import static com.google.common.collect.Iterables.filter;
import static javax.jcr.observation.Event.NODE_ADDED;
import static javax.jcr.observation.Event.NODE_MOVED;
import static javax.jcr.observation.Event.NODE_REMOVED;
Expand All @@ -23,8 +23,8 @@
import org.modeshape.jcr.api.Repository;
import org.slf4j.Logger;

import com.google.common.eventbus.EventBus;
import com.codahale.metrics.Counter;
import com.google.common.eventbus.EventBus;

/**
* Simple JCR EventListener that filters JCR Events through a Fedora
Expand Down
@@ -1,12 +1,12 @@

package org.fcrepo.services;

import static com.codahale.metrics.MetricRegistry.name;
import static com.google.common.base.Throwables.propagate;
import static com.google.common.collect.Collections2.transform;
import static com.google.common.collect.ImmutableSet.builder;
import static com.google.common.collect.ImmutableSet.copyOf;
import static com.google.common.collect.Sets.difference;
import static com.codahale.metrics.MetricRegistry.name;
import static java.security.MessageDigest.getInstance;
import static org.fcrepo.services.RepositoryService.metrics;
import static org.fcrepo.utils.FixityResult.FixityState.REPAIRED;
Expand All @@ -33,25 +33,25 @@

import org.fcrepo.Datastream;
import org.fcrepo.services.functions.GetBinaryKey;
import org.infinispan.loaders.CacheLoaderException;
import org.modeshape.jcr.GetBinaryStore;
import org.fcrepo.services.functions.GetCacheStore;
import org.fcrepo.services.functions.GetGoodFixityResults;
import org.fcrepo.utils.FixityResult;
import org.fcrepo.utils.LowLevelCacheEntry;
import org.infinispan.Cache;
import org.infinispan.loaders.CacheLoaderException;
import org.infinispan.loaders.CacheStore;
import org.infinispan.loaders.decorators.ChainingCacheStore;
import org.modeshape.jcr.GetBinaryStore;
import org.modeshape.jcr.value.BinaryKey;
import org.modeshape.jcr.value.binary.BinaryStore;
import org.modeshape.jcr.value.binary.CompositeBinaryStore;
import org.modeshape.jcr.value.binary.infinispan.InfinispanBinaryStore;
import org.slf4j.Logger;

import com.google.common.base.Function;
import com.google.common.collect.ImmutableSet;
import com.codahale.metrics.Counter;
import com.codahale.metrics.Timer;
import com.google.common.base.Function;
import com.google.common.collect.ImmutableSet;

public class LowLevelStorageService {

Expand Down
18 changes: 10 additions & 8 deletions fcrepo-kernel/src/main/java/org/fcrepo/services/NodeService.java
@@ -1,21 +1,23 @@
package org.fcrepo.services;

import com.google.common.collect.ImmutableSet;
import org.fcrepo.FedoraResource;
import org.fcrepo.utils.FedoraJcrTypes;
import org.fcrepo.utils.FedoraTypesUtils;
import org.slf4j.Logger;
import static com.google.common.collect.ImmutableSet.builder;
import static org.slf4j.LoggerFactory.getLogger;

import java.util.Set;

import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.version.Version;
import javax.jcr.version.VersionHistory;
import java.util.Set;

import static com.google.common.collect.ImmutableSet.builder;
import static org.slf4j.LoggerFactory.getLogger;
import org.fcrepo.FedoraResource;
import org.fcrepo.utils.FedoraJcrTypes;
import org.fcrepo.utils.FedoraTypesUtils;
import org.slf4j.Logger;

import com.google.common.collect.ImmutableSet;

public class NodeService extends RepositoryService implements FedoraJcrTypes {

Expand Down
Expand Up @@ -13,8 +13,6 @@
import org.modeshape.jcr.api.JcrConstants;
import org.slf4j.Logger;

import com.google.common.collect.ImmutableSet.Builder;

/**
* Service for creating and retrieving FedoraObjects without using the JCR API.
*
Expand Down
Expand Up @@ -20,7 +20,6 @@
import javax.jcr.query.QueryResult;
import javax.jcr.query.RowIterator;

import com.codahale.metrics.Timer;
import org.fcrepo.metrics.RegistryService;
import org.fcrepo.utils.FedoraJcrTypes;
import org.fcrepo.utils.NamespaceTools;
Expand All @@ -30,6 +29,7 @@
import org.slf4j.LoggerFactory;

import com.codahale.metrics.MetricRegistry;
import com.codahale.metrics.Timer;

public class RepositoryService extends JcrTools implements FedoraJcrTypes {

Expand Down
Expand Up @@ -6,7 +6,6 @@

import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;

Expand Down
@@ -1,6 +1,8 @@

package org.fcrepo.utils;

import static org.slf4j.LoggerFactory.getLogger;

import java.util.Iterator;

import javax.jcr.Node;
Expand All @@ -10,8 +12,6 @@
import org.modeshape.jcr.api.JcrConstants;
import org.slf4j.Logger;

import static org.slf4j.LoggerFactory.getLogger;

public class DatastreamIterator implements Iterator<Datastream> {

private static final Logger logger = getLogger(DatastreamIterator.class);
Expand Down
Expand Up @@ -24,17 +24,17 @@
import javax.jcr.version.Version;
import javax.jcr.version.VersionHistory;

import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.hp.hpl.jena.rdf.model.ResourceFactory;

import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;
import org.modeshape.jcr.JcrValueFactory;
import org.modeshape.jcr.api.Namespaced;

import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.hp.hpl.jena.rdf.model.ResourceFactory;

/**
* Convenience class with static methods for manipulating Fedora types in the JCR.
*
Expand Down
@@ -1,17 +1,5 @@
package org.fcrepo.utils;

import com.hp.hpl.jena.rdf.listeners.StatementListener;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.Statement;
import org.modeshape.common.collection.Problems;
import org.modeshape.common.collection.SimpleProblems;
import org.slf4j.Logger;

import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Value;

import static org.fcrepo.utils.JcrRdfTools.getNodeFromGraphSubject;
import static org.fcrepo.utils.JcrRdfTools.getPropertyNameFromPredicate;
import static org.fcrepo.utils.JcrRdfTools.isFedoraGraphSubject;
Expand All @@ -20,6 +8,19 @@
import static org.fcrepo.utils.NodePropertiesTools.removeNodeProperty;
import static org.slf4j.LoggerFactory.getLogger;

import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Value;

import org.modeshape.common.collection.Problems;
import org.modeshape.common.collection.SimpleProblems;
import org.slf4j.Logger;

import com.hp.hpl.jena.rdf.listeners.StatementListener;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.Statement;

public class JcrPropertyStatementListener extends StatementListener {

private Problems problems;
Expand Down
38 changes: 22 additions & 16 deletions fcrepo-kernel/src/main/java/org/fcrepo/utils/JcrRdfTools.java
@@ -1,5 +1,27 @@
package org.fcrepo.utils;

import static com.google.common.base.Preconditions.checkArgument;
import static org.fcrepo.utils.FedoraJcrTypes.FCR_CONTENT;
import static org.slf4j.LoggerFactory.getLogger;

import java.util.Set;

import javax.jcr.Node;
import javax.jcr.Property;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Value;
import javax.jcr.ValueFactory;
import javax.jcr.version.Version;
import javax.jcr.version.VersionHistory;
import javax.jcr.version.VersionIterator;

import org.fcrepo.services.LowLevelStorageService;
import org.modeshape.jcr.api.JcrConstants;
import org.modeshape.jcr.api.NamespaceRegistry;
import org.slf4j.Logger;

import com.google.common.collect.BiMap;
import com.google.common.collect.ImmutableBiMap;
import com.hp.hpl.jena.datatypes.RDFDatatype;
Expand All @@ -9,22 +31,6 @@
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.ResourceFactory;
import org.fcrepo.services.LowLevelStorageService;
import org.modeshape.jcr.api.JcrConstants;
import org.modeshape.jcr.api.NamespaceRegistry;
import org.slf4j.Logger;

import javax.jcr.*;
import javax.jcr.version.Version;
import javax.jcr.version.VersionHistory;
import javax.jcr.version.VersionIterator;


import java.util.Set;

import static com.google.common.base.Preconditions.checkArgument;
import static org.fcrepo.utils.FedoraJcrTypes.FCR_CONTENT;
import static org.slf4j.LoggerFactory.getLogger;

public abstract class JcrRdfTools {

Expand Down
Expand Up @@ -14,7 +14,6 @@
import java.lang.reflect.Field;
import java.net.URI;
import java.security.MessageDigest;
import java.util.Arrays;
import java.util.Properties;

import org.apache.poi.util.IOUtils;
Expand Down
@@ -1,18 +1,19 @@
package org.fcrepo.utils;

import org.slf4j.Logger;
import static org.fcrepo.utils.FedoraTypesUtils.getDefinitionForPropertyName;
import static org.slf4j.LoggerFactory.getLogger;

import java.util.ArrayList;
import java.util.Collections;

import javax.jcr.Node;
import javax.jcr.Property;
import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
import javax.jcr.Value;
import javax.jcr.nodetype.PropertyDefinition;
import java.util.ArrayList;
import java.util.Collections;

import static org.fcrepo.utils.FedoraTypesUtils.getDefinitionForPropertyName;
import static org.slf4j.LoggerFactory.getLogger;
import org.slf4j.Logger;

public abstract class NodePropertiesTools {

Expand Down
Expand Up @@ -6,7 +6,6 @@

import javax.jcr.Repository;

import org.modeshape.jcr.JcrRepository;
import org.modeshape.jcr.value.binary.BinaryStore;

import com.google.common.base.Function;
Expand Down

0 comments on commit 72629b9

Please sign in to comment.