Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting the entire code base #1476

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 8 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# formatting test
8eecf0d312ae06dd8fc4f873d56eb3921a2e6d41

# formatting oak-core
f3f602461c8901c01513490e3f8f5d204ea9fff2

# formatting rest of the code
ca6668c53ce5f637f2f7d7d7d951a76d8d95d1f1
14 changes: 7 additions & 7 deletions oak-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ The API for accessing core Oak functionality is located in the
`org.apache.jackrabbit.oak.api` package and consists of the following
key interfaces:

* ContentRepository
* ContentSession
* Root / Tree
* ContentRepository
* ContentSession
* Root / Tree

The `ContentRepository` interface represents an entire Oak content repository.
The repository may local or remote, or a cluster of any size. These deployment
Expand Down Expand Up @@ -52,8 +52,8 @@ that they are not accessed concurrently from multiple threads. `Tree`
instances *are* however thread-safe for read access, so implementations
need to ensure that all reading clients see a coherent state.

Content trees are recursive data structures that consist of named properties
and subtrees that share the same namespace, but are accessed through separate
Content trees are recursive data structures that consist of named properties
and subtrees that share the same namespace, but are accessed through separate
methods like outlined below:

Tree tree = ...;
Expand Down Expand Up @@ -101,11 +101,11 @@ License
Collective work: Copyright 2012 The Apache Software Foundation.

Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Expand Down
4 changes: 3 additions & 1 deletion oak-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>oak-parent</artifactId>
Expand Down
20 changes: 9 additions & 11 deletions oak-api/src/main/java/org/apache/jackrabbit/oak/api/AuthInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
import java.security.Principal;
import java.util.Collections;
import java.util.Set;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* {@code AuthInfo} instances provide access to information related
* to authentication and authorization of a given content session.
* {@code AuthInfo} instances are guaranteed to be immutable.
* {@code AuthInfo} instances provide access to information related to authentication and
* authorization of a given content session. {@code AuthInfo} instances are guaranteed to be
* immutable.
*/
public interface AuthInfo {

Expand Down Expand Up @@ -62,9 +61,8 @@ public String toString() {
};

/**
* Return the user ID to be exposed on the JCR Session object. It refers
* to the ID of the user associated with the Credentials passed to the
* repository login.
* Return the user ID to be exposed on the JCR Session object. It refers to the ID of the user
* associated with the Credentials passed to the repository login.
*
* @return the user ID such as exposed on the JCR Session object.
*/
Expand All @@ -74,15 +72,15 @@ public String toString() {
/**
* Returns the attribute names associated with this instance.
*
* @return The attribute names with that instance or an empty array if
* no attributes are present.
* @return The attribute names with that instance or an empty array if no attributes are
* present.
*/
@NotNull
String[] getAttributeNames();

/**
* Returns the attribute with the given name or {@code null} if no attribute
* with that {@code attributeName} exists.
* Returns the attribute with the given name or {@code null} if no attribute with that
* {@code attributeName} exists.
*
* @param attributeName The attribute name.
* @return The attribute or {@code null}.
Expand Down
49 changes: 22 additions & 27 deletions oak-api/src/main/java/org/apache/jackrabbit/oak/api/Blob.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,26 @@
package org.apache.jackrabbit.oak.api;

import java.io.InputStream;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* Immutable representation of a binary value of finite length.
* <p>
* Two blobs are considered equal in terms of {@link Object#equals(Object)}
* if they contain the same sequences of bytes. Implementations can optimize
* the equality checks by using strong hash codes or other similar means as
* long as they comply with the above definition of equality.
* Two blobs are considered equal in terms of {@link Object#equals(Object)} if they contain the same
* sequences of bytes. Implementations can optimize the equality checks by using strong hash codes
* or other similar means as long as they comply with the above definition of equality.
* <p>
* Due to their nature blobs should not be used as keys in hash tables.
* To highlight that and to ensure semantic correctness of the equality
* contract across different blob implementations, the {@link Object#hashCode()}
* method of all blob instances should return zero.
* Due to their nature blobs should not be used as keys in hash tables. To highlight that and to
* ensure semantic correctness of the equality contract across different blob implementations, the
* {@link Object#hashCode()} method of all blob instances should return zero.
*/
public interface Blob {

/**
* Returns a new stream for this blob. The streams returned from
* multiple calls to this method are byte wise equals. That is,
* subsequent calls to {@link java.io.InputStream#read() read}
* return the same sequence of bytes as long as neither call throws
* an exception.
* Returns a new stream for this blob. The streams returned from multiple calls to this method
* are byte wise equals. That is, subsequent calls to {@link java.io.InputStream#read() read}
* return the same sequence of bytes as long as neither call throws an exception.
*
* @return a new stream for this blob
*/
Expand All @@ -58,28 +53,27 @@ public interface Blob {
long length();

/**
* Returns a secure reference to this blob, or {@code null} if such
* a reference is not available.
* Returns a secure reference to this blob, or {@code null} if such a reference is not
* available.
*
* @see <a href="https://issues.apache.org/jira/browse/OAK-834">OAK-834</a>
* @return binary reference, or {@code null}
* @see <a href="https://issues.apache.org/jira/browse/OAK-834">OAK-834</a>
*/
@Nullable
String getReference();

/**
* A unique identifier of the content of this value. Usually this is a
* message digest of the content (a cryptographically secure one-way hash).
* This allows to avoid processing large binary values multiple times.
* A unique identifier of the content of this value. Usually this is a message digest of the
* content (a cryptographically secure one-way hash). This allows to avoid processing large
* binary values multiple times.
* <p>
* This method returns null if the identifier is unknown. The identifier may
* not always be available, for example if the value has not yet been saved
* or processed. Once an identifier is available, it will never change
* because values are immutable.
* This method returns null if the identifier is unknown. The identifier may not always be
* available, for example if the value has not yet been saved or processed. Once an identifier
* is available, it will never change because values are immutable.
* <p>
* If two values have the same identifier, the content of the value is
* guaranteed to be the same. However it is not guaranteed that two values
* with the same content will return the same identifier.
* If two values have the same identifier, the content of the value is guaranteed to be the
* same. However it is not guaranteed that two values with the same content will return the same
* identifier.
* <p>
* The identifier is opaque, meaning it can have any format and size.
*
Expand All @@ -90,6 +84,7 @@ public interface Blob {

/**
* Checks if the external blob is inlined in the id itself
*
* @return
*/
default boolean isInlined() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@
import javax.jcr.security.AccessControlException;
import javax.jcr.version.LabelExistsVersionException;
import javax.jcr.version.VersionException;

import org.jetbrains.annotations.NotNull;

/**
* Main exception thrown by methods defined on the {@code ContentSession}
* interface indicating that committing a given set of changes failed.
* Main exception thrown by methods defined on the {@code ContentSession} interface indicating that
* committing a given set of changes failed.
*/
public class CommitFailedException extends Exception {

Expand Down Expand Up @@ -121,16 +120,16 @@ public class CommitFailedException extends Exception {
private final int code;

public CommitFailedException(
String source, String type, int code, String message,
Throwable cause) {
String source, String type, int code, String message,
Throwable cause) {
super(format("%s%s%04d: %s", source, type, code, message), cause);
this.source = source;
this.type = type;
this.code = code;
}

public CommitFailedException(
String type, int code, String message, Throwable cause) {
String type, int code, String message, Throwable cause) {
this(OAK, type, code, message, cause);
}

Expand Down Expand Up @@ -203,8 +202,8 @@ public int getCode() {
}

/**
* Wraps the given {@link CommitFailedException} instance using the
* appropriate {@link javax.jcr.RepositoryException} subclass based on the
* Wraps the given {@link CommitFailedException} instance using the appropriate
* {@link javax.jcr.RepositoryException} subclass based on the
* {@link CommitFailedException#getType() type} of the given exception.
*
* @return matching repository exception
Expand All @@ -214,8 +213,8 @@ public RepositoryException asRepositoryException() {
}

/**
* Wraps the given {@link CommitFailedException} instance using the
* appropriate {@link javax.jcr.RepositoryException} subclass based on the
* Wraps the given {@link CommitFailedException} instance using the appropriate
* {@link javax.jcr.RepositoryException} subclass based on the
* {@link CommitFailedException#getType() type} of the given exception.
*
* @param message The exception message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,28 @@
import javax.jcr.Credentials;
import javax.jcr.NoSuchWorkspaceException;
import javax.security.auth.login.LoginException;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* Oak content repository. The repository may be local or remote, or a cluster
* of any size. These deployment details are all hidden behind this interface.
* Oak content repository. The repository may be local or remote, or a cluster of any size. These
* deployment details are all hidden behind this interface.
* <p>
* All access to the repository happens through authenticated
* {@link ContentSession} instances acquired through the
* {@link #login(Credentials, String)} method, which is why that is the only
* All access to the repository happens through authenticated {@link ContentSession} instances
* acquired through the {@link #login(Credentials, String)} method, which is why that is the only
* method of this interface.
* <p>
* Starting and stopping ContentRepository instances is the responsibility
* of each particular deployment and not covered by this interface.
* Repository clients should use a deployment-specific mechanism (JNDI,
* OSGi service, etc.) to acquire references to ContentRepository instances.
* Starting and stopping ContentRepository instances is the responsibility of each particular
* deployment and not covered by this interface. Repository clients should use a deployment-specific
* mechanism (JNDI, OSGi service, etc.) to acquire references to ContentRepository instances.
* <p>
* This interface is thread-safe.
*/
public interface ContentRepository {

/**
* Authenticates a user based on the given credentials or available
* out-of-band information and, if successful, returns a
* {@link ContentSession} instance for accessing repository content
* Authenticates a user based on the given credentials or available out-of-band information and,
* if successful, returns a {@link ContentSession} instance for accessing repository content
* inside the specified workspace as the authenticated user.
* <p>
* TODO clarify workspace handling once multiple workspaces are
Expand All @@ -70,19 +66,19 @@ public interface ContentRepository {
* </pre>
*
* @param credentials access credentials, or {@code null}
* @param workspaceName The workspace name or {@code null} if the default
* workspace should be used.
* @param workspaceName The workspace name or {@code null} if the default workspace should be
* used.
* @return authenticated repository session
* @throws LoginException if authentication failed
* @throws NoSuchWorkspaceException if the specified workspace name is invalid.
*/
@NotNull
ContentSession login(@Nullable Credentials credentials, @Nullable String workspaceName)
throws LoginException, NoSuchWorkspaceException;
throws LoginException, NoSuchWorkspaceException;

/**
* Returns the repository descriptors which contain all or a subset of the descriptors defined in
* {@link javax.jcr.Repository}.
* Returns the repository descriptors which contain all or a subset of the descriptors defined
* in {@link javax.jcr.Repository}.
*
* @return the repository descriptors
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,55 +17,49 @@
package org.apache.jackrabbit.oak.api;

import java.io.Closeable;

import org.jetbrains.annotations.NotNull;

/**
* Authentication session for accessing a content repository.
* A {@code ContentSession} provides access to the actual
* content through its {@link #getLatestRoot()} method.
* Authentication session for accessing a content repository. A {@code ContentSession} provides
* access to the actual content through its {@link #getLatestRoot()} method.
* <p>
* This interface is thread-safe.
*/
public interface ContentSession extends Closeable {

/**
* This methods provides access to information related to authentication
* and authorization of this content session. Multiple calls to this method
* may return different instances which are guaranteed to be equal wrt.
* to {@link Object#equals(Object)}.
* This methods provides access to information related to authentication and authorization of
* this content session. Multiple calls to this method may return different instances which are
* guaranteed to be equal wrt. to {@link Object#equals(Object)}.
*
* @return immutable {@link AuthInfo} instance
* @return immutable {@link AuthInfo} instance
*/
@NotNull
AuthInfo getAuthInfo();

/**
* The name of the workspace this {@code ContentSession} instance has
* been created for. If no workspace name has been specified during
* repository login this method will return the name of the default
* workspace.
* The name of the workspace this {@code ContentSession} instance has been created for. If no
* workspace name has been specified during repository login this method will return the name of
* the default workspace.
* <p>
* TODO clarify workspace handling once multiple workspaces are
* supported. See OAK-118.
*
* @return name of the workspace this instance has been created for or
* {@code null} if this content session is repository bound.
* @return name of the workspace this instance has been created for or {@code null} if this
* content session is repository bound.
*/
String getWorkspaceName();

/**
* The current head root as seen by this content session. Use
* {@link Root#commit()} to atomically apply the changes made in that
* subtree the underlying Microkernel.
* The current head root as seen by this content session. Use {@link Root#commit()} to
* atomically apply the changes made in that subtree the underlying Microkernel.
* <p>
* The root instance gives you a stable view of the tree at the time the
* root is acquired. In certain setups (i.e. clusters) changes committed
* through other sessions might not be immediately reflected through this
* call. <p>
* Please note this method is possibly expensive because it internally reads
* from the backend to detect if there were any changes (from any session).
*
* The root instance gives you a stable view of the tree at the time the root is acquired. In
* certain setups (i.e. clusters) changes committed through other sessions might not be
* immediately reflected through this call. <p> Please note this method is possibly expensive
* because it internally reads from the backend to detect if there were any changes (from any
* session).
*
* @return the current head root
*/
@NotNull
Expand Down
Loading
Loading