summaryrefslogtreecommitdiffstats
path: root/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager')
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/api/pom.xml23
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/api/src/main/yang/websocketmanager.yang38
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/pom.xml90
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/config/default-config.xml31
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/WebsocketImpl.java83
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/WebsocketmanagerProvider.java155
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/dto/UserDto.java70
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/utils/AkkaConfig.java144
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/utils/Utils.java31
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/websocket/SyncWebSocketClient.java77
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/websocket/WebSocketServerHandler.java238
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/websocket/WebSocketServerInitializer.java25
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/websocketmanager/impl/rev141210/WebsocketmanagerModule.java39
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/websocketmanager/impl/rev141210/WebsocketmanagerModuleFactory.java13
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/test/AkkaConfigTest.java22
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/test/WebsocketClientTest.java29
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/yang/websocketmanager-impl.yang38
-rw-r--r--sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/pom.xml50
18 files changed, 0 insertions, 1196 deletions
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/api/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/api/pom.xml
deleted file mode 100644
index 217f02d8..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/api/pom.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright (c) 2015 Wipro Ltd. All rights reserved. This program and
- the accompanying materials are made available under the terms of the Eclipse
- Public License v1.0 which accompanies this distribution, and is available
- at http://www.eclipse.org/legal/epl-v10.html INTERNAL -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.opendaylight.mwtn</groupId>
- <artifactId>config-parent</artifactId>
- <version>0.5.1-SNAPSHOT</version>
- <relativePath>../../commons/config-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>websocketmanager-api</artifactId>
- <packaging>bundle</packaging>
-
- <properties>
- <maven.javadoc.skip>true</maven.javadoc.skip>
- </properties>
-</project>
-
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/api/src/main/yang/websocketmanager.yang b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/api/src/main/yang/websocketmanager.yang
deleted file mode 100644
index dd029783..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/api/src/main/yang/websocketmanager.yang
+++ /dev/null
@@ -1,38 +0,0 @@
-module websocketmanager {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:websocketmanager";
- prefix "websocketmanager";
-
- revision "2015-01-05" {
- description "Initial revision of websocketmanager model";
- }
-
- rpc websocket-event {
- input {
- leaf nodeName {
- type string;
- }
-
- leaf eventType {
- type string;
- }
-
- leaf xmlEvent {
- type string;
- }
- }
- output {
- leaf response {
- type string;
- }
- }
- }
-
- notification messagePushed {
- leaf message {
- type string;
- }
-
- }
-}
-
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/pom.xml
deleted file mode 100644
index 4bb69014..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/pom.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright (c) 2015 Wipro Ltd. All rights reserved. This program and
- the accompanying materials are made available under the terms of the Eclipse
- Public License v1.0 which accompanies this distribution, and is available
- at http://www.eclipse.org/legal/epl-v10.html INTERNAL -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <parent>
- <groupId>org.opendaylight.mwtn</groupId>
- <artifactId>config-parent</artifactId>
- <version>0.5.1-SNAPSHOT</version>
- <relativePath>../../commons/config-parent</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>websocketmanager-impl</artifactId>
- <packaging>bundle</packaging>
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>websocketmanager-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-transport</artifactId>
- </dependency>
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>${netty.version}</version>
- </dependency>
- <dependency>
- <groupId>org.json</groupId>
- <artifactId>json</artifactId>
- </dependency>
- <dependency>
- <groupId>com.typesafe.akka</groupId>
- <artifactId>akka-actor_2.11</artifactId>
- </dependency>
- <dependency>
- <groupId>com.typesafe.akka</groupId>
- <artifactId>akka-cluster_2.11</artifactId>
- </dependency>
- <dependency>
- <groupId>org.java-websocket</groupId>
- <artifactId>Java-WebSocket</artifactId>
- <version>1.3.8</version>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Import-Package>
- com.github.mustachejava;resolution:=optional,
- com.sun.jna.*;resolution:=optional,
- com.vividsolutions.jts.*;resolution:=optional,
- org.apache.log4j.helpers;resolution:=optional,
- org.noggit;resolution:=optional,
- org.apache.commons.jexl2;resolution:=optional,
- org.apache.commons.jxpath.*;resolution:=optional,
- org.apache.commons.vfs2.*;resolution:=optional,
- org.apache.commons.commons-codec;resolution:=optional,
- org.apache.xml.resolver.*;resolution:=optional,
- org.apache.log;resolution:=optional,
- *;resolution:=optional
- </Import-Package>
- <Embed-Dependency>Java-WebSocket</Embed-Dependency>
- <Include-Resource>{maven-resources},{maven-dependencies},META-INF/git.properties=-target/classes/META-INF/git.properties</Include-Resource>
- <Embed-Transitive>true</Embed-Transitive>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
-
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/config/default-config.xml b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/config/default-config.xml
deleted file mode 100644
index 33cf8e2b..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/config/default-config.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- vi: set et smarttab sw=4 tabstop=4: -->
-<!--
-Copyright © 2016 Wipro technologies and others. All rights reserved.
-
-This program and the accompanying materials are made available under the
-terms of the Eclipse Public License v1.0 which accompanies this distribution,
-and is available at http://www.eclipse.org/legal/epl-v10.html
--->
-<snapshot>
- <required-capabilities>
- <capability>urn:opendaylight:params:xml:ns:yang:websocketmanager:impl?module=websocketmanager-impl&amp;revision=2014-12-10</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
- </required-capabilities>
- <configuration>
-
- <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
- <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
- <module>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:websocketmanager:impl">prefix:websocketmanager</type>
- <name>websocketmanager-default</name>
- <broker>
- <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
- <name>binding-osgi-broker</name>
- </broker>
- </module>
- </modules>
- </data>
- </configuration>
-</snapshot>
-
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/WebsocketImpl.java b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/WebsocketImpl.java
deleted file mode 100644
index 0a748561..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/WebsocketImpl.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-* Copyright (c) 2016 Wipro Ltd. and others. All rights reserved.
-*
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0 which accompanies this distribution,
-* and is available at http://www.eclipse.org/legal/epl-v10.html
-*/
-
-package org.opendaylight.mwtn.impl;
-
-import java.util.concurrent.Future;
-
-import org.json.JSONObject;
-import org.opendaylight.mwtn.impl.websocket.WebSocketServerHandler;
-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.WebsocketEventOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketmanagerService;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class WebsocketImpl implements WebsocketmanagerService {
-
- public interface EventInputCallback
- {
- void onMessagePushed(final String message) throws Exception;
- }
- private static final Logger LOG = LoggerFactory.getLogger(WebsocketImpl.class);
-
- private final EventInputCallback cb;
-
- public WebsocketImpl()
- {
- this(null);
- }
- public WebsocketImpl(EventInputCallback callback)
- {
- this.cb=callback;
- }
- @Override
- public Future<RpcResult<WebsocketEventOutput>> websocketEvent(WebsocketEventInput input) {
- LOG.debug("Send message '{}'", input);
- try {
- WebsocketEventOutputBuilder outputBuilder = new WebsocketEventOutputBuilder();
- final String s=input.getXmlEvent();
- WebSocketServerHandler.sendMessage(input.getNodeName(), input.getEventType(),s );
- outputBuilder.setResponse("OK");
- if(this.cb!=null)
- try {
- JSONObject o=new JSONObject();
- o.put(WebSocketServerHandler.KEY_NODENAME, input.getNodeName());
- o.put(WebSocketServerHandler.KEY_EVENTTYPE, input.getEventType());
- o.put(WebSocketServerHandler.KEY_XMLEVENT, input.getXmlEvent());
- this.cb.onMessagePushed(o.toString());
- }
- catch(Exception err)
- {
- LOG.warn("problem pushing messsage to other nodes: "+err.getMessage());
- }
- return RpcResultBuilder.success(outputBuilder.build()).buildFuture();
- } catch (Exception e) {
- LOG.warn("Socketproblem: {}", e);
- }
- return null;
- }
-
-
- /*
- public void websocketSend(String message) {
- LOG.debug("Send message '{}'", message);
- try {
- WebsocketEventOutputBuilder outputBuilder = new WebsocketEventOutputBuilder();
- WebSocketServerHandler.sendMessage(message);
- outputBuilder.setResponse("OK");
-
- } catch (Exception e) {
- LOG.warn("Socketproblem: {}", e);
- }
- }
- */
-}
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/WebsocketmanagerProvider.java b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/WebsocketmanagerProvider.java
deleted file mode 100644
index 31ac9544..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/WebsocketmanagerProvider.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
-* Copyright (c) 2016 Wipro Ltd. and others. All rights reserved.
-*
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0 which accompanies this distribution,
-* and is available at http://www.eclipse.org/legal/epl-v10.html
-*/
-
-package org.opendaylight.mwtn.impl;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.mwtn.impl.WebsocketImpl.EventInputCallback;
-import org.opendaylight.mwtn.impl.utils.AkkaConfig;
-import org.opendaylight.mwtn.impl.utils.AkkaConfig.ClusterConfig;
-import org.opendaylight.mwtn.impl.utils.AkkaConfig.ClusterNodeInfo;
-import org.opendaylight.mwtn.impl.websocket.SyncWebSocketClient;
-import org.opendaylight.mwtn.impl.websocket.WebSocketServerInitializer;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.rev150105.WebsocketmanagerService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import io.netty.bootstrap.ServerBootstrap;
-import io.netty.channel.Channel;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.channel.socket.nio.NioServerSocketChannel;
-
-public class WebsocketmanagerProvider implements BindingAwareProvider, AutoCloseable, Runnable {
-
- private static final Logger LOG = LoggerFactory.getLogger(WebsocketmanagerProvider.class);
- private static final int PORT = 8085;
-
- private Thread webserverThread;
- private final ServerBootstrap bootstrap = new ServerBootstrap();
- private final EventLoopGroup bossGroup = new NioEventLoopGroup();
- private final EventLoopGroup workerGroup = new NioEventLoopGroup();
- private RpcRegistration<WebsocketmanagerService> websocketService;
-
- private List<URI> clusterNodeClients=null;
- private final EventInputCallback rpcEventInputCallback=new EventInputCallback() {
-
- @Override
- public void onMessagePushed(String message) throws Exception {
-
- LOG.debug("onMessagePushed: "+message);
- if(WebsocketmanagerProvider.this.clusterNodeClients!=null &&
- WebsocketmanagerProvider.this.clusterNodeClients.size()>0)
- {
- SyncWebSocketClient client;
- for(URI clientURI : WebsocketmanagerProvider.this.clusterNodeClients)
- {
- client=new SyncWebSocketClient(clientURI);
- LOG.debug("try to push message to "+client.getURI());
- client.openAndSendAndCloseSync(message);
-
- //client.close();
- }
- }
- }
- };
-
- @Override
- public void onSessionInitiated(ProviderContext session) {
- LOG.info("WebsocketmanagerProvider Session Initiated");
- webserverThread = new Thread(this);
- webserverThread.start();
- websocketService = session.addRpcImplementation(WebsocketmanagerService.class, new WebsocketImpl(rpcEventInputCallback));
- AkkaConfig cfg =null;
- try {
- cfg=AkkaConfig.load();
- } catch (Exception e) {
- LOG.warn("problem loading akka config: "+e.getMessage());
- }
- if(cfg!=null && cfg.isCluster())
- {
- this.initWSClients(cfg.getClusterConfig());
- }
- }
-
- private void initWSClients(ClusterConfig clusterConfig) {
- clusterNodeClients=new ArrayList<URI>();
- for(ClusterNodeInfo nodeConfig:clusterConfig.getSeedNodes())
- {
- if(clusterConfig.isMe(nodeConfig))
- continue;
- String url=String.format("ws://%s:%d/websocket", nodeConfig.getRemoteAddress(),PORT);
- try {
- LOG.debug("registering ws client for "+url);
- clusterNodeClients.add(new URI(url));
- } catch (URISyntaxException e) {
- LOG.warn("problem instantiating wsclient for url: "+url);
- }
- }
- }
-
- @Override
- public void close() throws Exception {
- LOG.info("WebsocketmanagerProvider Closed");
- closeWebsocketServer();
- if (websocketService != null) {
- websocketService.close();
- }
- }
-
- @Override
- public void run() {
- // TODO Auto-generated method stub
- try {
- startWebSocketServer();
- } catch (Exception e) {
- LOG.warn("Exception occured while starting webSocket server {}",e);
- }
- }
-
- private void closeWebsocketServer() {
- if (bossGroup != null) {
- try {
- bossGroup.shutdownGracefully();
- } catch (Exception e) {
- LOG.warn("Exception occured while starting webSocket server {}",e);
- }
- }
- if (workerGroup != null) {
- try {
- workerGroup.shutdownGracefully();
- } catch (Exception e) {
- LOG.warn("Exception occured while starting webSocket server {}",e);
- }
- }
- }
-
- public void startWebSocketServer() throws Exception {
- try {
- bootstrap.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class)
- .childHandler(new WebSocketServerInitializer());
- Channel channel = bootstrap.bind(PORT).sync().channel();
- LOG.info("Web socket server started at port " + PORT + '.');
- LOG.info("Open your browser and navigate to http://localhost:" + PORT + '/');
- channel.closeFuture().sync();
- } catch (Exception e) {
- LOG.warn("Exception in start websocket server ======== " + e.toString());
- } finally {
- bossGroup.shutdownGracefully();
- workerGroup.shutdownGracefully();
- }
- }
-
-}
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/dto/UserDto.java b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/dto/UserDto.java
deleted file mode 100644
index 0939ea04..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/dto/UserDto.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-* Copyright (c) 2016 Wipro Ltd. and others. All rights reserved.
-*
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0 which accompanies this distribution,
-* and is available at http://www.eclipse.org/legal/epl-v10.html
-*/
-
-package org.opendaylight.mwtn.impl.dto;
-
-import java.util.HashMap;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.opendaylight.mwtn.impl.utils.Utils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class UserDto {
- private static final Logger LOG = LoggerFactory.getLogger(UserDto.class);
-
- private String userId;
- private HashMap<String, Boolean> hmScopes;
-
- public String getUserId() {
- return userId;
- }
-
- public void setUserId(String sessionId) {
- this.userId = sessionId;
- }
-
- public HashMap<String, Boolean> getScopes() {
- return hmScopes;
- }
-
- public void setScopes(JSONArray jsonScopes) {
- hmScopes = new HashMap<>();
- for (int i = 0; jsonScopes != null && i < jsonScopes.length(); i++) {
- try {
- hmScopes.put(jsonScopes.getString(i), true);
- } catch (JSONException e) {
- LOG.warn("Something wrong: {}", e);
- }
- }
- }
-
- public JSONObject getScopedResponse(JSONObject jsonAllValue) {
- JSONObject jsonResponse = new JSONObject();
- try {
- JSONArray jsonArrayRes = new JSONArray();
- JSONArray jsonArray = jsonAllValue.getJSONArray(Utils.MSG_KEY_DATA);
- for (int i = 0; jsonArray != null && i < jsonArray.length(); i++) {
- JSONObject jsonObject = jsonArray.getJSONObject(i);
- String msgScope = jsonObject.getString(Utils.MSG_KEY_SCOPE);
- if (getScopes().get(msgScope) != null && getScopes().get(msgScope)) {
- jsonArrayRes.put(jsonObject);
- }
- }
- if (jsonArrayRes.length() == 0) {
- return null;
- }
- jsonResponse.put(Utils.MSG_KEY_DATA, jsonArrayRes);
- } catch (Exception e) {
- LOG.warn("Something wrong: {}", e);
- }
- return jsonResponse;
- }
-}
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/utils/AkkaConfig.java b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/utils/AkkaConfig.java
deleted file mode 100644
index aa51f6f1..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/utils/AkkaConfig.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package org.opendaylight.mwtn.impl.utils;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import com.typesafe.config.Config;
-import com.typesafe.config.ConfigFactory;
-
-public class AkkaConfig{
-
-
-
- public static class ClusterNodeInfo
- {
- @Override
- public String toString() {
- return "ClusterNodeInfo [protocol=" + protocol + ", clusterName=" + clusterName + ", remoteAdr=" + remoteAdr
- + ", port=" + port + "]";
- }
- private final String protocol;
- private final String clusterName;
- private final String remoteAdr;
- private final int port;
-
- public String getRemoteAddress() {return this.remoteAdr;}
- public ClusterNodeInfo(String s) throws Exception
- {
- final String regex ="([a-z.]*):\\/\\/([a-zA-Z0-9-]*)@([a-zA-Z0-9.-]*):([0-9]*)";
- final Pattern pattern = Pattern.compile(regex);
- final Matcher matcher = pattern.matcher(s);
- if(!matcher.find())
- throw new Exception("invalid seedNode format");
- this.protocol=matcher.group(1);
- this.clusterName=matcher.group(2);
- this.remoteAdr=matcher.group(3);
- this.port=Integer.parseInt(matcher.group(4));
- }
- }
- public static class ClusterRoleInfo
- {
- @Override
- public String toString() {
- return "ClusterRoleInfo [Role=" + Role + ", Index=" + Index + "]";
- }
-
- private final String Role;
- private final int Index;
- public ClusterRoleInfo(String s) throws Exception {
- final String regex = "([a-z]*)-([0-9]*)";
- final Pattern pattern = Pattern.compile(regex);
- final Matcher matcher = pattern.matcher(s);
- if(!matcher.find())
- throw new Exception("invalid role format");
- this.Role=matcher.group(1);
- this.Index=Integer.parseInt(matcher.group(2));
- }
-
- }
- public static class ClusterConfig
- {
- @Override
- public String toString() {
- return "ClusterConfig [seedNodes=" + seedNodes + ", roles=" + roles + "]";
- }
- private final List<ClusterNodeInfo> seedNodes;
- private final List<ClusterRoleInfo> roles;
- private final ClusterNodeInfo ismeInfo;
- public ClusterConfig(Config o) throws Exception {
- {
- this.seedNodes = new ArrayList<ClusterNodeInfo>();
- List<String> a= o.getStringList("seed-nodes");
- for(int i=0;i<a.size();i++)
- {
- ClusterNodeInfo info=new ClusterNodeInfo(a.get(i));
- this.seedNodes.add(info);
- }
- this.roles=new ArrayList<ClusterRoleInfo>();
- a=o.getStringList("roles");
- for(int i=0;i<a.size();i++)
- {
- ClusterRoleInfo s=new ClusterRoleInfo(a.get(i));
- this.roles.add(s);
- }
- int idx=this.roles.get(0).Index-1;
- if(idx>=0 && idx<this.seedNodes.size())
- this.ismeInfo=this.seedNodes.get(idx);
- else
- this.ismeInfo=null;
- }
-
- }
- public boolean isCluster() {
- return this.seedNodes!=null?this.seedNodes.size()>1:false;
- }
- public boolean isMe(ClusterNodeInfo i) {
- return this.ismeInfo!=null?this.ismeInfo.equals(i):false;
- }
- public List<ClusterNodeInfo> getSeedNodes() {
- return this.seedNodes;
- }
- }
-
- private static final String DEFAULT_FILENAME = "configuration/initial/akka.conf";
- private final String filename;
- private ClusterConfig cluserConfig;
- public ClusterConfig getClusterConfig() {return this.cluserConfig;}
-
- private AkkaConfig(String filename) {
- this.filename = filename;
- }
- @Override
- public String toString() {
- return "AkkaConfig [filename=" + filename + ", cluserConfig=" + cluserConfig + "]";
- }
-
- private void loadFromFile() throws Exception {
- Config cfg=ConfigFactory.parseFile(new File(this.filename));
- this.cluserConfig=new ClusterConfig(cfg.getConfig("odl-cluster-data").getConfig("akka").getConfig("cluster"));
- }
-
- public boolean isCluster()
- {
- return this.cluserConfig!=null?this.cluserConfig.isCluster():false;
- }
- public static AkkaConfig load() throws Exception
- {
- return load(DEFAULT_FILENAME);
- }
-
- public static AkkaConfig load(String filename) throws Exception
- {
- AkkaConfig cfg=new AkkaConfig(filename);
- cfg.loadFromFile();
-
- return cfg;
- }
-
-
-
-
-}
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/utils/Utils.java b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/utils/Utils.java
deleted file mode 100644
index 98e58fc2..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/utils/Utils.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-* Copyright (c) 2016 Wipro Ltd. and others. All rights reserved.
-*
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0 which accompanies this distribution,
-* and is available at http://www.eclipse.org/legal/epl-v10.html
-*/
-
-package org.opendaylight.mwtn.impl.utils;
-
-import java.util.HashMap;
-
-import org.opendaylight.mwtn.impl.dto.UserDto;
-
-import io.netty.channel.ChannelHandlerContext;
-
-public class Utils {
-
- public static final String MSG_KEY_DATA = "data";
- public static final String MSG_KEY_SCOPES = "scopes";
- public static final String MSG_KEY_PARAM = "param";
- public static final String MSG_KEY_VALUE = "value";
- public static final String MSG_KEY_SCOPE = "scope";
- public static HashMap<String, UserDto> hmClientScopes = new HashMap<String, UserDto>();
- public static HashMap<String, ChannelHandlerContext> hmChannelContexts = new HashMap<String, ChannelHandlerContext>();
-
- public static enum SCOPE {
- ObjectCreationNotification, ObjectDeletionNotification, AttributeValueChangedNotification, ProblemNotification
- };
-
-}
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/websocket/SyncWebSocketClient.java b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/websocket/SyncWebSocketClient.java
deleted file mode 100644
index 53246de0..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/websocket/SyncWebSocketClient.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.opendaylight.mwtn.impl.websocket;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.java_websocket.client.WebSocketClient;
-import org.java_websocket.handshake.ServerHandshake;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SyncWebSocketClient extends WebSocketClient {
-
- private static final Logger LOG = LoggerFactory.getLogger(SyncWebSocketClient.class.getName());
- private String messageToSend;
-
- public SyncWebSocketClient(URI serverUri) {
- super(serverUri);
- // TODO Auto-generated constructor stub
- }
-
- public SyncWebSocketClient(String uri) throws URISyntaxException {
- this(new URI(uri));
- }
-
- @Override
- public void onClose(int arg0, String arg1, boolean arg2) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void onError(Exception arg0) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void onMessage(String arg0) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void onOpen(ServerHandshake arg0) {
- LOG.debug("ws opened");
- if(this.messageToSend!=null)
- {
- LOG.debug("try to send: "+this.messageToSend);
- this.send(this.messageToSend);
- this.messageToSend=null;
- }
-
- }
-
- public void openAndSendAsync(String message)
- {
- this.messageToSend=message;
- this.connect();
- }
- public void openAndSendAndCloseSync(String message)
- {
- try {
- this.connectBlocking();
- } catch (InterruptedException e) {
- LOG.warn("problem connecting:"+e.getMessage());
- }
- this.send(message);
- try {
- this.closeBlocking();
- } catch (InterruptedException e) {
- LOG.warn("problem disconnecting:"+e.getMessage());
-
- }
- }
-
-
-}
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/websocket/WebSocketServerHandler.java b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/websocket/WebSocketServerHandler.java
deleted file mode 100644
index 910886cd..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/websocket/WebSocketServerHandler.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
-* Copyright (c) 2016 Wipro Ltd. and others. All rights reserved.
-*
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0 which accompanies this distribution,
-* and is available at http://www.eclipse.org/legal/epl-v10.html
-*/
-
-package org.opendaylight.mwtn.impl.websocket;
-
-import static io.netty.handler.codec.http.HttpHeaders.isKeepAlive;
-import static io.netty.handler.codec.http.HttpHeaders.setContentLength;
-import static io.netty.handler.codec.http.HttpHeaders.Names.HOST;
-import static io.netty.handler.codec.http.HttpMethod.GET;
-import static io.netty.handler.codec.http.HttpResponseStatus.BAD_REQUEST;
-import static io.netty.handler.codec.http.HttpResponseStatus.FORBIDDEN;
-import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;
-import static org.opendaylight.mwtn.impl.utils.Utils.hmChannelContexts;
-import static org.opendaylight.mwtn.impl.utils.Utils.hmClientScopes;
-
-import java.util.Map;
-
-import org.json.JSONObject;
-import org.opendaylight.mwtn.impl.dto.UserDto;
-import org.opendaylight.mwtn.impl.utils.Utils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
-import io.netty.channel.ChannelFuture;
-import io.netty.channel.ChannelFutureListener;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.channel.SimpleChannelInboundHandler;
-import io.netty.handler.codec.http.DefaultFullHttpResponse;
-import io.netty.handler.codec.http.FullHttpRequest;
-import io.netty.handler.codec.http.FullHttpResponse;
-import io.netty.handler.codec.http.websocketx.CloseWebSocketFrame;
-import io.netty.handler.codec.http.websocketx.PingWebSocketFrame;
-import io.netty.handler.codec.http.websocketx.PongWebSocketFrame;
-import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
-import io.netty.handler.codec.http.websocketx.WebSocketFrame;
-import io.netty.handler.codec.http.websocketx.WebSocketServerHandshaker;
-import io.netty.handler.codec.http.websocketx.WebSocketServerHandshakerFactory;
-import io.netty.util.CharsetUtil;
-
-public class WebSocketServerHandler extends SimpleChannelInboundHandler<Object> {
- private static final Logger LOG = LoggerFactory.getLogger(WebSocketServerHandler.class.getName());
-
- private static final String WEBSOCKET_PATH = "/websocket";
-
- public static final String KEY_NODENAME = "nodename";
- public static final String KEY_EVENTTYPE = "eventtype";
- public static final String KEY_XMLEVENT = "xmlevent";
-
- private WebSocketServerHandshaker handshaker;
-
- @Override
- public void channelRegistered(ChannelHandlerContext ctx) throws Exception {
- super.channelRegistered(ctx);
- hmChannelContexts.put(String.valueOf(ctx.hashCode()), ctx);
- LOG.info("Channel registered " + ctx.channel().toString());
- }
-
- @Override
- public void channelUnregistered(ChannelHandlerContext ctx) throws Exception {
- super.channelUnregistered(ctx);
- if (ctx != null) {
- String channelHashCode = String.valueOf(ctx.hashCode());
- hmChannelContexts.remove(channelHashCode);
- LOG.info("Channel unregistered " + ctx.channel().toString());
- }
- }
-
- @Override
- public void channelRead0(ChannelHandlerContext ctx, Object msg) throws Exception {
- if (msg instanceof FullHttpRequest) {
- handleHttpRequest(ctx, (FullHttpRequest) msg);
- } else if (msg instanceof WebSocketFrame) {
- handleWebSocketFrame(ctx, (WebSocketFrame) msg);
- }
- }
-
- public static void sendMessage(String nodeName, String eventType, String xmlEvent) {
- if (hmChannelContexts != null && hmChannelContexts.size() > 0) {
- for (Map.Entry<String, ChannelHandlerContext> entry : hmChannelContexts.entrySet()) {
- ChannelHandlerContext ctx = entry.getValue();
-
- try {
- UserDto clientDto = hmClientScopes.get(String.valueOf(ctx.hashCode()));
- if (clientDto.getScopes().get(eventType) != null) {
- sendBroadcast(ctx, xmlEvent);
- }
- } catch (Exception ioe) {
- LOG.warn(ioe.getMessage());
- }
- }
- }
- }
- public static void sendMessage(String xmlEvent) {
- if (hmChannelContexts != null && hmChannelContexts.size() > 0) {
- for (Map.Entry<String, ChannelHandlerContext> entry : hmChannelContexts.entrySet()) {
- ChannelHandlerContext ctx = entry.getValue();
-
- try {
- sendBroadcast(ctx, xmlEvent);
-
- } catch (Exception ioe) {
- LOG.warn(ioe.getMessage());
- }
- }
- }
- }
- private static void sendBroadcast(ChannelHandlerContext ctx, String message) {
- try {
- ctx.channel().write(new TextWebSocketFrame(message));
- } catch (Exception e) {
- LOG.warn(e.getMessage());
- }
- ctx.channel().flush();
- }
-
- @Override
- public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
- ctx.flush();
- }
-
- private void handleHttpRequest(ChannelHandlerContext ctx, FullHttpRequest req) throws Exception {
- // Handle a bad request.
- if (!req.getDecoderResult().isSuccess()) {
- sendHttpResponse(ctx, req, new DefaultFullHttpResponse(HTTP_1_1, BAD_REQUEST));
- return;
- }
-
- // Allow only GET methods.
- if (req.getMethod() != GET) {
- sendHttpResponse(ctx, req, new DefaultFullHttpResponse(HTTP_1_1, FORBIDDEN));
- return;
- }
-
- // Handshake
- WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory(getWebSocketLocation(req),
- null, false);
- handshaker = wsFactory.newHandshaker(req);
- if (handshaker == null) {
- WebSocketServerHandshakerFactory.sendUnsupportedWebSocketVersionResponse(ctx.channel());
- } else {
- handshaker.handshake(ctx.channel(), req);
- }
- }
-
- private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {
-
- // Check for closing frame
- if (frame instanceof CloseWebSocketFrame) {
- handshaker.close(ctx.channel(), (CloseWebSocketFrame) frame.retain());
- return;
- }
- if (frame instanceof PingWebSocketFrame) {
- ctx.channel().write(new PongWebSocketFrame(frame.content().retain()));
- return;
- }
- if (!(frame instanceof TextWebSocketFrame)) {
- throw new UnsupportedOperationException(
- String.format("%s frame types not supported", frame.getClass().getName()));
- }
-
- String request = ((TextWebSocketFrame) frame).text();
- LOG.info(String.format("%s received %s", ctx.channel(), request));
- if(!manageClientRequest(ctx, request));
- manageClientRequest2(ctx, request);
- }
-
- /*
- * broadcast message to all your clients
- */
- private void manageClientRequest2(ChannelHandlerContext ctx, String request) {
- try {
- JSONObject o=new JSONObject(request);
- if(o.has(KEY_NODENAME) && o.has(KEY_EVENTTYPE) && o.has(KEY_EVENTTYPE))
- sendMessage(o.getString(KEY_NODENAME),o.getString(KEY_EVENTTYPE),o.getString(KEY_XMLEVENT));
- } catch (Exception e) {
- LOG.warn("handle ws request failed:"+e.getMessage());
- }
- }
- private boolean manageClientRequest(ChannelHandlerContext ctx, String request) {
- boolean ret=false;
- try {
- JSONObject jsonMessage = new JSONObject(request);
- if(jsonMessage.has(Utils.MSG_KEY_DATA))
- {
- String data = jsonMessage.getString(Utils.MSG_KEY_DATA);
- if (data.equals(Utils.MSG_KEY_SCOPES)) {
- ret=true;
- String sessionId = String.valueOf(ctx.hashCode());
- UserDto clientDto = new UserDto();
- clientDto.setScopes(jsonMessage.getJSONArray(Utils.MSG_KEY_SCOPES));
- clientDto.setUserId(sessionId);
- hmClientScopes.put(sessionId, clientDto);
- ctx.channel().write(new TextWebSocketFrame(
- "You are connected to the Opendaylight Websocket server and scopes are : " + request + ""));
- }
- }
- } catch (Exception e) {
- LOG.warn("problem set scope: "+e.getMessage());
- ctx.channel().write(new TextWebSocketFrame("Your request to the Opendaylight Websocket server is >> "
- + request + " << which failed because of following exception >> " + e.toString()));
- }
- return ret;
- }
-
- private static void sendHttpResponse(ChannelHandlerContext ctx, FullHttpRequest req, FullHttpResponse res) {
- // Generate an error page if response getStatus code is not OK (200).
- if (res.getStatus().code() != 200) {
- ByteBuf buf = Unpooled.copiedBuffer(res.getStatus().toString(), CharsetUtil.UTF_8);
- res.content().writeBytes(buf);
- buf.release();
- setContentLength(res, res.content().readableBytes());
- }
-
- // Send the response and close the connection if necessary.
- ChannelFuture f = ctx.channel().writeAndFlush(res);
- if (!isKeepAlive(req) || res.getStatus().code() != 200) {
- f.addListener(ChannelFutureListener.CLOSE);
- }
- }
-
- @Override
- public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
- LOG.info("Exception caught {}");
- ctx.close();
- }
-
- private static String getWebSocketLocation(FullHttpRequest req) {
- return "ws://" + req.headers().get(HOST) + WEBSOCKET_PATH;
- }
-
-}
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/websocket/WebSocketServerInitializer.java b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/websocket/WebSocketServerInitializer.java
deleted file mode 100644
index 8cdc1d74..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/mwtn/impl/websocket/WebSocketServerInitializer.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-* Copyright (c) 2016 Wipro Ltd. and others. All rights reserved.
-*
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0 which accompanies this distribution,
-* and is available at http://www.eclipse.org/legal/epl-v10.html
-*/
-
-package org.opendaylight.mwtn.impl.websocket;
-
-import io.netty.channel.ChannelInitializer;
-import io.netty.channel.ChannelPipeline;
-import io.netty.channel.socket.SocketChannel;
-import io.netty.handler.codec.http.HttpObjectAggregator;
-import io.netty.handler.codec.http.HttpServerCodec;
-
-public class WebSocketServerInitializer extends ChannelInitializer<SocketChannel> {
- @Override
- public void initChannel(SocketChannel ch) throws Exception {
- ChannelPipeline pipeline = ch.pipeline();
- pipeline.addLast("codec-http", new HttpServerCodec());
- pipeline.addLast("aggregator", new HttpObjectAggregator(65536));
- pipeline.addLast("handler", new WebSocketServerHandler());
- }
-}
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/websocketmanager/impl/rev141210/WebsocketmanagerModule.java b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/websocketmanager/impl/rev141210/WebsocketmanagerModule.java
deleted file mode 100644
index 0cab279c..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/websocketmanager/impl/rev141210/WebsocketmanagerModule.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-* Copyright (c) 2016 Wipro Ltd. and others. All rights reserved.
-*
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0 which accompanies this distribution,
-* and is available at http://www.eclipse.org/legal/epl-v10.html
-*/
-
-package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.impl.rev141210;
-
-import org.opendaylight.mwtn.impl.WebsocketmanagerProvider;
-
-public class WebsocketmanagerModule extends
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.impl.rev141210.AbstractWebsocketmanagerModule {
- public WebsocketmanagerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public WebsocketmanagerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.impl.rev141210.WebsocketmanagerModule oldModule,
- java.lang.AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public void customValidation() {
- // add custom validation form module attributes here.
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- WebsocketmanagerProvider provider = new WebsocketmanagerProvider();
- getBrokerDependency().registerProvider(provider);
- return provider;
- }
-
-}
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/websocketmanager/impl/rev141210/WebsocketmanagerModuleFactory.java b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/websocketmanager/impl/rev141210/WebsocketmanagerModuleFactory.java
deleted file mode 100644
index ecf0ff36..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/websocketmanager/impl/rev141210/WebsocketmanagerModuleFactory.java
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-+* Generated file
-*
-* Generated from: yang module name: websocketmanager yang module local name: websocketmanager
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Fri Jan 02 13:49:24 CST 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.impl.rev141210;
-public class WebsocketmanagerModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.websocketmanager.impl.rev141210.AbstractWebsocketmanagerModuleFactory {
-
-}
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/test/AkkaConfigTest.java b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/test/AkkaConfigTest.java
deleted file mode 100644
index 63f9a36c..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/test/AkkaConfigTest.java
+++ /dev/null
@@ -1,22 +0,0 @@
-import org.opendaylight.mwtn.impl.utils.AkkaConfig;
-
-public class AkkaConfigTest {
-
- public static void main(String[] args) {
-
- try {
- AkkaConfig cfg = AkkaConfig
- .load("/home/herbert/odl/distribution-karaf-0.6.1-Carbon/configuration/initial/akka.conf");
- System.out.println("config loaded successfully");
- System.out.println("==========================");
- System.out.println(cfg.toString());
- System.out.println("==========================");
- for(AkkaConfig.ClusterNodeInfo info:cfg.getClusterConfig().getSeedNodes())
- System.out.println("isme="+cfg.getClusterConfig().isMe(info));
-
- } catch (Exception e) {
-
- e.printStackTrace();
- }
- }
-}
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/test/WebsocketClientTest.java b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/test/WebsocketClientTest.java
deleted file mode 100644
index f96656ac..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/test/WebsocketClientTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-import org.opendaylight.mwtn.impl.websocket.SyncWebSocketClient;
-
-public class WebsocketClientTest {
-
- private static final int PORT = 8085;
-
- public static void main(String[] args)
- {
-
- String remoteAddress="192.168.178.142";
- String message="hier könnte ihre werbung stehen";
- SyncWebSocketClient wsclient=null;
- try {
- wsclient=new SyncWebSocketClient(String.format("ws://%s:%d/websocket", remoteAddress,PORT));
- if(!wsclient.isOpen())
- wsclient.openAndSendAsync(message);
- System.out.println("sending succeeded");
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- finally
- {
-
- }
- System.out.println("finished");
-
- }
-}
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/yang/websocketmanager-impl.yang b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/yang/websocketmanager-impl.yang
deleted file mode 100644
index 2f95a279..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/impl/src/main/yang/websocketmanager-impl.yang
+++ /dev/null
@@ -1,38 +0,0 @@
-module websocketmanager-impl {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:websocketmanager:impl";
- prefix "websocketmanager-impl";
-
- import config { prefix config; revision-date 2013-04-05; }
- import opendaylight-md-sal-binding { prefix md-sal-binding; revision-date 2013-10-28;}
-
- description
- "Service definition for websocketmanager project";
-
- revision "2014-12-10" {
- description
- "Initial revision";
- }
-
- identity websocketmanager {
- base config:module-type;
- config:java-name-prefix Websocketmanager;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case websocketmanager {
- when "/config:modules/config:module/config:type = 'websocketmanager'";
- container broker {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity md-sal-binding:binding-broker-osgi-registry;
- }
- }
- }
- }
- }
-
-
-}
-
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/pom.xml
deleted file mode 100644
index 3be337b2..00000000
--- a/sdnr/wireless-transport/code-Carbon-SR1/apps/websocketmanager/pom.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.opendaylight.odlparent</groupId>
- <artifactId>odlparent</artifactId>
- <version>1.8.1-Carbon</version>
- <relativePath />
- </parent>
-
- <groupId>org.opendaylight.mwtn</groupId>
- <artifactId>websocketmanager</artifactId>
- <name>websocketmanager</name>
- <version>0.5.1-SNAPSHOT</version>
- <packaging>pom</packaging>
-
- <modules>
- <module>api</module>
- <module>impl</module>
- </modules>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
-