http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/EntityCompositeConverter.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/EntityCompositeConverter.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/EntityCompositeConverter.java deleted file mode 100644 index 017489a..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/EntityCompositeConverter.java +++ /dev/null @@ -1,72 +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.inject.Inject; -import java.util.Map; -import org.apache.struts2.util.StrutsTypeConverter; -import org.qi4j.api.entity.EntityComposite; -import org.qi4j.api.unitofwork.UnitOfWork; -import org.qi4j.api.unitofwork.UnitOfWorkFactory; - -/** - * <p>Converts Strings to entities and entities to strings.</p> - * - * <p>To convert from a string to an entity the value passed in is expected to be an identity. The identity can - * be either a fully qualified identity, e.g org.qi4j.example.Person:368e27f0-ea39-497a-9069-ffb5f41bf174-0, or it can - * be just the uuid.</p> - * - * <p>Conversion to a String is done using the EntityComposites identity and and returning just the uuid portion.</p> - */ -public class EntityCompositeConverter - extends StrutsTypeConverter -{ - private UnitOfWorkFactory uowf; - - @Inject - public void setUnitOfWorkFactory( UnitOfWorkFactory uowf ) - { - this.uowf = uowf; - } - - @Override - public Object convertFromString( Map context, String[] values, Class toClass ) - { - String identity = extractIdentity( values ); - UnitOfWork uow = uowf.currentUnitOfWork(); - return uow.get( toClass, identity ); - } - - @Override - public String convertToString( Map context, Object o ) - { - return ( (EntityComposite) o ).identity().get(); - } - - private String extractIdentity( String[] values ) - { - String identity = values[ 0 ]; - int separatorIndex = identity.indexOf( ':' ); - if( separatorIndex == -1 ) - { - return identity; - } - return identity = identity.substring( separatorIndex + 1 ); - } -}
http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Qi4jApplicationBootstrapListener.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Qi4jApplicationBootstrapListener.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Qi4jApplicationBootstrapListener.java deleted file mode 100644 index ee9cb9e..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Qi4jApplicationBootstrapListener.java +++ /dev/null @@ -1,118 +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; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import org.qi4j.api.structure.Application; -import org.qi4j.api.structure.Module; -import org.qi4j.bootstrap.ApplicationAssembler; -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.Energy4Java; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.qi4j.library.struts2.Constants.SERVLET_ATTRIBUTE; - -public abstract class Qi4jApplicationBootstrapListener - implements ServletContextListener -{ - private static final Logger LOG = LoggerFactory.getLogger( Qi4jApplicationBootstrapListener.class ); - - private Application application; - - @Override - public final void contextInitialized( ServletContextEvent sce ) - { - LOG.info( "Qi4j Plugin: Initializing" ); - - ServletContext context = sce.getServletContext(); - application = createNewApplication( context ); - - if( application != null ) - { - Module module = qi4jStrutsModule( application ); - context.setAttribute( SERVLET_ATTRIBUTE, module ); - - try - { - application.activate(); - } - catch( Exception e ) - { - throw new IllegalStateException( e ); - } - } - else - { - throw new IllegalStateException( "None of the assembly creation methods returned a non-null assembler" ); - } - LOG.info( "... initialized qi4j-struts integration successfully" ); - } - - /** - * @param application Qi4j application. - * - * @return Qi4j struts module. - */ - protected abstract Module qi4jStrutsModule( Application application ); - - private Application createNewApplication( ServletContext context ) - { - Energy4Java qi4j = new Energy4Java(); - - // Try create assembler - final ApplicationAssembler assembler = createAssembler(); - if( assembler != null ) - { - try - { - return qi4j.newApplication( assembler ); - } - catch( AssemblyException e ) - { - throw new IllegalStateException( e ); - } - } - - return null; - } - - /** - * Override this method to create an application assembler. - * - * @return An application assembler. - */ - protected ApplicationAssembler createAssembler() - { - return null; - } - - @Override - public final void contextDestroyed( ServletContextEvent sce ) - { - try - { - application.passivate(); - } - catch( Exception e ) - { - throw new IllegalStateException( e ); - } - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Qi4jFilterDispatcher.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Qi4jFilterDispatcher.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Qi4jFilterDispatcher.java deleted file mode 100644 index 72da0a1..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Qi4jFilterDispatcher.java +++ /dev/null @@ -1,120 +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.config.Configuration; -import com.opensymphony.xwork2.config.ConfigurationException; -import com.opensymphony.xwork2.config.ConfigurationManager; -import com.opensymphony.xwork2.config.ContainerProvider; -import com.opensymphony.xwork2.inject.ContainerBuilder; -import com.opensymphony.xwork2.inject.Context; -import com.opensymphony.xwork2.inject.Factory; -import com.opensymphony.xwork2.util.location.LocatableProperties; -import javax.servlet.FilterConfig; -import org.apache.struts2.config.BeanSelectionProvider; -import org.apache.struts2.dispatcher.Dispatcher; -import org.apache.struts2.dispatcher.FilterDispatcher; -import org.qi4j.api.composite.TransientBuilderFactory; -import org.qi4j.api.object.ObjectFactory; -import org.qi4j.api.structure.Module; -import org.qi4j.api.unitofwork.UnitOfWorkFactory; - -import static org.qi4j.library.struts2.Constants.SERVLET_ATTRIBUTE; - -public class Qi4jFilterDispatcher - extends FilterDispatcher -{ - @Override - protected Dispatcher createDispatcher( final FilterConfig filterConfig ) - { - Dispatcher dispatcher = super.createDispatcher( filterConfig ); - ConfigurationManager configurationManager = createConfigurationManager( filterConfig ); - dispatcher.setConfigurationManager( configurationManager ); - return dispatcher; - } - - protected ConfigurationManager createConfigurationManager( FilterConfig filterConfig ) - { - ConfigurationManager configurationManager = new ConfigurationManager( BeanSelectionProvider.DEFAULT_BEAN_NAME ); - configurationManager.addContainerProvider( new Qi4jContainerProvider( module( filterConfig ) ) ); - return configurationManager; - } - - private Module module( FilterConfig filterConfig ) - { - return (Module) filterConfig.getServletContext().getAttribute( SERVLET_ATTRIBUTE ); - } - - class Qi4jContainerProvider - implements ContainerProvider - { - private final Module module; - private boolean registered = false; - - Qi4jContainerProvider( Module aModule ) - { - module = aModule; - } - - @Override - public void register( ContainerBuilder builder, LocatableProperties props ) - throws ConfigurationException - { - factory( builder, UnitOfWorkFactory.class, module ); - factory( builder, ObjectFactory.class, module ); - factory( builder, TransientBuilderFactory.class, module ); - factory( builder, ActionConfiguration.class, actionConfiguration() ); - registered = true; - } - - @Override - public boolean needsReload() - { - return !registered; - } - - @Override - public void init( Configuration configuration ) - throws ConfigurationException - { - } - - @Override - public void destroy() - { - } - - private <T> void factory( ContainerBuilder builder, Class<T> type, final T value ) - { - builder.factory( type, new Factory<T>() - { - @Override - public T create( Context context ) - { - return value; - } - } ); - } - - private ActionConfiguration actionConfiguration() - { - return module.findService( ActionService.class ).metaInfo( ActionConfiguration.class ); - } - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Qi4jObjectFactory.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Qi4jObjectFactory.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Qi4jObjectFactory.java deleted file mode 100644 index 42fd19b..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Qi4jObjectFactory.java +++ /dev/null @@ -1,241 +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; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.inject.Inject; -import java.util.HashMap; -import java.util.Map; -import org.apache.struts2.util.ObjectFactoryDestroyable; -import org.qi4j.api.common.ConstructionException; -import org.qi4j.api.composite.NoSuchTransientException; -import org.qi4j.api.composite.TransientBuilderFactory; -import org.qi4j.api.object.NoSuchObjectException; -import org.qi4j.api.object.ObjectFactory; - -import static org.qi4j.library.struts2.Qi4jObjectFactory.ClassType.*; - -/** - * Qi4j implementation of struts object factory. - */ -public class Qi4jObjectFactory - extends com.opensymphony.xwork2.ObjectFactory - implements ObjectFactoryDestroyable -{ - private static final long serialVersionUID = 1L; - - static enum ClassType - { - qi4jComposite, - qi4jObject, - object - } - - private final Map<Class, ClassType> types; - - private ObjectFactory objectFactory; - private TransientBuilderFactory compositeBuilderFactory; - - public Qi4jObjectFactory() - { - types = new HashMap<Class, ClassType>(); - } - - @Inject - public void setObjectFactory( ObjectFactory objectFactory ) - { - this.objectFactory = objectFactory; - } - - @Inject - public void setCompositeBuilderFactory( TransientBuilderFactory compositeBuilderFactory ) - { - this.compositeBuilderFactory = compositeBuilderFactory; - } - - /** - * Build a generic Java object of the given type. - * - * @param classType Type of Object to build - * @param extraContext A map of extra context which uses the same keys as the {@link ActionContext} - */ - @Override - @SuppressWarnings( "unchecked" ) - public Object buildBean( Class classType, Map extraContext ) - throws Exception - { - // TODO: What to do with extraContext - - ClassType type = types.get( classType ); - if( type != null ) - { - switch( type ) - { - case object: - return createStandardObject( classType, false ); - case qi4jComposite: - return createQi4jComposite( classType, false ); - case qi4jObject: - return createQi4jObject( classType, false ); - } - } - - // Figure out what kind of object is this. - Object object = createQi4jComposite( classType, true ); - if( object == null ) - { - object = createQi4jObject( classType, true ); - - if( object == null ) - { - object = createStandardObject( classType, true ); - } - } - - return object; - } - - private Object createStandardObject( Class aClass, boolean isAddToTypes ) - throws Exception - { - Object obj = null; - Exception exception = null; - try - { - obj = aClass.newInstance(); - } - catch( InstantiationException e ) - { - exception = e; - } - catch( IllegalAccessException e ) - { - exception = e; - } - - if( isAddToTypes ) - { - addToType( aClass, object ); - } - - if( exception != null ) - { - throw exception; - } - - return obj; - } - - @SuppressWarnings( "unchecked" ) - private Object createQi4jObject( Class aClass, boolean isAddToTypes ) - { - if( objectFactory == null ) - { - return null; - } - - ConstructionException exception = null; - Object obj = null; - - try - { - obj = objectFactory.newObject( aClass ); - } - catch( NoSuchObjectException e ) - { - return null; - } - catch( ConstructionException e ) - { - exception = e; - } - - if( isAddToTypes ) - { - addToType( aClass, qi4jObject ); - } - - if( exception != null ) - { - throw exception; - } - - return obj; - } - - @SuppressWarnings( "unchecked" ) - private Object createQi4jComposite( Class aClass, boolean isAddToTypes ) - { - if( compositeBuilderFactory == null ) - { - return null; - } - - Object obj = null; - ConstructionException exception = null; - - try - { - obj = compositeBuilderFactory.newTransient( aClass ); - } - catch( NoSuchTransientException e ) - { - return null; - } - catch( ConstructionException e ) - { - exception = e; - } - - if( isAddToTypes ) - { - addToType( aClass, qi4jComposite ); - } - - if( exception != null ) - { - throw exception; - } - - return obj; - } - - private void addToType( Class aClass, ClassType aClassType ) - { - synchronized( types ) - { - types.put( aClass, aClassType ); - } - } - - /** - * Allows for ObjectFactory implementations that support Actions without no-arg constructors. - * - * @return {@code false}. - */ - @Override - public boolean isNoArgConstructorRequired() - { - return false; - } - - @Override - public final void destroy() - { - types.clear(); - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Qi4jPropertyAccessor.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Qi4jPropertyAccessor.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Qi4jPropertyAccessor.java deleted file mode 100644 index 9cee45c..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/Qi4jPropertyAccessor.java +++ /dev/null @@ -1,232 +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.util.Collection; -import java.util.HashMap; -import java.util.Map; -import ognl.MethodFailedException; -import ognl.ObjectMethodAccessor; -import ognl.ObjectPropertyAccessor; -import ognl.OgnlContext; -import ognl.OgnlException; -import ognl.OgnlRuntime; -import org.qi4j.api.Qi4j; -import org.qi4j.api.association.Association; -import org.qi4j.api.association.ManyAssociation; -import org.qi4j.api.association.NamedAssociation; -import org.qi4j.api.constraint.ConstraintViolation; -import org.qi4j.api.constraint.ConstraintViolationException; -import org.qi4j.api.injection.scope.Structure; -import org.qi4j.api.property.Property; -import org.qi4j.library.struts2.ConstraintViolationInterceptor.FieldConstraintViolations; - -import static com.opensymphony.xwork2.conversion.impl.XWorkConverter.CONVERSION_PROPERTY_FULLNAME; -import static ognl.OgnlRuntime.getConvertedType; -import static ognl.OgnlRuntime.getFieldValue; -import static org.qi4j.library.struts2.ConstraintViolationInterceptor.CONTEXT_CONSTRAINT_VIOLATIONS; - -/** - * <p>An implementation of the ObjectPropertyAccessor that provides conversion for Qi4j properties. The typical way that - * OGNL gets/sets object attributes is by finding the corresponding JavaBean getter/setter methods. This - * ObjectPropertyAccessor checks if there is a Qi4j property on the Composite and if there is uses the properties - * get/set methods.</p> - * - * <p>When setting Property values, if a ConstraintViolationException is thrown it is added to the context so that - * it can be processed and by the ConstraintViolationInterceptor, similar to how conversion exceptions are handled by - * the ConversionErrorInterceptor</p> - * - * <p>When setting Association values, we attempt to convert the value to the association type using the normal XWork - * converter mechanisms. If the type is an EntityComposite, we already have a converter registered - * {@link EntityCompositeConverter} to handle conversion from a string identity to an object. If the type is not an - * EntityComposite, but the actual values are EntityComposites, you can register the {@link EntityCompositeConverter} - * for your type in your xwork-conversion.properties file.</p> - * - * <p>NOTE: We can't do this as a regular converter because Qi4j composites doesn't (nor should it be) following the - * JavaBean standard. We might be able to only override the getProperty() method here and have regular converters for - * Property, Association and SetAssociation but I haven't tried that yet so it may not work as expected.</p> - * - * <p>TODO: Doesn't yet handle ManyAssociations, but these shouldn't be too hard to add</p> - */ -public class Qi4jPropertyAccessor - extends ObjectPropertyAccessor -{ - private static final Object[] BLANK_ARGUMENTS = new Object[0]; - - private final ObjectMethodAccessor methodAccessor = new ObjectMethodAccessor(); - - @Structure - Qi4j api; - - @Override - public final Object getProperty( Map aContext, Object aTarget, Object aPropertyName ) - throws OgnlException - { - String fieldName = aPropertyName.toString(); - Object qi4jField = getQi4jField( aContext, aTarget, fieldName ); - if( qi4jField != null ) - { - Class<?> memberClass = qi4jField.getClass(); - if( Property.class.isAssignableFrom( memberClass ) ) - { - Property<?> property = (Property) qi4jField; - return property.get(); - } - else if( Association.class.isAssignableFrom( memberClass ) ) - { - Association<?> association = (Association) qi4jField; - return association.get(); - } - else if( ManyAssociation.class.isAssignableFrom( memberClass ) ) - { - return qi4jField; - } - else if( NamedAssociation.class.isAssignableFrom( memberClass ) ) - { - return qi4jField; - } - } - - return super.getProperty( aContext, aTarget, fieldName ); - } - - @SuppressWarnings( "unchecked" ) - private Object getQi4jField( Map aContext, Object aTarget, String aFieldName ) - throws OgnlException - { - if( aTarget != null ) - { - // Is target#name a method? e.g. cat.name() - try - { - return methodAccessor.callMethod( aContext, aTarget, aFieldName, BLANK_ARGUMENTS ); - } - catch( MethodFailedException e ) - { - // Means not a property/association - } - - // Is target#name a field? e.g. action.field1, where field1 is extracted from a composite - OgnlContext ognlContext = (OgnlContext) aContext; - try - { - return getFieldValue( ognlContext, aTarget, aFieldName, true ); - } - catch( NoSuchFieldException e ) - { - // Means not a field - } - } - - return null; - } - - @Override - @SuppressWarnings( "unchecked" ) - public final void setProperty( Map aContext, Object aTarget, Object aPropertyName, Object aPropertyValue ) - throws OgnlException - { - String fieldName = aPropertyName.toString(); - Object qi4jField = getQi4jField( aContext, aTarget, fieldName ); - - if( qi4jField != null ) - { - Class<?> memberClass = qi4jField.getClass(); - - if( Property.class.isAssignableFrom( memberClass ) ) - { - Property property = (Property) qi4jField; - - OgnlContext ognlContext = (OgnlContext) aContext; - Class<?> propertyType = (Class) api.propertyDescriptorFor( property ).type(); - Object convertedValue = getConvertedType( - ognlContext, aTarget, null, fieldName, aPropertyValue, propertyType ); - try - { - property.set( convertedValue ); - } - catch( ConstraintViolationException e ) - { - Collection<ConstraintViolation> violations = e.constraintViolations(); - handleConstraintViolation( aContext, aTarget, fieldName, convertedValue, violations ); - } - - return; - } - else if( Association.class.isAssignableFrom( memberClass ) ) - { - Association association = (Association) qi4jField; - OgnlContext ognlContext = (OgnlContext) aContext; - Class<?> associationType = (Class) api.associationDescriptorFor( association ).type(); - Object convertedValue = getConvertedType( - ognlContext, aTarget, null, fieldName, aPropertyValue, associationType ); - if( convertedValue == OgnlRuntime.NoConversionPossible ) - { - throw new OgnlException( "Could not convert value to association type" ); - } - try - { - association.set( convertedValue ); - } - catch( ConstraintViolationException e ) - { - Collection<ConstraintViolation> violations = e.constraintViolations(); - handleConstraintViolation( aContext, aTarget, fieldName, aPropertyValue, violations ); - } - - return; - } - else if( ManyAssociation.class.isAssignableFrom( memberClass ) ) - { - throw new OgnlException( "Setting many association [" + fieldName + "] is impossible." ); - } - else if( NamedAssociation.class.isAssignableFrom( memberClass ) ) - { - throw new OgnlException( "Setting named association [" + fieldName + "] is impossible." ); - } - } - - super.setProperty( aContext, aTarget, aPropertyName, aPropertyValue ); - } - - @SuppressWarnings( "unchecked" ) - protected final void handleConstraintViolation( - Map aContext, Object aTarget, String aPropertyName, Object aPropertyValue, - Collection<ConstraintViolation> violations - ) - { - Map<String, FieldConstraintViolations> allPropertyConstraintViolations - = (Map<String, FieldConstraintViolations>) aContext.get( CONTEXT_CONSTRAINT_VIOLATIONS ); - if( allPropertyConstraintViolations == null ) - { - allPropertyConstraintViolations = new HashMap<>(); - aContext.put( CONTEXT_CONSTRAINT_VIOLATIONS, allPropertyConstraintViolations ); - } - - String realFieldName = aPropertyName; - String fieldFullName = (String) aContext.get( CONVERSION_PROPERTY_FULLNAME ); - if( fieldFullName != null ) - { - realFieldName = fieldFullName; - } - // Add another violation - allPropertyConstraintViolations.put( - realFieldName, new FieldConstraintViolations( aTarget, aPropertyName, aPropertyValue, violations ) ); - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/UnitOfWorkInterceptor.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/UnitOfWorkInterceptor.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/UnitOfWorkInterceptor.java deleted file mode 100644 index 567c85f..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/UnitOfWorkInterceptor.java +++ /dev/null @@ -1,93 +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.Action; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.AbstractInterceptor; -import org.qi4j.api.injection.scope.Structure; -import org.qi4j.api.unitofwork.UnitOfWork; -import org.qi4j.api.unitofwork.UnitOfWorkFactory; - -/** - * <p>An interceptor to be used to start a UnitOfWork if one has not yet been started. If this interceptor creates a - * new UnitOfWork it will also add a PreResultListener to make sure the unit of work is completed or discarded before - * the result is executed. This is important so that the rendering of the result does not make any changes to the - * entities it is dealing with (we can maybe make this an option, to keep the UnitOfWork open until the invocation stack - * returns to this interceptor or if it should use the PreResultListener, but for now I like the PreResultListener - * better as it is safer).</p> - * - * <p>When a new UnitOfWork is created by this interceptor a decision must be made when closing it whether to discard - * the UnitOfWork or complete it. For now, if the resultCode is "success", we complete the UnitOfWork, otherwise we - * discard it. There are many things we can do here to make it more flexible, e.g. allow the user to specify result - * codes to complete or, conversely, codes that should result in the UnitOfWork being discarded. Since we have access - * to the action invocation we could also do something with annotations on the method to be executed to allow user to - * specify more specifically for that method what results should result in discards or completions.</p> - */ -public class UnitOfWorkInterceptor - extends AbstractInterceptor -{ - - private static final long serialVersionUID = 1L; - - @Structure - private UnitOfWorkFactory uowf; - - @Override - public String intercept( ActionInvocation invocation ) - throws Exception - { - boolean createdUnitOfWork = false; - UnitOfWork uow; - if (!uowf.isUnitOfWorkActive()) - { - uow = uowf.newUnitOfWork(); - createdUnitOfWork = true; - } else - { - uow = uowf.currentUnitOfWork(); - } - - String resultCode = null; - try - { - resultCode = invocation.invoke(); - } - finally - { - if( createdUnitOfWork && uow.isOpen() ) - { - if( shouldComplete( invocation, resultCode ) ) - { - uow.complete(); - } - else - { - uow.discard(); - } - } - } - return resultCode; - } - - protected boolean shouldComplete( ActionInvocation invocation, String resultCode ) - { - return Action.SUCCESS.equals( resultCode ); - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/bootstrap/Struts2PluginAssembler.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/bootstrap/Struts2PluginAssembler.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/bootstrap/Struts2PluginAssembler.java deleted file mode 100644 index 76d97eb..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/bootstrap/Struts2PluginAssembler.java +++ /dev/null @@ -1,47 +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.bootstrap; - -import org.qi4j.api.common.Visibility; -import org.qi4j.bootstrap.Assembler; -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.ModuleAssembly; -import org.qi4j.library.struts2.ActionConfiguration; -import org.qi4j.library.struts2.ActionService; -import org.qi4j.library.struts2.UnitOfWorkInterceptor; - -public class Struts2PluginAssembler - implements Assembler -{ - private final ActionConfiguration actionConfiguration; - - public Struts2PluginAssembler( ActionConfiguration actionConfiguration ) - { - this.actionConfiguration = actionConfiguration; - } - - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.objects( UnitOfWorkInterceptor.class ).visibleIn( Visibility.module ); - module.services( ActionService.class ) - .setMetaInfo( actionConfiguration ) - .visibleIn( Visibility.module ); - actionConfiguration.assemble( module ); - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/package.html ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/package.html b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/package.html deleted file mode 100644 index 1938ef3..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/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 Integration.</h2> - </body> -</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/HasInput.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/HasInput.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/HasInput.java deleted file mode 100644 index d570925..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/HasInput.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.support; - -public interface HasInput -{ - - String input() - throws Exception; -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/ProvidesEntityOf.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/ProvidesEntityOf.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/ProvidesEntityOf.java deleted file mode 100644 index 6723b7e..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/ProvidesEntityOf.java +++ /dev/null @@ -1,28 +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.support; - -public interface ProvidesEntityOf<T> -{ - String getId(); - - void setId( String id ); - - T getEntity(); -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/ProvidesEntityOfMixin.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/ProvidesEntityOfMixin.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/ProvidesEntityOfMixin.java deleted file mode 100644 index 4a86ea0..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/ProvidesEntityOfMixin.java +++ /dev/null @@ -1,77 +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.support; - -import org.qi4j.api.injection.scope.Structure; -import org.qi4j.api.injection.scope.This; -import org.qi4j.api.unitofwork.NoSuchEntityException; -import org.qi4j.api.unitofwork.UnitOfWork; -import org.qi4j.api.unitofwork.UnitOfWorkFactory; - -import static org.qi4j.library.struts2.util.ParameterizedTypes.findTypeVariables; - -public abstract class ProvidesEntityOfMixin<T> - implements ProvidesEntityOf<T>, StrutsAction -{ - - @This - private ProvidesEntityOf<T> entityProvider; - - @Structure - private UnitOfWorkFactory uowf; - - private String id; - private T entity; - - @Override - public String getId() - { - return id; - } - - @Override - public void setId( String id ) - { - this.id = id; - } - - @Override - public T getEntity() - { - return entity; - } - - protected void loadEntity() - { - UnitOfWork uow = uowf.currentUnitOfWork(); - try - { - entity = uow.get( typeToLoad(), entityProvider.getId() ); - } - catch( NoSuchEntityException e ) - { - addActionError( getText( "entity.not.found" ) ); - } - } - - protected Class<T> typeToLoad() - { - return (Class<T>) findTypeVariables( entityProvider.getClass(), ProvidesEntityOf.class )[ 0 ]; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/StrutsAction.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/StrutsAction.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/StrutsAction.java deleted file mode 100644 index 29d7e3a..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/StrutsAction.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.support; - -import com.opensymphony.xwork2.*; - -public interface StrutsAction - extends Action, Validateable, ValidationAware, TextProvider, LocaleProvider -{ -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/add/ProvidesAddingOf.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/add/ProvidesAddingOf.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/add/ProvidesAddingOf.java deleted file mode 100644 index 02bce67..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/add/ProvidesAddingOf.java +++ /dev/null @@ -1,29 +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.support.add; - -import com.opensymphony.xwork2.Preparable; -import org.qi4j.library.struts2.support.HasInput; -import org.qi4j.library.struts2.support.StrutsAction; - -public interface ProvidesAddingOf<T> - extends Preparable, HasInput, StrutsAction -{ - T getState(); -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/add/ProvidesAddingOfMixin.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/add/ProvidesAddingOfMixin.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/add/ProvidesAddingOfMixin.java deleted file mode 100644 index 1315d51..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/add/ProvidesAddingOfMixin.java +++ /dev/null @@ -1,88 +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.support.add; - -import com.opensymphony.xwork2.ActionSupport; -import org.qi4j.api.entity.EntityBuilder; -import org.qi4j.api.injection.scope.Structure; -import org.qi4j.api.injection.scope.This; -import org.qi4j.api.unitofwork.UnitOfWork; -import org.qi4j.api.unitofwork.UnitOfWorkFactory; - -import static org.qi4j.library.struts2.util.ClassNames.classNameInDotNotation; -import static org.qi4j.library.struts2.util.ParameterizedTypes.findTypeVariables; - -public abstract class ProvidesAddingOfMixin<T> - extends ActionSupport - implements ProvidesAddingOf<T> -{ - - @This - private ProvidesAddingOf<T> action; - - @Structure - private UnitOfWorkFactory uowf; - - private EntityBuilder<T> builder; - - @Override - public T getState() - { - return builder.instance(); - } - - @Override - public void prepare() - throws Exception - { - prepareEntityBuilder(); - } - - @Override - public String input() - { - return INPUT; - } - - @Override - public String execute() - throws Exception - { - addSuccessMessage(); - return SUCCESS; - } - - @SuppressWarnings( "unchecked" ) - protected Class<T> typeToAdd() - { - return (Class<T>) findTypeVariables( action.getClass(), ProvidesAddingOf.class )[ 0 ]; - } - - protected void addSuccessMessage() - { - addActionMessage( getText( classNameInDotNotation( typeToAdd() ) + ".successfully.added" ) ); - } - - protected void prepareEntityBuilder() - throws Exception - { - UnitOfWork uow = uowf.currentUnitOfWork(); - builder = uow.newEntityBuilder( typeToAdd() ); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/edit/ProvidesEditingOf.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/edit/ProvidesEditingOf.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/edit/ProvidesEditingOf.java deleted file mode 100644 index 3f8419f..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/edit/ProvidesEditingOf.java +++ /dev/null @@ -1,31 +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.support.edit; - -import com.opensymphony.xwork2.Preparable; -import org.qi4j.library.struts2.support.HasInput; -import org.qi4j.library.struts2.support.ProvidesEntityOf; -import org.qi4j.library.struts2.support.StrutsAction; - -public interface ProvidesEditingOf<T> - extends ProvidesEntityOf<T>, Preparable, HasInput, StrutsAction -{ - void prepareInput() - throws Exception; -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/edit/ProvidesEditingOfMixin.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/edit/ProvidesEditingOfMixin.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/edit/ProvidesEditingOfMixin.java deleted file mode 100644 index b4f1bd0..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/edit/ProvidesEditingOfMixin.java +++ /dev/null @@ -1,63 +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.support.edit; - -import org.qi4j.api.injection.scope.This; -import org.qi4j.library.struts2.support.ProvidesEntityOfMixin; - -import static org.qi4j.library.struts2.util.ParameterizedTypes.findTypeVariables; - -public abstract class ProvidesEditingOfMixin<T> - extends ProvidesEntityOfMixin<T> - implements ProvidesEditingOf<T> -{ - - @This - private ProvidesEditingOf<T> action; - - @Override - public void prepare() - throws Exception - { - loadEntity(); - } - - @Override - public void prepareInput() - throws Exception - { - - } - - @Override - public String input() - { - if( getEntity() == null ) - { - return "entity-not-found"; - } - return INPUT; - } - - @Override - protected Class<T> typeToLoad() - { - return (Class<T>) findTypeVariables( action.getClass(), ProvidesEditingOf.class )[ 0 ]; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/list/ProvidesListOf.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/list/ProvidesListOf.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/list/ProvidesListOf.java deleted file mode 100644 index 06b2a95..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/list/ProvidesListOf.java +++ /dev/null @@ -1,28 +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.support.list; - -import com.opensymphony.xwork2.Preparable; -import org.qi4j.library.struts2.support.StrutsAction; - -public interface ProvidesListOf<T> - extends Preparable, StrutsAction -{ - Iterable<T> list(); -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/list/ProvidesListOfMixin.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/list/ProvidesListOfMixin.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/list/ProvidesListOfMixin.java deleted file mode 100644 index 57388f8..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/list/ProvidesListOfMixin.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.support.list; - -import com.opensymphony.xwork2.ActionSupport; -import org.qi4j.api.injection.scope.Structure; -import org.qi4j.api.injection.scope.This; -import org.qi4j.api.query.QueryBuilder; -import org.qi4j.api.query.QueryBuilderFactory; -import org.qi4j.api.unitofwork.UnitOfWork; -import org.qi4j.api.unitofwork.UnitOfWorkFactory; - -import static org.qi4j.library.struts2.util.ParameterizedTypes.findTypeVariables; - -public abstract class ProvidesListOfMixin<T> - extends ActionSupport - implements ProvidesListOf<T> -{ - - @This - private ProvidesListOf<T> action; - - @Structure - private UnitOfWorkFactory uowf; - - @Structure - private QueryBuilderFactory qbf; - - private Iterable<T> results; - - @Override - public Iterable<T> list() - { - return results; - } - - /** - * This is where we'll load the list of entities. Not because it is any better than the execute() method, I - * would actually prefer doing it in the execute method. But since these list actions can be the target - * of redirects after errors, actionErrors may not be empty which would mean execute() would never get called. - * One way around this would be to have a different interceptor stack just for these list actions that doesn't - * do validation, but for now we'll just use the prepare() method. We can change it easily enough later if this - * becomes an issue for some reason. - */ - @Override - public void prepare() - throws Exception - { - UnitOfWork uow = uowf.currentUnitOfWork(); - QueryBuilder<T> qb = qbf.newQueryBuilder( typeToList() ); - results = uow.newQuery( qb ); - } - - private Class<T> typeToList() - { - return (Class<T>) findTypeVariables( action.getClass(), ProvidesListOf.class )[ 0 ]; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/view/ProvidesViewOf.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/view/ProvidesViewOf.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/view/ProvidesViewOf.java deleted file mode 100644 index 17e4de9..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/view/ProvidesViewOf.java +++ /dev/null @@ -1,27 +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.support.view; - -import org.qi4j.library.struts2.support.ProvidesEntityOf; -import org.qi4j.library.struts2.support.StrutsAction; - -public interface ProvidesViewOf<T> - extends ProvidesEntityOf<T>, StrutsAction -{ -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/view/ProvidesViewOfMixin.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/view/ProvidesViewOfMixin.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/view/ProvidesViewOfMixin.java deleted file mode 100644 index b36d100..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/support/view/ProvidesViewOfMixin.java +++ /dev/null @@ -1,45 +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.support.view; - -import org.qi4j.api.injection.scope.This; -import org.qi4j.library.struts2.support.ProvidesEntityOfMixin; - -import static org.qi4j.library.struts2.util.ParameterizedTypes.findTypeVariables; - -public abstract class ProvidesViewOfMixin<T> - extends ProvidesEntityOfMixin<T> - implements ProvidesViewOf<T> -{ - @This - private ProvidesViewOf<T> action; - - @Override - public String execute() - { - loadEntity(); - return SUCCESS; - } - - @Override - protected Class<T> typeToLoad() - { - return (Class<T>) findTypeVariables( action.getClass(), ProvidesViewOf.class )[ 0 ]; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/util/ClassNameFilters.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/util/ClassNameFilters.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/util/ClassNameFilters.java deleted file mode 100644 index a49b50e..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/util/ClassNameFilters.java +++ /dev/null @@ -1,55 +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.util; - -public final class ClassNameFilters -{ - private ClassNameFilters() - { - } - - public static ClassNameMapper passThruMapper = new ClassNameMapper() - { - @Override - public String map( Class<?> type ) - { - return type.getName(); - } - }; - - public static ClassNameMapper removeSuffixes( final String... suffixes ) - { - return new ClassNameMapper() - { - @Override - public String map( Class<?> type ) - { - String className = type.getName(); - for( String suffix : suffixes ) - { - if( className.endsWith( suffix ) ) - { - return className.substring( 0, className.length() - suffix.length() ); - } - } - return className; - } - }; - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/util/ClassNameMapper.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/util/ClassNameMapper.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/util/ClassNameMapper.java deleted file mode 100644 index 3c0ad2d..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/util/ClassNameMapper.java +++ /dev/null @@ -1,27 +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.util; - -import org.qi4j.functional.Function; - -public interface ClassNameMapper extends Function<Class<?>,String> -{ - @Override - String map( Class<?> type ); -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/util/ClassNames.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/util/ClassNames.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/util/ClassNames.java deleted file mode 100644 index a853c11..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/util/ClassNames.java +++ /dev/null @@ -1,86 +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.util; - -import java.util.Arrays; -import org.qi4j.functional.Function; -import org.qi4j.functional.Iterables; - -import static java.lang.Character.isLowerCase; -import static java.lang.Character.toLowerCase; - -public final class ClassNames -{ - private ClassNames() - { - } - - public static String classNameInDotNotation( Class<?> type ) - { - Function<Class<?>, String> mapper = ClassNameFilters.passThruMapper; - Iterable<String> map = Iterables.map( mapper, Arrays.asList( type ) ); - return ClassNames.camelCaseToDotNotation( map ); - } - - public static String classNameInDotNotation( Iterable<Class<?>> type, ClassNameMapper mapper ) - { - Iterable<String> map = Iterables.map( mapper, type ); - return ClassNames.camelCaseToDotNotation( map ); - } - - public static String camelCaseToDotNotation( Iterable<String> names ) - { - StringBuilder sb = new StringBuilder(); - int count = 0; - for( String name : names ) - { - if( count++ > 0 ) - { - sb.append( "," ); - } - sb.append( camelCaseToDotNotation( name ) ); - } - if( count == 1 ) - { - return sb.toString(); - } - sb.append( "]" ); - return "[" + sb.toString(); - } - - private static String camelCaseToDotNotation( String name ) - { - StringBuilder sb = new StringBuilder( name.length() ); - sb.append( toLowerCase( name.charAt( 0 ) ) ); - for( int i = 1; i < name.length(); i++ ) - { - char c = name.charAt( i ); - if( isLowerCase( c ) ) - { - sb.append( c ); - } - else - { - sb.append( '.' ); - sb.append( toLowerCase( c ) ); - } - } - return sb.toString(); - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/util/ParameterizedTypes.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/util/ParameterizedTypes.java b/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/util/ParameterizedTypes.java deleted file mode 100644 index 9bdc79c..0000000 --- a/libraries/struts2-plugin/src/main/java/org/qi4j/library/struts2/util/ParameterizedTypes.java +++ /dev/null @@ -1,57 +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.util; - -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; - -public final class ParameterizedTypes -{ - private ParameterizedTypes() - { - } - - public static <S, T extends S> Type[] findTypeVariables( Class<T> type, Class<S> searchType ) - { - return ParameterizedTypes.findParameterizedType( type, searchType ).getActualTypeArguments(); - } - - public static <S, T extends S> ParameterizedType findParameterizedType( Class<T> type, Class<S> searchType ) - { - return ParameterizedTypes.findParameterizedType( (Type) type, searchType ); - } - - static ParameterizedType findParameterizedType( Type type, Type searchType ) - { - if( type instanceof ParameterizedType && ( (ParameterizedType) type ).getRawType().equals( searchType ) ) - { - return (ParameterizedType) type; - } - Type[] parents = ( (Class<?>) type ).getGenericInterfaces(); - for( Type parent : parents ) - { - ParameterizedType foundType = findParameterizedType( parent, searchType ); - if( foundType != null ) - { - return foundType; - } - } - return null; - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/resources/struts-plugin.xml ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/resources/struts-plugin.xml b/libraries/struts2-plugin/src/main/resources/struts-plugin.xml deleted file mode 100644 index 5eaf6f9..0000000 --- a/libraries/struts2-plugin/src/main/resources/struts-plugin.xml +++ /dev/null @@ -1,35 +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.ObjectFactory" name="qi4j" class="org.qi4j.library.struts2.Qi4jObjectFactory"/> - <constant name="struts.objectFactory" value="qi4j"/> - - <bean type="ognl.PropertyAccessor" name="org.qi4j.composite.Composite" - class="org.qi4j.library.struts2.Qi4jPropertyAccessor"/> -</struts> http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/main/resources/xwork-conversion.properties ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/main/resources/xwork-conversion.properties b/libraries/struts2-plugin/src/main/resources/xwork-conversion.properties deleted file mode 100644 index 54f24fd..0000000 --- a/libraries/struts2-plugin/src/main/resources/xwork-conversion.properties +++ /dev/null @@ -1,16 +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. - -org.qi4j.api.entity.EntityComposite=org.qi4j.library.struts2.EntityCompositeConverter \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/libraries/struts2-plugin/src/test/java/org/qi4j/library/struts2/util/ParameterizedTypesTest.java ---------------------------------------------------------------------- diff --git a/libraries/struts2-plugin/src/test/java/org/qi4j/library/struts2/util/ParameterizedTypesTest.java b/libraries/struts2-plugin/src/test/java/org/qi4j/library/struts2/util/ParameterizedTypesTest.java deleted file mode 100644 index 93a022d..0000000 --- a/libraries/struts2-plugin/src/test/java/org/qi4j/library/struts2/util/ParameterizedTypesTest.java +++ /dev/null @@ -1,59 +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.util; - -import org.junit.Test; - -import java.lang.reflect.ParameterizedType; - -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; - -public class ParameterizedTypesTest -{ - @Test - public void findParameterizedType() - { - assertEquals( - GarbageMan.class.getGenericInterfaces()[ 0 ], - ParameterizedTypes.findParameterizedType( GarbageMan.class, HandlerOf.class ) - ); - } - - @Test - public void findTypeVariables() - { - assertArrayEquals( - ((ParameterizedType) GarbageMan.class.getGenericInterfaces()[0]).getActualTypeArguments(), - ParameterizedTypes.findTypeVariables( GarbageMan.class, HandlerOf.class ) - ); - } - - static interface HandlerOf<T> - { - } - - static interface Trash - { - } - - static final class GarbageMan implements HandlerOf<Trash> - { - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/manual/src/docs/userguide/libraries.txt ---------------------------------------------------------------------- diff --git a/manual/src/docs/userguide/libraries.txt b/manual/src/docs/userguide/libraries.txt index ce7b579..1efdcde 100644 --- a/manual/src/docs/userguide/libraries.txt +++ b/manual/src/docs/userguide/libraries.txt @@ -144,18 +144,6 @@ include::../../../../libraries/sql/src/docs/sql.txt[] :leveloffset: 2 -include::../../../../libraries/struts2-codebehind/src/docs/struts-codebehind.txt[] - -:leveloffset: 2 - -include::../../../../libraries/struts2-convention/src/docs/struts-convention.txt[] - -:leveloffset: 2 - -include::../../../../libraries/struts2-plugin/src/docs/struts-plugin.txt[] - -:leveloffset: 2 - include::../../../../libraries/uid/src/docs/uid.txt[] :leveloffset: 2 http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/manual/src/docs/website/samples.txt ---------------------------------------------------------------------- diff --git a/manual/src/docs/website/samples.txt b/manual/src/docs/website/samples.txt index 93a3f1c..94737a4 100644 --- a/manual/src/docs/website/samples.txt +++ b/manual/src/docs/website/samples.txt @@ -101,13 +101,6 @@ user@host $ A gradle task `runSample` is defined in this module as a shortcut to run the example. See <<build-system>>. -[[sample-struts2,Struts2 Sample]] -== Struts2 Sample == - -Sample of how to use the Struts2 integration. - -https://github.com/Qi4j/qi4j-sdk/tree/develop/samples/struts2Hello[Browse Source] - [[sample-swing,Swing Bindings Sample]] == Swing Bindings Sample == http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/samples/struts2Hello/build.gradle ---------------------------------------------------------------------- diff --git a/samples/struts2Hello/build.gradle b/samples/struts2Hello/build.gradle deleted file mode 100644 index e7da3c3..0000000 --- a/samples/struts2Hello/build.gradle +++ /dev/null @@ -1,37 +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 = "Sample of how to use the Struts2 integration." - -jar { manifest { name = "Qi4j Sample - Struts2" }} - -dependencies { - compile(project(":org.qi4j.core:org.qi4j.core.bootstrap")) - compile(project(":org.qi4j.libraries:org.qi4j.library.struts2-plugin")) - compile(project(":org.qi4j.libraries:org.qi4j.library.struts2-codebehind")) - compile(project(":org.qi4j.extensions:org.qi4j.extension.indexing-rdf")) - compile(project(":org.qi4j.libraries:org.qi4j.library.constraints")) - compile(project(":org.qi4j.libraries:org.qi4j.library.rdf")) - compile(libraries.jetty_webapp) - - testCompile(project(":org.qi4j.core:org.qi4j.core.testsupport")) - - testRuntime(project(":org.qi4j.core:org.qi4j.core.runtime")) - testRuntime(libraries.logback) -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/samples/struts2Hello/src/main/java/org/qi4j/library/struts2/example/Item.java ---------------------------------------------------------------------- diff --git a/samples/struts2Hello/src/main/java/org/qi4j/library/struts2/example/Item.java b/samples/struts2Hello/src/main/java/org/qi4j/library/struts2/example/Item.java deleted file mode 100644 index 1a86e0f..0000000 --- a/samples/struts2Hello/src/main/java/org/qi4j/library/struts2/example/Item.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.example; - -import org.qi4j.api.entity.EntityComposite; - -public interface Item - extends Nameable, EntityComposite -{ -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/samples/struts2Hello/src/main/java/org/qi4j/library/struts2/example/JettyLauncher.java ---------------------------------------------------------------------- diff --git a/samples/struts2Hello/src/main/java/org/qi4j/library/struts2/example/JettyLauncher.java b/samples/struts2Hello/src/main/java/org/qi4j/library/struts2/example/JettyLauncher.java deleted file mode 100644 index ea5a838..0000000 --- a/samples/struts2Hello/src/main/java/org/qi4j/library/struts2/example/JettyLauncher.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.example; - -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.ServerConnector; -import org.eclipse.jetty.webapp.WebAppContext; - -public class JettyLauncher -{ - - public static void main( String[] args ) - { - Server server = new Server(); - - ServerConnector connector = new ServerConnector( server ); - connector.setPort( 8080 ); - server.addConnector( connector ); - - WebAppContext web = new WebAppContext( server, "struts2.example", "/example" ); - web.setWar( "libraries/struts2/example/src/main/webapp/" ); - - try - { - server.start(); - server.join(); - } - catch( Exception e ) - { - e.printStackTrace(); - System.exit( 100 ); - } - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/122a51b6/samples/struts2Hello/src/main/java/org/qi4j/library/struts2/example/Nameable.java ---------------------------------------------------------------------- diff --git a/samples/struts2Hello/src/main/java/org/qi4j/library/struts2/example/Nameable.java b/samples/struts2Hello/src/main/java/org/qi4j/library/struts2/example/Nameable.java deleted file mode 100644 index ccced4a..0000000 --- a/samples/struts2Hello/src/main/java/org/qi4j/library/struts2/example/Nameable.java +++ /dev/null @@ -1,27 +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.example; - -import org.qi4j.api.property.Property; - -public interface Nameable -{ - - Property<String> name(); -}
