weightedNames = Arrays.asList(
- "com.ibm.xsp.core.library", //$NON-NLS-1$
- "com.ibm.xsp.extsn.library", //$NON-NLS-1$
- "com.ibm.xsp.domino.library", //$NON-NLS-1$
- "com.ibm.xsp.designer.library", //$NON-NLS-1$
- "com.ibm.xsp.extlib.library" //$NON-NLS-1$
- );
-
- @Override
- public int compare(XspLibrary lib1, XspLibrary lib2) {
- String libName1 = lib1.getLibraryId();
- String libName2 = lib2.getLibraryId();
-
- int loc1 = weightedNames.indexOf(libName1);
- int loc2 = weightedNames.indexOf(libName2);
- if(loc1 > -1 && loc2 == -1) {
- return -1;
- } else if(loc1 == -1 && loc2 > -1) {
- return 1;
- } else if(loc1 > -1 && loc2 > -1) {
- return Integer.compare(loc1, loc2);
- }
-
- return libName1.compareTo(libName2);
- }
-
-}
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/jakarta-faces-config.xml b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/jakarta-faces-config.xml
deleted file mode 100644
index 78a48c0..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/jakarta-faces-config.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
- org.openntf.xpages.runtime.JakartaFacesApplicationFactory
- org.openntf.xpages.runtime.context.JakartaFacesContextFactory
-
-
- org.openntf.xpages.runtime.xsp.JakartaViewHandler
-
-
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/platformPlugins.txt b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/platformPlugins.txt
deleted file mode 100644
index 7c8766c..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/platformPlugins.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-com.ibm.xsp.theme.oneuiv302.ThemeActivator
-com.ibm.xsp.theme.oneui_idx.ThemeActivator
-com.ibm.xsp.dojo.factory.DojoLibraryActivator
-
-com.ibm.xsp.extlib.library.ExtlibActivator
-com.ibm.xsp.extlib.plugin.ControlsPluginActivator
-com.ibm.xsp.theme.bootstrap.plugin.Activator
-com.ibm.xsp.extlib.plugin.MobilePluginActivator
-com.ibm.xsp.extlib.plugin.OneUIPluginActivator
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.commons.platform.Factory b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.commons.platform.Factory
deleted file mode 100644
index 59c131e..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.commons.platform.Factory
+++ /dev/null
@@ -1 +0,0 @@
-org.openntf.xpages.runtime.domino.platform.JakartaDominoPlatformFactory
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.designer.runtime.extensions.JavaScriptProvider b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.designer.runtime.extensions.JavaScriptProvider
deleted file mode 100644
index eec188e..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.designer.runtime.extensions.JavaScriptProvider
+++ /dev/null
@@ -1 +0,0 @@
-com.ibm.xsp.extlib.relational.javascript.JdbcJSFunctions
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.GlobalResourceProvider b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.GlobalResourceProvider
deleted file mode 100644
index ebc96d7..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.GlobalResourceProvider
+++ /dev/null
@@ -1,2 +0,0 @@
-com.ibm.xsp.minifier.MinifierResourceProvider
-com.ibm.xsp.extlib.resources.ExtlibResourceProvider
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.RequestParameters b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.RequestParameters
deleted file mode 100644
index 3c143aa..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.RequestParameters
+++ /dev/null
@@ -1 +0,0 @@
-com.ibm.xsp.extlib.library.ExtlibRequestCustomizerFactory
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.adapter.servletFactory b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.adapter.servletFactory
deleted file mode 100644
index 17e5602..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.adapter.servletFactory
+++ /dev/null
@@ -1,2 +0,0 @@
-com.ibm.xsp.extlib.proxy.servlet.ProxyServletFactory
-com.ibm.xsp.extlib.relational.jdbc.services.servlet.JdbcServletFactory
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.context.DojoLibraryFactory b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.context.DojoLibraryFactory
deleted file mode 100644
index 7d2ed9a..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.context.DojoLibraryFactory
+++ /dev/null
@@ -1 +0,0 @@
-com.ibm.xsp.dojo.factory.JakartaDojoLibraryFactory
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.core.events.ApplicationListener b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.core.events.ApplicationListener
deleted file mode 100644
index c35b092..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.core.events.ApplicationListener
+++ /dev/null
@@ -1 +0,0 @@
-com.ibm.xsp.extlib.relational.resources.ApplicationInitializer
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.DumpAccessorFactory b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.DumpAccessorFactory
deleted file mode 100644
index 4e1d2e2..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.DumpAccessorFactory
+++ /dev/null
@@ -1,6 +0,0 @@
-com.ibm.xsp.extlib.util.debug.JavaScriptDumpFactory
-com.ibm.xsp.extlib.util.debug.BasicDumpFactory
-com.ibm.xsp.extlib.util.debug.XPagesDumpFactory
-com.ibm.xsp.extlib.util.debug.ExtLibDumpFactory
-com.ibm.xsp.extlib.social.impl.SocialDumpFactory
-com.ibm.xsp.extlib.relational.debug.JdbcDumpFactory
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.controls.DynamicColumnBuilderFactory b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.controls.DynamicColumnBuilderFactory
deleted file mode 100644
index 7739fc9..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.controls.DynamicColumnBuilderFactory
+++ /dev/null
@@ -1 +0,0 @@
-com.ibm.xsp.extlib.relational.component.dynamicview.JdbcDynamicColumnBuilderFactory
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.device.DeviceDataProvider b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.device.DeviceDataProvider
deleted file mode 100644
index f8f3f2d..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.device.DeviceDataProvider
+++ /dev/null
@@ -1 +0,0 @@
-com.ibm.xsp.extlib.device.extensions.XspUserAgentDataProvider
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.relational.jdbc.datasource.IFileJdbcPoolProvider b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.relational.jdbc.datasource.IFileJdbcPoolProvider
deleted file mode 100644
index d8597ab..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.extlib.relational.jdbc.datasource.IFileJdbcPoolProvider
+++ /dev/null
@@ -1,2 +0,0 @@
-com.ibm.xsp.extlib.relational.jdbc.datasource.dbcp.NSFFileJdbcDBCPProvider
-com.ibm.xsp.extlib.relational.jdbc.datasource.xpages.NSFFileJdbcXPCPProvider
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.minifier.loader b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.minifier.loader
deleted file mode 100644
index 0197e85..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.minifier.loader
+++ /dev/null
@@ -1,2 +0,0 @@
-com.ibm.xsp.minifier.DojoLoader
-com.ibm.xsp.extlib.minifier.ExtLibLoader
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.renderkit.ContentTypeRenderer b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.renderkit.ContentTypeRenderer
deleted file mode 100644
index be8626a..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.renderkit.ContentTypeRenderer
+++ /dev/null
@@ -1 +0,0 @@
-com.ibm.xsp.extlib.renderkit.contenttype.GoogleSearch
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.resource.DojoModulePathResource b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.resource.DojoModulePathResource
deleted file mode 100644
index 626987b..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.resource.DojoModulePathResource
+++ /dev/null
@@ -1 +0,0 @@
-com.ibm.xsp.extlib.resources.ExtlibModulePath
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.runtime.resources b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.runtime.resources
deleted file mode 100644
index a1dfcfc..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.runtime.resources
+++ /dev/null
@@ -1 +0,0 @@
-com.ibm.xsp.extlib.relational.resources.JdbcDataSourceProvider
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.stylekit.StyleKitFactory b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.stylekit.StyleKitFactory
deleted file mode 100644
index f1149cd..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.stylekit.StyleKitFactory
+++ /dev/null
@@ -1,2 +0,0 @@
-com.ibm.xsp.theme.oneuiv302.ThemeStyleKitFactory
-com.ibm.xsp.theme.bootstrap.themes.StyleKitFactory
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.stylekit.ThemeExtension b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.stylekit.ThemeExtension
deleted file mode 100644
index 90220af..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/com.ibm.xsp.stylekit.ThemeExtension
+++ /dev/null
@@ -1 +0,0 @@
-com.ibm.xsp.stylekit.CoreThemeExtension
\ No newline at end of file
diff --git a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/org.openntf.xpages.runtime.osgi.ActivatorNameProvider b/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/org.openntf.xpages.runtime.osgi.ActivatorNameProvider
deleted file mode 100644
index 1e164bf..0000000
--- a/xpages-webapp-support/xpages-runtime/src/main/resources/META-INF/services/org.openntf.xpages.runtime.osgi.ActivatorNameProvider
+++ /dev/null
@@ -1 +0,0 @@
-org.openntf.xpages.runtime.osgi.DefaultActivatorNameProvider
\ No newline at end of file
diff --git a/xpages-webapp-support/xsp-maven-plugin/pom.xml b/xpages-webapp-support/xsp-maven-plugin/pom.xml
deleted file mode 100644
index 2a76f80..0000000
--- a/xpages-webapp-support/xsp-maven-plugin/pom.xml
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
- 4.0.0
-
- org.openntf.xpages
- xpages-webapp-support
- 1.3.0-SNAPSHOT
-
- xsp-maven-plugin
- maven-plugin
-
- XSP Transpiler Plugin
-
- Provides a Maven goal to transpile XSP source to Java during a project build.
-
-
-
- 3.3.9
-
-
- 2020
-
-
-
- The Apache Software License, Version 2.0
- http://www.apache.org/licenses/LICENSE-2.0.txt
-
-
-
-
-
- Jesse Gallagher
- jesse@frostillic.us
-
-
-
-
-
- org.apache.maven
- maven-plugin-api
- ${maven.api.version}
-
-
- org.apache.maven
- maven-core
- ${maven.api.version}
-
-
- org.apache.maven
- maven-project
- 2.2.1
-
-
- org.apache.maven.plugin-tools
- maven-plugin-annotations
- 3.2
- provided
-
-
- org.codehaus.plexus
- plexus-utils
- 3.2.1
-
-
- org.sonatype.plexus
- plexus-build-api
- 0.0.7
-
-
-
- org.codehaus.groovy
- groovy
- 3.0.7
-
-
- com.ibm.sbt
- com.ibm.commons
- 9.0.0
-
-
- com.ibm.sbt
- com.ibm.commons.xml
- 9.0.0
-
-
-
- ${project.groupId}
- xpages-runtime
- ${project.version}
- provided
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-plugin-plugin
- 3.5.1
-
- xsp
- true
-
-
-
- mojo-descriptor
-
- descriptor
-
-
-
- help-goal
-
- helpmojo
-
-
-
-
-
-
-
diff --git a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/Messages.java b/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/Messages.java
deleted file mode 100644
index 6146c82..0000000
--- a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/Messages.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.openntf.xsp.maven.transpiler;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class Messages {
- private static final String BUNDLE_NAME = "org.openntf.xsp.maven.transpiler.messages"; //$NON-NLS-1$
-
- private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
-
- private Messages() {
- }
-
- public static String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
diff --git a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/NonVerifyingPathClassLoader.java b/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/NonVerifyingPathClassLoader.java
deleted file mode 100644
index de8ba7f..0000000
--- a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/NonVerifyingPathClassLoader.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/**
- * Copyright © 2020-2020 Jesse Gallagher
- *
- * Licensed 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.openntf.xsp.maven.transpiler;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-import com.ibm.commons.util.io.StreamUtil;
-
-/**
- * {@link ClassLoader} implementation that loads classes from a collection of file paths,
- * but does not verify signatures.
- *
- * This is useful to avoid trouble with OSGi-style split packages in different JARs that
- * may or may not have the same signer.
- *
- * @author Jesse Gallagher
- */
-public class NonVerifyingPathClassLoader extends ClassLoader implements AutoCloseable {
- private final Collection paths;
- private final ClassLoader delegate;
- private final URLClassLoader resourceLoader;
- private final Map jarFiles = new HashMap<>();
-
- public NonVerifyingPathClassLoader(Collection paths, ClassLoader delegate) {
- super();
- this.paths = Objects.requireNonNull(paths);
- this.resourceLoader = URLClassLoader.newInstance(
- paths.stream()
- .map(Path::toUri)
- .map(t -> {
- try {
- return t.toURL();
- } catch (MalformedURLException e) {
- throw new RuntimeException(e);
- }
- })
- .toArray(size -> new URL[size])
- );
- this.delegate = delegate;
- }
-
- @Override
- protected Class> findClass(String name) throws ClassNotFoundException {
- String binaryName = String.valueOf(name)
- .replace('.', '/')
- + ".class"; //$NON-NLS-1$
- for(Path path : paths) {
- if(Files.isRegularFile(path)) {
- try {
- JarFile f = jarFiles.computeIfAbsent(path, p -> {
- try {
- return new JarFile(p.toFile());
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- });
- JarEntry entry = f.getJarEntry(binaryName);
- if(entry != null) {
- // Read in the class data
- try(InputStream is = f.getInputStream(entry)) {
- return defineClass(name, is);
- }
- }
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- } else if(Files.isDirectory(path)) {
- Path classFile = path.resolve(binaryName.replace('/', File.separatorChar));
- if(Files.isRegularFile(classFile)) {
- // Read in the class data
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- try {
- Files.copy(classFile, baos);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- byte[] classData = baos.toByteArray();
- return defineClass(name, classData, 0, classData.length);
- }
- }
- }
-
- return delegate.loadClass(name);
- }
-
- public Class> defineClass(String name, InputStream is) throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- StreamUtil.copyStream(is, baos);
- byte[] classData = baos.toByteArray();
- return defineClass(name, classData, 0, classData.length);
- }
-
- @Override
- protected URL findResource(String name) {
- return resourceLoader.findResource(name);
- }
-
- @Override
- protected Enumeration findResources(String name) throws IOException {
- return resourceLoader.findResources(name);
- }
-
- @Override
- public void close() throws Exception {
- resourceLoader.close();
- for(JarFile f : jarFiles.values()) {
- f.close();
- }
- }
-}
diff --git a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/TranspileXspMojo.java b/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/TranspileXspMojo.java
deleted file mode 100644
index 74b9ea2..0000000
--- a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/TranspileXspMojo.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/**
- * Copyright © 2020-2020 Jesse Gallagher
- *
- * Licensed 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.openntf.xsp.maven.transpiler;
-import java.io.File;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.lang.reflect.Method;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.text.MessageFormat;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.manager.WagonManager;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.descriptor.PluginDescriptor;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.maven.plugins.annotations.Component;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.project.MavenProject;
-import org.codehaus.plexus.util.Scanner;
-import org.sonatype.plexus.build.incremental.BuildContext;
-
-/**
- * Transpiles XSP source to Java.
- *
- * @author Jesse Gallagher
- * @since 1.0.0
- */
-@Mojo(
- name="transpile",
- defaultPhase=LifecyclePhase.GENERATE_SOURCES,
- requiresDependencyResolution=ResolutionScope.COMPILE_PLUS_RUNTIME,
- requiresDependencyCollection=ResolutionScope.COMPILE_PLUS_RUNTIME
-)
-public class TranspileXspMojo extends AbstractMojo {
- @Parameter(defaultValue="${project}", readonly=true, required=false)
- protected MavenProject project;
-
- @Component
- protected WagonManager wagonManager;
-
- @Parameter(defaultValue="${plugin}", readonly=true)
- protected PluginDescriptor pluginDescriptor;
-
- @Parameter(defaultValue="${session}", readonly=true)
- protected MavenSession mavenSession;
-
- /**
- * The root directory to search for XSP files.
- */
- @Parameter(required=false, defaultValue="${project.basedir}/src/main/webapp/WEB-INF/xpages")
- private File xspSourceRoot;
-
- /**
- * The root directory to search for XSP files.
- */
- @Parameter(required=false, defaultValue="${project.basedir}/src/main/webapp/WEB-INF/controls")
- private File ccSourceRoot;
-
- @Parameter(required=true, defaultValue="${project.build.directory}/generated-sources/java")
- private File outputDirectory;
-
- @Component
- private BuildContext buildContext;
-
- private Log log;
-
- public TranspileXspMojo() {
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public void execute() throws MojoExecutionException, MojoFailureException {
- log = getLog();
-
- Path xspSourceRoot = this.xspSourceRoot == null ? null : this.xspSourceRoot.toPath();
- if(xspSourceRoot != null) {
- if(!Files.exists(xspSourceRoot)) {
- xspSourceRoot = null;
- }
- }
- if(log.isInfoEnabled()) {
- log.info(MessageFormat.format(Messages.getString("TranspileXspMojo.usingXspSourceRoot"), xspSourceRoot)); //$NON-NLS-1$
- }
-
- Path ccSourceRoot = this.ccSourceRoot == null ? null : this.ccSourceRoot.toPath();
- if(ccSourceRoot != null) {
- if(!Files.exists(ccSourceRoot)) {
- ccSourceRoot = null;
- }
- }
- if(log.isInfoEnabled()) {
- log.info(MessageFormat.format(Messages.getString("TranspileXspMojo.usingCcSourceRoot"), ccSourceRoot)); //$NON-NLS-1$
- }
-
- // Check if a build is needed
- List changedXPages = Collections.emptyList();
- List deletedXPages = Collections.emptyList();
- if(xspSourceRoot != null) {
- Scanner scanner = buildContext.newScanner(xspSourceRoot.toFile());
- changedXPages = scanXspChanges(scanner, xspSourceRoot);
-
- scanner = buildContext.newDeleteScanner(xspSourceRoot.toFile());
- deletedXPages = scanXspChanges(scanner, xspSourceRoot);
- }
-
- List changedControls = Collections.emptyList();
- List deletedControls = Collections.emptyList();
- if(ccSourceRoot != null) {
- Scanner scanner = buildContext.newScanner(ccSourceRoot.toFile());
- changedControls = scanXspChanges(scanner, ccSourceRoot);
-
- scanner = buildContext.newDeleteScanner(ccSourceRoot.toFile());
- deletedControls = scanXspChanges(scanner, ccSourceRoot);
- }
-
- if(!changedXPages.isEmpty() || !changedControls.isEmpty() || !deletedXPages.isEmpty() || deletedControls.isEmpty()) {
- Path output = outputDirectory.toPath();
-
- Map toWrite = new HashMap<>();
- try(NonVerifyingPathClassLoader projectClassLoader = buildProjectClassLoader()) {
- // Shim TranspilerUtil into this classloader, as it's used in multiple places
- try(InputStream is = getClass().getResourceAsStream("/" + TranspilerUtil.class.getName().replace('.', '/') + ".class")) { //$NON-NLS-1$ //$NON-NLS-2$
- projectClassLoader.defineClass(TranspilerUtil.class.getName(), is);
- }
-
- // Handle deletions first, which may skip having to establish the full environment
- deleteChanges(projectClassLoader, deletedXPages, xspSourceRoot, output);
- deleteChanges(projectClassLoader, deletedControls, ccSourceRoot, output);
-
- // If needed, translate changes
- if(!changedXPages.isEmpty() || !changedControls.isEmpty()) {
- // Load our XspTranspiler class into the contained class loader
- Class> transpilerClass;
- try(InputStream is = getClass().getResourceAsStream("/" + XspTranspiler.class.getName().replace('.', '/') + ".class")) { //$NON-NLS-1$ //$NON-NLS-2$
- transpilerClass = projectClassLoader.defineClass(XspTranspiler.class.getName(), is);
- }
-
- ClassLoader tlcc = Thread.currentThread().getContextClassLoader();
- try {
- Thread.currentThread().setContextClassLoader(projectClassLoader);
-
- Object transpiler = transpilerClass.getConstructor(boolean.class).newInstance(log.isDebugEnabled());
-
- if(ccSourceRoot != null && Files.isDirectory(ccSourceRoot)) {
- TranspilerUtil.call(transpiler, "defineCustomControls", new Class>[] { Path.class }, ccSourceRoot); //$NON-NLS-1$
- }
-
- Method transpile = transpilerClass.getMethod("transpile", Path.class, Path.class); //$NON-NLS-1$
-
- for(Path xpage : changedXPages) {
- Map.Entry results = ((Map)transpile.invoke(transpiler, xspSourceRoot, xpage)).entrySet().iterator().next();
- Path dest = output.resolve(results.getKey());
- toWrite.put(dest, results.getValue());
- }
- for(Path control : changedControls) {
- Map.Entry results = ((Map)transpile.invoke(transpiler, ccSourceRoot, control)).entrySet().iterator().next();
- Path dest = output.resolve(results.getKey());
- toWrite.put(dest, results.getValue());
- }
- } finally {
- Thread.currentThread().setContextClassLoader(tlcc);
- }
-
- // Write out the files
- for(Map.Entry entry : toWrite.entrySet()) {
- Files.createDirectories(entry.getKey().getParent());
- try(OutputStream os = buildContext.newFileOutputStream(entry.getKey().toFile())) {
- try(Writer w = new OutputStreamWriter(os)) {
- w.write(entry.getValue());
- }
- }
- }
- }
- } catch (Exception e) {
- throw new MojoExecutionException(Messages.getString("TranspileXspMojo.exceptionTranspilingSource"), e); //$NON-NLS-1$
- }
- } else {
- if(log.isInfoEnabled()) {
- log.info(Messages.getString("TranspileXspMojo.noChangesDetected")); //$NON-NLS-1$
- }
- }
- }
-
- private NonVerifyingPathClassLoader buildProjectClassLoader() throws MojoExecutionException {
- // Build a class loader based on all project dependencies
- List dependencies;
- try {
- dependencies = project.getArtifacts().stream()
- .map(Artifact::getFile)
- .map(File::toPath)
- .peek(p -> {
- if(log.isDebugEnabled()) {
- log.debug(MessageFormat.format(Messages.getString("TranspileXspMojo.addingClasspathEntry"), p)); //$NON-NLS-1$
- }
- })
- .collect(Collectors.toCollection(LinkedList::new));
-
- } catch (Exception e) {
- throw new MojoExecutionException(Messages.getString("TranspileXspMojo.exceptionBuildingClasspath"), e); //$NON-NLS-1$
- }
-
- return new NonVerifyingPathClassLoader(dependencies, ClassLoader.getSystemClassLoader());
- }
-
- private List scanXspChanges(Scanner scanner, Path sourceRoot) {
- scanner.setIncludes(new String[] { "*.xsp" }); //$NON-NLS-1$
- scanner.scan();
- String[] changes = scanner.getIncludedFiles();
- if(changes != null) {
- return Arrays.stream(changes)
- .map(sourceRoot::resolve)
- .peek(p -> {
- if(log.isDebugEnabled()) {
- log.debug(MessageFormat.format(Messages.getString("TranspileXspMojo.foundChangedFile"), p)); //$NON-NLS-1$
- }
- })
- .collect(Collectors.toList());
- } else {
- return Collections.emptyList();
- }
- }
-
- private void deleteChanges(ClassLoader projectClassLoader, List deletedFiles, Path sourceRoot, Path output) {
- Class> innerUtil = TranspilerUtil.loadClass(projectClassLoader, TranspilerUtil.class.getName());
- deletedFiles.stream()
- .map(p -> TranspilerUtil.call(innerUtil, "xspPathToJavaPath", new Class>[] { Path.class }, sourceRoot.relativize(p))) //$NON-NLS-1$
- .map(Path.class::cast)
- .map(output::resolve)
- .filter(Files::isRegularFile)
- .peek(p -> {
- if(log.isDebugEnabled()) {
- log.debug(MessageFormat.format(Messages.getString("TranspileXspMojo.clearingDeletedTranslation"), p)); //$NON-NLS-1$
- }
- })
- .forEach(p -> {
- File file = p.toFile();
- file.delete();
- buildContext.refresh(file);
- });
- }
-}
diff --git a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/TranspilerUtil.java b/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/TranspilerUtil.java
deleted file mode 100644
index 9fed1f3..0000000
--- a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/TranspilerUtil.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/**
- * Copyright © 2020-2020 Jesse Gallagher
- *
- * Licensed 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.openntf.xsp.maven.transpiler;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.Collection;
-
-import org.w3c.dom.Document;
-
-import com.ibm.commons.util.io.StreamUtil;
-import com.ibm.commons.xml.DOMUtil;
-import com.ibm.commons.xml.XMLException;
-import com.ibm.xsp.page.compiled.PageToClassNameUtil;
-
-public enum TranspilerUtil {
- ;
-
- public static Class> loadClass(ClassLoader classLoader, String className) {
- try {
- return classLoader.loadClass(className);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static Object newInstance(ClassLoader classLoader, String className, Class>[] parameterTypes, Object... parameters) {
- try {
- Class> clazz = classLoader.loadClass(className);
- Constructor> ctor = clazz.getConstructor(parameterTypes);
- return ctor.newInstance(parameters);
- } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException | IllegalArgumentException | InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static T call(Object obj, String methodName) {
- return call(obj, methodName, new Class>[0]);
- }
-
- @SuppressWarnings("unchecked")
- public static T call(Object obj, String methodName, Class>[] parameterTypes, Object... parameters) {
- try {
- Method method = obj.getClass().getMethod(methodName, parameterTypes);
- return (T)method.invoke(obj, parameters);
- } catch(Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public static T call(Class> clazz, String staticMethodName) {
- return call(clazz, staticMethodName, new Class>[0]);
- }
-
- @SuppressWarnings("unchecked")
- public static T call(Class> clazz, String staticMethodName, Class>[] parameterTypes, Object... parameters) {
- try {
- Method method = clazz.getMethod(staticMethodName, parameterTypes);
- return (T)method.invoke(null, parameters);
- } catch(Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public static String readFile(Path path) {
- try(InputStream is = Files.newInputStream(path)) {
- return StreamUtil.readString(is);
- } catch(IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static Document readXml(Path file) {
- try(InputStream is = Files.newInputStream(file)) {
- return DOMUtil.createDocument(is);
- } catch(IOException | XMLException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static void deltree(Collection paths) throws IOException {
- for(Path path : paths) {
- deltree(path);
- }
- }
-
- public static void deltree(Path path) throws IOException {
- if(Files.isDirectory(path)) {
- Files.list(path)
- .forEach(t -> {
- try {
- deltree(t);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- });
- }
- try {
- Files.deleteIfExists(path);
- } catch(IOException e) {
- // This is likely a Windows file-locking thing. In this case,
- // punt and hand it off to File#deleteOnExit
- path.toFile().deleteOnExit();
- }
- }
-
- @SuppressWarnings("nls")
- public static Path xspPathToJavaPath(Path xspFile) {
- if(xspFile.isAbsolute()) {
- throw new IllegalArgumentException("xspFile must be relative");
- }
- String className = PageToClassNameUtil.getClassNameForPage(xspFile.toString());
- String outputFileName = className.replace('.', File.separatorChar) + ".java"; //$NON-NLS-1$
- return Paths.get(outputFileName);
- }
-}
diff --git a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/XspTranspiler.java b/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/XspTranspiler.java
deleted file mode 100644
index 9f84c30..0000000
--- a/xpages-webapp-support/xsp-maven-plugin/src/main/java/org/openntf/xsp/maven/transpiler/XspTranspiler.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/**
- * Copyright © 2020-2020 Jesse Gallagher
- *
- * Licensed 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.openntf.xsp.maven.transpiler;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Field;
-import java.nio.file.FileVisitOption;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.text.MessageFormat;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.stream.Stream;
-
-import org.openntf.xpages.runtime.xsp.LibraryWeightComparator;
-import org.w3c.dom.Document;
-
-import com.ibm.commons.Platform;
-import com.ibm.commons.extension.ExtensionManager;
-import com.ibm.commons.platform.GenericPlatform;
-import com.ibm.commons.util.StringUtil;
-import com.ibm.commons.util.io.StreamUtil;
-import com.ibm.commons.xml.DOMUtil;
-import com.ibm.commons.xml.XMLException;
-import com.ibm.xsp.extlib.interpreter.DynamicFacesClassLoader;
-import com.ibm.xsp.extlib.interpreter.DynamicXPageBean;
-import com.ibm.xsp.extlib.javacompiler.JavaSourceClassLoader;
-import com.ibm.xsp.library.ClasspathResourceBundleSource;
-import com.ibm.xsp.library.FacesClassLoader;
-import com.ibm.xsp.library.LibraryServiceLoader;
-import com.ibm.xsp.library.LibraryWrapper;
-import com.ibm.xsp.library.XspLibrary;
-import com.ibm.xsp.page.compiled.PageToClassNameUtil;
-import com.ibm.xsp.registry.CompositeComponentDefinitionImpl;
-import com.ibm.xsp.registry.FacesLibraryImpl;
-import com.ibm.xsp.registry.FacesProject;
-import com.ibm.xsp.registry.FacesProjectImpl;
-import com.ibm.xsp.registry.LibraryFragmentImpl;
-import com.ibm.xsp.registry.SharableRegistryImpl;
-import com.ibm.xsp.registry.UpdatableLibrary;
-import com.ibm.xsp.registry.config.IconUrlSource;
-import com.ibm.xsp.registry.config.ResourceBundleSource;
-import com.ibm.xsp.registry.config.SimpleRegistryProvider;
-import com.ibm.xsp.registry.parse.ConfigParser;
-import com.ibm.xsp.registry.parse.ConfigParserFactory;
-import com.ibm.xsp.registry.parse.ConfigParserImpl;
-
-public class XspTranspiler {
-
- private final boolean debug;
- protected final SharableRegistryImpl facesRegistry = new SharableRegistryImpl(getClass().getName());
- protected final FacesProject facesProject;
- protected final DynamicXPageBean dynamicXPageBean = new DynamicXPageBean();
- protected ResourceBundleSource resourceBundleSource;
- protected final IconUrlSource iconUrlSource = icon -> getClass().getResource(icon);
-
- public XspTranspiler(boolean debug) {
- this.debug = debug;
- this.facesProject = new FacesProjectImpl(getClass().getName(), facesRegistry);
-
- // Ensure that IBM Commons's platform detection doesn't try to load an implementation that depends on a Notes runtime
- System.setProperty(Platform.PLATFORM_PROPERTY_KEY, GenericPlatform.class.getName());
-
- resourceBundleSource = new ClasspathResourceBundleSource(Thread.currentThread().getContextClassLoader());
-
- initializeRegistry();
- }
-
- public void defineCustomControls(Path ccSourceRoot) throws IOException {
- if(ccSourceRoot != null) {
- if(debug) {
- System.out.println("Initializing Custom Control definitions"); //$NON-NLS-1$
- }
-
- // Generate a classpath, which the CC library needs to find classes for property types
- Set cleanup = new HashSet<>();
- try {
- ConfigParser configParser = getConfigParser();
-
- try(JavaSourceClassLoader cl = new JavaSourceClassLoader(Thread.currentThread().getContextClassLoader(), Collections.emptyList(), null)) {
- FacesClassLoader facesClassLoader = new DynamicFacesClassLoader(dynamicXPageBean, cl);
-
- try(Stream ccConfigs = Files.find(ccSourceRoot, Integer.MAX_VALUE, (path, attr) -> attr.isRegularFile() && path.toString().toLowerCase().endsWith(".xsp-config"), FileVisitOption.FOLLOW_LINKS)) { //$NON-NLS-1$
- ccConfigs.forEach(ccConfig -> {
- try {
- Document xspConfig = TranspilerUtil.readXml(ccConfig);
-
- String namespace = StringUtil.trim(DOMUtil.evaluateXPath(xspConfig, "/faces-config/faces-config-extension/namespace-uri/text()").getStringValue()); //$NON-NLS-1$
- Path fileName = ccSourceRoot.relativize(ccConfig);
- LibraryFragmentImpl fragment = (LibraryFragmentImpl)configParser.createFacesLibraryFragment(
- facesProject,
- facesClassLoader,
- fileName.toString(),
- xspConfig.getDocumentElement(),
- resourceBundleSource,
- iconUrlSource,
- namespace
- );
- UpdatableLibrary library = getLibrary(namespace);
- library.addLibraryFragment(fragment);
-
- // Load the definition to refresh its parent ref
- String controlName = StringUtil.trim(DOMUtil.evaluateXPath(xspConfig, "/faces-config/composite-component/composite-name/text()").getStringValue()); //$NON-NLS-1$
- CompositeComponentDefinitionImpl def = (CompositeComponentDefinitionImpl)library.getDefinition(controlName);
- def.refreshReferences();
- } catch (XMLException e) {
- throw new RuntimeException(e);
- }
- });
- }
- }
- } finally {
- TranspilerUtil.deltree(cleanup);
- }
- }
- }
-
- private ConfigParser getConfigParser() {
- ConfigParser parser = new ConfigParserImpl();
- // Stash this in ConfigParserFactory for reuse. Using the static getter falls down into invalid Eclipse land
- try {
- Field s_parserInstance = ConfigParserFactory.class.getDeclaredField("s_parserInstance"); //$NON-NLS-1$
- s_parserInstance.setAccessible(true);
- s_parserInstance.set(null, parser);
- } catch(Exception e) {
- throw new RuntimeException(e);
- }
-
- return parser;
- }
-
- private void initializeRegistry() {
- List