Valtri's patch to make it work on SLC4 (doesn't seem to break
authorAleš Křenek <ljocha@ics.muni.cz>
Thu, 17 Apr 2008 11:51:21 +0000 (11:51 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Thu, 17 Apr 2008 11:51:21 +0000 (11:51 +0000)
anything on SuSE 10.2 too)

org.glite.lb.client-java/nbproject/build-impl.xml
org.glite.lb.client-java/nbproject/project.properties
org.glite.lb.client-java/src/org/glite/lb/client_java/Context.java
org.glite.lb.client-java/src/org/glite/lb/client_java/ContextIL.java
org.glite.lb.client-java/src/org/glite/lb/client_java/ContextProxy.java
org.glite.lb.client-java/src/org/glite/lb/client_java/SeqCode.java
org.glite.lb.client-java/src/org/glite/lb/client_java/Sources.java
org.glite.lb.client-java/src/org/glite/test/Test.java

index a15c213..9bdbafd 100755 (executable)
@@ -112,7 +112,7 @@ is divided into following sections:
         <condition property="do.depend.true">
             <istrue value="${do.depend}"/>
         </condition>
-        <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
+        <condition property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'">
             <and>
                 <isset property="jaxws.endorsed.dir"/>
                 <available file="nbproject/jaxws-build.xml"/>
@@ -155,7 +155,7 @@ is divided into following sections:
             <attribute default="" name="sourcepath"/>
             <element name="customize" optional="true"/>
             <sequential>
-                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}">
+                <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" sourcepath="@{sourcepath}" srcdir="@{srcdir}">
                     <classpath>
                         <path path="@{classpath}"/>
                     </classpath>
@@ -250,7 +250,7 @@ is divided into following sections:
                 <contains string="${version-output}" substring="java version &quot;1.3"/>
             </or>
         </condition>
-        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
+        <condition property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
             <istrue value="${have-jdk-older-than-1.4}"/>
         </condition>
     </target>
@@ -469,7 +469,7 @@ is divided into following sections:
             -->
     <target depends="init" name="-javadoc-build">
         <mkdir dir="${dist.javadoc.dir}"/>
-        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
+        <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
             <classpath>
                 <path path="${javac.classpath}"/>
             </classpath>
index ba29c74..33e3dd9 100755 (executable)
@@ -24,10 +24,10 @@ jar.compress=false
 javac.classpath=\
     ${reference.jobid-api-java.jar}
 # Space-separated list of extra javac options
-javac.compilerargs=-Xlint:unchecked
+javac.compilerargs=
 javac.deprecation=false
-javac.source=1.5
-javac.target=1.5
+javac.source=
+javac.target=
 javac.test.classpath=\
     ${javac.classpath}:\
     ${build.classes.dir}:\
@@ -63,3 +63,4 @@ run.test.classpath=\
 source.encoding=UTF-8
 src.dir=src
 test.src.dir=test
