From 69004576bd13279607a374283b68c1f525334bcd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ale=C5=A1=20K=C5=99enek?= Date: Thu, 17 Apr 2008 11:51:21 +0000 Subject: [PATCH] Valtri's patch to make it work on SLC4 (doesn't seem to break anything on SuSE 10.2 too) --- org.glite.lb.client-java/nbproject/build-impl.xml | 8 +++--- .../nbproject/project.properties | 7 +++-- .../src/org/glite/lb/client_java/Context.java | 22 +++++++-------- .../src/org/glite/lb/client_java/ContextIL.java | 15 +++++----- .../src/org/glite/lb/client_java/ContextProxy.java | 6 ++-- .../src/org/glite/lb/client_java/SeqCode.java | 5 ++-- .../src/org/glite/lb/client_java/Sources.java | 32 ++++++++++++++-------- .../src/org/glite/test/Test.java | 7 ++--- 8 files changed, 55 insertions(+), 47 deletions(-) diff --git a/org.glite.lb.client-java/nbproject/build-impl.xml b/org.glite.lb.client-java/nbproject/build-impl.xml index a15c213..9bdbafd 100755 --- a/org.glite.lb.client-java/nbproject/build-impl.xml +++ b/org.glite.lb.client-java/nbproject/build-impl.xml @@ -112,7 +112,7 @@ is divided into following sections: - + @@ -155,7 +155,7 @@ is divided into following sections: - + @@ -250,7 +250,7 @@ is divided into following sections: - + @@ -469,7 +469,7 @@ is divided into following sections: --> - + diff --git a/org.glite.lb.client-java/nbproject/project.properties b/org.glite.lb.client-java/nbproject/project.properties index ba29c74..33e3dd9 100755 --- a/org.glite.lb.client-java/nbproject/project.properties +++ b/org.glite.lb.client-java/nbproject/project.properties @@ -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= diff --git a/org.glite.lb.client-java/src/org/glite/lb/client_java/Context.java b/org.glite.lb.client-java/src/org/glite/lb/client_java/Context.java index 5143bde..9b1fe9c 100755 --- a/org.glite.lb.client-java/src/org/glite/lb/client_java/Context.java +++ b/org.glite.lb.client-java/src/org/glite/lb/client_java/Context.java @@ -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"); } } diff --git a/org.glite.lb.client-java/src/org/glite/lb/client_java/ContextIL.java b/org.glite.lb.client-java/src/org/glite/lb/client_java/ContextIL.java index 03eaa9e..16ca38d 100755 --- a/org.glite.lb.client-java/src/org/glite/lb/client_java/ContextIL.java +++ b/org.glite.lb.client-java/src/org/glite/lb/client_java/ContextIL.java @@ -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); } /** diff --git a/org.glite.lb.client-java/src/org/glite/lb/client_java/ContextProxy.java b/org.glite.lb.client-java/src/org/glite/lb/client_java/ContextProxy.java index c8f16ff..581d521 100755 --- a/org.glite.lb.client-java/src/org/glite/lb/client_java/ContextProxy.java +++ b/org.glite.lb.client-java/src/org/glite/lb/client_java/ContextProxy.java @@ -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 al = new ArrayList(ciphers.length); +// ArrayList al = new ArrayList(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"); diff --git a/org.glite.lb.client-java/src/org/glite/lb/client_java/SeqCode.java b/org.glite.lb.client-java/src/org/glite/lb/client_java/SeqCode.java index ca58fa0..e8450b3 100755 --- a/org.glite.lb.client-java/src/org/glite/lb/client_java/SeqCode.java +++ b/org.glite.lb.client-java/src/org/glite/lb/client_java/SeqCode.java @@ -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="; diff --git a/org.glite.lb.client-java/src/org/glite/lb/client_java/Sources.java b/org.glite.lb.client-java/src/org/glite/lb/client_java/Sources.java index 651c471..af48310 100755 --- a/org.glite.lb.client-java/src/org/glite/lb/client_java/Sources.java +++ b/org.glite.lb.client-java/src/org/glite/lb/client_java/Sources.java @@ -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; + } } diff --git a/org.glite.lb.client-java/src/org/glite/test/Test.java b/org.glite.lb.client-java/src/org/glite/test/Test.java index 0740b01..4e4b7be 100755 --- a/org.glite.lb.client-java/src/org/glite/test/Test.java +++ b/org.glite.lb.client-java/src/org/glite/test/Test.java @@ -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"); - } } -- 1.8.2.3