Skip to content

Commit

Permalink
add basic javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Dec 16, 2013
1 parent 4007c3c commit ec2e8e1
Show file tree
Hide file tree
Showing 26 changed files with 114 additions and 20 deletions.
Expand Up @@ -15,6 +15,9 @@
*/
package org.fcrepo.auth.oauth;

/**
* OAuth constants
*/
public interface Constants {

static final String OAUTH_WORKSPACE = "oauth";
Expand Down
Expand Up @@ -20,6 +20,9 @@
import org.apache.oltu.oauth2.as.request.OAuthTokenRequest;


/**
* Validations for OAuth token requests
*/
public interface TokenRequestValidations {
/**
* Checks the validity of the auth code attached to the given request
Expand Down
Expand Up @@ -37,7 +37,9 @@
import org.fcrepo.http.commons.session.SessionFactory;
import org.slf4j.Logger;


/**
* Default audits and validations for an OAuth token request
*/
public class DefaultTokenRequestValidations implements TokenRequestValidations {

private static final Logger LOGGER =
Expand Down
Expand Up @@ -40,6 +40,7 @@
import org.springframework.beans.factory.annotation.Autowired;

/**
* Policy enforcement point for roles-based authentication
* @author Gregory Jansen
*/
public abstract class AbstractRolesPEP implements FedoraPolicyEnforcementPoint {
Expand Down Expand Up @@ -247,6 +248,9 @@ public abstract boolean rolesHaveModeShapePermission(String absPath,
String[] actions, Set<Principal> allPrincipals,
Principal userPrincipal, Set<String> roles);

/**
* Filter paths for reading
*/
public class PathIterator implements Iterator<Path> {

private Path next = null;
Expand Down
Expand Up @@ -37,6 +37,9 @@
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
* Repository-wide backup endpoint
*/
@Component
@Scope("prototype")
@Path("/fcr:backup")
Expand All @@ -57,7 +60,7 @@ public class FedoraRepositoryBackup extends AbstractResource {
@POST
public String runBackup(final InputStream bodyStream) throws RepositoryException, IOException {

File backupDirectory = null;
File backupDirectory;
if (null != bodyStream) {
final String body = IOUtils.toString(bodyStream).trim();

Expand Down
Expand Up @@ -42,6 +42,9 @@
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
* Restore a backup of the repository
*/
@Component
@Scope("prototype")
@Path("/fcr:restore")
Expand Down
Expand Up @@ -22,6 +22,9 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* COPY HTTP method
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@HttpMethod("COPY")
Expand Down
Expand Up @@ -22,6 +22,9 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* MOVE HTTP method
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@HttpMethod("MOVE")
Expand Down
Expand Up @@ -24,6 +24,9 @@

import javax.ws.rs.HttpMethod;

/**
* PATCH HTTP method
*/
@Target({METHOD})
@Retention(RUNTIME)
@HttpMethod("PATCH")
Expand Down
Expand Up @@ -48,7 +48,20 @@ public RangeRequestInputStream(final InputStream in,
}


/**
* An InputStream wrapper that skips bytes
* @param in
* @param skip
* @throws IOException
*/
private static class SkipInputStream extends ProxyInputStream {

/**
* An InputStream wrapper that always skips the first N bytes
* @param in
* @param skip
* @throws IOException
*/
public SkipInputStream(final InputStream in,
final long skip) throws IOException {
super(in);
Expand Down
Expand Up @@ -48,16 +48,26 @@ public ExecutionContext authenticate(final Credentials credentials,
final Map<String, Object> sessionAttributes) {
if (credentials instanceof ServletCredentials) {
return repositoryContext
.with(new AnonymousAdminSecurityContext());
.with(new AnonymousAdminSecurityContext("bypassAdmin"));
} else {
return null;
}

}

/**
* Security context with complete
*/
public static class AnonymousAdminSecurityContext implements
SecurityContext {

private String userName;

public AnonymousAdminSecurityContext(final String userName) {

this.userName = userName;
}

/*
* (non-Javadoc)
* @see org.modeshape.jcr.security.SecurityContext#isAnonymous()
Expand All @@ -73,7 +83,7 @@ public boolean isAnonymous() {
*/
@Override
public String getUserName() {
return "bypassAdmin";
return userName;
}

/*
Expand Down
20 changes: 11 additions & 9 deletions fcrepo-kernel/src/main/java/org/fcrepo/kernel/Datastream.java
Expand Up @@ -74,6 +74,7 @@ public Datastream(final Node n) {
* Create or find a FedoraDatastream at the given path
* @param session the JCR session to use to retrieve the object
* @param path the absolute path to the object
* @param nodeType primary type to assign to node
* @throws RepositoryException
*/
public Datastream(final Session session, final String path,
Expand Down Expand Up @@ -127,10 +128,13 @@ public InputStream getContent() throws RepositoryException {
/**
* Sets the content of this Datastream.
*
*
* @param content
* @param originalFileName
* @param content InputStream of binary content to be stored
* @param contentType MIME type of content (optional)
* @param checksum Checksum URI of the content (optional)
* @param originalFileName Original file name of the content (optional)
* @param storagePolicyDecisionPoint Policy decision point for storing the content (optional)
* @throws RepositoryException
* @throws InvalidChecksumException
*/
public void setContent(final InputStream content, final String contentType,
final URI checksum, final String originalFileName,
Expand Down Expand Up @@ -199,7 +203,7 @@ public void setContent(final InputStream content, final String contentType,

/**
* Set the content of this datastream
* @param content
* @param content Binary content to be stored
* @throws InvalidChecksumException
* @throws RepositoryException
*/
Expand All @@ -210,7 +214,6 @@ public void setContent(final InputStream content) throws InvalidChecksumExceptio

/**
* @return The size in bytes of content associated with this datastream.
* @throws RepositoryException
*/
public long getContentSize() {
try {
Expand Down Expand Up @@ -269,7 +272,7 @@ public String getMimeType() throws RepositoryException {

/**
* Return the calculated size of the DS node
* @return
* @return combined size of the properties and binary content
* @throws RepositoryException
*/
@Override
Expand All @@ -280,7 +283,7 @@ public long getSize() throws RepositoryException {

/**
* Return the file name for the binary content
* @return
* @return original file name for the binary content, or the object's id.
* @throws RepositoryException
*/
public String getFilename() throws RepositoryException {
Expand Down Expand Up @@ -316,8 +319,7 @@ private void decorateContentNode(final Node contentNode)

/**
* Check if the node has a fedora:datastream mixin
* @param node
* @return
* @param node node to check
* @throws RepositoryException
*/
public static boolean hasMixin(final Node node) throws RepositoryException {
Expand Down
Expand Up @@ -54,6 +54,7 @@ public FedoraObject(final Node node) {
* Create or find a FedoraObject at the given path
* @param session the JCR session to use to retrieve the object
* @param path the absolute path to the object
* @param nodeType primary type to assign to created object
* @throws RepositoryException
*/
public FedoraObject(final Session session, final String path,
Expand Down
Expand Up @@ -121,7 +121,7 @@ private void initializeNewResourceProperties(final Session session,
/**
* Is the given node a frozen node?
*
* @param node
* @param node Node to check
* @return
* @throws RepositoryException
*/
Expand All @@ -133,7 +133,7 @@ public static boolean isFrozen(final Node node) throws RepositoryException {
* Is the given node a Fedora resource
* (because it has a fedora:resource mixin)?
*
* @param node
* @param node Node to check
* @return
* @throws RepositoryException
*/
Expand Down Expand Up @@ -258,7 +258,7 @@ public Dataset updatePropertiesDataset(final GraphSubjects subjects,
/**
* Return the JCR properties of this object as a Jena {@link Dataset}
*
* @param subjects
* @param graphSubjects
* @param offset
* @param limit
* @return
Expand Down Expand Up @@ -298,6 +298,7 @@ public Dataset getPropertiesDataset(final GraphSubjects graphSubjects,

/**
* Return the JCR properties of this object as a Jena {@link Dataset}
* @param graphSubjects
* @return
* @throws RepositoryException
*/
Expand All @@ -308,6 +309,7 @@ public Dataset getPropertiesDataset(final GraphSubjects subjects)

/**
* Return the JCR properties of this object as an {@link RdfStream}
* @param graphSubjects
* @return
* @throws RepositoryException
*/
Expand All @@ -322,6 +324,7 @@ public RdfStream getTriples(final GraphSubjects graphSubjects)

/**
* Return the JCR properties of this object as an {@link RdfStream}
* @param graphSubjects
* @return
* @throws RepositoryException
*/
Expand Down Expand Up @@ -371,7 +374,7 @@ public boolean isNew() {
* Replace the properties of this object with the properties from the given
* model
*
* @param subjects
* @param graphSubjects
* @param inputModel
* @return
* @throws RepositoryException
Expand Down
Expand Up @@ -43,8 +43,9 @@ public MalformedRdfException(final String msg) {
* Ordinary constructor.
*
* @param msg
* @param rootCause
*/
public MalformedRdfException(final String msg, Throwable rootCause) {
public MalformedRdfException(final String msg, final Throwable rootCause) {
super(msg, rootCause);
}

Expand Down
Expand Up @@ -16,6 +16,9 @@

package org.fcrepo.kernel.exception;

/**
* Runtime exception that wraps a RepositoryException
*/
public class RepositoryRuntimeException extends RuntimeException {

private static final long serialVersionUID = 1L;
Expand All @@ -34,6 +37,7 @@ public RepositoryRuntimeException(final String msg) {
* Ordinary constructor.
*
* @param msg
* @param rootCause
*/
public RepositoryRuntimeException(final String msg, Throwable rootCause) {
super(msg, rootCause);
Expand Down
Expand Up @@ -29,11 +29,13 @@ public interface PidMinter {

/**
* Mint a new PID
* @return a new identifier
*/
String mintPid();

/**
* Provide a helpful function to mint any number of PIDs
* @return a function for minting new identifiers
*/
Function<Object, String> makePid();
}
Expand Up @@ -58,6 +58,7 @@ public FedoraEvent(final Event e) {
* Wrap a JCR Event with our FedoraEvent decorators
* and include the type given in the info map
* @param e
* @param wrappedNodeType type of node for the event
*/
public FedoraEvent(final Event e, final String wrappedNodeType) {
checkArgument(e != null, "null cannot support a FedoraEvent!");
Expand Down
Expand Up @@ -53,14 +53,15 @@ Node getNodeFromGraphSubject(final Resource subject)
String getPathFromGraphSubject(final Resource subject) throws RepositoryException;

/**
* Predicate for determining whether this {@link Node} is a Fedora object.
* Predicate for determining whether this {@link Resource} is a Fedora object.
* @param subject
* @return
*/
boolean isFedoraGraphSubject(final Resource subject);

/**
* Get the RDF resource for an absolute path
*
*
* @param absPath the absolute path to the JCR node
* @return an RDF URI resource
* @throws RepositoryException
Expand Down
Expand Up @@ -33,6 +33,10 @@
import static org.fcrepo.kernel.utils.FixityResult.FixityState.SUCCESS;
import static org.slf4j.LoggerFactory.getLogger;

/**
* Cache entry that wraps a binary stream and provides
* fixity methods against it
*/
public abstract class BasicCacheEntry implements CacheEntry {

private static final Logger LOGGER = getLogger(BasicCacheEntry.class);
Expand Down
Expand Up @@ -20,6 +20,9 @@

import javax.jcr.Binary;

/**
* Cache entry for a projected binary
*/
public class ProjectedCacheEntry extends BinaryCacheEntry {

/**
Expand Down

0 comments on commit ec2e8e1

Please sign in to comment.