Author: pauls
Date: Tue Apr 11 10:57:16 2017
New Revision: 1790951

URL: http://svn.apache.org/viewvc?rev=1790951&view=rev
Log:
Remove deprecated jcr resource API (SLING-5983).

Removed:
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrModifiablePropertyMap.java
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrPropertyMap.java
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceConstants.java
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceResolverFactory.java
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/JcrResourceUtil.java
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolverFactoryImpl.java
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/PathMapper.java
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/package-info.java
    
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrModifiablePropertyMapTest.java
    
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrPropertyMapTest.java
    
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceUtilTest.java
    
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/PathMapperImpl.java
    
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/PathMapperTest.java
Modified:
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/HelperData.java
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrListenerBaseConfig.java
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BasicQueryLanguageProvider.java
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactory.java
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceIterator.java
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrProviderStateFactory.java
    
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
    
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMapTest.java
    
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerScalabilityTest.java
    
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerTest.java
    
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/JcrNodeResourceIteratorTest.java
    
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactoryTest.java
    
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceTestBase.java
    
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceTest.java
    
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrTestNodeResource.java

Modified: 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/HelperData.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/HelperData.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/HelperData.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/HelperData.java
 Tue Apr 11 10:57:16 2017
@@ -24,7 +24,6 @@ import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
 import org.apache.sling.commons.classloader.DynamicClassLoaderManager;
