c40bfdfb9f2307bc233e79e578b41230c2cb22ab
[controller.git] / opendaylight / config / yang-jmx-generator-plugin / src / main / java / org / opendaylight / controller / config / yangjmxgenerator / plugin / ftl / AbstractModuleTemplate.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl;
9
10 import java.util.Collections;
11 import java.util.List;
12
13 import org.opendaylight.controller.config.api.DependencyResolver;
14 import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
15 import org.opendaylight.controller.config.api.ModuleIdentifier;
16 import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface;
17 import org.opendaylight.controller.config.api.runtime.RootRuntimeBeanRegistrator;
18 import org.opendaylight.controller.config.spi.Module;
19 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Constructor;
20 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Field;
21 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Header;
22 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.MethodDefinition;
23 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.ModuleField;
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
26
27 /**
28  *
29  */
30 public class AbstractModuleTemplate extends GeneralClassTemplate {
31
32     private final List<ModuleField> moduleFields;
33     private final boolean runtime;
34     private final String registratorType;
35
36     public AbstractModuleTemplate(Header header, String packageName,
37             String abstractModuleName, List<String> implementedIfcs,
38             List<ModuleField> moduleFields, List<MethodDefinition> methods,
39             boolean isRuntime, String registratorType) {
40         super(header, packageName, abstractModuleName, Collections
41                 .<String> emptyList(), implementedIfcs, Collections
42                 .<Field> emptyList(), methods, true, false, Collections
43                 .<Constructor> emptyList());
44         this.moduleFields = moduleFields;
45         this.runtime = isRuntime;
46         this.registratorType = registratorType;
47     }
48
49     public List<ModuleField> getModuleFields() {
50         return moduleFields;
51     }
52
53     public String getInstanceType() {
54         return AutoCloseable.class.getCanonicalName();
55     }
56
57     public String getModuleNameType() {
58         return ModuleIdentifier.class.getCanonicalName();
59     }
60
61     public String getAbstractServiceInterfaceType() {
62         return AbstractServiceInterface.class.getCanonicalName();
63     }
64
65     public String getModuleType() {
66         return Module.class.getCanonicalName();
67     }
68
69     public String getRegistratorType() {
70         return registratorType;
71     }
72
73     public boolean isRuntime() {
74         return runtime;
75     }
76
77     public String getDependencyResolverType() {
78         return DependencyResolver.class.getCanonicalName();
79     }
80
81     public String getDynamicMBeanWithInstanceType() {
82         return DynamicMBeanWithInstance.class.getCanonicalName();
83     }
84
85     public String getRootRuntimeRegistratorType() {
86         return RootRuntimeBeanRegistrator.class.getCanonicalName();
87     }
88
89     @Override
90     public String getFtlTempleteLocation() {
91         return "module_abs_template_new.ftl";
92     }
93
94     public String getLoggerType() {
95         return Logger.class.getCanonicalName();
96     }
97
98     public String getLoggerFactoryType() {
99         return LoggerFactory.class.getCanonicalName();
100     }
101
102 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.