public class XtextServiceDispatcher
extends java.lang.Object
getService(IServiceContext)
to obtain a XtextServiceDispatcher.ServiceDescriptor for a client request. The service
descriptor has some metadata that may influence the message format expected for the request, and
may lead to a rejection of the request.
A typical usage can look like this:
val serviceDispatcher = injector.getInstance(XtextServiceDispatcher) val serviceDescriptor = serviceDispatcher.getService(serviceContext) // Check whether the service metadata fits to the request format ... val result = serviceDescriptor.service.apply() // Serialize and send the result back to the client ...
| Modifier and Type | Class and Description |
|---|---|
static class |
XtextServiceDispatcher.ServiceDescriptor
Service metadata, including a function for actually invoking the service.
|
| Constructor and Description |
|---|
XtextServiceDispatcher() |
| Modifier and Type | Method and Description |
|---|---|
protected ServiceConflictResult |
_handleError(XtextServiceDispatcher.ServiceDescriptor service,
InvalidRequestException.InvalidDocumentStateException exception) |
protected ServiceConflictResult |
_handleError(XtextServiceDispatcher.ServiceDescriptor service,
java.lang.Throwable throwable) |
protected XtextServiceDispatcher.ServiceDescriptor |
createServiceDescriptor(java.lang.String serviceType,
IServiceContext context)
Do the actual dispatching by delegating to a service descriptor creation method depending on the service type.
|
protected boolean |
getBoolean(IServiceContext context,
java.lang.String key,
com.google.common.base.Optional<java.lang.Boolean> defaultValue)
Read a Boolean-valued parameter.
|
protected XtextServiceDispatcher.ServiceDescriptor |
getContentAssistService(IServiceContext context) |
protected XtextWebDocumentAccess |
getDocumentAccess(IServiceContext context)
Retrieve the document access for the given service context.
|
protected XtextServiceDispatcher.ServiceDescriptor |
getFormattingService(IServiceContext context) |
protected XtextWebDocument |
getFullTextDocument(java.lang.String fullText,
java.lang.String resourceId,
IServiceContext context)
Create a new document containing the given text.
|
protected XtextServiceDispatcher.ServiceDescriptor |
getGeneratorService(IServiceContext context) |
protected XtextServiceDispatcher.ServiceDescriptor |
getHighlightingService(IServiceContext context) |
protected XtextServiceDispatcher.ServiceDescriptor |
getHoverService(IServiceContext context) |
protected int |
getInt(IServiceContext context,
java.lang.String key,
com.google.common.base.Optional<java.lang.Integer> defaultValue)
Read an integer-valued parameter.
|
protected XtextServiceDispatcher.ServiceDescriptor |
getLoadResourceService(boolean revert,
IServiceContext context) |
protected XtextServiceDispatcher.ServiceDescriptor |
getOccurrencesService(IServiceContext context) |
protected XtextWebDocument |
getResourceDocument(java.lang.String resourceId,
IServiceContext context)
Obtain a document from the session store, and if it is not present there, ask the
IServerResourceHandler to provide it. |
protected java.lang.String |
getResourceID(IServiceContext context)
Returns the resource ID from the service context.
|
protected XtextServiceDispatcher.ServiceDescriptor |
getSaveResourceService(IServiceContext context) |
XtextServiceDispatcher.ServiceDescriptor |
getService(IServiceContext context)
Create a service descriptor according to the parameters given in the service context.
|
protected java.lang.String |
getString(IServiceContext context,
java.lang.String key,
com.google.common.base.Optional<java.lang.String> defaultValue)
Read an string-valued parameter.
|
protected XtextServiceDispatcher.ServiceDescriptor |
getUpdateDocumentService(IServiceContext context) |
protected XtextServiceDispatcher.ServiceDescriptor |
getValidationService(IServiceContext context) |
protected ServiceConflictResult |
handleError(XtextServiceDispatcher.ServiceDescriptor service,
java.lang.Throwable exception) |
protected void |
registerPreComputedServices(PrecomputedServiceRegistry registry) |
@Inject protected void registerPreComputedServices(PrecomputedServiceRegistry registry)
public XtextServiceDispatcher.ServiceDescriptor getService(IServiceContext context) throws InvalidRequestException
InvalidRequestExceptionprotected XtextServiceDispatcher.ServiceDescriptor createServiceDescriptor(java.lang.String serviceType, IServiceContext context)
protected XtextServiceDispatcher.ServiceDescriptor getLoadResourceService(boolean revert, IServiceContext context) throws InvalidRequestException
InvalidRequestExceptionprotected XtextServiceDispatcher.ServiceDescriptor getSaveResourceService(IServiceContext context) throws InvalidRequestException
InvalidRequestExceptionprotected XtextServiceDispatcher.ServiceDescriptor getUpdateDocumentService(IServiceContext context) throws InvalidRequestException
InvalidRequestExceptionprotected XtextServiceDispatcher.ServiceDescriptor getContentAssistService(IServiceContext context) throws InvalidRequestException
InvalidRequestExceptionprotected XtextServiceDispatcher.ServiceDescriptor getValidationService(IServiceContext context) throws InvalidRequestException
InvalidRequestExceptionprotected XtextServiceDispatcher.ServiceDescriptor getHoverService(IServiceContext context) throws InvalidRequestException
InvalidRequestExceptionprotected XtextServiceDispatcher.ServiceDescriptor getHighlightingService(IServiceContext context) throws InvalidRequestException
InvalidRequestExceptionprotected XtextServiceDispatcher.ServiceDescriptor getOccurrencesService(IServiceContext context) throws InvalidRequestException
InvalidRequestExceptionprotected XtextServiceDispatcher.ServiceDescriptor getFormattingService(IServiceContext context) throws InvalidRequestException
InvalidRequestExceptionFormatterPreferenceKeysprotected XtextServiceDispatcher.ServiceDescriptor getGeneratorService(IServiceContext context) throws InvalidRequestException
InvalidRequestExceptionprotected XtextWebDocumentAccess getDocumentAccess(IServiceContext context) throws InvalidRequestException
InvalidRequestExceptionprotected java.lang.String getResourceID(IServiceContext context)
protected XtextWebDocument getFullTextDocument(java.lang.String fullText, java.lang.String resourceId, IServiceContext context)
protected XtextWebDocument getResourceDocument(java.lang.String resourceId, IServiceContext context)
IServerResourceHandler to provide it. In case that resource handler fails
to provide the document, null is returned instead.protected java.lang.String getString(IServiceContext context, java.lang.String key, com.google.common.base.Optional<java.lang.String> defaultValue) throws InvalidRequestException.InvalidParametersException
defaultValue is returned.InvalidRequestException.InvalidParametersException - if the parameter
is not available and defaultValue is absentprotected int getInt(IServiceContext context, java.lang.String key, com.google.common.base.Optional<java.lang.Integer> defaultValue) throws InvalidRequestException.InvalidParametersException
defaultValue is returned.InvalidRequestException.InvalidParametersException - if the parameter
is not available and defaultValue is absentprotected boolean getBoolean(IServiceContext context, java.lang.String key, com.google.common.base.Optional<java.lang.Boolean> defaultValue) throws InvalidRequestException.InvalidParametersException
defaultValue is returned.InvalidRequestException.InvalidParametersException - if the parameter
is not available and defaultValue is absentprotected ServiceConflictResult _handleError(XtextServiceDispatcher.ServiceDescriptor service, java.lang.Throwable throwable)
protected ServiceConflictResult _handleError(XtextServiceDispatcher.ServiceDescriptor service, InvalidRequestException.InvalidDocumentStateException exception)
protected ServiceConflictResult handleError(XtextServiceDispatcher.ServiceDescriptor service, java.lang.Throwable exception)