You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by th...@apache.org on 2012/04/16 17:46:40 UTC

svn commit: r1326655 - in /river/jtsk/skunk/easystart: src-extra-examples/org/apache/river/extra/examples/easystart/ src-extra/org/apache/river/extra/easystart/config/settings/

Author: thobbs
Date: Mon Apr 16 15:46:40 2012
New Revision: 1326655

URL: http://svn.apache.org/viewvc?rev=1326655&view=rev
Log:
Corrected bug in example code and expanded it a bit.  Needs documentation now.

Modified:
    river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/ExampleService.java
    river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/ExampleServiceImpl.java
    river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/LookupServices.java
    river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/StartServices.java
    river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/settings/start.config

Modified: river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/ExampleService.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/ExampleService.java?rev=1326655&r1=1326654&r2=1326655&view=diff
==============================================================================
--- river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/ExampleService.java (original)
+++ river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/ExampleService.java Mon Apr 16 15:46:40 2012
@@ -22,14 +22,18 @@ import java.rmi.Remote;
 import java.rmi.RemoteException;
 
 import net.jini.admin.Administrable;
+import net.jini.admin.JoinAdmin;
 
 import com.sun.jini.admin.DestroyAdmin;
 
 public interface ExampleService extends Remote, 
 										Administrable,
 										DestroyAdmin,
+										JoinAdmin,
 										Serializable  {
 	
+	public static final String PACKAGE = "org.apache.river.extra.examples.easystart";
+	
 	String doSomething() throws RemoteException;
 
 }

Modified: river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/ExampleServiceImpl.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/ExampleServiceImpl.java?rev=1326655&r1=1326654&r2=1326655&view=diff
==============================================================================
--- river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/ExampleServiceImpl.java (original)
+++ river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/ExampleServiceImpl.java Mon Apr 16 15:46:40 2012
@@ -45,11 +45,10 @@ public class ExampleServiceImpl implemen
 	private static final long serialVersionUID = -3388051367238615846L;
 	private static final Logger log = Logger.getLogger(ExampleServiceImpl.class.getName());
 
-	private static final String PACKAGE = "org.apache.river.extra.examples.easystart";
-	
 	private Object proxy;
     private Exporter exporter;
     private JoinManager joinManager;
+    private LookupDiscoveryManager ldm;
     
 	public ExampleServiceImpl(String[] configArgs, LifeCycle lifeCycle) throws RemoteException {
 		try {
@@ -103,12 +102,12 @@ public class ExampleServiceImpl implemen
 			}
 		};
 		
-		LookupDiscoveryManager mgr = new LookupDiscoveryManager(groups,lookupLocators, null); // DiscoveryListener
-		
-        joinManager = new JoinManager(proxy, 
+		ldm = new LookupDiscoveryManager(groups,lookupLocators, null); // DiscoveryListener
+
+		joinManager = new JoinManager(proxy, 
         						      atts, 
         						      serviceIdListener, 
-        						      mgr, 
+        						      ldm, 
         						      null,
         						      config);
         
@@ -145,5 +144,72 @@ public class ExampleServiceImpl implemen
         exporter.unexport(true);
 	}
 
+	@Override
+	public Entry[] getLookupAttributes() throws RemoteException {
+		return joinManager.getAttributes();
+	}
+
+	@Override
+	public void addLookupAttributes(Entry[] attrSets) throws RemoteException {
+		joinManager.addAttributes(attrSets);
+	}
+
+	@Override
+	public void modifyLookupAttributes(Entry[] attrSetTemplates,
+			Entry[] attrSets) throws RemoteException {
+		joinManager.modifyAttributes(attrSetTemplates, attrSets);
+	}
+
+	@Override
+	public String[] getLookupGroups() throws RemoteException {
+		return ldm.getGroups();
+	}
+
+	@Override
+	public void addLookupGroups(String[] groups) throws RemoteException {
+		try {
+			ldm.addGroups(groups);
+		} catch (IOException e) {
+			throw new RemoteException(e.getMessage(), e);
+		}
+	}
+
+	@Override
+	public void removeLookupGroups(String[] groups) throws RemoteException {
+		ldm.removeGroups(groups);
+	}
+
+	@Override
+	public void setLookupGroups(String[] groups) throws RemoteException {
+		try {
+			ldm.setGroups(groups);
+		} catch (IOException e) {
+			throw new RemoteException(e.getMessage(), e);
+		}
+	}
+
+	@Override
+	public LookupLocator[] getLookupLocators() throws RemoteException {
+		return ldm.getLocators();
+	}
+
+	@Override
+	public void addLookupLocators(LookupLocator[] locators)
+			throws RemoteException {
+		ldm.addLocators(locators);
+	}
+
+	@Override
+	public void removeLookupLocators(LookupLocator[] locators)
+			throws RemoteException {
+		ldm.removeLocators(locators);
+	}
+
+	@Override
+	public void setLookupLocators(LookupLocator[] locators)
+			throws RemoteException {
+		ldm.setLocators(locators);
+	}
+
 	
 }

Modified: river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/LookupServices.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/LookupServices.java?rev=1326655&r1=1326654&r2=1326655&view=diff
==============================================================================
--- river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/LookupServices.java (original)
+++ river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/LookupServices.java Mon Apr 16 15:46:40 2012
@@ -22,6 +22,8 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.logging.Logger;
 
+import net.jini.admin.Administrable;
+import net.jini.admin.JoinAdmin;
 import net.jini.core.lookup.ServiceItem;
 import net.jini.core.lookup.ServiceTemplate;
 
@@ -57,6 +59,10 @@ public class LookupServices {
 		log.severe("Found "+serviceItems.size()+" services");
 		for(ServiceItem si : serviceItems) {
 			log.severe("\tAttributes: "+Arrays.toString(si.attributeSets));
+			
+			JoinAdmin jAdmin = (JoinAdmin) ((Administrable)si.service).getAdmin();
+			log.severe("\tLookup Attributes: "+Arrays.toString(jAdmin.getLookupAttributes()));
+			
 		}
 	}
 

Modified: river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/StartServices.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/StartServices.java?rev=1326655&r1=1326654&r2=1326655&view=diff
==============================================================================
--- river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/StartServices.java (original)
+++ river/jtsk/skunk/easystart/src-extra-examples/org/apache/river/extra/examples/easystart/StartServices.java Mon Apr 16 15:46:40 2012
@@ -36,7 +36,7 @@ public class StartServices {
 		options.setJiniPort(4162);
 		options.setHttpOptions("localhost", 8080, true);
 		options.addLookupGroup("extra").addLookupGroup("example");
-		options.setPackageName("org.apache.river.extra.examples");
+		options.setPackageName(ExampleService.PACKAGE);
 		
 		ApplicationConfigurationFactory configFac = new ApplicationConfigurationFactory(options);
 		

Modified: river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/settings/start.config
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/settings/start.config?rev=1326655&r1=1326654&r2=1326655&view=diff
==============================================================================
--- river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/settings/start.config (original)
+++ river/jtsk/skunk/easystart/src-extra/org/apache/river/extra/easystart/config/settings/start.config Mon Apr 16 15:46:40 2012
@@ -39,7 +39,7 @@ com.sun.jini.start {
 	    new String[] { 
 	    "-"
 	    //overrides
-	    ${options}
+${options}
 	    //overrides end
 	    }
 	    )
@@ -49,7 +49,7 @@ com.sun.jini.start {
 ${servicePackageName} {
 
 //defaults
-	${defaults}
+${defaults}
 //defaults end
 
 }