| 1 | // SECTION-START[License Header] |
| 2 | // <editor-fold defaultstate="collapsed" desc=" Generated License "> |
| 3 | /* |
| 4 | * Copyright (c) 2010 The JOMC Project |
| 5 | * Copyright (c) 2005 Christian Schulte <schulte2005@users.sourceforge.net> |
| 6 | * All rights reserved. |
| 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions |
| 10 | * are met: |
| 11 | * |
| 12 | * o Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * |
| 15 | * o Redistributions in binary form must reproduce the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer in |
| 17 | * the documentation and/or other materials provided with the |
| 18 | * distribution. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE JOMC PROJECT AND CONTRIBUTORS "AS IS" |
| 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 22 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 23 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JOMC PROJECT OR |
| 24 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 25 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 26 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 27 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 28 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 29 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 30 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 | * |
| 32 | * $Id: DefaultSequenceChangeListener.java 2247 2010-06-29 08:01:42Z schulte2005 $ |
| 33 | * |
| 34 | */ |
| 35 | // </editor-fold> |
| 36 | // SECTION-END |
| 37 | package org.jomc.sequences.ri; |
| 38 | |
| 39 | import org.jomc.sequences.SequenceChangeEvent; |
| 40 | |
| 41 | // SECTION-START[Documentation] |
| 42 | // <editor-fold defaultstate="collapsed" desc=" Generated Documentation "> |
| 43 | /** |
| 44 | * SequenceChangeListener reference implementation. |
| 45 | * <p><b>Specifications</b><ul> |
| 46 | * <li>{@code 'org.jomc.sequences.SequenceChangeListener'} {@code (org.jomc.sequences.SequenceChangeListener)} {@code 1.0} {@code Multiton}</li> |
| 47 | * </ul></p> |
| 48 | * <p><b>Dependencies</b><ul> |
| 49 | * <li>"{@link #getLocale Locale}"<blockquote> |
| 50 | * Dependency on {@code 'java.util.Locale'} {@code (java.util.Locale)} at specification level 1.1 bound to an instance.</blockquote></li> |
| 51 | * <li>"{@link #getLogger Logger}"<blockquote> |
| 52 | * Dependency on {@code 'org.jomc.logging.Logger'} {@code (org.jomc.logging.Logger)} at specification level 1.0 bound to an instance.</blockquote></li> |
| 53 | * </ul></p> |
| 54 | * <p><b>Messages</b><ul> |
| 55 | * <li>"{@link #getOperationInfo operationInfo}"<table> |
| 56 | * <tr><td valign="top">English:</td><td valign="top"><pre>--''{0}'' |
| 57 | * ++''{1}'' |
| 58 | * </pre></td></tr> |
| 59 | * <tr><td valign="top">Deutsch:</td><td valign="top"><pre>--''{0}'' |
| 60 | * ++''{1}'' |
| 61 | * </pre></td></tr> |
| 62 | * </table> |
| 63 | * </ul></p> |
| 64 | * |
| 65 | * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a> 1.0 |
| 66 | * @version $Id: DefaultSequenceChangeListener.java 2247 2010-06-29 08:01:42Z schulte2005 $ |
| 67 | */ |
| 68 | // </editor-fold> |
| 69 | // SECTION-END |
| 70 | // SECTION-START[Annotations] |
| 71 | // <editor-fold defaultstate="collapsed" desc=" Generated Annotations "> |
| 72 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.0", comments = "See http://jomc.sourceforge.net/jomc/1.0/jomc-tools" ) |
| 73 | // </editor-fold> |
| 74 | // SECTION-END |
| 75 | public class DefaultSequenceChangeListener |
| 76 | implements |
| 77 | org.jomc.sequences.SequenceChangeListener |
| 78 | { |
| 79 | // SECTION-START[SequenceChangeListener] |
| 80 | |
| 81 | public void sequenceChange( final SequenceChangeEvent evt ) |
| 82 | { |
| 83 | if ( this.getLogger().isDebugEnabled() ) |
| 84 | { |
| 85 | this.getLogger().debug( this.getOperationInfo( |
| 86 | this.getLocale(), evt.getOldSequence() == null ? null : evt.getOldSequence().toString(), |
| 87 | evt.getNewSequence() == null ? null : evt.getNewSequence().toString() ) ); |
| 88 | |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | // SECTION-END |
| 93 | // SECTION-START[DefaultSequenceChangeListener] |
| 94 | // SECTION-END |
| 95 | // SECTION-START[Constructors] |
| 96 | // <editor-fold defaultstate="collapsed" desc=" Generated Constructors "> |
| 97 | |
| 98 | /** Creates a new {@code DefaultSequenceChangeListener} instance. */ |
| 99 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.0", comments = "See http://jomc.sourceforge.net/jomc/1.0/jomc-tools" ) |
| 100 | public DefaultSequenceChangeListener() |
| 101 | { |
| 102 | // SECTION-START[Default Constructor] |
| 103 | super(); |
| 104 | // SECTION-END |
| 105 | } |
| 106 | // </editor-fold> |
| 107 | // SECTION-END |
| 108 | // SECTION-START[Dependencies] |
| 109 | // <editor-fold defaultstate="collapsed" desc=" Generated Dependencies "> |
| 110 | |
| 111 | /** |
| 112 | * Gets the {@code Locale} dependency. |
| 113 | * <p>This method returns the {@code 'default'} object of the {@code 'java.util.Locale'} {@code (java.util.Locale)} specification at specification level 1.1.</p> |
| 114 | * <p>That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance.</p> |
| 115 | * @return The {@code Locale} dependency. |
| 116 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
| 117 | */ |
| 118 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.0", comments = "See http://jomc.sourceforge.net/jomc/1.0/jomc-tools" ) |
| 119 | private java.util.Locale getLocale() |
| 120 | { |
| 121 | final java.util.Locale _d = (java.util.Locale) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "Locale" ); |
| 122 | assert _d != null : "'Locale' dependency not found."; |
| 123 | return _d; |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * Gets the {@code Logger} dependency. |
| 128 | * <p>This method returns any available object of the {@code 'org.jomc.logging.Logger'} {@code (org.jomc.logging.Logger)} specification at specification level 1.0.</p> |
| 129 | * <p>That specification does not apply to any scope. A new object is returned whenever requested and bound to this instance.</p> |
| 130 | * <p><b>Properties</b><dl> |
| 131 | * <dt>"{@code name}"</dt> |
| 132 | * <dd>Property of type {@code java.lang.String}. |
| 133 | * </dd> |
| 134 | * </dl> |
| 135 | * @return The {@code Logger} dependency. |
| 136 | * @throws org.jomc.ObjectManagementException if getting the dependency instance fails. |
| 137 | */ |
| 138 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.0", comments = "See http://jomc.sourceforge.net/jomc/1.0/jomc-tools" ) |
| 139 | private org.jomc.logging.Logger getLogger() |
| 140 | { |
| 141 | final org.jomc.logging.Logger _d = (org.jomc.logging.Logger) org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getDependency( this, "Logger" ); |
| 142 | assert _d != null : "'Logger' dependency not found."; |
| 143 | return _d; |
| 144 | } |
| 145 | // </editor-fold> |
| 146 | // SECTION-END |
| 147 | // SECTION-START[Properties] |
| 148 | // SECTION-END |
| 149 | // SECTION-START[Messages] |
| 150 | // <editor-fold defaultstate="collapsed" desc=" Generated Messages "> |
| 151 | |
| 152 | /** |
| 153 | * Gets the text of the {@code operationInfo} message. |
| 154 | * <p><b>Templates</b><br/><table> |
| 155 | * <tr><td valign="top">English:</td><td valign="top"><pre>--''{0}'' |
| 156 | * ++''{1}'' |
| 157 | * </pre></td></tr> |
| 158 | * <tr><td valign="top">Deutsch:</td><td valign="top"><pre>--''{0}'' |
| 159 | * ++''{1}'' |
| 160 | * </pre></td></tr> |
| 161 | * </table></p> |
| 162 | * @param locale The locale of the message to return. |
| 163 | * @param oldSequenceInfo Format argument. |
| 164 | * @param newSequenceInfo Format argument. |
| 165 | * @return The text of the {@code operationInfo} message. |
| 166 | * |
| 167 | * @throws org.jomc.ObjectManagementException if getting the message instance fails. |
| 168 | */ |
| 169 | @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.0", comments = "See http://jomc.sourceforge.net/jomc/1.0/jomc-tools" ) |
| 170 | private String getOperationInfo( final java.util.Locale locale, final java.lang.String oldSequenceInfo, final java.lang.String newSequenceInfo ) |
| 171 | { |
| 172 | final String _m = org.jomc.ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getMessage( this, "operationInfo", locale, oldSequenceInfo, newSequenceInfo ); |
| 173 | assert _m != null : "'operationInfo' message not found."; |
| 174 | return _m; |
| 175 | } |
| 176 | // </editor-fold> |
| 177 | // SECTION-END |
| 178 | } |