2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl;
10 import java.util.Collections;
11 import java.util.List;
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;
30 public class AbstractModuleTemplate extends GeneralClassTemplate {
32 private final List<ModuleField> moduleFields;
33 private final boolean runtime;
34 private final String registratorType;
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;
49 public List<ModuleField> getModuleFields() {
53 public String getInstanceType() {
54 return AutoCloseable.class.getCanonicalName();
57 public String getModuleNameType() {
58 return ModuleIdentifier.class.getCanonicalName();
61 public String getAbstractServiceInterfaceType() {
62 return AbstractServiceInterface.class.getCanonicalName();
65 public String getModuleType() {
66 return Module.class.getCanonicalName();
69 public String getRegistratorType() {
70 return registratorType;
73 public boolean isRuntime() {
77 public String getDependencyResolverType() {
78 return DependencyResolver.class.getCanonicalName();
81 public String getDynamicMBeanWithInstanceType() {
82 return DynamicMBeanWithInstance.class.getCanonicalName();
85 public String getRootRuntimeRegistratorType() {
86 return RootRuntimeBeanRegistrator.class.getCanonicalName();
90 public String getFtlTempleteLocation() {
91 return "module_abs_template_new.ftl";
94 public String getLoggerType() {
95 return Logger.class.getCanonicalName();
98 public String getLoggerFactoryType() {
99 return LoggerFactory.class.getCanonicalName();