geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r481118 - in /geronimo/sandbox/gcache: client/ client/src/main/java/org/apache/geronimo/gcache/client/ client/src/main/java/org/apache/geronimo/gcache/transports/ client/src/main/xsd/ common/ common/src/main/java/org/apache/geronimo/gcache/...
Date Fri, 01 Dec 2006 00:23:34 GMT
Author: jgenender
Date: Thu Nov 30 16:23:31 2006
New Revision: 481118

URL: http://svn.apache.org/viewvc?view=rev&rev=481118
Log:
Refactoring and client work

Added:
    geronimo/sandbox/gcache/client/src/main/java/org/apache/geronimo/gcache/client/
    geronimo/sandbox/gcache/client/src/main/java/org/apache/geronimo/gcache/client/GCacheClient.java
    geronimo/sandbox/gcache/client/src/main/java/org/apache/geronimo/gcache/transports/ClientConnectionManager.java
    geronimo/sandbox/gcache/client/src/main/xsd/
    geronimo/sandbox/gcache/client/src/main/xsd/catalog.cat
    geronimo/sandbox/gcache/client/src/main/xsd/gcache-client.xsd
    geronimo/sandbox/gcache/common/src/main/java/org/apache/geronimo/gcache/transports/ConnectionManager.java
    geronimo/sandbox/gcache/common/src/main/xsd/
    geronimo/sandbox/gcache/common/src/main/xsd/gcache.xsd
Modified:
    geronimo/sandbox/gcache/client/pom.xml
    geronimo/sandbox/gcache/common/pom.xml
    geronimo/sandbox/gcache/server/src/main/java/org/apache/geronimo/gcache/transports/ServerConnectionManager.java

Modified: geronimo/sandbox/gcache/client/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/client/pom.xml?view=diff&rev=481118&r1=481117&r2=481118
==============================================================================
--- geronimo/sandbox/gcache/client/pom.xml (original)
+++ geronimo/sandbox/gcache/client/pom.xml Thu Nov 30 16:23:31 2006
@@ -17,6 +17,16 @@
 	<dependencies>
 
 		<dependency>
+			<groupId>com.sun.xml.bind</groupId>
+			<artifactId>jaxb-impl</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>javax.xml.bind</groupId>
+			<artifactId>jaxb-api</artifactId>
+		</dependency>
+
+		<dependency>
 			<groupId>org.testng</groupId>
 			<artifactId>testng</artifactId>
 			<classifier>jdk15</classifier>
@@ -34,6 +44,19 @@
 		</dependency>
 
 	</dependencies>
-	<build></build>
-
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>jaxb2-maven-plugin</artifactId>
+				<configuration>
+					<catalog>${basedir}/src/main/xsd/catalog.cat</catalog>
+					<packageName>
+						org.apache.geronimo.gcache.client.dd
+					</packageName>
+					<extension>true</extension>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
 </project>