-import org.apache.sling.jcr.resource.internal.helper.jcr.PathMapper;
 
 /**
  * This is a helper class used to pass several services/data to the resource
@@ -34,14 +33,10 @@ public class HelperData {
 
     private final AtomicReference<DynamicClassLoaderManager> 
dynamicClassLoaderManagerReference;
 
-    public final PathMapper pathMapper;
-
     private volatile String[] namespacePrefixes;
 
-    public HelperData(final AtomicReference<DynamicClassLoaderManager> 
dynamicClassLoaderManagerReference,
-            final PathMapper pathMapper) {
+    public HelperData(final AtomicReference<DynamicClassLoaderManager> 
dynamicClassLoaderManagerReference) {
         this.dynamicClassLoaderManagerReference = 
dynamicClassLoaderManagerReference;
-        this.pathMapper = pathMapper;
     }
 
     public String[] getNamespacePrefixes(final Session session)

Modified: 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrListenerBaseConfig.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrListenerBaseConfig.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrListenerBaseConfig.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrListenerBaseConfig.java
 Tue Apr 11 10:57:16 2017
@@ -35,7 +35,6 @@ import org.apache.jackrabbit.oak.jcr.obs
 import org.apache.sling.api.resource.observation.ResourceChange.ChangeType;
 import org.apache.sling.api.resource.path.Path;
 import org.apache.sling.jcr.api.SlingRepository;
-import org.apache.sling.jcr.resource.internal.helper.jcr.PathMapper;
 import org.apache.sling.spi.resource.provider.ObservationReporter;
 import org.apache.sling.spi.resource.provider.ObserverConfiguration;
 import org.slf4j.Logger;
@@ -51,17 +50,13 @@ public class JcrListenerBaseConfig imple
 
     private final Session session;
 
-    private final PathMapper pathMapper;
-
     private final ObservationReporter reporter;
 
     @SuppressWarnings("deprecation")
     public JcrListenerBaseConfig(
                     final ObservationReporter reporter,
-                    final PathMapper pathMapper,
                     final SlingRepository repository)
     throws RepositoryException {
-        this.pathMapper = pathMapper;
         this.reporter = reporter;
         // The session should have read access on the whole repository
         this.session = repository.loginService("observation", 
repository.getDefaultWorkspace());
@@ -191,8 +186,4 @@ public class JcrListenerBaseConfig imple
     public ObservationReporter getReporter() {
         return this.reporter;
     }
-
-    public PathMapper getPathMapper() {
-        return this.pathMapper;
-    }
 }

Modified: 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceListener.java
 Tue Apr 11 10:57:16 2017
@@ -159,7 +159,7 @@ public class JcrResourceListener impleme
     private ResourceChange createResourceChange(final Event event,
             final String path,
             final ChangeType changeType) {
-        final String fullPath = 
this.baseConfig.getPathMapper().mapJCRPathToResourcePath(path);
+        final String fullPath = path;
         final boolean isExternal = this.isExternal(event);
         final String userId;
         if (!isExternal) {

Modified: 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BasicQueryLanguageProvider.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BasicQueryLanguageProvider.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BasicQueryLanguageProvider.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/BasicQueryLanguageProvider.java
 Tue Apr 11 10:57:16 2017
@@ -129,7 +129,7 @@ public class BasicQueryLanguageProvider
                     while ( result == null && rows.hasNext() ) {
                         try {
                             final Row jcrRow = rows.nextRow();
-                            final String resourcePath = 
ctx.getProviderState().getHelperData().pathMapper.mapJCRPathToResourcePath(jcrRow.getPath());
+                            final String resourcePath = jcrRow.getPath();
                             if ( resourcePath != null && 
providerContext.getExcludedPaths().matches(resourcePath) == null) {
                                 final Map<String, Object> row = new 
HashMap<String, Object>();
 
@@ -144,8 +144,7 @@ public class BasicQueryLanguageProvider
                                             
JcrResourceUtil.toJavaObject(values[i]));
                                         if (colName.equals(QUERY_COLUMN_PATH)) 
{
                                             didPath = true;
-                                            row.put(colName,
-                                                    
ctx.getProviderState().getHelperData().pathMapper.mapJCRPathToResourcePath(JcrResourceUtil.toJavaObject(values[i]).toString()));
+                                            row.put(colName, 
JcrResourceUtil.toJavaObject(values[i]).toString());
                                         }
                                         if 
(colName.equals(QUERY_COLUMN_SCORE)) {
                                             didScore = true;
@@ -153,7 +152,7 @@ public class BasicQueryLanguageProvider
                                     }
                                 }
                                 if (!didPath) {
-                                    row.put(QUERY_COLUMN_PATH, 
ctx.getProviderState().getHelperData().pathMapper.mapJCRPathToResourcePath(jcrRow.getPath()));
+                                    row.put(QUERY_COLUMN_PATH, 
jcrRow.getPath());
                                 }
                                 if (!didScore) {
                                     row.put(QUERY_COLUMN_SCORE, 
jcrRow.getScore());

Modified: 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactory.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactory.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactory.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactory.java
 Tue Apr 11 10:57:16 2017
@@ -65,7 +65,7 @@ public class JcrItemResourceFactory {
      */
     public JcrItemResource<?> createResource(final ResourceResolver 
resourceResolver, final String resourcePath,
             final Resource parent, final Map<String, String> parameters) 
