001/*
002 *   Copyright (C) Christian Schulte, 2005-206
003 *   All rights reserved.
004 *
005 *   Redistribution and use in source and binary forms, with or without
006 *   modification, are permitted provided that the following conditions
007 *   are met:
008 *
009 *     o Redistributions of source code must retain the above copyright
010 *       notice, this list of conditions and the following disclaimer.
011 *
012 *     o Redistributions in binary form must reproduce the above copyright
013 *       notice, this list of conditions and the following disclaimer in
014 *       the documentation and/or other materials provided with the
015 *       distribution.
016 *
017 *   THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
018 *   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
019 *   AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
020 *   THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
021 *   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
022 *   NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
023 *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
024 *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
025 *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
026 *   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
027 *
028 *   $JOMC: TestModletProvider.java 4654 2012-11-15 22:28:26Z schulte $
029 *
030 */
031package org.jomc.modlet.test.support;
032
033import java.net.URL;
034import org.jomc.modlet.ModelContext;
035import org.jomc.modlet.ModelException;
036import org.jomc.modlet.ModelProcessor;
037import org.jomc.modlet.ModelProvider;
038import org.jomc.modlet.ModelValidator;
039import org.jomc.modlet.Modlet;
040import org.jomc.modlet.ModletProvider;
041import org.jomc.modlet.Modlets;
042import org.jomc.modlet.Service;
043import org.jomc.modlet.Services;
044
045/**
046 * {@code ModletProvider} test implementation.
047 *
048 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 1.0
049 * @version $JOMC: TestModletProvider.java 4654 2012-11-15 22:28:26Z schulte $
050 */
051public final class TestModletProvider implements ModletProvider
052{
053
054    private boolean booleanProperty;
055
056    private boolean boxedBooleanProperty;
057
058    private Boolean unboxedBooleanProperty;
059
060    private char characterProperty;
061
062    private char boxedCharacterProperty;
063
064    private Character unboxedCharacterProperty;
065
066    private byte byteProperty;
067
068    private byte boxedByteProperty;
069
070    private Byte unboxedByteProperty;
071
072    private short shortProperty;
073
074    private short boxedShortProperty;
075
076    private Short unboxedShortProperty;
077
078    private int intProperty;
079
080    private int boxedIntProperty;
081
082    private Integer unboxedIntProperty;
083
084    private long longProperty;
085
086    private long boxedLongProperty;
087
088    private Long unboxedLongProperty;
089
090    private float floatProperty;
091
092    private float boxedFloatProperty;
093
094    private Float unboxedFloatProperty;
095
096    private double doubleProperty;
097
098    private double boxedDoubleProperty;
099
100    private Double unboxedDoubleProperty;
101
102    private String stringProperty;
103
104    private URL urlProperty;
105
106    private Thread.State enumProperty;
107
108    private Object objectProperty;
109
110    private String stringPropertyWithoutSetter;
111
112    private String stringPropertyWithoutGetter;
113
114    private Math unsupportedPropertyType;
115
116    private InstantiationExceptionPropertyType instantiationExceptionProperty;
117
118    private InvocationTargetExceptionPropertyType invocationTargetExceptionProperty;
119
120    public TestModletProvider()
121    {
122        super();
123    }
124
125    public Modlets findModlets( final ModelContext context ) throws ModelException
126    {
127        final Modlets modlets = new Modlets();
128        final Modlet modlet = new Modlet();
129        modlets.getModlet().add( modlet );
130        modlet.setName( TestModletProvider.class.getName() );
131        modlet.setModel( TestModletProvider.class.getName() );
132        modlet.setServices( new Services() );
133
134        Service s = new Service();
135        s.setClazz( TestModelProvider.class.getName() );
136        s.setIdentifier( ModelProvider.class.getName() );
137        modlet.getServices().getService().add( s );
138
139        s = new Service();
140        s.setClazz( TestModelProcessor.class.getName() );
141        s.setIdentifier( ModelProcessor.class.getName() );
142        modlet.getServices().getService().add( s );
143
144        s = new Service();
145        s.setClazz( TestModelValidator.class.getName() );
146        s.setIdentifier( ModelValidator.class.getName() );
147        modlet.getServices().getService().add( s );
148
149        context.setAttribute( TestModletProvider.class.getName(), this );
150        return modlets;
151    }
152
153    public boolean isBooleanProperty()
154    {
155        return this.booleanProperty;
156    }
157
158    public void setBooleanProperty( final boolean value )
159    {
160        this.booleanProperty = value;
161    }
162
163    public Boolean isBoxedBooleanProperty()
164    {
165        return this.boxedBooleanProperty;
166    }
167
168    public void setBoxedBooleanProperty( final boolean value )
169    {
170        this.boxedBooleanProperty = value;
171    }
172
173    public boolean isUnboxedBooleanProperty()
174    {
175        return this.unboxedBooleanProperty ? true : false;
176    }
177
178    public void setUnboxedBooleanProperty( final Boolean value )
179    {
180        this.unboxedBooleanProperty = value;
181    }
182
183    public char getCharacterProperty()
184    {
185        return this.characterProperty;
186    }
187
188    public void setCharacterProperty( final char value )
189    {
190        this.characterProperty = value;
191    }
192
193    public Character getBoxedCharacterProperty()
194    {
195        return this.boxedCharacterProperty;
196    }
197
198    public void setBoxedCharacterProperty( final char value )
199    {
200        this.boxedCharacterProperty = value;
201    }
202
203    public char getUnboxedCharacterProperty()
204    {
205        return this.unboxedCharacterProperty;
206    }
207
208    public void setUnboxedCharacterProperty( final Character value )
209    {
210        this.unboxedCharacterProperty = value;
211    }
212
213    public byte getByteProperty()
214    {
215        return this.byteProperty;
216    }
217
218    public void setByteProperty( final byte value )
219    {
220        this.byteProperty = value;
221    }
222
223    public Byte getBoxedByteProperty()
224    {
225        return this.boxedByteProperty;
226    }
227
228    public void setBoxedByteProperty( final byte value )
229    {
230        this.boxedByteProperty = value;
231    }
232
233    public byte getUnboxedByteProperty()
234    {
235        return this.unboxedByteProperty;
236    }
237
238    public void setUnboxedByteProperty( final Byte value )
239    {
240        this.unboxedByteProperty = value;
241    }
242
243    public short getShortProperty()
244    {
245        return this.shortProperty;
246    }
247
248    public void setShortProperty( final short value )
249    {
250        this.shortProperty = value;
251    }
252
253    public Short getBoxedShortProperty()
254    {
255        return this.boxedShortProperty;
256    }
257
258    public void setBoxedShortProperty( final short value )
259    {
260        this.boxedShortProperty = value;
261    }
262
263    public short getUnboxedShortProperty()
264    {
265        return this.unboxedShortProperty;
266    }
267
268    public void setUnboxedShortProperty( final Short value )
269    {
270        this.unboxedShortProperty = value;
271    }
272
273    public int getIntProperty()
274    {
275        return this.intProperty;
276    }
277
278    public void setIntProperty( final int value )
279    {
280        this.intProperty = value;
281    }
282
283    public Integer getBoxedIntProperty()
284    {
285        return this.boxedIntProperty;
286    }
287
288    public void setBoxedIntProperty( final int value )
289    {
290        this.boxedIntProperty = value;
291    }
292
293    public int getUnboxedIntProperty()
294    {
295        return this.unboxedIntProperty;
296    }
297
298    public void setUnboxedIntProperty( final Integer value )
299    {
300        this.unboxedIntProperty = value;
301    }
302
303    public long getLongProperty()
304    {
305        return this.longProperty;
306    }
307
308    public void setLongProperty( final long value )
309    {
310        this.longProperty = value;
311    }
312
313    public Long getBoxedLongProperty()
314    {
315        return this.boxedLongProperty;
316    }
317
318    public void setBoxedLongProperty( final long value )
319    {
320        this.boxedLongProperty = value;
321    }
322
323    public long getUnboxedLongProperty()
324    {
325        return this.unboxedLongProperty;
326    }
327
328    public void setUnboxedLongProperty( final Long value )
329    {
330        this.unboxedLongProperty = value;
331    }
332
333    public float getFloatProperty()
334    {
335        return this.floatProperty;
336    }
337
338    public void setFloatProperty( final float value )
339    {
340        this.floatProperty = value;
341    }
342
343    public Float getBoxedFloatProperty()
344    {
345        return this.boxedFloatProperty;
346    }
347
348    public void setBoxedFloatProperty( final float value )
349    {
350        this.boxedFloatProperty = value;
351    }
352
353    public float getUnboxedFloatProperty()
354    {
355        return this.unboxedFloatProperty;
356    }
357
358    public void setUnboxedFloatProperty( final Float value )
359    {
360        this.unboxedFloatProperty = value;
361    }
362
363    public double getDoubleProperty()
364    {
365        return this.doubleProperty;
366    }
367
368    public void setDoubleProperty( final double value )
369    {
370        this.doubleProperty = value;
371    }
372
373    public Double getBoxedDoubleProperty()
374    {
375        return this.boxedDoubleProperty;
376    }
377
378    public void setBoxedDoubleProperty( final double value )
379    {
380        this.boxedDoubleProperty = value;
381    }
382
383    public double getUnboxedDoubleProperty()
384    {
385        return this.unboxedDoubleProperty;
386    }
387
388    public void setUnboxedDoubleProperty( final Double value )
389    {
390        this.unboxedDoubleProperty = value;
391    }
392
393    public String getStringProperty()
394    {
395        return this.stringProperty;
396    }
397
398    public void setStringProperty( final String value )
399    {
400        this.stringProperty = value;
401    }
402
403    public String getStringPropertyWithoutSetter()
404    {
405        return this.stringPropertyWithoutSetter;
406    }
407
408    public void setStringPropertyWithoutGetter( final String value )
409    {
410        this.stringPropertyWithoutGetter = value;
411    }
412
413    public URL getUrlProperty()
414    {
415        return this.urlProperty;
416    }
417
418    public void setUrlProperty( final URL value )
419    {
420        this.urlProperty = value;
421    }
422
423    public Thread.State getEnumProperty()
424    {
425        return this.enumProperty;
426    }
427
428    public void setEnumProperty( final Thread.State value )
429    {
430        this.enumProperty = value;
431    }
432
433    public Object getObjectProperty()
434    {
435        return this.objectProperty;
436    }
437
438    public void setObjectProperty( final Object value )
439    {
440        this.objectProperty = value;
441    }
442
443    public Math getUnsupportedPropertyType()
444    {
445        return this.unsupportedPropertyType;
446    }
447
448    public void setUnsupportedPropertyType( final Math value )
449    {
450        this.unsupportedPropertyType = value;
451    }
452
453    public InstantiationExceptionPropertyType getInstantiationExceptionProperty()
454    {
455        return this.instantiationExceptionProperty;
456    }
457
458    public void setInstantiationExceptionProperty( final InstantiationExceptionPropertyType value )
459    {
460        this.instantiationExceptionProperty = value;
461    }
462
463    public InvocationTargetExceptionPropertyType getInvocationTargetExceptionProperty()
464    {
465        return this.invocationTargetExceptionProperty;
466    }
467
468    public void setInvocationTargetExceptionProperty( final InvocationTargetExceptionPropertyType value )
469    {
470        this.invocationTargetExceptionProperty = value;
471    }
472
473}