jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bae...@apache.org
Subject svn commit: r1453987 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: security/authorization/AccessControlImporter.java security/user/UserImporter.java spi/xml/NodeInfo.java spi/xml/PropInfo.java spi/xml/TextValue.java
Date Thu, 07 Mar 2013 18:26:51 GMT
Author: baedke
Date: Thu Mar  7 18:26:50 2013
New Revision: 1453987

URL: http://svn.apache.org/r1453987
Log:
OAK-127: initial version of session import

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlImporter.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/NodeInfo.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/PropInfo.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/TextValue.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlImporter.java?rev=1453987&r1=1453986&r2=1453987&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlImporter.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authorization/AccessControlImporter.java
Thu Mar  7 18:26:50 2013
@@ -243,18 +243,15 @@ class AccessControlImporter implements P
         private void setPrivilegeNames(TextValue[] txtValues) throws RepositoryException
{
             privileges = new ArrayList<Privilege>();
             for (TextValue value : txtValues) {
-                // FIXME: proper namespace handling (in case of local remapping)
-                Value privilegeName = value.getValue(PropertyType.NAME, namePathMapper);
+                Value privilegeName = value.getValue(PropertyType.NAME);
                 privileges.add(acMgr.privilegeFromName(privilegeName.getString()));
             }
         }
 
         private void addRestriction(PropInfo propInfo) throws RepositoryException {
-            // FIXME: proper namespace handling (in case of local remapping)
             String restrictionName = propInfo.getName();
             int targetType = acl.getRestrictionType(restrictionName);
-            // FIXME: proper namespace handling (in case of local remapping)
-            restrictions.put(propInfo.getName(), propInfo.getValue(targetType, namePathMapper));
+            restrictions.put(propInfo.getName(), propInfo.getValue(targetType));
         }
 
         private void addRestrictions(List<PropInfo> propInfos) throws RepositoryException
{

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java?rev=1453987&r1=1453986&r2=1453987&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/UserImporter.java
Thu Mar  7 18:26:50 2013
@@ -364,7 +364,7 @@ public class UserImporter implements Pro
                 }
             }
         } else {
-            log.warn("{} is not of type {}", childInfo.getString(), NT_REP_MEMBERS);
+            log.warn("{} is not of type {}", childInfo.getName(), NT_REP_MEMBERS);
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/NodeInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/NodeInfo.java?rev=1453987&r1=1453986&r2=1453987&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/NodeInfo.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/NodeInfo.java
Thu Mar  7 18:26:50 2013
@@ -68,7 +68,7 @@ public class NodeInfo {
      *
      * @return node name
      */
-    public String getString() {
+    public String getName() {
         return name;
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/PropInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/PropInfo.java?rev=1453987&r1=1453986&r2=1453987&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/PropInfo.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/PropInfo.java
Thu Mar  7 18:26:50 2013
@@ -21,7 +21,7 @@ import javax.jcr.RepositoryException;
 import javax.jcr.Value;
 import javax.jcr.nodetype.PropertyDefinition;
 
-import org.apache.jackrabbit.oak.namepath.NamePathMapper;
+import org.apache.jackrabbit.oak.plugins.nodetype.EffectiveNodeType;
 
 /**
  * Information about a property being imported. This class is used
@@ -125,18 +125,47 @@ public class PropInfo {
         return values;
     }
 
-    public Value getValue(int targetType, NamePathMapper namePathMapper) throws RepositoryException
{
+    public Value getValue(int targetType) throws RepositoryException {
         if (multipleStatus == MultipleStatus.MULTIPLE) {
             throw new RepositoryException("TODO");
         }
-        return values[0].getValue(targetType, namePathMapper);
+        return values[0].getValue(targetType);
     }
 
-    public Value[] getValues(int targetType, NamePathMapper namePathMapper) throws RepositoryException
{
+    public Value[] getValues(int targetType) throws RepositoryException {
         Value[] va = new Value[values.length];
         for (int i = 0; i < values.length; i++) {
-            va[i] = values[i].getValue(targetType, namePathMapper);
+            va[i] = values[i].getValue(targetType);
         }
         return va;
     }
+
+    //TODO check multivalue handling
+    public PropertyDefinition getPropertyDef(EffectiveNodeType ent) {
+        Iterable<PropertyDefinition> definitions = ent.getNamedPropertyDefinitions(getName());
+        int knownType = getType();
+        for (PropertyDefinition def : definitions) {
+            int requiredType = def.getRequiredType();
+            if ((requiredType == PropertyType.UNDEFINED || knownType == PropertyType.UNDEFINED
|| requiredType == knownType)
+                    && (def.isMultiple() || multipleStatus == MultipleStatus.UNKNOWN))
{
+                return def;
+            }
+        }
+        definitions = ent.getResidualPropertyDefinitions();
+        for (PropertyDefinition def : definitions) {
+            int requiredType = def.getRequiredType();
+            if ((requiredType == PropertyType.UNDEFINED || knownType == PropertyType.UNDEFINED
|| requiredType == knownType)
+                    && !def.isMultiple() && multipleStatus == MultipleStatus.UNKNOWN)
{
+                return def;
+            }
+        }
+        for (PropertyDefinition def : definitions) {
+            int requiredType = def.getRequiredType();
+            if ((requiredType == PropertyType.UNDEFINED || knownType == PropertyType.UNDEFINED
|| requiredType == knownType)
+                    && def.isMultiple()) {
+                return def;
+            }
+        }
+        return null;
+    }
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/TextValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/TextValue.java?rev=1453987&r1=1453986&r2=1453987&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/TextValue.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/xml/TextValue.java
Thu Mar  7 18:26:50 2013
@@ -20,8 +20,6 @@ import javax.jcr.RepositoryException;
 import javax.jcr.Value;
 import javax.jcr.ValueFormatException;
 
-import org.apache.jackrabbit.oak.namepath.NamePathMapper;
-
 /**
  * {@code TextValue} represents a serialized property value read
  * from a System or Document View XML document.
@@ -30,8 +28,7 @@ public interface TextValue {
 
     String getString();
 
-    // TODO: review again
-    Value getValue(int targetType, NamePathMapper namePathMapper) throws ValueFormatException,
RepositoryException;
+    Value getValue(int targetType) throws ValueFormatException, RepositoryException;
 
     /**
      * Dispose this value, i.e. free all bound resources. Once a value has



Mime
View raw message