river-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter_firmst...@apache.org
Subject svn commit: r1066768 - in /incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup: LocalServiceItem.java MarshalledServiceItem.java ServiceResultStreamFilter.java ServiceResultStreamUnmarshaller.java StreamServiceRegistrar.java
Date Thu, 03 Feb 2011 09:33:54 GMT
Author: peter_firmstone
Date: Thu Feb  3 09:33:53 2011
New Revision: 1066768

URL: http://svn.apache.org/viewvc?rev=1066768&view=rev
Log:
Change MarshalledServiceItem to LocalServiceItem, refactor StreamServiceRegistrar

Added:
    incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/LocalServiceItem.java
      - copied, changed from r1065559, incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/MarshalledServiceItem.java
Removed:
    incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/MarshalledServiceItem.java
Modified:
    incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/ServiceResultStreamFilter.java
    incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/ServiceResultStreamUnmarshaller.java
    incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/StreamServiceRegistrar.java

Copied: incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/LocalServiceItem.java
(from r1065559, incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/MarshalledServiceItem.java)
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/LocalServiceItem.java?p2=incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/LocalServiceItem.java&p1=incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/MarshalledServiceItem.java&r1=1065559&r2=1066768&rev=1066768&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/MarshalledServiceItem.java
(original)
+++ incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/LocalServiceItem.java
Thu Feb  3 09:33:53 2011
@@ -25,38 +25,48 @@ import net.jini.core.lookup.ServiceID;
 import net.jini.core.lookup.ServiceItem;
 
 /**
- * MarshalledServiceItem extends ServiceItem and can be used anywhere a 
- * ServiceItem can.  A MarshalledServiceItem implementation instance 
- * contains the marshalled form of a Service and it's Entry's,
- * the corresponding superclass ServiceItem however contains null values
- * for the service and can exclude any Entry's, however where Entry
- * classes already exist at the client, that they be unmarshalled. 
+ * LocalServiceItem extends ServiceItem and can be used anywhere a 
+ * ServiceItem can.  A LocalServiceItem implementation instance 
+ * is otherwise equivalent, except only local code is used for 
+ * resolving classes during unmarshalling or deserialization.
+ * 
+ * Some fields in the ServiceItem may be null or fields in Entry's may be null or 
+ * even the service may be null.
  * 
  * The ServiceID shall be in unmarshalled form always in the ServiceItem super class.
  * 
- * Since the ServiceItem.service is null, use of this class in existing software
- * will not return the service, however it will not break that software as
- * ServiceItem's contract is to set service or Entry's to null when they cannot
- * be unmarshalled.
+ * Since the ServiceItem.service may be null, use of this class in existing software
+ * may not return the service, unless it is a reflective proxy only, however it 
+ * must honour ServiceItem's contract and set service, Entry's or their fields
+ * to null when they cannot be unmarshalled with local code.
  * 
  * ServiceItem's toString() method will return a different result for
- * MarshalledServiceItem instances.
+ * LocalServiceItem instances.
  * 
  * If required, a new ServiceItem that is fully unmarshalled 
- * can be constructed from this class's methods and ServiceID.
+ * using remote codebases when required can be obtained by calling #unmarshall().
  * 
  * @author Peter Firmstone.
  */