Added: geronimo/sandbox/gcache/client/src/main/java/org/apache/geronimo/gcache/client/GCacheClient.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/client/src/main/java/org/apache/geronimo/gcache/client/GCacheClient.java?view=auto&rev=481118
==============================================================================
--- geronimo/sandbox/gcache/client/src/main/java/org/apache/geronimo/gcache/client/GCacheClient.java
(added)
+++ geronimo/sandbox/gcache/client/src/main/java/org/apache/geronimo/gcache/client/GCacheClient.java
Thu Nov 30 16:23:31 2006
@@ -0,0 +1,66 @@
+/*
+ * 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.geronimo.gcache.client;
+
+import net.sf.ehcache.CacheManager;
+
+import org.apache.geronimo.gcache.CacheInfoHolder;
+import org.apache.geronimo.gcache.transports.ClientConnectionManager;
+import org.apache.geronimo.gcache.transports.ConnectionManager;
+import org.apache.geronimo.gcache.transports.tcp.TCPClientCommandVisitor;
+
+public class GCacheClient {
+    
+    private CacheInfoHolder info;
+    private CacheManager cacheMgr;
+    private ConnectionManager connectionManager;
+
+    public void start() throws Exception {
+        // Create a cache with the configuration from the gcache-config file
+        //TODO - Pass a configuration file
+//        cacheMgr = new CacheManager(config.getEhcacheConfig());
+        cacheMgr = new CacheManager();
+        info = new CacheInfoHolder(cacheMgr);
+        info.setCommandVisitor(new TCPClientCommandVisitor(info));
+        
+        connectionManager = new ClientConnectionManager(info);
+//        connectionManager.setTransportURI(config.getTransportUri());
+//        connectionManager.setDiscoveryURI(config.getDiscoveryUri());
+        connectionManager.start();
+
+    }
+    
+    public void stop() throws Exception{
+        //TODO - Do we clear the cacheMgr??
+        connectionManager.stop();
+    }
+
+    public void put(String session, Object key, Object value) {
+
+    }
+
+    public void get(String session, Object key) {
+
+    }
+
+    public void remove(String session, Object key) {
+
+    }
+
+}

Added: geronimo/sandbox/gcache/client/src/main/java/org/apache/geronimo/gcache/transports/ClientConnectionManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/client/src/main/java/org/apache/geronimo/gcache/transports/ClientConnectionManager.java?view=auto&rev=481118
==============================================================================
--- geronimo/sandbox/gcache/client/src/main/java/org/apache/geronimo/gcache/transports/ClientConnectionManager.java
(added)
+++ geronimo/sandbox/gcache/client/src/main/java/org/apache/geronimo/gcache/transports/ClientConnectionManager.java
Thu Nov 30 16:23:31 2006
@@ -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.
+ */
+package org.apache.geronimo.gcache.transports;
+
+import org.apache.geronimo.gcache.CacheInfoHolder;
+import org.apache.geronimo.gcache.transports.discovery.DiscoveryAgentFactory;
+
+public class ClientConnectionManager extends ConnectionManager {
+    
+    public ClientConnectionManager(CacheInfoHolder info) {
+        super(info);
+    }
+    
+    @Override
+    public void start() throws Exception {
+        transport = TransportFactory.createTransportService(transportURI, info);
+        if (discoveryURI != null) {
+            discovery = DiscoveryAgentFactory.createDiscoveryAgent(discoveryURI, info);
+        }
+
+        transport.start();
+
+        if (discovery != null)
+            discovery.start();
+    }
+
+    @Override
+    public void stop() throws Exception {
+
+        if (discovery != null)
+            discovery.stop();
+
+        if (transport != null) {
+            transport.stop();
+        }
+    }
+
+}

Added: geronimo/sandbox/gcache/client/src/main/xsd/catalog.cat
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/client/src/main/xsd/catalog.cat?view=auto&rev=481118
==============================================================================
--- geronimo/sandbox/gcache/client/src/main/xsd/catalog.cat (added)
+++ geronimo/sandbox/gcache/client/src/main/xsd/catalog.cat Thu Nov 30 16:23:31 2006
@@ -0,0 +1 @@
+SYSTEM "http://geronimo.apache.org/xml/ns/gcache-1.0.xsd" "../../../../common/src/main/xsd/gcache.xsd"

Added: geronimo/sandbox/gcache/client/src/main/xsd/gcache-client.xsd
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/client/src/main/xsd/gcache-client.xsd?view=auto&rev=481118
==============================================================================
--- geronimo/sandbox/gcache/client/src/main/xsd/gcache-client.xsd (added)
+++ geronimo/sandbox/gcache/client/src/main/xsd/gcache-client.xsd Thu Nov 30 16:23:31 2006
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema
+	xmlns:gcache-client="http://geronimo.apache.org/xml/ns/gcache-client-1.0"
+	xmlns:gcache="http://geronimo.apache.org/xml/ns/gcache-1.0"
+	xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	targetNamespace="http://geronimo.apache.org/xml/ns/gcache-client-1.0"
+	elementFormDefault="qualified" attributeFormDefault="unqualified">
+
+	<xs:import namespace="http://geronimo.apache.org/xml/ns/gcache-1.0" schemaLocation="http://geronimo.apache.org/xml/ns/gcache-1.0.xsd"/>
+
+	<xs:element name="gcache-client-config"
+		type="gcache-client:gcacheClientConfigType" />
+
+	<xs:complexType name="gcacheClientConfigType">
+		<xs:sequence>
+			<xs:element name="transport" type="gcache:transportType"
+				minOccurs="1" maxOccurs="1" />
+			<xs:element name="diskStore" type="gcache:diskStoreType"
+				minOccurs="1" maxOccurs="1" />
+			<xs:element name="defaultCache"
+				type="gcache:defaultCacheType" minOccurs="1" maxOccurs="1" />
+			<xs:element name="cache" type="gcache:cacheType"
+				minOccurs="0" maxOccurs="unbounded" />
+		</xs:sequence>
+	</xs:complexType>
+
+</xs:schema>
\ No newline at end of file

