jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r1568583 - in /jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging: PackageProperties.java VaultPackage.java impl/PackagePropertiesImpl.java impl/ZipVaultPackage.java
Date Sat, 15 Feb 2014 01:31:17 GMT
Author: tripod
Date: Sat Feb 15 01:31:16 2014
New Revision: 1568583

URL: http://svn.apache.org/r1568583
Log:
JCRVLT-32 Store package properties in the MANIFEST.MF for faster access (wip)

- first step to factor out the properties from the package interface

Added:
    jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/PackageProperties.java
    jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/PackagePropertiesImpl.java
Modified:
    jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/VaultPackage.java
    jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/ZipVaultPackage.java

Added: jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/PackageProperties.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/PackageProperties.java?rev=1568583&view=auto
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/PackageProperties.java
(added)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/PackageProperties.java
Sat Feb 15 01:31:16 2014
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * 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
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.vault.packaging;
+
+import java.util.Calendar;
+
+import org.apache.jackrabbit.vault.fs.io.AccessControlHandling;
+
+/**
+ * The package properties provide extra/meta information about the package to install. The
properties are usually
+ * store in the {@code META-INF/vault/properties.xml} or in the jar's manifest.
+ *
+ * @since 3.1
+ */
+public interface PackageProperties {
+
+    /**
+     * Name of the last modified meta-inf property
+     */
+    String NAME_LAST_MODIFIED = "lastModified";
+
+    /**
+     * Name of the last modified by meta-inf property
+     */
+    String NAME_LAST_MODIFIED_BY = "lastModifiedBy";
+
+    /**
+     * Name of the group property
+     * @since 2.2
+     */
+    String NAME_GROUP = "group";
+
+    /**
+     * Name of the 'name' property
+     * @since 2.2
+     */
+    String NAME_NAME = "name";
+
+    /**
+     * Name of the build count meta-inf property
+     */
+    String NAME_BUILD_COUNT = "buildCount";
+
+    /**
+     * Name of the version meta-inf property
+     */
+    String NAME_VERSION = "version";
+
+    /**
+     * Name of the dependencies meta-inf property
+     */
+    String NAME_DEPENDENCIES = "dependencies";
+
+    /**
+     * Name of the created meta-inf property
+     */
+    String NAME_CREATED = "created";
+
+    /**
+     * Name of the created by meta-inf property
+     */
+    String NAME_CREATED_BY = "createdBy";
+
+    /**
+     * Name of the last wrapped meta-inf property
+     * @since 2.2.22
+     */
+    String NAME_LAST_WRAPPED = "lastWrapped";
+
+    /**
+     * Name of the last wrapped by meta-inf property
+     * @since 2.2.22
+     */
+    String NAME_LAST_WRAPPED_BY = "lastWrappedBy";
+
+    /**
+     * Name of the 'acHandling' by meta-inf property.
+     * @see org.apache.jackrabbit.vault.fs.io.AccessControlHandling
+     */
+    String NAME_AC_HANDLING = "acHandling";
+
+    /**
+     * Name of the 'cndPattern' by meta-inf property.
+     * @since 2.3.12
+     */
+    String NAME_CND_PATTERN = "cndPattern";
+
+    /**
+     * Name of the description meta-inf property
+     */
+    String NAME_DESCRIPTION = "description";
+
+    /**
+     * Name of the flag that indicates in only admin sessions
+     * can extract this package.
+     */
+    String NAME_REQUIRES_ROOT = "requiresRoot";
+
+    /**
+     * Name of the flag that indicates that the system needs a restart after
+     * package extraction.
+     */
+    String NAME_REQUIRES_RESTART = "requiresRestart";
+
+    /**
+     * Name of the flag that indicates to disable intermediate saves.
+     */
+    String NAME_DISABLE_INTERMEDIATE_SAVE = "noIntermediateSaves";
+
+    /**
+     * the prefix for an install hook property. eg:
+     * 'installhook.test1.class = ....'
+     */
+    String PREFIX_INSTALL_HOOK = "installhook.";
+
+    /**
+     * Returns the id of this package or <code>null</code> if the id can't
+     * be determined.
+     * @return the id of this package.
+     */
+    PackageId getId();
+
+    /**
+     * Returns the last modification date or <code>null</code> if n/a.
+     * @return last modification date or <code>null</code>
+     */
+    Calendar getLastModified();
+
+    /**
+     * Returns the user that last modified the package or <code>null</code> if
n/a.
+     * @return the user or <code>null</code>
+     */
+    String getLastModifiedBy();
+
+    /**
+     * Returns the date when this package was built or <code>null</code> if n/a.
+     * @return the creation date
+     */
+    Calendar getCreated();
+
+    /**
+     * Returns the user that built this package or null if n/a.
+     * @return the creator
+     */
+    String getCreatedBy();
+
+    /**
+     * Returns the date when this package was wrapped or <code>null</code> if
n/a.
+     * @return the wrapped date
+     * @since 2.2.22
+     */
+    Calendar getLastWrapped();
+
+    /**
+     * Returns the user that wrapped this package or null if n/a.
+     * @return the wrapper
+     * @since 2.2.22
+     */
+    String getLastWrappedBy();
+
+    /**
+     * Returns a description of this package or <code>null</code> if n/a
+     * @return a description
+     */
+    String getDescription();
+
+    /**
+     * Returns <code>true</code> if this package can only be extracted by a
+     * admin session.
+     * @return <code>true</code> if this package requires an admin session for
extraction.
+     */
+    boolean requiresRoot();
+
+    /**
+     * Returns an unmodifiable list of dependencies
+     * @return list of dependencies
+     */
+    Dependency[] getDependencies();
+
+    /**
+     * Returns the access control handling defined in this package.
+     * @return the access control handling.
+     */
+    AccessControlHandling getACHandling();
+
+    /**
+     * Returns the date property with the given name or {@code null} if it does not exist
or if the value cannot be
+     * converted to a date.
+     * @param name the property name
+     * @return the property value or {@code null}
+     */
+    Calendar getDateProperty(String name);
+
+    /**
+     * Returns the property with the given name or {@code null} if it does not exist.
+     * @param name the property name
+     * @return the property value or {@code null}
+     */
+    public String getProperty(String name);
+
+}
\ No newline at end of file

