bda-controller/src/main/java/gr/ntua/ece/cslab/selis/bda/controller/resources/MessageResource.java
@POST
    @Path("{slug}/insert")
    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public static Response handleMessage(@PathParam("slug") String scnSlug,
                                         String message) {
        try {
            Message msg = new Message();
            Map<String, Object> retMap = new Gson().fromJson(
                    message, new TypeToken<HashMap<String, Object>>() {}.getType()
            );
            for (Map.Entry<String, Object> entry: retMap.entrySet())
                msg.put(entry.getKey(),entry.getValue());
            PubSubMessageHandler.handleMessage(msg, scnSlug);
            LOGGER.log(Level.INFO,"PubSub message successfully inserted in the BDA.");
        } catch (Exception e) {
            e.printStackTrace();

            return Response.serverError().entity(
                    new RequestResponse("ERROR", "Could not insert new PubSub message.")
            ).build();
        }

        return Response.ok(
                new RequestResponse("OK", "")
        ).build();
    }
/**
     * Handle incoming PubSub message method
     * @param message the PubSub message
     */
Handle incoming PubSub message method
@param message the PubSub message
Handle incoming PubSub message method @param message the PubSub message
@POST
    @Path("{slug}/insert")
    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public static Response handleMessage(@PathParam("slug") String scnSlug,
                                         String message) {
        try {
            Message msg = new Message();
            Map<String, Object> retMap = new Gson().fromJson(
                    message, new TypeToken<HashMap<String, Object>>() {}.getType()
            );
            for (Map.Entry<String, Object> entry: retMap.entrySet())
                msg.put(entry.getKey(),entry.getValue());
            PubSubMessageHandler.handleMessage(msg, scnSlug);
            LOGGER.log(Level.INFO,"PubSub message successfully inserted in the BDA.");
        } catch (Exception e) {
            e.printStackTrace();
            return Response.serverError().entity(
                    new RequestResponse("ERROR", "Could not insert new PubSub message.")
            ).build();
        }
        return Response.ok(
                new RequestResponse("OK", "")
        ).build();
    }
@ POST @ Path ( "{slug}/insert" ) @ Consumes ( { MediaType . APPLICATION_JSON , MediaType . APPLICATION_XML } ) @ Produces ( { MediaType . APPLICATION_JSON , MediaType . APPLICATION_XML } ) public static Response handleMessage ( @ PathParam ( "slug" ) String scnSlug , String message ) { try { Message msg = new Message ( ) ; Map < String , Object > retMap = new Gson ( ) . fromJson ( message , new TypeToken < HashMap < String , Object > > ( ) { } . getType ( ) ) ; for ( Map . Entry < String , Object > entry : retMap . entrySet ( ) ) msg . put ( entry . getKey ( ) , entry . getValue ( ) ) ; PubSubMessageHandler . handleMessage ( msg , scnSlug ) ; LOGGER . log ( Level . INFO , "PubSub message successfully inserted in the BDA." ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return Response . serverError ( ) . entity ( new RequestResponse ( "ERROR" , "Could not insert new PubSub message." ) ) . build ( ) ; } return Response . ok ( new RequestResponse ( "OK" , "" ) ) . build ( ) ; }
Handle incoming PubSub message method
 @param message the PubSub message
Handle incoming PubSub message method @param message the PubSub message