Initial code drop of yang model driven configuration system
[controller.git] / opendaylight / config / yang-jmx-generator-plugin / src / main / java / org / opendaylight / controller / config / yangjmxgenerator / plugin / ftl / AbstractFactoryTemplate.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.spi.Module;
18 import org.opendaylight.controller.config.spi.ModuleFactory;
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
24 import com.google.common.collect.Lists;
25
26 /**
27  *
28  */
29 public class AbstractFactoryTemplate extends GeneralClassTemplate {
30
31     private static final List<String> implementedIfcs = Lists
32             .newArrayList(ModuleFactory.class.getCanonicalName());
33
34     private final String globallyUniqueName, moduleInstanceType;
35     private final List<String> providedServices;
36
37     public AbstractFactoryTemplate(Header header, String packageName,
38             String abstractFactoryName, String globallyUniqueName,
39             String moduleInstanceType, List<Field> fields,
40             List<String> providedServices) {
41         super(header, packageName, abstractFactoryName, Collections
42                 .<String> emptyList(), implementedIfcs, fields, Collections
43                 .<MethodDefinition> emptyList(), true, false, Collections
44                 .<Constructor> emptyList());
45         this.globallyUniqueName = globallyUniqueName;
46         this.moduleInstanceType = moduleInstanceType;
47         this.providedServices = providedServices;
48     }
49
50     public String getGloballyUniqueName() {
51         return globallyUniqueName;
52     }
53
54     public String getInstanceType() {
55         return AutoCloseable.class.getCanonicalName();
56     }
57
58     public String getModuleNameType() {
59         return ModuleIdentifier.class.getCanonicalName();
60     }
61
62     public String getModuleInstanceType() {
63         return moduleInstanceType;
64     }
65
66     public String getAbstractServiceInterfaceType() {
67         return AbstractServiceInterface.class.getCanonicalName();
68     }
69
70     public List<String> getProvidedServices() {
71         return providedServices;
72     }
73
74     public String getModuleType() {
75         return Module.class.getCanonicalName();
76     }
77
78     public String getDependencyResolverType() {
79         return DependencyResolver.class.getCanonicalName();
80     }
81
82     public String getDynamicMBeanWithInstanceType() {
83         return DynamicMBeanWithInstance.class.getCanonicalName();
84     }
85
86     @Override
87     public String getFtlTempleteLocation() {
88         return "factory_abs_template.ftl";
89     }
90
91 }