git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@757 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2002-08-22 21:33:13 +00:00
parent abf760435d
commit cea5f56ec5
5 changed files with 45 additions and 16 deletions

View File

@ -5,7 +5,7 @@ set CLASSPATH=%CLASSPATH%;c:\data\pmd\pmd-dcpd\lib\runtimeonly\reggie.jar
set CLASSPATH=%CLASSPATH%;c:\data\pmd\pmd-dcpd\build
set CLASSPATH=%CLASSPATH%;c:\data\pmd\pmd-dcpd\lib\pmd-0.9.jar
set MAIN=net.sourceforge.pmd.dcpd.Test
set MAIN=net.sourceforge.pmd.dcpd.DCPD
set MEMORY_ARG=-Xms128M -Xmx384M
set POLICY_ARG=-Djava.security.policy=c:\jini-1_2_1\policy\policy.all
set SPACENAME_ARG=-Dcom.sun.jini.outrigger.spacename=JavaSpaces

View File

@ -28,7 +28,7 @@ public class DCPD {
public DCPD(String javaSpaceURL) {
try {
space = getSpace(javaSpaceURL);
space = Util.findSpace("mordor");
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("Couldn't connect to the space on " + javaSpaceURL);
@ -62,13 +62,6 @@ public class DCPD {
tokenSets.add(ts);
}
private JavaSpace getSpace(String javaSpaceServerName) throws ClassNotFoundException, MalformedURLException, IOException, RemoteException {
ServiceRegistrar registrar = (new LookupLocator(javaSpaceServerName)).getRegistrar();
ServiceMatches sm = registrar.lookup(new ServiceTemplate(null, new Class[] {JavaSpace.class}, new Entry[] {}), 1);
return (JavaSpace)sm.items[0].service;
}
public static void main(String[] args) {
new DCPD("jini://mordor");
}

View File

@ -0,0 +1,16 @@
/*
* User: tom
* Date: Aug 22, 2002
* Time: 5:13:14 PM
*/
package net.sourceforge.pmd.dcpd;
public class DCPDWorker {
public DCPDWorker() {
}
public static void main(String[] args) {
new DCPDWorker();
}
}

View File

@ -22,7 +22,7 @@ public class Test {
public Test() {
try {
JavaSpace space = getSpace();
JavaSpace space = Util.findSpace("mordor");
add("C:\\j2sdk1.4.0_01\\src\\java\\lang\\", true);
Entry wrapper = new TokenSetsWrapper(tokenSets);
@ -59,12 +59,6 @@ public class Test {
tokenSets.add(ts);
}
private JavaSpace getSpace() throws Exception {
ServiceRegistrar registrar = (new LookupLocator("jini://mordor")).getRegistrar();
ServiceMatches sm = registrar.lookup(new ServiceTemplate(null, new Class[] {JavaSpace.class}, new Entry[] {}), 1);
return (JavaSpace)sm.items[0].service;
}
public static void main(String[] args) {
new Test();
}

View File

@ -0,0 +1,26 @@
/*
* User: tom
* Date: Aug 22, 2002
* Time: 5:25:40 PM
*/
package net.sourceforge.pmd.dcpd;
import net.jini.space.JavaSpace;
import net.jini.core.lookup.ServiceRegistrar;
import net.jini.core.lookup.ServiceMatches;
import net.jini.core.lookup.ServiceTemplate;
import net.jini.core.discovery.LookupLocator;
import net.jini.core.entry.Entry;
import java.rmi.RemoteException;
import java.io.IOException;
import java.net.MalformedURLException;
public class Util {
public static JavaSpace findSpace(String serverName) throws ClassNotFoundException, MalformedURLException, IOException, RemoteException {
ServiceRegistrar registrar = (new LookupLocator("jini://" + serverName)).getRegistrar();
ServiceMatches sm = registrar.lookup(new ServiceTemplate(null, new Class[] {JavaSpace.class}, new Entry[] {}), 1);
return (JavaSpace)sm.items[0].service;
}
}