geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r463283 - in /geronimo/plugins/spring/trunk: ./ example-web/ example-web/src/ example-web/src/webapp/ example-web/src/webapp/WEB-INF/ example/src/java/org/apache/geronimo/plugins/spring/example/ example/src/resources/ example/src/resources/...
Date Thu, 12 Oct 2006 15:35:10 GMT
Author: ammulder
Date: Thu Oct 12 08:35:09 2006
New Revision: 463283

URL: http://svn.apache.org/viewvc?view=rev&rev=463283
Log:
Working example Spring context with 2 beans
Working web application to view Spring context
  see http://localhost:8080/spring-example/

Added:
    geronimo/plugins/spring/trunk/example-web/
    geronimo/plugins/spring/trunk/example-web/pom.xml   (with props)
    geronimo/plugins/spring/trunk/example-web/src/
    geronimo/plugins/spring/trunk/example-web/src/webapp/
    geronimo/plugins/spring/trunk/example-web/src/webapp/WEB-INF/
    geronimo/plugins/spring/trunk/example-web/src/webapp/WEB-INF/geronimo-web.xml   (with
props)
    geronimo/plugins/spring/trunk/example-web/src/webapp/WEB-INF/web.xml   (with props)
    geronimo/plugins/spring/trunk/example-web/src/webapp/index.jsp   (with props)
    geronimo/plugins/spring/trunk/example-web/src/webapp/test.jsp   (with props)
    geronimo/plugins/spring/trunk/example/src/resources/
    geronimo/plugins/spring/trunk/example/src/resources/META-INF/
    geronimo/plugins/spring/trunk/example/src/resources/META-INF/geronimo-spring.xml   (with
props)
    geronimo/plugins/spring/trunk/example/src/resources/example-config.xml   (with props)
    geronimo/plugins/spring/trunk/modules/spring-integration-service/src/java/org/apache/geronimo/plugins/spring/SpringContextWrapper.java
  (with props)
Modified:
    geronimo/plugins/spring/trunk/example/src/java/org/apache/geronimo/plugins/spring/example/Austin.java
    geronimo/plugins/spring/trunk/modules/spring-integration-service/src/java/org/apache/geronimo/plugins/spring/SpringGBean.java
    geronimo/plugins/spring/trunk/pom.xml

Added: geronimo/plugins/spring/trunk/example-web/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/spring/trunk/example-web/pom.xml?view=auto&rev=463283
==============================================================================
--- geronimo/plugins/spring/trunk/example-web/pom.xml (added)
+++ geronimo/plugins/spring/trunk/example-web/pom.xml Thu Oct 12 08:35:09 2006
@@ -0,0 +1,72 @@
+<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>
+  <parent>
+    <groupId>org.apache.geronimo.plugins</groupId>
+    <artifactId>spring-parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <relativePath>../pom.xml</relativePath>
+  </parent>
+  <artifactId>example-web</artifactId>
+  <packaging>war</packaging>
+  <name>Sample Spring-Accessing Web Application</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-servlet_2.4_spec</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jsp_2.0_spec</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.geronimo.plugins</groupId>
+      <artifactId>spring-plugin-example</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>geronimo</groupId>
+      <artifactId>geronimo-kernel</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.geronimo.plugins</groupId>
+      <artifactId>spring-integration-service</artifactId>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <sourceDirectory>src/java</sourceDirectory>
+    <resources>
+      <resource>
+        <directory>src/resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <configuration>
+          <warSourceDirectory>src/webapp</warSourceDirectory>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

