public class SchemaServiceImpl extends Object implements SchemaService
Constructor and Description |
---|
SchemaServiceImpl() |
Modifier and Type | Method and Description |
---|---|
boolean |
deleteSchema(String schemaId)
Delete a schema according to its id
|
void |
destroy() |
Set<String> |
getInstalledJsonSchemaIds()
Get the list of installed Json Schema Ids
|
JsonSchemaWrapper |
getSchema(String schemaId)
Get a schema matching by a schema id
|
JsonSchemaWrapper |
getSchemaForEventType(String eventType)
Get the schema that is able to validate the specific event type
|
List<JsonSchemaWrapper> |
getSchemasByTarget(String target)
Get a list a
JsonSchemaWrapper |
void |
init() |
boolean |
isEventValid(String event)
Verify if the event is valid
(This method is fail safe, if unexpected errors happens it will returns false)
|
boolean |
isEventValid(String event,
String eventType)
Deprecate (since 2.2.0).
|
boolean |
isValid(String data,
String schemaId)
Verify if a jsonNode is valid against a schema
(This method is fail safe, if unexpected errors happens it will returns false)
|
void |
loadPredefinedSchema(InputStream schemaStream)
Load a predefined schema into memory
|
void |
saveSchema(String schema)
Save a new schema or update a schema
|
void |
setJsonSchemaRefreshInterval(Integer jsonSchemaRefreshInterval) |
void |
setPersistenceService(PersistenceService persistenceService) |
void |
setScopeService(ScopeService scopeService) |
boolean |
unloadPredefinedSchema(InputStream schemaStream)
Unload a predefined schema into memory
|
Set<ValidationError> |
validateEvent(String event)
perform a validation on the given event
|
Map<String,Set<ValidationError>> |
validateEvents(String events)
perform a validation of a list of the given events
|
public boolean isValid(String data, String schemaId)
SchemaService
isValid
in interface SchemaService
data
- to validateschemaId
- id of the schema used for the validationpublic boolean isEventValid(String event, String eventType)
SchemaService
isEventValid
in interface SchemaService
public boolean isEventValid(String event)
SchemaService
isEventValid
in interface SchemaService
event
- the event to check validitypublic Set<ValidationError> validateEvent(String event) throws ValidationException
SchemaService
validateEvent
in interface SchemaService
event
- the event to validateValidationException
- in case something goes wrong and validation could not be performed.public Map<String,Set<ValidationError>> validateEvents(String events) throws ValidationException
SchemaService
validateEvents
in interface SchemaService
events
- the events to validateValidationException
- in case something goes wrong and validation could not be performed.public JsonSchemaWrapper getSchema(String schemaId)
SchemaService
getSchema
in interface SchemaService
schemaId
- Id of the schemapublic Set<String> getInstalledJsonSchemaIds()
SchemaService
getInstalledJsonSchemaIds
in interface SchemaService
public List<JsonSchemaWrapper> getSchemasByTarget(String target)
SchemaService
JsonSchemaWrapper
getSchemasByTarget
in interface SchemaService
target
- to filter the schemaspublic JsonSchemaWrapper getSchemaForEventType(String eventType) throws ValidationException
SchemaService
getSchemaForEventType
in interface SchemaService
eventType
- the eventTypeValidationException
public void saveSchema(String schema)
SchemaService
saveSchema
in interface SchemaService
schema
- as a String valuepublic boolean deleteSchema(String schemaId)
SchemaService
deleteSchema
in interface SchemaService
schemaId
- id of the schema to deletepublic void loadPredefinedSchema(InputStream schemaStream) throws IOException
SchemaService
loadPredefinedSchema
in interface SchemaService
schemaStream
- inputStream of the schemaIOException
public boolean unloadPredefinedSchema(InputStream schemaStream)
SchemaService
unloadPredefinedSchema
in interface SchemaService
schemaStream
- inputStream of the schema to deletepublic void init()
public void destroy()
public void setPersistenceService(PersistenceService persistenceService)
public void setScopeService(ScopeService scopeService)
public void setJsonSchemaRefreshInterval(Integer jsonSchemaRefreshInterval)
Copyright © 2014–2023 Apache Software Foundation. All rights reserved.