KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > dna > impl > MockComponent


1 /*
2  * Copyright (C) The DNA Group. All rights reserved.
3  *
4  * This software is published under the terms of the DNA
5  * Software License version 1.1, a copy of which has been included
6  * with this distribution in the LICENSE.txt file.
7  */

8 package org.codehaus.dna.impl;
9
10 import org.codehaus.dna.Active;
11 import org.codehaus.dna.Composable;
12 import org.codehaus.dna.Configurable;
13 import org.codehaus.dna.Configuration;
14 import org.codehaus.dna.ConfigurationException;
15 import org.codehaus.dna.LogEnabled;
16 import org.codehaus.dna.Logger;
17 import org.codehaus.dna.MissingResourceException;
18 import org.codehaus.dna.ResourceLocator;
19
20 class MockComponent
21     implements LogEnabled, Composable, Configurable, Active
22 {
23     private Logger m_logger;
24     private ResourceLocator m_services;
25     private Configuration m_configuration;
26     private boolean m_initialized;
27     private boolean m_disposed;
28
29     public void enableLogging( Logger logger )
30     {
31         m_logger = logger;
32     }
33
34     public void compose( ResourceLocator locator )
35         throws MissingResourceException
36     {
37         m_services = locator;
38     }
39
40     public void configure( Configuration configuration )
41         throws ConfigurationException
42     {
43         m_configuration = configuration;
44     }
45
46     public void initialize()
47         throws Exception JavaDoc
48     {
49         m_initialized = true;
50     }
51
52     public void dispose()
53         throws Exception JavaDoc
54     {
55         m_disposed = true;
56     }
57
58     Logger getLogger()
59     {
60         return m_logger;
61     }
62
63     ResourceLocator getServices()
64     {
65         return m_services;
66     }
67
68     Configuration getConfiguration()
69     {
70         return m_configuration;
71     }
72
73     boolean isInitialized()
74     {
75         return m_initialized;
76     }
77
78     boolean isDisposed()
79     {
80         return m_disposed;
81     }
82 }
83
Popular Tags