Propchange: geronimo/plugins/spring/trunk/example-web/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/plugins/spring/trunk/example-web/src/webapp/WEB-INF/geronimo-web.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/spring/trunk/example-web/src/webapp/WEB-INF/geronimo-web.xml?view=auto&rev=463283
==============================================================================
--- geronimo/plugins/spring/trunk/example-web/src/webapp/WEB-INF/geronimo-web.xml (added)
+++ geronimo/plugins/spring/trunk/example-web/src/webapp/WEB-INF/geronimo-web.xml Thu Oct
12 08:35:09 2006
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app
+        xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1">
+    <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
+        <moduleId>
+            <groupId>org.apache.geronimo.plugins</groupId>
+            <artifactId>SpringIntegrationExampleWeb</artifactId>
+        </moduleId>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.geronimo.plugins</groupId>
+                <artifactId>spring-plugin-example</artifactId>
+                <type>car</type>
+            </dependency>
+        </dependencies>
+    </environment>
+    <context-root>/spring-example</context-root>
+    <gbean-ref xmlns="http://geronimo.apache.org/xml/ns/naming-1.1">
+        <ref-name>spring/Example</ref-name>
+        <ref-type>org.apache.geronimo.plugins.spring.SpringContextWrapper</ref-type>
+        <pattern>
+            <name>SpringExampleContext</name>
+        </pattern>
+    </gbean-ref>
+</web-app>
\ No newline at end of file

Propchange: geronimo/plugins/spring/trunk/example-web/src/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/plugins/spring/trunk/example-web/src/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/spring/trunk/example-web/src/webapp/WEB-INF/web.xml?view=auto&rev=463283
==============================================================================
--- geronimo/plugins/spring/trunk/example-web/src/webapp/WEB-INF/web.xml (added)
+++ geronimo/plugins/spring/trunk/example-web/src/webapp/WEB-INF/web.xml Thu Oct 12 08:35:09
2006
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
+         version="2.4">
+
+</web-app>

Propchange: geronimo/plugins/spring/trunk/example-web/src/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/plugins/spring/trunk/example-web/src/webapp/index.jsp
URL: http://svn.apache.org/viewvc/geronimo/plugins/spring/trunk/example-web/src/webapp/index.jsp?view=auto&rev=463283
==============================================================================
--- geronimo/plugins/spring/trunk/example-web/src/webapp/index.jsp (added)
+++ geronimo/plugins/spring/trunk/example-web/src/webapp/index.jsp Thu Oct 12 08:35:09 2006
@@ -0,0 +1,22 @@
+<%@ page import="javax.naming.InitialContext" %>
+<%@ page import="org.apache.geronimo.plugins.spring.SpringContextWrapper" %>
+<html>
+  <head>
+    <title>Spring Context Test</title>
+  </head>
+  <body bgcolor="white">
+    <h1>Spring Context Test</h1>
+    <p>Looking for beans in Spring context:</p>
+    <dl>
+<%
+    SpringContextWrapper context = (SpringContextWrapper) new InitialContext().lookup("java:comp/env/spring/Example");
+    String[] names = context.getBeanDefinitionNames();
+    for (int i = 0; i < names.length; i++) {
+        String name = names[i];
+        out.println("<dt>"+name+"</dt>");
+        out.println("<dd>"+context.getBean(name)+"</dd>");
+    }
+%>
+    </dl>
+  </body>
+</html>
\ No newline at end of file

Propchange: geronimo/plugins/spring/trunk/example-web/src/webapp/index.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/plugins/spring/trunk/example-web/src/webapp/test.jsp
URL: http://svn.apache.org/viewvc/geronimo/plugins/spring/trunk/example-web/src/webapp/test.jsp?view=auto&rev=463283
==============================================================================
--- geronimo/plugins/spring/trunk/example-web/src/webapp/test.jsp (added)
+++ geronimo/plugins/spring/trunk/example-web/src/webapp/test.jsp Thu Oct 12 08:35:09 2006
@@ -0,0 +1,37 @@
+<%@ page import="org.apache.geronimo.kernel.config.MultiParentClassLoader" %>
+<%@ page import="java.net.URL" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<html>
+  <head><title>Diagnostics</title></head>
+  <body>
+    <p>Class Loader Parents:</p>
+    <ul>
+<%
+    ClassLoader mine = getClass().getClassLoader().getParent();
+    if (mine instanceof MultiParentClassLoader) {
+        MultiParentClassLoader cl = (MultiParentClassLoader) mine;
+        ClassLoader[] parents = cl.getParents();
+        for (int i = 0; i < parents.length; i++) {
+            ClassLoader temp = parents[i];
+            if (temp instanceof MultiParentClassLoader) {
+                MultiParentClassLoader parent = (MultiParentClassLoader) temp;
+                out.println("<li>Parent " + parent.getId());
+                URL[] urls = parent.getURLs();
+                out.println("<ul>");
+                for (int j = 0; j < urls.length; j++) {
+                    URL url = urls[j];
+                    out.println("<li>"+url+"</li>");
+                }
+                out.println("</ul>");
+                out.println("</li>");
+            } else {
+                out.println("<li>Parent not MPCL: " + temp.getClass().getName() + "</li>");
+            }
+        }
+    } else {
+        out.println("<li>Unknown CL type: " + mine.getClass().getName() + "</li>");
+    }
+%>
+    </ul>
+  </body>
+</html>
\ No newline at end of file

