Created onos-core-trivial as a place to put trivial implementation of core again…
…st which initial set of providers can be developed.
Showing
16 changed files
with
46 additions
and
19 deletions
... | @@ -32,7 +32,7 @@ | ... | @@ -32,7 +32,7 @@ |
32 | <feature name="onos-core" version="1.0.0" | 32 | <feature name="onos-core" version="1.0.0" |
33 | description="ONOS core components"> | 33 | description="ONOS core components"> |
34 | <feature>onos-api</feature> | 34 | <feature>onos-api</feature> |
35 | - <bundle>mvn:org.onlab.onos/onos-core/1.0.0-SNAPSHOT</bundle> | 35 | + <bundle>mvn:org.onlab.onos/onos-core-trivial/1.0.0-SNAPSHOT</bundle> |
36 | </feature> | 36 | </feature> |
37 | 37 | ||
38 | <feature name="onos-rest" version="1.0.0" | 38 | <feature name="onos-rest" version="1.0.0" | ... | ... |
... | @@ -38,10 +38,9 @@ public abstract class AbstractProviderBroker<P extends Provider, S extends Provi | ... | @@ -38,10 +38,9 @@ public abstract class AbstractProviderBroker<P extends Provider, S extends Provi |
38 | public synchronized void unregister(P provider) { | 38 | public synchronized void unregister(P provider) { |
39 | checkNotNull(provider, "Provider cannot be null"); | 39 | checkNotNull(provider, "Provider cannot be null"); |
40 | S service = services.get(provider); | 40 | S service = services.get(provider); |
41 | - checkArgument(service != null, "Provider %s not registered", provider.id()); | 41 | + if (service != null && service instanceof AbstractProviderService) { |
42 | - if (service instanceof AbstractProviderService) { | ||
43 | ((AbstractProviderService) service).invalidate(); | 42 | ((AbstractProviderService) service).invalidate(); |
44 | - } | ||
45 | services.remove(provider); | 43 | services.remove(provider); |
46 | } | 44 | } |
45 | + } | ||
47 | } | 46 | } | ... | ... |
... | @@ -13,6 +13,7 @@ public interface ProviderBroker<P extends Provider, S extends ProviderService<P> | ... | @@ -13,6 +13,7 @@ public interface ProviderBroker<P extends Provider, S extends ProviderService<P> |
13 | * | 13 | * |
14 | * @param provider provider to be registered | 14 | * @param provider provider to be registered |
15 | * @return provider service for injecting information into core | 15 | * @return provider service for injecting information into core |
16 | + * @throws java.lang.IllegalArgumentException if the provider is registered already | ||
16 | */ | 17 | */ |
17 | S register(P provider); | 18 | S register(P provider); |
18 | 19 | ||
... | @@ -20,6 +21,9 @@ public interface ProviderBroker<P extends Provider, S extends ProviderService<P> | ... | @@ -20,6 +21,9 @@ public interface ProviderBroker<P extends Provider, S extends ProviderService<P> |
20 | * Unregisters the supplied provider. As a result the previously issued | 21 | * Unregisters the supplied provider. As a result the previously issued |
21 | * provider service will be invalidated and any subsequent invocations | 22 | * provider service will be invalidated and any subsequent invocations |
22 | * of its methods may throw {@link java.lang.IllegalStateException}. | 23 | * of its methods may throw {@link java.lang.IllegalStateException}. |
24 | + * <p/> | ||
25 | + * Unregistering a provider that has not been previously registered results | ||
26 | + * in a no-op. | ||
23 | * | 27 | * |
24 | * @param provider provider to be unregistered | 28 | * @param provider provider to be unregistered |
25 | */ | 29 | */ | ... | ... |
... | @@ -12,10 +12,14 @@ | ... | @@ -12,10 +12,14 @@ |
12 | </parent> | 12 | </parent> |
13 | 13 | ||
14 | <artifactId>onos-core</artifactId> | 14 | <artifactId>onos-core</artifactId> |
15 | - <packaging>bundle</packaging> | 15 | + <packaging>pom</packaging> |
16 | 16 | ||
17 | <description>ONOS network control core subsystems</description> | 17 | <description>ONOS network control core subsystems</description> |
18 | 18 | ||
19 | + <modules> | ||
20 | + <module>trivial</module> | ||
21 | + </modules> | ||
22 | + | ||
19 | <dependencies> | 23 | <dependencies> |
20 | <dependency> | 24 | <dependency> |
21 | <groupId>org.onlab.onos</groupId> | 25 | <groupId>org.onlab.onos</groupId> | ... | ... |
net/core/trivial/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
5 | + <modelVersion>4.0.0</modelVersion> | ||
6 | + | ||
7 | + <parent> | ||
8 | + <groupId>org.onlab.onos</groupId> | ||
9 | + <artifactId>onos-core</artifactId> | ||
10 | + <version>1.0.0-SNAPSHOT</version> | ||
11 | + <relativePath>../pom.xml</relativePath> | ||
12 | + </parent> | ||
13 | + | ||
14 | + <artifactId>onos-core-trivial</artifactId> | ||
15 | + <packaging>bundle</packaging> | ||
16 | + | ||
17 | + <description>ONOS network control trivial implementations of core subsystems</description> | ||
18 | + | ||
19 | +</project> |
1 | -package org.onlab.onos.net.impl; | 1 | +package org.onlab.onos.net.trivial.impl; |
2 | 2 | ||
3 | import org.apache.felix.scr.annotations.Activate; | 3 | import org.apache.felix.scr.annotations.Activate; |
4 | import org.apache.felix.scr.annotations.Component; | 4 | import org.apache.felix.scr.annotations.Component; | ... | ... |
1 | -package org.onlab.onos.net.impl; | 1 | +package org.onlab.onos.net.trivial.impl; |
2 | 2 | ||
3 | import org.apache.felix.scr.annotations.Activate; | 3 | import org.apache.felix.scr.annotations.Activate; |
4 | import org.apache.felix.scr.annotations.Component; | 4 | import org.apache.felix.scr.annotations.Component; | ... | ... |
... | @@ -254,7 +254,7 @@ | ... | @@ -254,7 +254,7 @@ |
254 | <group> | 254 | <group> |
255 | <title>Core Subsystems</title> | 255 | <title>Core Subsystems</title> |
256 | <packages> | 256 | <packages> |
257 | - org.onlab.onos.net.impl:org.onlab.onos.net.*.impl | 257 | + org.onlab.onos.net.trivial.impl:org.onlab.onos.net.*.impl |
258 | </packages> | 258 | </packages> |
259 | </group> | 259 | </group> |
260 | <group> | 260 | <group> | ... | ... |
providers/of/device/src/main/java/org/onlab/onos/provider/of/device/impl/OpenFlowDeviceProvider.java
... | @@ -16,10 +16,10 @@ import org.slf4j.Logger; | ... | @@ -16,10 +16,10 @@ import org.slf4j.Logger; |
16 | import org.slf4j.LoggerFactory; | 16 | import org.slf4j.LoggerFactory; |
17 | 17 | ||
18 | /** | 18 | /** |
19 | - * Device provider which uses an OpenFlow controller to detect network | 19 | + * Provider which uses an OpenFlow controller to detect network |
20 | * infrastructure devices. | 20 | * infrastructure devices. |
21 | */ | 21 | */ |
22 | -@Component | 22 | +@Component(immediate = true) |
23 | public class OpenFlowDeviceProvider extends AbstractProvider implements DeviceProvider { | 23 | public class OpenFlowDeviceProvider extends AbstractProvider implements DeviceProvider { |
24 | 24 | ||
25 | private final Logger log = LoggerFactory.getLogger(OpenFlowDeviceProvider.class); | 25 | private final Logger log = LoggerFactory.getLogger(OpenFlowDeviceProvider.class); |
... | @@ -60,7 +60,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -60,7 +60,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
60 | 60 | ||
61 | @Override | 61 | @Override |
62 | public void roleChanged(Device device, MastershipRole newRole) { | 62 | public void roleChanged(Device device, MastershipRole newRole) { |
63 | - log.info("Accepting mastership role change fordevice {}", device.id()); | 63 | + log.info("Accepting mastership role change for device {}", device.id()); |
64 | } | 64 | } |
65 | 65 | ||
66 | } | 66 | } | ... | ... |
... | @@ -15,10 +15,10 @@ import org.slf4j.Logger; | ... | @@ -15,10 +15,10 @@ import org.slf4j.Logger; |
15 | import org.slf4j.LoggerFactory; | 15 | import org.slf4j.LoggerFactory; |
16 | 16 | ||
17 | /** | 17 | /** |
18 | - * Device provider which uses an OpenFlow controller to detect network | 18 | + * Provider which uses an OpenFlow controller to detect network |
19 | * end-station hosts. | 19 | * end-station hosts. |
20 | */ | 20 | */ |
21 | -@Component | 21 | +@Component(immediate = true) |
22 | public class OpenFlowHostProvider extends AbstractProvider implements HostProvider { | 22 | public class OpenFlowHostProvider extends AbstractProvider implements HostProvider { |
23 | 23 | ||
24 | private final Logger log = LoggerFactory.getLogger(OpenFlowHostProvider.class); | 24 | private final Logger log = LoggerFactory.getLogger(OpenFlowHostProvider.class); |
... | @@ -55,4 +55,5 @@ public class OpenFlowHostProvider extends AbstractProvider implements HostProvid | ... | @@ -55,4 +55,5 @@ public class OpenFlowHostProvider extends AbstractProvider implements HostProvid |
55 | public void triggerProbe(Host host) { | 55 | public void triggerProbe(Host host) { |
56 | log.info("Triggering probe on device {}", host); | 56 | log.info("Triggering probe on device {}", host); |
57 | } | 57 | } |
58 | + | ||
58 | } | 59 | } | ... | ... |
... | @@ -14,10 +14,10 @@ import org.slf4j.Logger; | ... | @@ -14,10 +14,10 @@ import org.slf4j.Logger; |
14 | import org.slf4j.LoggerFactory; | 14 | import org.slf4j.LoggerFactory; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | - * Device provider which uses an OpenFlow controller to detect network | 17 | + * Provider which uses an OpenFlow controller to detect network |
18 | * infrastructure links. | 18 | * infrastructure links. |
19 | */ | 19 | */ |
20 | -@Component | 20 | +@Component(immediate = true) |
21 | public class OpenFlowLinkProvider extends AbstractProvider implements LinkProvider { | 21 | public class OpenFlowLinkProvider extends AbstractProvider implements LinkProvider { |
22 | 22 | ||
23 | private final Logger log = LoggerFactory.getLogger(OpenFlowLinkProvider.class); | 23 | private final Logger log = LoggerFactory.getLogger(OpenFlowLinkProvider.class); | ... | ... |
... | @@ -19,7 +19,7 @@ | ... | @@ -19,7 +19,7 @@ |
19 | <dependencies> | 19 | <dependencies> |
20 | <dependency> | 20 | <dependency> |
21 | <groupId>org.onlab.onos</groupId> | 21 | <groupId>org.onlab.onos</groupId> |
22 | - <artifactId>onos-core</artifactId> | 22 | + <artifactId>onos-core-trivial</artifactId> |
23 | <version>1.0.0-SNAPSHOT</version> | 23 | <version>1.0.0-SNAPSHOT</version> |
24 | <scope>test</scope> | 24 | <scope>test</scope> |
25 | </dependency> | 25 | </dependency> | ... | ... |
... | @@ -5,7 +5,7 @@ import com.sun.jersey.test.framework.JerseyTest; | ... | @@ -5,7 +5,7 @@ import com.sun.jersey.test.framework.JerseyTest; |
5 | import org.junit.BeforeClass; | 5 | import org.junit.BeforeClass; |
6 | import org.junit.Test; | 6 | import org.junit.Test; |
7 | import org.onlab.onos.net.GreetService; | 7 | import org.onlab.onos.net.GreetService; |
8 | -import org.onlab.onos.net.impl.GreetManager; | 8 | +import org.onlab.onos.net.trivial.impl.GreetManager; |
9 | import org.onlab.osgi.ServiceDirectory; | 9 | import org.onlab.osgi.ServiceDirectory; |
10 | import org.onlab.osgi.TestServiceDirectory; | 10 | import org.onlab.osgi.TestServiceDirectory; |
11 | 11 | ... | ... |
-
Please register or login to post a comment