Merge "BUG 718: changed codec for URI parsing"
[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 com.google.common.collect.Lists;
11 import org.opendaylight.controller.config.api.DependencyResolver;
12 import org.opendaylight.controller.config.api.DynamicMBeanWithInstance;
13 import org.opendaylight.controller.config.api.ModuleIdentifier;
14 import org.opendaylight.controller.config.api.annotations.AbstractServiceInterface;
15 import org.opendaylight.controller.config.spi.Module;
16 import org.opendaylight.controller.config.spi.ModuleFactory;
17 import org.opendaylight.controller.config.yangjmxgenerator.ModuleMXBeanEntry;
18 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Constructor;
19 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Field;
20 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Header;
21 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.MethodDefinition;
22 import org.osgi.framework.BundleContext;
23
24 import java.util.Collections;
25 import java.util.List;
26
27 /**
28  *
29  */
30 public class AbstractFactoryTemplate extends GeneralClassTemplate {
31
32     private static final List<String> implementedIfcs = Lists
33             .newArrayList(ModuleFactory.class.getCanonicalName());
34
35     private final String globallyUniqueName, moduleInstanceType;
36     private final List<String> providedServices;
37     private final ModuleMXBeanEntry mbe;
38
39     public AbstractFactoryTemplate(Header header, String packageName,
40                                    String abstractFactoryName, String globallyUniqueName,
41                                    String moduleInstanceType, List<Field> fields,
42                                    List<String> providedServices, ModuleMXBeanEntry mbe) {
43         super(header, packageName, abstractFactoryName, Collections
44                 .<String> emptyList(), implementedIfcs, fields, Collections
45                 .<MethodDefinition> emptyList(), true, false, Collections
46                 .<Constructor> emptyList());
47         this.globallyUniqueName = globallyUniqueName;
48         this.moduleInstanceType = moduleInstanceType;
49         this.providedServices = providedServices;
50         this.mbe = mbe;
51     }
52
53     public String getGloballyUniqueName() {
54         return globallyUniqueName;
55     }
56
57     public String getInstanceType() {
58         return AutoCloseable.class.getCanonicalName();
59     }
60
61     public String getModuleNameType() {
62         return ModuleIdentifier.class.getCanonicalName();
63     }
64
65     public String getModuleInstanceType() {
66         return moduleInstanceType;
67     }
68
69     public String getAbstractServiceInterfaceType() {
70         return AbstractServiceInterface.class.getCanonicalName();
71     }
72
73     public List<String> getProvidedServices() {
74         return providedServices;
75     }
76
77     public String getModuleType() {
78         return Module.class.getCanonicalName();
79     }
80
81     public String getDependencyResolverType() {
82         return DependencyResolver.class.getCanonicalName();
83     }
84
85     public String getDynamicMBeanWithInstanceType() {
86         return DynamicMBeanWithInstance.class.getCanonicalName();
87     }
88
89     public String getBundleContextType() {
90         return BundleContext.class.getCanonicalName();
91     }
92
93     @Override
94     public String getFtlTempleteLocation() {
95         return "factory_abs_template.ftl";
96     }
97
98     public ModuleMXBeanEntry getMbe() {
99         return mbe;
100     }
101 }