@@ -11,16 +11,13 @@ import de.upb.cs.swt.delphi.instanceregistry.authorization.AccessTokenEnums.User
1111import de .upb .cs .swt .delphi .instanceregistry .authorization .{AccessToken , AuthProvider }
1212import de .upb .cs .swt .delphi .instanceregistry .io .swagger .client .model .InstanceEnums .ComponentType
1313import de .upb .cs .swt .delphi .instanceregistry .io .swagger .client .model .{EventJsonSupport , Instance , InstanceJsonSupport , InstanceLinkJsonSupport }
14+ import de .upb .cs .swt .delphi .instanceregistry .requestLimiter .{IpLogActor , RequestLimitScheduler }
1415import de .upb .cs .swt .delphi .instanceregistry .{AppLogging , Registry , RequestHandler }
1516import spray .json .JsonParser .ParsingException
1617import spray .json ._
1718
18- import scala .concurrent .{ ExecutionContext , Future }
19+ import scala .concurrent .ExecutionContext
1920import scala .util .{Failure , Success }
20- import de .upb .cs .swt .delphi .instanceregistry .requestLimiter .{IpLogActor , RequestLimitScheduler }
21- import sun .font .Decoration .Label
22-
23- import scala .collection .immutable .Range
2421
2522/**
2623 * Web server configuration for Instance Registry API.
@@ -75,7 +72,9 @@ class Server(handler: RequestHandler) extends HttpApp
7572 matchingInstance(Id )
7673 } ~
7774 path(" matchingResult" ) {
78- entity(as[JsValue ]) { json => matchInstance(Id , json.asJsObject.fields(" MatchingSuccessful" ).asInstanceOf [Boolean ], json.asJsObject.fields(" SenderId" ).asInstanceOf [Long ]) }
75+ entity(as[JsValue ]) {
76+ json => matchInstance(Id , json.asJsObject.fields(" MatchingSuccessful" ).toString(), json.asJsObject.fields(" SenderId" ).toString())
77+ }
7978 } ~
8079 path(" eventList" ) {
8180 eventList(Id )
@@ -341,10 +340,13 @@ class Server(handler: RequestHandler) extends HttpApp
341340 *
342341 * @return Server route that either maps to 200 OK or to the respective error codes
343342 */
344- def matchInstance (callerId : Long , matchingResult : Boolean , matchedInstanceId : Long ): server.Route = {
343+ def matchInstance (callerId : Long , matchingResultStr : String , matchedInstanceIdStr : String ): server.Route = {
345344 authenticateOAuth2[AccessToken ](" Secure Site" , AuthProvider .authenticateOAuthRequire(_, userType = UserType .Component )) { token =>
345+
346+ val matchingResult : Boolean = matchingResultStr.toBoolean
347+ val matchedInstanceId : Long = matchedInstanceIdStr.toLong
346348 post {
347- log.debug(s " POST /matchingResult?callerId= $callerId& matchedInstanceId= $matchedInstanceId&MatchingSuccessful= $matchingResult has been called " )
349+ log.debug(s " POST /instances/ $callerId/matchingResult has been called with parameters : matchedInstanceId= $matchedInstanceId&MatchingSuccessful= $matchingResult" )
348350
349351 handler.handleMatchingResult(callerId, matchedInstanceId, matchingResult) match {
350352 case handler.OperationResult .IdUnknown =>
@@ -395,9 +397,9 @@ class Server(handler: RequestHandler) extends HttpApp
395397 authenticateOAuth2[AccessToken ](" Secure Site" , AuthProvider .authenticateOAuthRequire(_, userType = UserType .Admin )) { token =>
396398 post {
397399 if (name.isEmpty) {
398- log.debug(s " POST /deploy?ComponentType= $compTypeString has been called " )
400+ log.debug(s " POST /instances/ deploy?ComponentType= $compTypeString has been called " )
399401 } else {
400- log.debug(s " POST /deploy?ComponentType= $compTypeString&name= ${name.get} has been called " )
402+ log.debug(s " POST /instances/ deploy?ComponentType= $compTypeString&name= ${name.get} has been called " )
401403 }
402404 val compType : ComponentType = ComponentType .values.find(v => v.toString == compTypeString).orNull
403405
@@ -832,7 +834,7 @@ class Server(handler: RequestHandler) extends HttpApp
832834 def network (): server.Route = {
833835 authenticateOAuth2[AccessToken ](" Secure Site" , AuthProvider .authenticateOAuthRequire(_, userType = UserType .User )) { token =>
834836 get {
835- log.debug(s " GET /network has been called. " )
837+ log.debug(s " GET /instances/ network has been called. " )
836838 complete {
837839 handler.handleGetNetwork().toJson
838840 }
0 commit comments