hammant 01/12/31 05:48:21
Modified: armi/src/java/org/apache/commons/armi/client/impl
ObjectStreamInvocationHandler.java
ServerClassArmiFactory.java
armi/src/java/org/apache/commons/armi/client/impl/direct
DirectInvocationHandler.java
armi/src/java/org/apache/commons/armi/client/impl/rmi
RmiInvocationHandler.java
armi/src/java/org/apache/commons/armi/common
ClassRequest.java MethodRequest.java
armi/src/java/org/apache/commons/armi/server/impl
AbstractServer.java
Added: armi/src/java/org/apache/commons/armi/common
NotPublishedException.java NotPublishedReply.java
PublishedNameRequest.java
Log:
Lookup of unpublished service handled.
Revision Changes Path
1.3 +9 -4
jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/ObjectStreamInvocationHandler.java
Index: ObjectStreamInvocationHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/ObjectStreamInvocationHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ObjectStreamInvocationHandler.java 31 Dec 2001 12:48:41 -0000 1.2
+++ ObjectStreamInvocationHandler.java 31 Dec 2001 13:48:21 -0000 1.3
@@ -1,8 +1,8 @@
/*
- * $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/ObjectStreamInvocationHandler.java,v
1.2 2001/12/31 12:48:41 hammant Exp $
- * $Revision: 1.2 $
- * $Date: 2001/12/31 12:48:41 $
+ * $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/ObjectStreamInvocationHandler.java,v
1.3 2001/12/31 13:48:21 hammant Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/12/31 13:48:21 $
*
* ====================================================================
*
@@ -69,6 +69,9 @@
import org.apache.commons.armi.common.MethodRequest;
import org.apache.commons.armi.common.ArmiInvocationException;
import org.apache.commons.armi.common.TryLaterReply;
+import org.apache.commons.armi.common.NotPublishedReply;
+import org.apache.commons.armi.common.NotPublishedException;
+import org.apache.commons.armi.common.PublishedNameRequest;
import java.io.IOException;
import java.io.ObjectOutputStream;
@@ -80,7 +83,7 @@
*
*
* @author Paul Hammant <a
href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class ObjectStreamInvocationHandler implements ArmiInvocationHandler {
@@ -137,6 +140,8 @@
Thread.sleep(millis);
} catch (InterruptedException ie) {}
again = true;
+ } else if (reply instanceof NotPublishedReply) {
+ throw new NotPublishedException(((PublishedNameRequest)
request).getPublishedObjectName());
}
}
return reply;
1.3 +11 -5
jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/ServerClassArmiFactory.java
Index: ServerClassArmiFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/ServerClassArmiFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ServerClassArmiFactory.java 30 Dec 2001 01:12:04 -0000 1.2
+++ ServerClassArmiFactory.java 31 Dec 2001 13:48:21 -0000 1.3
@@ -1,8 +1,8 @@
/*
- * $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/ServerClassArmiFactory.java,v
1.2 2001/12/30 01:12:04 hammant Exp $
- * $Revision: 1.2 $
- * $Date: 2001/12/30 01:12:04 $
+ * $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/ServerClassArmiFactory.java,v
1.3 2001/12/31 13:48:21 hammant Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/12/31 13:48:21 $
*
* ====================================================================
*
@@ -67,6 +67,7 @@
import org.apache.commons.armi.common.ClassReply;
import org.apache.commons.armi.common.ArmiConnectionException;
import org.apache.commons.armi.common.ClassRequest;
+import org.apache.commons.armi.common.NotPublishedException;
import java.util.HashMap;
@@ -76,7 +77,7 @@
*
*
* @author Paul Hammant <a
href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class ServerClassArmiFactory extends ArmiFactory {
@@ -101,7 +102,12 @@
if (mPublishedServiceClassLoaders.containsKey(publishedServiceName)) {
tcl = (TransportedClassLoader)
mPublishedServiceClassLoaders.get(publishedServiceName);
} else {
- ClassReply cr = (ClassReply)
hostContext.getInvocationHandler().handleInvocation(new
ClassRequest(publishedServiceName));
+ ClassReply cr = null;
+ try {
+ cr = (ClassReply)
hostContext.getInvocationHandler().handleInvocation(new
ClassRequest(publishedServiceName));
+ } catch (NotPublishedException npe) {
+ throw new ArmiConnectionException("Service " +
publishedServiceName + " not published on Server");
+ }
tcl = new TransportedClassLoader("ArmiGenerated" +
publishedServiceName, cr.getClassBytes());
tcl.initialize();
mPublishedServiceClassLoaders.put(publishedServiceName, tcl);
1.3 +9 -4
jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/direct/DirectInvocationHandler.java
Index: DirectInvocationHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/direct/DirectInvocationHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DirectInvocationHandler.java 31 Dec 2001 12:48:42 -0000 1.2
+++ DirectInvocationHandler.java 31 Dec 2001 13:48:21 -0000 1.3
@@ -1,8 +1,8 @@
/*
- * $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/direct/DirectInvocationHandler.java,v
1.2 2001/12/31 12:48:42 hammant Exp $
- * $Revision: 1.2 $
- * $Date: 2001/12/31 12:48:42 $
+ * $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/direct/DirectInvocationHandler.java,v
1.3 2001/12/31 13:48:21 hammant Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/12/31 13:48:21 $
*
* ====================================================================
*
@@ -68,6 +68,9 @@
import org.apache.commons.armi.common.ArmiReply;
import org.apache.commons.armi.common.ArmiRequest;
import org.apache.commons.armi.common.TryLaterReply;
+import org.apache.commons.armi.common.NotPublishedReply;
+import org.apache.commons.armi.common.NotPublishedException;
+import org.apache.commons.armi.common.PublishedNameRequest;
/**
@@ -75,7 +78,7 @@
*
*
* @author Paul Hammant <a
href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public final class DirectInvocationHandler implements ArmiInvocationHandler {
@@ -116,6 +119,8 @@
Thread.sleep(millis);
} catch (InterruptedException ie) {}
again = true;
+ } else if (reply instanceof NotPublishedReply) {
+ throw new NotPublishedException(((PublishedNameRequest)
request).getPublishedObjectName());
}
}
return reply;
1.3 +9 -4
jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/rmi/RmiInvocationHandler.java
Index: RmiInvocationHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/rmi/RmiInvocationHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RmiInvocationHandler.java 31 Dec 2001 12:48:42 -0000 1.2
+++ RmiInvocationHandler.java 31 Dec 2001 13:48:21 -0000 1.3
@@ -1,8 +1,8 @@
/*
- * $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/rmi/RmiInvocationHandler.java,v
1.2 2001/12/31 12:48:42 hammant Exp $
- * $Revision: 1.2 $
- * $Date: 2001/12/31 12:48:42 $
+ * $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/client/impl/rmi/RmiInvocationHandler.java,v
1.3 2001/12/31 13:48:21 hammant Exp $
+ * $Revision: 1.3 $
+ * $Date: 2001/12/31 13:48:21 $
*
* ====================================================================
*
@@ -70,6 +70,9 @@
import org.apache.commons.armi.common.ArmiInvocationException;
import org.apache.commons.armi.common.ArmiConnectionException;
import org.apache.commons.armi.common.TryLaterReply;
+import org.apache.commons.armi.common.NotPublishedReply;
+import org.apache.commons.armi.common.NotPublishedException;
+import org.apache.commons.armi.common.PublishedNameRequest;
import java.rmi.Naming;
import java.rmi.RemoteException;
@@ -83,7 +86,7 @@
*
*
* @author Paul Hammant <a
href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public final class RmiInvocationHandler implements ArmiInvocationHandler {
@@ -140,6 +143,8 @@
Thread.sleep(millis);
} catch (InterruptedException ie) {}
again = true;
+ } else if (reply instanceof NotPublishedReply) {
+ throw new NotPublishedException(((PublishedNameRequest)
request).getPublishedObjectName());
}
}
return reply;
1.2 +4 -16
jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ClassRequest.java
Index: ClassRequest.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ClassRequest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ClassRequest.java 30 Dec 2001 00:42:10 -0000 1.1
+++ ClassRequest.java 31 Dec 2001 13:48:21 -0000 1.2
@@ -1,8 +1,8 @@
/*
- * $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ClassRequest.java,v
1.1 2001/12/30 00:42:10 hammant Exp $
- * $Revision: 1.1 $
- * $Date: 2001/12/30 00:42:10 $
+ * $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/ClassRequest.java,v
1.2 2001/12/31 13:48:21 hammant Exp $
+ * $Revision: 1.2 $
+ * $Date: 2001/12/31 13:48:21 $
*
* ====================================================================
*
@@ -67,11 +67,9 @@
*
*
* @author Paul Hammant <a
href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
-public class ClassRequest extends ArmiRequest {
-
- private final String mPublishedObjectName;
+public class ClassRequest extends PublishedNameRequest {
/**
* Constructor ClassRequest
@@ -81,17 +79,7 @@
*
*/
public ClassRequest(String publishedObjectName) {
- mPublishedObjectName = publishedObjectName;
+ super(publishedObjectName);
}
- /**
- * Method getPublishedObjectName
- *
- *
- * @return
- *
- */
- public String getPublishedObjectName() {
- return mPublishedObjectName;
- }
}
1.2 +6 -18
jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/MethodRequest.java
Index: MethodRequest.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/MethodRequest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MethodRequest.java 28 Dec 2001 18:08:38 -0000 1.1
+++ MethodRequest.java 31 Dec 2001 13:48:21 -0000 1.2
@@ -1,8 +1,8 @@
/*
- * $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/MethodRequest.java,v
1.1 2001/12/28 18:08:38 hammant Exp $
- * $Revision: 1.1 $
- * $Date: 2001/12/28 18:08:38 $
+ * $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/MethodRequest.java,v
1.2 2001/12/31 13:48:21 hammant Exp $
+ * $Revision: 1.2 $
+ * $Date: 2001/12/31 13:48:21 $
*
* ====================================================================
*
@@ -68,12 +68,11 @@
*
*
* @author Paul Hammant <a
href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
-public class MethodRequest extends ArmiRequest {
+public class MethodRequest extends PublishedNameRequest {
private final String mMethodSignature;
- private final String mPublishedObjectName;
private final Object[] mArgs;
/**
@@ -86,8 +85,7 @@
*
*/
public MethodRequest(String publishedObjectName, String methodSignature,
Object[] args) {
-
- mPublishedObjectName = publishedObjectName;
+ super(publishedObjectName);
mMethodSignature = methodSignature;
mArgs = args;
}
@@ -114,14 +112,4 @@
return mArgs;
}
- /**
- * Method getPublishedObjectName
- *
- *
- * @return
- *
- */
- public String getPublishedObjectName() {
- return mPublishedObjectName;
- }
}
1.1
jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/NotPublishedException.java
Index: NotPublishedException.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/NotPublishedException.java,v
1.1 2001/12/31 13:48:21 hammant Exp $
* $Revision: 1.1 $
* $Date: 2001/12/31 13:48:21 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.armi.common;
import java.io.Serializable;
/**
* Class NotPublishedException
*
*
* @author Paul Hammant <a
href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
* @version $Revision: 1.1 $
*/
public class NotPublishedException extends ArmiInvocationException {
/**
* Constructor NotPublishedException
*
*
* @param s
*
*/
public NotPublishedException(String service) {
super("Service " + service + " not published by server");
}
}
1.1
jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/NotPublishedReply.java
Index: NotPublishedReply.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/NotPublishedReply.java,v
1.1 2001/12/31 13:48:21 hammant Exp $
* $Revision: 1.1 $
* $Date: 2001/12/31 13:48:21 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.armi.common;
/**
* Class NotPublishedReply
*
*
* @author Paul Hammant <a
href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
* @version $Revision: 1.1 $
*/
public class NotPublishedReply extends ArmiReply {
/**
* Constructor NotPublishedReply
*
*/
public NotPublishedReply() {
}
}
1.1
jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/PublishedNameRequest.java
Index: PublishedNameRequest.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/common/PublishedNameRequest.java,v
1.1 2001/12/31 13:48:21 hammant Exp $
* $Revision: 1.1 $
* $Date: 2001/12/31 13:48:21 $
*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.armi.common;
/**
* Class PublishedNameRequest
*
*
* @author Paul Hammant <a
href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
* @version $Revision: 1.1 $
*/
public abstract class PublishedNameRequest extends ArmiRequest {
private final String mPublishedObjectName;
/**
* Constructor PublishedNameRequest
*
*
* @param publishedObjectName
*
*/
public PublishedNameRequest(String publishedObjectName) {
mPublishedObjectName = publishedObjectName;
}
/**
* Method getPublishedObjectName
*
*
* @return
*
*/
public String getPublishedObjectName() {
return mPublishedObjectName;
}
}
1.4 +12 -9
jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/AbstractServer.java
Index: AbstractServer.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/AbstractServer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractServer.java 31 Dec 2001 12:48:42 -0000 1.3
+++ AbstractServer.java 31 Dec 2001 13:48:21 -0000 1.4
@@ -1,8 +1,8 @@
/*
- * $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/AbstractServer.java,v
1.3 2001/12/31 12:48:42 hammant Exp $
- * $Revision: 1.3 $
- * $Date: 2001/12/31 12:48:42 $
+ * $Header:
/home/cvs/jakarta-commons-sandbox/armi/src/java/org/apache/commons/armi/server/impl/AbstractServer.java,v
1.4 2001/12/31 13:48:21 hammant Exp $
+ * $Revision: 1.4 $
+ * $Date: 2001/12/31 13:48:21 $
*
* ====================================================================
*
@@ -75,7 +75,7 @@
import org.apache.commons.armi.common.ClassReply;
import org.apache.commons.armi.common.RequestFailedReply;
import org.apache.commons.armi.common.TryLaterReply;
-import org.apache.commons.armi.client.impl.BaseServedObject;
+import org.apache.commons.armi.common.NotPublishedReply;
import java.lang.reflect.Method;
@@ -88,11 +88,11 @@
*
*
* @author Paul Hammant <a
href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public class AbstractServer extends AbstractMethodHandler implements ArmiServer {
- private HashMap publishedObjects = new HashMap();
+ private HashMap mPublishedObjects = new HashMap();
private boolean mSuspend = false;
/**
@@ -128,7 +128,7 @@
HashMap methodMap = new HashMap();
DefaultInvocationHandler dih = new DefaultInvocationHandler(impl,
methodMap);
- publishedObjects.put(as, dih);
+ mPublishedObjects.put(as, dih);
for (int x = 0; x < interfacesToExpose.length; x++) {
Method methods[] = interfacesToExpose[x].getMethods();
@@ -161,8 +161,11 @@
if (request instanceof MethodRequest) {
MethodRequest mr = (MethodRequest) request;
- String as = mr.getPublishedObjectName();
- ArmiInvocationHandler ih = (ArmiInvocationHandler)
publishedObjects.get(as);
+ String publishedObjectName = mr.getPublishedObjectName();
+ if (!mPublishedObjects.containsKey(publishedObjectName)) {
+ return new NotPublishedReply();
+ }
+ ArmiInvocationHandler ih = (ArmiInvocationHandler)
mPublishedObjects.get(publishedObjectName);
return ih.handleInvocation(mr);
} else if (request instanceof ClassRequest) {
try {
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>