Propchange: geronimo/plugins/spring/trunk/example-web/src/webapp/test.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/plugins/spring/trunk/example/src/java/org/apache/geronimo/plugins/spring/example/Austin.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/spring/trunk/example/src/java/org/apache/geronimo/plugins/spring/example/Austin.java?view=diff&rev=463283&r1=463282&r2=463283
==============================================================================
--- geronimo/plugins/spring/trunk/example/src/java/org/apache/geronimo/plugins/spring/example/Austin.java
(original)
+++ geronimo/plugins/spring/trunk/example/src/java/org/apache/geronimo/plugins/spring/example/Austin.java
Thu Oct 12 08:35:09 2006
@@ -58,8 +58,8 @@
 
     public String toString() {
         return "food: " + food +
-        " drink: " + drink +
-        " music: " + music +
-        " year: " + year;
+        ", drink: " + drink +
+        ", music: " + music +
+        ", year: " + year;
     }
 }

Added: geronimo/plugins/spring/trunk/example/src/resources/META-INF/geronimo-spring.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/spring/trunk/example/src/resources/META-INF/geronimo-spring.xml?view=auto&rev=463283
==============================================================================
--- geronimo/plugins/spring/trunk/example/src/resources/META-INF/geronimo-spring.xml (added)
+++ geronimo/plugins/spring/trunk/example/src/resources/META-INF/geronimo-spring.xml Thu Oct
12 08:35:09 2006
@@ -0,0 +1,12 @@
+<contexts xmlns="http://geronimo.apache.org/xml/ns/plugins/spring-1.0">
+    <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
+        <moduleId>
+            <groupId>org.apache.geronimo.plugins</groupId>
+            <artifactId>spring-plugin-example</artifactId>
+        </moduleId>
+    </environment>
+    <context>
+        <name>SpringExampleContext</name>
+        <spring-config>example-config.xml</spring-config>
+    </context>
+</contexts>

Propchange: geronimo/plugins/spring/trunk/example/src/resources/META-INF/geronimo-spring.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/plugins/spring/trunk/example/src/resources/example-config.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/spring/trunk/example/src/resources/example-config.xml?view=auto&rev=463283
==============================================================================
--- geronimo/plugins/spring/trunk/example/src/resources/example-config.xml (added)
+++ geronimo/plugins/spring/trunk/example/src/resources/example-config.xml Thu Oct 12 08:35:09
2006
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       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.0.xsd">
+  <bean id="ApacheCon2006Bean" class="org.apache.geronimo.plugins.spring.example.Austin">
+      <property name="drink" value="Coke" />
+      <property name="food" value="Nachos" />
+      <property name="music" value="New Age" />
+      <property name="year" value="2006" />
+  </bean>
+  <bean id="ApacheCon2005" class="org.apache.geronimo.plugins.spring.example.Austin">
+      <property name="drink" value="Orange Juice" />
+      <property name="food" value="Fish" />
+      <property name="music" value="Jazz" />
+      <property name="year" value="2005" />
+  </bean>
+</beans>
\ No newline at end of file

