finalizing SSE; todo fix jetty-server OSGi
diff --git a/apps/fpcagent/BUCK b/apps/fpcagent/BUCK
index 89b33cb..3915fac 100644
--- a/apps/fpcagent/BUCK
+++ b/apps/fpcagent/BUCK
@@ -12,6 +12,7 @@
'//core/store/serializers:onos-core-serializers',
'//apps/restconf/utils:onos-apps-restconf-utils',
'//apps/config:onos-apps-config',
+ '//apps/restconf/api:onos-apps-restconf-api',
'//models/fpcagent:onos-models-fpcagent',
'//models/common:onos-models-common',
'//lib:jetty-http',
@@ -19,8 +20,9 @@
':jetty-annotations',
':jetty-server-v9.4.6',
'//lib:jetty-util',
- ':zeromq',
+ '//lib:jersey-server',
'//lib:javax.servlet-api',
+ ':zeromq',
':json',
]
@@ -34,6 +36,14 @@
'//apps/fpcagent:onos-apps-fpcagent',
'//lib:httpclient-osgi',
'//lib:httpcore-osgi',
+ '//lib:org.apache.httpcomponents.httpasyncclient-osgi',
+ '//lib:jetty-http',
+ ':jetty-servlet',
+ ':jetty-annotations',
+ ':jetty-server-v9.4.6',
+ '//lib:jetty-util',
+ '//lib:jersey-server',
+ '//lib:javax.servlet-api',
]
EXCLUDED_BUNDLES = [
diff --git a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/FpcManager.java b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/FpcManager.java
index 6478827..9e97ee9 100644
--- a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/FpcManager.java
+++ b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/FpcManager.java
@@ -35,6 +35,7 @@
import org.onosproject.fpcagent.workers.ZMQSBSubscriberManager;
import org.onosproject.net.config.*;
import org.onosproject.net.config.basics.SubjectFactories;
+import org.onosproject.restconf.api.RestconfService;
import org.onosproject.yang.model.ModelConverter;
import org.onosproject.yang.model.RpcRegistry;
import org.slf4j.Logger;
@@ -86,6 +87,9 @@
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
private DpnProviderService dpnProviderService;
+ @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+ private RestconfService restconfService;
+
/* Variables */
private IdGenerator notificationIds;
private FpcConfig fpcConfig;
@@ -119,7 +123,7 @@
jettyServer.start();
parseStream.start();
- NBEventWorkerManager.createInstance(20).open();
+ NBEventWorkerManager.createInstance(20, restconfService).open();
HTTPNotifier.createInstance().open();
log.info("FPC Service Started");
diff --git a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/util/eventStream/NotificationServer.java b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/util/eventStream/NotificationServer.java
index 65150f8..e859cbf 100644
--- a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/util/eventStream/NotificationServer.java
+++ b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/util/eventStream/NotificationServer.java
@@ -7,10 +7,11 @@
*/
package org.onosproject.fpcagent.util.eventStream;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
+import org.apache.commons.lang.exception.ExceptionUtils;
+import org.json.JSONException;
+import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.servlet.AsyncContext;
import javax.servlet.ServletContext;
@@ -18,12 +19,10 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.opendaylight.fpc.utils.ErrorLog;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
/**
* A HTTP servlet that handles requests for notification streams
@@ -57,8 +56,8 @@
asyncContext.getResponse().setBufferSize(1200);
try {
asyncContext.getResponse().flushBuffer();
- } catch (IOException e1) {
- ErrorLog.logError(e1.getMessage(),e1.getStackTrace());
+ } catch (IOException e) {
+ log.error(ExceptionUtils.getFullStackTrace(e));
}
ServletContext servletContext = request.getServletContext();
Map<String,AsyncContext> notificationStreams = (ConcurrentHashMap<String,AsyncContext>) servletContext.getAttribute("notificationStreams");
@@ -66,7 +65,7 @@
log.info("Client Id received in the notification stream request: "+clientId);
}
} catch (JSONException e) {
- ErrorLog.logError(e.getLocalizedMessage(),e.getStackTrace());
+ log.error(ExceptionUtils.getFullStackTrace(e));
}
}
}