From 3b22af019e22e9d43aeb76758f664c912432fe88 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Mon, 8 Jun 2009 18:47:20 +0000 Subject: [PATCH] - moved examples to extra dir - make it all build thoroughly --- org.glite.lb.client-java/Makefile | 7 ++++--- .../{src/org/glite/lb => examples}/ProducerTestIL.java | 0 .../{src/org/glite/lb => examples}/ProducerTestLL.java | 2 +- org.glite.lb.client-java/examples/SSLClient.java | 3 ++- org.glite.lb.client-java/examples/SimpleLLTest.java | 2 +- org.glite.lb.client-java/src/org/glite/lb/ContextLL.java | 16 ++++++++-------- .../src/org/glite/lb/Notification.java | 8 +------- org.glite.lb.client-java/src/org/glite/lb/SSLSend.java | 14 ++------------ org.glite.lb.client-java/src_c/Makefile | 3 +++ 9 files changed, 22 insertions(+), 33 deletions(-) rename org.glite.lb.client-java/{src/org/glite/lb => examples}/ProducerTestIL.java (100%) rename org.glite.lb.client-java/{src/org/glite/lb => examples}/ProducerTestLL.java (99%) diff --git a/org.glite.lb.client-java/Makefile b/org.glite.lb.client-java/Makefile index 87790f0..b2e1f6c 100644 --- a/org.glite.lb.client-java/Makefile +++ b/org.glite.lb.client-java/Makefile @@ -1,7 +1,6 @@ -include Makefile.inc -EXAMPLES := SimpleLLTest.class SSLClient.class SSLServer.class QueryDemo.class -# broken: ProducerTestIL.class ProducerTestLL.class +EXAMPLES := SimpleLLTest.class SSLClient.class SSLServer.class QueryDemo.class ProducerTestIL.class ProducerTestLL.class VPATH := examples @@ -30,6 +29,8 @@ install: cd src_c && make install PREFIX=${PREFIX} clean: - echo TODO + rm -rf dist + find . -name \*.class -exec rm {} \; + cd src_c && make clean diff --git a/org.glite.lb.client-java/src/org/glite/lb/ProducerTestIL.java b/org.glite.lb.client-java/examples/ProducerTestIL.java similarity index 100% rename from org.glite.lb.client-java/src/org/glite/lb/ProducerTestIL.java rename to org.glite.lb.client-java/examples/ProducerTestIL.java diff --git a/org.glite.lb.client-java/src/org/glite/lb/ProducerTestLL.java b/org.glite.lb.client-java/examples/ProducerTestLL.java similarity index 99% rename from org.glite.lb.client-java/src/org/glite/lb/ProducerTestLL.java rename to org.glite.lb.client-java/examples/ProducerTestLL.java index afbbd25..f535525 100644 --- a/org.glite.lb.client-java/src/org/glite/lb/ProducerTestLL.java +++ b/org.glite.lb.client-java/examples/ProducerTestLL.java @@ -133,7 +133,7 @@ public class ProducerTestLL { * Example: * ctx.setPathToCertificate("/home/paja6/myCertificate.p12"); */ - ctx.setPathToCertificate(args[9]); + ctx.setCredentials(new LBCredentials(args[9],null)); System.out.println("pathToCertificate: " + args[9]); /* Path to directory where will be saved files with logs until inter-logger sends diff --git a/org.glite.lb.client-java/examples/SSLClient.java b/org.glite.lb.client-java/examples/SSLClient.java index f9b21dc..99e2041 100644 --- a/org.glite.lb.client-java/examples/SSLClient.java +++ b/org.glite.lb.client-java/examples/SSLClient.java @@ -1,4 +1,5 @@ import org.glite.lb.SSLSend; +import org.glite.lb.LBCredentials; public class SSLClient { public static void main(String[] args) { @@ -6,7 +7,7 @@ public class SSLClient { SSLSend ssl = new SSLSend(); try { - ssl.send(args[0],"localhost",9002,100,"baff"); + ssl.send(new LBCredentials(args[0],null),"localhost",9002,100,"baff"); } catch (Exception e) { System.err.println(e); diff --git a/org.glite.lb.client-java/examples/SimpleLLTest.java b/org.glite.lb.client-java/examples/SimpleLLTest.java index 0e1f456..a742ed2 100644 --- a/org.glite.lb.client-java/examples/SimpleLLTest.java +++ b/org.glite.lb.client-java/examples/SimpleLLTest.java @@ -26,7 +26,7 @@ public class SimpleLLTest { ctx.setTimeout(5); ctx.setAddress("localhost"); ctx.setPort(9002); - ctx.setPathToCertificate(args[0]); + ctx.setCredentials(new LBCredentials(args[0],null)); ctx.setPrefix("/tmp/dglog.paja6_testProxy6"); EventRunning running = new EventRunning(); running.setNode("node"); diff --git a/org.glite.lb.client-java/src/org/glite/lb/ContextLL.java b/org.glite.lb.client-java/src/org/glite/lb/ContextLL.java index 3eeb4d4..8fe35a0 100644 --- a/org.glite.lb.client-java/src/org/glite/lb/ContextLL.java +++ b/org.glite.lb.client-java/src/org/glite/lb/ContextLL.java @@ -14,7 +14,7 @@ public class ContextLL extends Context { private String prefix; private int repeatWriteToFile = 5; private int timeout = 30000; //in milliseconds - private String pathToCertificate; + private LBCredentials cred; private SSLSend sslSend = null; public ContextLL() { @@ -81,7 +81,7 @@ public class ContextLL extends Context { ILFileWriter.write(prefix, message, repeatWriteToFile); - sslSend.send(pathToCertificate, address, port, timeout, message); + sslSend.send(cred, address, port, timeout, message); } public String getAddress() { @@ -143,16 +143,16 @@ public class ContextLL extends Context { this.timeout = timeout; } - public String getPathToCertificate() { - return pathToCertificate; + public LBCredentials getCredentials() { + return cred; } - public void setPathToCertificate(String pathToCertificate) { - if (pathToCertificate == null) { - throw new IllegalArgumentException("ContextLL pathToCertificate"); + public void setCredentials(LBCredentials cred) { + if (cred == null) { + throw new IllegalArgumentException("ContextLL credentials"); } - this.pathToCertificate = pathToCertificate; + this.cred = cred; } diff --git a/org.glite.lb.client-java/src/org/glite/lb/Notification.java b/org.glite.lb.client-java/src/org/glite/lb/Notification.java index e25ae3e..53af91e 100644 --- a/org.glite.lb.client-java/src/org/glite/lb/Notification.java +++ b/org.glite.lb.client-java/src/org/glite/lb/Notification.java @@ -207,7 +207,7 @@ public class Notification { */ public JobStatus receive(int timeout) throws LBException { SSL ssl = new SSL(); - ssl.setProxy(keyStore); + ssl.setCredentials(lbCredent); ILProtoReceiver receiver = null; String received = null; try { @@ -226,12 +226,6 @@ public class Notification { return parser.getJobInfo(); } catch (IOException ex) { throw new LBException(ex); - } catch (KeyManagementException ex) { - throw new LBException(ex); - } catch (KeyStoreException ex) { - throw new LBException(ex); - } catch (NoSuchAlgorithmException ex) { - throw new LBException(ex); } catch (ParserConfigurationException ex) { throw new LBException(ex); } catch (SAXException ex) { diff --git a/org.glite.lb.client-java/src/org/glite/lb/SSLSend.java b/org.glite.lb.client-java/src/org/glite/lb/SSLSend.java index 6b56958..94bc565 100644 --- a/org.glite.lb.client-java/src/org/glite/lb/SSLSend.java +++ b/org.glite.lb.client-java/src/org/glite/lb/SSLSend.java @@ -24,16 +24,15 @@ public class SSLSend { * @param timeout connection timeout * @param message message which will be send */ - public void send(String keyStoreSender, String host, + public void send(LBCredentials cred, String host, int port, int timeout, String message) throws LBException -// throws KeyStoreException,IOException,NoSuchAlgorithmException,KeyManagementException { try { SSL lbsock = new SSL(); - lbsock.setProxy(keyStoreSender); + lbsock.setCredentials(cred); Socket sock = lbsock.connect(host,port,timeout); PrintStream s = new PrintStream(sock.getOutputStream(),false); @@ -57,17 +56,8 @@ public class SSLSend { s.flush(); s.close(); } - catch (KeyStoreException e) { - throw new LBException(e); - } catch (IOException e) { throw new LBException(e); } - catch (NoSuchAlgorithmException e) { - throw new LBException(e); - } - catch (KeyManagementException e) { - throw new LBException(e); - } } } diff --git a/org.glite.lb.client-java/src_c/Makefile b/org.glite.lb.client-java/src_c/Makefile index 4270cbf..6d48605 100755 --- a/org.glite.lb.client-java/src_c/Makefile +++ b/org.glite.lb.client-java/src_c/Makefile @@ -16,3 +16,6 @@ ${LIB}: ${OBJ} install: compile -mkdir -p ${PREFIX}/lib libtool --mode=install install -m 755 ${LIB} ${PREFIX}/lib + +clean: + rm -rf ${OBJ} .libs ${LIB} -- 1.8.2.3