|
eXo WS :: REST :: Extentions 2.3.0-GA | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exoplatform.services.rest.ext.groovy.GroovyJaxrsPublisher
public class GroovyJaxrsPublisher
Manage via ResourceBinder Groovy based RESTful services.
| Field Summary | |
|---|---|
protected ResourceBinder |
binder
|
protected GroovyClassLoaderProvider |
classLoaderProvider
|
protected static Charset |
DEFAULT_CHARSET
Default character set. |
protected static String |
DEFAULT_CHARSET_NAME
Default character set name. |
protected org.exoplatform.services.script.groovy.GroovyScriptInstantiator |
instantiator
|
protected Map<ResourceId,String> |
resources
|
| Constructor Summary | |
|---|---|
GroovyJaxrsPublisher(ResourceBinder binder,
org.exoplatform.services.script.groovy.GroovyScriptInstantiator instantiator)
Create GroovyJaxrsPublisher which is able publish per-request and singleton resources. |
|
GroovyJaxrsPublisher(ResourceBinder binder,
org.exoplatform.services.script.groovy.GroovyScriptInstantiator instantiator,
GroovyClassLoaderProvider classLoaderProvider)
|
|
| Method Summary | |
|---|---|
protected groovy.lang.GroovyCodeSource |
createCodeSource(InputStream in,
String name)
Create GroovyCodeSource from given stream and name. |
protected Object |
createInstance(Class clazz)
|
groovy.lang.GroovyClassLoader |
getGroovyClassLoader()
Deprecated. |
ObjectFactory<AbstractResourceDescriptor> |
getResource(ResourceId resourceId)
Get resource corresponded to specified id resourceId . |
boolean |
isPublished(ResourceId resourceId)
Check is groovy resource with specified id is published or not |
void |
publishPerRequest(InputStream in,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties)
Parse given stream and publish result as per-request RESTful service. |
void |
publishPerRequest(InputStream in,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties,
SourceFolder[] src,
SourceFile[] files)
Parse given stream and publish result as per-request RESTful service. |
void |
publishPerRequest(String source,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties)
Parse given source and publish result as per-request RESTful
service. |
void |
publishPerRequest(String source,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties,
SourceFolder[] src,
SourceFile[] files)
Parse given source and publish result as per-request RESTful
service. |
void |
publishPerRequest(String source,
String charset,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties)
Parse given source and publish result as per-request RESTful
service. |
void |
publishPerRequest(String source,
String charset,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties,
SourceFolder[] src,
SourceFile[] files)
Parse given source and publish result as per-request RESTful
service. |
void |
publishSingleton(InputStream in,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties)
Parse given stream and publish result as singleton RESTful service. |
void |
publishSingleton(InputStream in,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties,
SourceFolder[] src,
SourceFile[] files)
Parse given stream and publish result as singleton RESTful service. |
void |
publishSingleton(String source,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties)
Parse given source and publish result as singleton RESTful
service. |
void |
publishSingleton(String source,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties,
SourceFolder[] src,
SourceFile[] files)
Parse given source and publish result as singleton RESTful
service. |
void |
publishSingleton(String source,
String charset,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties)
Parse given source and publish result as singleton RESTful
service. |
void |
publishSingleton(String source,
String charset,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties,
SourceFolder[] src,
SourceFile[] files)
Parse given source and publish result as singleton RESTful
service. |
void |
setGroovyClassLoader(groovy.lang.GroovyClassLoader gcl)
Deprecated. |
ObjectFactory<AbstractResourceDescriptor> |
unpublishResource(ResourceId resourceId)
Unpublish resource with specified id. |
void |
validateResource(InputStream in,
String name)
Validate does stream contain Groovy source code which is conforms with requirement to JAX-RS resource. |
void |
validateResource(InputStream in,
String name,
SourceFolder[] src,
SourceFile[] files)
Validate does stream contain Groovy source code which is conforms with requirement to JAX-RS resource. |
void |
validateResource(String source,
String name)
Validate does source contain Groovy source code which is
conforms with requirement to JAX-RS resource. |
void |
validateResource(String source,
String name,
SourceFolder[] src,
SourceFile[] files)
Validate does source contain Groovy source code which is
conforms with requirement to JAX-RS resource. |
void |
validateResource(String source,
String charset,
String name,
SourceFolder[] src,
SourceFile[] files)
Validate does source contain Groovy source code which is
conforms with requirement to JAX-RS resource. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String DEFAULT_CHARSET_NAME
protected static final Charset DEFAULT_CHARSET
protected final ResourceBinder binder
protected final org.exoplatform.services.script.groovy.GroovyScriptInstantiator instantiator
protected final GroovyClassLoaderProvider classLoaderProvider
protected final Map<ResourceId,String> resources
| Constructor Detail |
|---|
public GroovyJaxrsPublisher(ResourceBinder binder,
org.exoplatform.services.script.groovy.GroovyScriptInstantiator instantiator,
GroovyClassLoaderProvider classLoaderProvider)
public GroovyJaxrsPublisher(ResourceBinder binder,
org.exoplatform.services.script.groovy.GroovyScriptInstantiator instantiator)
PerRequestObjectFactory, instance of singleton
resources will be created by GroovyScriptInstantiator.
binder - resource binderinstantiator - instantiate java object from given groovy source| Method Detail |
|---|
@Deprecated public groovy.lang.GroovyClassLoader getGroovyClassLoader()
@Deprecated public void setGroovyClassLoader(groovy.lang.GroovyClassLoader gcl)
gcl - groovy class loader
NullPointerException - if gcl == nullpublic ObjectFactory<AbstractResourceDescriptor> getResource(ResourceId resourceId)
resourceId .
resourceId - resource id
nullpublic boolean isPublished(ResourceId resourceId)
resourceId - id of resource to be checked
true if resource is published and false
otherwise
public void publishPerRequest(InputStream in,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties)
in - stream which contains groovy source code of RESTful serviceresourceId - id to be assigned to resourceproperties - optional resource properties. This parameter may be
null
NullPointerException - if resourceId == null
ResourcePublicationException - see
ResourceBinder.addResource(Class, MultivaluedMap)
org.codehaus.groovy.control.CompilationFailedException - if compilation fails from source errors
public void publishPerRequest(InputStream in,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties,
SourceFolder[] src,
SourceFile[] files)
in - stream which contains Groovy source code of RESTful serviceresourceId - id to be assigned to resourceproperties - optional resource properties. This parameter may be
nullsrc - additional path to Groovy sourcesfiles - Groovy source files to be added in build path directly
NullPointerException - if resourceId == null
ResourcePublicationException - see
ResourceBinder.addResource(Class, MultivaluedMap)
org.codehaus.groovy.control.CompilationFailedException - if compilation fails from source errors
public final void publishPerRequest(String source,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties)
source and publish result as per-request RESTful
service.
source - groovy source code of RESTful serviceresourceId - id to be assigned to resourceproperties - optional resource properties. This parameter may be
null
NullPointerException - if resourceId == null
ResourcePublicationException - see
ResourceBinder.addResource(Class, MultivaluedMap)
org.codehaus.groovy.control.CompilationFailedException - if compilation fails from source errors
public final void publishPerRequest(String source,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties,
SourceFolder[] src,
SourceFile[] files)
source and publish result as per-request RESTful
service.
source - groovy source code of RESTful serviceresourceId - id to be assigned to resourceproperties - optional resource properties. This parameter may be
nullsrc - additional path to Groovy sourcesfiles - Groovy source files to be added in build path directly
NullPointerException - if resourceId == null
ResourcePublicationException - see
ResourceBinder.addResource(Class, MultivaluedMap)
org.codehaus.groovy.control.CompilationFailedException - if compilation fails from source errors
public final void publishPerRequest(String source,
String charset,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties)
source and publish result as per-request RESTful
service.
source - groovy source code of RESTful servicecharset - source string charset. May be null than
default charset will be in useresourceId - id to be assigned to resourceproperties - optional resource properties. This parameter may be
null.
UnsupportedCharsetException - if charset is unsupported
NullPointerException - if resourceId == null
ResourcePublicationException - see
ResourceBinder.addResource(Class, MultivaluedMap)
org.codehaus.groovy.control.CompilationFailedException - if compilation fails from source errors
public final void publishPerRequest(String source,
String charset,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties,
SourceFolder[] src,
SourceFile[] files)
source and publish result as per-request RESTful
service.
source - groovy source code of RESTful servicecharset - source string charset. May be null than
default charset will be in useresourceId - id to be assigned to resourceproperties - optional resource properties. This parameter may be
null.src - additional path to Groovy sourcesfiles - Groovy source files to be added in build path directly
UnsupportedCharsetException - if charset is unsupported
NullPointerException - if resourceId == null
ResourcePublicationException - see
ResourceBinder.addResource(Class, MultivaluedMap)
org.codehaus.groovy.control.CompilationFailedException - if compilation fails from source errors
public void publishSingleton(InputStream in,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties)
in - stream which contains groovy source code of RESTful serviceresourceId - id to be assigned to resourceproperties - optional resource properties. This parameter may be
null
NullPointerException - if resourceId == null
ResourcePublicationException - see
ResourceBinder.addResource(Object, MultivaluedMap)
org.codehaus.groovy.control.CompilationFailedException - if compilation fails from source errors
public void publishSingleton(InputStream in,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties,
SourceFolder[] src,
SourceFile[] files)
in - stream which contains groovy source code of RESTful serviceresourceId - id to be assigned to resourceproperties - optional resource properties. This parameter may be
nullsrc - additional path to Groovy sourcesfiles - Groovy source files to be added in build path directly
NullPointerException - if resourceId == null
ResourcePublicationException - see
ResourceBinder.addResource(Object, MultivaluedMap)
org.codehaus.groovy.control.CompilationFailedException - if compilation fails from source errors
public final void publishSingleton(String source,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties)
source and publish result as singleton RESTful
service.
source - groovy source code of RESTful serviceresourceId - name of resourceproperties - optional resource properties. This parameter may be
null.
NullPointerException - if resourceId == null
ResourcePublicationException - see
ResourceBinder.addResource(Object, MultivaluedMap)
org.codehaus.groovy.control.CompilationFailedException - if compilation fails from source errors
public final void publishSingleton(String source,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties,
SourceFolder[] src,
SourceFile[] files)
source and publish result as singleton RESTful
service.
source - groovy source code of RESTful serviceresourceId - name of resourceproperties - optional resource properties. This parameter may be
null.src - additional path to Groovy sourcesfiles - Groovy source files to be added in build path directly
NullPointerException - if resourceId == null
ResourcePublicationException - see
ResourceBinder.addResource(Object, MultivaluedMap)
org.codehaus.groovy.control.CompilationFailedException - if compilation fails from source errors
public final void publishSingleton(String source,
String charset,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties)
source and publish result as singleton RESTful
service.
source - groovy source code of RESTful servicecharset - source string charset. May be null than
default charset will be in useresourceId - name of resourceproperties - optional resource properties. This parameter may be
null.
UnsupportedCharsetException - if charset is unsupported
NullPointerException - if resourceId == null
ResourcePublicationException - see
ResourceBinder.addResource(Object, MultivaluedMap)
org.codehaus.groovy.control.CompilationFailedException - if compilation fails from source errors
public final void publishSingleton(String source,
String charset,
ResourceId resourceId,
javax.ws.rs.core.MultivaluedMap<String,String> properties,
SourceFolder[] src,
SourceFile[] files)
source and publish result as singleton RESTful
service.
source - groovy source code of RESTful servicecharset - source string charset. May be null than
default charset will be in useresourceId - name of resourceproperties - optional resource properties. This parameter may be
null.src - additional path to Groovy sourcesfiles - Groovy source files to be added in build path directly
UnsupportedCharsetException - if charset is unsupported
NullPointerException - if resourceId == null
ResourcePublicationException - see
ResourceBinder.addResource(Object, MultivaluedMap)
org.codehaus.groovy.control.CompilationFailedException - if compilation fails from source errorspublic ObjectFactory<AbstractResourceDescriptor> unpublishResource(ResourceId resourceId)
resourceId - id of resource to be unpublished
true if resource was published and false
otherwise, e.g. because there is not resource corresponded to
supplied resourceId
public void validateResource(InputStream in,
String name,
SourceFolder[] src,
SourceFile[] files)
throws MalformedScriptException
in - Groovy source streamname - script name. This name will be used by GroovyClassLoader to
identify script, e.g. specified name will be used in error
message in compilation of Groovy fails. If this parameter is
null then GroovyClassLoader will use automatically
generated namesrc - additional path to Groovy sourcesfiles - Groovy source files to be added in build path directly
MalformedScriptException - if source has errors or there is no
required JAX-RS annotation
public void validateResource(InputStream in,
String name)
throws MalformedScriptException
in - Groovy source streamname - script name. This name will be used by GroovyClassLoader to
identify script, e.g. specified name will be used in error
message in compilation of Groovy fails. If this parameter is
null then GroovyClassLoader will use automatically
generated name
MalformedScriptException - if source has errors or there is no
required JAX-RS annotation
public final void validateResource(String source,
String charset,
String name,
SourceFolder[] src,
SourceFile[] files)
throws MalformedScriptException
source contain Groovy source code which is
conforms with requirement to JAX-RS resource.
source - Groovy source code as Stringcharset - source string charset. May be null than
default charset will be in usename - script name. This name will be used by GroovyClassLoader to
identify script, e.g. specified name will be used in error
message in compilation of Groovy fails. If this parameter is
null then GroovyClassLoader will use automatically
generated namesrc - additional path to Groovy sourcesfiles - Groovy source files to be added in build path directly
MalformedScriptException - if source has errors or there is no
required JAX-RS annotation
public final void validateResource(String source,
String name,
SourceFolder[] src,
SourceFile[] files)
throws MalformedScriptException
source contain Groovy source code which is
conforms with requirement to JAX-RS resource.
source - Groovy source code as Stringname - script name. This name will be used by GroovyClassLoader to
identify script, e.g. specified name will be used in error
message in compilation of Groovy fails. If this parameter is
null then GroovyClassLoader will use automatically
generated namesrc - additional path to Groovy sourcesfiles - Groovy source files to be added in build path directly
MalformedScriptException - if source has errors or there is no
required JAX-RS annotation
public final void validateResource(String source,
String name)
throws MalformedScriptException
source contain Groovy source code which is
conforms with requirement to JAX-RS resource.
source - Groovy source code as Stringname - script name. This name will be used by GroovyClassLoader to
identify script, e.g. specified name will be used in error
message in compilation of Groovy fails. If this parameter is
null then GroovyClassLoader will use automatically
generated name
MalformedScriptException - if source has errors or there is no
required JAX-RS annotation
protected Object createInstance(Class clazz)
throws IllegalArgumentException,
InstantiationException,
IllegalAccessException,
InvocationTargetException
IllegalArgumentException
InstantiationException
IllegalAccessException
InvocationTargetException
protected groovy.lang.GroovyCodeSource createCodeSource(InputStream in,
String name)
GroovyCodeSource from given stream and name. Code base
'file:/groovy/script/jaxrs' will be used.
in - groovy source code streamname - code source name
|
eXo WS :: REST :: Extentions 2.3.0-GA | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||