|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.repo.processor.BaseProcessor
org.alfresco.repo.jscript.RhinoScriptProcessor
public class RhinoScriptProcessor
Implementation of the ScriptProcessor using the Rhino JavaScript library.
Field Summary |
---|
Fields inherited from class org.alfresco.repo.processor.BaseProcessor |
---|
extension, name, processorExtensions, scriptService, services, templateService |
Constructor Summary | |
---|---|
RhinoScriptProcessor()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Pre initializes two scope objects (one secure and one not) with the standard objects preinitialised. |
java.lang.Object |
execute(org.alfresco.service.cmr.repository.NodeRef nodeRef,
org.alfresco.service.namespace.QName contentProp,
java.util.Map model)
Execute script |
java.lang.Object |
execute(ScriptLocation location,
java.util.Map model)
Execute script |
java.lang.Object |
execute(java.lang.String location,
java.util.Map model)
Execute script |
java.lang.Object |
executeString(java.lang.String source,
java.util.Map model)
Execute script string |
protected org.mozilla.javascript.Scriptable |
initScope(org.mozilla.javascript.Context cx,
boolean secure,
boolean sealed)
Initializes a scope for script execution. |
java.lang.String |
loadScriptResource(java.lang.String resource)
Load a script content from the specific resource path. |
void |
reset()
Reset the processor - such as clearing any internal caches etc. |
void |
setCompile(boolean compile)
|
void |
setShareSealedScopes(boolean shareSealedScopes)
|
void |
setStorePath(java.lang.String storePath)
|
void |
setStoreUrl(java.lang.String storeRef)
Set the default store reference |
Methods inherited from class org.alfresco.repo.processor.BaseProcessor |
---|
getExtension, getName, getProcessorExtensions, register, registerProcessorExtension, setExtension, setName, setScriptService, setServiceRegistry, setTemplateService |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.alfresco.processor.Processor |
---|
getExtension, getName, registerProcessorExtension |
Constructor Detail |
---|
public RhinoScriptProcessor()
Method Detail |
---|
public void setStoreUrl(java.lang.String storeRef)
storeRef
- The default store referencepublic void setStorePath(java.lang.String storePath)
storePath
- The store path to set.public void setCompile(boolean compile)
compile
- the compile flag to setpublic void setShareSealedScopes(boolean shareSealedScopes)
shareSealedScopes
- true to allow sharing of sealed scopes between script executions - set to
false to disable this feature and ensure that a new scope is created for each executed script.public void reset()
ScriptProcessor
reset
in interface ScriptProcessor
ScriptProcessor.reset()
public java.lang.Object execute(ScriptLocation location, java.util.Map model)
ScriptProcessor
execute
in interface ScriptProcessor
location
- the location of the scriptmodel
- context model
ScriptProcessor.execute(org.alfresco.service.cmr.repository.ScriptLocation, java.util.Map)
public java.lang.Object execute(java.lang.String location, java.util.Map model)
ScriptProcessor
execute
in interface ScriptProcessor
location
- the classpath string locating the scriptmodel
- the context model
ScriptProcessor.execute(java.lang.String, java.util.Map)
public java.lang.Object execute(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName contentProp, java.util.Map model)
ScriptProcessor
execute
in interface ScriptProcessor
nodeRef
- the script node referencecontentProp
- the content property of the scriptmodel
- the context model
ScriptProcessor.execute(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName, java.util.Map)
public java.lang.Object executeString(java.lang.String source, java.util.Map model)
ScriptProcessor
executeString
in interface ScriptProcessor
source
- the script stringmodel
- the context model
ScriptProcessor.executeString(java.lang.String, java.util.Map)
public java.lang.String loadScriptResource(java.lang.String resource)
loadScriptResource
in interface org.alfresco.scripts.ScriptResourceLoader
resource
- Resources can be of the form:
classpath:alfresco/includeme.js workspace://SpacesStore/6f73de1b-d3b4-11db-80cb-112e6c2ea048 /Company Home/Data Dictionary/Scripts/includeme.js
org.alfresco.error.AlfrescoRuntimeException
- on any IO or ContentIO errorpublic void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
InitializingBean.afterPropertiesSet()
protected org.mozilla.javascript.Scriptable initScope(org.mozilla.javascript.Context cx, boolean secure, boolean sealed)
cx
- the thread execution contextsecure
- Do we consider the script secure? When false
this ensures the script may not
access insecure java.* libraries or import any other classes for direct access - only the
configured root host objects will be available to the script writer.sealed
- Should the scope be sealed, making it immutable? This should be true
if a scope
is to be reused.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |