*/
public <K> void put(K key, MappingEntry<?>... values);
- /**
- * Get a specific value from the DAO.
- *
- * @param key
- * The key of the value to fetch
- * @param valueKey
- * The value to fetch
- * @return The value from the DAO.
- */
- public <K, V> V getSpecific(K key, MappingValueKey<V> valueKey);
-
/**
* Get a specific value from the DAO.
*
* The key.
* @return The value from the DAO.
*/
- public <K> Map<String, ?> get(K key);
+ public <K> Map<String, Object> get(K key);
/**
* Remove an entry from the DAO
--- /dev/null
+META-INF
+*.launch
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.opendaylight.lispflowmapping</groupId>
+ <artifactId>mappingservice-parent</artifactId>
+ <version>1.1.3-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+ <artifactId>mappingservice.clusterdao</artifactId>
+ <packaging>bundle</packaging>
+ <scm>
+ <connection>scm:git:https://git.opendaylight.org/gerrit/p/lispflowmapping.git</connection>
+ <developerConnection>scm:git:ssh://git.opendaylight.org:29418/lispflowmapping.git</developerConnection>
+ <url>https://wiki.opendaylight.org/view/OpenDaylight_Lisp_Flow_Mapping:Main</url>
+ <tag>HEAD</tag>
+ </scm>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>
+ org.opendaylight.lispflowmapping.clusterdao
+ </Export-Package>
+ <Import-Package>
+ org.apache.felix.dm,
+ org.opendaylight.controller.clustering.services,
+ org.opendaylight.controller.sal.core,
+ org.opendaylight.lispflowmapping.interfaces.dao, org.slf4j
+ </Import-Package>
+ <Bundle-Activator>
+ org.opendaylight.lispflowmapping.clusterdao.Activator
+ </Bundle-Activator>
+ <Service-Component>
+ </Service-Component>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>clustering.services</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.lispflowmapping</groupId>
+ <artifactId>mappingservice.api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>equinoxSDK381</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ </dependency>
+ </dependencies>
+</project>
--- /dev/null
+/*
+ * Copyright (c) 2014 Contextream, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.lispflowmapping.clusterdao;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.felix.dm.Component;
+import org.opendaylight.controller.clustering.services.IClusterContainerServices;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
+import org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO;
+import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
+
+/**
+ * Main application activator class for registering the dependencies and
+ * initialising the Mapping Service application.
+ *
+ */
+
+public class Activator extends ComponentActivatorAbstractBase {
+
+ /**
+ * Function called when the activator starts just after some initializations
+ * are done by the ComponentActivatorAbstractBase.
+ *
+ */
+ @Override
+ public void init() {
+ }
+
+ /**
+ * Function called when the activator stops just before the cleanup done by
+ * ComponentActivatorAbstractBase
+ *
+ */
+ @Override
+ public void destroy() {
+ }
+
+ /**
+ * Function that is used to communicate to dependency manager the list of
+ * known implementations for services inside a container
+ *
+ *
+ * @return An array containing all the CLASS objects that will be
+ * instantiated in order to get an fully working implementation
+ * Object
+ */
+ @Override
+ public Object[] getImplementations() {
+ Object[] res = { ClusterDAOService.class };
+ return res;
+ }
+
+ /**
+ * Function that is called when configuration of the dependencies is
+ * required.
+ *
+ * @param c
+ * dependency manager Component object, used for configuring the
+ * dependencies exported and imported
+ * @param imp
+ * Implementation class that is being configured, needed as long
+ * as the same routine can configure multiple implementations
+ * @param containerName
+ * The containerName being configured, this allow also optional
+ * per-container different behavior if needed, usually should not
+ * be the case though.
+ */
+ @Override
+ public void configureInstance(Component c, Object imp, String containerName) {
+ if (imp.equals(ClusterDAOService.class)) {
+ // export the service
+ Dictionary<String, String> props = new Hashtable<String, String>();
+ props.put("name", "clusterosgiservice");
+ c.setInterface(new String[] { ILispDAO.class.getName() }, props);
+ c.add(createContainerServiceDependency(containerName).setService(IClusterContainerServices.class)
+ .setCallbacks("setClusterContainerService", "unsetClusterContainerService").setRequired(true));
+ }
+ }
+
+ /**
+ * Method which tells how many Global implementations are supported by the
+ * bundle. This way we can tune the number of components created. This
+ * components will be created ONLY at the time of bundle startup and will be
+ * destroyed only at time of bundle destruction, this is the major
+ * difference with the implementation retrieved via getImplementations where
+ * all of them are assumed to be in a container !
+ *
+ *
+ * @return The list of implementations the bundle will support, in Global
+ * version
+ */
+ @Override
+ protected Object[] getGlobalImplementations() {
+ return null;
+ }
+
+ /**
+ * Configure the dependency for a given instance Global
+ *
+ * @param c
+ * Component assigned for this instance, this will be what will
+ * be used for configuration
+ * @param imp
+ * implementation to be configured
+ * @param containerName
+ * container on which the configuration happens
+ */
+ @Override
+ protected void configureGlobalInstance(Component c, Object imp) {
+
+ }
+}
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.lispflowmapping.implementation.dao;
+package org.opendaylight.lispflowmapping.clusterdao;
import java.lang.reflect.ParameterizedType;
import java.util.EnumSet;
}
@SuppressWarnings("unchecked")
- public <K, V> V getSpecific(K key, MappingValueKey<V> valueKey) {
+ private <K, V> V getSpecific(K key, MappingValueKey<V> valueKey) {
Map<Object, Map<String, Object>> keysToValues = getTypeMap(key);
Map<String, Object> keyToValues = keysToValues.get(key);
if (keyToValues == null) {
return getSpecific(key, new MappingValueKey<Object>(valueKey));
}
- public <K> Map<String, ?> get(K key) {
+ public <K> Map<String, Object> get(K key) {
Map<Object, Map<String, Object>> keysToValues = getTypeMap(key);
return keysToValues.get(key);
}
public void setTimeUnit(TimeUnit timeUnit) {
this.timeUnit = timeUnit;
}
-
}
org.opendaylight.lispflowmapping.type,
org.opendaylight.lispflowmapping.type.lisp,
org.opendaylight.lispflowmapping.type.sbplugin,
- org.opendaylight.controller.clustering.services,
javax.crypto,
javax.crypto.spec,
org.opendaylight.controller.sal.binding.api,
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>clustering.services</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal</artifactId>
import java.util.Hashtable;
import org.apache.felix.dm.Component;
-import org.opendaylight.controller.clustering.services.IClusterContainerServices;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
-import org.opendaylight.lispflowmapping.implementation.dao.ClusterDAOService;
import org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO;
import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
*/
@Override
public Object[] getImplementations() {
- Object[] res = { LispMappingService.class, ClusterDAOService.class };
+ Object[] res = { LispMappingService.class };
return res;
}
.setRequired(true));
c.add(createServiceDependency().setService(BindingAwareBroker.class).setRequired(true)
.setCallbacks("setBindingAwareBroker", "unsetBindingAwareBroker"));
- } else if (imp.equals(ClusterDAOService.class)) {
- // export the service
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("name", "clusterosgiservice");
- c.setInterface(new String[] { ILispDAO.class.getName() }, props);
- c.add(createContainerServiceDependency(containerName).setService(IClusterContainerServices.class)
- .setCallbacks("setClusterContainerService", "unsetClusterContainerService").setRequired(true));
}
}
<artifactId>mappingservice.northbound</artifactId>
<version>${lispflowmapping.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.lispflowmapping</groupId>
+ <artifactId>mappingservice.clusterdao</artifactId>
+ <version>${lispflowmapping.version}</version>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>containermanager</artifactId>
.versionAsInProject(), mavenBundle("geminiweb", "org.eclipse.virgo.util.parser.manifest").versionAsInProject(),
// Our bundles
- mavenBundle("org.opendaylight.controller", "clustering.stub").versionAsInProject(), mavenBundle("org.opendaylight.controller",
- "clustering.services").versionAsInProject(), mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(),
-
- mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.yangmodel").versionAsInProject(), mavenBundle(
- "org.opendaylight.lispflowmapping", "mappingservice.config").versionAsInProject(), mavenBundle(
- "org.opendaylight.lispflowmapping", "mappingservice.api").versionAsInProject(), mavenBundle(
- "org.opendaylight.lispflowmapping", "mappingservice.implementation").versionAsInProject(), //
+ mavenBundle("org.opendaylight.controller", "clustering.stub").versionAsInProject(), //
+ mavenBundle("org.opendaylight.controller", "clustering.services").versionAsInProject(), //
+ mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(), //
+ mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.yangmodel").versionAsInProject(), //
+ mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.config").versionAsInProject(), //
+ mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.api").versionAsInProject(), //
+ mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.implementation").versionAsInProject(), //
mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.southbound").versionAsInProject(), //
mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.northbound").versionAsInProject(), //
junitBundles());
}
+ public static Option mappingServiceBundlesWithClusterDAO() {
+ return new DefaultCompositeOption( //
+ mappingServiceBundles(), //
+ mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.clusterdao").versionAsInProject() //
+ );
+ }
+
}
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.opendaylight.lispflowmapping.implementation.dao.ClusterDAOService;
+import org.opendaylight.lispflowmapping.clusterdao.ClusterDAOService;
import org.opendaylight.lispflowmapping.implementation.serializer.LispMessage;
import org.opendaylight.lispflowmapping.implementation.serializer.MapNotifySerializer;
import org.opendaylight.lispflowmapping.implementation.serializer.MapRegisterSerializer;
// Configure the OSGi container
@Configuration
public Option[] config() {
- return options(MappingServiceTestHelper.mappingServiceBundles());
+ return options(MappingServiceTestHelper.mappingServiceBundlesWithClusterDAO());
}
@Test
<module>yangmodel</module>
<module>api</module>
<module>config</module>
+ <module>clusterdao</module>
<module>implementation</module>
<module>southbound</module>
<module>northbound</module>