OSGi property annotations for remaining apps
Change-Id: I5f87ebeb65eb85ee7161e35a838d9275fde22787
diff --git a/apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/ControlPlaneRedirectManager.java b/apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/ControlPlaneRedirectManager.java
index 679d33e..0d7adf5 100644
--- a/apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/ControlPlaneRedirectManager.java
+++ b/apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/ControlPlaneRedirectManager.java
@@ -79,13 +79,20 @@
import static org.onlab.packet.IPv6.PROTOCOL_ICMP6;
import static org.onlab.packet.IPv6.getLinkLocalAddress;
import static org.onlab.packet.IPv6.getSolicitNodeAddress;
+import static org.onosproject.routing.cpr.OsgiPropertyConstants.FORCE_UNPROVISION;
+import static org.onosproject.routing.cpr.OsgiPropertyConstants.FORCE_UNPROVISION_DEFAULT;
import static org.slf4j.LoggerFactory.getLogger;
/**
* Manages connectivity between peers redirecting control traffic to a routing
* control plane available on the dataplane.
*/
-@Component(immediate = true)
+@Component(
+ immediate = true,
+ property = {
+ FORCE_UNPROVISION + ":Boolean=" + FORCE_UNPROVISION_DEFAULT
+ }
+)
public class ControlPlaneRedirectManager {
private final Logger log = getLogger(getClass());
@@ -125,9 +132,8 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected ComponentConfigService cfgService;
- //@Property(name = "forceUnprovision", boolValue = false,
- // label = "Force unprovision when the device goes offline")
- private boolean forceUnprovision = false;
+ /** Force unprovision when the device goes offline. */
+ private boolean forceUnprovision = FORCE_UNPROVISION_DEFAULT;
private static final String APP_NAME = "org.onosproject.cpr";
private ApplicationId appId;
@@ -175,7 +181,7 @@
Dictionary<?, ?> properties = context.getProperties();
Boolean flag;
- flag = Tools.isPropertyEnabled(properties, "forceUnprovision");
+ flag = Tools.isPropertyEnabled(properties, FORCE_UNPROVISION);
if (flag == null) {
log.info("ForceUnprovision is not configured, " +
"using current value of {}", forceUnprovision);
diff --git a/apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/OsgiPropertyConstants.java b/apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/OsgiPropertyConstants.java
new file mode 100644
index 0000000..86e2f35
--- /dev/null
+++ b/apps/routing/cpr/src/main/java/org/onosproject/routing/cpr/OsgiPropertyConstants.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.routing.cpr;
+
+/**
+ * Name/Value constants for properties.
+ */
+public final class OsgiPropertyConstants {
+ private OsgiPropertyConstants() {
+ }
+
+ static final String FORCE_UNPROVISION = "forceUnprovision";
+ static final boolean FORCE_UNPROVISION_DEFAULT = false;
+}