<artifactId>jakarta.annotation-api</artifactId>
<optional>true</optional>
</dependency>
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>openflowplugin-api</artifactId>
<artifactId>org.osgi.service.component.annotations</artifactId>
</dependency>
- <!-- FIXME: migrate commands and clean up these two dependencies -->
- <dependency>
- <groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.console</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.framework</artifactId>
- </dependency>
-
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-binding-test-utils</artifactId>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Private-Package>org.opendaylight.openflowplugin.applications.reconciliation.impl</Private-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-services-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
<scm>
<connection>scm:git:ssh://git.opendaylight.org:29418/openflowplugin.git</connection>
<developerConnection>scm:git:ssh://git.opendaylight.org:29418/openflowplugin.git</developerConnection>
*/
package org.opendaylight.openflowplugin.applications.reconciliation.cli;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
import org.apache.karaf.shell.api.action.lifecycle.Reference;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
import org.opendaylight.openflowplugin.applications.reconciliation.ReconciliationManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* CLI to display the service priority, service name and service status
* FIXME: service status
*/
+@Service
@Command(scope = "reconciliation", name = "getRegisteredServices",
- description = "displaying services registered to Reconciliation Framework")
-public class GetRegisteredServices extends OsgiCommandSupport {
+ description = "displaying services registered to Reconciliation Framework")
+public class GetRegisteredServices implements Action {
private static final Logger LOG = LoggerFactory.getLogger(GetRegisteredServices.class);
- private static final String CLI_FORMAT = "%d %-20s ";
@Reference
- ReconciliationManager reconciliationManager;
+ private ReconciliationManager reconciliationManager;
@Override
- protected Object doExecute() {
+ @SuppressWarnings("checkstyle:RegexpSinglelineJava")
+ public Object execute() {
LOG.debug("Executing getRegisteredServices to Reconciliation Framework command");
if (reconciliationManager.getRegisteredServices().isEmpty()) {
- session.getConsole().println("No Services have registered to Reconciliation Framework");
+ System.out.println("No Services have registered to Reconciliation Framework");
} else {
- for (var services : reconciliationManager.getRegisteredServices() .values()) {
+ for (var services : reconciliationManager.getRegisteredServices().values()) {
for (var service : services) {
- session.getConsole().println(String.format(CLI_FORMAT, service.getPriority(), service.getName()));
+ System.out.println(String.format("%d %-20s ", service.getPriority(), service.getName()));
}
}
}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
- odl:use-default-for-reference-types="true">
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
- <command>
- <action class="org.opendaylight.openflowplugin.applications.reconciliation.cli.GetRegisteredServices"/>
- </command>
- </command-bundle>
-</blueprint>