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 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;
24 import java.util.Collections;
25 import java.util.List;
30 public class AbstractFactoryTemplate extends GeneralClassTemplate {
32 private static final List<String> implementedIfcs = Lists
33 .newArrayList(ModuleFactory.class.getCanonicalName());
35 private final String globallyUniqueName, moduleInstanceType;
36 private final List<String> providedServices;
37 private final ModuleMXBeanEntry mbe;
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;
53 public String getGloballyUniqueName() {
54 return globallyUniqueName;
57 public String getInstanceType() {
58 return AutoCloseable.class.getCanonicalName();
61 public String getModuleNameType() {
62 return ModuleIdentifier.class.getCanonicalName();
65 public String getModuleInstanceType() {
66 return moduleInstanceType;
69 public String getAbstractServiceInterfaceType() {
70 return AbstractServiceInterface.class.getCanonicalName();
73 public List<String> getProvidedServices() {
74 return providedServices;
77 public String getModuleType() {
78 return Module.class.getCanonicalName();
81 public String getDependencyResolverType() {
82 return DependencyResolver.class.getCanonicalName();
85 public String getDynamicMBeanWithInstanceType() {
86 return DynamicMBeanWithInstance.class.getCanonicalName();
89 public String getBundleContextType() {
90 return BundleContext.class.getCanonicalName();
94 public String getFtlTempleteLocation() {
95 return "factory_abs_template.ftl";
98 public ModuleMXBeanEntry getMbe() {