- moved examples to extra dir
authorAleš Křenek <ljocha@ics.muni.cz>
Mon, 8 Jun 2009 18:47:20 +0000 (18:47 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Mon, 8 Jun 2009 18:47:20 +0000 (18:47 +0000)
- make it all build thoroughly

org.glite.lb.client-java/Makefile
org.glite.lb.client-java/examples/ProducerTestIL.java [moved from org.glite.lb.client-java/src/org/glite/lb/ProducerTestIL.java with 100% similarity]
org.glite.lb.client-java/examples/ProducerTestLL.java [moved from org.glite.lb.client-java/src/org/glite/lb/ProducerTestLL.java with 99% similarity]
org.glite.lb.client-java/examples/SSLClient.java
org.glite.lb.client-java/examples/SimpleLLTest.java
org.glite.lb.client-java/src/org/glite/lb/ContextLL.java
org.glite.lb.client-java/src/org/glite/lb/Notification.java
org.glite.lb.client-java/src/org/glite/lb/SSLSend.java
org.glite.lb.client-java/src_c/Makefile

index 87790f0..b2e1f6c 100644 (file)
@@ -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
 
 
@@ -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 
index f9b21dc..99e2041 100644 (file)
@@ -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);
index 0e1f456..a742ed2 100644 (file)
@@ -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");
index 3eeb4d4..8fe35a0 100644 (file)
@@ -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;
     }
 
     
index e25ae3e..53af91e 100644 (file)
@@ -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) {
index 6b56958..94bc565 100644 (file)
@@ -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);
-      }
     }
 }
index 4270cbf..6d48605 100755 (executable)
@@ -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}