OSGi property annotations for remaining apps
Change-Id: I5f87ebeb65eb85ee7161e35a838d9275fde22787
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java
index bb74d77..a484d66 100644
--- a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalCircuitIntentCompiler.java
@@ -82,21 +82,24 @@
import static com.google.common.base.Preconditions.checkArgument;
import static org.onosproject.net.optical.device.OpticalDeviceServiceView.opticalView;
+import static org.onosproject.net.optical.intent.impl.compiler.OsgiPropertyConstants.MAX_CAPACITY;
+import static org.onosproject.net.optical.intent.impl.compiler.OsgiPropertyConstants.MAX_CAPACITY_DEFAULT;
/**
* An intent compiler for {@link org.onosproject.net.intent.OpticalCircuitIntent}.
*/
-@Component(immediate = true)
+@Component(
+ immediate = true,
+ property = {
+ MAX_CAPACITY + ":Integer=" + MAX_CAPACITY_DEFAULT
+ }
+)
public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircuitIntent> {
private static final Logger log = LoggerFactory.getLogger(OpticalCircuitIntentCompiler.class);
- private static final int DEFAULT_MAX_CAPACITY = 10;
-
- //@Property(name = "maxCapacity", intValue = DEFAULT_MAX_CAPACITY,
- // label = "Maximum utilization of an optical connection.")
-
- private int maxCapacity = DEFAULT_MAX_CAPACITY;
+ /** Maximum utilization of an optical connection. */
+ private int maxCapacity = MAX_CAPACITY_DEFAULT;
@Reference(cardinality = ReferenceCardinality.MANDATORY)
protected ComponentConfigService cfgService;
@@ -133,7 +136,7 @@
Dictionary properties = context.getProperties();
//TODO for reduction check if the new capacity is smaller than the size of the current mapping
- String propertyString = Tools.get(properties, "maxCapacity");
+ String propertyString = Tools.get(properties, MAX_CAPACITY);
//Ignore if propertyString is empty or null
if (!Strings.isNullOrEmpty(propertyString)) {
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OsgiPropertyConstants.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OsgiPropertyConstants.java
new file mode 100644
index 0000000..5eb77e7
--- /dev/null
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OsgiPropertyConstants.java
@@ -0,0 +1,25 @@
+/*
+ * 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.net.optical.intent.impl.compiler;
+
+public final class OsgiPropertyConstants {
+ private OsgiPropertyConstants() {
+ }
+
+ static final String MAX_CAPACITY = "maxCapacity";
+ static final int MAX_CAPACITY_DEFAULT = 10;
+}