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.plugin.ftl.model.Constructor;
18 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Field;
19 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.Header;
20 import org.opendaylight.controller.config.yangjmxgenerator.plugin.ftl.model.MethodDefinition;
21 import org.osgi.framework.BundleContext;
23 import java.util.Collections;
24 import java.util.List;
29 public class AbstractFactoryTemplate extends GeneralClassTemplate {
31 private static final List<String> implementedIfcs = Lists
32 .newArrayList(ModuleFactory.class.getCanonicalName());
34 private final String globallyUniqueName, moduleInstanceType;
35 private final List<String> providedServices;
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;
50 public String getGloballyUniqueName() {
51 return globallyUniqueName;
54 public String getInstanceType() {
55 return AutoCloseable.class.getCanonicalName();
58 public String getModuleNameType() {
59 return ModuleIdentifier.class.getCanonicalName();
62 public String getModuleInstanceType() {
63 return moduleInstanceType;
66 public String getAbstractServiceInterfaceType() {
67 return AbstractServiceInterface.class.getCanonicalName();
70 public List<String> getProvidedServices() {
71 return providedServices;
74 public String getModuleType() {
75 return Module.class.getCanonicalName();
78 public String getDependencyResolverType() {
79 return DependencyResolver.class.getCanonicalName();
82 public String getDynamicMBeanWithInstanceType() {
83 return DynamicMBeanWithInstance.class.getCanonicalName();
86 public String getBundleContextType() {
87 return BundleContext.class.getCanonicalName();
91 public String getFtlTempleteLocation() {
92 return "factory_abs_template.ftl";