diff --git a/.gitignore b/.gitignore index fa5143f..ee21036 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /bin/ /test-output/ /javaDoc/ +/build/ +/dist/ diff --git a/build.num b/build.num new file mode 100644 index 0000000..c26a073 --- /dev/null +++ b/build.num @@ -0,0 +1,3 @@ +#Build Number for ANT. Do not edit! +#Mon Sep 05 12:43:48 CEST 2016 +build.number=1 diff --git a/build.properties b/build.properties new file mode 100644 index 0000000..f539b5d --- /dev/null +++ b/build.properties @@ -0,0 +1,3 @@ +product.name=siba +product.revision.major=0 +product.revision.minor=0 diff --git a/build.xml b/build.xml index 9f6b1a4..9fea018 100644 --- a/build.xml +++ b/build.xml @@ -1,93 +1,144 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + Done. + + + + + Type ant -p + + + + + ======================================================================= + + + + + + ======================================================================= + + + classpath=${toString:project.libs} + + + + + + ======================================================================= + + + + + + + + ======================================================================= + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/buildandgit.xml b/buildandgit.xml new file mode 100644 index 0000000..763a794 --- /dev/null +++ b/buildandgit.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/jar-in-jar-loader.zip b/lib/jar-in-jar-loader.zip new file mode 100644 index 0000000..6ee1217 Binary files /dev/null and b/lib/jar-in-jar-loader.zip differ diff --git a/scripts/log4j.properties b/scripts/log4j.properties new file mode 100644 index 0000000..d29fc63 --- /dev/null +++ b/scripts/log4j.properties @@ -0,0 +1,11 @@ +# Log information (priority setting : DEBUG < INFO < WARN < ERROR) +# ################ +log4j.rootLogger = CONSOLE + +log4j.logger.org.dclermonte.siba = WARN + + +#-- +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern = %d{ISO8601} - SIBA [%-5p] %34.34c.%25M - %m%n diff --git a/scripts/siba.bat b/scripts/siba.bat new file mode 100644 index 0000000..ac5277c --- /dev/null +++ b/scripts/siba.bat @@ -0,0 +1,3 @@ +ECHO OFF + +java -Xms368m -Xmx1024m -jar siba.jar %1 %2 %3 %4 %5 %6 %7 diff --git a/scripts/siba.command b/scripts/siba.command new file mode 100644 index 0000000..f2ffc0b --- /dev/null +++ b/scripts/siba.command @@ -0,0 +1,7 @@ +#!/bin/sh + +# Set the current directory with the Siba directory. +cd "`dirname "$0"`" + +# +java -Xms368m -Xmx1024m -jar siba.jar $@ diff --git a/scripts/siba.sh b/scripts/siba.sh new file mode 100644 index 0000000..f2ffc0b --- /dev/null +++ b/scripts/siba.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# Set the current directory with the Siba directory. +cd "`dirname "$0"`" + +# +java -Xms368m -Xmx1024m -jar siba.jar $@ diff --git a/src/org/dclermonte/siba/cli/SibaCLI.java b/src/org/dclermonte/siba/cli/SibaCLI.java index fe9694b..b6df450 100644 --- a/src/org/dclermonte/siba/cli/SibaCLI.java +++ b/src/org/dclermonte/siba/cli/SibaCLI.java @@ -25,6 +25,7 @@ import java.util.ResourceBundle; import org.apache.commons.lang3.StringUtils; import org.dclermonte.siba.SibaException; import org.dclermonte.siba.model.SibaManager; +import org.dclermonte.siba.util.BuildInformation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -110,6 +111,7 @@ public final class SibaCLI { StringList message = new StringList(); + message.append("Siba version ").appendln(new BuildInformation().version()); message.appendln("Usage:"); message.appendln(" siba [ -h | -help | --help ]"); message.appendln(" siba backup directoryToSave [ target ]"); diff --git a/src/org/dclermonte/siba/gui/SibaGUI.java b/src/org/dclermonte/siba/gui/SibaGUI.java index f2a35cd..fc8e948 100644 --- a/src/org/dclermonte/siba/gui/SibaGUI.java +++ b/src/org/dclermonte/siba/gui/SibaGUI.java @@ -52,6 +52,7 @@ import javax.swing.UnsupportedLookAndFeelException; import org.apache.commons.lang3.StringUtils; import org.dclermonte.siba.SibaException; import org.dclermonte.siba.gui.utils.GUIToolBox; +import org.dclermonte.siba.util.BuildInformation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -180,7 +181,7 @@ public final class SibaGUI this.frmSimpleBackup.setFont(new Font("DejaVu Sans", Font.BOLD, 12)); this.frmSimpleBackup.setForeground(new Color(0, 100, 0)); this.frmSimpleBackup.setBackground(new Color(102, 205, 170)); - this.frmSimpleBackup.setTitle("Simple Backup"); + this.frmSimpleBackup.setTitle(String.format("Simple Backup - v%s", new BuildInformation().version())); this.frmSimpleBackup.setBounds(100, 100, 450, 300); this.frmSimpleBackup.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); diff --git a/src/org/dclermonte/siba/util/BuildInformation.java b/src/org/dclermonte/siba/util/BuildInformation.java new file mode 100644 index 0000000..3ea6bb2 --- /dev/null +++ b/src/org/dclermonte/siba/util/BuildInformation.java @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2016 Didier Clermonté + * Copyright (C) 2016 Christian Pierre Momon + * + * This file is part of Siba. + * + * Siba is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.dclermonte.siba.util; + +import java.io.IOException; +import java.net.URL; +import java.util.Properties; + +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Christian Pierre MOMON (christian.momon@devinsy.fr) + */ +public class BuildInformation +{ + private static final Logger logger = LoggerFactory.getLogger(BuildInformation.class); + + private static String BUILD_INFORMATION_FILE = "/build_information.properties"; + + private String productName; + private String majorRevision; + private String minorRevision; + private String buildNumber; + private String buildDate; + private String generator; + private String author; + + /** + * + */ + public BuildInformation() + { + Properties build = new Properties(); + + try + { + // + URL buildInformationFile = BuildInformation.class.getResource(BUILD_INFORMATION_FILE); + + if (buildInformationFile != null) + { + build.load(BuildInformation.class.getResource(BUILD_INFORMATION_FILE).openStream()); + } + + // + this.productName = build.getProperty("product.name", "PuckInstaller"); + this.majorRevision = build.getProperty("product.revision.major", "d"); + this.minorRevision = build.getProperty("product.revision.minor", "e"); + this.buildNumber = build.getProperty("product.revision.build", "v"); + this.buildDate = build.getProperty("product.revision.date", "today"); + this.generator = build.getProperty("product.revision.generator", "n/a"); + this.author = build.getProperty("product.revision.author", "n/a"); + + } + catch (IOException exception) + { + // + logger.error("Error loading the build.properties file: " + exception.getMessage()); + logger.error(ExceptionUtils.getStackTrace(exception)); + + // + this.productName = "n/a"; + this.majorRevision = "n/a"; + this.minorRevision = "n/a"; + this.buildNumber = "n/a"; + this.buildDate = "n/a"; + this.generator = "n/a"; + this.author = "n/a"; + } + } + + public String author() + { + return this.author; + } + + public String buildDate() + { + return this.buildDate; + } + + public String buildNumber() + { + return this.buildNumber; + } + + public String generator() + { + return this.generator; + } + + public String majorRevision() + { + return this.majorRevision; + } + + public String minorRevision() + { + return this.minorRevision; + } + + public String productName() + { + return this.productName; + } + + /** + * + */ + @Override + public String toString() + { + String result; + + result = String.format("%s %s.%s.%s built on %s by %s", this.productName, this.majorRevision, + this.minorRevision, this.buildNumber, this.buildDate, this.author); + + // + return result; + } + + /** + * + * @return + */ + public String version() + { + String result; + + result = String.format("%s.%s.%s", this.majorRevision, this.minorRevision, this.buildNumber); + + // + return result; + } + + /** + * + */ + public static boolean isDefined() + { + boolean result; + + if (BuildInformation.class.getResource(BUILD_INFORMATION_FILE) == null) + { + result = false; + } + else + { + result = true; + } + + // + return result; + } +}