From: Roland Haeder Date: Fri, 19 Feb 2016 14:30:58 +0000 (+0100) Subject: Organized members to general structure X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=739f0a5e5236b3c748ed2465820899b01c98f9af;p=jaddressbook-share-lib.git Organized members to general structure --- diff --git a/src/org/mxchange/addressbook/validator/addressbook/AddressbookIdValidator.java b/src/org/mxchange/addressbook/validator/addressbook/AddressbookIdValidator.java index daccc42..e396e44 100644 --- a/src/org/mxchange/addressbook/validator/addressbook/AddressbookIdValidator.java +++ b/src/org/mxchange/addressbook/validator/addressbook/AddressbookIdValidator.java @@ -56,6 +56,26 @@ public class AddressbookIdValidator extends BaseLongValidator { @Log private LoggerBeanLocal loggerBeanLocal; + /** + * Public consutructor + */ + public AddressbookIdValidator () { + // Try to get it + try { + // Get initial context + Context context = new InitialContext(); + + // Lookup logger + this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N + + // ... and user controller + this.addressbookBean = (AddressbookSessionBeanRemote) context.lookup("java:global/addressbook-ejb/addressbook!org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote"); //NOI18N + } catch (final NamingException ex) { + // Continue to throw it + throw new RuntimeException("context.lookup() failed.", ex); //NOI18N + } + } + @Override public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException { // Trace message @@ -97,24 +117,4 @@ public class AddressbookIdValidator extends BaseLongValidator { // Trace message this.loggerBeanLocal.logTrace("validate: EXIT!"); //NOI18N } - - /** - * Public consutructor - */ - public AddressbookIdValidator () { - // Try to get it - try { - // Get initial context - Context context = new InitialContext(); - - // Lookup logger - this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N - - // ... and user controller - this.addressbookBean = (AddressbookSessionBeanRemote) context.lookup("java:global/addressbook-ejb/addressbook!org.mxchange.addressbook.model.addressbook.AddressbookSessionBeanRemote"); //NOI18N - } catch (final NamingException ex) { - // Continue to throw it - throw new RuntimeException("context.lookup() failed.", ex); //NOI18N - } - } } diff --git a/src/org/mxchange/addressbook/validator/user/UserIdValidator.java b/src/org/mxchange/addressbook/validator/user/UserIdValidator.java index 2f50468..9333f73 100644 --- a/src/org/mxchange/addressbook/validator/user/UserIdValidator.java +++ b/src/org/mxchange/addressbook/validator/user/UserIdValidator.java @@ -54,16 +54,36 @@ public class UserIdValidator extends BaseLongValidator implements Validator { */ private static final long serialVersionUID = 12_869_569_314_764_690L; + /** + * Logger instance + */ + @Log + private LoggerBeanLocal loggerBeanLocal; + /** * Remote bean */ private UserSessionBeanRemote userBean; /** - * Logger instance + * Initialization of this converter */ - @Log - private LoggerBeanLocal loggerBeanLocal; + public UserIdValidator () { + // Try to get it + try { + // Get initial context + Context context = new InitialContext(); + + // Lookup logger + this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N + + // ... and user controller + this.userBean = (UserSessionBeanRemote) context.lookup("java:global/juser-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N + } catch (final NamingException ex) { + // Continue to throw it + throw new RuntimeException("context.lookup() failed.", ex); //NOI18N + } + } /** * Event fired when the user registration is complete @@ -93,13 +113,13 @@ public class UserIdValidator extends BaseLongValidator implements Validator { User registeredUser = event.getUser(); // Debug message - System.out.println(MessageFormat.format("UserIdValidator:afterRegistrationEvent: registeredUser={0}", registeredUser)); //NOI18N + this.loggerBeanLocal.logDebug(MessageFormat.format("UserIdValidator:afterRegistrationEvent: registeredUser={0}", registeredUser)); //NOI18N // Update cache UserIdValidator.cachedStatus.add(registeredUser.getUserId()); // Trace message - System.out.println("UserIdValidator:afterRegistrationEvent: EXIT!"); //NOI18N + this.loggerBeanLocal.logTrace("UserIdValidator:afterRegistrationEvent: EXIT!"); //NOI18N } @Override @@ -141,23 +161,4 @@ public class UserIdValidator extends BaseLongValidator implements Validator { this.loggerBeanLocal.logTrace("validate: EXIT!"); //NOI18N } - /** - * Initialization of this converter - */ - public UserIdValidator () { - // Try to get it - try { - // Get initial context - Context context = new InitialContext(); - - // Lookup logger - this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N - - // ... and user controller - this.userBean = (UserSessionBeanRemote) context.lookup("java:global/juser-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N - } catch (final NamingException ex) { - // Continue to throw it - throw new RuntimeException("context.lookup() failed.", ex); //NOI18N - } - } }