Class EnvironmentProcessor
- java.lang.Object
-
- edu.uiuc.ncsa.security.core.configuration.EnvironmentProcessor
-
public class EnvironmentProcessor extends Object
This class does the work of taking a raw configuration file, possibly with environment elements, snooping the lines for the environment tags, and resolving them It will create the environment for a single document.Usage
- Instantiate this class
- Invoke
resolveEnvironment(InputStream)
on your configuration file - retrieve the processed file using
getRootDocument()
- If you need the environment, it is in
getEnv()
-
-
Field Summary
Fields Modifier and Type Field Description static String
ENV_END_ELEMENT
static String
ENV_START_ELEMENT
static String
ENV_TAG
static String
INCLUDE_TAG
static String
KEY_TAG
-
Constructor Summary
Constructors Constructor Description EnvironmentProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>
getEnv()
Document
getRootDocument()
The final document when all is said and done.protected boolean
isEndEnv(String l)
Does the trimmed line end with an environment end tag?protected boolean
isStartEnv(String l)
Does the trimmed line start and environment entry?protected void
processEnvDocument(InputStream inputStream, EnvStack envStack)
Process a single env document from any source.void
resolveEnvironment(InputStream inputStream)
This starts the environment resolution on a file.protected void
resolveEnvironment(InputStream inputStream, EnvStack stack)
void
setEnv(Map<String,String> env)
void
setRootDocument(Document rootDocument)
-
-
-
Field Detail
-
ENV_TAG
public static final String ENV_TAG
- See Also:
- Constant Field Values
-
KEY_TAG
public static final String KEY_TAG
- See Also:
- Constant Field Values
-
INCLUDE_TAG
public static final String INCLUDE_TAG
- See Also:
- Constant Field Values
-
ENV_START_ELEMENT
public static final String ENV_START_ELEMENT
- See Also:
- Constant Field Values
-
ENV_END_ELEMENT
public static final String ENV_END_ELEMENT
- See Also:
- Constant Field Values
-
-
Method Detail
-
isStartEnv
protected boolean isStartEnv(String l)
Does the trimmed line start and environment entry?- Parameters:
l
-- Returns:
-
isEndEnv
protected boolean isEndEnv(String l)
Does the trimmed line end with an environment end tag?- Parameters:
l
-- Returns:
-
getRootDocument
public Document getRootDocument()
The final document when all is said and done.- Returns:
-
setRootDocument
public void setRootDocument(Document rootDocument)
-
resolveEnvironment
public void resolveEnvironment(InputStream inputStream) throws Throwable
This starts the environment resolution on a file. It will read through the lines for environment tags, collect them then process them. You do not call this on a file with only environment elements in it.- Parameters:
inputStream
-- Throws:
Throwable
-
resolveEnvironment
protected void resolveEnvironment(InputStream inputStream, EnvStack stack) throws Throwable
- Throws:
Throwable
-
processEnvDocument
protected void processEnvDocument(InputStream inputStream, EnvStack envStack) throws Throwable
Process a single env document from any source. At the end of this, every envionment element will have been processed and added to the current environmentgetEnv()
.- Parameters:
inputStream
-- Throws:
Throwable
-
-