diff --git a/jackrabbit-jcr-server-jakarta/pom.xml b/jackrabbit-jcr-server-jakarta/pom.xml new file mode 100644 index 00000000000..f48bbe644e6 --- /dev/null +++ b/jackrabbit-jcr-server-jakarta/pom.xml @@ -0,0 +1,106 @@ + + + + 4.0.0 + + org.apache.jackrabbit + jackrabbit-jcr-server-project + 2.23.0-beta-SNAPSHOT + ../jackrabbit-jcr-server-project + + jackrabbit-jcr-server-jakarta + + + + org.eclipse.transformer + transformer-maven-plugin + 0.5.0 + true + + + true + + + + + default-jar + + jar + + + + org.apache.jackrabbit + jackrabbit-jcr-server + ${project.version} + + + + + + + + + + apache-release + + + + org.eclipse.transformer + transformer-maven-plugin + 0.5.0 + true + + + true + + + + + source-jar + + jar + + + + org.apache.jackrabbit + jackrabbit-jcr-server + ${project.version} + sources + + + + + + + + + + + + org.apache.jackrabbit + jackrabbit-webdav-jakarta + ${project.version} + + + jakarta.servlet + jakarta.servlet-api + 5.0.0 + provided + + + \ No newline at end of file diff --git a/jackrabbit-jcr-server-project/pom.xml b/jackrabbit-jcr-server-project/pom.xml new file mode 100644 index 00000000000..9508dfb4572 --- /dev/null +++ b/jackrabbit-jcr-server-project/pom.xml @@ -0,0 +1,125 @@ + + + + 4.0.0 + + org.apache.jackrabbit + jackrabbit-parent + 2.23.0-beta-SNAPSHOT + ../jackrabbit-parent/pom.xml + + jackrabbit-jcr-server-project + pom + + ../jackrabbit-jcr-server + ../jackrabbit-jcr-server-jakarta + + + + javax.jcr + jcr + + + org.apache.jackrabbit + jackrabbit-spi-commons + ${project.version} + + + org.apache.jackrabbit + jackrabbit-jcr-commons + ${project.version} + + + org.apache.tika + tika-core + + + org.slf4j + slf4j-api + + + commons-fileupload + commons-fileupload + + + + org.osgi + org.osgi.compendium + 5.0.0 + provided + + + org.apache.felix + org.apache.felix.scr.annotations + 1.12.0 + provided + + + org.osgi + org.osgi.annotation + provided + + + junit + junit + test + + + org.easymock + easymock + test + + + org.apache.jackrabbit + jackrabbit-core + ${project.version} + test + + + org.apache.jackrabbit + jackrabbit-jcr-tests + ${project.version} + test + + + org.eclipse.jetty + jetty-server + test + + + org.eclipse.jetty + jetty-servlet + test + + + ch.qos.logback + logback-classic + test + + + org.mockito + mockito-core + test + + + org.apache.derby + derby + test + + + \ No newline at end of file diff --git a/jackrabbit-jcr-server/pom.xml b/jackrabbit-jcr-server/pom.xml index 5a9e95b2af9..3bd18c0d335 100644 --- a/jackrabbit-jcr-server/pom.xml +++ b/jackrabbit-jcr-server/pom.xml @@ -25,9 +25,9 @@ org.apache.jackrabbit - jackrabbit-parent + jackrabbit-jcr-server-project 2.23.0-beta-SNAPSHOT - ../jackrabbit-parent/pom.xml + ../jackrabbit-jcr-server-project jackrabbit-jcr-server Jackrabbit JCR Server @@ -179,38 +179,17 @@ - - javax.jcr - jcr - - - org.apache.jackrabbit - jackrabbit-spi-commons - ${project.version} - - - org.apache.jackrabbit - jackrabbit-jcr-commons - ${project.version} - org.apache.jackrabbit jackrabbit-webdav ${project.version} - - org.apache.tika - tika-core - - - org.slf4j - slf4j-api - javax.servlet javax.servlet-api provided + commons-fileupload commons-fileupload diff --git a/jackrabbit-jcr-servlet-jakarta/pom.xml b/jackrabbit-jcr-servlet-jakarta/pom.xml new file mode 100644 index 00000000000..bb3de1b7ea6 --- /dev/null +++ b/jackrabbit-jcr-servlet-jakarta/pom.xml @@ -0,0 +1,101 @@ + + + + 4.0.0 + + org.apache.jackrabbit + jackrabbit-jcr-servlet-project + 2.23.0-beta-SNAPSHOT + ../jackrabbit-jcr-servlet-project + + jackrabbit-jcr-servlet-jakarta + + + + org.eclipse.transformer + transformer-maven-plugin + 0.5.0 + true + + + true + + + + + default-jar + + jar + + + + org.apache.jackrabbit + jackrabbit-jcr-servlet + ${project.version} + + + + + + + + + + apache-release + + + + org.eclipse.transformer + transformer-maven-plugin + 0.5.0 + true + + + true + + + + + source-jar + + jar + + + + org.apache.jackrabbit + jackrabbit-jcr-servlet + ${project.version} + sources + + + + + + + + + + + + jakarta.servlet + jakarta.servlet-api + 5.0.0 + provided + + + \ No newline at end of file diff --git a/jackrabbit-jcr-servlet-project/pom.xml b/jackrabbit-jcr-servlet-project/pom.xml new file mode 100644 index 00000000000..4e2d7773d23 --- /dev/null +++ b/jackrabbit-jcr-servlet-project/pom.xml @@ -0,0 +1,50 @@ + + + + 4.0.0 + + org.apache.jackrabbit + jackrabbit-parent + 2.23.0-beta-SNAPSHOT + ../jackrabbit-parent/pom.xml + + jackrabbit-jcr-servlet-project + pom + Jackrabbit WebDAV Project + + ../jackrabbit-jcr-servlet + ../jackrabbit-jcr-servlet-jakarta + + + + javax.jcr + jcr + + + org.apache.jackrabbit + jackrabbit-jcr-commons + ${project.version} + + + org.apache.jackrabbit + jackrabbit-core + ${project.version} + true + + + \ No newline at end of file diff --git a/jackrabbit-jcr-servlet/pom.xml b/jackrabbit-jcr-servlet/pom.xml index bb27fdbd375..6cd07ca742f 100644 --- a/jackrabbit-jcr-servlet/pom.xml +++ b/jackrabbit-jcr-servlet/pom.xml @@ -21,9 +21,9 @@ 4.0.0 org.apache.jackrabbit - jackrabbit-parent + jackrabbit-jcr-servlet-project 2.23.0-beta-SNAPSHOT - ../jackrabbit-parent/pom.xml + ../jackrabbit-jcr-servlet-project jackrabbit-jcr-servlet @@ -35,10 +35,6 @@ - - javax.jcr - jcr - javax.servlet javax.servlet-api diff --git a/jackrabbit-webapp-jakarta/pom.xml b/jackrabbit-webapp-jakarta/pom.xml new file mode 100644 index 00000000000..84a4e458473 --- /dev/null +++ b/jackrabbit-webapp-jakarta/pom.xml @@ -0,0 +1,154 @@ + + + + 4.0.0 + + org.apache.jackrabbit + jackrabbit-webapp-project + 2.23.0-beta-SNAPSHOT + ../jackrabbit-webapp-project + + jackrabbit-webapp-jakarta + war + + 10.1.6 + + + + + maven-war-plugin + + true + + + + org.eclipse.transformer + transformer-maven-plugin + 0.5.0 + true + + + true + + + + + default-war + + jar + + + + org.apache.jackrabbit + jackrabbit-webapp + ${project.version} + + + + + + + + + + apache-release + + + + org.eclipse.transformer + transformer-maven-plugin + 0.5.0 + true + + + true + + + + + source-jar + + jar + + + + org.apache.jackrabbit + jackrabbit-webapp + ${project.version} + sources + + + + + + + + + + + + org.apache.jackrabbit + jackrabbit-jcr-server-jakarta + ${project.version} + + + org.apache.jackrabbit + jackrabbit-jcr-servlet-jakarta + ${project.version} + + + org.apache.tomcat.embed + tomcat-embed-core + ${tomcat.version} + + + org.apache.tomcat.embed + tomcat-embed-jasper + ${tomcat.version} + + + org.apache.tomcat + tomcat-jasper + ${tomcat.version} + + + org.apache.tomcat + tomcat-jasper-el + ${tomcat.version} + + + org.apache.tomcat + tomcat-jsp-api + ${tomcat.version} + + + org.apache.tika + tika-parsers-standard-package + + + org.bouncycastle + bcmail-jdk15on + + + org.bouncycastle + bcprov-jdk15on + + + + + \ No newline at end of file diff --git a/jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java b/jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java new file mode 100644 index 00000000000..0299a509af2 --- /dev/null +++ b/jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java @@ -0,0 +1,184 @@ +/* + * 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.j2ee; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Enumeration; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; + +import org.apache.catalina.startup.Tomcat; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.IOUtils; +import org.slf4j.bridge.SLF4JBridgeHandler; + +import com.gargoylesoftware.htmlunit.WebClient; +import com.gargoylesoftware.htmlunit.html.HtmlElement; +import com.gargoylesoftware.htmlunit.html.HtmlForm; +import com.gargoylesoftware.htmlunit.html.HtmlInput; +import com.gargoylesoftware.htmlunit.html.HtmlPage; +import com.google.common.io.Files; + +import junit.framework.TestCase; + +public class TomcatIT extends TestCase { + + static { + SLF4JBridgeHandler.install(); + } + + private URL url; + + private Tomcat tomcat; + + private WebClient client; + + protected void setUp() throws Exception { + File war = null; + for (File f : new File("target").listFiles()) { + if (f.isFile() && f.getName().endsWith("war")) { + war = extractWarFile(f); + break; + } + } + assertNotNull(war); + rewriteWebXml(war); + + File bootstrap = new File("target", "bootstrap.properties"); + bootstrap.delete(); + + File baseDir = new File("target", "tomcat"); + FileUtils.deleteQuietly(baseDir); + + File repoDir = new File("target", "repository"); + FileUtils.deleteQuietly(repoDir); + + url = new URL("http://localhost:12856/"); + + tomcat = new Tomcat(); + tomcat.setSilent(true); + tomcat.setBaseDir(baseDir.getPath()); + tomcat.setHostname(url.getHost()); + tomcat.setPort(url.getPort()); + tomcat.getConnector(); + tomcat.addWebapp("", war.getAbsolutePath()); + + tomcat.start(); + + client = new WebClient(); + } + + private File extractWarFile(File warFile) throws IOException{ + String fileBaseName = FilenameUtils.getBaseName(warFile.getName()); + Path destFolderPath = Paths.get(warFile.getParent(), fileBaseName); + if (!java.nio.file.Files.exists(destFolderPath)) { + try (ZipFile zipFile = new ZipFile(warFile, ZipFile.OPEN_READ)){ + Enumeration entries = zipFile.entries(); + while (entries.hasMoreElements()) { + ZipEntry entry = entries.nextElement(); + Path entryPath = destFolderPath.resolve(entry.getName()); + if (entryPath.normalize().startsWith(destFolderPath.normalize())){ + if (entry.isDirectory()) { + java.nio.file.Files.createDirectories(entryPath); + } else { + java.nio.file.Files.createDirectories(entryPath.getParent()); + try (InputStream in = zipFile.getInputStream(entry)){ + try (OutputStream out = new FileOutputStream(entryPath.toFile())){ + IOUtils.copy(in, out); + } + } + } + } + } + } + } + return destFolderPath.toFile(); + } + + protected void mkdirs(File dir, String errorMessageFormat) { + if (dir.exists() && dir.isDirectory()) { + return; + } + dir.mkdirs(); + if (!dir.exists()) { + throw new RuntimeException(String.format(errorMessageFormat, dir.getPath())); + } + } + + public void testTomcat() throws Exception { + HtmlPage page = client.getPage(url); + assertEquals("Content Repository Setup", page.getTitleText()); + + page = submitNewRepositoryForm(page); + assertEquals("Content Repository Ready", page.getTitleText()); + + page = page.getAnchorByText("home").click(); + assertEquals("Apache Jackrabbit JCR Server", page.getTitleText()); + } + + private HtmlPage submitNewRepositoryForm(HtmlPage page) throws IOException { + for (HtmlForm form : page.getForms()) { + for (HtmlInput mode : form.getInputsByName("mode")) { + if ("new".equals(mode.getValueAttribute())) { + for (HtmlInput home : form.getInputsByName("repository_home")) { + home.setValueAttribute("target/repository"); + for (HtmlElement submit : form.getElementsByAttribute("input", "type", "submit")) { + return submit.click(); + } + } + } + } + } + fail(); + return null; + } + + private void rewriteWebXml(File war) throws IOException { + File webXml = new File(war, new File("WEB-INF","web.xml").getPath()); + assertTrue(webXml.exists()); + List lines = Files.readLines(webXml, StandardCharsets.UTF_8); + BufferedWriter writer = Files.newWriter(webXml, StandardCharsets.UTF_8); + try { + for (String line : lines) { + line = line.replace("jackrabbit/bootstrap.properties", + "target/bootstrap.properties"); + writer.write(line); + writer.write(System.lineSeparator()); + } + } finally { + writer.close(); + } + } + + protected void tearDown() throws Exception { + client.close(); + + tomcat.stop(); + } + +} diff --git a/jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml b/jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml new file mode 100644 index 00000000000..b0609231f80 --- /dev/null +++ b/jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml @@ -0,0 +1,31 @@ + + + + + + target/jcr.log + + %date{HH:mm:ss.SSS} %-5level %-40([%thread] %F:%L) %msg%n + + + + + + + + diff --git a/jackrabbit-webapp-project/pom.xml b/jackrabbit-webapp-project/pom.xml new file mode 100644 index 00000000000..881a6ae24c6 --- /dev/null +++ b/jackrabbit-webapp-project/pom.xml @@ -0,0 +1,120 @@ + + + + 4.0.0 + + org.apache.jackrabbit + jackrabbit-parent + 2.23.0-beta-SNAPSHOT + ../jackrabbit-parent/pom.xml + + jackrabbit-webapp-project + pom + + ../jackrabbit-webapp + ../jackrabbit-webapp-jakarta + + + 8.5.86 + + + + javax.jcr + jcr + compile + + + org.apache.jackrabbit + jackrabbit-core + ${project.version} + + + org.apache.tika + tika-parsers-standard-package + + + org.slf4j + jcl-over-slf4j + + + ch.qos.logback + logback-classic + + + commons-beanutils + commons-beanutils + 1.9.4 + + + org.apache.tomcat + tomcat-servlet-api + ${tomcat.version} + provided + + + junit + junit + test + + + net.sourceforge.htmlunit + htmlunit + 2.67.0 + test + + + commons-logging + commons-logging + + + + + org.slf4j + jul-to-slf4j + ${slf4j.version} + test + + + com.google.guava + guava + 31.1-jre + test + + + org.apache.derby + derby + + + + + + + maven-failsafe-plugin + + + + derby.stream.error.file + target/derby.log + + + + + + + + diff --git a/jackrabbit-webapp/pom.xml b/jackrabbit-webapp/pom.xml index 4aa3b3e1242..58c04bfa79f 100644 --- a/jackrabbit-webapp/pom.xml +++ b/jackrabbit-webapp/pom.xml @@ -1,5 +1,4 @@ - - 4.0.0 - org.apache.jackrabbit - jackrabbit-parent + jackrabbit-webapp-project 2.23.0-beta-SNAPSHOT - ../jackrabbit-parent/pom.xml + ../jackrabbit-webapp-project jackrabbit-webapp war @@ -39,24 +36,6 @@ - - javax.jcr - jcr - compile - - - org.apache.jackrabbit - jackrabbit-core - ${project.version} - - - org.apache.tika - tika-parsers-standard-package - - - org.slf4j - jcl-over-slf4j - org.apache.jackrabbit jackrabbit-jcr-server @@ -67,10 +46,12 @@ jackrabbit-jcr-servlet ${project.version} + ch.qos.logback logback-classic + org.apache.tomcat tomcat-servlet-api @@ -101,6 +82,20 @@ ${tomcat.version} test + + org.apache.tika + tika-parsers-standard-package + + + org.bouncycastle + bcmail-jdk15on + + + org.bouncycastle + bcprov-jdk15on + + + net.sourceforge.htmlunit htmlunit @@ -130,7 +125,6 @@ test - @@ -179,21 +173,5 @@ - - - - maven-failsafe-plugin - - - - derby.stream.error.file - target/derby.log - - - - - - - diff --git a/jackrabbit-webdav-jakarta/pom.xml b/jackrabbit-webdav-jakarta/pom.xml new file mode 100644 index 00000000000..9b8bc1f2e57 --- /dev/null +++ b/jackrabbit-webdav-jakarta/pom.xml @@ -0,0 +1,101 @@ + + + + 4.0.0 + + org.apache.jackrabbit + jackrabbit-webdav-project + 2.23.0-beta-SNAPSHOT + ../jackrabbit-webdav-project + + jackrabbit-webdav-jakarta + + + + org.eclipse.transformer + transformer-maven-plugin + 0.5.0 + true + + + true + + + + + default-jar + + jar + + + + org.apache.jackrabbit + jackrabbit-webdav + ${project.version} + + + + + + + + + + apache-release + + + + org.eclipse.transformer + transformer-maven-plugin + 0.5.0 + true + + + true + + + + + source-jar + + jar + + + + org.apache.jackrabbit + jackrabbit-webdav + ${project.version} + sources + + + + + + + + + + + + jakarta.servlet + jakarta.servlet-api + 5.0.0 + provided + + + \ No newline at end of file diff --git a/jackrabbit-webdav-project/pom.xml b/jackrabbit-webdav-project/pom.xml new file mode 100644 index 00000000000..b8147236dfe --- /dev/null +++ b/jackrabbit-webdav-project/pom.xml @@ -0,0 +1,73 @@ + + + + 4.0.0 + + org.apache.jackrabbit + jackrabbit-parent + 2.23.0-beta-SNAPSHOT + ../jackrabbit-parent/pom.xml + + jackrabbit-webdav-project + pom + Jackrabbit JCR Servlet Project + + ../jackrabbit-webdav + ../jackrabbit-webdav-jakarta + + + + org.osgi + org.osgi.annotation + provided + + + org.slf4j + slf4j-api + + + javax.servlet + javax.servlet-api + provided + + + org.apache.httpcomponents + httpcore + 4.4.16 + + + org.apache.httpcomponents + httpclient + 4.5.14 + + + org.slf4j + jcl-over-slf4j + + + junit + junit + test + + + ch.qos.logback + logback-classic + test + + + \ No newline at end of file diff --git a/jackrabbit-webdav/pom.xml b/jackrabbit-webdav/pom.xml index d1c7c62ea33..34a37028742 100644 --- a/jackrabbit-webdav/pom.xml +++ b/jackrabbit-webdav/pom.xml @@ -25,9 +25,9 @@ org.apache.jackrabbit - jackrabbit-parent + jackrabbit-webdav-project 2.23.0-beta-SNAPSHOT - ../jackrabbit-parent/pom.xml + ../jackrabbit-webdav-project jackrabbit-webdav bundle @@ -54,44 +54,10 @@ - - org.osgi - org.osgi.annotation - provided - - - org.slf4j - slf4j-api - javax.servlet javax.servlet-api provided - - org.apache.httpcomponents - httpcore - 4.4.16 - - - org.apache.httpcomponents - httpclient - 4.5.14 - - - org.slf4j - jcl-over-slf4j - - - - junit - junit - test - - - ch.qos.logback - logback-classic - test - diff --git a/pom.xml b/pom.xml index 0531091eaa2..92b556eb275 100644 --- a/pom.xml +++ b/pom.xml @@ -43,10 +43,10 @@ jackrabbit-aws-ext jackrabbit-vfs-ext jackrabbit-core - jackrabbit-webdav - jackrabbit-jcr-server - jackrabbit-jcr-servlet - jackrabbit-webapp + jackrabbit-webdav-project + jackrabbit-jcr-server-project + jackrabbit-jcr-servlet-project + jackrabbit-webapp-project jackrabbit-jca jackrabbit-spi jackrabbit-spi-commons