001    // SECTION-START[License Header]
002    // <editor-fold defaultstate="collapsed" desc=" Generated License ">
003    /*
004     *   jDTAUS
005     *   Copyright (C) Christian Schulte, 2012-039
006     *
007     *   This program is free software: you can redistribute it and/or modify
008     *   it under the terms of the GNU Lesser General Public License as published
009     *   by the Free Software Foundation, either version 2.1 of the License, or
010     *   (at your option) any later version.
011     *
012     *   This program is distributed in the hope that it will be useful,
013     *   but WITHOUT ANY WARRANTY; without even the implied warranty of
014     *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
015     *   GNU General Public License for more details.
016     *
017     *   You should have received a copy of the GNU Lesser General Public License
018     *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
019     *
020     *   $JDTAUS: ObjectManagerContainer.java 8518 2012-04-02 20:55:41Z schulte2005 $
021     *
022     */
023    // </editor-fold>
024    // SECTION-END
025    package org.jdtaus.core.container.ri.jomc;
026    
027    import java.util.Locale;
028    import org.jdtaus.core.container.Container;
029    import org.jdtaus.core.container.ContainerFactory;
030    import org.jomc.ObjectManagerFactory;
031    
032    // SECTION-START[Documentation]
033    // <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
034    /**
035     * jDTAUS {@code Container} implementation delegating to the JOMC {@code ObjectManager}.
036     *
037     * <dl>
038     *   <dt><b>Identifier:</b></dt><dd>jDTAUS Core JOMC Container :: ObjectManagerContainer</dd>
039     *   <dt><b>Name:</b></dt><dd>jDTAUS Core JOMC Container :: ObjectManagerContainer</dd>
040     *   <dt><b>Specifications:</b></dt>
041     *     <dd>org.jdtaus.core.container.Container</dd>
042     *   <dt><b>Abstract:</b></dt><dd>No</dd>
043     *   <dt><b>Final:</b></dt><dd>No</dd>
044     *   <dt><b>Stateless:</b></dt><dd>No</dd>
045     * </dl>
046     *
047     * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a> 1.0
048     * @version 1.11
049     */
050    // </editor-fold>
051    // SECTION-END
052    // SECTION-START[Annotations]
053    // <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
054    @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
055    // </editor-fold>
056    // SECTION-END
057    public class ObjectManagerContainer
058        implements
059        org.jdtaus.core.container.Container
060    {
061        // SECTION-START[Container]
062    
063        private static final Container instance = ContainerFactory.newContainer();
064    
065        public static Container getContainer()
066        {
067            return instance;
068        }
069    
070        @Override
071        public Object getObject( final Class specification )
072        {
073            return ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getObject( specification );
074        }
075    
076        @Override
077        public Object getObject( final Class specification, final String implementationName )
078        {
079            return ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).
080                getObject( specification, implementationName );
081    
082        }
083    
084        @Override
085        public Object getDependency( final Object object, final String dependencyName )
086        {
087            return ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).
088                getDependency( object, dependencyName );
089    
090        }
091    
092        @Override
093        public Object getProperty( final Object object, final String propertyName )
094        {
095            return ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).
096                getProperty( object, propertyName );
097    
098        }
099    
100        @Override
101        public String getMessage( final Object object, final String messageName, final Locale locale,
102                                  final Object arguments )
103        {
104            return ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).
105                getMessage( object, messageName, locale, (Object[]) arguments );
106    
107        }
108    
109        @Override
110        @Deprecated
111        public Object getImplementation( final Class specification, final String implementationName )
112        {
113            return this.getObject( specification, implementationName );
114        }
115    
116        @Override
117        @Deprecated
118        public Object getDependency( final Class implementation, final String dependencyName )
119        {
120            throw new UnsupportedOperationException();
121        }
122    
123        @Override
124        @Deprecated
125        public Object getObject( final String specificationIdentifier )
126        {
127            throw new UnsupportedOperationException();
128        }
129    
130        @Override
131        @Deprecated
132        public Object getObject( final String specificationIdentifier, final String implementationName )
133        {
134            throw new UnsupportedOperationException();
135        }
136    
137        @Override
138        @Deprecated
139        public String getMessage( final Object object, final String messageName, final Object arguments )
140        {
141            return this.getMessage( object, messageName, Locale.getDefault(), arguments );
142        }
143    
144        // SECTION-END
145        // SECTION-START[ObjectManagerContainer]
146        // SECTION-END
147        // SECTION-START[Constructors]
148        // <editor-fold defaultstate="collapsed" desc=" Generated Constructors ">
149        /** Creates a new {@code ObjectManagerContainer} instance. */
150        @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.2.3", comments = "See http://jomc.sourceforge.net/jomc/1.2/jomc-tools-1.2.3" )
151        public ObjectManagerContainer()
152        {
153            // SECTION-START[Default Constructor]
154            super();
155            // SECTION-END
156        }
157        // </editor-fold>
158        // SECTION-END
159        // SECTION-START[Dependencies]
160        // SECTION-END
161        // SECTION-START[Properties]
162        // SECTION-END
163        // SECTION-START[Messages]
164        // SECTION-END
165    }