You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by gd...@apache.org on 2004/05/11 14:25:00 UTC
cvs commit: incubator-geronimo/sandbox/webdav/src/test/org/apache/geronimo/datastore/impl/remote/replication ReplicationTest.java
gdamour 2004/05/11 05:25:00
Modified: sandbox/webdav/src/java/org/apache/geronimo/datastore/impl
GFileDAO.java GFileDelegateImpl.java GFileImpl.java
GFileStateManager.java GFileDelegate.java
AbstractGFileManager.java
sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/local
LocalGFileManager.java
sandbox/webdav project.xml
Added: sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/remote
GFileManagerClient.java GFileManagerProxy.java
sandbox/webdav/src/test/org/apache/geronimo/datastore/impl/remote
RemoteUseCaseTest.java
Removed: sandbox/webdav/src/test/org/apache/geronimo/datastore/impl/remote/datastore
RemoteUseCaseTest.java
sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/remote/datastore
GFileStub.java GFileManagerProxy.java
GFileManagerClient.java
sandbox/webdav/src/test/org/apache/geronimo/datastore/impl/remote/messaging
TopologyTest.java IndexedMapTest.java
CommandRequestTest.java DummyConnector.java
NodeTest.java
sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/remote/messaging
QueueOutInterceptor.java
CommunicationException.java MsgHeader.java
MsgHeaderConstants.java HeaderInInterceptor.java
StreamInInterceptor.java MsgQueue.java
NodeProcessors.java Connector.java
AbstractConnector.java StreamManagerImpl.java
Processor.java NodeImpl.java
MsgInterceptorStoppedException.java
StreamOutInterceptor.java RequestSender.java
MsgCopier.java StreamInputStream.java Node.java
MsgBody.java MsgInInterceptor.java Processors.java
HeaderOutInterceptor.java Topology.java
HeaderReactor.java GInputStream.java
MsgOutInterceptor.java QueueInInterceptor.java
StreamOutputStream.java CommandResult.java
CommandRequest.java NodeContext.java
IndexedMap.java StreamManager.java Msg.java
NodeInfo.java MetaConnection.java
sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/remote/replication
ReplicationMember.java UpdateEvent.java
UpdateListener.java SimpleReplicatedMap.java
ReplicationMemberImpl.java ReplicationCapable.java
ReplicationException.java
sandbox/webdav/src/test/org/apache/geronimo/datastore/impl/remote/replication
ReplicationTest.java
Log:
Refactoring to use geronimo-sandbox-messaging as the mean to
implement the remote part of the GFileManager service.
Revision Changes Path
1.1 incubator-geronimo/sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/remote/GFileManagerClient.java
Index: GFileManagerClient.java
===================================================================
/**
*
* Copyright 2004 The Apache Software Foundation
*
* Licensed 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.datastore.impl.remote;
import net.sf.cglib.proxy.Callback;
import net.sf.cglib.proxy.MethodInterceptor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.datastore.GFile;
import org.apache.geronimo.datastore.GFileManager;
import org.apache.geronimo.datastore.GFileManagerException;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoFactory;
import org.apache.geronimo.messaging.AbstractEndPoint;
import org.apache.geronimo.messaging.Node;
import org.apache.geronimo.messaging.NodeInfo;
import org.apache.geronimo.messaging.interceptors.MsgOutInterceptor;
import org.apache.geronimo.messaging.util.EndPointCallback;
import org.apache.geronimo.messaging.util.ProxyFactory;
/**
* GFileManager mirroring a GFileManagerProxy mounted by a remote node.
* <BR>
* Operations peformed against this instance are actually executed against the
* remote GFileManagerProxy having the same name than this instance.
*
* @version $Revision: 1.1 $ $Date: 2004/05/11 12:24:59 $
*/
public class GFileManagerClient
extends AbstractEndPoint
implements GFileManager
{
private static final Log log = LogFactory.getLog(GFileManagerClient.class);
/**
* Name of the proxy to be mirrored.
*/
private final String name;
/**
* Node hosting the proxy to be mirrored.
*/
private final NodeInfo node;
private GFileManager remoteThis;
/**
* EndPointCallback used under the cover by otherMembers.
*/
private final EndPointCallback endPointCallback;
/**
* Creates a client having the specified name. The name MUST be the name
* of the proxy to be mirrored.
*
* @param aNode Node hosting the proxy.
* @param aName Name of the proxy to be mirrored.
* @param aNodeInfo Node hosting the proxy to be mirrored.
*/
public GFileManagerClient(Node aNode,
String aName, NodeInfo aNodeInfo) {
super(aNode, aName);
if ( null == aName ) {
throw new IllegalArgumentException("Name is required.");
} else if ( null == aNode ) {
throw new IllegalArgumentException("Node is required.");
}
name = aName;
node = aNodeInfo;
endPointCallback = new EndPointCallback(sender);
endPointCallback.setEndPointId(aName);
endPointCallback.setTargets(new NodeInfo[] {aNodeInfo});
ProxyFactory factory =
new ProxyFactory(new Class[] {GFileManager.class},
new Callback[] {endPointCallback},
new Class[] {MethodInterceptor.class}, null);
remoteThis = (GFileManager) factory.getProxy();
}
public String getName() {
return name;
}
/**
* Gets the NodeInfo of the node hosting the GFileManagerProxy mirrored by
* this instance.
*
* @return Hosting node info.
*/
public NodeInfo getHostingNode() {
return node;
}
public void setMsgProducerOut(MsgOutInterceptor aMsgOut) {
super.setMsgProducerOut(aMsgOut);
endPointCallback.setOut(out);
}
public Object startInteraction() {
return remoteThis.startInteraction();
}
public GFile factoryGFile(Object anOpaque, String aPath)
throws GFileManagerException {
return remoteThis.factoryGFile(anOpaque, aPath);
}
public void persistNew(Object anOpaque, GFile aFile) {
remoteThis.persistNew(anOpaque, aFile);
}
public void persistUpdate(Object anOpaque, GFile aFile) {
remoteThis.persistUpdate(anOpaque, aFile);
}
public void persistDelete(Object anOpaque, GFile aFile) {
remoteThis.persistDelete(anOpaque, aFile);
}
public void endInteraction(Object anOpaque) throws GFileManagerException {
remoteThis.endInteraction(anOpaque);
}
public static final GBeanInfo GBEAN_INFO;
static {
GBeanInfoFactory factory = new GBeanInfoFactory(GFileManagerClient.class, AbstractEndPoint.GBEAN_INFO);
factory.setConstructor(
new String[] {"Node", "ID", "HostingNode"},
new Class[] {Node.class, String.class, NodeInfo.class});
factory.addAttribute("HostingNode", true);
GBEAN_INFO = factory.getBeanInfo();
}
public static GBeanInfo getGBeanInfo() {
return GBEAN_INFO;
}
}
1.1 incubator-geronimo/sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/remote/GFileManagerProxy.java
Index: GFileManagerProxy.java
===================================================================
/**
*
* Copyright 2004 The Apache Software Foundation
*
* Licensed 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.datastore.impl.remote;
import org.apache.geronimo.datastore.GFile;
import org.apache.geronimo.datastore.GFileManager;
import org.apache.geronimo.datastore.GFileManagerException;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoFactory;
import org.apache.geronimo.messaging.AbstractEndPoint;
import org.apache.geronimo.messaging.Node;
/**
* It is a wrapper/proxy for a GFileManager, whose services need to be exposed
* via a Node.
*
* @version $Revision: 1.1 $ $Date: 2004/05/11 12:24:59 $
*/
public class GFileManagerProxy
extends AbstractEndPoint
implements GFileManager
{
/**
* Proxied GFileManager.
*/
private final GFileManager fileManager;
/**
* Builds a proxy for the provided GFileManager.
*
* @param aNode Node containing this instance.
* @param aFileManager GFileManager to be proxied by this instance.
*/
public GFileManagerProxy(Node aNode,
GFileManager aFileManager) {
super(aNode, aFileManager.getName());
if ( null == aFileManager ) {
throw new IllegalArgumentException("GFileManager is required.");
}
fileManager = aFileManager;
}
public String getName() {
return fileManager.getName();
}
public GFile factoryGFile(Object anOpaque, String aPath)
throws GFileManagerException {
return fileManager.factoryGFile(anOpaque, aPath);
}
public void persistNew(Object anOpaque, GFile aFile) {
fileManager.persistNew(anOpaque, aFile);
}
public void persistUpdate(Object anOpaque, GFile aFile) {
fileManager.persistUpdate(anOpaque, aFile);
}
public void persistDelete(Object anOpaque, GFile aFile) {
fileManager.persistDelete(anOpaque, aFile);
}
public Object startInteraction() {
return fileManager.startInteraction();
}
public void endInteraction(Object anOpaque) throws GFileManagerException {
fileManager.endInteraction(anOpaque);
}
public static final GBeanInfo GBEAN_INFO;
static {
GBeanInfoFactory factory = new GBeanInfoFactory(GFileManagerProxy.class, AbstractEndPoint.GBEAN_INFO);
factory.setConstructor(
new String[] {"Node", "Delegate"},
new Class[] {Node.class, GFileManager.class});
factory.addReference("Delegate", GFileManager.class);
GBEAN_INFO = factory.getBeanInfo();
}
public static GBeanInfo getGBeanInfo() {
return GBEAN_INFO;
}
}
1.2 +3 -4 incubator-geronimo/sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/GFileDAO.java
Index: GFileDAO.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/GFileDAO.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GFileDAO.java 25 Feb 2004 13:36:16 -0000 1.1
+++ GFileDAO.java 11 May 2004 12:24:59 -0000 1.2
@@ -63,8 +63,9 @@
public void delete(String aPath) throws DAOException;
/**
- * Gets the children of the file identified by the provided path.
+ * Gets the children of the directory identified by the provided path.
*
+ * @param aPath Directory path.
* @return Children.
* @throws DAOException If a DAO error has occured.
*/
@@ -78,8 +79,6 @@
/**
* Unflushes the updates performed since the last flush operation.
- *
- * @throws DAOException If a DAO error has occured.
*/
public void unflush();
1.2 +1 -5 incubator-geronimo/sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/GFileDelegateImpl.java
Index: GFileDelegateImpl.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/GFileDelegateImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GFileDelegateImpl.java 25 Feb 2004 13:36:16 -0000 1.1
+++ GFileDelegateImpl.java 11 May 2004 12:24:59 -0000 1.2
@@ -25,8 +25,6 @@
import java.util.Iterator;
import java.util.Map;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.datastore.GFile;
/**
@@ -38,8 +36,6 @@
implements GFileDelegate
{
- private static final Log log = LogFactory.getLog(GFileDelegateImpl.class);
-
/**
* Lock manager to be used to lock GFile.
*/
1.2 +4 -7 incubator-geronimo/sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/GFileImpl.java
Index: GFileImpl.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/GFileImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GFileImpl.java 25 Feb 2004 13:36:16 -0000 1.1
+++ GFileImpl.java 11 May 2004 12:24:59 -0000 1.2
@@ -23,6 +23,7 @@
import java.util.Map;
import org.apache.geronimo.datastore.GFile;
+import org.apache.geronimo.messaging.reference.Referenceable;
/**
* GFile implementation.
@@ -30,7 +31,7 @@
* @version $Revision$ $Date$
*/
public class GFileImpl
- implements GFile
+ implements GFile, Referenceable
{
/**
@@ -39,11 +40,6 @@
private String path;
/**
- * Properties of the file.
- */
- private Map properties;
-
- /**
* New content of the file.
*/
private InputStream content;
@@ -62,6 +58,7 @@
* Creates a GFile having the specified path.
*
* @param aPath Path of this file.
+ * @param aManager StateManager tracking the state of this instance.
*/
public GFileImpl(String aPath, GFileStateManager aManager) {
if ( null == aPath ) {
1.2 +3 -4 incubator-geronimo/sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/GFileStateManager.java
Index: GFileStateManager.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/GFileStateManager.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GFileStateManager.java 25 Feb 2004 13:36:16 -0000 1.1
+++ GFileStateManager.java 11 May 2004 12:24:59 -0000 1.2
@@ -48,10 +48,9 @@
private GFileDelegateImpl delegate;
/**
- * Creates a StateManager for the provided GFile. Interactions with the
- * data store will be performed by the provided DAO.
+ * Creates a StateManager. Interactions with the data store will be
+ * performed by the provided DAO.
*
- * @param aFile GFile.
* @param aFileDAO DAO to be used to query/update the data store.
* @param aDirtyMarker Initial life cycle state of the provided file.
*/
1.2 +11 -11 incubator-geronimo/sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/GFileDelegate.java
Index: GFileDelegate.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/GFileDelegate.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GFileDelegate.java 25 Feb 2004 13:36:16 -0000 1.1
+++ GFileDelegate.java 11 May 2004 12:24:59 -0000 1.2
@@ -31,16 +31,16 @@
public interface GFileDelegate
{
- public boolean exists();
- public boolean isDirectory();
- public boolean isFile();
- public String[] listFiles();
- public void lock();
- public void unlock();
- public Map getProperties();
+ public boolean exists() throws IOException;
+ public boolean isDirectory() throws IOException;
+ public boolean isFile() throws IOException;
+ public String[] listFiles() throws IOException;
+ public void lock() throws IOException;
+ public void unlock() throws IOException;
+ public Map getProperties() throws IOException;
public InputStream getInputStream() throws IOException;
- public Map getPropertiesByName(Collection aCollOfNames);
- public void addProperty(String aName, String aValue);
- public void removeProperty(String aName);
+ public Map getPropertiesByName(Collection aCollOfNames) throws IOException;
+ public void addProperty(String aName, String aValue) throws IOException;
+ public void removeProperty(String aName) throws IOException;
}
1.4 +4 -13 incubator-geronimo/sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/AbstractGFileManager.java
Index: AbstractGFileManager.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/AbstractGFileManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractGFileManager.java 24 Mar 2004 11:42:57 -0000 1.3
+++ AbstractGFileManager.java 11 May 2004 12:24:59 -0000 1.4
@@ -64,17 +64,6 @@
private final Map interToStateManagers;
/**
- * Indicates if an interaction is started. We are between a start and a
- * end invocation.
- */
- private boolean isStarted;
-
- /**
- * Used to perform isStarted operation.
- */
- private final Object stateLock = new Object();
-
- /**
* Name of this GFileManager.
*/
protected final String name;
@@ -217,6 +206,8 @@
*
* @param anOpaque An opaque object identifying the interaction whose
* StateManagers need to be retrieved.
+ * @return Set of StateManagers related to the interaction identified by
+ * anOpaque.
* @throws IllegalStateException Indicates that the provided identifier
* does not define an interaction.
*/
@@ -238,7 +229,7 @@
public void doStop() throws WaitingException, Exception {}
- public void doFail() {};
+ public void doFail() {}
public static final GBeanInfo GBEAN_INFO;
1.5 +94 -22 incubator-geronimo/sandbox/webdav/src/test/org/apache/geronimo/datastore/impl/remote/RemoteUseCaseTest.java
1.3 +6 -6 incubator-geronimo/sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/local/LocalGFileManager.java
Index: LocalGFileManager.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/sandbox/webdav/src/java/org/apache/geronimo/datastore/impl/local/LocalGFileManager.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LocalGFileManager.java 3 Mar 2004 13:10:07 -0000 1.2
+++ LocalGFileManager.java 11 May 2004 12:25:00 -0000 1.3
@@ -50,12 +50,15 @@
private final File root;
/**
- * Checks compliance of a Root file with this implementation.
+ * Checks compliance of a Root file with this implementation.
+ *
+ * @param aReader To read the root file.
+ * @return true if the root is supported.
*/
public static boolean isRootSupported(PushbackReader aReader)
throws IOException {
char[] chars = new char[IDENTIFIER.length()];
- int nbRead = aReader.read(chars);
+ aReader.read(chars);
boolean supported = true;
for (int i = 0; i < chars.length; i++) {
if ( chars[i] != IDENTIFIER.charAt(i) ) {
@@ -101,9 +104,6 @@
return root;
}
- /**
- * Plug-in the LocalGFileDAO implementation.
- */
protected GFileDAO newGerFileDAO() throws DAOException {
return new LocalGFileDAO(root);
}
1.15 +8 -59 incubator-geronimo/sandbox/webdav/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/incubator-geronimo/sandbox/webdav/project.xml,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- project.xml 1 May 2004 06:40:20 -0000 1.14
+++ project.xml 11 May 2004 12:25:00 -0000 1.15
@@ -45,92 +45,41 @@
<dependencies>
<dependency>
- <groupId>geronimo</groupId>
- <artifactId>geronimo-kernel</artifactId>
- <version>${pom.currentVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>geronimo</groupId>
- <artifactId>geronimo-jetty</artifactId>
+ <groupId>geronimo-sandbox</groupId>
+ <artifactId>geronimo-sandbox-messaging</artifactId>
<version>${pom.currentVersion}</version>
</dependency>
<dependency>
<groupId>geronimo</groupId>
- <artifactId>geronimo-common</artifactId>
+ <artifactId>geronimo-network</artifactId>
<version>${pom.currentVersion}</version>
</dependency>
<dependency>
<groupId>geronimo</groupId>
- <artifactId>geronimo-naming</artifactId>
+ <artifactId>geronimo-system</artifactId>
<version>${pom.currentVersion}</version>
- <properties>
- <xmlbeans>true</xmlbeans>
- </properties>
</dependency>
<dependency>
<groupId>geronimo</groupId>
- <artifactId>geronimo-security</artifactId>
- <version>${pom.currentVersion}</version>
- <properties>
- <xmlbeans>true</xmlbeans>
- </properties>
- </dependency>
-
- <dependency>
- <groupId>geronimo</groupId>
- <artifactId>geronimo-transaction</artifactId>
+ <artifactId>geronimo-kernel</artifactId>
<version>${pom.currentVersion}</version>
</dependency>
-
+
<dependency>
<groupId>geronimo</groupId>
- <artifactId>geronimo-connector</artifactId>
+ <artifactId>geronimo-common</artifactId>
<version>${pom.currentVersion}</version>
</dependency>
<dependency>
<groupId>geronimo-spec</groupId>
- <artifactId>geronimo-spec-jta</artifactId>
- <version>1.0.1B-rc1</version>
- </dependency>
-
- <dependency>
- <groupId>geronimo-spec</groupId>
<artifactId>geronimo-spec-servlet</artifactId>
<version>2.4-rc1</version>
</dependency>
- <dependency>
- <groupId>geronimo-spec</groupId>
- <artifactId>geronimo-spec-j2ee-jacc</artifactId>
- <version>1.0-rc1</version>
- </dependency>
-
- <dependency>
- <groupId>geronimo-spec</groupId>
- <artifactId>geronimo-spec-j2ee-connector</artifactId>
- <version>1.5-rc1</version>
- </dependency>
-
- <dependency>
- <groupId>geronimo-spec</groupId>
- <artifactId>geronimo-spec-j2ee-deployment</artifactId>
- <version>1.1-rc1</version>
- </dependency>
-
- <dependency>
- <groupId>geronimo-spec</groupId>
- <artifactId>geronimo-spec-j2eeschema</artifactId>
- <version>${pom.currentVersion}</version>
- <properties>
- <xmlbeans>true</xmlbeans>
- </properties>
- </dependency>
-
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>