Package jadex.extension.rs.publish
Class AbstractRestServicePublishService
- java.lang.Object
-
- jadex.extension.rs.publish.AbstractRestServicePublishService
-
- All Implemented Interfaces:
IPublishService
,IWebPublishService
- Direct Known Subclasses:
GrizzlyRestServicePublishService
public abstract class AbstractRestServicePublishService extends java.lang.Object implements IWebPublishService
The default web service publish service. Publishes web services using the JDK Endpoint class.
-
-
Field Summary
Fields Modifier and Type Field Description protected IInternalAccess
component
The component.static javax.ws.rs.core.MediaType[]
DEFAULT_FORMATS
The default media formats.static java.lang.String
FORMATS
Constant for String[] for supported parameter media types.static java.lang.String
GENERATE
Constant for boolean flag if automatic generation should be used.static java.lang.String
GENERATE_INFO
Constant for boolean.protected IRestMethodGenerator
generator
The generator.static java.lang.String
JADEXSERVICE
The service constant.protected LRU<Tuple2<java.lang.Class<?>,java.lang.Class<?>>,java.lang.Class<?>>
proxyclasses
The proxy classes.-
Fields inherited from interface jadex.bridge.service.types.publish.IPublishService
DEFAULT_RSPUBLISH_COMPONENTS, PUBLISH_RS, PUBLISH_WS
-
-
Constructor Summary
Constructors Constructor Description AbstractRestServicePublishService()
Create a new publish service.AbstractRestServicePublishService(IRestMethodGenerator generator)
Create a new publish service.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.lang.Integer
addMapping(java.lang.String url, java.lang.String name, java.lang.String target, java.lang.String cookie)
protected java.lang.Class<?>
createProxyClass(IServiceIdentifier serviceid, java.lang.ClassLoader classloader, java.lang.Class<?> baseclass, java.util.Map<java.lang.String,java.lang.Object> mapprops, java.util.List<RestMethodInfo> geninfos)
Create a service proxy class.static byte[]
digest(byte[] input)
Build the digest given the timestamp and password.static byte[]
digest(java.lang.String input)
Build the digest given the timestamp and password.protected java.lang.Class<?>
getProxyClass(IServiceIdentifier serviceid, java.lang.ClassLoader classloader, java.lang.Class<?> baseclass, java.util.Map<java.lang.String,java.lang.Object> mapprops)
Get or generate a proxy class.java.lang.Object
getServiceInfo(java.lang.Object[] params, java.lang.String sig)
Functionality blueprint for get service info web method.static java.lang.String
hex(byte[] data)
Convert to hex value.java.lang.Void
initWebProxyRefresh(java.lang.String url, java.lang.String name, java.lang.String target, java.lang.String user, java.lang.String pass, IServiceIdentifier sid)
abstract void
internalPublishService(java.net.URI uri, org.glassfish.jersey.server.ResourceConfig rc, IServiceIdentifier sid, PublishInfo info)
java.lang.Object
invoke(java.lang.Object[] params, java.lang.String sig)
Method that is invoked when rest service is called.abstract boolean
isPublished(IServiceIdentifier sid)
Test if a service is published.IFuture<java.lang.Boolean>
isSupported(java.lang.String publishtype)
Test if publishing a specific type is supported (e.g. web service).protected java.lang.String
login(java.lang.String url, java.lang.String user, java.lang.String pass)
protected java.util.Map<java.lang.String,java.lang.String>
parseHeader(java.lang.String header, java.lang.String delims)
Convert header to key value pairs.abstract IFuture<java.lang.Void>
publishExternal(java.net.URI uri, java.lang.String rootpath)
Publish file resources from the file system.abstract IFuture<java.lang.Void>
publishHMTLPage(java.lang.String uri, java.lang.String vhost, java.lang.String html)
Publish an html page.abstract IFuture<java.lang.Void>
publishResources(java.lang.String uri, java.lang.String path)
Publish resources via a rel jar path.IFuture<java.lang.Void>
publishService(IServiceIdentifier serviceid, PublishInfo pi)
Publish a service.abstract IFuture<java.lang.Void>
unpublishService(IServiceIdentifier sid)
Unpublish a service.
-
-
-
Field Detail
-
GENERATE
public static final java.lang.String GENERATE
Constant for boolean flag if automatic generation should be used.- See Also:
- Constant Field Values
-
FORMATS
public static final java.lang.String FORMATS
Constant for String[] for supported parameter media types.- See Also:
- Constant Field Values
-
GENERATE_INFO
public static final java.lang.String GENERATE_INFO
Constant for boolean.- See Also:
- Constant Field Values
-
DEFAULT_FORMATS
public static final javax.ws.rs.core.MediaType[] DEFAULT_FORMATS
The default media formats.
-
JADEXSERVICE
public static final java.lang.String JADEXSERVICE
The service constant.- See Also:
- Constant Field Values
-
component
protected IInternalAccess component
The component.
-
generator
protected IRestMethodGenerator generator
The generator.
-
-
Constructor Detail
-
AbstractRestServicePublishService
public AbstractRestServicePublishService()
Create a new publish service.
-
AbstractRestServicePublishService
public AbstractRestServicePublishService(IRestMethodGenerator generator)
Create a new publish service.
-
-
Method Detail
-
isSupported
public IFuture<java.lang.Boolean> isSupported(java.lang.String publishtype)
Test if publishing a specific type is supported (e.g. web service).- Specified by:
isSupported
in interfaceIPublishService
- Parameters:
publishtype
- The type to test.- Returns:
- True, if can be published.
-
getProxyClass
protected java.lang.Class<?> getProxyClass(IServiceIdentifier serviceid, java.lang.ClassLoader classloader, java.lang.Class<?> baseclass, java.util.Map<java.lang.String,java.lang.Object> mapprops) throws java.lang.Exception
Get or generate a proxy class.- Throws:
java.lang.Exception
-
publishService
public IFuture<java.lang.Void> publishService(IServiceIdentifier serviceid, PublishInfo pi)
Publish a service.- Specified by:
publishService
in interfaceIPublishService
- Parameters:
cl
- The classloader.service
- The original service.pid
- The publish id (e.g. url or name).
-
unpublishService
public abstract IFuture<java.lang.Void> unpublishService(IServiceIdentifier sid)
Unpublish a service.- Specified by:
unpublishService
in interfaceIPublishService
- Parameters:
sid
- The service identifier.
-
internalPublishService
public abstract void internalPublishService(java.net.URI uri, org.glassfish.jersey.server.ResourceConfig rc, IServiceIdentifier sid, PublishInfo info)
-
publishHMTLPage
public abstract IFuture<java.lang.Void> publishHMTLPage(java.lang.String uri, java.lang.String vhost, java.lang.String html)
Publish an html page.- Specified by:
publishHMTLPage
in interfaceIWebPublishService
-
publishResources
public abstract IFuture<java.lang.Void> publishResources(java.lang.String uri, java.lang.String path)
Publish resources via a rel jar path. The resources are searched with respect to the component classloader (todo: allow for specifiying RID).- Specified by:
publishResources
in interfaceIWebPublishService
-
publishExternal
public abstract IFuture<java.lang.Void> publishExternal(java.net.URI uri, java.lang.String rootpath)
Publish file resources from the file system.
-
createProxyClass
protected java.lang.Class<?> createProxyClass(IServiceIdentifier serviceid, java.lang.ClassLoader classloader, java.lang.Class<?> baseclass, java.util.Map<java.lang.String,java.lang.Object> mapprops, java.util.List<RestMethodInfo> geninfos) throws java.lang.Exception
Create a service proxy class.- Parameters:
service
- The Jadex service.classloader
- The classloader.type
- The web service interface type.- Returns:
- The proxy object.
- Throws:
java.lang.Exception
-
initWebProxyRefresh
public java.lang.Void initWebProxyRefresh(java.lang.String url, java.lang.String name, java.lang.String target, java.lang.String user, java.lang.String pass, IServiceIdentifier sid)
-
login
protected java.lang.String login(java.lang.String url, java.lang.String user, java.lang.String pass)
-
addMapping
protected java.lang.Integer addMapping(java.lang.String url, java.lang.String name, java.lang.String target, java.lang.String cookie)
-
invoke
public java.lang.Object invoke(java.lang.Object[] params, java.lang.String sig)
Method that is invoked when rest service is called. Functionality blueprint for all service methods.- Parameters:
params
- The parameters.- Returns:
- The result.
-
getServiceInfo
public java.lang.Object getServiceInfo(java.lang.Object[] params, java.lang.String sig)
Functionality blueprint for get service info web method. Creates a html page with css for style and javascript for ajax post requests. The service info site contains a section for each published method.- Parameters:
params
- The parameters.- Returns:
- The result.
-
isPublished
public abstract boolean isPublished(IServiceIdentifier sid)
Test if a service is published.
-
hex
public static java.lang.String hex(byte[] data)
Convert to hex value.
-
digest
public static byte[] digest(java.lang.String input)
Build the digest given the timestamp and password.
-
digest
public static byte[] digest(byte[] input)
Build the digest given the timestamp and password.
-
parseHeader
protected java.util.Map<java.lang.String,java.lang.String> parseHeader(java.lang.String header, java.lang.String delims)
Convert header to key value pairs.
-
-