View Javadoc

1   // SECTION-START[License Header]
2   // <editor-fold defaultstate="collapsed" desc=" Generated License ">
3   /*
4    *   jDTAUS
5    *   Copyright (C) Christian Schulte, 2012-039
6    *
7    *   This program is free software: you can redistribute it and/or modify
8    *   it under the terms of the GNU Lesser General Public License as published
9    *   by the Free Software Foundation, either version 2.1 of the License, or
10   *   (at your option) any later version.
11   *
12   *   This program is distributed in the hope that it will be useful,
13   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   *   GNU General Public License for more details.
16   *
17   *   You should have received a copy of the GNU Lesser General Public License
18   *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
19   *
20   *   $JDTAUS: ObjectManagerContainer.java 8804 2012-12-03 19:30:17Z schulte $
21   *
22   */
23  // </editor-fold>
24  // SECTION-END
25  package org.jdtaus.core.container.ri.jomc;
26  
27  import java.util.Locale;
28  import org.jdtaus.core.container.Container;
29  import org.jdtaus.core.container.ContainerFactory;
30  import org.jomc.ObjectManagerFactory;
31  
32  // SECTION-START[Documentation]
33  // <editor-fold defaultstate="collapsed" desc=" Generated Documentation ">
34  /**
35   * jDTAUS {@code Container} implementation delegating to the JOMC {@code ObjectManager}.
36   *
37   * <dl>
38   *   <dt><b>Identifier:</b></dt><dd>jDTAUS Core &#8273; JOMC Container &#8273; ObjectManagerContainer</dd>
39   *   <dt><b>Name:</b></dt><dd>jDTAUS Core &#8273; JOMC Container &#8273; ObjectManagerContainer</dd>
40   *   <dt><b>Specifications:</b></dt>
41   *     <dd>org.jdtaus.core.container.Container</dd>
42   *   <dt><b>Abstract:</b></dt><dd>No</dd>
43   *   <dt><b>Final:</b></dt><dd>No</dd>
44   *   <dt><b>Stateless:</b></dt><dd>No</dd>
45   * </dl>
46   *
47   * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 1.0
48   * @version 1.14
49   */
50  // </editor-fold>
51  // SECTION-END
52  // SECTION-START[Annotations]
53  // <editor-fold defaultstate="collapsed" desc=" Generated Annotations ">
54  @javax.annotation.Generated( value = "org.jomc.tools.SourceFileProcessor 1.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.3" )
55  // </editor-fold>
56  // SECTION-END
57  public class ObjectManagerContainer
58      implements
59      org.jdtaus.core.container.Container
60  {
61      // SECTION-START[Container]
62  
63      private static final Container instance = ContainerFactory.newContainer();
64  
65      public static Container getContainer()
66      {
67          return instance;
68      }
69  
70      @Override
71      public Object getObject( final Class specification )
72      {
73          return ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).getObject( specification );
74      }
75  
76      @Override
77      public Object getObject( final Class specification, final String implementationName )
78      {
79          return ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).
80              getObject( specification, implementationName );
81  
82      }
83  
84      @Override
85      public Object getDependency( final Object object, final String dependencyName )
86      {
87          return ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).
88              getDependency( object, dependencyName );
89  
90      }
91  
92      @Override
93      public Object getProperty( final Object object, final String propertyName )
94      {
95          return ObjectManagerFactory.getObjectManager( this.getClass().getClassLoader() ).
96              getProperty( object, propertyName );
97  
98      }
99  
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.3", comments = "See http://jomc.sourceforge.net/jomc/1.3/jomc-tools-1.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 }