diff --git a/hsarback/.classpath b/hsarback/.classpath
index 2c40f2b..62952fc 100644
--- a/hsarback/.classpath
+++ b/hsarback/.classpath
@@ -2,7 +2,11 @@
-
+
+
+
+
+
@@ -17,7 +21,6 @@
-
@@ -31,5 +34,6 @@
+
diff --git a/hsarback/lib/hsadmin-util-4.0.1-SNAPSHOT.jar b/hsarback/lib/hsadmin-util-4.0.1-SNAPSHOT.jar
new file mode 100644
index 0000000..4ee364f
Binary files /dev/null and b/hsarback/lib/hsadmin-util-4.0.1-SNAPSHOT.jar differ
diff --git a/hsarback/lib/jpwgen-1.2.0.jar b/hsarback/lib/jpwgen-1.2.0.jar
deleted file mode 100644
index 08dfd9b..0000000
Binary files a/hsarback/lib/jpwgen-1.2.0.jar and /dev/null differ
diff --git a/hsarback/src/de/hsadmin/autoconfig/AutoconfigAutodiscoverServlet.java b/hsarback/src/de/hsadmin/autoconfig/AutoconfigAutodiscoverServlet.java
index 25ac9a1..f27e896 100644
--- a/hsarback/src/de/hsadmin/autoconfig/AutoconfigAutodiscoverServlet.java
+++ b/hsarback/src/de/hsadmin/autoconfig/AutoconfigAutodiscoverServlet.java
@@ -25,8 +25,8 @@ import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
-import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.Transaction;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.mods.email.EMailAddress;
import de.hsadmin.mods.user.UnixUser;
diff --git a/hsarback/src/de/hsadmin/core/model/AbstractEntity.java b/hsarback/src/de/hsadmin/core/model/AbstractEntity.java
index b6184bb..398f4df 100644
--- a/hsarback/src/de/hsadmin/core/model/AbstractEntity.java
+++ b/hsarback/src/de/hsadmin/core/model/AbstractEntity.java
@@ -2,6 +2,7 @@ package de.hsadmin.core.model;
import javax.persistence.EntityManager;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.mods.user.UnixUser;
public abstract class AbstractEntity {
diff --git a/hsarback/src/de/hsadmin/core/model/AbstractModuleImpl.java b/hsarback/src/de/hsadmin/core/model/AbstractModuleImpl.java
index e1e272f..eadb74a 100644
--- a/hsarback/src/de/hsadmin/core/model/AbstractModuleImpl.java
+++ b/hsarback/src/de/hsadmin/core/model/AbstractModuleImpl.java
@@ -1,5 +1,6 @@
package de.hsadmin.core.model;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.LinkedList;
import java.util.List;
@@ -13,6 +14,7 @@ import de.hsadmin.core.qserv.EntityProcessorFactory;
import de.hsadmin.core.qserv.NullProcessor;
import de.hsadmin.core.qserv.Processor;
import de.hsadmin.core.qserv.QueueTask;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.mods.user.UnixUser;
/**
@@ -174,7 +176,7 @@ public abstract class AbstractModuleImpl implements ModuleInterface {
try {
procFactClass = Class.forName(procFactName);
if (procFactClass != null) {
- procFact = (EntityProcessorFactory) procFactClass.newInstance();
+ procFact = (EntityProcessorFactory) procFactClass.getDeclaredConstructor().newInstance();
}
} catch (ClassNotFoundException e) {
// no processor defined
@@ -182,6 +184,8 @@ public abstract class AbstractModuleImpl implements ModuleInterface {
throw new HSAdminException(e);
} catch (IllegalAccessException e) {
throw new HSAdminException(e);
+ } catch (IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
+ // no processor defined
}
return procFact;
}
diff --git a/hsarback/src/de/hsadmin/core/model/AuthenticationException.java b/hsarback/src/de/hsadmin/core/model/AuthenticationException.java
index 66332f1..8a26bc4 100644
--- a/hsarback/src/de/hsadmin/core/model/AuthenticationException.java
+++ b/hsarback/src/de/hsadmin/core/model/AuthenticationException.java
@@ -1,5 +1,7 @@
package de.hsadmin.core.model;
+import de.hsadmin.core.util.HSAdminException;
+
public class AuthenticationException extends HSAdminException {
private static final long serialVersionUID = 6242824365822822456L;
diff --git a/hsarback/src/de/hsadmin/core/model/AuthorisationException.java b/hsarback/src/de/hsadmin/core/model/AuthorisationException.java
index 7fa5370..cca6db3 100644
--- a/hsarback/src/de/hsadmin/core/model/AuthorisationException.java
+++ b/hsarback/src/de/hsadmin/core/model/AuthorisationException.java
@@ -1,5 +1,6 @@
package de.hsadmin.core.model;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.mods.user.UnixUser;
public class AuthorisationException extends HSAdminException {
diff --git a/hsarback/src/de/hsadmin/core/model/EntitySessionHelper.java b/hsarback/src/de/hsadmin/core/model/EntitySessionHelper.java
index a710a1a..54a1c9d 100644
--- a/hsarback/src/de/hsadmin/core/model/EntitySessionHelper.java
+++ b/hsarback/src/de/hsadmin/core/model/EntitySessionHelper.java
@@ -1,6 +1,5 @@
package de.hsadmin.core.model;
-
public class EntitySessionHelper {
/**
@@ -24,9 +23,9 @@ public class EntitySessionHelper {
}
private static AbstractModuleImpl instantiateModuleImpl(Transaction tx, Class> wrapperClass)
- throws InstantiationException, IllegalAccessException {
+ throws ReflectiveOperationException {
AbstractModuleImpl impl;
- impl = (AbstractModuleImpl) wrapperClass.newInstance();
+ impl = (AbstractModuleImpl) wrapperClass.getDeclaredConstructor().newInstance();
impl.construct(tx);
return impl;
}
diff --git a/hsarback/src/de/hsadmin/core/model/GenericModuleImpl.java b/hsarback/src/de/hsadmin/core/model/GenericModuleImpl.java
index 880e6ec..6b99549 100644
--- a/hsarback/src/de/hsadmin/core/model/GenericModuleImpl.java
+++ b/hsarback/src/de/hsadmin/core/model/GenericModuleImpl.java
@@ -4,7 +4,7 @@ import java.lang.reflect.Field;
import java.util.List;
import java.util.regex.Pattern;
-import de.hsadmin.core.util.ReflectionUtil;
+import de.hsadmin.core.util.HSAdminException;
public class GenericModuleImpl implements ModuleInterface {
diff --git a/hsarback/src/de/hsadmin/core/model/HSAdminException.java b/hsarback/src/de/hsadmin/core/model/HSAdminException.java
deleted file mode 100644
index 8e42774..0000000
--- a/hsarback/src/de/hsadmin/core/model/HSAdminException.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package de.hsadmin.core.model;
-
-public class HSAdminException extends Exception {
-
- private static final long serialVersionUID = -5082179267383474532L;
-
- public HSAdminException(String message) {
- super(message);
- }
-
- public HSAdminException(Exception e) {
- super(e);
- }
-
- public HSAdminException(String message, Exception aExc) {
- super(message, aExc);
- }
-
-}
diff --git a/hsarback/src/de/hsadmin/core/model/LoginUser.java b/hsarback/src/de/hsadmin/core/model/LoginUser.java
deleted file mode 100644
index 6e3f4d5..0000000
--- a/hsarback/src/de/hsadmin/core/model/LoginUser.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package de.hsadmin.core.model;
-
-/**
- * Transiente User-Klasse. Entkoppelt das core-Paket vom UnixUser-Modul.
- * @author Peter Hormanns
- */
-public class LoginUser {
-
- // TODO UnixUser Referenzen im Core-Paket ersetzen
- private String login;
-
- public LoginUser(String loginName) {
- login = loginName;
- }
-
- public String getLogin() {
- return login;
- }
-
- public boolean hasHostmasterRole() {
- // TODO Auto-generated method stub
- return false;
- }
-
-}
diff --git a/hsarback/src/de/hsadmin/core/model/ModuleInterface.java b/hsarback/src/de/hsadmin/core/model/ModuleInterface.java
index 0fe5b52..ff140ed 100644
--- a/hsarback/src/de/hsadmin/core/model/ModuleInterface.java
+++ b/hsarback/src/de/hsadmin/core/model/ModuleInterface.java
@@ -2,6 +2,8 @@ package de.hsadmin.core.model;
import java.util.List;
+import de.hsadmin.core.util.HSAdminException;
+
/**
* Represents a CRUD (Create, Retrieve, Update, Delete) interface for generic
* entity instances.
diff --git a/hsarback/src/de/hsadmin/core/model/PrivilegesModuleImpl.java b/hsarback/src/de/hsadmin/core/model/PrivilegesModuleImpl.java
index 8686274..5ac4b99 100644
--- a/hsarback/src/de/hsadmin/core/model/PrivilegesModuleImpl.java
+++ b/hsarback/src/de/hsadmin/core/model/PrivilegesModuleImpl.java
@@ -2,6 +2,7 @@ package de.hsadmin.core.model;
import java.util.List;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.mods.user.UnixUser;
public class PrivilegesModuleImpl extends AbstractModuleImpl implements PrivilegesInterface {
diff --git a/hsarback/src/de/hsadmin/core/util/ReflectionUtil.java b/hsarback/src/de/hsadmin/core/model/ReflectionUtil.java
similarity index 93%
rename from hsarback/src/de/hsadmin/core/util/ReflectionUtil.java
rename to hsarback/src/de/hsadmin/core/model/ReflectionUtil.java
index 5f86d88..7d8c9e5 100644
--- a/hsarback/src/de/hsadmin/core/util/ReflectionUtil.java
+++ b/hsarback/src/de/hsadmin/core/model/ReflectionUtil.java
@@ -1,4 +1,4 @@
-package de.hsadmin.core.util;
+package de.hsadmin.core.model;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -8,9 +8,7 @@ import java.util.List;
import java.util.Set;
import java.util.TreeSet;
-import de.hsadmin.core.model.AbstractEntity;
-import de.hsadmin.core.model.AnnFieldIO;
-import de.hsadmin.core.model.TechnicalException;
+import de.hsadmin.core.util.TextUtil;
public class ReflectionUtil {
@@ -81,7 +79,7 @@ public class ReflectionUtil {
if (valueObject != null && valueObject instanceof Object[]) {
for (Object item : ((Object[]) valueObject)) {
if (item instanceof String && referTo.getDeclaredField("name") != null) {
- Object instance = referTo.newInstance();
+ Object instance = referTo.getDeclaredConstructor().newInstance();
if (instance instanceof AbstractEntity) {
invokeSetter((AbstractEntity) instance, referTo, referTo.getDeclaredField("name"), item);
newSet.add(instance);
@@ -90,7 +88,7 @@ public class ReflectionUtil {
}
}
} else {
- Object newInstance = type.newInstance();
+ Object newInstance = type.getDeclaredConstructor().newInstance();
clasz.getMethod(setterName(f), type).invoke(entity, newInstance);
type.getMethod("setName", String.class).invoke(newInstance, valueObject);
}
diff --git a/hsarback/src/de/hsadmin/core/model/SecureDefaultModuleImpl.java b/hsarback/src/de/hsadmin/core/model/SecureDefaultModuleImpl.java
index 36ead48..270d6e1 100644
--- a/hsarback/src/de/hsadmin/core/model/SecureDefaultModuleImpl.java
+++ b/hsarback/src/de/hsadmin/core/model/SecureDefaultModuleImpl.java
@@ -5,6 +5,7 @@ import java.util.List;
import javax.persistence.EntityManager;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.mods.user.UnixUser;
/**
diff --git a/hsarback/src/de/hsadmin/core/qserv/EntityProcessorFactory.java b/hsarback/src/de/hsadmin/core/qserv/EntityProcessorFactory.java
index 43d9919..e343a0a 100644
--- a/hsarback/src/de/hsadmin/core/qserv/EntityProcessorFactory.java
+++ b/hsarback/src/de/hsadmin/core/qserv/EntityProcessorFactory.java
@@ -3,16 +3,17 @@ package de.hsadmin.core.qserv;
import javax.persistence.EntityManager;
import de.hsadmin.core.model.AbstractEntity;
+import de.hsadmin.core.util.HSAdminException;
public interface EntityProcessorFactory
{
public Processor
- createCreateProcessor(EntityManager em, T entity) throws ProcessorException;
+ createCreateProcessor(EntityManager em, T entity) throws HSAdminException;
public Processor
- createUpdateProcessor(EntityManager em, T newEntity) throws ProcessorException;
+ createUpdateProcessor(EntityManager em, T newEntity) throws HSAdminException;
public Processor
- createDeleteProcessor(EntityManager em, T entity) throws ProcessorException;
+ createDeleteProcessor(EntityManager em, T entity) throws HSAdminException;
}
diff --git a/hsarback/src/de/hsadmin/core/qserv/JDBCProcessor.java b/hsarback/src/de/hsadmin/core/qserv/JDBCProcessor.java
index a570d14..2827562 100644
--- a/hsarback/src/de/hsadmin/core/qserv/JDBCProcessor.java
+++ b/hsarback/src/de/hsadmin/core/qserv/JDBCProcessor.java
@@ -60,7 +60,7 @@ public class JDBCProcessor extends AbstractProcessor {
System.out.println("SQL: " + sqlStatement);
s.execute(sqlStatement);
}
- return new Integer(0);
+ return 0;
} catch (SQLException aSqlExc) {
Exception exc = aSqlExc.getNextException();
if (exc == null) {
diff --git a/hsarback/src/de/hsadmin/core/qserv/ProcessorException.java b/hsarback/src/de/hsadmin/core/qserv/ProcessorException.java
index ea8ac25..d682e79 100644
--- a/hsarback/src/de/hsadmin/core/qserv/ProcessorException.java
+++ b/hsarback/src/de/hsadmin/core/qserv/ProcessorException.java
@@ -1,6 +1,6 @@
package de.hsadmin.core.qserv;
-import de.hsadmin.core.model.HSAdminException;
+import de.hsadmin.core.util.HSAdminException;
public class ProcessorException extends HSAdminException {
diff --git a/hsarback/src/de/hsadmin/core/qserv/SmtpHelper.java b/hsarback/src/de/hsadmin/core/qserv/SmtpHelper.java
index f363334..2f7db34 100644
--- a/hsarback/src/de/hsadmin/core/qserv/SmtpHelper.java
+++ b/hsarback/src/de/hsadmin/core/qserv/SmtpHelper.java
@@ -11,8 +11,8 @@ import org.apache.commons.net.smtp.SMTPClient;
import org.apache.commons.net.smtp.SMTPReply;
import org.apache.commons.net.smtp.SimpleSMTPHeader;
-import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.util.Config;
+import de.hsadmin.core.util.HSAdminException;
public class SmtpHelper {
diff --git a/hsarback/src/de/hsadmin/core/util/Config.java b/hsarback/src/de/hsadmin/core/util/Config.java
deleted file mode 100644
index 2d713a4..0000000
--- a/hsarback/src/de/hsadmin/core/util/Config.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package de.hsadmin.core.util;
-
-import java.io.File;
-import java.io.FileReader;
-import java.util.Properties;
-import java.util.logging.Logger;
-
-public class Config {
-
- private static Config instance;
-
- private static Logger LOG = Logger.getLogger(Config.class.getName());
-
- private Properties props;
-
- private Config() {
- props = new Properties();
- File file = new File(System.getProperty("user.dir") + "/hsadmin.properties");
- if (!file.canRead()) {
- file = new File(System.getProperty("user.dir") + "/conf/hsadmin.properties");
- }
- if (!file.canRead()) {
- file = new File(System.getProperty("user.home") + "/.hsadmin.properties");
- }
- if (!file.canRead()) {
- file = new File("/etc/hsadmin.properties");
- }
- if (!file.canRead()) {
- file = new File("/etc/hsadmin/hsadmin.properties");
- }
- if (file.canRead()) {
- try {
- LOG.info("Constructor - Properties-File: " + file.getAbsolutePath());
- props.load(new FileReader(file));
- } catch (Exception e) {
- // should not happen
- e.printStackTrace();
- }
- }
- }
-
- public static Config getInstance() {
- if (instance == null) {
- instance = new Config();
- }
- return instance;
- }
-
- public String getProperty(String propertyName) {
- String property = props.getProperty(propertyName);
- return property;
- }
-
- public String getProperty(String propertyName, String defaultValue) {
- return props.getProperty(propertyName, defaultValue).trim();
- }
-
-}
diff --git a/hsarback/src/de/hsadmin/core/util/IPv6Trick.java b/hsarback/src/de/hsadmin/core/util/IPv6Trick.java
deleted file mode 100644
index 85847cd..0000000
--- a/hsarback/src/de/hsadmin/core/util/IPv6Trick.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package de.hsadmin.core.util;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-import de.hsadmin.core.qserv.ProcessorException;
-
-public class IPv6Trick {
-
- private static final String IPv4_LOCALHOST = "127.0.0";
- private static final String IPv6_LOCALHOST = "::1";
- private static final String IPv6_LOCALHOST_ALT = "0:0:0:0:0:0:0:1";
-
- private static final String IPv4_83_223_79 = "83.223.79"; // Alboin-Kontor Berlin
- private static final String IPv4_83_223_91 = "83.223.91"; // Alboin-Kontor Berlin
- private static final String IPv4_83_223_95 = "83.223.95"; // Alboin-Kontor Berlin
- private static final String IPv6_PREFIX_AK = "2a01:37:1000::1";
-
- private static final String IPv4_83_223_78 = "83.223.78"; // e-Shelter Berlin
- private static final String IPv4_83_223_94 = "83.223.94"; // e-Shelter Berlin
- private static final String IPv6_PREFIX_ES = "2a01:37:3000::1";
-
- private static final String IPv6_PREFIX_HS = "2a01:37:";
- private static final String IPv6_PREFIX_HS_ALT = "2a01:0037:";
-
- public static String convertIPv4ToIPv6(final String ipv4address) throws ProcessorException {
- if (ipv4address == null || ipv4address.length() == 0) {
- throw new ProcessorException("no IPv4 address given");
- }
- try {
- final InetAddress inetV4Address = InetAddress.getByName(ipv4address);
- if (ipv4address.startsWith(IPv4_83_223_79) // Alboin-Kontor Berlin
- || ipv4address.startsWith(IPv4_83_223_91)
- || ipv4address.startsWith(IPv4_83_223_95) ) {
- return embedIPv4Address(inetV4Address, InetAddress.getByName(IPv6_PREFIX_AK));
- }
- if (ipv4address.startsWith(IPv4_83_223_78) // e-Shelter Berlin
- || ipv4address.startsWith(IPv4_83_223_94) ) {
- return embedIPv4Address(inetV4Address, InetAddress.getByName(IPv6_PREFIX_ES));
- }
- } catch (UnknownHostException e) {
- throw new ProcessorException(e);
- }
- throw new ProcessorException("unknown IPv4 address given");
- }
-
- public static boolean isKnownRemote(final String remoteAddress) {
- boolean isKnown = false;
- System.out.print(remoteAddress + "\n");
- if (remoteAddress.startsWith(IPv4_LOCALHOST) || remoteAddress.startsWith(IPv6_LOCALHOST) || remoteAddress.startsWith(IPv6_LOCALHOST_ALT)) {
- // localhost
- isKnown = true;
- }
- if (remoteAddress.startsWith(IPv6_PREFIX_HS) || remoteAddress.startsWith(IPv6_PREFIX_HS_ALT)) {
- // Hostsharing IPv6
- isKnown = true;
- }
- if (remoteAddress.startsWith(IPv4_83_223_78) || remoteAddress.startsWith(IPv4_83_223_94)) {
- // e-Shelter
- isKnown = true;
- }
- if (remoteAddress.startsWith(IPv4_83_223_79) || remoteAddress.startsWith(IPv4_83_223_91) || remoteAddress.startsWith(IPv4_83_223_95)) {
- // Speedbone Alboin Kontor
- isKnown = true;
- }
- return isKnown;
- }
-
- private static String embedIPv4Address(final InetAddress ipv4address, final InetAddress ipv6Mask) throws UnknownHostException {
- final byte[] ipv4Bytes = ipv4address.getAddress();
- final byte[] ipv6Bytes = ipv6Mask.getAddress();
- ipv6Bytes[10] = ipv4Bytes[0];
- ipv6Bytes[11] = ipv4Bytes[1];
- ipv6Bytes[12] = ipv4Bytes[2];
- ipv6Bytes[13] = ipv4Bytes[3];
- ipv6Bytes[14] = 0;
- ipv6Bytes[15] = 0;
- final InetAddress ipv6Address = InetAddress.getByAddress(ipv6Bytes);
- final String ipv6String = ipv6Address.getHostAddress();
- if (ipv6String.startsWith("/")) {
- return ipv6String.substring(1);
- } else {
- return ipv6String;
- }
- }
-
-}
diff --git a/hsarback/src/de/hsadmin/core/util/PasswordTool.java b/hsarback/src/de/hsadmin/core/util/PasswordTool.java
deleted file mode 100644
index 004b07d..0000000
--- a/hsarback/src/de/hsadmin/core/util/PasswordTool.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package de.hsadmin.core.util;
-
-import java.util.Random;
-
-import de.rrze.jpwgen.flags.PwGeneratorFlagBuilder;
-import de.rrze.jpwgen.impl.PwGenerator;
-
-public class PasswordTool {
-
- public static PwGeneratorFlagBuilder flagBuilder = new PwGeneratorFlagBuilder();
- public static Random random = new Random();
-
- static {
- flagBuilder.setIncludeCapitals();
- flagBuilder.setIncludeNumerals();
-// flagBuilder.setIncludeReducedSymbols();
- flagBuilder.setFilterAmbiguous();
- }
-
- public static String generatePassword() {
- String password = PwGenerator.generatePassword(17, flagBuilder.build(), 100, random);
- return password;
- }
-
-}
diff --git a/hsarback/src/de/hsadmin/core/util/TextUtil.java b/hsarback/src/de/hsadmin/core/util/TextUtil.java
deleted file mode 100644
index 1c80168..0000000
--- a/hsarback/src/de/hsadmin/core/util/TextUtil.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package de.hsadmin.core.util;
-
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Locale;
-
-public class TextUtil {
-
- private static final DateFormat df = SimpleDateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMAN);
-
- public static synchronized String replaceUmlautCharacters(String umlautString) {
- StringBuffer buffer = new StringBuffer();
- for (char c : umlautString.toCharArray()) {
- if ( (c >= 'a' && c <= 'z') ||
- (c >= 'A' && c <= 'Z') ||
- (c >= '0' && c <= '9') ||
- (c == ' ') ) {
- buffer.append(c);
- } else {
- switch (c) {
- case 'ä':
- buffer.append("ae");
- break;
- case 'ö':
- buffer.append("oe");
- break;
- case 'ü':
- buffer.append("ue");
- break;
- case 'Ä':
- buffer.append("Ae");
- break;
- case 'Ö':
- buffer.append("Oe");
- break;
- case 'Ü':
- buffer.append("Ue");
- break;
- case 'ß':
- buffer.append("ss");
- break;
- default:
- buffer.append('-');
- break;
- }
- }
- }
- return buffer.toString();
- }
-
- public static synchronized String format(Date date) {
- return df.format(date);
- }
-
- public static synchronized Date parseDate(String dateString) {
- try {
- return df.parse(dateString);
- } catch (ParseException e) {
- try {
- return df.parse("01.01.1970");
- } catch (ParseException e1) {
- // don't care
- return null;
- }
- }
- }
-
- public static synchronized String format(boolean free) {
- return free ? "true" : "false";
- }
-
- public static synchronized boolean parseBool(String boolString) {
- boolean parsedValue = "T".equals(boolString.toUpperCase()) || "TRUE".equals(boolString.toUpperCase());
- return parsedValue;
- }
-
- public static synchronized String hidePassword(String passwd) {
- final StringBuffer val = new StringBuffer(passwd.substring(0, 2));
- for (int i = 2; i < 6; i++) {
- val.append('*');
- }
- return val.toString();
- }
-
-}
diff --git a/hsarback/src/de/hsadmin/mods/db/MySqlDatabaseModuleImpl.java b/hsarback/src/de/hsadmin/mods/db/MySqlDatabaseModuleImpl.java
index 72e90f7..6e6da29 100644
--- a/hsarback/src/de/hsadmin/mods/db/MySqlDatabaseModuleImpl.java
+++ b/hsarback/src/de/hsadmin/mods/db/MySqlDatabaseModuleImpl.java
@@ -8,8 +8,8 @@ import javax.persistence.Query;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AbstractModuleImpl;
import de.hsadmin.core.model.AuthorisationException;
-import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.Transaction;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.hostsharing.BasePacType;
import de.hsadmin.hostsharing.MultiOption;
import de.hsadmin.mods.pac.Pac;
diff --git a/hsarback/src/de/hsadmin/mods/db/MySqlUserModuleImpl.java b/hsarback/src/de/hsadmin/mods/db/MySqlUserModuleImpl.java
index 05162b9..d51164c 100644
--- a/hsarback/src/de/hsadmin/mods/db/MySqlUserModuleImpl.java
+++ b/hsarback/src/de/hsadmin/mods/db/MySqlUserModuleImpl.java
@@ -8,8 +8,8 @@ import javax.persistence.Query;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AbstractModuleImpl;
import de.hsadmin.core.model.AuthorisationException;
-import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.Transaction;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.hostsharing.BasePacType;
import de.hsadmin.hostsharing.MultiOption;
import de.hsadmin.mods.pac.Pac;
diff --git a/hsarback/src/de/hsadmin/mods/db/PgSqlDatabaseModuleImpl.java b/hsarback/src/de/hsadmin/mods/db/PgSqlDatabaseModuleImpl.java
index 464b38e..0e047b7 100644
--- a/hsarback/src/de/hsadmin/mods/db/PgSqlDatabaseModuleImpl.java
+++ b/hsarback/src/de/hsadmin/mods/db/PgSqlDatabaseModuleImpl.java
@@ -8,8 +8,8 @@ import javax.persistence.Query;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AbstractModuleImpl;
import de.hsadmin.core.model.AuthorisationException;
-import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.Transaction;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.hostsharing.BasePacType;
import de.hsadmin.hostsharing.MultiOption;
import de.hsadmin.mods.pac.Pac;
diff --git a/hsarback/src/de/hsadmin/mods/db/PgSqlUserModuleImpl.java b/hsarback/src/de/hsadmin/mods/db/PgSqlUserModuleImpl.java
index 6d4617b..b8222bd 100644
--- a/hsarback/src/de/hsadmin/mods/db/PgSqlUserModuleImpl.java
+++ b/hsarback/src/de/hsadmin/mods/db/PgSqlUserModuleImpl.java
@@ -8,7 +8,7 @@ import javax.persistence.Query;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AbstractModuleImpl;
import de.hsadmin.core.model.AuthorisationException;
-import de.hsadmin.core.model.HSAdminException;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.hostsharing.BasePacType;
import de.hsadmin.hostsharing.MultiOption;
import de.hsadmin.mods.pac.Pac;
diff --git a/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java b/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java
index 67b8615..55618b4 100644
--- a/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java
+++ b/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java
@@ -13,7 +13,7 @@ import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AbstractModuleImpl;
import de.hsadmin.core.model.AuthorisationException;
import de.hsadmin.core.model.GenericModuleImpl;
-import de.hsadmin.core.model.HSAdminException;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.hostsharing.BasePacType;
import de.hsadmin.mods.email.EMailAddress;
import de.hsadmin.mods.pac.Pac;
diff --git a/hsarback/src/de/hsadmin/mods/email/EMailAddress.java b/hsarback/src/de/hsadmin/mods/email/EMailAddress.java
index 2dad272..440d42e 100644
--- a/hsarback/src/de/hsadmin/mods/email/EMailAddress.java
+++ b/hsarback/src/de/hsadmin/mods/email/EMailAddress.java
@@ -19,9 +19,9 @@ import javax.persistence.Transient;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AnnFieldIO;
import de.hsadmin.core.model.AnnModuleImpl;
-import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.ReadWriteAccess;
import de.hsadmin.core.model.SearchFilter;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.mods.dom.Domain;
import de.hsadmin.mods.user.UnixUser;
diff --git a/hsarback/src/de/hsadmin/mods/email/EMailAddressModuleImpl.java b/hsarback/src/de/hsadmin/mods/email/EMailAddressModuleImpl.java
index 4103fd5..f029791 100644
--- a/hsarback/src/de/hsadmin/mods/email/EMailAddressModuleImpl.java
+++ b/hsarback/src/de/hsadmin/mods/email/EMailAddressModuleImpl.java
@@ -8,8 +8,8 @@ import javax.persistence.Query;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AbstractModuleImpl;
import de.hsadmin.core.model.AuthorisationException;
-import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.Transaction;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.hostsharing.BasePacType;
import de.hsadmin.mods.dom.Domain;
import de.hsadmin.mods.dom.DomainOption;
diff --git a/hsarback/src/de/hsadmin/mods/email/EMailAliasModuleImpl.java b/hsarback/src/de/hsadmin/mods/email/EMailAliasModuleImpl.java
index 17827d0..e4fb47c 100644
--- a/hsarback/src/de/hsadmin/mods/email/EMailAliasModuleImpl.java
+++ b/hsarback/src/de/hsadmin/mods/email/EMailAliasModuleImpl.java
@@ -8,8 +8,8 @@ import javax.persistence.Query;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AbstractModuleImpl;
import de.hsadmin.core.model.AuthorisationException;
-import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.Transaction;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.hostsharing.BasePacType;
import de.hsadmin.hostsharing.MultiOption;
import de.hsadmin.mods.pac.Pac;
diff --git a/hsarback/src/de/hsadmin/mods/pac/INetAddress.java b/hsarback/src/de/hsadmin/mods/pac/INetAddress.java
index 682cb3c..6c74c18 100644
--- a/hsarback/src/de/hsadmin/mods/pac/INetAddress.java
+++ b/hsarback/src/de/hsadmin/mods/pac/INetAddress.java
@@ -13,7 +13,7 @@ import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import de.hsadmin.core.model.AbstractEntity;
-import de.hsadmin.core.qserv.ProcessorException;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.core.util.IPv6Trick;
import de.hsadmin.mods.user.UnixUser;
@@ -73,7 +73,7 @@ public class INetAddress extends AbstractEntity implements Serializable {
return name;
}
- public String getInet6Addr() throws ProcessorException {
+ public String getInet6Addr() throws HSAdminException {
return IPv6Trick.convertIPv4ToIPv6(name);
}
diff --git a/hsarback/src/de/hsadmin/mods/pac/PacModuleImpl.java b/hsarback/src/de/hsadmin/mods/pac/PacModuleImpl.java
index 15c0af8..a2e54f4 100644
--- a/hsarback/src/de/hsadmin/mods/pac/PacModuleImpl.java
+++ b/hsarback/src/de/hsadmin/mods/pac/PacModuleImpl.java
@@ -14,7 +14,7 @@ import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AbstractModuleImpl;
import de.hsadmin.core.model.AuthorisationException;
import de.hsadmin.core.model.GenericModuleImpl;
-import de.hsadmin.core.model.HSAdminException;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.core.util.TextUtil;
import de.hsadmin.hostsharing.BasePacType;
import de.hsadmin.mods.cust.Contact;
@@ -136,7 +136,7 @@ public class PacModuleImpl extends AbstractModuleImpl {
for (PacComponent c : oldPacComponents) {
String feature = c.getBaseComponent().getFeature();
int quantity = c.getQuantity();
- oldQuantities.put(feature, new Integer(quantity));
+ oldQuantities.put(feature, quantity);
em.remove(c);
}
oldPacComponents.clear();
diff --git a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java
index c00dc5f..678edd3 100644
--- a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java
+++ b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java
@@ -21,6 +21,7 @@ import de.hsadmin.core.qserv.ShellProcessor;
import de.hsadmin.core.qserv.VelocityProcessor;
import de.hsadmin.core.qserv.WaitingTasksProcessor;
import de.hsadmin.core.util.Config;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.core.util.PasswordTool;
import de.hsadmin.hostsharing.BasePacType;
import de.hsadmin.hostsharing.QuotaLimit;
@@ -32,7 +33,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
@Override
public Processor createCreateProcessor(
- EntityManager em, T entity) throws ProcessorException {
+ EntityManager em, T entity) throws HSAdminException {
Pac pac = (Pac) entity;
String basepacName = pac.getBasepac().getName();
if (basepacName.equals(BasePacType.PAC_WEB)) {
@@ -67,7 +68,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
@Override
public Processor createUpdateProcessor(EntityManager em, T entity)
- throws ProcessorException {
+ throws HSAdminException {
Pac pac = (Pac) entity;
String basepacName = pac.getBasepac().getName();
if (basepacName.equals(BasePacType.PAC_WEB)) {
@@ -91,7 +92,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
}
@Override
- public Processor createDeleteProcessor(EntityManager em, T entity) throws ProcessorException {
+ public Processor createDeleteProcessor(EntityManager em, T entity) throws HSAdminException {
Pac pac = (Pac) entity;
String basepacName = pac.getBasepac().getName();
if (basepacName.equals(BasePacType.PAC_WEB)) {
@@ -130,7 +131,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
return new ShellProcessor("mk-iptables-rules Accounting");
}
- private Processor createHttpdVirtualProc(Hive hive) throws ProcessorException {
+ private Processor createHttpdVirtualProc(Hive hive) throws HSAdminException {
Processor domSetupProcessor = new CompoundProcessor(
new CreateFileProcessor("/de/hsadmin/mods/pac/httpd-virtual.vm", hive,
"/etc/apache2/conf.d/virtual.conf.tmp", "root", "root", "644", true),
@@ -145,7 +146,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
return new VelocityProcessor("/de/hsadmin/mods/pac/hosts.vm", hive, "/etc/hosts", true);
}
- private Processor createNetworkInterfacesProc(final Hive hive) throws ProcessorException {
+ private Processor createNetworkInterfacesProc(final Hive hive) throws HSAdminException {
return
new CompoundProcessor(
new VelocityProcessor("/de/hsadmin/mods/pac/pac-addr-ipv4.vm", hive, "/etc/network/pac-addr-ipv4", true),
@@ -180,7 +181,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
zonefileTemplateVars.put("inet4Addr", pac.getCurINetAddr().getInet4Addr());
try {
zonefileTemplateVars.put("inet6Addr", pac.getCurINetAddr().getInet6Addr());
- } catch (ProcessorException e) {
+ } catch (HSAdminException e) {
// dont care
}
final String domName = pac.getName() + ".hostsharing.net";
@@ -288,7 +289,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
);
}
- private Processor createIfUp(final Pac pac) throws ProcessorException {
+ private Processor createIfUp(final Pac pac) throws HSAdminException {
return new CompoundProcessor(
new ShellProcessor("ip addr add "
+ pac.getCurINetAddr().getInet4Addr()
@@ -301,7 +302,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
);
}
- private Processor createIfDown(final Pac pac) throws ProcessorException {
+ private Processor createIfDown(final Pac pac) throws HSAdminException {
return new CompoundProcessor(
new ShellProcessor("ip addr del "
+ pac.getCurINetAddr().getInet4Addr()
diff --git a/hsarback/src/de/hsadmin/mods/qstat/QTaskModuleImpl.java b/hsarback/src/de/hsadmin/mods/qstat/QTaskModuleImpl.java
index 1fe6756..706758d 100644
--- a/hsarback/src/de/hsadmin/mods/qstat/QTaskModuleImpl.java
+++ b/hsarback/src/de/hsadmin/mods/qstat/QTaskModuleImpl.java
@@ -4,7 +4,7 @@ import java.util.List;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AbstractModuleImpl;
-import de.hsadmin.core.model.HSAdminException;
+import de.hsadmin.core.util.HSAdminException;
public class QTaskModuleImpl extends AbstractModuleImpl {
diff --git a/hsarback/src/de/hsadmin/mods/user/UnixUserModuleImpl.java b/hsarback/src/de/hsadmin/mods/user/UnixUserModuleImpl.java
index 5ef663f..fa1e64a 100644
--- a/hsarback/src/de/hsadmin/mods/user/UnixUserModuleImpl.java
+++ b/hsarback/src/de/hsadmin/mods/user/UnixUserModuleImpl.java
@@ -9,8 +9,8 @@ import javax.persistence.Query;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AbstractModuleImpl;
import de.hsadmin.core.model.AuthorisationException;
-import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.Transaction;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.hostsharing.BasePacType;
import de.hsadmin.hostsharing.MultiOption;
import de.hsadmin.mods.pac.Pac;
diff --git a/hsarback/src/de/hsadmin/pillar/JsonPillarServlet.java b/hsarback/src/de/hsadmin/pillar/JsonPillarServlet.java
index dc0043d..5046545 100644
--- a/hsarback/src/de/hsadmin/pillar/JsonPillarServlet.java
+++ b/hsarback/src/de/hsadmin/pillar/JsonPillarServlet.java
@@ -17,7 +17,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.httpclient.HttpStatus;
import de.hsadmin.core.model.Transaction;
-import de.hsadmin.core.qserv.ProcessorException;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.core.util.IPv6Trick;
import de.hsadmin.mods.dom.Domain;
import de.hsadmin.mods.pac.Hive;
@@ -61,7 +61,7 @@ public class JsonPillarServlet extends HttpServlet {
writer.println(" , \"hiveipv4\": \"" + hive.getInetAddr().getInet4Addr() + "\"");
try {
writer.println(" , \"hiveipv6\": \"" + hive.getInetAddr().getInet6Addr() + "\"");
- } catch (ProcessorException e) {
+ } catch (HSAdminException e) {
// dont care
}
final long currentTimeSeconds = System.currentTimeMillis() / 1000L;
@@ -86,7 +86,7 @@ public class JsonPillarServlet extends HttpServlet {
writer.println(" , \"ipv4\": \"" + curINetAddr.getInet4Addr() + "\"");
try {
writer.println(" , \"ipv6\": \"" + curINetAddr.getInet6Addr() + "\"");
- } catch (ProcessorException e) {
+ } catch (HSAdminException e) {
// dont care
}
final PacComponent pacQuota = pac.getPacComponent("QUOTA");
diff --git a/hsarback/src/de/hsadmin/remote/AbstractRemote.java b/hsarback/src/de/hsadmin/remote/AbstractRemote.java
index 5548459..1f95e67 100644
--- a/hsarback/src/de/hsadmin/remote/AbstractRemote.java
+++ b/hsarback/src/de/hsadmin/remote/AbstractRemote.java
@@ -12,9 +12,9 @@ import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AuthenticationException;
import de.hsadmin.core.model.AuthorisationException;
import de.hsadmin.core.model.GenericModuleImpl;
-import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.ModuleInterface;
import de.hsadmin.core.model.Transaction;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.mods.user.UnixUser;
public abstract class AbstractRemote implements IRemote {
diff --git a/hsarback/src/de/hsadmin/remote/GenericAbstractRemote.java b/hsarback/src/de/hsadmin/remote/GenericAbstractRemote.java
index e503528..7dbaef8 100644
--- a/hsarback/src/de/hsadmin/remote/GenericAbstractRemote.java
+++ b/hsarback/src/de/hsadmin/remote/GenericAbstractRemote.java
@@ -7,11 +7,11 @@ import java.util.regex.Pattern;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AnnFieldIO;
-import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.ReadWriteAccess;
+import de.hsadmin.core.model.ReflectionUtil;
import de.hsadmin.core.model.TechnicalException;
import de.hsadmin.core.model.Transaction;
-import de.hsadmin.core.util.ReflectionUtil;
+import de.hsadmin.core.util.HSAdminException;
public abstract class GenericAbstractRemote extends AbstractRemote {
diff --git a/hsarback/src/de/hsadmin/remote/IRemote.java b/hsarback/src/de/hsadmin/remote/IRemote.java
index 48cc2ac..c1632ec 100644
--- a/hsarback/src/de/hsadmin/remote/IRemote.java
+++ b/hsarback/src/de/hsadmin/remote/IRemote.java
@@ -3,7 +3,7 @@ package de.hsadmin.remote;
import java.util.List;
import java.util.Map;
-import de.hsadmin.core.model.HSAdminException;
+import de.hsadmin.core.util.HSAdminException;
public interface IRemote {
diff --git a/hsarback/src/de/hsadmin/remote/ModulePropertiesRemote.java b/hsarback/src/de/hsadmin/remote/ModulePropertiesRemote.java
index 3e9a66f..9527613 100644
--- a/hsarback/src/de/hsadmin/remote/ModulePropertiesRemote.java
+++ b/hsarback/src/de/hsadmin/remote/ModulePropertiesRemote.java
@@ -12,11 +12,11 @@ import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AnnFieldIO;
import de.hsadmin.core.model.AuthenticationException;
import de.hsadmin.core.model.DefaultSelectableValues;
-import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.KindOfSelectableValue;
import de.hsadmin.core.model.ReadWriteAccess;
import de.hsadmin.core.model.SelectableValue;
import de.hsadmin.core.model.Transaction;
+import de.hsadmin.core.util.HSAdminException;
public class ModulePropertiesRemote implements IRemote {
diff --git a/hsarback/src/de/hsadmin/remote/PacRemote.java b/hsarback/src/de/hsadmin/remote/PacRemote.java
index ff1daac..8aacf39 100644
--- a/hsarback/src/de/hsadmin/remote/PacRemote.java
+++ b/hsarback/src/de/hsadmin/remote/PacRemote.java
@@ -6,8 +6,8 @@ import java.util.Map;
import java.util.Set;
import de.hsadmin.core.model.AbstractEntity;
-import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.Transaction;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.core.util.TextUtil;
import de.hsadmin.mods.cust.Customer;
import de.hsadmin.mods.pac.BasePac;
diff --git a/hsarback/src/de/hsadmin/remote/PropertyRemote.java b/hsarback/src/de/hsadmin/remote/PropertyRemote.java
index e72ad86..aead0f0 100644
--- a/hsarback/src/de/hsadmin/remote/PropertyRemote.java
+++ b/hsarback/src/de/hsadmin/remote/PropertyRemote.java
@@ -11,9 +11,9 @@ import java.util.Properties;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AnnFieldIO;
import de.hsadmin.core.model.AuthenticationException;
-import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.ReadWriteAccess;
import de.hsadmin.core.model.Transaction;
+import de.hsadmin.core.util.HSAdminException;
public class PropertyRemote implements IRemote {
diff --git a/hsarback/src/de/hsadmin/remote/RoleRemote.java b/hsarback/src/de/hsadmin/remote/RoleRemote.java
index a9d724f..41349d4 100644
--- a/hsarback/src/de/hsadmin/remote/RoleRemote.java
+++ b/hsarback/src/de/hsadmin/remote/RoleRemote.java
@@ -8,9 +8,9 @@ import java.util.Map;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AuthenticationException;
import de.hsadmin.core.model.GenericModuleImpl;
-import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.core.util.Config;
+import de.hsadmin.core.util.HSAdminException;
import de.hsadmin.mods.dom.Domain;
import de.hsadmin.mods.pac.Pac;