Author: veithen Date: Sun Apr 11 14:01:10 2010 New Revision: 932907 URL: http://svn.apache.org/viewvc?rev=932907&view=rev Log: Initial code for the Axis2-Spring integration.
Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/ axis/axis2/java/core/scratch/spring/axis2-spring-x/pom.xml (with props) axis/axis2/java/core/scratch/spring/axis2-spring-x/src/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/AxisServiceFactory.java (with props) axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/ConfigurationBeanDefinitionParser.java (with props) axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/ConfigurationContextFactoryBean.java (with props) axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/Constants.java (with props) axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/NamespaceHandler.java (with props) axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/PojoAxisServiceFactory.java (with props) axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/PojoServiceBeanDefinitionParser.java (with props) axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringAxisConfigurator.java (with props) axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringAxisServlet.java (with props) axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringServiceObjectSupplier.java - copied, changed from r929196, axis/axis2/java/core/scratch/java/veithen/spring/axis2-spring-core/src/main/java/org/apache/axis2/spring/service/SpringServiceObjectSupplier.java axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/util/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/util/SingletonFactoryBean.java - copied unchanged from r929441, axis/axis2/java/core/scratch/java/veithen/spring/axis2-spring-core/src/main/java/org/apache/axis2/spring/util/SingletonFactoryBean.java axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/META-INF/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/META-INF/spring.handlers axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/META-INF/spring.schemas axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/schemas/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/schemas/axis2-spring.xsd axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/PojoTest.java (with props) axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/WeatherServiceServletRunner.java (with props) axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/WeatherSpringService.java - copied, changed from r929196, axis/axis2/java/core/scratch/java/veithen/spring/axis2-spring-core/src/test/java/org/apache/axis2/spring/service/WeatherSpringService.java axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/resources/ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/resources/log4j.properties - copied unchanged from r929077, axis/axis2/java/core/scratch/java/veithen/spring/axis2-spring-core/src/test/resources/log4j.properties axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/resources/pojo_test_context.xml (with props) Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/pom.xml?rev=932907&view=auto ============================================================================== --- axis/axis2/java/core/scratch/spring/axis2-spring-x/pom.xml (added) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/pom.xml Sun Apr 11 14:01:10 2010 @@ -0,0 +1,111 @@ +<?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. + --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <!-- TODO: parent, groupId and artifactId to be changed once we have decided whether the code + goes into the existing axis2-spring module, becomes a new module of the Axis2 (core) + project or becomes a new project --> + <parent> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-parent</artifactId> + <version>SNAPSHOT</version> + <!-- relativePath>../parent/pom.xml</relativePath --> + </parent> + <artifactId>axis2-spring-x</artifactId> + <name>Apache Axis2 - Spring integration</name> + <description>Spring support for Axis2</description> + <dependencies> + <dependency> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-kernel</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + <version>2.5.1</version> + </dependency> + <dependency> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-transport-http</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-transport-local</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.axis2</groupId> + <artifactId>axis2-adb</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mortbay.jetty</groupId> + <artifactId>jetty</artifactId> + <version>6.1.2</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <artifactId>maven-remote-resources-plugin</artifactId> + <executions> + <execution> + <id>legal-files</id> + <goals> + <goal>process</goal> + </goals> + <configuration> + <resourceBundles> + <resourceBundle>org.apache.axis2:axis2-resource-bundle:${project.version}</resourceBundle> + </resourceBundles> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> Propchange: axis/axis2/java/core/scratch/spring/axis2-spring-x/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/AxisServiceFactory.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/AxisServiceFactory.java?rev=932907&view=auto ============================================================================== --- axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/AxisServiceFactory.java (added) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/AxisServiceFactory.java Sun Apr 11 14:01:10 2010 @@ -0,0 +1,27 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.axis2.spring; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.engine.AxisConfiguration; + +public interface AxisServiceFactory { + AxisService create(AxisConfiguration axisConfiguration) throws AxisFault; +} Propchange: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/AxisServiceFactory.java ------------------------------------------------------------------------------ svn:eol-style = native Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/ConfigurationBeanDefinitionParser.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/ConfigurationBeanDefinitionParser.java?rev=932907&view=auto ============================================================================== --- axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/ConfigurationBeanDefinitionParser.java (added) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/ConfigurationBeanDefinitionParser.java Sun Apr 11 14:01:10 2010 @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.axis2.spring; + +import org.springframework.beans.factory.BeanDefinitionStoreException; +import org.springframework.beans.factory.support.AbstractBeanDefinition; +import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; +import org.springframework.beans.factory.xml.ParserContext; +import org.w3c.dom.Element; + +public class ConfigurationBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { + @Override + protected Class<?> getBeanClass(Element element) { + return ConfigurationContextFactoryBean.class; + } + + @Override + protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) + throws BeanDefinitionStoreException { + return Constants.CONFIGURATION_CONTEXT_BEAN_NAME; + } + + @Override + protected void doParse(Element element, BeanDefinitionBuilder builder) { + builder.addPropertyValue("axis2xml", element.getAttribute("axis2xml")); + builder.addPropertyValue("repository", element.getAttribute("repository")); + } +} Propchange: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/ConfigurationBeanDefinitionParser.java ------------------------------------------------------------------------------ svn:eol-style = native Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/ConfigurationContextFactoryBean.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/ConfigurationContextFactoryBean.java?rev=932907&view=auto ============================================================================== --- axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/ConfigurationContextFactoryBean.java (added) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/ConfigurationContextFactoryBean.java Sun Apr 11 14:01:10 2010 @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.axis2.spring; + +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.context.ConfigurationContextFactory; +import org.apache.axis2.deployment.URLBasedAxisConfigurator; +import org.apache.axis2.engine.AxisConfigurator; +import org.apache.axis2.spring.util.SingletonFactoryBean; +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.core.io.Resource; + +public class ConfigurationContextFactoryBean extends SingletonFactoryBean<ConfigurationContext> implements ApplicationContextAware { + private Resource axis2xml; + private Resource repository; + private ApplicationContext applicationContext; + + public ConfigurationContextFactoryBean() { + super(ConfigurationContext.class); + } + + public void setAxis2xml(Resource axis2xml) { + this.axis2xml = axis2xml; + } + + public void setRepository(Resource repository) { + this.repository = repository; + } + + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + this.applicationContext = applicationContext; + } + + @Override + protected ConfigurationContext create() throws Exception { + // TODO: need to use the appropriate AxisConfigurator implementation, depending on the type of resource and/or runtime environment + AxisConfigurator parentConfigurator = new URLBasedAxisConfigurator(axis2xml.getURL(), repository.getURL()); + return ConfigurationContextFactory.createConfigurationContext( + new SpringAxisConfigurator(parentConfigurator, applicationContext)); + } +} Propchange: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/ConfigurationContextFactoryBean.java ------------------------------------------------------------------------------ svn:eol-style = native Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/Constants.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/Constants.java?rev=932907&view=auto ============================================================================== --- axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/Constants.java (added) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/Constants.java Sun Apr 11 14:01:10 2010 @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.axis2.spring; + +public class Constants { + private Constants() {} + + public static final String CONFIGURATION_CONTEXT_BEAN_NAME = "_configurationContext"; +} Propchange: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/Constants.java ------------------------------------------------------------------------------ svn:eol-style = native Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/NamespaceHandler.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/NamespaceHandler.java?rev=932907&view=auto ============================================================================== --- axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/NamespaceHandler.java (added) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/NamespaceHandler.java Sun Apr 11 14:01:10 2010 @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.axis2.spring; + +import org.springframework.beans.factory.xml.NamespaceHandlerSupport; + +public class NamespaceHandler extends NamespaceHandlerSupport { + public void init() { + registerBeanDefinitionParser("configuration", new ConfigurationBeanDefinitionParser()); + registerBeanDefinitionParser("pojoService", new PojoServiceBeanDefinitionParser()); + } +} Propchange: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/NamespaceHandler.java ------------------------------------------------------------------------------ svn:eol-style = native Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/PojoAxisServiceFactory.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/PojoAxisServiceFactory.java?rev=932907&view=auto ============================================================================== --- axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/PojoAxisServiceFactory.java (added) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/PojoAxisServiceFactory.java Sun Apr 11 14:01:10 2010 @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.axis2.spring; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.Constants; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.engine.AxisConfiguration; + +public class PojoAxisServiceFactory implements AxisServiceFactory { + private Object serviceObject; + + public void setServiceObject(Object serviceObject) { + this.serviceObject = serviceObject; + } + + public AxisService create(AxisConfiguration axisConfiguration) throws AxisFault { + AxisService service = AxisService.createService(serviceObject.getClass().getName(), axisConfiguration); + service.addParameter(Constants.SERVICE_OBJECT_SUPPLIER, SpringServiceObjectSupplier.class.getName()); + service.addParameter(SpringServiceObjectSupplier.SERVICE_SPRING_BEANNAME, serviceObject); + return service; + } +} Propchange: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/PojoAxisServiceFactory.java ------------------------------------------------------------------------------ svn:eol-style = native Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/PojoServiceBeanDefinitionParser.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/PojoServiceBeanDefinitionParser.java?rev=932907&view=auto ============================================================================== --- axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/PojoServiceBeanDefinitionParser.java (added) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/PojoServiceBeanDefinitionParser.java Sun Apr 11 14:01:10 2010 @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.axis2.spring; + +import org.springframework.beans.factory.support.BeanDefinitionBuilder; +import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; +import org.w3c.dom.Element; + +public class PojoServiceBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { + @Override + protected Class<?> getBeanClass(Element element) { + return PojoAxisServiceFactory.class; + } + + @Override + protected boolean shouldGenerateId() { + return true; + } + + @Override + protected void doParse(Element element, BeanDefinitionBuilder builder) { + builder.addPropertyReference("serviceObject", element.getAttribute("bean")); + } +} Propchange: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/PojoServiceBeanDefinitionParser.java ------------------------------------------------------------------------------ svn:eol-style = native Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringAxisConfigurator.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringAxisConfigurator.java?rev=932907&view=auto ============================================================================== --- axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringAxisConfigurator.java (added) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringAxisConfigurator.java Sun Apr 11 14:01:10 2010 @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.axis2.spring; + +import org.apache.axis2.AxisFault; +import org.apache.axis2.engine.AxisConfiguration; +import org.apache.axis2.engine.AxisConfigurator; +import org.springframework.context.ApplicationContext; + +public class SpringAxisConfigurator implements AxisConfigurator { + private final AxisConfigurator parent; + private final ApplicationContext applicationContext; + private AxisConfiguration axisConfiguration; + + public SpringAxisConfigurator(AxisConfigurator parent, ApplicationContext applicationContext) { + this.parent = parent; + this.applicationContext = applicationContext; + } + + public AxisConfiguration getAxisConfiguration() throws AxisFault { + axisConfiguration = parent.getAxisConfiguration(); + return axisConfiguration; + } + + public void loadServices() { + parent.loadServices(); + for (Object factory : applicationContext.getBeansOfType(AxisServiceFactory.class).values()) { + try { + axisConfiguration.addService(((AxisServiceFactory)factory).create(axisConfiguration)); + } catch (AxisFault ex) { + throw new RuntimeException(ex); // TODO: better exception handling here! + } + } + } + + public void engageGlobalModules() throws AxisFault { + parent.engageGlobalModules(); + } + + public void cleanup() { + parent.cleanup(); + } +} Propchange: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringAxisConfigurator.java ------------------------------------------------------------------------------ svn:eol-style = native Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringAxisServlet.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringAxisServlet.java?rev=932907&view=auto ============================================================================== --- axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringAxisServlet.java (added) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringAxisServlet.java Sun Apr 11 14:01:10 2010 @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.axis2.spring; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; + +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.transport.http.AxisServlet; +import org.springframework.context.ApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +public class SpringAxisServlet extends AxisServlet { + @Override + protected ConfigurationContext initConfigContext(ServletConfig config) throws ServletException { + ApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext( + config.getServletContext()); + return (ConfigurationContext)applicationContext.getBean(Constants.CONFIGURATION_CONTEXT_BEAN_NAME); + } +} Propchange: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringAxisServlet.java ------------------------------------------------------------------------------ svn:eol-style = native Copied: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringServiceObjectSupplier.java (from r929196, axis/axis2/java/core/scratch/java/veithen/spring/axis2-spring-core/src/main/java/org/apache/axis2/spring/service/SpringServiceObjectSupplier.java) URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringServiceObjectSupplier.java?p2=axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringServiceObjectSupplier.java&p1=axis/axis2/java/core/scratch/java/veithen/spring/axis2-spring-core/src/main/java/org/apache/axis2/spring/service/SpringServiceObjectSupplier.java&r1=929196&r2=932907&rev=932907&view=diff ============================================================================== --- axis/axis2/java/core/scratch/java/veithen/spring/axis2-spring-core/src/main/java/org/apache/axis2/spring/service/SpringServiceObjectSupplier.java (original) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/java/org/apache/axis2/spring/SpringServiceObjectSupplier.java Sun Apr 11 14:01:10 2010 @@ -1,4 +1,4 @@ -package org.apache.axis2.spring.service; +package org.apache.axis2.spring; import org.apache.axis2.AxisFault; import org.apache.axis2.ServiceObjectSupplier; Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/META-INF/spring.handlers URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/META-INF/spring.handlers?rev=932907&view=auto ============================================================================== --- axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/META-INF/spring.handlers (added) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/META-INF/spring.handlers Sun Apr 11 14:01:10 2010 @@ -0,0 +1,19 @@ +# +# 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. +# +http\://axis.apache.org/axis2-spring=org.apache.axis2.spring.NamespaceHandler Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/META-INF/spring.schemas URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/META-INF/spring.schemas?rev=932907&view=auto ============================================================================== --- axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/META-INF/spring.schemas (added) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/META-INF/spring.schemas Sun Apr 11 14:01:10 2010 @@ -0,0 +1,20 @@ +# +# 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. +# +http\://svn.apache.org/repos/asf/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/schemas/axis2-spring.xsd=schemas/axis2-spring.xsd +https\://svn.apache.org/repos/asf/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/schemas/axis2-spring.xsd=schemas/axis2-spring.xsd Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/schemas/axis2-spring.xsd URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/schemas/axis2-spring.xsd?rev=932907&view=auto ============================================================================== --- axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/schemas/axis2-spring.xsd (added) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/schemas/axis2-spring.xsd Sun Apr 11 14:01:10 2010 @@ -0,0 +1,36 @@ +<?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. + --> +<schema xmlns="http://www.w3.org/2001/XMLSchema" + xmlns:beans="http://www.springframework.org/schema/beans" + targetNamespace="http://axis.apache.org/axis2-spring" + xmlns:tns="http://axis.apache.org/axis2-spring" elementFormDefault="qualified"> + <import namespace="http://www.springframework.org/schema/beans" schemaLocation="http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"/> + <element name="configuration"> + <complexType> + <attribute name="axis2xml" type="string" use="required"/> + <attribute name="repository" type="string" use="required"/> + </complexType> + </element> + <element name="pojoService"> + <complexType> + <attribute name="bean" use="required"/> + </complexType> + </element> +</schema> Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/PojoTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/PojoTest.java?rev=932907&view=auto ============================================================================== --- axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/PojoTest.java (added) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/PojoTest.java Sun Apr 11 14:01:10 2010 @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.axis2.spring; + +import junit.framework.TestCase; + +import org.apache.axis2.context.ConfigurationContext; +import org.apache.axis2.description.AxisService; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class PojoTest extends TestCase { + public void test() throws Exception { + ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext("pojo_test_context.xml"); + ConfigurationContext cfgCtx = (ConfigurationContext)appContext.getBean(Constants.CONFIGURATION_CONTEXT_BEAN_NAME); + AxisService service = cfgCtx.getAxisConfiguration().getServices().get("WeatherService"); + assertNotNull(service); + } +} Propchange: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/PojoTest.java ------------------------------------------------------------------------------ svn:eol-style = native Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/WeatherServiceServletRunner.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/WeatherServiceServletRunner.java?rev=932907&view=auto ============================================================================== --- axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/WeatherServiceServletRunner.java (added) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/WeatherServiceServletRunner.java Sun Apr 11 14:01:10 2010 @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.axis2.spring; + +import org.mortbay.jetty.Server; +import org.mortbay.jetty.servlet.Context; +import org.mortbay.jetty.servlet.ServletHolder; +import org.springframework.web.context.ContextLoaderListener; + +// Note: WSDL location is http://localhost:8080/services/WeatherService?wsdl +public class WeatherServiceServletRunner { + public static void main(String[] args) throws Exception { + Server server = new Server(8080); + Context context = new Context(server, "/", Context.SESSIONS); + ServletHolder holder = new ServletHolder(new SpringAxisServlet()); + context.addServlet(holder, "/services/*"); + context.getInitParams().put("contextConfigLocation", "pojo_test_context.xml"); + context.setResourceBase("src/test/resources"); + context.addEventListener(new ContextLoaderListener()); + server.start(); + } +} Propchange: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/WeatherServiceServletRunner.java ------------------------------------------------------------------------------ svn:eol-style = native Copied: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/WeatherSpringService.java (from r929196, axis/axis2/java/core/scratch/java/veithen/spring/axis2-spring-core/src/test/java/org/apache/axis2/spring/service/WeatherSpringService.java) URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/WeatherSpringService.java?p2=axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/WeatherSpringService.java&p1=axis/axis2/java/core/scratch/java/veithen/spring/axis2-spring-core/src/test/java/org/apache/axis2/spring/service/WeatherSpringService.java&r1=929196&r2=932907&rev=932907&view=diff ============================================================================== --- axis/axis2/java/core/scratch/java/veithen/spring/axis2-spring-core/src/test/java/org/apache/axis2/spring/service/WeatherSpringService.java (original) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/java/org/apache/axis2/spring/WeatherSpringService.java Sun Apr 11 14:01:10 2010 @@ -1,4 +1,4 @@ -package org.apache.axis2.spring.service; +package org.apache.axis2.spring; import javax.jws.WebMethod; import javax.jws.WebService; Added: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/resources/pojo_test_context.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/resources/pojo_test_context.xml?rev=932907&view=auto ============================================================================== --- axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/resources/pojo_test_context.xml (added) +++ axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/resources/pojo_test_context.xml Sun Apr 11 14:01:10 2010 @@ -0,0 +1,28 @@ +<?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. + --> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:axis2="http://axis.apache.org/axis2-spring" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://axis.apache.org/axis2-spring http://svn.apache.org/repos/asf/axis/axis2/java/core/scratch/spring/axis2-spring-x/src/main/resources/schemas/axis2-spring.xsd"> + <axis2:configuration axis2xml="classpath:org/apache/axis2/deployment/axis2_default.xml" repository="file:repository"/> + <axis2:pojoService bean="weatherService"/> + <bean id="weatherService" class="org.apache.axis2.spring.WeatherSpringService"/> +</beans> Propchange: axis/axis2/java/core/scratch/spring/axis2-spring-x/src/test/resources/pojo_test_context.xml ------------------------------------------------------------------------------ svn:eol-style = native