You are viewing a plain text version of this content. The canonical link for it is here.
Posted to nuvem-commits@incubator.apache.org by lr...@apache.org on 2011/02/12 07:07:20 UTC

svn commit: r1070036 - in /incubator/nuvem/trunk/nuvem-standalone-xmpp: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/sca/ src/main/java/org/apache/tusca...

Author: lresende
Date: Sat Feb 12 07:07:19 2011
New Revision: 1070036

URL: http://svn.apache.org/viewvc?rev=1070036&view=rev
Log:
Standalone XMPP server based on Vysper

Added:
    incubator/nuvem/trunk/nuvem-standalone-xmpp/
    incubator/nuvem/trunk/nuvem-standalone-xmpp/pom.xml   (with props)
    incubator/nuvem/trunk/nuvem-standalone-xmpp/src/
    incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/
    incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/
    incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/
    incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/
    incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/
    incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/
    incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/host/
    incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/host/xmpp/
    incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/host/xmpp/DefaultXMPPServer.java   (with props)
    incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/host/xmpp/XMPPServer.java   (with props)
    incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/resources/
    incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/resources/config/
    incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/resources/config/bogus_mina_tls.cert

Added: incubator/nuvem/trunk/nuvem-standalone-xmpp/pom.xml
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-standalone-xmpp/pom.xml?rev=1070036&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-standalone-xmpp/pom.xml (added)
+++ incubator/nuvem/trunk/nuvem-standalone-xmpp/pom.xml Sat Feb 12 07:07:19 2011
@@ -0,0 +1,86 @@
+<?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>
+    <parent>
+        <groupId>org.apache.nuvem</groupId>
+        <artifactId>nuvem</artifactId>
+        <version>1.0-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+	<artifactId>nuvem-cloud-standalone-xmpp</artifactId>
+	<name>Apache Nuvem Standalone XMPP Host</name>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.tuscany.sca</groupId>
+			<artifactId>tuscany-assembly</artifactId>
+			<version>${tuscany.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.vysper</groupId>
+			<artifactId>vysper-server</artifactId>
+			<type>pom</type>
+			<version>1.0.0-SNAPSHOT</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.vysper</groupId>
+			<artifactId>vysper-core</artifactId>
+			<version>1.0.0-SNAPSHOT</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.vysper</groupId>
+			<artifactId>vysper-extensions</artifactId>
+			<type>pom</type>
+			<version>1.0.0-SNAPSHOT</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<version>1.5.3</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-simple</artifactId>
+			<version>1.5.3</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>jcl-over-slf4j</artifactId>
+			<version>1.5.3</version>
+		</dependency>
+
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.8.1</version>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+</project>

Propchange: incubator/nuvem/trunk/nuvem-standalone-xmpp/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/nuvem/trunk/nuvem-standalone-xmpp/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/nuvem/trunk/nuvem-standalone-xmpp/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/host/xmpp/DefaultXMPPServer.java
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/host/xmpp/DefaultXMPPServer.java?rev=1070036&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/host/xmpp/DefaultXMPPServer.java (added)
+++ incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/host/xmpp/DefaultXMPPServer.java Sat Feb 12 07:07:19 2011
@@ -0,0 +1,114 @@
+/*
+ * 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.tuscany.sca.host.xmpp;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.vysper.mina.TCPEndpoint;
+import org.apache.vysper.stanzasession.StanzaSessionFactory;
+import org.apache.vysper.storage.StorageProviderRegistry;
+import org.apache.vysper.storage.inmemory.MemoryStorageProviderRegistry;
+import org.apache.vysper.xmpp.authorization.AccountManagement;
+import org.apache.vysper.xmpp.modules.extension.xep0049_privatedata.PrivateDataModule;
+import org.apache.vysper.xmpp.modules.extension.xep0054_vcardtemp.VcardTempModule;
+import org.apache.vysper.xmpp.modules.extension.xep0092_software_version.SoftwareVersionModule;
+import org.apache.vysper.xmpp.modules.extension.xep0119_xmppping.XmppPingModule;
+import org.apache.vysper.xmpp.modules.extension.xep0202_entity_time.EntityTimeModule;
+
+/**
+ * Default XMPP Server
+ */
+public class DefaultXMPPServer implements XMPPServer {
+    private static String DEFAULT_HOST = "localhost";
+    
+    org.apache.vysper.xmpp.server.XMPPServer server;
+
+    /**
+     * Default constructor
+     */
+    public DefaultXMPPServer() {
+     
+    }
+    
+    /**
+     * Start a Embedded XMPP Server
+     */
+    public void start() {
+        try {
+            StorageProviderRegistry providerRegistry = new MemoryStorageProviderRegistry();
+
+            final AccountManagement accountManagement = (AccountManagement)providerRegistry.retrieve(AccountManagement.class);
+
+            accountManagement.addUser("test@localhost", "password");
+            accountManagement.addUser("test2@localhost", "password");
+
+            server = new org.apache.vysper.xmpp.server.XMPPServer(DEFAULT_HOST);
+            server.addEndpoint(new TCPEndpoint());
+            server.addEndpoint(new StanzaSessionFactory());
+            server.setStorageProviderRegistry(providerRegistry);
+
+            server.setTLSCertificateInfo(new File("src/main/resources/config/bogus_mina_tls.cert"), "boguspw");
+
+            try {
+                server.start();
+                System.out.println("vysper server is running...");
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+
+            server.addModule(new SoftwareVersionModule());
+            server.addModule(new EntityTimeModule());
+            server.addModule(new VcardTempModule());
+            server.addModule(new XmppPingModule());
+            server.addModule(new PrivateDataModule());
+            
+            //server.addModule(new MUCModule());
+        } catch (Exception e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+    }
+
+    /**
+     * Stop the XMPP Server and perform any cleanup necessary
+     */
+    public void stop() {
+        server.stop();
+
+    }
+    
+    /**
+     * For debug/test purposes only
+     * @param args
+     * @throws IOException
+     */
+    public static void main(String args[]) throws IOException {
+        DefaultXMPPServer server = new DefaultXMPPServer();
+        server.start();
+        System.out.println("XMPP server started !!!");
+        System.in.read();
+        System.out.println("Stopping ...");
+        server.stop();
+        System.out.println();
+    }
+
+}

Propchange: incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/host/xmpp/DefaultXMPPServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/host/xmpp/DefaultXMPPServer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/host/xmpp/XMPPServer.java
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/host/xmpp/XMPPServer.java?rev=1070036&view=auto
==============================================================================
--- incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/host/xmpp/XMPPServer.java (added)
+++ incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/host/xmpp/XMPPServer.java Sat Feb 12 07:07:19 2011
@@ -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.tuscany.sca.host.xmpp;
+
+public interface XMPPServer {
+    
+    public void start();
+    
+    public void stop();
+
+}

Propchange: incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/host/xmpp/XMPPServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/java/org/apache/tuscany/sca/host/xmpp/XMPPServer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/resources/config/bogus_mina_tls.cert
URL: http://svn.apache.org/viewvc/incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/resources/config/bogus_mina_tls.cert?rev=1070036&view=auto
==============================================================================
Files incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/resources/config/bogus_mina_tls.cert (added) and incubator/nuvem/trunk/nuvem-standalone-xmpp/src/main/resources/config/bogus_mina_tls.cert Sat Feb 12 07:07:19 2011 differ