public class SameAsService extends AbstractTopicWebApp
SameAsService implements a simple web service that returns all subject identifiers of a given topic. Given topic is recognized with a single subject identifier given in URL parameter.
The response format is similar to the JSON response format of the sameAs.org service. Thus, Wandora can be used as a part of LOD machinery, a web service returning similar URIs.
Wandora features a subject expander, SameAsAnywhereSubjectExpander, that can be used to retrieve subjects provided by the SameAsService.
Modifier and Type | Class and Description |
---|---|
protected class |
SameAsService.SameAs
SameAs is a helper class to store the URL and all similar URLs.
|
tmManager
appStartPage, topicRequestKey, webAppName
actionParamKey, handledActions, httpHeaders, isDefaultAction, replacements, replacementsInitialized, servletModule
engine, initScript, persistentObjects, scriptManager, startScript, stopScript
autoStart, isInitialized, isRunning, logging, loggingModule, moduleManager
Constructor and Description |
---|
SameAsService() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
encodeJSON(java.lang.String string) |
protected SameAsService.SameAs |
getSameAs(java.lang.String u,
Topic t) |
boolean |
handleAction(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
ModulesServlet.HttpMethod method,
java.lang.String action,
User user)
Handles this action.
|
void |
init(ModuleManager manager,
java.util.HashMap<java.lang.String,java.lang.Object> settings)
Initialises the module.
|
protected java.lang.String |
makeJSON(SameAsService.SameAs sameas) |
Topic |
resolveTopic(java.lang.String query) |
getDependencies, start, stop
getAppName, getAppStartPage, getAppTopicPage
addHandledAction, doReplacements, handleRequest, isHandleAction, setActionParamKey, setHttpHeaders
getScriptEngine
isInitialized, isRunning, requireLogging, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isInitialized, isRunning
public void init(ModuleManager manager, java.util.HashMap<java.lang.String,java.lang.Object> settings) throws ModuleException
Module
Initialises the module. After constructor, this is the first method called in the life cycle of a module. It should not perform anything time consuming or anything with notable outside side effects. It should only read the parameters and initialise the module so that it can later be started. Note that a module being initialised doesn't mean that it necessarily will ever be started.
A ModuleException may be thrown if something vital is missing from the parameters or they are not sensible. In some cases you may not want to throw an exception even if vital initialisation information is missing. If, for example, it is possible that the module is initialised in some other way between the init and the start method calls. A ModuleException may also be thrown at the start method if the module is still not initialised.
init
in interface Module
init
in class AbstractWebApp
manager
- The module manager handling this module. You may keep a
reference to it if needed.ModuleException
public boolean handleAction(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, ModulesServlet.HttpMethod method, java.lang.String action, User user) throws javax.servlet.ServletException, java.io.IOException, ActionException
AbstractAction
handleAction
in class AbstractAction
req
- The HTTP Request.resp
- The HTTP response.method
- The HTTP method of the request.action
- The parsed action id.user
- The logged in user, or null if not applicable.javax.servlet.ServletException
java.io.IOException
ActionException
public Topic resolveTopic(java.lang.String query)
resolveTopic
in class AbstractTopicWebApp
protected java.lang.String makeJSON(SameAsService.SameAs sameas)
protected SameAsService.SameAs getSameAs(java.lang.String u, Topic t) throws TopicMapException
TopicMapException
protected java.lang.String encodeJSON(java.lang.String string)
Copyright 2004-2015 Wandora Team