Interface ExternalIntegrationProvider
-
- All Superinterfaces:
LearningTrackingProvider
public interface ExternalIntegrationProvider extends LearningTrackingProvider
-
-
Field Summary
Fields Modifier and Type Field Description static StringSESSION_IDThe recommended param key to use for sending in session ids in requests
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ObjectfetchEntity(String reference)<T> TfindService(Class<T> type)Allows services in the external system to be located (this is used to find external providers for overriding the default internal services)voidfireEvent(String eventName, String reference)Fires events from EB using an external event system
You can assume the eventName is not null and the reference has been validated and normalized
NOTE: if you have no way to handle external events then throwUnsupportedOperationException<T> TgetConfigurationSetting(String settingName, T defaultValue)Retrieves settings from the configuration service (sakai.properties)StringgetMaxJSONLevel()Gets the entitybroker.maxJSONLevel config string from sakai.properties via ServerConfigurationService.StringgetServerUrl()Gets the full server URL for the server which this is being used onStringhandleEntityError(HttpServletRequest req, Throwable error)Handles an error which occurs while processing an entity request, e.g. by sending an email and logging extra info about the failurevoidhandleUserSessionKey(HttpServletRequest req)Allows the external system to create a session based on a passed in session key (or other data in the request), no returns are necessary and this method can simple be left unimplemented if it is not used
Most likely all requests will not include session keys so you should not fail if one is not set in most cases-
Methods inherited from interface org.sakaiproject.entitybroker.entityprovider.extension.LearningTrackingProvider
registerStatement
-
-
-
-
Field Detail
-
SESSION_ID
static final String SESSION_ID
The recommended param key to use for sending in session ids in requests- See Also:
- Constant Field Values
-
-
Method Detail
-
findService
<T> T findService(Class<T> type)
Allows services in the external system to be located (this is used to find external providers for overriding the default internal services)- Type Parameters:
T-- Parameters:
type- the service API class- Returns:
- the service OR null if it does not exist
-
fireEvent
void fireEvent(String eventName, String reference)
Fires events from EB using an external event system
You can assume the eventName is not null and the reference has been validated and normalized
NOTE: if you have no way to handle external events then throwUnsupportedOperationException- Parameters:
eventName- a string which represents the name of the event (e.g. announcement.create), cannot be null or emptyreference- a globally unique reference to an entity, consists of the entity prefix and optionally the local id, cannot be null or empty- Throws:
IllegalArgumentException- if the event arguments are invalid or the event cannot be thrownUnsupportedOperationException- if the external system does not handle events
-
getServerUrl
String getServerUrl()
Gets the full server URL for the server which this is being used on- Returns:
- the full server URL (default: http://localhost:8080), should not include a trailing slash
- Throws:
UnsupportedOperationException- if the external system cannot handle this
-
getMaxJSONLevel
String getMaxJSONLevel()
Gets the entitybroker.maxJSONLevel config string from sakai.properties via ServerConfigurationService. Defaults to 7.
-
fetchEntity
Object fetchEntity(String reference)
Fetches a concrete object representing this entity reference from an external system
Note that this object may be aStringorMapand does not have to be a POJO, the type of object should be determined out of band
This should return null if the entity exists but has no available object- Parameters:
reference- a string representing a unique reference to an entity (e.g. /type/id/extra)- Returns:
- an object which represents the entity OR null if none can be found or this type does not support fetching
- Throws:
SecurityException- if the entity cannot be accessed by the current user or is not publicly accessibleIllegalArgumentException- if the reference is invalidUnsupportedOperationException- if the external system cannot handle thisIllegalStateException- if any other error occurs
-
handleEntityError
String handleEntityError(HttpServletRequest req, Throwable error)
Handles an error which occurs while processing an entity request, e.g. by sending an email and logging extra info about the failure- Parameters:
req- the current requesterror- the current error that occurred- Returns:
- the comprehensive error message to send back to the requester
- Throws:
UnsupportedOperationException- if the external system cannot handle this
-
handleUserSessionKey
void handleUserSessionKey(HttpServletRequest req)
Allows the external system to create a session based on a passed in session key (or other data in the request), no returns are necessary and this method can simple be left unimplemented if it is not used
Most likely all requests will not include session keys so you should not fail if one is not set in most cases- Parameters:
req- the request as it is coming in (before any other processing has occurred)- Throws:
IllegalArgumentException- if this request is invalid in some waySecurityException- if this request is not allowed for security reasons
-
getConfigurationSetting
<T> T getConfigurationSetting(String settingName, T defaultValue)
Retrieves settings from the configuration service (sakai.properties)- Parameters:
settingName- the name of the setting to retrieve, Should be a string name: e.g. auto.ddl, mystuff.config, etc.defaultValue- a specified default value to return if this setting cannot be found, NOTE: You can set the default value to null but you must specify the class type in parens- Returns:
- the value of the configuration setting OR the default value if none can be found
-
-