diff options
Diffstat (limited to 'sdnr/wt/websocketmanager2/provider/src')
3 files changed, 21 insertions, 34 deletions
diff --git a/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManagerProvider.java b/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManagerProvider.java index 2c54d2a78..881ee1a82 100644 --- a/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManagerProvider.java +++ b/sdnr/wt/websocketmanager2/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/websocketmanager2/WebSocketManagerProvider.java @@ -17,16 +17,22 @@ ******************************************************************************/ package org.onap.ccsdk.features.sdnr.wt.websocketmanager2; +import com.google.common.util.concurrent.ListenableFuture; import javax.servlet.ServletException; import org.opendaylight.mdsal.binding.api.RpcProviderService; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketEventInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketEventOutput; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketmanagerService; import org.opendaylight.yangtools.concepts.ObjectRegistration; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.opendaylight.yangtools.yang.common.RpcResultBuilder; +import org.opendaylight.yangtools.yang.common.RpcError.ErrorType; import org.osgi.service.http.HttpService; import org.osgi.service.http.NamespaceException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class WebSocketManagerProvider extends Blueprint { +public class WebSocketManagerProvider extends Blueprint implements WebsocketmanagerService { private static final Logger LOG = LoggerFactory.getLogger(WebSocketManagerProvider.class); private static final String APPLICATION_NAME = WebSocketManagerProvider.class.getName(); @@ -97,4 +103,14 @@ public class WebSocketManagerProvider extends Blueprint { public void setWsServlet(WebSocketManager wsServlet) { this.wsServlet = wsServlet; } + + @Override + public ListenableFuture<RpcResult<WebsocketEventOutput>> websocketEvent(WebsocketEventInput input) { + if (wsServlet != null) { + return wsServlet.websocketEvent(input); + } else { + RpcResultBuilder<WebsocketEventOutput> result = RpcResultBuilder.failed(); + return result.withError(ErrorType.APPLICATION, "Not intialized").buildFuture(); + } + } } diff --git a/sdnr/wt/websocketmanager2/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml b/sdnr/wt/websocketmanager2/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml deleted file mode 100644 index 5e95b7b74..000000000 --- a/sdnr/wt/websocketmanager2/provider/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ============LICENSE_START======================================================================== - ONAP : ccsdk feature sdnr wt - ================================================================================================= - Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - ================================================================================================= - 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. - ============LICENSE_END========================================================================== ---> -<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"> - - <reference id="rpcProviderRegistry" interface="org.opendaylight.mdsal.binding.api.RpcProviderService" odl:type="default" /> - - <bean id="provider" class="org.onap.ccsdk.features.sdnr.wt.websocketmanager2.WebSocketManagerProvider" init-method="init" destroy-method="close"> - <property name="rpcProviderRegistry" ref="rpcProviderRegistry" /> - </bean> - - <reference id="onBindService" availability="mandatory" activation="eager" interface="org.osgi.service.http.HttpService"> - <reference-listener ref="provider" bind-method="onBindService" unbind-method="onUnbindService" /> - </reference> - -</blueprint> diff --git a/sdnr/wt/websocketmanager2/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/sdnr/wt/websocketmanager2/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml index 5e95b7b74..32b19a646 100644 --- a/sdnr/wt/websocketmanager2/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml +++ b/sdnr/wt/websocketmanager2/provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml @@ -30,4 +30,8 @@ <reference-listener ref="provider" bind-method="onBindService" unbind-method="onUnbindService" /> </reference> + <service id="registerWebsocketmanagerService" + interface="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketmanagerService" + ref="provider" /> + </blueprint> |