You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2015/07/06 15:05:42 UTC
[4/5] zest-qi4j git commit: Removed CXF Removed Struts Upgraded to
Spring 4.1.7
Removed CXF
Removed Struts
Upgraded to Spring 4.1.7
Project: http://git-wip-us.apache.org/repos/asf/zest-qi4j/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-qi4j/commit/122a51b6
Tree: http://git-wip-us.apache.org/repos/asf/zest-qi4j/tree/122a51b6
Diff: http://git-wip-us.apache.org/repos/asf/zest-qi4j/diff/122a51b6
Branch: refs/heads/develop
Commit: 122a51b69f0936775deb66a96ac879125364cae4
Parents: 0e0276b
Author: Niclas Hedhman <he...@betfair.com>
Authored: Mon Jul 6 16:04:42 2015 +0300
Committer: Niclas Hedhman <he...@betfair.com>
Committed: Mon Jul 6 16:04:42 2015 +0300
----------------------------------------------------------------------
LICENSE.txt | 31 -
build.gradle | 2 -
.../qi4j/bootstrap/layered/LayerAssembler.java | 1 +
.../layered/LayeredApplicationAssembler.java | 5 +
libraries.gradle | 8 +-
libraries/NOTICE | 5 -
.../Qi4jBootstrapBeanDefinitionParser.java | 2 +-
libraries/struts2-codebehind/build.gradle | 33 -
libraries/struts2-codebehind/dev-status.xml | 35 -
.../src/docs/struts-codebehind.txt | 32 -
.../Qi4jCodebehindPackageProvider.java | 741 -------------------
.../bootstrap/CodebehindAssembler.java | 36 -
.../library/struts2/codebehind/package.html | 21 -
.../src/main/resources/struts-plugin.xml | 32 -
libraries/struts2-convention/build.gradle | 33 -
libraries/struts2-convention/dev-status.xml | 35 -
.../src/docs/struts-convention.txt | 32 -
.../Qi4jPackageBasedActionConfigBuilder.java | 60 --
.../struts2/convention/Qi4jPackageProvider.java | 50 --
.../library/struts2/convention/package.html | 21 -
.../src/main/resources/struts-plugin.xml | 28 -
libraries/struts2-plugin/build.gradle | 35 -
libraries/struts2-plugin/dev-status.xml | 35 -
.../struts2-plugin/src/docs/struts-plugin.txt | 32 -
.../library/struts2/ActionConfiguration.java | 74 --
.../org/qi4j/library/struts2/ActionService.java | 26 -
.../org/qi4j/library/struts2/Constants.java | 22 -
.../struts2/ConstraintViolationInterceptor.java | 231 ------
.../struts2/EntityCompositeConverter.java | 72 --
.../Qi4jApplicationBootstrapListener.java | 118 ---
.../library/struts2/Qi4jFilterDispatcher.java | 120 ---
.../qi4j/library/struts2/Qi4jObjectFactory.java | 241 ------
.../library/struts2/Qi4jPropertyAccessor.java | 232 ------
.../library/struts2/UnitOfWorkInterceptor.java | 93 ---
.../bootstrap/Struts2PluginAssembler.java | 47 --
.../java/org/qi4j/library/struts2/package.html | 21 -
.../qi4j/library/struts2/support/HasInput.java | 26 -
.../struts2/support/ProvidesEntityOf.java | 28 -
.../struts2/support/ProvidesEntityOfMixin.java | 77 --
.../library/struts2/support/StrutsAction.java | 26 -
.../struts2/support/add/ProvidesAddingOf.java | 29 -
.../support/add/ProvidesAddingOfMixin.java | 88 ---
.../struts2/support/edit/ProvidesEditingOf.java | 31 -
.../support/edit/ProvidesEditingOfMixin.java | 63 --
.../struts2/support/list/ProvidesListOf.java | 28 -
.../support/list/ProvidesListOfMixin.java | 74 --
.../struts2/support/view/ProvidesViewOf.java | 27 -
.../support/view/ProvidesViewOfMixin.java | 45 --
.../library/struts2/util/ClassNameFilters.java | 55 --
.../library/struts2/util/ClassNameMapper.java | 27 -
.../qi4j/library/struts2/util/ClassNames.java | 86 ---
.../struts2/util/ParameterizedTypes.java | 57 --
.../src/main/resources/struts-plugin.xml | 35 -
.../main/resources/xwork-conversion.properties | 16 -
.../struts2/util/ParameterizedTypesTest.java | 59 --
manual/src/docs/userguide/libraries.txt | 12 -
manual/src/docs/website/samples.txt | 7 -
samples/struts2Hello/build.gradle | 37 -
.../org/qi4j/library/struts2/example/Item.java | 26 -
.../library/struts2/example/JettyLauncher.java | 50 --
.../qi4j/library/struts2/example/Nameable.java | 27 -
.../struts2/example/actions/AddItem.java | 39 -
.../struts2/example/actions/EditItem.java | 41 -
.../example/actions/HelloWorldAction.java | 72 --
.../struts2/example/actions/IndexAction.java | 65 --
.../struts2/example/actions/ListItems.java | 36 -
.../example/converters/DateConverter.java | 59 --
.../listener/ExampleBootstrapListener.java | 79 --
.../src/main/resources/log4j.properties | 30 -
.../src/main/resources/struts.properties | 34 -
.../struts2Hello/src/main/resources/struts.xml | 56 --
.../src/main/webapp/WEB-INF/decorators.xml | 33 -
.../src/main/webapp/WEB-INF/decorators/main.jsp | 91 ---
.../src/main/webapp/WEB-INF/dwr.xml | 35 -
.../src/main/webapp/WEB-INF/sitemesh.xml | 65 --
.../src/main/webapp/WEB-INF/web.xml | 85 ---
samples/struts2Hello/src/main/webapp/index.jsp | 17 -
.../src/main/webapp/jsp/addItem.jsp | 31 -
.../src/main/webapp/jsp/editItem.jsp | 31 -
.../src/main/webapp/jsp/helloWorld.jsp | 31 -
.../struts2Hello/src/main/webapp/jsp/index.jsp | 33 -
.../src/main/webapp/jsp/listItems.jsp | 36 -
.../src/main/webapp/styles/forms.css | 161 ----
.../src/main/webapp/styles/layout-1col.css | 65 --
.../main/webapp/styles/layout-navleft-1col.css | 69 --
.../main/webapp/styles/layout-navleft-2col.css | 77 --
.../main/webapp/styles/layout-navtop-1col.css | 70 --
.../main/webapp/styles/layout-navtop-3col.css | 81 --
.../webapp/styles/layout-navtop-localleft.css | 74 --
.../webapp/styles/layout-navtop-subright.css | 74 --
.../src/main/webapp/styles/layout.css | 178 -----
.../src/main/webapp/styles/main.css | 33 -
.../src/main/webapp/styles/nav-horizontal.css | 123 ---
.../src/main/webapp/styles/nav-vertical.css | 127 ----
.../src/main/webapp/styles/tools.css | 112 ---
.../src/main/webapp/styles/typo.css | 264 -------
samples/swing/build.gradle | 2 +-
settings.gradle | 4 -
tools/qidea/TODO | 1 -
99 files changed, 9 insertions(+), 6183 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/LICENSE.txt
----------------------------------------------------------------------
diff --git a/LICENSE.txt b/LICENSE.txt
index d800464..09fd2eb 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -228,37 +228,6 @@ THE SOFTWARE.
The Apache Zest Qi4j project bundles the following files under the BSD
3-Clauses License:
-- A CSS Framework by Mike Stenhouse (http://www.donotremove.co.uk/)
- Bundled in the Struts 2 sample.
- Copyright (c) 2005, Mike Stenhouse of Content with Style.
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-3. Neither the name of the copyright holder nor the names of its contributors
- may be used to endorse or promote products derived from this software without
- specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-----------------------------------------------------------------------
The W3C Software License
-----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 2658c9c..7ff01a1 100644
--- a/build.gradle
+++ b/build.gradle
@@ -89,8 +89,6 @@ rat {
'manual/**/sh*.css', 'manual/**/sh*.js',
// jQuery & plugins - MIT
'manual/**/jquery*.js',
- // A CSS Framework by Mike Stenhouse - BSD 3-Clauses
- 'samples/struts2Hello/**/styles/*.css',
// W3C XML Schemas - W3C Software License
'samples/rental/src/main/resources/*.xsd',
]
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/core/bootstrap/src/main/java/org/qi4j/bootstrap/layered/LayerAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/qi4j/bootstrap/layered/LayerAssembler.java b/core/bootstrap/src/main/java/org/qi4j/bootstrap/layered/LayerAssembler.java
index 394eac3..c8a7b88 100644
--- a/core/bootstrap/src/main/java/org/qi4j/bootstrap/layered/LayerAssembler.java
+++ b/core/bootstrap/src/main/java/org/qi4j/bootstrap/layered/LayerAssembler.java
@@ -18,6 +18,7 @@
*/
package org.qi4j.bootstrap.layered;
+import org.qi4j.bootstrap.ApplicationAssembly;
import org.qi4j.bootstrap.AssemblyException;
import org.qi4j.bootstrap.LayerAssembly;
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/core/bootstrap/src/main/java/org/qi4j/bootstrap/layered/LayeredApplicationAssembler.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/qi4j/bootstrap/layered/LayeredApplicationAssembler.java b/core/bootstrap/src/main/java/org/qi4j/bootstrap/layered/LayeredApplicationAssembler.java
index 4682464..4c4cad7 100644
--- a/core/bootstrap/src/main/java/org/qi4j/bootstrap/layered/LayeredApplicationAssembler.java
+++ b/core/bootstrap/src/main/java/org/qi4j/bootstrap/layered/LayeredApplicationAssembler.java
@@ -56,6 +56,11 @@ public abstract class LayeredApplicationAssembler
instantiateApplication( qi4j, model );
}
+ public ApplicationAssembly assembly()
+ {
+ return assembly;
+ }
+
/**
* This method is called from the constructor to instantiate the Qi4j application from the application model.
*
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries.gradle
----------------------------------------------------------------------
diff --git a/libraries.gradle b/libraries.gradle
index 7a779f5..a673af5 100644
--- a/libraries.gradle
+++ b/libraries.gradle
@@ -70,10 +70,9 @@ def skedVersion = '2.1'
def sleepycatVersion = '5.0.73'
def slf4jVersion = '1.7.7'
def solrVersion = "1.4.1" // 4.8.1 Fails to compile!
-def springVersion = '3.2.6.RELEASE' // 4.0.5.RELEASE Fails to compile!
+def springVersion = '4.1.7.RELEASE' // 4.0.5.RELEASE Fails to compile!
def spymemcachedVersion = '2.11.3'
def sqliteVersion = '3.7.2'
-def strutsVersion = '2.3.15.3' // 2.3.16.3 Fails to compile!
def velocityVersion = '1.7'
def voldemortVersion = '1.3.0'
def wicketVersion = '1.5.8' // 6.15.0 Samples fails to compile!
@@ -185,11 +184,6 @@ rootProject.ext {
jetty_client: "org.eclipse.jetty:jetty-client:$jettyVersion",
jetty_xml: "org.eclipse.jetty:jetty-xml:$jettyVersion",
- // Struts
- struts_codebehind: "org.apache.struts:struts2-codebehind-plugin:$strutsVersion",
- struts_convention: "org.apache.struts:struts2-convention-plugin:$strutsVersion",
- struts_core: "org.apache.struts:struts2-core:$strutsVersion",
-
// Scripting
groovy: "org.codehaus.groovy:groovy-all:$groovyVersion",
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/NOTICE
----------------------------------------------------------------------
diff --git a/libraries/NOTICE b/libraries/NOTICE
index 85ed1e0..cafd1d4 100644
--- a/libraries/NOTICE
+++ b/libraries/NOTICE
@@ -108,9 +108,4 @@ This module uses Spring Framework, software developed at
http://www.springsource.org, under Apache License 2.0. See LICENSE.
-libraries/struts-* NOTICE
-This module uses Apache Struts, developed at Apache Software Foundation
-(http://struts.apache.org), under Apache License 2.0. See LICENSE.
-
-
END OF NOTICE
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/spring/src/main/java/org/qi4j/library/spring/bootstrap/internal/application/Qi4jBootstrapBeanDefinitionParser.java
----------------------------------------------------------------------
diff --git a/libraries/spring/src/main/java/org/qi4j/library/spring/bootstrap/internal/application/Qi4jBootstrapBeanDefinitionParser.java b/libraries/spring/src/main/java/org/qi4j/library/spring/bootstrap/internal/application/Qi4jBootstrapBeanDefinitionParser.java
index aa68dc1..14b1389 100644
--- a/libraries/spring/src/main/java/org/qi4j/library/spring/bootstrap/internal/application/Qi4jBootstrapBeanDefinitionParser.java
+++ b/libraries/spring/src/main/java/org/qi4j/library/spring/bootstrap/internal/application/Qi4jBootstrapBeanDefinitionParser.java
@@ -57,7 +57,7 @@ public final class Qi4jBootstrapBeanDefinitionParser
Class<?> bootstrapClass;
try
{
- bootstrapClass = forName( bootstrapClassString );
+ bootstrapClass = forName( bootstrapClassString, getClass().getClassLoader() );
} catch ( ClassNotFoundException e )
{
readerContext.error( "Qi4j bootstrap class [" + bootstrapClassString + "] is not found.", anElement );
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-codebehind/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/struts2-codebehind/build.gradle b/libraries/struts2-codebehind/build.gradle
deleted file mode 100644
index 014c551..0000000
--- a/libraries/struts2-codebehind/build.gradle
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-
-description = "Qi4j Struts Library allows integration of Qi4j into Struts2 applications."
-
-jar { manifest { name = "Qi4j Library - Struts2 - Code Behind"}}
-
-dependencies {
- compile(project(":org.qi4j.core:org.qi4j.core.bootstrap"))
- compile( project( ':org.qi4j.libraries:org.qi4j.library.struts2-plugin' ) )
- compile(libraries.struts_codebehind)
-
- testCompile(project(":org.qi4j.core:org.qi4j.core.testsupport"))
-
- testRuntime(project(":org.qi4j.core:org.qi4j.core.runtime"))
- testRuntime(libraries.logback)
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-codebehind/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/struts2-codebehind/dev-status.xml b/libraries/struts2-codebehind/dev-status.xml
deleted file mode 100644
index 1a18f48..0000000
--- a/libraries/struts2-codebehind/dev-status.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- 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.
--->
-<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.qi4j.org/schemas/2008/dev-status/1
- http://www.qi4j.org/schemas/2008/dev-status/1/dev-status.xsd">
- <status>
- <!--none,early,beta,stable,mature-->
- <codebase>beta</codebase>
-
- <!-- none, brief, good, complete -->
- <documentation>none</documentation>
-
- <!-- none, some, good, complete -->
- <unittests>some</unittests>
- </status>
- <licenses>
- <license>ALv2</license>
- </licenses>
-</module>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-codebehind/src/docs/struts-codebehind.txt
----------------------------------------------------------------------
diff --git a/libraries/struts2-codebehind/src/docs/struts-codebehind.txt b/libraries/struts2-codebehind/src/docs/struts-codebehind.txt
deleted file mode 100644
index 46c3560..0000000
--- a/libraries/struts2-codebehind/src/docs/struts-codebehind.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-///////////////////////////////////////////////////////////////
- * 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.
-///////////////////////////////////////////////////////////////
-
-[[library-struts-codebehind, Struts Code Behind Library]]
-= Struts - Code Behind =
-
-[devstatus]
---------------
-source=libraries/struts2-codebehind/dev-status.xml
---------------
-
-Struts Code Behing Library
-
-NOTE: This Library has no documentation yet. Learn how to contribute in <<community-docs>>.
-
-include::../../build/docs/buildinfo/artifact.txt[]
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-codebehind/src/main/java/org/qi4j/library/struts2/codebehind/Qi4jCodebehindPackageProvider.java
----------------------------------------------------------------------
diff --git a/libraries/struts2-codebehind/src/main/java/org/qi4j/library/struts2/codebehind/Qi4jCodebehindPackageProvider.java b/libraries/struts2-codebehind/src/main/java/org/qi4j/library/struts2/codebehind/Qi4jCodebehindPackageProvider.java
deleted file mode 100644
index 72e77db..0000000
--- a/libraries/struts2-codebehind/src/main/java/org/qi4j/library/struts2/codebehind/Qi4jCodebehindPackageProvider.java
+++ /dev/null
@@ -1,741 +0,0 @@
-/*
- * 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.qi4j.library.struts2.codebehind;
-
-import com.opensymphony.xwork2.config.Configuration;
-import com.opensymphony.xwork2.config.ConfigurationException;
-import com.opensymphony.xwork2.config.PackageProvider;
-import com.opensymphony.xwork2.config.entities.ActionConfig;
-import com.opensymphony.xwork2.config.entities.PackageConfig;
-import com.opensymphony.xwork2.config.entities.ResultConfig;
-import com.opensymphony.xwork2.config.entities.ResultTypeConfig;
-import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.ClassLoaderUtil;
-import com.opensymphony.xwork2.util.logging.Logger;
-import com.opensymphony.xwork2.util.logging.LoggerFactory;
-import java.lang.annotation.Annotation;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.*;
-import javax.servlet.ServletContext;
-import org.apache.struts2.config.*;
-import org.qi4j.library.struts2.ActionConfiguration;
-
-/**
- * This is inspired by the ClasspathPackageProvider from the struts2-codebehind-plugin. Most of the code
- * is directly copied from the 2.1.1 version of the plugin but modified to only look for the @Action annotation
- * and to accept interfaces as well as classes.
- */
-public class Qi4jCodebehindPackageProvider
- implements PackageProvider
-{
-
- private ActionConfiguration actionConfiguration;
-
- /**
- * The default page prefix (or "path").
- * Some applications may place pages under "/WEB-INF" as an extreme security precaution.
- */
- protected static final String DEFAULT_PAGE_PREFIX = "struts.configuration.classpath.defaultPagePrefix";
-
- /**
- * The default page prefix (none).
- */
- private String defaultPagePrefix = "";
-
- /**
- * The default page extension, to use in place of ".jsp".
- */
- protected static final String DEFAULT_PAGE_EXTENSION = "struts.configuration.classpath.defaultPageExtension";
-
- /**
- * The defacto default page extension, usually associated with JavaServer Pages.
- */
- private String defaultPageExtension = ".jsp";
-
- /**
- * A setting to indicate a custom default parent package,
- * to use in place of "struts-default".
- */
- protected static final String DEFAULT_PARENT_PACKAGE = "struts.configuration.classpath.defaultParentPackage";
-
- /**
- * Name of the framework's default configuration package,
- * that application configuration packages automatically inherit.
- */
- private String defaultParentPackage = "struts-default";
-
- /**
- * The default page prefix (or "path").
- * Some applications may place pages under "/WEB-INF" as an extreme security precaution.
- */
- protected static final String FORCE_LOWER_CASE = "struts.configuration.classpath.forceLowerCase";
-
- /**
- * Whether to use a lowercase letter as the initial letter of an action.
- * If false, actions will retain the initial uppercase letter from the Action class.
- * (<code>view.action</code> (true) versus <code>View.action</code> (false)).
- */
- private boolean forceLowerCase = true;
-
- /**
- * Default suffix that can be used to indicate POJO "Action" classes.
- */
- private static final String ACTION = "Action";
-
- /**
- * Helper class to scan class path for server pages.
- */
- private PageLocator pageLocator = new ClasspathPageLocator();
-
- /**
- * Flag to indicate the packages have been loaded.
- *
- * @see #loadPackages
- * @see #needsReload
- */
- private boolean initialized = false;
-
- private PackageLoader packageLoader;
-
- /**
- * Logging instance for this class.
- */
- private static final Logger LOG = LoggerFactory.getLogger( Qi4jCodebehindPackageProvider.class );
-
- /**
- * The XWork Configuration for this application.
- *
- * @see #init
- */
- private Configuration configuration;
-
- private String actionPackages;
-
- private ServletContext servletContext;
-
- /**
- * PageLocator defines a locate method that can be used to discover server pages.
- */
- public static interface PageLocator
- {
- public URL locate( String path );
- }
-
- /**
- * ClasspathPathLocator searches the classpath for server pages.
- */
- public static class ClasspathPageLocator
- implements PageLocator
- {
- @Override
- public URL locate( String path )
- {
- return ClassLoaderUtil.getResource( path, getClass() );
- }
- }
-
- @Inject( "actionPackages" )
- public void setActionPackages( String packages )
- {
- this.actionPackages = packages;
- }
-
- @Inject
- public void setServletContext( ServletContext ctx )
- {
- this.servletContext = ctx;
- }
-
- @Inject
- public void setActionConfiguration( ActionConfiguration actionConfiguration )
- {
- this.actionConfiguration = actionConfiguration;
- }
-
- /**
- * Register a default parent package for the actions.
- *
- * @param defaultParentPackage the new defaultParentPackage
- */
- @Inject( value = DEFAULT_PARENT_PACKAGE, required = false )
- public void setDefaultParentPackage( String defaultParentPackage )
- {
- this.defaultParentPackage = defaultParentPackage;
- }
-
- /**
- * Register a default page extension to use when locating pages.
- *
- * @param defaultPageExtension the new defaultPageExtension
- */
- @Inject( value = DEFAULT_PAGE_EXTENSION, required = false )
- public void setDefaultPageExtension( String defaultPageExtension )
- {
- this.defaultPageExtension = defaultPageExtension;
- }
-
- /**
- * Reigster a default page prefix to use when locating pages.
- *
- * @param defaultPagePrefix the defaultPagePrefix to set
- */
- @Inject( value = DEFAULT_PAGE_PREFIX, required = false )
- public void setDefaultPagePrefix( String defaultPagePrefix )
- {
- this.defaultPagePrefix = defaultPagePrefix;
- }
-
- /**
- * Whether to use a lowercase letter as the initial letter of an action.
- *
- * @param force If false, actions will retain the initial uppercase letter from the Action class.
- * (<code>view.action</code> (true) versus <code>View.action</code> (false)).
- */
- @Inject( value = FORCE_LOWER_CASE, required = false )
- public void setForceLowerCase( String force )
- {
- this.forceLowerCase = "true".equals( force );
- }
-
- /**
- * Register a PageLocation to use to scan for server pages.
- *
- * @param locator
- */
- public void setPageLocator( PageLocator locator )
- {
- this.pageLocator = locator;
- }
-
- @Override
- public void init( Configuration configuration )
- throws ConfigurationException
- {
- this.configuration = configuration;
- }
-
- @Override
- public boolean needsReload()
- {
- return !initialized;
- }
-
- /**
- * Clears and loads the list of packages registered at construction.
- *
- * @throws ConfigurationException
- */
- @Override
- public void loadPackages()
- throws ConfigurationException
- {
- packageLoader = new PackageLoader();
- String[] names = actionPackages.split( "\\s*[,]\\s*" );
- // Initialize the classloader scanner with the configured packages
- if( names.length > 0 )
- {
- setPageLocator( new ServletContextPageLocator( servletContext ) );
- }
- loadPackages( names );
- initialized = true;
- }
-
- protected void loadPackages( String[] pkgs )
- throws ConfigurationException
- {
- for( Class cls : actionConfiguration.getClasses() )
- {
- processActionClass( cls, pkgs );
- }
-
- for( PackageConfig config : packageLoader.createPackageConfigs() )
- {
- configuration.addPackageConfig( config.getName(), config );
- }
- }
-
- /**
- * Create a default action mapping for a class instance.
- *
- * The namespace annotation is honored, if found, otherwise
- * the Java package is converted into the namespace
- * by changing the dots (".") to slashes ("/").
- *
- * @param cls Action or POJO instance to process
- * @param pkgs List of packages that were scanned for Actions
- */
- protected void processActionClass( Class<?> cls, String[] pkgs )
- {
- String name = cls.getName();
- String actionPackage = cls.getPackage().getName();
- String actionNamespace = null;
- String actionName = null;
-
- org.apache.struts2.config.Action actionAnn =
- (org.apache.struts2.config.Action) cls.getAnnotation( org.apache.struts2.config.Action.class );
- if( actionAnn != null )
- {
- actionName = actionAnn.name();
- if( actionAnn.namespace().equals( org.apache.struts2.config.Action.DEFAULT_NAMESPACE ) )
- {
- actionNamespace = "";
- }
- else
- {
- actionNamespace = actionAnn.namespace();
- }
- }
- else
- {
- for( String pkg : pkgs )
- {
- if( name.startsWith( pkg ) )
- {
- if( LOG.isDebugEnabled() )
- {
- LOG.debug( "ClasspathPackageProvider: Processing class " + name );
- }
- name = name.substring( pkg.length() + 1 );
-
- actionNamespace = "";
- actionName = name;
- int pos = name.lastIndexOf( '.' );
- if( pos > -1 )
- {
- actionNamespace = "/" + name.substring( 0, pos ).replace( '.', '/' );
- actionName = name.substring( pos + 1 );
- }
- break;
- }
- }
- // Truncate Action suffix if found
- if( actionName.endsWith( getClassSuffix() ) )
- {
- actionName = actionName.substring( 0, actionName.length() - getClassSuffix().length() );
- }
-
- // Force initial letter of action to lowercase, if desired
- if( ( forceLowerCase ) && ( actionName.length() > 1 ) )
- {
- int lowerPos = actionName.lastIndexOf( '/' ) + 1;
- StringBuilder sb = new StringBuilder();
- sb.append( actionName.substring( 0, lowerPos ) );
- sb.append( Character.toLowerCase( actionName.charAt( lowerPos ) ) );
- sb.append( actionName.substring( lowerPos + 1 ) );
- actionName = sb.toString();
- }
- }
-
- PackageConfig.Builder pkgConfig = loadPackageConfig( actionNamespace, actionPackage, cls );
-
- // In case the package changed due to namespace annotation processing
- if( !actionPackage.equals( pkgConfig.getName() ) )
- {
- actionPackage = pkgConfig.getName();
- }
-
- Annotation annotation = cls.getAnnotation( ParentPackage.class );
- if( annotation != null )
- {
- String parent = ( (ParentPackage) annotation ).value()[0];
- PackageConfig parentPkg = configuration.getPackageConfig( parent );
- if( parentPkg == null )
- {
- throw new ConfigurationException( "ClasspathPackageProvider: Unable to locate parent package " + parent, annotation );
- }
- pkgConfig.addParent( parentPkg );
-
- if( !isNotEmpty( pkgConfig.getNamespace() ) && isNotEmpty( parentPkg.getNamespace() ) )
- {
- pkgConfig.namespace( parentPkg.getNamespace() );
- }
- }
-
- ResultTypeConfig defaultResultType = packageLoader.getDefaultResultType( pkgConfig );
- ActionConfig actionConfig = new ActionConfig.Builder( actionPackage, actionName, cls.getName() )
- .addResultConfigs( new ResultMap<String, ResultConfig>( cls, actionName, defaultResultType ) )
- .build();
- pkgConfig.addActionConfig( actionName, actionConfig );
- }
-
- protected String getClassSuffix()
- {
- return ACTION;
- }
-
- /**
- * Finds or creates the package configuration for an Action class.
- *
- * The namespace annotation is honored, if found,
- * and the namespace is checked for a parent configuration.
- *
- * @param actionNamespace The configuration namespace
- * @param actionPackage The Java package containing our Action classes
- * @param actionClass The Action class instance
- *
- * @return PackageConfig object for the Action class
- */
- protected PackageConfig.Builder loadPackageConfig( String actionNamespace, String actionPackage, Class actionClass )
- {
- PackageConfig.Builder parent = null;
-
- // Check for the @Namespace annotation
- if( actionClass != null )
- {
- Namespace ns = (Namespace) actionClass.getAnnotation( Namespace.class );
- if( ns != null )
- {
- parent = loadPackageConfig( actionNamespace, actionPackage, null );
- actionNamespace = ns.value();
- actionPackage = actionClass.getName();
-
- // See if the namespace has been overridden by the @Action annotation
- }
- else
- {
- org.apache.struts2.config.Action actionAnn =
- (org.apache.struts2.config.Action) actionClass.getAnnotation( org.apache.struts2.config.Action.class );
- if( actionAnn != null && !actionAnn.DEFAULT_NAMESPACE.equals( actionAnn.namespace() ) )
- {
- // we pass null as the namespace in case the parent package hasn't been loaded yet
- parent = loadPackageConfig( null, actionPackage, null );
- actionPackage = actionClass.getName();
- }
- }
- }
-
- PackageConfig.Builder pkgConfig = packageLoader.getPackage( actionPackage );
- if( pkgConfig == null )
- {
- pkgConfig = new PackageConfig.Builder( actionPackage );
-
- pkgConfig.namespace( actionNamespace );
- if( parent == null )
- {
- PackageConfig cfg = configuration.getPackageConfig( defaultParentPackage );
- if( cfg != null )
- {
- pkgConfig.addParent( cfg );
- }
- else
- {
- throw new ConfigurationException( "ClasspathPackageProvider: Unable to locate default parent package: " +
- defaultParentPackage );
- }
- }
- packageLoader.registerPackage( pkgConfig );
-
- // if the parent package was first created by a child, ensure the namespace is correct
- }
- else if( pkgConfig.getNamespace() == null )
- {
- pkgConfig.namespace( actionNamespace );
- }
-
- if( parent != null )
- {
- packageLoader.registerChildToParent( pkgConfig, parent );
- }
-
- if( LOG.isDebugEnabled() )
- {
- LOG.debug( "class:" + actionClass + " parent:" + parent + " current:" + ( pkgConfig != null ? pkgConfig.getName() : "" ) );
- }
- return pkgConfig;
- }
-
- /**
- * Creates ResultConfig objects from result annotations,
- * and if a result isn't found, creates it on the fly.
- */
- class ResultMap<K, V>
- extends HashMap<K, V>
- {
- private Class actionClass;
- private String actionName;
- private ResultTypeConfig defaultResultType;
-
- public ResultMap( Class actionClass, String actionName, ResultTypeConfig defaultResultType )
- {
- this.actionClass = actionClass;
- this.actionName = actionName;
- this.defaultResultType = defaultResultType;
-
- // check if any annotations are around
- buildFromAnnotations( actionClass );
- }
-
- /**
- * Recursively finds annotations from all parent classes and interfaces.
- *
- * @param actionClass
- */
- private void buildFromAnnotations( Class actionClass )
- {
- if( actionClass == null || actionClass.getName().equals( Object.class.getName() ) )
- {
- return;
- }
-
- //noinspection unchecked
- Results results = (Results) actionClass.getAnnotation( Results.class );
- if( results != null )
- {
- // first check here...
- for( int i = 0; i < results.value().length; i++ )
- {
- Result result = results.value()[ i ];
- ResultConfig config = createResultConfig( result );
- if( !containsKey( (K) config.getName() ) )
- {
- put( (K) config.getName(), (V) config );
- }
- }
- }
-
- // what about a single Result annotation?
- Result result = (Result) actionClass.getAnnotation( Result.class );
- if( result != null )
- {
- ResultConfig config = createResultConfig( result );
- if( !containsKey( (K) config.getName() ) )
- {
- put( (K) config.getName(), (V) config );
- }
- }
-
- buildFromAnnotations( actionClass.getSuperclass() );
- for( Class implementedInterface : actionClass.getInterfaces() )
- {
- buildFromAnnotations( implementedInterface );
- }
- }
-
- /**
- * Extracts result name and value and calls {@link #createResultConfig}.
- *
- * @param result Result annotation reference representing result type to create
- *
- * @return New or cached ResultConfig object for result
- */
- protected ResultConfig createResultConfig( Result result )
- {
- Class<? extends Object> cls = result.type();
- if( cls == NullResult.class )
- {
- cls = null;
- }
- return createResultConfig( result.name(), cls, result.value(), createParameterMap( result.params() ) );
- }
-
- protected Map<String, String> createParameterMap( String[] parms )
- {
- Map<String, String> map = new HashMap<String, String>();
- int subtract = parms.length % 2;
- if( subtract != 0 )
- {
- LOG.warn( "Odd number of result parameters key/values specified. The final one will be ignored." );
- }
- for( int i = 0; i < parms.length - subtract; i++ )
- {
- String key = parms[ i++ ];
- String value = parms[ i ];
- map.put( key, value );
- if( LOG.isDebugEnabled() )
- {
- LOG.debug( "Adding parmeter[" + key + ":" + value + "] to result." );
- }
- }
- return map;
- }
-
- /**
- * Creates a default ResultConfig,
- * using either the resultClass or the default ResultType for configuration package
- * associated this ResultMap class.
- *
- * @param key The result type name
- * @param resultClass The class for the result type
- * @param location Path to the resource represented by this type
- *
- * @return A ResultConfig for key mapped to location
- */
- private ResultConfig createResultConfig( Object key, Class<? extends Object> resultClass,
- String location,
- Map<? extends Object, ? extends Object> configParams
- )
- {
- if( resultClass == null )
- {
- configParams = defaultResultType.getParams();
- String className = defaultResultType.getClassName();
- try
- {
- resultClass = ClassLoaderUtil.loadClass( className, getClass() );
- }
- catch( ClassNotFoundException ex )
- {
- throw new ConfigurationException( "ClasspathPackageProvider: Unable to locate result class " + className, actionClass );
- }
- }
-
- String defaultParam;
- try
- {
- defaultParam = (String) resultClass.getField( "DEFAULT_PARAM" ).get( null );
- }
- catch( Exception e )
- {
- // not sure why this happened, but let's just use a sensible choice
- defaultParam = "location";
- }
-
- HashMap params = new HashMap();
- if( configParams != null )
- {
- params.putAll( configParams );
- }
-
- params.put( defaultParam, location );
- return new ResultConfig.Builder( (String) key, resultClass.getName() ).addParams( params ).build();
- }
- }
-
- /**
- * Search classpath for a page.
- */
- private final class ServletContextPageLocator
- implements PageLocator
- {
- private final ServletContext context;
- private ClasspathPageLocator classpathPageLocator = new ClasspathPageLocator();
-
- private ServletContextPageLocator( ServletContext context )
- {
- this.context = context;
- }
-
- @Override
- public URL locate( String path )
- {
- URL url = null;
- try
- {
- url = context.getResource( path );
- if( url == null )
- {
- url = classpathPageLocator.locate( path );
- }
- }
- catch( MalformedURLException e )
- {
- if( LOG.isDebugEnabled() )
- {
- LOG.debug( "Unable to resolve path " + path + " against the servlet context" );
- }
- }
- return url;
- }
- }
-
- private static class PackageLoader
- {
-
- /**
- * The package configurations for scanned Actions.
- */
- private Map<String, PackageConfig.Builder> packageConfigBuilders = new HashMap<String, PackageConfig.Builder>();
-
- private Map<PackageConfig.Builder, PackageConfig.Builder> childToParent = new HashMap<PackageConfig.Builder, PackageConfig.Builder>();
-
- public PackageConfig.Builder getPackage( String name )
- {
- return packageConfigBuilders.get( name );
- }
-
- public void registerChildToParent( PackageConfig.Builder child, PackageConfig.Builder parent )
- {
- childToParent.put( child, parent );
- }
-
- public void registerPackage( PackageConfig.Builder builder )
- {
- packageConfigBuilders.put( builder.getName(), builder );
- }
-
- public Collection<PackageConfig> createPackageConfigs()
- {
- Map<String, PackageConfig> configs = new HashMap<String, PackageConfig>();
-
- Set<PackageConfig.Builder> builders;
- while( ( builders = findPackagesWithNoParents() ).size() > 0 )
- {
- for( PackageConfig.Builder parent : builders )
- {
- PackageConfig config = parent.build();
- configs.put( config.getName(), config );
- packageConfigBuilders.remove( config.getName() );
-
- for( Iterator<Map.Entry<PackageConfig.Builder, PackageConfig.Builder>> i = childToParent.entrySet()
- .iterator(); i.hasNext(); )
- {
- Map.Entry<PackageConfig.Builder, PackageConfig.Builder> entry = i.next();
- if( entry.getValue() == parent )
- {
- entry.getKey().addParent( config );
- i.remove();
- }
- }
- }
- }
- return configs.values();
- }
-
- Set<PackageConfig.Builder> findPackagesWithNoParents()
- {
- Set<PackageConfig.Builder> builders = new HashSet<PackageConfig.Builder>();
- for( PackageConfig.Builder child : packageConfigBuilders.values() )
- {
- if( !childToParent.containsKey( child ) )
- {
- builders.add( child );
- }
- }
- return builders;
- }
-
- public ResultTypeConfig getDefaultResultType( PackageConfig.Builder pkgConfig )
- {
- PackageConfig.Builder parent;
- PackageConfig.Builder current = pkgConfig;
-
- while( ( parent = childToParent.get( current ) ) != null )
- {
- current = parent;
- }
- return current.getResultType( current.getFullDefaultResultType() );
- }
- }
-
- public static boolean isNotEmpty( String text )
- {
- return ( text != null ) && !"".equals( text );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-codebehind/src/main/java/org/qi4j/library/struts2/codebehind/bootstrap/CodebehindAssembler.java
----------------------------------------------------------------------
diff --git a/libraries/struts2-codebehind/src/main/java/org/qi4j/library/struts2/codebehind/bootstrap/CodebehindAssembler.java b/libraries/struts2-codebehind/src/main/java/org/qi4j/library/struts2/codebehind/bootstrap/CodebehindAssembler.java
deleted file mode 100644
index ce9b239..0000000
--- a/libraries/struts2-codebehind/src/main/java/org/qi4j/library/struts2/codebehind/bootstrap/CodebehindAssembler.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.qi4j.library.struts2.codebehind.bootstrap;
-
-import org.qi4j.bootstrap.Assembler;
-import org.qi4j.bootstrap.AssemblyException;
-import org.qi4j.bootstrap.ModuleAssembly;
-import org.qi4j.library.struts2.codebehind.Qi4jCodebehindPackageProvider;
-
-public class CodebehindAssembler
- implements Assembler
-{
-
- @Override
- public void assemble( ModuleAssembly aModule )
- throws AssemblyException
- {
- aModule.objects( Qi4jCodebehindPackageProvider.class );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-codebehind/src/main/java/org/qi4j/library/struts2/codebehind/package.html
----------------------------------------------------------------------
diff --git a/libraries/struts2-codebehind/src/main/java/org/qi4j/library/struts2/codebehind/package.html b/libraries/struts2-codebehind/src/main/java/org/qi4j/library/struts2/codebehind/package.html
deleted file mode 100644
index c313668..0000000
--- a/libraries/struts2-codebehind/src/main/java/org/qi4j/library/struts2/codebehind/package.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!--
-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.
--->
-<html>
- <body>
- <h2>Struts 2 CodeBehind Integration.</h2>
- </body>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-codebehind/src/main/resources/struts-plugin.xml
----------------------------------------------------------------------
diff --git a/libraries/struts2-codebehind/src/main/resources/struts-plugin.xml b/libraries/struts2-codebehind/src/main/resources/struts-plugin.xml
deleted file mode 100644
index ccf2c42..0000000
--- a/libraries/struts2-codebehind/src/main/resources/struts-plugin.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-/*
- * $Id: pom.xml 559206 2007-07-24 21:01:18Z apetrelli $
- *
- * 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.
- */
--->
-
-<!DOCTYPE struts PUBLIC
- "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
- "http://struts.apache.org/dtds/struts-2.0.dtd">
-
-<struts>
- <bean type="com.opensymphony.xwork2.config.PackageProvider" name="qi4j"
- class="org.qi4j.library.struts2.codebehind.Qi4jCodebehindPackageProvider"/>
-</struts>
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-convention/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/struts2-convention/build.gradle b/libraries/struts2-convention/build.gradle
deleted file mode 100644
index 04a1f42..0000000
--- a/libraries/struts2-convention/build.gradle
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-
-description = "Qi4j Struts Library allows integration of Qi4j into Struts2 applications."
-
-jar { manifest { name = "Qi4j Library - Struts2 - Convention" }}
-
-dependencies {
- compile(project(":org.qi4j.core:org.qi4j.core.bootstrap"))
- compile( project( ':org.qi4j.libraries:org.qi4j.library.struts2-plugin' ) )
- compile(libraries.struts_convention)
-
- testCompile(project(":org.qi4j.core:org.qi4j.core.testsupport"))
-
- testRuntime(project(":org.qi4j.core:org.qi4j.core.runtime"))
- testRuntime(libraries.logback)
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-convention/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/struts2-convention/dev-status.xml b/libraries/struts2-convention/dev-status.xml
deleted file mode 100644
index 1a18f48..0000000
--- a/libraries/struts2-convention/dev-status.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- 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.
--->
-<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.qi4j.org/schemas/2008/dev-status/1
- http://www.qi4j.org/schemas/2008/dev-status/1/dev-status.xsd">
- <status>
- <!--none,early,beta,stable,mature-->
- <codebase>beta</codebase>
-
- <!-- none, brief, good, complete -->
- <documentation>none</documentation>
-
- <!-- none, some, good, complete -->
- <unittests>some</unittests>
- </status>
- <licenses>
- <license>ALv2</license>
- </licenses>
-</module>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-convention/src/docs/struts-convention.txt
----------------------------------------------------------------------
diff --git a/libraries/struts2-convention/src/docs/struts-convention.txt b/libraries/struts2-convention/src/docs/struts-convention.txt
deleted file mode 100644
index 2bb442b..0000000
--- a/libraries/struts2-convention/src/docs/struts-convention.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-///////////////////////////////////////////////////////////////
- * 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.
-///////////////////////////////////////////////////////////////
-
-[[library-struts-convention, Struts Convention Library]]
-= Struts - Convention =
-
-[devstatus]
---------------
-source=libraries/struts2-convention/dev-status.xml
---------------
-
-Struts Convention Library
-
-NOTE: This Library has no documentation yet. Learn how to contribute in <<community-docs>>.
-
-include::../../build/docs/buildinfo/artifact.txt[]
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-convention/src/main/java/org/qi4j/library/struts2/convention/Qi4jPackageBasedActionConfigBuilder.java
----------------------------------------------------------------------
diff --git a/libraries/struts2-convention/src/main/java/org/qi4j/library/struts2/convention/Qi4jPackageBasedActionConfigBuilder.java b/libraries/struts2-convention/src/main/java/org/qi4j/library/struts2/convention/Qi4jPackageBasedActionConfigBuilder.java
deleted file mode 100644
index 4820682..0000000
--- a/libraries/struts2-convention/src/main/java/org/qi4j/library/struts2/convention/Qi4jPackageBasedActionConfigBuilder.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.qi4j.library.struts2.convention;
-
-import com.opensymphony.xwork2.ObjectFactory;
-import com.opensymphony.xwork2.config.Configuration;
-import com.opensymphony.xwork2.inject.Container;
-import com.opensymphony.xwork2.inject.Inject;
-import java.lang.reflect.Modifier;
-import org.apache.struts2.convention.PackageBasedActionConfigBuilder;
-import org.qi4j.library.struts2.ActionConfiguration;
-
-public class Qi4jPackageBasedActionConfigBuilder
- extends PackageBasedActionConfigBuilder
-{
-
- private final ActionConfiguration actionConfiguration;
-
- @Inject
- public Qi4jPackageBasedActionConfigBuilder( Configuration configuration, Container container,
- ObjectFactory objectFactory,
- @Inject( "struts.convention.redirect.to.slash" ) String redirectToSlash,
- @Inject( "struts.convention.default.parent.package" ) String defaultParentPackage,
- ActionConfiguration actionConfiguration
- )
- {
- super( configuration, container, objectFactory, redirectToSlash, defaultParentPackage );
- this.actionConfiguration = actionConfiguration;
- }
-
- @Override
- public void buildActionConfigs()
- {
- buildConfiguration( actionConfiguration.getClasses() );
- }
-
- @Override
- protected boolean cannotInstantiate( Class<?> actionClass )
- {
- return actionClass.isAnnotation()
- || actionClass.isEnum()
- || ( !actionClass.isInterface() && ( actionClass.getModifiers() & Modifier.ABSTRACT ) != 0 );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-convention/src/main/java/org/qi4j/library/struts2/convention/Qi4jPackageProvider.java
----------------------------------------------------------------------
diff --git a/libraries/struts2-convention/src/main/java/org/qi4j/library/struts2/convention/Qi4jPackageProvider.java b/libraries/struts2-convention/src/main/java/org/qi4j/library/struts2/convention/Qi4jPackageProvider.java
deleted file mode 100644
index fa8f515..0000000
--- a/libraries/struts2-convention/src/main/java/org/qi4j/library/struts2/convention/Qi4jPackageProvider.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.qi4j.library.struts2.convention;
-
-import com.opensymphony.xwork2.config.Configuration;
-import com.opensymphony.xwork2.config.ConfigurationException;
-import com.opensymphony.xwork2.config.PackageProvider;
-import com.opensymphony.xwork2.inject.Inject;
-import org.apache.struts2.convention.ActionConfigBuilder;
-
-public class Qi4jPackageProvider implements PackageProvider {
-
- private ActionConfigBuilder actionConfigBuilder;
-
- @Inject("qi4j")
- public Qi4jPackageProvider(ActionConfigBuilder actionConfigBuilder) {
- this.actionConfigBuilder = actionConfigBuilder;
- }
-
- @Override
- public void init(Configuration configuration) throws ConfigurationException {
- }
-
- @Override
- public void loadPackages() throws ConfigurationException {
- actionConfigBuilder.buildActionConfigs();
- }
-
- @Override
- public boolean needsReload() {
- return false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-convention/src/main/java/org/qi4j/library/struts2/convention/package.html
----------------------------------------------------------------------
diff --git a/libraries/struts2-convention/src/main/java/org/qi4j/library/struts2/convention/package.html b/libraries/struts2-convention/src/main/java/org/qi4j/library/struts2/convention/package.html
deleted file mode 100644
index 7bdc6a8..0000000
--- a/libraries/struts2-convention/src/main/java/org/qi4j/library/struts2/convention/package.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!--
-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.
--->
-<html>
- <body>
- <h2>Struts 2 Convention Integration.</h2>
- </body>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-convention/src/main/resources/struts-plugin.xml
----------------------------------------------------------------------
diff --git a/libraries/struts2-convention/src/main/resources/struts-plugin.xml b/libraries/struts2-convention/src/main/resources/struts-plugin.xml
deleted file mode 100644
index a48ab7d..0000000
--- a/libraries/struts2-convention/src/main/resources/struts-plugin.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE struts PUBLIC
- "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
- "http://struts.apache.org/dtds/struts-2.0.dtd">
-<!--
- 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.
--->
-
-<struts>
- <bean type="org.apache.struts2.convention.ActionConfigBuilder" name="qi4j"
- class="org.qi4j.library.struts2.convention.Qi4jPackageBasedActionConfigBuilder"/>
-
- <bean type="com.opensymphony.xwork2.config.PackageProvider" name="qi4j"
- class="org.qi4j.library.struts2.convention.Qi4jPackageProvider"/>
-</struts>
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/build.gradle
----------------------------------------------------------------------
diff --git a/libraries/struts2-plugin/build.gradle b/libraries/struts2-plugin/build.gradle
deleted file mode 100644
index 1a9bcac..0000000
--- a/libraries/struts2-plugin/build.gradle
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-description = "Qi4j Struts Library allows integration of Qi4j into Struts2 applications."
-
-jar { manifest { name = "Qi4j Library - Struts2" }}
-
-dependencies {
- compile(project(":org.qi4j.core:org.qi4j.core.bootstrap"))
- compile(libraries.struts_core)
- compile(libraries.freemarker)
- compile(libraries.servlet_api)
- compile(libraries.slf4j_api)
-
- testCompile(project(":org.qi4j.core:org.qi4j.core.testsupport"))
-
- testRuntime(project(":org.qi4j.core:org.qi4j.core.runtime"))
- testRuntime(libraries.logback)
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/dev-status.xml
----------------------------------------------------------------------
diff --git a/libraries/struts2-plugin/dev-status.xml b/libraries/struts2-plugin/dev-status.xml
deleted file mode 100644
index 1a18f48..0000000
--- a/libraries/struts2-plugin/dev-status.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
- 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.
--->
-<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.qi4j.org/schemas/2008/dev-status/1
- http://www.qi4j.org/schemas/2008/dev-status/1/dev-status.xsd">
- <status>
- <!--none,early,beta,stable,mature-->
- <codebase>beta</codebase>
-
- <!-- none, brief, good, complete -->
- <documentation>none</documentation>
-
- <!-- none, some, good, complete -->
- <unittests>some</unittests>
- </status>
- <licenses>
- <license>ALv2</license>
- </licenses>
-</module>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/docs/struts-plugin.txt
----------------------------------------------------------------------
diff --git a/libraries/struts2-plugin/src/docs/struts-plugin.txt b/libraries/struts2-plugin/src/docs/struts-plugin.txt
deleted file mode 100644
index 678fb0f..0000000
--- a/libraries/struts2-plugin/src/docs/struts-plugin.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-///////////////////////////////////////////////////////////////
- * 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.
-///////////////////////////////////////////////////////////////
-
-[[library-struts-plugin, Struts Plugin Library]]
-= Struts - Plugin =
-
-[devstatus]
---------------
-source=libraries/struts2-plugin/dev-status.xml
---------------
-
-Struts Plugin Library
-
-NOTE: This Library has no documentation yet. Learn how to contribute in <<community-docs>>.
-
-include::../../build/docs/buildinfo/artifact.txt[]
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/ActionConfiguration.java
----------------------------------------------------------------------
diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/ActionConfiguration.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/ActionConfiguration.java
deleted file mode 100644
index 5f9b1a2..0000000
--- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/ActionConfiguration.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.qi4j.library.struts2;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import org.qi4j.api.common.Visibility;
-import org.qi4j.api.composite.Composite;
-import org.qi4j.api.composite.TransientComposite;
-import org.qi4j.bootstrap.Assembler;
-import org.qi4j.bootstrap.AssemblyException;
-import org.qi4j.bootstrap.ModuleAssembly;
-
-public class ActionConfiguration
- implements Assembler, Serializable
-{
- static final long serialVersionUID = 1L;
-
- private final Set<Class> objectTypes;
- private final Set<Class<? extends Composite>> compositeTypes;
-
- public ActionConfiguration()
- {
- compositeTypes = new HashSet<Class<? extends Composite>>();
- objectTypes = new HashSet<Class>();
- }
-
- public void addObjects( Class... objectTypes )
- throws AssemblyException
- {
- this.objectTypes.addAll( Arrays.asList( objectTypes ) );
- }
-
- public void addComposites( Class<? extends Composite>... compositeTypes )
- throws AssemblyException
- {
- this.compositeTypes.addAll( Arrays.asList( compositeTypes ) );
- }
-
- public Set<Class> getClasses()
- {
- Set<Class> classes = new HashSet<Class>( objectTypes );
- classes.addAll( compositeTypes );
- return Collections.unmodifiableSet( classes );
- }
-
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.objects( objectTypes.toArray( new Class[]{ } ) ).visibleIn( Visibility.module );
- module.transients( (Class<? extends TransientComposite>[]) compositeTypes.toArray( new Class[]{ } ) )
- .visibleIn( Visibility.module );
- }
-}
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/ActionService.java
----------------------------------------------------------------------
diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/ActionService.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/ActionService.java
deleted file mode 100644
index 1d616ae..0000000
--- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/ActionService.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.qi4j.library.struts2;
-
-import org.qi4j.api.service.ServiceComposite;
-
-public interface ActionService
- extends ServiceComposite
-{
-}
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Constants.java
----------------------------------------------------------------------
diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Constants.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Constants.java
deleted file mode 100644
index a8476f2..0000000
--- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Constants.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright 2008 Edward Yakop.
- *
- * 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.qi4j.library.struts2;
-
-public class Constants
-{
- public static String SERVLET_ATTRIBUTE = "qi4j.application.initializer";
-}
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/ConstraintViolationInterceptor.java
----------------------------------------------------------------------
diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/ConstraintViolationInterceptor.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/ConstraintViolationInterceptor.java
deleted file mode 100644
index eeeb600..0000000
--- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/ConstraintViolationInterceptor.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * 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.qi4j.library.struts2;
-
-import com.opensymphony.xwork2.ActionContext;
-import com.opensymphony.xwork2.ActionInvocation;
-import com.opensymphony.xwork2.ValidationAware;
-import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
-import com.opensymphony.xwork2.interceptor.PreResultListener;
-import com.opensymphony.xwork2.util.ValueStack;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import org.qi4j.api.Qi4j;
-import org.qi4j.api.composite.Composite;
-import org.qi4j.api.constraint.ConstraintViolation;
-import org.qi4j.library.struts2.util.ClassNameMapper;
-
-import static java.util.Collections.emptyMap;
-import static org.qi4j.library.struts2.util.ClassNameFilters.removeSuffixes;
-import static org.qi4j.library.struts2.util.ClassNames.classNameInDotNotation;
-
-/**
- * <p>ConstraintViolationInterceptor adds constraint violations from the ActionContext to the Action's field errors.</p>
- *
- * <p>This interceptor adds any error found in the {@link ActionContext}'s constraint violations map as a field error
- * (provided that the action implements {@link ValidationAware}). In addition, any field that contains a constraint
- * violation has its original value saved such that any subsequent requests for that value return the original value
- * rather than the value in the action. This is important because if the value "abc" is submitted and can't be set
- * on a property requiring at least 5 characters, we want to display the original string ("abc") again rather than the
- * original value (likely an empty string, which would make very little sense to the user).</p>
- *
- * <p>This is similar, in principle, to the XWork ConversionErrorInterceptor and much of the code is reflects that.</p>
- */
-public class ConstraintViolationInterceptor
- extends AbstractInterceptor
-{
- static final long serialVersionUID = 1L;
-
- public static final String CONTEXT_CONSTRAINT_VIOLATIONS = ConstraintViolationInterceptor.class.getName() + ".constraintViolations";
-
- protected Object getOverrideExpr( ActionInvocation invocation, FieldConstraintViolations violations )
- {
- return "'" + violations.value() + "'";
- }
-
- @Override
- public String intercept( ActionInvocation invocation )
- throws Exception
- {
- ActionContext invocationContext = invocation.getInvocationContext();
- ValueStack stack = invocationContext.getValueStack();
-
- Object action = invocation.getAction();
- if( action instanceof ValidationAware )
- {
- ValidationAware va = (ValidationAware) action;
- HashMap<Object, Object> propertyOverrides = new HashMap<Object, Object>();
- for( Map.Entry<String, FieldConstraintViolations> fieldViolations : fieldConstraintViolations( invocationContext )
- .entrySet() )
- {
- addConstraintViolationFieldErrors( stack, va, fieldViolations.getKey(), fieldViolations.getValue() );
- propertyOverrides.put( fieldViolations.getKey(), getOverrideExpr( invocation, fieldViolations.getValue() ) );
- }
- // if there were some errors, put the original (fake) values in place right before the result
- if( !propertyOverrides.isEmpty() )
- {
- overrideActionValues( invocation, stack, propertyOverrides );
- }
- }
-
- return invocation.invoke();
- }
-
- private void overrideActionValues(
- ActionInvocation invocation, ValueStack stack, final HashMap<Object, Object> propertyOverrides
- )
- {
- invocation.addPreResultListener( new PreResultListener()
- {
- @Override
- public void beforeResult( ActionInvocation invocation, String resultCode )
- {
- invocation.getStack().setExprOverrides( propertyOverrides );
- }
- } );
- }
-
- private void addConstraintViolationFieldErrors(
- ValueStack stack, ValidationAware va, String fieldName, FieldConstraintViolations violations
- )
- {
- for( ConstraintViolation constraintViolation : violations.constraintViolations() )
- {
- Object target = violations.target();
- String message = message( target, violations.propertyName(), constraintViolation, stack );
- va.addFieldError( fieldName, message );
- }
- }
-
- @SuppressWarnings( "unchecked" )
- private Map<String, FieldConstraintViolations> fieldConstraintViolations( ActionContext context )
- {
- Map<String, FieldConstraintViolations> violations =
- (Map<String, FieldConstraintViolations>) context.get( CONTEXT_CONSTRAINT_VIOLATIONS );
- if( violations == null )
- {
- return emptyMap();
- }
-
- return violations;
- }
-
- protected String message( Object target,
- String propertyName,
- ConstraintViolation constraintViolation,
- ValueStack stack
- )
- {
- String messageKey = messageKey( target, propertyName, constraintViolation );
- String getTextExpression = "getText('" + messageKey + "')";
- String message = (String) stack.findValue( getTextExpression );
-
- if( message == null )
- {
- message = messageKey;
- }
-
- return message;
- }
-
- /**
- * <p>The message key is generated based on the type of the target, the name of the property and the type of the
- * constraint violation. So, if the target has type ItemEntity with a name property that has a not empty constraint
- * and the user doesn't enter anything for the value, the corresponding message key would be
- * 'item.name.not.empty.constraint.violated'.</p>
- *
- * <p>Note that if the type name of the target ends with 'Composite' or 'Entity', those will be removed and the
- * rest of the name will be converted from camel-case to a dot notation. This is true of the constraint types as
- * well. So a constraint named NotEmpty will be converted to not.empty as in the example above.</p>
- * @param target JAVADOC
- * @param propertyName JAVADOC
- * @param violation JAVADOC
- * @return JAVADOC
- */
- protected String messageKey( Object target, String propertyName, ConstraintViolation violation )
- {
- Iterable<Class<?>> types;
- if( target instanceof Composite )
- {
- Composite composite = (Composite) target;
- types = Qi4j.FUNCTION_DESCRIPTOR_FOR.map( composite ).types();
- }
- else
- {
- ArrayList<Class<?>> list = new ArrayList<Class<?>>( 1 );
- list.add(target.getClass());
- types = list;
- }
-
- return classNameInDotNotation( types, withoutCompositeOrEntitySuffix )
- + "." + propertyName
- + "." + constraintKeyPart( violation )
- + ".constraint.violated";
- }
-
- private static final ClassNameMapper withoutCompositeOrEntitySuffix = removeSuffixes( "Composite", "Entity" );
-
- private String constraintKeyPart( ConstraintViolation constraintViolation )
- {
- return classNameInDotNotation( constraintViolation.constraint().annotationType() );
- }
-
- public static class FieldConstraintViolations
- {
- private final Object target;
- private final String propertyName;
- private final Object value;
- private final Collection<ConstraintViolation> constraintViolations;
-
- public FieldConstraintViolations(
- Object aTarget,
- String aPropertyName,
- Object aValue,
- Collection<ConstraintViolation> constraintViolations
- )
- {
- target = aTarget;
- propertyName = aPropertyName;
- value = aValue;
- this.constraintViolations = constraintViolations;
- }
-
- public Object target()
- {
- return target;
- }
-
- public String propertyName()
- {
- return propertyName;
- }
-
- public Object value()
- {
- return value;
- }
-
- public Collection<ConstraintViolation> constraintViolations()
- {
- return constraintViolations;
- }
- }
-}