Modified: geronimo/sandbox/gcache/common/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/common/pom.xml?view=diff&rev=481118&r1=481117&r2=481118
==============================================================================
--- geronimo/sandbox/gcache/common/pom.xml (original)
+++ geronimo/sandbox/gcache/common/pom.xml Thu Nov 30 16:23:31 2006
@@ -20,12 +20,12 @@
             <groupId>backport-util-concurrent</groupId>                
             <artifactId>backport-util-concurrent</artifactId>
         </dependency>
-
+        
         <dependency>
             <groupId>commons-logging</groupId>
             <artifactId>commons-logging</artifactId>
         </dependency>
-
+        
         <dependency>
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>

Added: geronimo/sandbox/gcache/common/src/main/java/org/apache/geronimo/gcache/transports/ConnectionManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/common/src/main/java/org/apache/geronimo/gcache/transports/ConnectionManager.java?view=auto&rev=481118
==============================================================================
--- geronimo/sandbox/gcache/common/src/main/java/org/apache/geronimo/gcache/transports/ConnectionManager.java
(added)
+++ geronimo/sandbox/gcache/common/src/main/java/org/apache/geronimo/gcache/transports/ConnectionManager.java
Thu Nov 30 16:23:31 2006
@@ -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.
+ */
+package org.apache.geronimo.gcache.transports;
+
+import java.net.URI;
+
+import org.apache.geronimo.gcache.CacheInfoHolder;
+import org.apache.geronimo.gcache.transports.discovery.DiscoveryAgent;
+
+public abstract class ConnectionManager {
+
+    protected CacheInfoHolder info;
+
+    protected URI transportURI;
+
+    protected URI discoveryURI;
+
+    protected TransportService transport;
+
+    protected DiscoveryAgent discovery;
+
+    public ConnectionManager(CacheInfoHolder info) {
+        super();
+        this.info = info;
+    }
+
+    public void setTransportURI(URI transportURI) {
+        this.transportURI = transportURI;
+    }
+
+    public void setDiscoveryURI(URI discoveryURI) {
+        this.discoveryURI = discoveryURI;
+    }
+
+    public abstract void start() throws Exception;
+
+    public abstract void stop() throws Exception;
+}