throws RepositoryException {
-        final String jcrPath = 
helper.pathMapper.mapResourcePathToJCRPath(resourcePath);
+        final String jcrPath = resourcePath;
         if (jcrPath == null) {
             log.debug("createResource: {} maps to an empty JCR path", 
resourcePath);
             return null;

Modified: 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResource.java
 Tue Apr 11 10:57:16 2017
@@ -39,8 +39,7 @@ import org.apache.sling.api.resource.Per
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ValueMap;
-import org.apache.sling.jcr.resource.JcrModifiablePropertyMap;
-import org.apache.sling.jcr.resource.JcrResourceConstants;
+import org.apache.sling.jcr.resource.api.JcrResourceConstants;
 import org.apache.sling.jcr.resource.internal.HelperData;
 import org.apache.sling.jcr.resource.internal.JcrModifiableValueMap;
 import org.apache.sling.jcr.resource.internal.JcrValueMap;
@@ -134,27 +133,6 @@ class JcrNodeResource extends JcrItemRes
             return (Type) getInputStream(); // unchecked cast
         } else if (type == Map.class || type == ValueMap.class) {
             return (Type) new JcrValueMap(getNode(), this.helper); // 
unchecked cast
-        } else if (type == PersistableValueMap.class ) {
-            if ( LOG_DEPRECATED_MAP ) {
-                LOG_DEPRECATED_MAP = false;
-                LOGGER.warn("DEPRECATION WARNING: PersistableValueMap is 
deprecated, a JcrResource should not be adapted to this anymore. Please switch 
to ModifiableValueMap.");
-            }
-            // check write
-            try {
-                getNode().getSession().checkPermission(getPath(),
-                    "set_property");
-                return (Type) new JcrModifiablePropertyMap(getNode(), 
this.helper.getDynamicClassLoader());
-            } catch (AccessControlException ace) {
-                // the user has no write permission, cannot adapt
-                LOGGER.debug(
-                    "adaptTo(PersistableValueMap): Cannot set properties on 
{}",
-                    this);
-            } catch (RepositoryException e) {
-                // some other problem, cannot adapt
-                LOGGER.debug(
-                    "adaptTo(PersistableValueMap): Unexpected problem for {}",
-                    this);
-            }
         } else if (type == ModifiableValueMap.class ) {
             // check write
             try {

Modified: 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceIterator.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceIterator.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceIterator.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceIterator.java
 Tue Apr 11 10:57:16 2017
@@ -142,6 +142,6 @@ public class JcrNodeResourceIterator imp
         } else {
             path = "/".equals(parentPath) ? '/' + node.getName() : parentPath 
+ '/' + node.getName();
         }
-        return helper.pathMapper.mapJCRPathToResourcePath(path);
+        return path;
     }
 }

Modified: 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrProviderStateFactory.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrProviderStateFactory.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrProviderStateFactory.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrProviderStateFactory.java
 Tue Apr 11 10:57:16 2017
@@ -56,16 +56,12 @@ public class JcrProviderStateFactory {
 
     private final AtomicReference<DynamicClassLoaderManager> 
dynamicClassLoaderManagerReference;
 
-    private final PathMapper pathMapper;
-
     public JcrProviderStateFactory(final ServiceReference<SlingRepository> 
repositoryReference,
             final SlingRepository repository,
-            final AtomicReference<DynamicClassLoaderManager> 
dynamicClassLoaderManagerReference,
-            final PathMapper pathMapper) {
+            final AtomicReference<DynamicClassLoaderManager> 
dynamicClassLoaderManagerReference) {
         this.repository = repository;
         this.repositoryReference = repositoryReference;
         this.dynamicClassLoaderManagerReference = 
dynamicClassLoaderManagerReference;
-        this.pathMapper = pathMapper;
     }
 
     /** Get the calling Bundle from auth info, fail if not provided
@@ -146,7 +142,7 @@ public class JcrProviderStateFactory {
             @Nullable final BundleContext ctx
     ) throws LoginException {
         final Session session = handleImpersonation(s, authenticationInfo, 
logoutSession);
-        final HelperData data = new 
HelperData(this.dynamicClassLoaderManagerReference, this.pathMapper);
+        final HelperData data = new 
HelperData(this.dynamicClassLoaderManagerReference);
         return new JcrProviderState(session, data, logoutSession, ctx, ctx == 
null ? null : repositoryReference);
     }
 

Modified: 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java
 Tue Apr 11 10:57:16 2017
@@ -101,9 +101,6 @@ public class JcrResourceProvider extends
     @Reference(name = REPOSITORY_REFERNENCE_NAME, service = 
SlingRepository.class)
     private ServiceReference<SlingRepository> repositoryReference;
 
-    @Reference
-    private PathMapper pathMapper;
-
     /** The JCR listener base configuration. */
     private volatile JcrListenerBaseConfig listenerConfig;
 
@@ -131,7 +128,7 @@ public class JcrResourceProvider extends
         this.repository = repository;
 
         this.stateFactory = new JcrProviderStateFactory(repositoryReference, 
repository,
-                classLoaderManagerReference, pathMapper);
+                classLoaderManagerReference);
     }
 
     @Deactivate
