Skip to content

Commit

Permalink
Checkstyle violation cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ajs6f committed Aug 22, 2013
1 parent 156c73c commit 303b84e
Show file tree
Hide file tree
Showing 20 changed files with 106 additions and 96 deletions.
Expand Up @@ -30,7 +30,7 @@
public class Transaction {

// the default timeout is 3 minutes
public static final long DEFAULT_TIMEOUT = 3l * 60l * 1000l;
public static final long DEFAULT_TIMEOUT = 3L * 60L * 1000L;

public static final String TIMEOUT_SYSTEM_PROPERTY = "fcrepo4.tx.timeout";

Expand All @@ -55,7 +55,7 @@ public static enum State {
* Create a transaction for the given Session
* @param session
*/
public Transaction(Session session) {
public Transaction(final Session session) {
super();
this.session = session;
this.created = new Date();
Expand Down
Expand Up @@ -45,7 +45,7 @@ public TxAwareSession(final Session session, final String txID) {

/**
* Wrap a JCR session with this dynamic proxy
*
*
* @param session a JCR session
* @param txId the transaction identifier
* @return a wrapped JCR session
Expand All @@ -58,8 +58,7 @@ public static Session newInstance(final Session session, final String txId) {

@Override
public Object invoke(final Object proxy, final Method method,
final Object[] args) throws ReflectiveOperationException,
IllegalArgumentException {
final Object[] args) throws ReflectiveOperationException {
if (method.getName().equals("logout") ||
method.getName().equals("save")) {
return null;
Expand Down
Expand Up @@ -16,6 +16,8 @@

package org.fcrepo.kernel.rdf;

import static com.hp.hpl.jena.sparql.util.Symbol.create;

import javax.jcr.Node;
import javax.jcr.RepositoryException;

Expand All @@ -25,10 +27,11 @@

public interface GraphProperties {

public static final Symbol URI_SYMBOL = Symbol.create("uri");
public static final Symbol INLINED_RESOURCES_MODEL = Symbol.create("inlined-resources-model");
Symbol URI_SYMBOL = create("uri");

Symbol INLINED_RESOURCES_MODEL = create("inlined-resources-model");

public static final String PROBLEMS_MODEL_NAME = "problems";
String PROBLEMS_MODEL_NAME = "problems";

/**
* Return the name of the model this property factory will insert
Expand Down
Expand Up @@ -30,20 +30,31 @@
import com.hp.hpl.jena.sparql.util.Context;
import com.hp.hpl.jena.sparql.util.Symbol;

public class SerializationUtils {
/**
* Utilities for serializing RDF.
*
* @author ajs6f
* @date Aug 22, 2013
*/
public final class SerializationUtils {

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

public static final Symbol subjectKey = Symbol.create("uri");

private SerializationUtils() {
throw new AssertionError(this.getClass().getName()
+ " is a helper class which should never be instantiated!");
}

/**
* Set the subject of the dataset by injecting a context "uri"
*
* @param rdf
* @return
*/
public static void setDatasetSubject(final Dataset rdf, final String uri) {
Context context = rdf.getContext();
final Context context = rdf.getContext();
context.set(subjectKey, uri);
}

Expand All @@ -54,8 +65,8 @@ public static void setDatasetSubject(final Dataset rdf, final String uri) {
* @return
*/
public static Node getDatasetSubject(final Dataset rdf) {
Context context = rdf.getContext();
String uri = context.getAsString(subjectKey);
final Context context = rdf.getContext();
final String uri = context.getAsString(subjectKey);
logger.debug("uri from context: {}", uri);
if (uri != null) {
return createURI(uri);
Expand Down
Expand Up @@ -42,7 +42,7 @@
* create/commit/rollback {@link Transaction} objects A {@link Scheduled}
* annotation is used for removing timed out Transactions
*
*
*
* @author frank asseg
*/
@Component
Expand All @@ -56,7 +56,7 @@ public class TransactionService {
static final String FCREPO4_TX_ID = "fcrepo4.tx.id";

/*
* TODO: since transactions have to be available on all nodes, they have to
* TODO since transactions have to be available on all nodes, they have to
* be either persisted or written to a distributed map or sth, not just this
* plain hashmap that follows
*/
Expand Down Expand Up @@ -92,7 +92,7 @@ public void removeAndRollbackExpired() {

/**
* Create a new Transaction and add it to the currently open ones
*
*
* @param sess The session to use for this Transaction
* @return the {@link Transaction}
*/
Expand All @@ -106,7 +106,7 @@ public Transaction beginTransaction(final Session sess) throws RepositoryExcepti

/**
* Retrieve an open {@link Transaction}
*
*
* @param txid the Id of the {@link Transaction}
* @return the {@link Transaction}
*/
Expand Down Expand Up @@ -149,14 +149,14 @@ public Transaction getTransaction(final Session session)
public static String getCurrentTransactionId(final Session session) {
try {
return session.getNamespaceURI(FCREPO4_TX_ID);
} catch (RepositoryException e) {
} catch (final RepositoryException e) {
return null;
}
}

/**
* Check if a Transaction exists
*
*
* @param txid the Id of the {@link Transaction}
* @return the {@link Transaction}
*/
Expand All @@ -166,7 +166,7 @@ public boolean exists(final String txid) {

/**
* Commit a {@link Transaction} with the given id
*
*
* @param txid the id of the {@link Transaction}
* @throws RepositoryException
*/
Expand All @@ -182,7 +182,7 @@ public Transaction commit(final String txid) throws RepositoryException {

/**
* Roll a {@link Transaction} back
*
*
* @param txid the id of the {@link Transaction}
* @return the {@link Transaction} object
* @throws RepositoryException if the {@link Transaction} could not be found
Expand Down
Expand Up @@ -30,46 +30,46 @@ public interface StoragePolicyDecisionPoint {

/**
* Add a new storage policy
*
*
* @param p org.fcrepo.kernel.services.policy object
*/
public abstract void addPolicy(Policy p);
void addPolicy(final Policy p);

/**
* Given a JCR node (likely a jcr:content node), determine which storage
* policy should apply
*
*
* @param n
* @return
*/
public abstract String evaluatePolicies(Node n);
String evaluatePolicies(final Node n);

/**
* Remove a storage policy
*
*
* @param p org.fcrepo.kernel.services.policy object
*/
public abstract void removePolicy(Policy p);
void removePolicy(final Policy p);

/**
* Explicitly set the policies this PDP should use
*
*
* @param policies
*/
public abstract void setPolicies(List<Policy> policies);
void setPolicies(final List<Policy> policies);

/**
* @param policy
*/
public abstract boolean contains(Policy policy);
boolean contains(final Policy policy);

/**
* clear all policies
*/
public void removeAll();
void removeAll();

/**
* @return policies size
*/
public abstract int size();
}
int size();
}
Expand Up @@ -18,7 +18,7 @@

/**
* A convenient abstraction over JCR's integer-typed events.
*
*
* @author ajs6f
* @date Feb 7, 2013
*/
Expand All @@ -28,7 +28,7 @@ public enum EventType {

/**
* Get the Fedora event type for a JCR type
*
*
* @param i
* @return
*/
Expand All @@ -50,8 +50,8 @@ public static EventType getEventType(final Integer i) {
return PERSIST;
// no default
default:
throw new IllegalArgumentException("Invalid JCR event type: " +
i);
throw new IllegalArgumentException("Invalid JCR event type: "
+ i);
}
}

Expand All @@ -78,8 +78,8 @@ public static String getEventName(final Integer jcrEvent) {
return "persist";
// no default
default:
throw new IllegalArgumentException("Invalid JCR event type: " +
jcrEvent);
throw new IllegalArgumentException("Invalid JCR event type: "
+ jcrEvent);
}
}
}
Expand Up @@ -64,7 +64,7 @@
/**
* Convenience class with static methods for manipulating Fedora types in the
* JCR.
*
*
* @author ajs6f
* @date Feb 14, 2013
*/
Expand Down Expand Up @@ -248,7 +248,7 @@ public com.hp.hpl.jena.rdf.model.Property apply(

/**
* Creates a JCR {@link Binary}
*
*
* @param n a {@link Node}
* @param i an {@link InputStream}
* @return a JCR {@link Binary}
Expand All @@ -267,7 +267,7 @@ public static Binary getBinary(final Node n, final InputStream i) {

/**
* Creates a JCR {@link Binary}
*
*
* @param n a {@link Node}
* @param i an {@link InputStream}
* @return a JCR {@link Binary}
Expand All @@ -289,7 +289,7 @@ public static Binary getBinary(final Node n, final InputStream i,

/**
* Get the JCR Node Type manager
*
*
* @param node
* @return
* @throws RepositoryException
Expand All @@ -302,7 +302,7 @@ public static NodeTypeManager getNodeTypeManager(final Node node)
/**
* Get the property definition information (containing type and multi-value
* information)
*
*
* @param node the node to use for inferring the property definition
* @param propertyName the property name to retrieve a definition for
* @return a JCR PropertyDefinition, if available, or null
Expand All @@ -326,7 +326,7 @@ public static PropertyDefinition getDefinitionForPropertyName(
/**
* Convenience method for transforming arrays into {@link Collection}s
* through a mapping {@link Function}.
*
*
* @param input A Collection<F>.
* @param f A Function<F,T>.
* @return An ImmutableSet copy of input after transformation by f
Expand All @@ -348,7 +348,7 @@ public static String convertDateToXSDString(final long date) {

/**
* Get the JCR Base version for a node
*
*
* @param node
* @return
* @throws RepositoryException
Expand All @@ -360,21 +360,20 @@ public static Version getBaseVersion(final Node node)
}

/**
* Get the JCR VersionHistory for an existing node
*
* Get the JCR VersionHistory for an existing node.
*
* @param node
* @return
* @throws RepositoryException
*/

public static VersionHistory getVersionHistory(final Node node)
throws RepositoryException {
return getVersionHistory(node.getSession(), node.getPath());
}

/**
* Get the JCR VersionHistory for a node at a given JCR path
*
*
* @param session
* @param path
* @return
Expand Down

0 comments on commit 303b84e

Please sign in to comment.