diff --git a/.classpath b/.classpath
index 81c1a7b..e943848 100644
--- a/.classpath
+++ b/.classpath
@@ -5,12 +5,11 @@
-
-
+
diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component
index 92485e5..685e12c 100644
--- a/.settings/org.eclipse.wst.common.component
+++ b/.settings/org.eclipse.wst.common.component
@@ -1,6 +1,4 @@
-
-
+
-
diff --git a/src/zutil/log/net/NetLogClient.java b/src/zutil/log/net/NetLogClient.java
new file mode 100644
index 0000000..8cce4e8
--- /dev/null
+++ b/src/zutil/log/net/NetLogClient.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ziver Koc
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ ******************************************************************************/
+package zutil.log.net;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import zutil.log.LogUtil;
+
+
+public class NetLogClient extends Thread{
+ private static final Logger logger = LogUtil.getLogger();
+
+ private ConcurrentLinkedQueue listeners;
+ private Socket s;
+
+ public NetLogClient(String host, int port) throws UnknownHostException, IOException{
+ s = new Socket(host, port);
+ listeners = new ConcurrentLinkedQueue();
+ this.start();
+ }
+
+ public void addListener(NetLogListener listener){
+ logger.info("Registring new NetLogListener: "+listener.getClass().getName());
+ listeners.add( listener );
+ }
+
+ public void run(){
+ try{
+ ObjectInputStream in = new ObjectInputStream( s.getInputStream() );
+ while( true ){
+ Object o = in.readObject();
+
+ for( NetLogListener listener : listeners ){
+ if( o instanceof NetLogMessage )
+ listener.handleLogMessage((NetLogMessage)o);
+ else if( o instanceof NetLogExceptionMessage )
+ listener.handleExceptionMessage((NetLogExceptionMessage)o);
+ else if( o instanceof NetLogStatusMessage )
+ listener.handleStatusMessage((NetLogStatusMessage)o);
+ else
+ logger.warning("Received unknown message: "+o.getClass().getName());
+ }
+ }
+ } catch( Exception e ){
+ logger.log(Level.SEVERE, null, e);
+ close();
+ }
+ }
+
+
+
+ public void close(){
+ try{
+ this.interrupt();
+ s.close();
+ } catch (Exception e){
+ logger.log(Level.SEVERE, "Unable to close Client Socket.", e);
+ }
+ }
+}
diff --git a/src/zutil/log/net/NetLogExceptionMessage.java b/src/zutil/log/net/NetLogExceptionMessage.java
new file mode 100644
index 0000000..77742b2
--- /dev/null
+++ b/src/zutil/log/net/NetLogExceptionMessage.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ziver Koc
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ ******************************************************************************/
+package zutil.log.net;
+
+import java.util.logging.LogRecord;
+
+import zutil.net.nio.message.Message;
+
+public class NetLogExceptionMessage extends Message {
+ private static final long serialVersionUID = 1L;
+
+ private int count;
+ private String name;
+ private String message;
+ private String stackTrace;
+
+ NetLogExceptionMessage(String name, String message, String stackTrace){
+ this.count = 1;
+ this.name = name;
+ this.message = message;
+ this.stackTrace = stackTrace;
+ }
+
+ public NetLogExceptionMessage(LogRecord record) {
+ Throwable exception = record.getThrown();
+
+ this.count = 1;
+ this.name = exception.getClass().getName();
+ this.message = exception.getMessage();
+ this.stackTrace = "";
+ for(int i=0; i exceptionData =
+ FXCollections.observableArrayList(
+ new NetLogExceptionMessage("java.lang.NullPointerException", "", " at com.example.myproject.Book.getTitle(Book.java:16) \n at com.example.myproject.Author.getBookTitles(Author.java:25) \n at com.example.myproject.Bootstrap.main(Bootstrap.java:14)"),
+ new NetLogExceptionMessage("java.lang.NullPointerException", "", " at com.example.myproject.Book.getTitle(Book.java:16) \n at com.example.myproject.Author.getBookTitles(Author.java:25) \n at com.example.myproject.Bootstrap.main(Bootstrap.java:14)"),
+ new NetLogExceptionMessage("java.io.FileNotFoundException", "fred.txt", " at java.io.FileInputStream.(FileInputStream.java) \n at java.io.FileInputStream.(FileInputStream.java) \n at ExTest.readMyFile(ExTest.java:19) \n at ExTest.main(ExTest.java:7)")
+ );
+
+ // UI elements
+ @FXML private ToggleButton pauseButton;
+ @FXML private Label logCountLabel;
+ @FXML private ProgressBar progressBar;
+
+ @FXML private TableView logTable;
+ @FXML private TableColumn logTimestampColumn;
+ @FXML private TableColumn logLevelColumn;
+ @FXML private TableColumn logColumn;
+
+ @FXML private TableView exceptionTable;
+ @FXML private TableColumn exCountColumn;
+ @FXML private TableColumn exNameColumn;
+ @FXML private TableColumn exMessageColumn;
+ @FXML private TableColumn exStackTraceColumn;
+
+
+ public void initialize(URL arg0, ResourceBundle arg1) {
+ // Connect to Server
+ try{
+ net = new NetLogClient("localhost", 5050);
+ net.addListener( this );
+ status = Status.RUNNING;
+ }catch(Exception e){
+ logger.log(Level.SEVERE, null, e);
+ status = Status.DISCONNECTED;
+ }
+ updateStatus();
+
+ // Setup Gui
+ logTimestampColumn.setCellValueFactory(new PropertyValueFactory("timestamp"));
+ logLevelColumn.setCellValueFactory(new PropertyValueFactory("level"));
+ logColumn.setCellValueFactory(new PropertyValueFactory("log"));
+
+ exCountColumn.setCellValueFactory(new PropertyValueFactory("count"));
+ exNameColumn.setCellValueFactory(new PropertyValueFactory("name"));
+ exMessageColumn.setCellValueFactory(new PropertyValueFactory("message"));
+ exStackTraceColumn.setCellValueFactory(new PropertyValueFactory("stackTrace"));
+
+ //logTable.setItems(logData);
+ exceptionTable.setItems(exceptionData);
+ }
+
+ /************* NETWORK *****************/
+ public void handleLogMessage(NetLogMessage log) {
+ logTable.getItems().add( log );
+ }
+
+ public void handleExceptionMessage(NetLogExceptionMessage exception) {
+ exceptionTable.getItems().add( exception );
+ }
+
+ public void handleStatusMessage(NetLogStatusMessage status) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /*************** GUI *******************/
+ @FXML
+ protected void handlePauseAction(ActionEvent event) {
+ if(status == Status.RUNNING){
+ status = Status.PAUSED;
+ logger.info("Logging paused");
+ }
+ else if(status == Status.PAUSED){
+ status = Status.RUNNING;
+ logger.info("Logging Unpaused");
+ }
+ updateStatus();
+ }
+
+ @FXML
+ protected void handleDisconnectAction(Event event) {
+ logger.info("Disconnecting from Log Server");
+ net.close();
+ status = Status.DISCONNECTED;
+ updateStatus();
+ }
+
+ @FXML
+ protected void handleLevelChanged(ActionEvent event) {
+ logger.info("Updating Log Level");
+ }
+
+ @FXML
+ protected void handleIntervalChanged(ActionEvent event) {
+ logger.info("Updating Log Interval");
+ }
+
+ private void updateStatus(){
+ if(progressBar == null || pauseButton == null){
+ return;
+ }
+
+ if(status == Status.RUNNING){
+ progressBar.setProgress(-1.0);
+ pauseButton.setText("Pause");
+ }
+ else if(status == Status.PAUSED){
+ progressBar.setProgress(1.0);
+ pauseButton.setText("Unpause");
+ }
+ else if(status == Status.DISCONNECTED){
+ progressBar.setProgress(0);
+ pauseButton.disableProperty();
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/zutil/log/net/NetLogListener.java b/src/zutil/log/net/NetLogListener.java
new file mode 100644
index 0000000..23fd6fd
--- /dev/null
+++ b/src/zutil/log/net/NetLogListener.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ziver Koc
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ ******************************************************************************/
+package zutil.log.net;
+
+
+public interface NetLogListener {
+ /**
+ * Handle incoming log messages
+ */
+ public void handleLogMessage( NetLogMessage log );
+
+ /**
+ * Handle incoming exception messages
+ */
+ public void handleExceptionMessage( NetLogExceptionMessage exception );
+
+ /**
+ * Handle incoming status messages
+ */
+ public void handleStatusMessage( NetLogStatusMessage status );
+}
diff --git a/src/zutil/log/net/NetLogMessage.java b/src/zutil/log/net/NetLogMessage.java
new file mode 100644
index 0000000..cf2a657
--- /dev/null
+++ b/src/zutil/log/net/NetLogMessage.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ziver Koc
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ ******************************************************************************/
+package zutil.log.net;
+
+import java.util.logging.LogRecord;
+
+import zutil.net.nio.message.Message;
+
+public class NetLogMessage extends Message {
+ private static final long serialVersionUID = 1L;
+
+ private long timestamp;
+ private String level;
+ private int threadID;
+ private String className;
+ private String methodName;
+ private String log;
+
+ public NetLogMessage(String level, long timestamp, String log){
+ this.level = level;
+ this.timestamp = timestamp;
+ this.log = log;
+ }
+
+ public NetLogMessage( LogRecord record ){
+ timestamp = record.getMillis();
+ level = record.getLevel().getName();
+ threadID = record.getThreadID();
+ className = record.getSourceClassName();
+ methodName = record.getSourceMethodName();
+ log = record.getMessage();
+ }
+
+
+
+ public long getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(long timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public String getLevel() {
+ return level;
+ }
+
+ public void setLevel(String level) {
+ this.level = level;
+ }
+
+ public int getThreadID() {
+ return threadID;
+ }
+
+ public void setThreadID(int threadID) {
+ this.threadID = threadID;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public String getMethodName() {
+ return methodName;
+ }
+
+ public void setMethodName(String methodName) {
+ this.methodName = methodName;
+ }
+
+ public String getLog() {
+ return log;
+ }
+
+ public void setLog(String log) {
+ this.log = log;
+ }
+
+
+}
diff --git a/src/zutil/log/net/NetLogServer.java b/src/zutil/log/net/NetLogServer.java
new file mode 100644
index 0000000..54296a2
--- /dev/null
+++ b/src/zutil/log/net/NetLogServer.java
@@ -0,0 +1,153 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ziver Koc
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ ******************************************************************************/
+package zutil.log.net;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.net.Socket;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+
+import zutil.log.LogUtil;
+import zutil.net.nio.message.Message;
+import zutil.net.threaded.ThreadedTCPNetworkServer;
+import zutil.net.threaded.ThreadedTCPNetworkServerThread;
+
+
+public class NetLogServer extends Handler {
+ private static final Logger logger = LogUtil.getLogger();
+
+ private NetLogNetwork net;
+
+ /**
+ * @param port the port the server will listen on
+ */
+ public NetLogServer(int port) {
+ super();
+ net = new NetLogNetwork(port);
+
+ }
+
+
+ public void publish(LogRecord record) {
+ // ensure that this log record should be logged by this Handler
+ if (!isLoggable(record))
+ return;
+
+ // Output the formatted data to the file
+ if(record.getThrown() != null){
+ NetLogExceptionMessage exception = new NetLogExceptionMessage(record);
+ net.sendMessage( exception );
+ }
+ else{
+ NetLogMessage log = new NetLogMessage(record);
+ net.sendMessage( log );
+ }
+ }
+
+ public void flush() {}
+
+ public void close() {
+ net.close();
+ }
+
+
+ class NetLogNetwork extends ThreadedTCPNetworkServer{
+ private ConcurrentLinkedQueue threads;
+
+ public NetLogNetwork(int port) {
+ super(port);
+ threads = new ConcurrentLinkedQueue();
+ }
+
+ public void sendMessage(Message log){
+ for( NetLogServerThread thread : threads ){
+ thread.queueMessage( log );
+ }
+ }
+
+ @Override
+ protected ThreadedTCPNetworkServerThread getThreadInstance(Socket s) {
+ try {
+ NetLogServerThread thread = new NetLogServerThread(s);
+ logger.info("Client connection from: "+s.getInetAddress());
+ threads.add( thread );
+ return thread;
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, "Unable to start Client thread", e);
+ }
+ return null;
+ }
+
+
+ class NetLogServerThread implements ThreadedTCPNetworkServerThread{
+ private Queue queue;
+ private ObjectOutputStream out;
+ private Socket s;
+
+ public NetLogServerThread(Socket s) throws IOException{
+ queue = new LinkedList();
+ this.s = s;
+ out = new ObjectOutputStream( s.getOutputStream() );
+ }
+
+ public void queueMessage(Message log){
+ queue.add( log );
+ queue.notify();
+ }
+
+ public void run() {
+ try {
+ while( true ){
+ while( !queue.isEmpty() ){
+ Message msg = queue.poll();
+ out.writeObject( msg );
+ }
+ queue.wait();
+
+ }
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, null, e);
+ } finally {
+ this.close();
+ }
+ }
+
+
+ public void close(){
+ try {
+ out.close();
+ s.close();
+ queue = null;
+ threads.remove(this);
+ } catch (IOException e) {
+ logger.log(Level.SEVERE, "Unable to close Client Socket", e);
+ }
+ }
+ }
+ }
+}
diff --git a/src/zutil/log/net/NetLogStatusMessage.java b/src/zutil/log/net/NetLogStatusMessage.java
new file mode 100644
index 0000000..1b1233e
--- /dev/null
+++ b/src/zutil/log/net/NetLogStatusMessage.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Ziver Koc
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ ******************************************************************************/
+package zutil.log.net;
+
+import zutil.net.nio.message.Message;
+
+public class NetLogStatusMessage extends Message{
+ private static final long serialVersionUID = 1L;
+
+ public long totalMemory;
+ public long freememory;
+}
diff --git a/src/zutil/log/netlog/NetLoggerClient.fxml b/src/zutil/log/net/NetLoggerClient.fxml
similarity index 97%
rename from src/zutil/log/netlog/NetLoggerClient.fxml
rename to src/zutil/log/net/NetLoggerClient.fxml
index db10222..e1b7ceb 100644
--- a/src/zutil/log/netlog/NetLoggerClient.fxml
+++ b/src/zutil/log/net/NetLoggerClient.fxml
@@ -8,7 +8,7 @@
-
+
diff --git a/src/zutil/log/netlog/NetLoggerClientInstance.css b/src/zutil/log/net/NetLoggerClientInstance.css
similarity index 100%
rename from src/zutil/log/netlog/NetLoggerClientInstance.css
rename to src/zutil/log/net/NetLoggerClientInstance.css
diff --git a/src/zutil/log/netlog/NetLoggerClientInstance.fxml b/src/zutil/log/net/NetLoggerClientInstance.fxml
similarity index 99%
rename from src/zutil/log/netlog/NetLoggerClientInstance.fxml
rename to src/zutil/log/net/NetLoggerClientInstance.fxml
index 8afb930..a43a7de 100644
--- a/src/zutil/log/netlog/NetLoggerClientInstance.fxml
+++ b/src/zutil/log/net/NetLoggerClientInstance.fxml
@@ -9,7 +9,7 @@
-
+
diff --git a/src/zutil/log/netlog/NLExceptionData.java b/src/zutil/log/netlog/NLExceptionData.java
deleted file mode 100644
index 6a4cc61..0000000
--- a/src/zutil/log/netlog/NLExceptionData.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package zutil.log.netlog;
-
-public class NLExceptionData {
-
- private int count;
- private String name;
- private String message;
- private String stackTrace;
-
- NLExceptionData(String name, String message, String stackTrace){
- this.count = 0;
- this.name = name;
- this.message = message;
- this.stackTrace = stackTrace;
- }
-
-
-
- public int getCount() {
- return count;
- }
-
- public void setCount(int count) {
- this.count = count;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public String getStackTrace() {
- return stackTrace;
- }
-
- public void setStackTrace(String stackTrace) {
- this.stackTrace = stackTrace;
- }
-}
diff --git a/src/zutil/log/netlog/NLLogData.java b/src/zutil/log/netlog/NLLogData.java
deleted file mode 100644
index abd5b41..0000000
--- a/src/zutil/log/netlog/NLLogData.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package zutil.log.netlog;
-
-public class NLLogData {
-
- private String level;
- private long timestamp;
- private String log;
-
- NLLogData(String level, long timestamp, String log){
- this.level = level;
- this.timestamp = timestamp;
- this.log = log;
- }
-
-
- public String getLevel() {
- return level;
- }
-
- public void setLevel(String level) {
- this.level = level;
- }
-
- public long getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(long timestamp) {
- this.timestamp = timestamp;
- }
-
- public String getLog() {
- return log;
- }
-
- public void setLog(String log) {
- this.log = log;
- }
-}
diff --git a/src/zutil/log/netlog/NetLoggerClientInstance.java b/src/zutil/log/netlog/NetLoggerClientInstance.java
deleted file mode 100644
index dc09d9a..0000000
--- a/src/zutil/log/netlog/NetLoggerClientInstance.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package zutil.log.netlog;
-
-import java.net.URL;
-import java.util.ResourceBundle;
-
-import javafx.collections.FXCollections;
-import javafx.collections.ObservableList;
-import javafx.event.ActionEvent;
-import javafx.event.Event;
-import javafx.fxml.FXML;
-import javafx.fxml.Initializable;
-import javafx.scene.control.ProgressBar;
-import javafx.scene.control.TableColumn;
-import javafx.scene.control.ToggleButton;
-import javafx.scene.control.TableView;
-import javafx.scene.control.Label;
-import javafx.scene.control.cell.PropertyValueFactory;
-
-public class NetLoggerClientInstance implements Initializable {
- private enum Status{RUNNING, PAUSED, DISCONNECTED}
-
- // Logic variables
- private Status status;
-
- private final ObservableList exceptionData =
- FXCollections.observableArrayList(
- new NLExceptionData("java.lang.NullPointerException", "", " at com.example.myproject.Book.getTitle(Book.java:16) \n at com.example.myproject.Author.getBookTitles(Author.java:25) \n at com.example.myproject.Bootstrap.main(Bootstrap.java:14)"),
- new NLExceptionData("java.lang.NullPointerException", "", " at com.example.myproject.Book.getTitle(Book.java:16) \n at com.example.myproject.Author.getBookTitles(Author.java:25) \n at com.example.myproject.Bootstrap.main(Bootstrap.java:14)"),
- new NLExceptionData("java.io.FileNotFoundException", "fred.txt", " at java.io.FileInputStream.(FileInputStream.java) \n at java.io.FileInputStream.(FileInputStream.java) \n at ExTest.readMyFile(ExTest.java:19) \n at ExTest.main(ExTest.java:7)")
- );
-
- // UI elements
- @FXML private ToggleButton pauseButton;
-
- @FXML private TableView logTable;
- @FXML private TableColumn logTimestampColumn;
- @FXML private TableColumn logLevelColumn;
- @FXML private TableColumn logColumn;
-
- @FXML private TableView exceptionTable;
- @FXML private TableColumn exCountColumn;
- @FXML private TableColumn exNameColumn;
- @FXML private TableColumn exMessageColumn;
- @FXML private TableColumn exStackTraceColumn;
-
- @FXML private Label logCountLabel;
- @FXML private ProgressBar progressBar;
-
-
- public void initialize(URL arg0, ResourceBundle arg1) {
- status = Status.RUNNING;
- updateStatus();
-
- logTimestampColumn.setCellValueFactory(new PropertyValueFactory("timestamp"));
- logLevelColumn.setCellValueFactory(new PropertyValueFactory("level"));
- logColumn.setCellValueFactory(new PropertyValueFactory("log"));
-
- exCountColumn.setCellValueFactory(new PropertyValueFactory("count"));
- exNameColumn.setCellValueFactory(new PropertyValueFactory("name"));
- exMessageColumn.setCellValueFactory(new PropertyValueFactory("message"));
- exStackTraceColumn.setCellValueFactory(new PropertyValueFactory("stackTrace"));
-
- //logTable.setItems(logData);
- exceptionTable.setItems(exceptionData);
- }
-
- @FXML
- protected void handlePauseAction(ActionEvent event) {
- if(status == Status.RUNNING){
- status = Status.PAUSED;
- System.out.println("Logging Paused");
- }
- else if(status == Status.PAUSED){
- status = Status.RUNNING;
- System.out.println("Logging Unpaused");
- }
- updateStatus();
- }
-
- @FXML
- protected void handleDisconnectAction(Event event) {
- System.out.println("Disconnected changed");
- status = Status.DISCONNECTED;
- updateStatus();
- }
-
- @FXML
- protected void handleLevelChanged(ActionEvent event) {
- System.out.println("Level changed");
- }
-
- @FXML
- protected void handleIntervalChanged(ActionEvent event) {
- System.out.println("Interval changed");
- }
-
- private void updateStatus(){
- if(progressBar == null || pauseButton == null){
- System.out.println("progressBar="+progressBar+" pauseButton="+pauseButton);
- return;
- }
-
- System.out.println("Status: "+status);
-
- if(status == Status.RUNNING){
- progressBar.setProgress(-1.0);
- pauseButton.setText("Pause");
- }
- else if(status == Status.PAUSED){
- progressBar.setProgress(1.0);
- pauseButton.setText("Unpause");
- }
- else if(status == Status.DISCONNECTED){
- progressBar.setProgress(0);
- pauseButton.disableProperty();
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/zutil/net/http/HttpClient.java b/src/zutil/net/http/HttpClient.java
index e81dd66..b68adee 100644
--- a/src/zutil/net/http/HttpClient.java
+++ b/src/zutil/net/http/HttpClient.java
@@ -107,7 +107,7 @@ public class HttpClient {
}
else
request.println("");
- request.flush();
+ request.close();
// Response
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
diff --git a/src/zutil/net/http/HttpHeaderParser.java b/src/zutil/net/http/HttpHeaderParser.java
index 1aa87d1..63df1ff 100644
--- a/src/zutil/net/http/HttpHeaderParser.java
+++ b/src/zutil/net/http/HttpHeaderParser.java
@@ -85,6 +85,7 @@ public class HttpHeaderParser {
parseLine( tmp );
}
}
+ sc.close();
parseCookies();
}
diff --git a/src/zutil/net/http/multipart/MultipartField.java b/src/zutil/net/http/multipart/MultipartField.java
index 263a623..4ee9e8f 100644
--- a/src/zutil/net/http/multipart/MultipartField.java
+++ b/src/zutil/net/http/multipart/MultipartField.java
@@ -21,11 +21,6 @@
******************************************************************************/
package zutil.net.http.multipart;
-import java.io.BufferedReader;
-import java.io.File;
-
-import zutil.ProgressListener;
-
/**
* A class for handling multipart field
diff --git a/src/zutil/net/http/multipart/MultipartFile.java b/src/zutil/net/http/multipart/MultipartFile.java
index 867335e..01286e5 100644
--- a/src/zutil/net/http/multipart/MultipartFile.java
+++ b/src/zutil/net/http/multipart/MultipartFile.java
@@ -21,11 +21,8 @@
******************************************************************************/
package zutil.net.http.multipart;
-import java.io.BufferedReader;
import java.io.File;
-import zutil.ProgressListener;
-
/**
* A class for handling multipart files
diff --git a/src/zutil/net/http/multipart/MultipartParser.java b/src/zutil/net/http/multipart/MultipartParser.java
index 86db7ab..d67e1af 100644
--- a/src/zutil/net/http/multipart/MultipartParser.java
+++ b/src/zutil/net/http/multipart/MultipartParser.java
@@ -21,12 +21,8 @@
******************************************************************************/
package zutil.net.http.multipart;
-import java.io.BufferedOutputStream;
import java.io.BufferedReader;
-import java.io.BufferedWriter;
import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -101,83 +97,15 @@ public class MultipartParser {
*/
public List parse() throws IOException{
ArrayList list = new ArrayList();
- // TODO: parse(list, delimiter);
+ parse(list, delimiter);
return list;
}
-// TODO:
-/*
+
private void parse(List list, String delimiter) throws IOException{
- String line = "";
- MultipartField field = null;
- delimiter = "--"+delimiter;
- String endDelimiter = delimiter+"--";
- BufferedWriter out = null;
- // Parsing the stream
- while(line != null){
- line = in.readLine();
- // Skip empty lines
- if(line == null || line.trim().isEmpty())
- continue;
- // End of field
- else if(line.equals( endDelimiter )){
- list.add(field);
- if(out != null) out.close();
- field.length = field.file.length();
- out = null;
- field = null;
- continue;
- }
- // New field
- else if(line.equals( delimiter )){
- if(field != null){
- list.add(field);
- if(out != null) out.close();
- field.length = field.file.length();
- out = null;
- field = null;
- }
- // Read the content-disposition
- line = in.readLine();
- if(line.toLowerCase().startsWith("content-disposition")){
- line = line.split(":", 2)[1];
- String[] fieldData = line.split(" *; *");
- //String type = fieldData[0].toLowerCase();
- field = new MultipartField();
- field.type = MultipartField.FieldType.Field;
-
- // Parse content-disposition parameters
- for(String param : fieldData){
- String[] temp = param.split(" *= *");
- if(temp[0].equalsIgnoreCase("name"))
- field.fieldname = temp[1];
- else if(temp[0].equalsIgnoreCase("filename")){
- field.filename = temp[1];
- field.file = createTempFile();
- out = new BufferedWriter(new FileWriter(field.file));
- field.type = MultipartField.FieldType.File;
- }
- }
- }
- else
- throw new IOException("MultipartForm parse error unrecognized line: "+line);
- }
- // Read field data
- else if(field != null){
- if(field.type == MultipartField.FieldType.File){
- out.append(line);
- }
- else{
- field.value += line;
- }
- field.received += line.length();
- }
- }
-
- if(field != null)
- throw new IOException("MultipartForm parse error stream ended prematurely");
+ // TODO:
}
-*/
+
/**
* Creates a temporary file in either the system
diff --git a/src/zutil/net/http/soap/SOAPHttpPage.java b/src/zutil/net/http/soap/SOAPHttpPage.java
index 9291bae..328fc98 100644
--- a/src/zutil/net/http/soap/SOAPHttpPage.java
+++ b/src/zutil/net/http/soap/SOAPHttpPage.java
@@ -46,7 +46,7 @@ import zutil.net.ws.WSParameterDef;
import zutil.net.ws.WSReturnObject;
import zutil.net.ws.WSReturnObject.WSValueName;
import zutil.net.ws.WebServiceDef;
-import zutil.parser.wsdl.WSDLWriter;
+import zutil.parser.wsdl.WSDLWriterOld;
/**
* This is an HTTPPage for the HTTPServer that
@@ -87,7 +87,7 @@ public class SOAPHttpPage implements HttpPage{
/** This instance of the web service class is used if session is disabled **/
private WSInterface ws;
/** The WSDL document **/
- private WSDLWriter wsdl;
+ private WSDLWriterOld wsdl;
/** Session enabled **/
private boolean session_enabled;
@@ -95,7 +95,7 @@ public class SOAPHttpPage implements HttpPage{
this.wsDef = wsDef;
this.session_enabled = false;
- wsdl = new WSDLWriter( wsDef );
+ wsdl = new WSDLWriterOld( wsDef );
}
/**
diff --git a/src/zutil/net/threaded/ThreadedTCPNetworkServer.java b/src/zutil/net/threaded/ThreadedTCPNetworkServer.java
index f04035e..4155f17 100644
--- a/src/zutil/net/threaded/ThreadedTCPNetworkServer.java
+++ b/src/zutil/net/threaded/ThreadedTCPNetworkServer.java
@@ -43,7 +43,7 @@ import zutil.log.LogUtil;
* @author Ziver
*/
public abstract class ThreadedTCPNetworkServer extends Thread{
- public static final Logger logger = LogUtil.getLogger();
+ private static final Logger logger = LogUtil.getLogger();
public final int port;
private File keyStore;
diff --git a/src/zutil/parser/Base64Decoder.java b/src/zutil/parser/Base64Decoder.java
index 4813559..d4d0d98 100644
--- a/src/zutil/parser/Base64Decoder.java
+++ b/src/zutil/parser/Base64Decoder.java
@@ -34,7 +34,7 @@ public class Base64Decoder {
public static String decode( String data ){
Base64Decoder base64 = new Base64Decoder();
base64.write( data );
- return base64.getString();
+ return base64.toString();
}
public void write( String data ){
@@ -76,7 +76,7 @@ public class Base64Decoder {
output.append( buffer, 0, buffi );
}
- public String getString(){
+ public String toString(){
return output.getString();
}
@@ -84,8 +84,8 @@ public class Base64Decoder {
return output.getByte();
}
- public void reset(){
- output.reset();
+ public void clear(){
+ output.clear();
rest = 0;
rest_data = 0;
}
diff --git a/src/zutil/parser/DataNode.java b/src/zutil/parser/DataNode.java
index c9dd0a5..e95e6cf 100644
--- a/src/zutil/parser/DataNode.java
+++ b/src/zutil/parser/DataNode.java
@@ -88,6 +88,8 @@ public class DataNode implements Iterable{
map = new HashMap(); break;
case List:
list = new LinkedList(); break;
+ default:
+ break;
}
}
diff --git a/src/zutil/test/Base64Test.java b/src/zutil/test/Base64Test.java
index bb92a2d..e398445 100644
--- a/src/zutil/test/Base64Test.java
+++ b/src/zutil/test/Base64Test.java
@@ -34,15 +34,15 @@ public class Base64Test {
Base64Decoder decoder = new Base64Decoder();
//decoder.decode("TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=");
//assertEquals( "Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure.", decoder.toString() );
- decoder.reset();
- decoder.decode("YW55IGNhcm5hbCBwbGVhc3VyZQ==");
+ decoder.clear();
+ decoder.write("YW55IGNhcm5hbCBwbGVhc3VyZQ==");
assertEquals( "any carnal pleasure", decoder.toString() );
- decoder.reset();
- decoder.decode("bGVhc3VyZS4=");
+ decoder.clear();
+ decoder.write("bGVhc3VyZS4=");
assertEquals( "leasure.", decoder.toString() );
- decoder.reset();
- decoder.decode("YW55IGNhcm5hbCBwbGVhc3Vy");
+ decoder.clear();
+ decoder.write("YW55IGNhcm5hbCBwbGVhc3Vy");
assertEquals( "any carnal pleasur", decoder.toString() );
- decoder.reset();
+ decoder.clear();
}
}
diff --git a/src/zutil/test/BoundaryBufferedInputStreamTest.java b/src/zutil/test/BoundaryBufferedInputStreamTest.java
index 5424732..1d44892 100644
--- a/src/zutil/test/BoundaryBufferedInputStreamTest.java
+++ b/src/zutil/test/BoundaryBufferedInputStreamTest.java
@@ -30,6 +30,7 @@ import org.junit.Test;
import zutil.io.BoundaryBufferedInputStream;
import zutil.io.StringInputStream;
+@SuppressWarnings("resource")
public class BoundaryBufferedInputStreamTest {
@Test
diff --git a/src/zutil/ui/wizard/Wizard.java b/src/zutil/ui/wizard/Wizard.java
index 8434ba0..2f0fa12 100644
--- a/src/zutil/ui/wizard/Wizard.java
+++ b/src/zutil/ui/wizard/Wizard.java
@@ -54,8 +54,7 @@ import zutil.ui.wizard.listener.BlockingWizardListener;
*/
public class Wizard implements ActionListener{
public static final boolean DEBUG = false;
- private static final long serialVersionUID = 1L;
-
+
/** Some defoult backgrounds for the sidebar */
public static final String BACKGROUND_1 = "zutil/data/wizard1.jpg";
public static final String BACKGROUND_2 = "zutil/data/wizard2.jpg";
diff --git a/src/zutil/ui/wizard/WizardActionHandler.java b/src/zutil/ui/wizard/WizardActionHandler.java
index 2557713..98de77a 100644
--- a/src/zutil/ui/wizard/WizardActionHandler.java
+++ b/src/zutil/ui/wizard/WizardActionHandler.java
@@ -83,7 +83,7 @@ public class WizardActionHandler implements ActionListener, FocusListener, ListS
* JList
*/
else if(c instanceof JList){
- JList o = (JList) c;
+ JList> o = (JList>) c;
o.addListSelectionListener( this );
}
}
@@ -115,7 +115,7 @@ public class WizardActionHandler implements ActionListener, FocusListener, ListS
* JList
*/
else if(c instanceof JList){
- JList o = (JList) c;
+ JList> o = (JList>) c;
values.put( o.getName() , o.getSelectedValue() );
}
}