diff --git a/.gitignore b/.gitignore index e5008f7..a78fa30 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ build/ *.iws out/ atlassian-ide-plugin.xml +*.jar diff --git a/.java-version b/.java-version new file mode 100644 index 0000000..6259340 --- /dev/null +++ b/.java-version @@ -0,0 +1 @@ +1.8 diff --git a/build.gradle b/build.gradle index 6547bab..39d6793 100644 --- a/build.gradle +++ b/build.gradle @@ -23,6 +23,9 @@ repositories { maven { url "http://repo.adobe.com/nexus/content/groups/public" } + + // hack to allow getting to a working version of AEM 6.1 uberjar without running afoul of licensing restrictions + flatDir { dirs '.' } } sourceCompatibility = '1.7' @@ -32,15 +35,13 @@ targetCompatibility = '1.7' dependencies { // AEM's new "uber-jar" - compile "com.adobe.aem:aem-api:6.0.0.1", { - exclude group: "org.slf4j", module: "slf4j-simple" - exclude group: "com.adobe.cq.testing", module: "cq-integration-testing" - } +// compile "com.adobe.aem:uber-jar:6.1.0" // broken + compile name: "uberjar-6.1" // install into the top-level dir of project compile "javax.jcr:jcr:2.0" compile "com.google.guava:guava:15.0" - compile "org.apache.sling:org.apache.sling.jcr.resource:2.3.8" - compile "org.slf4j:slf4j-api:1.6.6" + compile "org.apache.sling:org.apache.sling.jcr.resource:2.5.0" + compile "org.slf4j:slf4j-api:1.7.6" compile "javax.servlet:servlet-api:2.5" compile "commons-io:commons-io:2.4" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c93c687..ad9d71b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,2 +1,2 @@ #Tue Feb 24 15:51:41 MST 2015 -distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-bin.zip diff --git a/src/main/java/com/twcable/jackalope/impl/cq/PageImpl.java b/src/main/java/com/twcable/jackalope/impl/cq/PageImpl.java index e5ffe77..011d8f0 100644 --- a/src/main/java/com/twcable/jackalope/impl/cq/PageImpl.java +++ b/src/main/java/com/twcable/jackalope/impl/cq/PageImpl.java @@ -216,6 +216,18 @@ public Calendar getOffTime() { } + @Override + public Calendar getDeleted() { + throw new UnsupportedOperationException(); + } + + + @Override + public String getDeletedBy() { + throw new UnsupportedOperationException(); + } + + @Override public String getLastModifiedBy() { ValueMap properties = getProperties(); diff --git a/src/main/java/com/twcable/jackalope/impl/cq/PageManagerImpl.java b/src/main/java/com/twcable/jackalope/impl/cq/PageManagerImpl.java index 4e2c772..b9f7f13 100644 --- a/src/main/java/com/twcable/jackalope/impl/cq/PageManagerImpl.java +++ b/src/main/java/com/twcable/jackalope/impl/cq/PageManagerImpl.java @@ -124,16 +124,63 @@ public Page create(String parentPath, String pageName, String template, String t @Override public Page move(Page page, String destination, String beforeName, boolean shallow, boolean resolveConflicts, String[] adjustRefs) throws WCMException { + return this.move(page, destination, beforeName, shallow, resolveConflicts, adjustRefs, null); + } + + + /** + * Moves the given page to the new destination and automatically saves the changes. + * If source and destination are equals the page is just ordered. + * + * @param page the page to move + * @param destination the path of the new destination + * @param beforeName the name of the next page. if null the page is ordered at the end. + * @param shallow if true only the page content is moved + * @param resolveConflict if true resolves name conflict if destination already exists. + * @param adjustRefs list of paths to pages that refer to the moved one. those references will be adjusted. + * @param publishRefs list of referencing paths that will be republished. + * @return the new page at the new location + * @throws WCMException if an error during this operation occurs. + */ + @Override + public Page move(Page page, String destination, String beforeName, boolean shallow, boolean resolveConflict, + String[] adjustRefs, String[] publishRefs) throws WCMException { throw new UnsupportedOperationException(); } @Override public Resource move(Resource resource, String destination, String beforeName, boolean shallow, boolean resolveConflicts, String[] adjustRefs) throws WCMException { + return this.move(resource, destination, beforeName, shallow, resolveConflicts, adjustRefs, null); + } + + + /** + * Moves the given resource to the new destination and automatically saves the changes. + * If source and destination are equals the resource is just ordered. + * + * @param resource the resource to move + * @param destination the path of the new destination + * @param beforeName the name of the next page. if null the page is ordered at the end. + * @param shallow if true only the resource content is moved. + * @param resolveConflict if true resolves name conflict if destination already exists. + * @param adjustRefs list of paths to pages that refer to the moved one. those references will be adjusted. + * @param publishRefs list of referencing paths that will be republished. + * @return the new page at the new location + * @throws WCMException if an error during this operation occurs. + */ + @Override + public Resource move(Resource resource, String destination, String beforeName, boolean shallow, boolean resolveConflict, String[] adjustRefs, String[] publishRefs) throws WCMException { throw new UnsupportedOperationException(); } + @Override + public Resource copy(CopyOptions copyOptions) throws WCMException { + return copy(copyOptions.resource, copyOptions.destination, copyOptions.beforeName, copyOptions.shallow, copyOptions.resolveConflict, copyOptions.autoSave); + } + + @Override public Page copy(Page page, String destination, String beforeName, boolean shallow, boolean resolveConflict) throws WCMException { return copy(page, destination, beforeName, shallow, resolveConflict, false); diff --git a/src/main/java/com/twcable/jackalope/impl/sling/NodeResourceImpl.java b/src/main/java/com/twcable/jackalope/impl/sling/NodeResourceImpl.java index 823a9c8..264d74a 100644 --- a/src/main/java/com/twcable/jackalope/impl/sling/NodeResourceImpl.java +++ b/src/main/java/com/twcable/jackalope/impl/sling/NodeResourceImpl.java @@ -29,9 +29,9 @@ import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ResourceUtil; import org.apache.sling.api.resource.ValueMap; +import org.apache.sling.api.wrappers.ModifiableValueMapDecorator; import org.apache.sling.jcr.resource.JcrModifiablePropertyMap; import org.apache.sling.jcr.resource.JcrPropertyMap; -import org.apache.sling.jcr.resource.internal.JcrModifiableValueMap; import javax.jcr.Node; import javax.jcr.Property; @@ -132,7 +132,8 @@ public AdapterType adaptTo(Class type) { if (type.equals(Node.class)) return (AdapterType)node; if (type.equals(ValueMap.class) || type.equals(Map.class)) return (AdapterType)new JcrPropertyMap(node); if (type.equals(PersistableValueMap.class)) return (AdapterType)new JcrModifiablePropertyMap(node); - if (type.equals(ModifiableValueMap.class)) return (AdapterType)new JcrModifiableValueMap(node, null); + if (type.equals(ModifiableValueMap.class)) + return (AdapterType)new ModifiableValueMapDecorator(new JcrModifiablePropertyMap(node, null)); if (type.equals(Page.class)) { try { diff --git a/src/main/java/com/twcable/jackalope/impl/sling/SimpleResourceResolverFactory.java b/src/main/java/com/twcable/jackalope/impl/sling/SimpleResourceResolverFactory.java index 20a783d..8ece3ad 100644 --- a/src/main/java/com/twcable/jackalope/impl/sling/SimpleResourceResolverFactory.java +++ b/src/main/java/com/twcable/jackalope/impl/sling/SimpleResourceResolverFactory.java @@ -21,6 +21,7 @@ import org.apache.sling.api.resource.ResourceResolverFactory; import org.apache.sling.jcr.api.SlingRepository; +import javax.annotation.CheckForNull; import javax.annotation.Nonnull; import java.util.Map; @@ -37,21 +38,31 @@ public SimpleResourceResolverFactory(@Nonnull SlingRepository repository) { } + @Nonnull @Override public ResourceResolver getResourceResolver(Map authenticationInfo) throws LoginException { return this.resourceResolver; } + @Nonnull @Override public ResourceResolver getAdministrativeResourceResolver(Map authenticationInfo) throws LoginException { return this.resourceResolver; } + @Nonnull @Override public ResourceResolver getServiceResourceResolver(Map authenticationInfo) throws LoginException { return this.resourceResolver; } + + @Override + @CheckForNull + public ResourceResolver getThreadResourceResolver() { + return this.resourceResolver; + } + }