-public abstract class MarshalledServiceItem extends ServiceItem{
+public abstract class LocalServiceItem extends ServiceItem{
     private static final long SerialVersionUID = 1L;
-    protected MarshalledServiceItem(ServiceID id, Entry[] unmarshalledEntries){
+    protected LocalServiceItem(ServiceID id, Entry[] unmarshalledEntries){
         super(id, (Object) null, unmarshalledEntries);
     }
+    
+    /* Default constructor for serializable sub class.
+     */ 
+    protected LocalServiceItem(){
+        super(null, null, null);
+    }
     /**
-     * Unmarshall the ServiceItem.  The returned ServiceItem may have a null service 
-     * or entries , if unmarshalling is unsuccessful.
-     *
-     * @return ServiceItem, totally unmarshalled.
+     * Using remote and local code as required unmarshall a new ServiceItem. 
+     * The returned ServiceItem may have a null service 
+     * or Entry's , if unmarshalling is unsuccessful, however it must not
+     * be an instance of this class.
+     * 
+     * @return ServiceItem, totally unmarshalled, using remote codebase resources
+     * in addition to any local classpath or resources.
      */
     public abstract ServiceItem unmarshall();
 }

Modified: incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/ServiceResultStreamFilter.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/ServiceResultStreamFilter.java?rev=1066768&r1=1066767&r2=1066768&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/ServiceResultStreamFilter.java
(original)
+++ incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/ServiceResultStreamFilter.java
Thu Feb  3 09:33:53 2011
@@ -1,17 +1,30 @@
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * 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.river.api.lookup;
 
 import java.io.IOException;
-import net.jini.lookup.*;
 import org.apache.river.api.util.ResultStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import net.jini.core.lookup.ServiceItem;
+import net.jini.lookup.ServiceItemFilter;
 
 /**
  * A Filter utility class designed to filter out unwanted results.  Filters can

Modified: incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/ServiceResultStreamUnmarshaller.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/ServiceResultStreamUnmarshaller.java?rev=1066768&r1=1066767&r2=1066768&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/ServiceResultStreamUnmarshaller.java
(original)
+++ incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/ServiceResultStreamUnmarshaller.java
Thu Feb  3 09:33:53 2011
@@ -20,18 +20,18 @@ package org.apache.river.api.lookup;
 
 import java.io.IOException;
 import java.security.CodeSource;
-import org.apache.river.api.lookup.MarshalledServiceItem;
+import org.apache.river.api.lookup.LocalServiceItem;
 import org.apache.river.api.util.ResultStream;
 import net.jini.core.lookup.*;
 
 /**
  * Add this to the ResultStream filter chain
  * {@link StreamServiceRegistrar#lookup(ServiceTemplate, Class[], int)}
- * to unmarshall any MarshalledServiceItem's in the stream, prior to 
+ * to unmarshall any LocalServiceItem's in the stream, prior to 
  * proxy verification, or applying constraints.
  * 
  * @author Peter Firmstone.
- * @see MarshalledServiceItem.
+ * @see LocalServiceItem.
  * @see StreamServiceRegistrar
  */
 public class ServiceResultStreamUnmarshaller implements ResultStream<ServiceItem> {
@@ -50,13 +50,13 @@ public class ServiceResultStreamUnmarsha
     public ServiceItem get() throws IOException {
 	if (input == null) return null;
         for(Object item = input.get(); item != null; item = input.get()) {
-            if (item instanceof MarshalledServiceItem){
-                MarshalledServiceItem msi = (MarshalledServiceItem) item;
+            if (item instanceof LocalServiceItem){
+                LocalServiceItem msi = (LocalServiceItem) item;
                 return msi.unmarshall();
             } else if (item instanceof ServiceItem) {
 		return (ServiceItem) item;
 	    }
-	    /* If item is not an instanceof ServiceItem or MarshalledServiceItem
+	    /* If item is not an instanceof ServiceItem or LocalServiceItem
 	     * it is ignored and the next item in the ResultStream is retrieved.
 	     */
         }//end item loop

Modified: incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/StreamServiceRegistrar.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/StreamServiceRegistrar.java?rev=1066768&r1=1066767&r2=1066768&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/StreamServiceRegistrar.java
(original)
+++ incubator/river/jtsk/skunk/pepe/src/org/apache/river/api/lookup/StreamServiceRegistrar.java
Thu Feb  3 09:33:53 2011
@@ -88,72 +88,4 @@ public interface StreamServiceRegistrar 
      */
     ResultStream lookup(ServiceTemplate tmpl, 
         Class[] unmarshalledEntries, int maxBatchSize) throws IOException;
-    
-    /**
-     * Looks at all service items that match the specified template, finds
-     * every entry (among those service items) that either doesn't match any
-     * entry templates or is a subclass of at least one matching entry
-     * template, and returns the set of the (most specific) classes of those
-     * entries.  Duplicate classes are eliminated, and the order of classes
-     * within the returned array is arbitrary.  Null (not an empty array) is
-     * returned if there are no such entries or no matching items.  If a
-     * returned class cannot be deserialized, that element of the returned
-     * array is set to null and no exception is thrown.
-     *
-     * @param tmpl template to match
-     * @param maxBatchSize 
-     * @return a ResultStream containing Class of entry (attribute sets) for every service
-     * that matches the specified template
-     * @throws java.rmi.RemoteException
-     */
-    ResultStream getEntryClasses(ServiceTemplate tmpl, int maxBatchSize) 
-            throws IOException;
-
-    /**
-     * Looks at all service items that match the specified template, finds
-     * every entry (among those service items) that matches
-     * tmpl.attributeSetTemplates[setIndex], and returns the set of values
-     * of the specified field of those entries.  Duplicate values are
-     * eliminated, and the order of values isarbitrary.  
-     * If a returned value cannot be deserialized, that
-     * element is excluded and no exception is thrown.
-     *
-     * @param tmpl template to match
-     * @param setIndex index into tmpl.attributeSetTemplates
-     * @param field name of field of tmpl.attributeSetTemplates[setIndex]
-     *
-     * @param maxBatchSize 
-     * @return a ResultStream of objects that represents field values of entries
-     * associated with services that meet the specified matching
-     * criteria
-     *
-     * @throws NoSuchFieldException field does not name a field of the
-     * entry template
-     * @throws java.rmi.RemoteException
-     */
-    ResultStream getFieldValues(ServiceTemplate tmpl, int setIndex, String field,
-            int maxBatchSize) throws NoSuchFieldException, IOException;
-    
-    /**
-     * Looks at all service items that match the specified template, and for
-     * every service item finds the most specific type (class or interface)
-     * or types the service item is an instance of that are neither equal to,
-     * nor a superclass of, any of the service types in the template and that
-     * have names that start with the specified prefix, and returns the set
-     * of all such types.  Duplicate types are eliminated, and the order of
-     * types within the returned array is arbitrary.  
-     * Null is returned if there are no such types.  If a returned type
-     * cannot be deserialized, that element is excluded and no exception is thrown.
-     *
-     * @param tmpl template to match
-     * @param prefix class name prefix
-     *
-     * @param maxBatchSize 
-     * @return a ResultStream containing a Class for all services that either match the
-     * specified template or match the specified prefix
-     * @throws java.rmi.RemoteException
-     */
-    ResultStream getServiceTypes(ServiceTemplate tmpl, String prefix, 
-            int maxBatchSize) throws IOException;
-
 }



Mime
View raw message