Package gov.usgs.earthquake.distribution
Class URLNotificationJSONConverter
java.lang.Object
gov.usgs.earthquake.distribution.URLNotificationJSONConverter
Converts to and from JSON for URL notifications
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringattribute for codestatic final Stringattribute for expiresstatic final Stringattribute for product idstatic final Stringattribute for sourcestatic final Stringattribute for typestatic final Stringattribute for updatetimestatic final Stringattribute for url -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidMain function to run a test JSON-ifying a URLnotificationstatic URLNotificationparseJSON(InputStream message) parse a message from the input streamstatic URLNotificationparseJSON(javax.json.JsonObject json) Parse a JsonObjectstatic StringtoJSON(URLNotification notification) Converts a URLNotification into a JSON string
-
Field Details
-
ATTRIBUTE_PRODUCT_ID
attribute for product id- See Also:
-
ATTRIBUTE_SOURCE
attribute for source- See Also:
-
ATTRIBUTE_TYPE
attribute for type- See Also:
-
ATTRIBUTE_CODE
attribute for code- See Also:
-
ATTRIBUTE_UPDATE_TIME
attribute for updatetime- See Also:
-
ATTRIBUTE_EXPIRES
attribute for expires- See Also:
-
ATTRIBUTE_URL
attribute for url- See Also:
-
-
Constructor Details
-
URLNotificationJSONConverter
public URLNotificationJSONConverter()
-
-
Method Details
-
toJSON
Converts a URLNotification into a JSON string- Parameters:
notification- URLNotification to convert- Returns:
- JSON string
-
parseJSON
parse a message from the input stream- Parameters:
message- InputStream message- Returns:
- URLNotification
- Throws:
Exception- if error occurs
-
parseJSON
Parse a JsonObject- Parameters:
json- JsonObject- Returns:
- URLNotification
- Throws:
Exception- if error occurs
-
main
Main function to run a test JSON-ifying a URLnotification- Parameters:
args- arguments- Throws:
Exception- if error occurs
-