Use JcrConstants
Add missing null annotation, fix some error messages and labels
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMap.java b/src/main/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMap.java
index 445edb1..d28afdd 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMap.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMap.java
@@ -25,6 +25,7 @@
import javax.jcr.RepositoryException;
import javax.jcr.Value;
+import org.apache.jackrabbit.JcrConstants;
import org.apache.sling.api.resource.ModifiableValueMap;
import org.apache.sling.jcr.resource.internal.helper.JcrPropertyMapCacheEntry;
@@ -62,7 +63,7 @@
final JcrPropertyMapCacheEntry entry = new JcrPropertyMapCacheEntry(value, this.node);
this.cache.put(key, entry);
final String name = escapeKeyName(key);
- if ( NodeUtil.MIXIN_TYPES.equals(name) ) {
+ if ( JcrConstants.JCR_MIXINTYPES.equals(name) ) {
NodeUtil.handleMixinTypes(node, entry.convertToType(String[].class, node, this.helper.getDynamicClassLoader()));
} else if ( "jcr:primaryType".equals(name) ) {
node.setPrimaryType(entry.convertToType(String.class, node, this.helper.getDynamicClassLoader()));
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/NodeUtil.java b/src/main/java/org/apache/sling/jcr/resource/internal/NodeUtil.java
index 7f605f5..df852a1 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/NodeUtil.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/NodeUtil.java
@@ -39,12 +39,6 @@
public abstract class NodeUtil {
- /** Property for the mixin node types. */
- public static final String MIXIN_TYPES = "jcr:mixinTypes";
-
- /** Property for the node type. */
- public static final String NODE_TYPE = "jcr:primaryType";
-
/**
* Update the mixin node types
*
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BinaryDownloadUriProvider.java b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BinaryDownloadUriProvider.java
index 28edfa0..3aa5abb 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BinaryDownloadUriProvider.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BinaryDownloadUriProvider.java
@@ -58,7 +58,7 @@
@ObjectClassDefinition(
name = "Apache Sling Binary Download URI Provider",
- description = "Provides URIs for resources containing a primary JCR binary property backed by a blob store with external access")
+ description = "Provides URIs for resources containing a primary JCR binary property backed by a blob store allowing direct HTTP access")
public static @interface Configuration {
@AttributeDefinition(
name = "Content-Disposition",
@@ -101,7 +101,7 @@
}
}
- protected Property getPrimaryProperty(@NotNull Node node) throws RepositoryException {
+ protected @NotNull Property getPrimaryProperty(@NotNull Node node) throws RepositoryException {
return NodeUtil.getPrimaryProperty(node);
}
@@ -113,7 +113,7 @@
Binary binary = binaryProperty.getBinary();
if (!(binary instanceof BinaryDownload)) {
binary.dispose();
- throw new IllegalArgumentException("The property " + binaryProperty.getPath() + " is not backed by an store providing direct downloads");
+ throw new IllegalArgumentException("The property " + binaryProperty.getPath() + " is not backed by a blob store allowing direct HTTP access");
}
BinaryDownload binaryDownload = BinaryDownload.class.cast(binary);
try {
diff --git a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
index e2d774a..bdb7790 100644
--- a/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
+++ b/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
@@ -40,6 +40,7 @@
import javax.jcr.RepositoryException;
import javax.jcr.Session;
+import org.apache.jackrabbit.JcrConstants;
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.api.security.user.Authorizable;
import org.apache.jackrabbit.api.security.user.UserManager;
@@ -96,9 +97,9 @@
private static final Set<String> IGNORED_PROPERTIES = new HashSet<>();
static {
- IGNORED_PROPERTIES.add(NodeUtil.MIXIN_TYPES);
- IGNORED_PROPERTIES.add(NodeUtil.NODE_TYPE);
- IGNORED_PROPERTIES.add("jcr:created");
+ IGNORED_PROPERTIES.add(JcrConstants.JCR_MIXINTYPES);
+ IGNORED_PROPERTIES.add(JcrConstants.JCR_PRIMARYTYPE);
+ IGNORED_PROPERTIES.add(JcrConstants.JCR_CREATED);
IGNORED_PROPERTIES.add("jcr:createdBy");
}
@@ -410,7 +411,7 @@
public Resource create(final @NotNull ResolveContext<JcrProviderState> ctx, final String path, final Map<String, Object> properties)
throws PersistenceException {
// check for node type
- final Object nodeObj = (properties != null ? properties.get(NodeUtil.NODE_TYPE) : null);
+ final Object nodeObj = (properties != null ? properties.get(JcrConstants.JCR_PRIMARYTYPE) : null);
// check for sling:resourcetype
final String nodeType;
if ( nodeObj != null ) {
@@ -459,9 +460,9 @@
// create modifiable map
final JcrModifiableValueMap jcrMap = new JcrModifiableValueMap(node, ctx.getProviderState().getHelperData());
// check mixin types first
- final Object value = properties.get(NodeUtil.MIXIN_TYPES);
+ final Object value = properties.get(JcrConstants.JCR_MIXINTYPES);
if ( value != null ) {
- jcrMap.put(NodeUtil.MIXIN_TYPES, value);
+ jcrMap.put(JcrConstants.JCR_MIXINTYPES, value);
}
for(final Map.Entry<String, Object> entry : properties.entrySet()) {
if ( !IGNORED_PROPERTIES.contains(entry.getKey()) ) {