mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Merged V2.0 to HEAD
svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5132 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5134 . - ScriptLocation#getInputStream - RMI Registry git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5166 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -33,6 +33,19 @@ public class ClasspathScriptLocation implements ScriptLocation
|
||||
ParameterCheck.mandatory("Location", location);
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.service.cmr.repository.ScriptLocation#getInputStream()
|
||||
*/
|
||||
public InputStream getInputStream()
|
||||
{
|
||||
InputStream stream = getClass().getClassLoader().getResourceAsStream(location);
|
||||
if (stream == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Unable to load classpath resource: " + location);
|
||||
}
|
||||
return stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.service.cmr.repository.ScriptLocation#getReader()
|
||||
@@ -83,5 +96,4 @@ public class ClasspathScriptLocation implements ScriptLocation
|
||||
{
|
||||
return this.location.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@
|
||||
*/
|
||||
package org.alfresco.service.cmr.repository;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
|
||||
/**
|
||||
@@ -13,6 +14,13 @@ import java.io.Reader;
|
||||
*/
|
||||
public interface ScriptLocation
|
||||
{
|
||||
/**
|
||||
* Returns an input stream to the contents of the script
|
||||
*
|
||||
* @return the input stream
|
||||
*/
|
||||
InputStream getInputStream();
|
||||
|
||||
/**
|
||||
* Returns a reader to the contents of the script
|
||||
*
|
||||
|
Reference in New Issue
Block a user