Added: geronimo/sandbox/gcache/common/src/main/xsd/gcache.xsd
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/common/src/main/xsd/gcache.xsd?view=auto&rev=481118
==============================================================================
--- geronimo/sandbox/gcache/common/src/main/xsd/gcache.xsd (added)
+++ geronimo/sandbox/gcache/common/src/main/xsd/gcache.xsd Thu Nov 30 16:23:31 2006
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:gcache="http://geronimo.apache.org/xml/ns/gcache-1.0"
+	xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+	targetNamespace="http://geronimo.apache.org/xml/ns/gcache-1.0"
+	version="1.0" attributeFormDefault="unqualified" jxb:version="2.0"
+	elementFormDefault="qualified">
+	
+	<xs:element name="gcache-config" type="gcache:gcacheConfigType" />
+	
+	<xs:complexType name="gcacheConfigType">
+		<xs:sequence>
+			<xs:element name="diskStore" type="gcache:diskStoreType"
+				minOccurs="1" maxOccurs="1" />
+			<xs:element name="defaultCache"
+				type="gcache:defaultCacheType" minOccurs="1" maxOccurs="1" />
+			<xs:element name="cache" type="gcache:cacheType"
+				minOccurs="0" maxOccurs="unbounded" />
+		</xs:sequence>
+	</xs:complexType>
+	
+	<xs:complexType name="diskStoreType">
+		<xs:attribute name="path" use="required" type="xs:NCName" />
+	</xs:complexType>
+	
+	<xs:complexType name="defaultCacheType">
+		<xs:attribute name="diskExpiryThreadIntervalSeconds"
+			type="xs:int" default="120" />
+		<xs:attribute name="diskPersistent" type="xs:boolean" />
+		<xs:attribute name="eternal" use="required" type="xs:boolean" />
+		<xs:attribute name="maxElementsInMemory" use="required"
+			type="xs:int" />
+		<xs:attribute name="memoryStoreEvictionPolicy"
+			type="gcache:evictionPolicyType" default="LRU">
+  			<xs:annotation>
+    			<xs:appinfo>
+                	<jxb:property>
+                    	<jxb:baseType>
+                        	<jxb:javaType name="String"
+                            	parseMethod="javax.xml.bind.DatatypeConverter.parseString"
+                            	printMethod="javax.xml.bind.DatatypeConverter.printString"/>
+                    	</jxb:baseType>
+                	</jxb:property>
+                </xs:appinfo>
+        	</xs:annotation>
+       	</xs:attribute>
+		<xs:attribute name="overflowToDisk" use="required"
+			type="xs:boolean" />
+		<xs:attribute name="timeToIdleSeconds" type="xs:int"
+			default="120" />
+		<xs:attribute name="timeToLiveSeconds" type="xs:int"
+			default="120" />
+	</xs:complexType>
+	
+	<xs:complexType name="cacheType">
+		<xs:attribute name="diskExpiryThreadIntervalSeconds"
+			type="xs:int" default="60" />
+		<xs:attribute name="diskPersistent" type="xs:boolean" />
+		<xs:attribute name="eternal" use="required" type="xs:boolean" />
+		<xs:attribute name="maxElementsInMemory" use="required"
+			type="xs:int" />
+		<xs:attribute name="memoryStoreEvictionPolicy"
+			type="gcache:evictionPolicyType" default="LRU">
+  			<xs:annotation>
+    			<xs:appinfo>
+                	<jxb:property>
+                    	<jxb:baseType>
+                        	<jxb:javaType name="String"
+                            	parseMethod="javax.xml.bind.DatatypeConverter.parseString"
+                            	printMethod="javax.xml.bind.DatatypeConverter.printString"/>
+                    	</jxb:baseType>
+                	</jxb:property>
+                </xs:appinfo>
+        	</xs:annotation>
+        </xs:attribute>
+		<xs:attribute name="name" use="required" type="xs:NCName" />
+		<xs:attribute name="overflowToDisk" use="required"
+			type="xs:boolean" />
+		<xs:attribute name="timeToIdleSeconds" type="xs:int"
+			default="0" />
+		<xs:attribute name="timeToLiveSeconds" type="xs:int"
+			default="0" />
+	</xs:complexType>
+	
+	<xs:simpleType name="evictionPolicyType">
+		<xs:restriction base="xs:string">
+			<xs:enumeration value="FIFO" />
+			<xs:enumeration value="LFU" />
+			<xs:enumeration value="LRU" />
+		</xs:restriction>
+	</xs:simpleType>
+	
+	<xs:complexType name="transportType">
+		<xs:attribute name="name" use="required" type="xs:NCName" />
+		<xs:attribute name="uri" use="required" type="xs:NCName" />
+		<xs:attribute name="discoveryUri" use="optional"
+			type="xs:NCName" />
+	</xs:complexType>
+	
+</xs:schema>
\ No newline at end of file

Modified: geronimo/sandbox/gcache/server/src/main/java/org/apache/geronimo/gcache/transports/ServerConnectionManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gcache/server/src/main/java/org/apache/geronimo/gcache/transports/ServerConnectionManager.java?view=diff&rev=481118&r1=481117&r2=481118
==============================================================================
--- geronimo/sandbox/gcache/server/src/main/java/org/apache/geronimo/gcache/transports/ServerConnectionManager.java
(original)
+++ geronimo/sandbox/gcache/server/src/main/java/org/apache/geronimo/gcache/transports/ServerConnectionManager.java
Thu Nov 30 16:23:31 2006
@@ -18,29 +18,17 @@
  */
 package org.apache.geronimo.gcache.transports;
 
-import java.net.URI;
-
 import org.apache.geronimo.gcache.CacheInfoHolder;
-import org.apache.geronimo.gcache.transports.discovery.DiscoveryAgent;
 import org.apache.geronimo.gcache.transports.discovery.DiscoveryAgentFactory;
 
-public class ServerConnectionManager {
-    private CacheInfoHolder info;
-
-    private URI transportURI;
-
-    private URI discoveryURI;
-
-    private TransportService transport;
-
-    private DiscoveryAgent discovery;
-
+public class ServerConnectionManager extends ConnectionManager{
+ 
     private String nodeName;
 
     private int order;
 
     public ServerConnectionManager(CacheInfoHolder info) {
-        this.info = info;
+        super(info);
     }
 
     public void start() throws Exception {
@@ -68,13 +56,7 @@
         }
     }
 
-    public void setTransportURI(URI transportURI) {
-        this.transportURI = transportURI;
-    }
 
-    public void setDiscoveryURI(URI discoveryURI) {
-        this.discoveryURI = discoveryURI;
-    }
 
     public void setNodeName(String nodeName) {
         this.nodeName = nodeName;



Mime
View raw message