Modified: jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/VaultPackage.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/VaultPackage.java?rev=1568583&r1=1568582&r2=1568583&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/VaultPackage.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/VaultPackage.java
Sat Feb 15 01:31:16 2014
@@ -31,108 +31,10 @@ import org.apache.jackrabbit.vault.fs.io
 /**
  * Defines a vault package. A vault package is a binary assembled representation
  * of a vault export.
+ * <p/>
+ * Note that VaultPackage currently extends from PackageProperties to keep the interface
backwards compatible.
  */
-public interface VaultPackage {
-
-    /**
-     * Name of the last modified meta-inf property
-     */
-    String NAME_LAST_MODIFIED = "lastModified";
-
-    /**
-     * Name of the last modified by meta-inf property
-     */
-    String NAME_LAST_MODIFIED_BY = "lastModifiedBy";
-
-    /**
-     * Name of the group property
-     * @since 2.2
-     */
-    String NAME_GROUP = "group";
-
-    /**
-     * Name of the 'name' property
-     * @since 2.2
-     */
-    String NAME_NAME = "name";
-
-    /**
-     * Name of the build count meta-inf property
-     */
-    String NAME_BUILD_COUNT = "buildCount";
-
-    /**
-     * Name of the version meta-inf property
-     */
-    String NAME_VERSION = "version";
-
-    /**
-     * Name of the dependencies meta-inf property
-     */
-    String NAME_DEPENDENCIES = "dependencies";
-
-    /**
-     * Name of the created meta-inf property
-     */
-    String NAME_CREATED = "created";
-
-    /**
-     * Name of the created by meta-inf property
-     */
-    String NAME_CREATED_BY = "createdBy";
-
-    /**
-     * Name of the last wrapped meta-inf property
-     * @since 2.2.22
-     */
-    String NAME_LAST_WRAPPED = "lastWrapped";
-
-    /**
-     * Name of the last wrapped by meta-inf property
-     * @since 2.2.22
-     */
-    String NAME_LAST_WRAPPED_BY = "lastWrappedBy";
-
-    /**
-     * Name of the 'acHandling' by meta-inf property.
-     * @see AccessControlHandling
-     */
-    String NAME_AC_HANDLING = "acHandling";
-
-    /**
-     * Name of the 'cndPattern' by meta-inf property.
-     * @since 2.3.12
-     */
-    String NAME_CND_PATTERN = "cndPattern";
-
-    /**
-     * Name of the description meta-inf property
-     */
-    String NAME_DESCRIPTION = "description";
-
-    /**
-     * Name of the flag that indicates in only admin sessions
-     * can extract this package.
-     */
-    String NAME_REQUIRES_ROOT = "requiresRoot";
-
-    /**
-     * Name of the flag that indicates that the system needs a restart after
-     * package extraction.
-     */
-    String NAME_REQUIRES_RESTART = "requiresRestart";
-
-    /**
-     * Name of the flag that indicates to disable intermediate saves.
-     */
-    String NAME_DISABLE_INTERMEDIATE_SAVE = "noIntermediateSaves";
-
-    /**
-     * the prefix for an install hook property. eg:
-     * 'installhook.test1.class = ....'
-     */
-    String PREFIX_INSTALL_HOOK = "installhook.";
-
+public interface VaultPackage extends PackageProperties {
 
     /**
      * Returns the id of this package or <code>null</code> if the id can't
@@ -142,6 +44,13 @@ public interface VaultPackage {
     PackageId getId();
 
     /**
+     * Returns the properties of this package.
+     * @return the properties.
+     * @since 3.1
+     */
+    PackageProperties getProperties();
+
+    /**
      * Checks if this package is valid.
      * @return <code>true</code> if this package is valid.
      */
@@ -166,69 +75,6 @@ public interface VaultPackage {
     long getSize();
 
     /**
-     * Returns the last modification date or <code>null</code> if n/a.
-     * @return last modification date or <code>null</code>
-     */
-    Calendar getLastModified();
-
-    /**
-     * Returns the user that last modified the package or <code>null</code> if
n/a.
-     * @return the user or <code>null</code>
-     */
-    String getLastModifiedBy();
-
-    /**
-     * Returns the date when this package was built or <code>null</code> if n/a.
-     * @return the creation date
-     */
-    Calendar getCreated();
-
-    /**
-     * Returns the user that built this package or null if n/a.
-     * @return the creator
-     */
-    String getCreatedBy();
-
-    /**
-     * Returns the date when this package was wrapped or <code>null</code> if
n/a.
-     * @return the wrapped date
-     * @since 2.2.22
-     */
-    Calendar getLastWrapped();
-
-    /**
-     * Returns the user that wrapped this package or null if n/a.
-     * @return the wrapper
-     * @since 2.2.22
-     */
-    String getLastWrappedBy();
-
-    /**
-     * Returns a description of this package or <code>null</code> if n/a
-     * @return a description
-     */
-    String getDescription();
-
-    /**
-     * Returns <code>true</code> if this package can only be extracted by a
-     * admin session.
-     * @return <code>true</code> if this package requires an admin session for
extraction.
-     */
-    boolean requiresRoot();
-
-    /**
-     * Returns an unmodifiable list of dependencies
-     * @return list of dependencies
-     */
-    Dependency[] getDependencies();
-
-    /**
-     * Returns the access control handling defined in this package.
-     * @return the access control handling.
-     */
-    AccessControlHandling getACHandling();
-
-    /**
      * Extracts the package contents to the repository
      *
      * @param session repository session

Added: jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/PackagePropertiesImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/PackagePropertiesImpl.java?rev=1568583&view=auto
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/PackagePropertiesImpl.java
(added)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/PackagePropertiesImpl.java
Sat Feb 15 01:31:16 2014
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * 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
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.vault.packaging.impl;
+
+import java.util.Calendar;
+import java.util.Properties;
+
+import org.apache.jackrabbit.util.ISO8601;
+import org.apache.jackrabbit.vault.fs.io.AccessControlHandling;
+import org.apache.jackrabbit.vault.packaging.Dependency;
+import org.apache.jackrabbit.vault.packaging.PackageId;
+import org.apache.jackrabbit.vault.packaging.PackageProperties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * package properties abstraction
+ */
+public abstract class PackagePropertiesImpl implements PackageProperties {
+
+    private static final Logger log = LoggerFactory.getLogger(PackagePropertiesImpl.class);
+
+    public static final String UNKNOWN_PATH = "/etc/packages/unknown";
+
+    private PackageId id;
+
+    public PackageId getId() {
+        if (id == null) {
+            String version = getProperty(NAME_VERSION);
+            if (version == null) {
+                log.warn("Package does not specify a version. setting to ''");
+                 version = "";
+            }
+            String group = getProperty(NAME_GROUP);
+            String name = getProperty(NAME_NAME);
+            if (group != null && name != null) {
+                id = new PackageId(group, name, version);
+            } else {
+                // check for legacy packages that only contains a 'path' property
+                String path = getProperty("path");
+                if (path == null || path.length() == 0) {
+                    log.warn("Package does not specify a path. setting to 'unknown'");
+                    path = UNKNOWN_PATH;
+                }
+                id = new PackageId(path, version);
+            }
+        }
+        return id;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Calendar getLastModified() {
+        return getDateProperty(NAME_LAST_MODIFIED);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getLastModifiedBy() {
+        return getProperty(NAME_LAST_MODIFIED_BY);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Calendar getCreated() {
+        return getDateProperty(NAME_CREATED);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getCreatedBy() {
+        return getProperty(NAME_CREATED_BY);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Calendar getLastWrapped() {
+        return getDateProperty(NAME_LAST_WRAPPED);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getLastWrappedBy() {
+        return getProperty(NAME_LAST_WRAPPED_BY);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getDescription() {
+        return getProperty(NAME_DESCRIPTION);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public AccessControlHandling getACHandling() {
+        String ac = getProperty(NAME_AC_HANDLING);
+        if (ac == null) {
+            return AccessControlHandling.IGNORE;
+        } else {
+            try {
+                return AccessControlHandling.valueOf(ac.toUpperCase());
+            } catch (IllegalArgumentException e) {
+                log.warn("invalid access control handling configured: {}", ac);
+                return AccessControlHandling.IGNORE;
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean requiresRoot() {
+        return "true".equals(getProperty(NAME_REQUIRES_ROOT));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Dependency[] getDependencies() {
+        String deps = getProperty(NAME_DEPENDENCIES);
+        if (deps == null) {
+            return Dependency.EMPTY;
+        } else {
+            return Dependency.parse(deps);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Calendar getDateProperty(String name) {
+        try {
+            String p = getProperty(name);
+            return p == null
+                    ? null
+                    : ISO8601.parse(p);
+        } catch (Exception e) {
+            log.error("Error while converting date property", e);
+            return null;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getProperty(String name) {
+        try {
+            Properties props = getPropertiesMap();
+            return props == null ? null : props.getProperty(name);
+        } catch (Exception e) {
+            return null;
+        }
+    }
+
+    protected abstract Properties getPropertiesMap();
+
+
+}
\ No newline at end of file

Modified: jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/ZipVaultPackage.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/ZipVaultPackage.java?rev=1568583&r1=1568582&r2=1568583&view=diff
==============================================================================
--- jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/ZipVaultPackage.java
(original)
+++ jackrabbit/commons/filevault/trunk/vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/ZipVaultPackage.java
Sat Feb 15 01:31:16 2014
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.vault.pack
 
 import java.io.File;
 import java.io.IOException;
-import java.util.Calendar;
 import java.util.List;
 import java.util.Properties;
 import java.util.regex.PatternSyntaxException;
@@ -28,19 +27,17 @@ import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.jackrabbit.util.ISO8601;
 import org.apache.jackrabbit.vault.fs.config.MetaInf;
 import org.apache.jackrabbit.vault.fs.io.AccessControlHandling;
 import org.apache.jackrabbit.vault.fs.io.Archive;
 import org.apache.jackrabbit.vault.fs.io.ImportOptions;
 import org.apache.jackrabbit.vault.fs.io.Importer;
 import org.apache.jackrabbit.vault.fs.io.ZipArchive;
-import org.apache.jackrabbit.vault.packaging.Dependency;
 import org.apache.jackrabbit.vault.packaging.InstallContext;
 import org.apache.jackrabbit.vault.packaging.InstallHookProcessor;
 import org.apache.jackrabbit.vault.packaging.InstallHookProcessorFactory;
 import org.apache.jackrabbit.vault.packaging.PackageException;
-import org.apache.jackrabbit.vault.packaging.PackageId;
+import org.apache.jackrabbit.vault.packaging.PackageProperties;
 import org.apache.jackrabbit.vault.packaging.VaultPackage;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -49,7 +46,7 @@ import org.slf4j.LoggerFactory;
  * Implements a vault package that is a zipped representation of a file vault
  * export.
  */
-public class ZipVaultPackage implements VaultPackage {
+public class ZipVaultPackage extends PackagePropertiesImpl implements VaultPackage {
 
     private static final Logger log = LoggerFactory.getLogger(ZipVaultPackage.class);
 
@@ -61,8 +58,6 @@ public class ZipVaultPackage implements 
 
     private boolean isTmpFile;
 
-    private PackageId id;
-
     protected ZipVaultPackage(File file, boolean isTmpFile) throws IOException {
         this(file, isTmpFile, false);
     }
@@ -102,8 +97,8 @@ public class ZipVaultPackage implements 
     public Archive getArchive() {
         if (archive == null) {
             if (file == null) {
-                log.error("Package already closed: " + id);
-                throw new IllegalStateException("Package already closed: " + id);
+                log.error("Package already closed: {}", getId());
+                throw new IllegalStateException("Package already closed: " + getId());
             }
             archive = new ZipArchive(file);
             try {
@@ -116,30 +111,6 @@ public class ZipVaultPackage implements 
         return archive;
     }
 
-    public PackageId getId() {
-        if (id == null) {
-            String version = getProperty(NAME_VERSION);
-            if (version == null) {
-                log.warn("Package does not specify a version. setting to ''");
-                 version = "";
-            }
-            String group = getProperty(NAME_GROUP);
-            String name = getProperty(NAME_NAME);
-            if (group != null && name != null) {
-                id = new PackageId(group, name, version);
-            } else {
-                // check for legacy packages that only contains a 'path' property
-                String path = getProperty("path");
-                if (path == null || path.length() == 0) {
-                    log.warn("Package does not specify a path. setting to 'unknown'");
-                    path = UNKNOWN_PATH;
-                }
-                id = new PackageId(path, version);
-            }
-        }
-        return id;
-    }
-
     /**
      * {@inheritDoc}
      */
@@ -189,93 +160,15 @@ public class ZipVaultPackage implements 
     /**
      * {@inheritDoc}
      */
-    public Calendar getLastModified() {
-        return getDateProperty(NAME_LAST_MODIFIED);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getLastModifiedBy() {
-        return getProperty(NAME_LAST_MODIFIED_BY);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Calendar getCreated() {
-        return getDateProperty(NAME_CREATED);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getCreatedBy() {
-        return getProperty(NAME_CREATED_BY);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Calendar getLastWrapped() {
-        return getDateProperty(NAME_LAST_WRAPPED);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getLastWrappedBy() {
-        return getProperty(NAME_LAST_WRAPPED_BY);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public String getDescription() {
-        return getProperty(NAME_DESCRIPTION);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public AccessControlHandling getACHandling() {
-        String ac = getProperty(NAME_AC_HANDLING);
-        if (ac == null) {
-            return AccessControlHandling.IGNORE;
-        } else {
-            try {
-                return AccessControlHandling.valueOf(ac.toUpperCase());
-            } catch (IllegalArgumentException e) {
-                log.warn("invalid access control handling configured: {}", ac);
-                return AccessControlHandling.IGNORE;
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean requiresRoot() {
-        return "true".equals(getProperty(NAME_REQUIRES_ROOT));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public Dependency[] getDependencies() {
-        String deps = getProperty(NAME_DEPENDENCIES);
-        if (deps == null) {
-            return Dependency.EMPTY;
-        } else {
-            return Dependency.parse(deps);
-        }
+    public void extract(Session session, ImportOptions opts) throws RepositoryException,
PackageException {
+        extract(prepareExtract(session, opts), null);
     }
 
     /**
      * {@inheritDoc}
      */
-    public void extract(Session session, ImportOptions opts) throws RepositoryException,
PackageException {
-        extract(prepareExtract(session, opts), null);
+    public PackageProperties getProperties() {
+        return this;
     }
 
     /**
@@ -371,25 +264,9 @@ public class ZipVaultPackage implements 
         log.info("Extracting {} completed.", getId());
     }
 
-    private Calendar getDateProperty(String name) {
-        try {
-            String p = getProperty(name);
-            return p == null
-                    ? null
-                    : ISO8601.parse(p);
-        } catch (Exception e) {
-            log.error("Error while converting date property", e);
-            return null;
-        }
-    }
-
-    private String getProperty(String name) {
-        try {
-            Properties props = getMetaInf().getProperties();
-            return props == null ? null : props.getProperty(name);
-        } catch (Exception e) {
-            return null;
-        }
+    @Override
+    protected Properties getPropertiesMap() {
+        return getMetaInf().getProperties();
     }
 
     @Override



Mime
View raw message