You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by tr...@apache.org on 2007/10/23 04:29:48 UTC

svn commit: r587364 [7/7] - in /mina/sandbox/asyncweb: ./ assembly/ assembly/src/ assembly/src/main/ assembly/src/main/descriptor/ core/ core/src/ core/src/main/ core/src/main/java/ core/src/main/java/org/ core/src/main/java/org/safehaus/ core/src/main...

Added: mina/sandbox/asyncweb/pom.xml
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/pom.xml?rev=587364&view=auto
==============================================================================
--- mina/sandbox/asyncweb/pom.xml (added)
+++ mina/sandbox/asyncweb/pom.xml Mon Oct 22 19:29:38 2007
@@ -0,0 +1,200 @@
+<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>
+  <groupId>org.safehaus.asyncweb</groupId>
+  <artifactId>asyncweb</artifactId>
+  <packaging>pom</packaging>
+  <version>0.9.0-SNAPSHOT</version>
+  <name>AsyncWeb</name>
+  <url>http://asyncweb.safehaus.org</url>
+  <inceptionYear>2006</inceptionYear>
+  <issueManagement>
+      <system>jira</system>
+      <url>http://jira.safehaus.org/browse/ASYNCWEB</url>
+  </issueManagement>
+  <developers>
+      <developer>
+          <id>dirving</id>
+          <name>Dave Irving</name>
+          <organization>Safehaus</organization>
+          <roles>
+              <role>Despot</role>
+              <role>Committer</role>
+          </roles>
+      </developer>
+      <developer>
+          <id>tbennett</id>
+          <name>Timothy Bennett</name>
+          <organization>Safehaus</organization>
+          <roles>
+              <role>Committer</role>
+          </roles>
+      </developer>
+      <developer>
+          <id>dandy</id>
+          <name>Dan Diephouse</name>
+          <roles>
+              <role>Committer</role>
+          </roles>
+      </developer>
+      <developer>
+          <id>trustin</id>
+          <name>Trustin Lee</name>
+          <roles>
+              <role>Committer</role>
+          </roles>
+      </developer>
+  </developers>
+  <licenses>
+      <license>
+          <name>The Apache Software License, Version 2.0</name>
+          <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+          <distribution>repo</distribution>
+      </license>
+  </licenses>
+  <scm>
+      <connection>
+          scm:svn:https://svn.safehaus.org/repos/asyncweb/trunk
+      </connection>
+      <developerConnection>
+          scm:svn:https://svn.safehaus.org/repos/asyncweb/trunk
+      </developerConnection>
+      <url>
+          https://svn.safehaus.org/repos/asyncweb/trunk
+      </url>
+  </scm>
+  <organization>
+      <name>Safehaus</name>
+      <url>http://www.safehaus.org/</url>
+  </organization>
+  <repositories>
+    <repository>
+      <id>apache.snapshots</id>
+      <name>Apache Snapshot Repository</name>
+      <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+      <releases>
+        <enabled>false</enabled>
+      </releases>
+    </repository>
+  </repositories>
+  <distributionManagement>
+    <repository>
+      <id>safehaus</id>
+      <url>
+        scp://safehaus.org/home/domains/m2_safehaus_org/public_html
+      </url>
+    </repository>
+    <snapshotRepository>
+      <id>safehaus</id>
+      <url>
+        scp://safehaus.org/home/domains/m2_safehaus_org/public_html
+      </url>
+    </snapshotRepository>
+  </distributionManagement>
+  <modules>
+    <module>core</module>
+    <module>springframework</module>
+    <module>example</module>
+  </modules>
+  <build>
+      <plugins>
+          <plugin>
+              <artifactId>maven-compiler-plugin</artifactId>
+              <configuration>
+                  <source>1.5</source>
+                  <target>1.5</target>
+              </configuration>
+          </plugin>
+          <plugin>
+              <artifactId>maven-release-plugin</artifactId>
+              <configuration>
+                  <tagBase>
+                      https://svn.safehaus.org/repos/asyncweb/tags
+                  </tagBase>
+              </configuration>
+          </plugin>
+      </plugins>
+  </build>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.safehaus.asyncweb</groupId>
+        <artifactId>asyncweb-core</artifactId>
+        <version>${pom.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.safehaus.asyncweb</groupId>
+        <artifactId>asyncweb-springframework</artifactId>
+        <version>${pom.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.safehaus.asyncweb</groupId>
+        <artifactId>asyncweb-example</artifactId>
+        <version>${pom.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>concurrent</groupId>
+        <artifactId>concurrent</artifactId>
+        <version>1.3.4</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.mina</groupId>
+        <artifactId>mina-core</artifactId>
+        <version>2.0.0-M1-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-log4j12</artifactId>
+        <version>1.0.1</version>
+      </dependency>
+      <dependency>
+        <groupId>commons-logging</groupId>
+        <artifactId>commons-logging</artifactId>
+        <version>1.1</version>
+      </dependency>
+      <dependency>
+        <groupId>log4j</groupId>
+        <artifactId>log4j</artifactId>
+        <version>1.2.13</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-core</artifactId>
+        <version>2.0</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-beans</artifactId>
+        <version>2.0</version>
+      </dependency>
+      <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-context</artifactId>
+        <version>2.0</version>
+      </dependency>
+      <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>3.8.1</version>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+  <dependencies>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>

Propchange: mina/sandbox/asyncweb/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/asyncweb/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: mina/sandbox/asyncweb/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: mina/sandbox/asyncweb/springframework/pom.xml
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/springframework/pom.xml?rev=587364&view=auto
==============================================================================
--- mina/sandbox/asyncweb/springframework/pom.xml (added)
+++ mina/sandbox/asyncweb/springframework/pom.xml Mon Oct 22 19:29:38 2007
@@ -0,0 +1,54 @@
+<!-- 
+	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>
+	<parent>
+		<groupId>org.safehaus.asyncweb</groupId>
+		<artifactId>asyncweb</artifactId>
+		<version>0.9.0-SNAPSHOT</version>
+	</parent>
+	<artifactId>asyncweb-springframework</artifactId>
+	<packaging>jar</packaging>
+	<name>AsyncWeb Springframework Integration</name>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.safehaus.asyncweb</groupId>
+			<artifactId>asyncweb-core</artifactId>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-core</artifactId>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-beans</artifactId>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-context</artifactId>
+			<scope>compile</scope>
+		</dependency>
+	</dependencies>
+</project>

Propchange: mina/sandbox/asyncweb/springframework/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/asyncweb/springframework/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: mina/sandbox/asyncweb/springframework/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: mina/sandbox/asyncweb/springframework/src/main/java/org/safehaus/asyncweb/integration/spring/HttpServiceLoader.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/springframework/src/main/java/org/safehaus/asyncweb/integration/spring/HttpServiceLoader.java?rev=587364&view=auto
==============================================================================
--- mina/sandbox/asyncweb/springframework/src/main/java/org/safehaus/asyncweb/integration/spring/HttpServiceLoader.java (added)
+++ mina/sandbox/asyncweb/springframework/src/main/java/org/safehaus/asyncweb/integration/spring/HttpServiceLoader.java Mon Oct 22 19:29:38 2007
@@ -0,0 +1,56 @@
+/*
+ *  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.safehaus.asyncweb.integration.spring;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.safehaus.asyncweb.service.HttpService;
+import org.safehaus.asyncweb.service.HttpServiceHandler;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+
+/**
+ * Loads all <code>HttpService</code>s defined in an
+ * <code>ApplicationContext</code> to an associated 
+ * <code>HttpServiceHandler</code>
+ * 
+ * @author irvingd
+ */
+public class HttpServiceLoader implements ApplicationContextAware {
+
+  private HttpServiceHandler handler;
+  
+  public void setHandler(HttpServiceHandler httpServiceHandler) {
+    this.handler = httpServiceHandler;
+  }
+  
+  public void setApplicationContext(ApplicationContext context) {
+    Map services = context.getBeansOfType(HttpService.class);
+    for (Iterator iter=services.entrySet().iterator(); iter.hasNext(); ) {
+      Map.Entry entry = (Map.Entry) iter.next();
+      String serviceName = (String) entry.getKey();
+      HttpService service = (HttpService) entry.getValue();
+      handler.addHttpService(serviceName, service);
+    }
+  }
+
+}

Propchange: mina/sandbox/asyncweb/springframework/src/main/java/org/safehaus/asyncweb/integration/spring/HttpServiceLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/asyncweb/springframework/src/main/java/org/safehaus/asyncweb/integration/spring/HttpServiceLoader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: mina/sandbox/asyncweb/springframework/src/main/java/org/safehaus/asyncweb/integration/spring/Main.java
URL: http://svn.apache.org/viewvc/mina/sandbox/asyncweb/springframework/src/main/java/org/safehaus/asyncweb/integration/spring/Main.java?rev=587364&view=auto
==============================================================================
--- mina/sandbox/asyncweb/springframework/src/main/java/org/safehaus/asyncweb/integration/spring/Main.java (added)
+++ mina/sandbox/asyncweb/springframework/src/main/java/org/safehaus/asyncweb/integration/spring/Main.java Mon Oct 22 19:29:38 2007
@@ -0,0 +1,99 @@
+/*
+ *  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.safehaus.asyncweb.integration.spring;
+
+import java.io.File;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.safehaus.asyncweb.service.ContainerLifecycleException;
+import org.safehaus.asyncweb.service.ServiceContainer;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+
+
+/**
+ * Simple stand-alone server which loads configuration using Spring
+ * 
+ * @author irvingd
+ *
+ */
+public class Main {
+  
+  private static final Log LOG = LogFactory.getLog(Main.class);
+  
+  private static final String CONFIG_PROPERTY         = "asyncWeb.config";
+  private static final String SERVICE_CONFIG_PROPERTY = "asyncWeb.config.services";
+  private static final String DEFAULT_SERVICE_CONFIG  = "httpServiceDefinitions";
+  
+  private String configDir;
+  private String serviceConfigName;
+  
+  /**
+   * @param asyncWebDir The async web base directory
+   */
+  public Main(File asyncWebDir) {
+    this(asyncWebDir, DEFAULT_SERVICE_CONFIG);
+  }
+  
+  /**
+   * @param asyncWebDir         The async web configuration directory - containing the
+   *                          <code>AsyncWeb.xml</code> configuration file
+   * @param serviceConfigName The name of the directory within <code>configDir</code>
+   *                          containing service definitions
+   */
+  public Main(File asyncWebDir, String serviceConfigName) {
+    if (!asyncWebDir.isDirectory()) {
+      throw new IllegalArgumentException("Could not find asyncWeb directory: " + asyncWebDir);
+    }
+    this.configDir = asyncWebDir.getAbsolutePath() + "/";
+    this.serviceConfigName = serviceConfigName;
+  }
+  
+  /**
+   * Uses system properties to determine the asyncWeb configuration directory,
+   * and (optionally) the service configuration directory contained within
+   */
+  Main() {
+    configDir = System.getProperty(CONFIG_PROPERTY);
+    configDir = configDir == null ? "AsyncWeb/" : (configDir + "/");
+    serviceConfigName = System.getProperty(SERVICE_CONFIG_PROPERTY, 
+                                           DEFAULT_SERVICE_CONFIG); 
+  }
+  
+  public void start() {
+    String[] configs = new String[] { configDir + "conf/AsyncWeb.xml", configDir + 
+                                      "conf/" + serviceConfigName + "/*.xml"};
+    ApplicationContext ctx = new FileSystemXmlApplicationContext(configs);
+    ServiceContainer container = (ServiceContainer) ctx.getBean("container");
+    try {
+      container.start();
+    } catch (ContainerLifecycleException e) {
+      LOG.error("Failed to start container", e);
+      System.exit(1);
+    }
+    LOG.info("AsyncWeb server started");    
+  }
+  
+  
+  public static void main(String[] args) throws Exception {  
+    new Main().start();  
+  }
+}

Propchange: mina/sandbox/asyncweb/springframework/src/main/java/org/safehaus/asyncweb/integration/spring/Main.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/sandbox/asyncweb/springframework/src/main/java/org/safehaus/asyncweb/integration/spring/Main.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date