tom

Created onos-core-trivial as a place to put trivial implementation of core again…

…st which initial set of providers can be developed.
......@@ -32,7 +32,7 @@
<feature name="onos-core" version="1.0.0"
description="ONOS core components">
<feature>onos-api</feature>
<bundle>mvn:org.onlab.onos/onos-core/1.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.onlab.onos/onos-core-trivial/1.0.0-SNAPSHOT</bundle>
</feature>
<feature name="onos-rest" version="1.0.0"
......
......@@ -38,10 +38,9 @@ public abstract class AbstractProviderBroker<P extends Provider, S extends Provi
public synchronized void unregister(P provider) {
checkNotNull(provider, "Provider cannot be null");
S service = services.get(provider);
checkArgument(service != null, "Provider %s not registered", provider.id());
if (service instanceof AbstractProviderService) {
if (service != null && service instanceof AbstractProviderService) {
((AbstractProviderService) service).invalidate();
}
services.remove(provider);
}
}
}
......
......@@ -13,6 +13,7 @@ public interface ProviderBroker<P extends Provider, S extends ProviderService<P>
*
* @param provider provider to be registered
* @return provider service for injecting information into core
* @throws java.lang.IllegalArgumentException if the provider is registered already
*/
S register(P provider);
......@@ -20,6 +21,9 @@ public interface ProviderBroker<P extends Provider, S extends ProviderService<P>
* Unregisters the supplied provider. As a result the previously issued
* provider service will be invalidated and any subsequent invocations
* of its methods may throw {@link java.lang.IllegalStateException}.
* <p/>
* Unregistering a provider that has not been previously registered results
* in a no-op.
*
* @param provider provider to be unregistered
*/
......
......@@ -12,10 +12,14 @@
</parent>
<artifactId>onos-core</artifactId>
<packaging>bundle</packaging>
<packaging>pom</packaging>
<description>ONOS network control core subsystems</description>
<modules>
<module>trivial</module>
</modules>
<dependencies>
<dependency>
<groupId>org.onlab.onos</groupId>
......
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onlab.onos</groupId>
<artifactId>onos-core</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>onos-core-trivial</artifactId>
<packaging>bundle</packaging>
<description>ONOS network control trivial implementations of core subsystems</description>
</project>
package org.onlab.onos.net.impl;
package org.onlab.onos.net.trivial.impl;
import com.google.common.collect.ImmutableSet;
import org.apache.felix.scr.annotations.Activate;
......
package org.onlab.onos.net.impl;
package org.onlab.onos.net.trivial.impl;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
......
package org.onlab.onos.net.impl;
package org.onlab.onos.net.trivial.impl;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
......
package org.onlab.onos.net.impl;
package org.onlab.onos.net.trivial.impl;
import org.junit.Test;
import org.onlab.onos.net.GreetService;
......
......@@ -254,7 +254,7 @@
<group>
<title>Core Subsystems</title>
<packages>
org.onlab.onos.net.impl:org.onlab.onos.net.*.impl
org.onlab.onos.net.trivial.impl:org.onlab.onos.net.*.impl
</packages>
</group>
<group>
......
......@@ -16,10 +16,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Device provider which uses an OpenFlow controller to detect network
* Provider which uses an OpenFlow controller to detect network
* infrastructure devices.
*/
@Component
@Component(immediate = true)
public class OpenFlowDeviceProvider extends AbstractProvider implements DeviceProvider {
private final Logger log = LoggerFactory.getLogger(OpenFlowDeviceProvider.class);
......@@ -60,7 +60,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr
@Override
public void roleChanged(Device device, MastershipRole newRole) {
log.info("Accepting mastership role change fordevice {}", device.id());
log.info("Accepting mastership role change for device {}", device.id());
}
}
......
......@@ -15,10 +15,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Device provider which uses an OpenFlow controller to detect network
* Provider which uses an OpenFlow controller to detect network
* end-station hosts.
*/
@Component
@Component(immediate = true)
public class OpenFlowHostProvider extends AbstractProvider implements HostProvider {
private final Logger log = LoggerFactory.getLogger(OpenFlowHostProvider.class);
......@@ -55,4 +55,5 @@ public class OpenFlowHostProvider extends AbstractProvider implements HostProvid
public void triggerProbe(Host host) {
log.info("Triggering probe on device {}", host);
}
}
......
......@@ -14,10 +14,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Device provider which uses an OpenFlow controller to detect network
* Provider which uses an OpenFlow controller to detect network
* infrastructure links.
*/
@Component
@Component(immediate = true)
public class OpenFlowLinkProvider extends AbstractProvider implements LinkProvider {
private final Logger log = LoggerFactory.getLogger(OpenFlowLinkProvider.class);
......
......@@ -19,7 +19,7 @@
<dependencies>
<dependency>
<groupId>org.onlab.onos</groupId>
<artifactId>onos-core</artifactId>
<artifactId>onos-core-trivial</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
......
......@@ -5,7 +5,7 @@ import com.sun.jersey.test.framework.JerseyTest;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onlab.onos.net.GreetService;
import org.onlab.onos.net.impl.GreetManager;
import org.onlab.onos.net.trivial.impl.GreetManager;
import org.onlab.osgi.ServiceDirectory;
import org.onlab.osgi.TestServiceDirectory;
......