Propchange: geronimo/plugins/spring/trunk/example/src/resources/example-config.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/plugins/spring/trunk/modules/spring-integration-service/src/java/org/apache/geronimo/plugins/spring/SpringContextWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/spring/trunk/modules/spring-integration-service/src/java/org/apache/geronimo/plugins/spring/SpringContextWrapper.java?view=auto&rev=463283
==============================================================================
--- geronimo/plugins/spring/trunk/modules/spring-integration-service/src/java/org/apache/geronimo/plugins/spring/SpringContextWrapper.java
(added)
+++ geronimo/plugins/spring/trunk/modules/spring-integration-service/src/java/org/apache/geronimo/plugins/spring/SpringContextWrapper.java
Thu Oct 12 08:35:09 2006
@@ -0,0 +1,32 @@
+package org.apache.geronimo.plugins.spring;
+
+import org.springframework.context.ApplicationContext;
+
+/**
+ * Used by components that want to access a Spring context
+ *
+ * @version $Rev: 410741 $ $Date: 2006-06-01 00:35:48 -0400 (Thu, 01 Jun 2006) $
+ */
+public interface SpringContextWrapper {
+    /**
+     * Gets the name of this context
+     */
+    public String getContextName();
+
+    /**
+     * Gets a reference to the Spring context.
+     * Warning: This method cannot be called by web applications in
+     *          Geronimo/Jetty 1.1.1.
+     */
+    public ApplicationContext getSpringContext();
+
+    /**
+     * Gets the names of the beans defined in the Spring context
+     */
+    public String[] getBeanDefinitionNames();
+
+    /**
+     * Gets a bean from the Spring context
+     */
+    public Object getBean(String name);
+}

Propchange: geronimo/plugins/spring/trunk/modules/spring-integration-service/src/java/org/apache/geronimo/plugins/spring/SpringContextWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/plugins/spring/trunk/modules/spring-integration-service/src/java/org/apache/geronimo/plugins/spring/SpringGBean.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/spring/trunk/modules/spring-integration-service/src/java/org/apache/geronimo/plugins/spring/SpringGBean.java?view=diff&rev=463283&r1=463282&r2=463283
==============================================================================
--- geronimo/plugins/spring/trunk/modules/spring-integration-service/src/java/org/apache/geronimo/plugins/spring/SpringGBean.java
(original)
+++ geronimo/plugins/spring/trunk/modules/spring-integration-service/src/java/org/apache/geronimo/plugins/spring/SpringGBean.java
Thu Oct 12 08:35:09 2006
@@ -65,6 +65,14 @@
         return springContext;
     }
 
+    public String[] getBeanDefinitionNames() {
+        return springContext.getBeanDefinitionNames();
+    }
+
+    public Object getBean(String name) {
+        return springContext.getBean(name);
+    }
+
     public void doStart() throws Exception {
         String config = getConfigFileName();
 

Modified: geronimo/plugins/spring/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/spring/trunk/pom.xml?view=diff&rev=463283&r1=463282&r2=463283
==============================================================================
--- geronimo/plugins/spring/trunk/pom.xml (original)
+++ geronimo/plugins/spring/trunk/pom.xml Thu Oct 12 08:35:09 2006
@@ -21,6 +21,7 @@
         <module>configs</module>
         <module>dependencies</module>
         <module>example</module>
+        <module>example-web</module>
     </modules>
 
     <repositories>
@@ -78,6 +79,11 @@
             <artifactId>spring-deployer-service</artifactId>
             <version>${spring-plugin-version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.plugins</groupId>
+            <artifactId>spring-plugin-example</artifactId>
+            <version>${spring-plugin-version}</version>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.geronimo.plugins</groupId>
@@ -236,6 +242,18 @@
             <groupId>stax</groupId>
             <artifactId>stax-api</artifactId>
             <version>1.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-servlet_2.4_spec</artifactId>
+            <version>1.0.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jsp_2.0_spec</artifactId>
+            <version>1.0.1</version>
         </dependency>
     </dependencies>
   </dependencyManagement>



Mime
View raw message