* Function that will be called when there is the event of
* coordinator change in the cluster.
*/
- public void coordinatorChanged();
+ void coordinatorChanged();
}
* active-standby milestone is reached, after will be removed.
*
*/
- public void newActiveAvailable();
+ void newActiveAvailable();
}
--- /dev/null
+/*
+ * Copyright (c) 2013 Cisco Systems, 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.controller.clustering.services_implementation.internal;
+
+import java.lang.ref.WeakReference;
+
+import org.jboss.marshalling.ContextClassResolver;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public final class ClassResolver extends ContextClassResolver {
+ private WeakReference<ClassLoader> osgiClassLoader = null;
+ private static final Logger logger = LoggerFactory.getLogger(ClassResolver.class);
+
+ public ClassResolver() {
+ ClassLoader cl = this.getClass()
+ .getClassLoader();
+ if (cl != null) {
+ this.osgiClassLoader = new WeakReference<ClassLoader>(cl);
+ logger.trace("Acquired weak reference to OSGi classLoader {}", cl);
+ }
+ }
+
+ @Override
+ protected ClassLoader getClassLoader() {
+ ClassLoader ret = null;
+ if (this.osgiClassLoader != null) {
+ ret = this.osgiClassLoader.get();
+ if (ret != null) {
+ if (logger.isTraceEnabled()) {
+ logger.trace("Returning OSGi class loader {}", ret);
+ }
+ return ret;
+ }
+ }
+
+ logger.warn("Could not resolve classloader!");
+ return ret;
+ }
+}
import org.infinispan.Cache;
import org.infinispan.configuration.cache.Configuration;
+import org.infinispan.configuration.global.GlobalConfigurationBuilder;
+import org.infinispan.configuration.parsing.ConfigurationBuilderHolder;
+import org.infinispan.configuration.parsing.ParserRegistry;
import org.infinispan.manager.DefaultCacheManager;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.notifications.Listener;
}
logger.info("Starting the ClusterManager");
try {
- //FIXME keeps throwing FileNotFoundException
- this.cm = new DefaultCacheManager("config/infinispan-config.xml");
+ ParserRegistry parser = new ParserRegistry(this.getClass()
+ .getClassLoader());
+ ConfigurationBuilderHolder holder = parser.parseFile("config/infinispan-config.xml");
+ GlobalConfigurationBuilder globalBuilder = holder.getGlobalConfigurationBuilder();
+ globalBuilder.serialization()
+ .classResolver(new ClassResolver())
+ .build();
+ this.cm = new DefaultCacheManager(holder, false);
logger.debug("Allocated ClusterManager");
if (this.cm != null) {
this.cm.start();
/**
* Trigger from configuration component to persist the configuration state.
*/
- public Status saveConfiguration();
+ Status saveConfiguration();
}
*
*/
public interface IConfigurationServiceCommon {
- public Status saveConfigurations();
+ Status saveConfigurations();
}
String controller = ci.nextArgument();
if (controller == null) {
ci.println("Nodes connected to this controller : ");
- if (this.getLocalNodes() == null) ci.println("None");
- else ci.println(this.getLocalNodes().toString());
+ if (this.getLocalNodes() == null) {
+ ci.println("None");
+ } else {
+ ci.println(this.getLocalNodes().toString());
+ }
return;
}
try {
InetAddress address = InetAddress.getByName(controller);
ci.println("Nodes connected to controller "+controller);
- if (this.getNodes(address) == null) ci.println("None");
- else ci.println(this.getNodes(address).toString());
- return;
+ if (this.getNodes(address) == null) {
+ ci.println("None");
+ } else {
+ ci.println(this.getNodes(address).toString());
+ }
} catch (UnknownHostException e) {
logger.error("An error occured",e);
}
* @param ipAddress (InetAddress) the IP address
* @return StaticRoute
*/
- public StaticRoute getBestMatchStaticRoute(InetAddress ipAddress);
+ StaticRoute getBestMatchStaticRoute(InetAddress ipAddress);
/**
* Returns all the StaticRouteConfig
* @return all the StaticRouteConfig
*/
- public ConcurrentMap<String, StaticRouteConfig> getStaticRouteConfigs();
+ ConcurrentMap<String, StaticRouteConfig> getStaticRouteConfigs();
/**
* Adds a StaticRouteConfig
* @return a text string indicating the result of the operation..
* If the operation is successful, the return string will be "SUCCESS"
*/
- public Status addStaticRoute(StaticRouteConfig config);
+ Status addStaticRoute(StaticRouteConfig config);
/**
* Removes the named StaticRouteConfig
* @return a text string indicating the result of the operation.
* If the operation is successful, the return string will be "SUCCESS"
*/
- public Status removeStaticRoute(String name);
+ Status removeStaticRoute(String name);
}
* @param s: StaticRoute
* @param added: boolean true if the static route is added,
*/
- public void staticRouteUpdate(StaticRoute s, boolean added);
+ void staticRouteUpdate(StaticRoute s, boolean added);
}
* New PortGroupConfig object created by user Configuration.
* @return true if successful. false otherwise.
*/
- public boolean createPortGroupConfig(PortGroupConfig config);
+ boolean createPortGroupConfig(PortGroupConfig config);
/**
* This method is invoked by the Controller towards the Provider when an
* Existing Port Group Configuration deleted by the user.
* @return true if successful. false otherwise.
*/
- public boolean deletePortGroupConfig(PortGroupConfig config);
+ boolean deletePortGroupConfig(PortGroupConfig config);
/**
* Returns the complete mapping database corresponds to a PortGroup
* @return Database of Switch-Id to PortGroup mapping that corresponds to
* the Port Group User Configuration.
*/
- public Map<Node, PortGroup> getPortGroupData(PortGroupConfig config);
+ Map<Node, PortGroup> getPortGroupData(PortGroupConfig config);
/**
* Returns PortGroup data for a given Switch and user Configuration. Its the
* @return PortGroup data for a given Openflow switch.
* @see PortGroup
*/
- public PortGroup getPortGroupData(PortGroupConfig config, long matrixSwitchId);
+ PortGroup getPortGroupData(PortGroupConfig config, long matrixSwitchId);
/**
* Registers a Listener for Port Group membership changes based on Custom
* A Controller module that listens to events from the Custom
* Port Grouping Application.
*/
- public void registerPortGroupChange(PortGroupChangeListener listener);
+ void registerPortGroupChange(PortGroupChangeListener listener);
/**
* Application returns an Usage string for the Match Criteria User
*
* @return Usage string.
*/
- public String getApplicationDrivenMatchCriteriaUsage();
+ String getApplicationDrivenMatchCriteriaUsage();
/**
* Returns the name of the Custom Application that implements
*
* @return Provider Name
*/
- public String getProviderName();
+ String getProviderName();
/**
* Controller uses this method to check with the Provider supports the
* @return true if the Provider supports the matchCriteria String. false
* otherwise.
*/
- public boolean isMatchCriteriaSupported(String matchCriteria);
+ boolean isMatchCriteriaSupported(String matchCriteria);
}
@Override
public int compareTo(Entity o) {
int r;
- if (port == null)
+ if (port == null) {
r = o.port == null ? 0 : -1;
- else if (o.port == null)
+ }
+ else if (o.port == null) {
r = 1;
+ }
else {
// XXX - the node id is only defined as an object rather
// than something useful. We're just going to have to
* @param newEntity
* the entity to add. newEntity must be have the same entity
* class as device
- * @param if positive indicates the index in the entities array were the new
+ * @param insertionpoint
+ * if positive indicates the index in the entities array were the new
* entity should be inserted. If negative we will compute the correct
* insertion point
*/
TreeSet<Short> vals = new TreeSet<Short>();
for (Entity e : entities) {
- if (e.getVlan() == null)
+ if (e.getVlan() == null) {
vals.add((short) -1);
- else
+ } else {
vals.add(e.getVlan());
+ }
}
return vals.toArray(new Short[vals.size()]);
}
return false;
for (AttachmentPoint ap : apList) {
- if (ap.getLastSeen() + AttachmentPoint.INACTIVITY_INTERVAL < System
- .currentTimeMillis())
- expiredAPs.add(ap);
+ if (ap.getLastSeen() + AttachmentPoint.INACTIVITY_INTERVAL < System.currentTimeMillis()) {
+ expiredAPs.add(ap);
+ }
}
if (expiredAPs.size() > 0) {
apList.removeAll(expiredAPs);
return true;
- } else
+ } else {
return false;
+ }
}
/**
* any change to the list of attachment points for the device -- which
* indicates a device move.
*
- * @param sw
* @param port
* @param lastSeen
* @return
/**
* Delete (sw,port) from the list of list of attachment points and oldAPs.
*
- * @param sw
* @param port
* @return
*/
TreeSet<Short> vals = new TreeSet<Short>();
for (Entity e : entities) {
if (e.getPort().equals(swp.getPort())) {
- if (e.getVlan() == null)
+ if (e.getVlan() == null) {
vals.add(VLAN_UNTAGGED);
- else
+ }
+ else {
vals.add(e.getVlan());
+ }
}
}
return vals.toArray(new Short[vals.size()]);
long newDomain = 0;
boolean newBD = false;
- if (oldDomain < newDomain)
- return -1;
- else if (oldDomain > newDomain)
+ if (oldDomain < newDomain) {
+ return -1;
+ } else if (oldDomain > newDomain) {
return 1;
-
+ }
// Give preference to OFPP_LOCAL always
if (!oldAP.getPort().getType().equals(NodeConnectorIDType.SWSTACK)
&& newAP.getPort().getType()
}
public boolean isSubnetOf(InetAddress ip) {
- if (ip == null)
+ if (ip == null) {
return false;
+ }
InetAddress thisPrefix = getPrefixForAddress(this.networkAddress);
InetAddress otherPrefix = getPrefixForAddress(ip);
- if ((thisPrefix == null) || (otherPrefix == null))
+ if ((thisPrefix == null) || (otherPrefix == null)) {
return false;
- if (thisPrefix.equals(otherPrefix))
+ }
+ if (thisPrefix.equals(otherPrefix)) {
return true;
- else
+ }
+ else {
return false;
+ }
}
public short getVlan() {
// OVS apparently sends partial messages in errors
// need to be careful of that AND can't use data.limit() as
// a packet boundary because there could be more data queued
- if (messages.size() > 0)
+ if (messages.size() > 0) {
return messages.get(0);
- else
+ } else {
return null;
+ }
}
/**
public void setNextHop(InetAddress address) {
short actionLen;
- if (address instanceof Inet4Address)
- actionLen = (short)ONHLength.ONH_LEN_IPV4.getValue();
- else
- actionLen = (short)ONHLength.ONH_LEN_IPV6.getValue();
- super.setLength(actionLen);
+ if (address instanceof Inet4Address) {
+ actionLen = (short)ONHLength.ONH_LEN_IPV4.getValue();
+ } else {
+ actionLen = (short)ONHLength.ONH_LEN_IPV6.getValue();
+ }
+ super.setLength(actionLen);
this.address = address;
}
public InetAddress getNextHop() {