Package org.intermine.client.core
Class ServiceFactory
- java.lang.Object
-
- org.intermine.client.core.ServiceFactory
-
public class ServiceFactory extends java.lang.Object
The Class that should be used for creating services. You should never need to create instances of service classes directly with their constructors - it is simpler to use this factory. This factory deals with constructing services with the correct relative paths.Usage:
ServiceFactory serviceFactory = new ServiceFactory("https://www.flymine.org/flymine/service", "MyApp") QueryService queryService = serviceFactory.getQueryService() ...
Proxy settings:
To configure access through a proxy, ensure that the following Java system properties have been set:http.proxyServer
(eg: "123.456.78.90")http.proxyPort
(eg: "8080", Optional)
-
-
Constructor Summary
Constructors Constructor Description ServiceFactory(java.lang.String rootUrl)
Construct a service factory with a default application name.ServiceFactory(java.lang.String rootUrl, java.lang.String token)
Construct a factory for gaining access to specific resources.ServiceFactory(java.lang.String rootUrl, java.lang.String userName, java.lang.String userPass)
Deprecated.This method causes username and password information to be insecurely transmitted over HTTP connections.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ListService
getListService()
Return a new ListService for getting getting list information from.org.intermine.metadata.Model
getModel()
A convenience method to getting a model (used widely throughout the API).ModelService
getModelService()
Return a new ModelService for retrieving the data model.QueryService
getQueryService()
Return a new QueryService for getting query results from.Service
getService(java.lang.String serviceRelativeUrl, java.lang.String name)
Creates a new service for general use.TemplateService
getTemplateService()
Return a new QueryService for getting query results from.WidgetService
getWidgetService()
Return the WidgetService for retrieving widget information.void
setApplicationName(java.lang.String name)
Set the application name used to identify your requests to the server.
-
-
-
Constructor Detail
-
ServiceFactory
public ServiceFactory(java.lang.String rootUrl)
Construct a service factory with a default application name. (defaults to "InterMine-WS-Client-Java-$VERSION")- Parameters:
rootUrl
- the base URL for all services, it is the prefix common to all services. Example: http://www.flymine.org/flymine/service
-
ServiceFactory
public ServiceFactory(java.lang.String rootUrl, java.lang.String token)
Construct a factory for gaining access to specific resources. Allows you to set the root url and the authorization token. Use this constructor if you need to access private restricted-access resources.- Parameters:
rootUrl
- the base URL for all services, it is the prefix common to all services. Example: http://www.flymine.org/flymine/servicetoken
- the authorization token.
-
ServiceFactory
@Deprecated public ServiceFactory(java.lang.String rootUrl, java.lang.String userName, java.lang.String userPass)
Deprecated.This method causes username and password information to be insecurely transmitted over HTTP connections. Use the token authentication mechanism instead.Construct a factory for gaining access to specific resources. Allows you to set the root url and the authorization token. Use this constructor if you need to access private restricted-access resources.- Parameters:
rootUrl
- the base URL for all services, it is the prefix common to all services. Example: http://www.flymine.org/flymine/serviceuserName
- your user account name (usually an email address)userPass
- your user account password, in plain text. Please do not use this constructor unless you absolutely have to. Token identification is preferred
-
-
Method Detail
-
setApplicationName
public void setApplicationName(java.lang.String name)
Set the application name used to identify your requests to the server. * @param name application name
-
getQueryService
public QueryService getQueryService()
Return a new QueryService for getting query results from.- Returns:
- query service
-
getTemplateService
public TemplateService getTemplateService()
Return a new QueryService for getting query results from.- Returns:
- template service
-
getListService
public ListService getListService()
Return a new ListService for getting getting list information from.- Returns:
- list service
-
getModelService
public ModelService getModelService()
Return a new ModelService for retrieving the data model.- Returns:
- model service
-
getModel
public org.intermine.metadata.Model getModel()
A convenience method to getting a model (used widely throughout the API). This method also allows us to not violate the law of Demeter in many ugly ways.- Returns:
- the data model for the service we are attached to.
-
getService
public Service getService(java.lang.String serviceRelativeUrl, java.lang.String name)
Creates a new service for general use. You very likely won't want to use this, unless you know exactly what resource you are requesting.- Parameters:
serviceRelativeUrl
- the part of the URL specific to this service Example: query/resultsname
- application name, information for server which application uses this service- Returns:
- the created service
-
getWidgetService
public WidgetService getWidgetService()
Return the WidgetService for retrieving widget information.- Returns:
- widget service
-
-