+javac.compilerargs.jaxws=
index 5143bde..9b1fe9c 100755 (executable)
@@ -107,17 +107,17 @@ public class Context {
      * @throws IllegalArgumentException if wrong source type is set
      */
     private String recognizeSource(Sources sourceEnum) {
-        switch (sourceEnum) {
-            case EDG_WLL_SOURCE_NONE: return "Undefined";
-            case EDG_WLL_SOURCE_USER_INTERFACE: return "UserInterface";
-            case EDG_WLL_SOURCE_NETWORK_SERVER: return "NetworkServer";
-            case EDG_WLL_SOURCE_WORKLOAD_MANAGER: return "WorkloadManager";
-            case EDG_WLL_SOURCE_BIG_HELPER: return "BigHelper";
-            case EDG_WLL_SOURCE_JOB_SUBMISSION: return "JobController";
-            case EDG_WLL_SOURCE_LOG_MONITOR: return "LogMonitor";
-            case EDG_WLL_SOURCE_LRMS: return "LRMS";
-            case EDG_WLL_SOURCE_APPLICATION: return "Application";
-            case EDG_WLL_SOURCE_LB_SERVER: return "LBServer";
+        switch (sourceEnum.source) {
+            case Sources.EDG_WLL_SOURCE_NONE: return "Undefined";
+            case Sources.EDG_WLL_SOURCE_USER_INTERFACE: return "UserInterface";
+            case Sources.EDG_WLL_SOURCE_NETWORK_SERVER: return "NetworkServer";
+            case Sources.EDG_WLL_SOURCE_WORKLOAD_MANAGER: return "WorkloadManager";
+            case Sources.EDG_WLL_SOURCE_BIG_HELPER: return "BigHelper";
+            case Sources.EDG_WLL_SOURCE_JOB_SUBMISSION: return "JobController";
+            case Sources.EDG_WLL_SOURCE_LOG_MONITOR: return "LogMonitor";
+            case Sources.EDG_WLL_SOURCE_LRMS: return "LRMS";
+            case Sources.EDG_WLL_SOURCE_APPLICATION: return "Application";
+            case Sources.EDG_WLL_SOURCE_LB_SERVER: return "LBServer";
             default: throw new IllegalArgumentException("wrong source type");
         }
     }
index 03eaa9e..16ca38d 100755 (executable)
@@ -24,7 +24,7 @@ public class ContextIL extends Context {
     private int repeatWriteToFile = 5;
     private int connAttempts = 3;
     private int timeout = 3;
-    private Boolean useUnixSocket = true;
+    private Boolean useUnixSocket = Boolean.TRUE;
 
     //tutorial http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jni.html
     //native method which is written in C and imported to Java
@@ -118,7 +118,7 @@ public class ContextIL extends Context {
                     if (!file.exists()) {
                         continue;
                     }
-                    fileLength = raf.length();
+                    fileLength = new Long(raf.length());
                     fileWriter = new FileWriter(file, true);
                     //true means append data at the end of file
 
@@ -172,7 +172,7 @@ public class ContextIL extends Context {
             long fileSize,
             String message) {
 
-        if (useUnixSocket) {
+        if (useUnixSocket.booleanValue()) {
             try {
                 System.loadLibrary("sendviasocket");
                message += '\n';
@@ -184,7 +184,7 @@ public class ContextIL extends Context {
                         timeout);
                 
             } catch (UnsatisfiedLinkError ex) {
-                useUnixSocket = false;
+                useUnixSocket = Boolean.FALSE;
                 System.err.println(ex);
             }
         }
@@ -196,7 +196,6 @@ public class ContextIL extends Context {
      * @param event event
      * @throws java.lang.IllegalArgumentException if event, prefix or path
      */
-    @Override
     public void log(Event event) {
         if (event == null) {
             throw new IllegalArgumentException("ContextIL event");
@@ -208,12 +207,12 @@ public class ContextIL extends Context {
 
         if (pathToSocket == null || pathToSocket.equals("")) { 
             pathToSocket = new String("");
-            useUnixSocket = false;
+            useUnixSocket = Boolean.FALSE;
         }
 
         if (pathToNativeLib == null || pathToNativeLib.equals("")) { 
             pathToNativeLib = new String("");
-            useUnixSocket = false;
+            useUnixSocket = Boolean.FALSE;
         }
         
         super.log(event);
@@ -221,7 +220,7 @@ public class ContextIL extends Context {
 
         Long fileLength = writeToFile(prefix, message);
 
-        writeToSocket(pathToSocket, fileLength, message);
+        writeToSocket(pathToSocket, fileLength.longValue(), message);
     }
 
     /**
index c8f16ff..581d521 100755 (executable)
@@ -93,7 +93,7 @@ public class ContextProxy extends Context {
                     if (!file.exists()) {
                         continue;
                     }
-                    fileLength = raf.length();
+                    fileLength = new Long(raf.length());
                     fileWriter = new FileWriter(file, true);
                     //true means append data to the end of file
                     
@@ -141,7 +141,8 @@ public class ContextProxy extends Context {
             socket.setEnabledProtocols(new String[]{"SSLv3"});   //  SSLv2Hello, SSLv3,TLSv1
             //enable only ciphers without RC4 (some bug in JSSE?)
             String[] ciphers = socket.getEnabledCipherSuites();
-            ArrayList<String> al = new ArrayList<String>(ciphers.length);
+//            ArrayList<String> al = new ArrayList<String>(ciphers.length);
+            ArrayList al = new ArrayList(ciphers.length);
             for (int i = 0; i < ciphers.length; i++) {
                 if (ciphers[i].indexOf("RC4") == -1) al.add(ciphers[i]);
             }
@@ -163,7 +164,6 @@ public class ContextProxy extends Context {
         }
     }
 
-    @Override
     public void log(Event event) {
         if (event == null) {
             throw new IllegalArgumentException("ContextProxy event");
index ca58fa0..e8450b3 100755 (executable)
@@ -33,7 +33,7 @@ public class SeqCode {
      * @param part part of sequence number which will be increased
      */
     public void incrementSeqCode(Sources part) {
-        seqCode[part.ordinal()-1]++;
+        seqCode[part.source-1]++;
     }
     
     /**
@@ -60,13 +60,12 @@ public class SeqCode {
             } else {
                 colonPosition = seqCodeString.indexOf(':', currentPosition);
             }
-            seqCode[i] = new Integer(seqCodeString.substring(equalsPosition+1, colonPosition));
+            seqCode[i] = (new Integer(seqCodeString.substring(equalsPosition+1, colonPosition))).intValue();
             currentPosition = colonPosition + 1;
         }
         
     }
     
-    @Override
     public String toString() {        
         String tmp = Integer.toString(seqCode[0]);    
         String output = "UI=";
index 651c471..af48310 100755 (executable)
@@ -5,15 +5,25 @@ package org.glite.lb.client_java;
  * 
  * @author Pavel Piskac (173297@mail.muni.cz)
  */
-public enum Sources {
-    EDG_WLL_SOURCE_NONE,            /* uninitialized value */
-    EDG_WLL_SOURCE_USER_INTERFACE,
-    EDG_WLL_SOURCE_NETWORK_SERVER,
-    EDG_WLL_SOURCE_WORKLOAD_MANAGER,
-    EDG_WLL_SOURCE_BIG_HELPER,
-    EDG_WLL_SOURCE_JOB_SUBMISSION,
-    EDG_WLL_SOURCE_LOG_MONITOR,
-    EDG_WLL_SOURCE_LRMS,
-    EDG_WLL_SOURCE_APPLICATION,
-    EDG_WLL_SOURCE_LB_SERVER
+public class Sources {
+    public static final int EDG_WLL_SOURCE_NONE = 0;            /* uninitialized value */
+    public static final int EDG_WLL_SOURCE_USER_INTERFACE = 1;
+    public static final int EDG_WLL_SOURCE_NETWORK_SERVER = 2;
+    public static final int EDG_WLL_SOURCE_WORKLOAD_MANAGER = 3;
+    public static final int EDG_WLL_SOURCE_BIG_HELPER = 4;
+    public static final int EDG_WLL_SOURCE_JOB_SUBMISSION = 5;
+    public static final int EDG_WLL_SOURCE_LOG_MONITOR = 6;
+    public static final int EDG_WLL_SOURCE_LRMS = 7;
+    public static final int EDG_WLL_SOURCE_APPLICATION = 8;
+    public static final int EDG_WLL_SOURCE_LB_SERVER = 9;
+    
+    public int source;
+    
+    public Sources() {
+       this.source = 0;
+    }
+    
+    public Sources(int source) {
+       this.source = source;
+    }
 }
index 0740b01..4e4b7be 100755 (executable)
@@ -113,12 +113,12 @@ public class Test {
              * In this case we have to use method which converts args[2] to Sources. In real environment it will
              * not be used.
              */
-            ctx.setSource(stringToSources(args[2]));
+            ctx.setSource(new Sources(stringToSources(args[2])));
 
             /* Flag tells which part of the sequence number will be increased. It is a number in range from 0 to 8
              * Example: ctx.setFlag(0);
              */
-            ctx.setFlag(new Integer(args[3]));
+            ctx.setFlag((new Integer(args[3])).intValue());
 
             /* Name of the computer where is locallogger running
              * Example: ctx.setHost("pelargir.ics.muni.cz");
@@ -185,7 +185,7 @@ public class Test {
      * This method helps with converting String from input to convert to Source.
      * In real environment it will not be used.
      */
-    private static Sources stringToSources(String source) {         
+    private static int stringToSources(String source) {
         if (source.equals("Sources.EDG_WLL_SOURCE_NONE")) return Sources.EDG_WLL_SOURCE_NONE;
         if (source.equals("Sources.EDG_WLL_SOURCE_USER_INTERFACE")) return Sources.EDG_WLL_SOURCE_USER_INTERFACE;
         if (source.equals("Sources.EDG_WLL_SOURCE_NETWORK_SERVER")) return Sources.EDG_WLL_SOURCE_NETWORK_SERVER;
@@ -197,6 +197,5 @@ public class Test {
         if (source.equals("Sources.EDG_WLL_SOURCE_APPLICATION")) return Sources.EDG_WLL_SOURCE_APPLICATION;
         if (source.equals("Sources.EDG_WLL_SOURCE_LB_SERVER")) return Sources.EDG_WLL_SOURCE_LB_SERVER;
         throw new IllegalArgumentException("wrong source type");
-
     }
 }