1 /*
2 ~ Copyright 2006-2007 Nicolas De Loof.
3 ~
4 ~ Licensed under the Apache License, Version 2.0 (the "License");
5 ~ you may not use this file except in compliance with the License.
6 ~ You may obtain a copy of the License at
7 ~
8 ~ http://www.apache.org/licenses/LICENSE-2.0
9 ~
10 ~ Unless required by applicable law or agreed to in writing, software
11 ~ distributed under the License is distributed on an "AS IS" BASIS,
12 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ~ See the License for the specific language governing permissions and
14 ~ limitations under the License.
15 */
16 package org.jmonit.repositories;
17
18 import org.jmonit.Monitor;
19 import org.jmonit.events.MonitoringEventListener;
20 import org.jmonit.log.Log;
21 import org.jmonit.monitors.DefaultMonitor;
22
23 /**
24 * Default implementation of <code>Repository</code>
25 *
26 * @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
27 */
28 public class DefaultRepository
29 extends AbstractRepository
30 {
31 /** logger */
32 private static Log log = Log.getLog( DefaultRepository.class );
33
34 /**
35 * Constructor
36 */
37 public DefaultRepository()
38 {
39 super();
40 }
41
42 /**
43 * {@inheritDoc}
44 *
45 * @see org.jmonit.repositories.AbstractRepository#newMonitorInstance(java.lang.String)
46 */
47 protected Monitor newMonitorInstance( String name )
48 {
49 log.info( "create monitor for name " + name );
50 DefaultMonitor monitor = new DefaultMonitor( name, this );
51 monitor.setPluginManager( getFeatureManager() );
52 if ( getFeatureManager() instanceof MonitoringEventListener )
53 {
54 monitor.addListener( (MonitoringEventListener) getFeatureManager() );
55 }
56 return monitor;
57 }
58 }