@@ -190,7 +187,6 @@ public class JcrResourceProvider extends
             logger.debug("Registering resource listeners...");
             try {
                 this.listenerConfig = new 
JcrListenerBaseConfig(this.getProviderContext().getObservationReporter(),
-                    this.pathMapper,
                     this.repository);
                 for(final ObserverConfiguration config : 
this.getProviderContext().getObservationReporter().getObserverConfigurations()) 
{
                     logger.debug("Registering listener for {}", 
config.getPaths());
@@ -406,7 +402,7 @@ public class JcrResourceProvider extends
                 nodeType = null;
             }
         }
-        final String jcrPath = pathMapper.mapResourcePathToJCRPath(path);
+        final String jcrPath = path;
         if ( jcrPath == null ) {
             throw new PersistenceException("Unable to create node at " + path, 
null, path, null);
         }
@@ -463,7 +459,7 @@ public class JcrResourceProvider extends
         Item item = resource.adaptTo(Item.class);
         try {
             if ( item == null ) {
-                final String jcrPath = 
pathMapper.mapResourcePathToJCRPath(resource.getPath());
+                final String jcrPath = resource.getPath();
                 if (jcrPath == null) {
                     logger.debug("delete: {} maps to an empty JCR path", 
resource.getPath());
                     throw new PersistenceException("Unable to delete 
resource", null, resource.getPath(), null);
@@ -552,8 +548,8 @@ public class JcrResourceProvider extends
     public boolean move(final  @Nonnull ResolveContext<JcrProviderState> ctx,
             final String srcAbsPath,
             final String destAbsPath) throws PersistenceException {
-        final String srcNodePath = 
pathMapper.mapResourcePathToJCRPath(srcAbsPath);
-        final String dstNodePath = 
pathMapper.mapResourcePathToJCRPath(destAbsPath + '/' + 
ResourceUtil.getName(srcAbsPath));
+        final String srcNodePath = srcAbsPath;
+        final String dstNodePath = destAbsPath + '/' + 
ResourceUtil.getName(srcAbsPath);
         try {
             ctx.getProviderState().getSession().move(srcNodePath, dstNodePath);
             return true;

Modified: 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMapTest.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMapTest.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMapTest.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMapTest.java
 Tue Apr 11 10:57:16 2017
@@ -23,6 +23,8 @@ import static org.apache.sling.jcr.resou
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.io.Serializable;
+import java.lang.reflect.Array;
+import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
@@ -35,6 +37,9 @@ import java.util.concurrent.atomic.Atomi
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
 import javax.jcr.nodetype.NodeType;
 
 import org.apache.commons.io.IOUtils;
@@ -43,7 +48,6 @@ import org.apache.sling.api.resource.Mod
 import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.commons.classloader.DynamicClassLoaderManager;
 import org.apache.sling.commons.testing.jcr.RepositoryTestBase;
-import org.apache.sling.jcr.resource.JcrResourceUtil;
 
 public class JcrModifiableValueMapTest extends RepositoryTestBase {
 
@@ -63,10 +67,59 @@ public class JcrModifiableValueMapTest e
 
         final Map<String, Object> values = this.initialSet();
         for(Map.Entry<String, Object> entry : values.entrySet()) {
-            JcrResourceUtil.setProperty(rootNode, entry.getKey().toString(), 
entry.getValue());
+            setProperty(rootNode, entry.getKey().toString(), entry.getValue());
         }
         getSession().save();
     }
+    
+    private void setProperty(final Node node,
+            final String propertyName,
+            final Object propertyValue)
+    throws RepositoryException {
+        if ( propertyValue == null ) {
+            node.setProperty(propertyName, (String)null);
+        } else if ( propertyValue.getClass().isArray() ) {
+            final int length = Array.getLength(propertyValue);
+            final Value[] setValues = new Value[length];
+            for(int i=0; i<length; i++) {
+                final Object value = Array.get(propertyValue, i);
+                setValues[i] = createValue(value, node.getSession());
+            }
+            node.setProperty(propertyName, setValues);
+        } else {
+            node.setProperty(propertyName, createValue(propertyValue, 
node.getSession()));
+        }
+    }
+    
+    Value createValue(final Object value, final Session session)
+            throws RepositoryException {
+                Value val;
+                ValueFactory fac = session.getValueFactory();
+                if(value instanceof Calendar) {
+                    val = fac.createValue((Calendar)value);
+                } else if (value instanceof InputStream) {
+                    val = 
fac.createValue(fac.createBinary((InputStream)value));
+                } else if (value instanceof Node) {
+                    val = fac.createValue((Node)value);
+                } else if (value instanceof BigDecimal) {
+                    val = fac.createValue((BigDecimal)value);
+                } else if (value instanceof Long) {
+                    val = fac.createValue((Long)value);
+                } else if (value instanceof Short) {
+                    val = fac.createValue((Short)value);
+                } else if (value instanceof Integer) {
+                    val = fac.createValue((Integer)value);
+                } else if (value instanceof Number) {
+                    val = fac.createValue(((Number)value).doubleValue());
+                } else if (value instanceof Boolean) {
+                    val = fac.createValue((Boolean) value);
+                } else if ( value instanceof String ) {
+                    val = fac.createValue((String)value);
+                } else {
+                    val = null;
+                }
+                return val;
+            }
 
     @Override
     protected void tearDown() throws Exception {
@@ -78,7 +131,7 @@ public class JcrModifiableValueMapTest e
     }
 
     private HelperData getHelperData() throws Exception {
-        return new HelperData(new 
AtomicReference<DynamicClassLoaderManager>(), new PathMapperImpl());
+        return new HelperData(new 
AtomicReference<DynamicClassLoaderManager>());
     }
 
     private Map<String, Object> initialSet() {

Modified: 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerScalabilityTest.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerScalabilityTest.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerScalabilityTest.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerScalabilityTest.java
 Tue Apr 11 10:57:16 2017
@@ -73,7 +73,6 @@ public class JcrResourceListenerScalabil
 
         final ProviderContext ctx = new SimpleProviderContext();
         this.config = new JcrListenerBaseConfig(ctx.getObservationReporter(),
-                new PathMapperImpl(),
                 RepositoryUtil.getRepository());
         jcrResourceListener = new JcrResourceListener(this.config, 
ctx.getObservationReporter().getObserverConfigurations().get(0));
 

Modified: 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerTest.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerTest.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerTest.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/JcrResourceListenerTest.java
 Tue Apr 11 10:57:16 2017
@@ -75,7 +75,6 @@ public class JcrResourceListenerTest {
         RepositoryUtil.registerSlingNodeTypes(adminSession);
         final SlingRepository repo = RepositoryUtil.getRepository();
         this.config = new JcrListenerBaseConfig(getObservationReporter(),
-                new PathMapperImpl(),
                 new SlingRepository() {
 
                     @Override

Modified: 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/JcrNodeResourceIteratorTest.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/JcrNodeResourceIteratorTest.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/JcrNodeResourceIteratorTest.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/JcrNodeResourceIteratorTest.java
 Tue Apr 11 10:57:16 2017
@@ -30,7 +30,6 @@ import org.apache.sling.commons.classloa
 import org.apache.sling.commons.testing.jcr.MockNode;
 import org.apache.sling.commons.testing.jcr.MockNodeIterator;
 import org.apache.sling.jcr.resource.internal.HelperData;
-import org.apache.sling.jcr.resource.internal.PathMapperImpl;
 import 
org.apache.sling.jcr.resource.internal.helper.jcr.JcrNodeResourceIterator;
 
 import junit.framework.TestCase;
@@ -38,7 +37,7 @@ import junit.framework.TestCase;
 public class JcrNodeResourceIteratorTest extends TestCase {
 
     private HelperData getHelperData() {
-        return new HelperData(new 
AtomicReference<DynamicClassLoaderManager>(), new PathMapperImpl());
+        return new HelperData(new 
AtomicReference<DynamicClassLoaderManager>());
     }
 
     public void testEmpty() {

Modified: 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactoryTest.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactoryTest.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactoryTest.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceFactoryTest.java
 Tue Apr 11 10:57:16 2017
@@ -32,7 +32,6 @@ import org.apache.jackrabbit.commons.Jcr
 import org.apache.sling.commons.classloader.DynamicClassLoaderManager;
 import org.apache.sling.commons.testing.jcr.RepositoryTestBase;
 import org.apache.sling.jcr.resource.internal.HelperData;
-import org.apache.sling.jcr.resource.internal.PathMapperImpl;
 
 public class JcrItemResourceFactoryTest extends RepositoryTestBase {
 
@@ -88,7 +87,7 @@ public class JcrItemResourceFactoryTest
     }
 
     private void compareGetItemOrNull(String path, String expectedPath) throws 
RepositoryException {
-        HelperData helper = new HelperData(new 
AtomicReference<DynamicClassLoaderManager>(), new PathMapperImpl());
+        HelperData helper = new HelperData(new 
AtomicReference<DynamicClassLoaderManager>());
         Item item1 = new JcrItemResourceFactory(session, 
helper).getItemOrNull(path);
         Item item2 = new JcrItemResourceFactory(nonJackrabbitSession, 
helper).getItemOrNull(path);
         if (expectedPath == null) {

Modified: 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceTestBase.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceTestBase.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceTestBase.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrItemResourceTestBase.java
 Tue Apr 11 10:57:16 2017
@@ -26,7 +26,7 @@ import javax.jcr.Node;
 
 import org.apache.sling.api.SlingConstants;
 import org.apache.sling.commons.testing.jcr.RepositoryTestBase;
-import org.apache.sling.jcr.resource.JcrResourceConstants;
+import org.apache.sling.jcr.resource.api.JcrResourceConstants;
 import org.junit.Ignore;
 
 @Ignore

Modified: 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceTest.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceTest.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceTest.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrNodeResourceTest.java
 Tue Apr 11 10:57:16 2017
@@ -33,14 +33,13 @@ import org.apache.jackrabbit.JcrConstant
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceMetadata;
 import org.apache.sling.commons.classloader.DynamicClassLoaderManager;
-import org.apache.sling.jcr.resource.JcrResourceConstants;
+import org.apache.sling.jcr.resource.api.JcrResourceConstants;
 import org.apache.sling.jcr.resource.internal.HelperData;
-import org.apache.sling.jcr.resource.internal.PathMapperImpl;
 
 public class JcrNodeResourceTest extends JcrItemResourceTestBase {
 
     private HelperData getHelperData() throws Exception {
-        return new HelperData(new 
AtomicReference<DynamicClassLoaderManager>(), new PathMapperImpl());
+        return new HelperData(new 
AtomicReference<DynamicClassLoaderManager>());
     }
 
     public void testLinkedFile() throws Exception {

Modified: 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrTestNodeResource.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrTestNodeResource.java?rev=1790951&r1=1790950&r2=1790951&view=diff
==============================================================================
--- 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrTestNodeResource.java
 (original)
+++ 
sling/trunk/bundles/jcr/resource/src/test/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrTestNodeResource.java
 Tue Apr 11 10:57:16 2017
@@ -26,13 +26,12 @@ import javax.jcr.RepositoryException;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.commons.classloader.DynamicClassLoaderManager;
 import org.apache.sling.jcr.resource.internal.HelperData;
-import org.apache.sling.jcr.resource.internal.PathMapperImpl;
 
 public class JcrTestNodeResource extends JcrNodeResource {
 
     public JcrTestNodeResource(ResourceResolver resourceResolver, Node node,
             ClassLoader dynamicClassLoader) throws RepositoryException {
-        super(resourceResolver, node.getPath(), null, node, new HelperData(new 
AtomicReference<DynamicClassLoaderManager>(), new PathMapperImpl()));
+        super(resourceResolver, node.getPath(), null, node, new HelperData(new 
AtomicReference<DynamicClassLoaderManager>()));
     }
 
 }


Reply via email to