tom

Added more trivial core implementations.

......@@ -14,7 +14,7 @@ public interface HostProvider extends Provider {
* Triggers an asynchronous probe of the specified host, intended to
* determine whether the host is present or not. An indirect result of this
* should be invocation of {@link org.onlab.onos.net.host.HostProviderService#hostDetected(HostDescription)} or
* {@link org.onlab.onos.net.host.HostProviderService#hostNotDetected(HostDescription)}
* {@link org.onlab.onos.net.host.HostProviderService#hostVanished(HostDescription)}
* at some later point in time.
*
* @param host host to probe
......
......@@ -20,6 +20,6 @@ public interface HostProviderService extends ProviderService<HostProvider> {
*
* @param hostDescription description of host
*/
void hostNotDetected(HostDescription hostDescription);
void hostVanished(HostDescription hostDescription);
}
......
......@@ -8,17 +8,17 @@ import org.onlab.onos.net.provider.ProviderService;
public interface LinkProviderService extends ProviderService<LinkProvider> {
/**
* Signals that an infrastructure link has been connected.
* Signals that an infrastructure link has been detected.
*
* @param linkDescription link information
*/
void linkConnected(LinkDescription linkDescription);
void linkDetected(LinkDescription linkDescription);
/**
* Signals that an infrastructure link has been disconnected.
* Signals that an infrastructure link has disappeared.
*
* @param linkDescription link information
*/
void linkDisconnected(LinkDescription linkDescription);
void linkVanished(LinkDescription linkDescription);
}
......
package org.onlab.onos.net.trivial.impl;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Service;
import org.onlab.onos.net.host.HostDescription;
import org.onlab.onos.net.host.HostProvider;
import org.onlab.onos.net.host.HostProviderBroker;
import org.onlab.onos.net.host.HostProviderService;
import org.onlab.onos.net.provider.AbstractProviderBroker;
import org.onlab.onos.net.provider.AbstractProviderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Provides basic implementation of the host SB &amp; NB APIs.
*/
@Component(immediate = true)
@Service
public class SimpleHostManager implements HostProviderBroker {
private Logger log = LoggerFactory.getLogger(SimpleHostManager.class);
private final HostProviderBroker broker = new InternalBroker();
@Activate
public void activate() {
log.info("Started");
}
@Deactivate
public void deactivate() {
log.info("Stopped");
}
@Override
public HostProviderService register(HostProvider provider) {
log.info("Registering provider {}", provider.id());
return broker.register(provider);
}
@Override
public void unregister(HostProvider provider) {
log.info("Unregistering provider {}", provider.id());
broker.unregister(provider);
}
// Internal delegate for tracking various providers and issuing them a
// personalized provider service.
private class InternalBroker extends AbstractProviderBroker<HostProvider, HostProviderService>
implements HostProviderBroker {
@Override
protected HostProviderService createProviderService(HostProvider provider) {
return new InternalHostProviderService(provider);
}
}
// Personalized host provider service issued to the supplied provider.
private class InternalHostProviderService extends AbstractProviderService<HostProvider>
implements HostProviderService {
public InternalHostProviderService(HostProvider provider) {
super(provider);
}
@Override
public void hostDetected(HostDescription hostDescription) {
log.info("Host {} detected", hostDescription);
}
@Override
public void hostVanished(HostDescription hostDescription) {
log.info("Host {} vanished", hostDescription);
}
}
}
package org.onlab.onos.net.trivial.impl;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Service;
import org.onlab.onos.net.link.LinkDescription;
import org.onlab.onos.net.link.LinkProvider;
import org.onlab.onos.net.link.LinkProviderBroker;
import org.onlab.onos.net.link.LinkProviderService;
import org.onlab.onos.net.provider.AbstractProviderBroker;
import org.onlab.onos.net.provider.AbstractProviderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Provides basic implementation of the link SB &amp; NB APIs.
*/
@Component(immediate = true)
@Service
public class SimpleLinkManager implements LinkProviderBroker {
private Logger log = LoggerFactory.getLogger(SimpleLinkManager.class);
private final LinkProviderBroker broker = new InternalBroker();
@Activate
public void activate() {
log.info("Started");
}
@Deactivate
public void deactivate() {
log.info("Stopped");
}
@Override
public LinkProviderService register(LinkProvider provider) {
log.info("Registering provider {}", provider.id());
return broker.register(provider);
}
@Override
public void unregister(LinkProvider provider) {
log.info("Unregistering provider {}", provider.id());
broker.unregister(provider);
}
// Internal delegate for tracking various providers and issuing them a
// personalized provider service.
private class InternalBroker extends AbstractProviderBroker<LinkProvider, LinkProviderService>
implements LinkProviderBroker {
@Override
protected LinkProviderService createProviderService(LinkProvider provider) {
return new InternalLinkProviderService(provider);
}
}
// Personalized link provider service issued to the supplied provider.
private class InternalLinkProviderService extends AbstractProviderService<LinkProvider>
implements LinkProviderService {
public InternalLinkProviderService(LinkProvider provider) {
super(provider);
}
@Override
public void linkDetected(LinkDescription linkDescription) {
log.info("Link {} detected", linkDescription);
}
@Override
public void linkVanished(LinkDescription linkDescription) {
log.info("Link {} vanished", linkDescription);
}
}
}