Class PropertiesCommand
- java.lang.Object
-
- org.apache.openjpa.persistence.jest.PropertiesCommand
-
- All Implemented Interfaces:
JESTCommand
public class PropertiesCommand extends java.lang.Object
Represents configuration properties in HTML.- Author:
- Pinaki Poddar
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.openjpa.persistence.jest.JESTCommand
JESTCommand.Format
-
-
Field Summary
Fields Modifier and Type Field Description protected JPAServletContext
_ctx
protected ObjectFormatter<?>
_formatter
protected static Localizer
_loc
static java.util.Collection<java.lang.String>
EMPTY_LIST
static char
EQUAL
static java.lang.String
PATH_SEPARATOR
-
Constructor Summary
Constructors Constructor Description PropertiesCommand(JPAServletContext ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
debug(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, JPAServletContext ctx)
java.lang.String
getArgument(java.lang.String key)
Get the value of this command's argument of the given name.java.util.Map<java.lang.String,java.lang.String>
getArguments()
Get this command's arguments.protected JESTCommand.Format
getDefaultFormat()
JPAServletContext
getExecutionContext()
Get the execution context of this command.java.lang.String
getMandatoryArgument(java.lang.String key)
protected java.util.Collection<java.lang.String>
getMandatoryArguments()
Gets the mandatory arguments.protected int
getMaximumArguments()
Gets the maximum number of arguments excluding the mandatory arguments.protected int
getMinimumArguments()
Gets the minimum number of arguments excluding the mandatory arguments.ObjectFormatter<?>
getObjectFormatter()
java.lang.String
getQualifier(java.lang.String key)
Get the value of this command's qualifier of the given name.java.util.Map<java.lang.String,java.lang.String>
getQualifiers()
Get this command's qualifiers.protected java.util.Collection<java.lang.String>
getValidQualifiers()
Gets the valid qualifiers.boolean
hasArgument(java.lang.String key)
Affirm this command contains an argument of the given name.boolean
hasQualifier(java.lang.String key)
Affirm this command contains an qualifier of the given name.protected boolean
isBooleanQualifier(java.lang.String key)
void
parse()
Parses HTTP Request for the qualifier and argument of a command.protected void
popFetchPlan(boolean finder)
void
process()
Process the given request and write the output on to the given response in the given context.protected void
pushFetchPlan(java.lang.Object target)
protected OpenJPAStateManager
toStateManager(java.lang.Object obj)
protected java.util.List<OpenJPAStateManager>
toStateManager(java.util.Collection<?> objects)
protected void
validate()
Called post-parse to validate this command has requisite qualifiers and arguments.
-
-
-
Field Detail
-
EQUAL
public static final char EQUAL
- See Also:
- Constant Field Values
-
PATH_SEPARATOR
public static final java.lang.String PATH_SEPARATOR
- See Also:
- Constant Field Values
-
EMPTY_LIST
public static final java.util.Collection<java.lang.String> EMPTY_LIST
-
_formatter
protected ObjectFormatter<?> _formatter
-
_ctx
protected final JPAServletContext _ctx
-
_loc
protected static Localizer _loc
-
-
Constructor Detail
-
PropertiesCommand
public PropertiesCommand(JPAServletContext ctx)
-
-
Method Detail
-
getMaximumArguments
protected int getMaximumArguments()
Gets the maximum number of arguments excluding the mandatory arguments.- Returns:
- Integer.MAX_VALUE by default.
-
process
public void process() throws ProcessingException, java.io.IOException
Description copied from interface:JESTCommand
Process the given request and write the output on to the given response in the given context.- Throws:
ProcessingException
java.io.IOException
-
getDefaultFormat
protected JESTCommand.Format getDefaultFormat()
-
getExecutionContext
public JPAServletContext getExecutionContext()
Description copied from interface:JESTCommand
Get the execution context of this command.- Specified by:
getExecutionContext
in interfaceJESTCommand
- Returns:
- the execution context. never null.
-
getMandatoryArgument
public java.lang.String getMandatoryArgument(java.lang.String key)
-
getArgument
public java.lang.String getArgument(java.lang.String key)
Description copied from interface:JESTCommand
Get the value of this command's argument of the given name.- Specified by:
getArgument
in interfaceJESTCommand
- Returns:
- null if the argument does not exist.
-
hasArgument
public boolean hasArgument(java.lang.String key)
Description copied from interface:JESTCommand
Affirm this command contains an argument of the given name.- Specified by:
hasArgument
in interfaceJESTCommand
-
getArguments
public java.util.Map<java.lang.String,java.lang.String> getArguments()
Description copied from interface:JESTCommand
Get this command's arguments.- Specified by:
getArguments
in interfaceJESTCommand
-
getQualifier
public java.lang.String getQualifier(java.lang.String key)
Description copied from interface:JESTCommand
Get the value of this command's qualifier of the given name.- Specified by:
getQualifier
in interfaceJESTCommand
- Returns:
- null if the qualifier does not exist.
-
hasQualifier
public boolean hasQualifier(java.lang.String key)
Description copied from interface:JESTCommand
Affirm this command contains an qualifier of the given name.- Specified by:
hasQualifier
in interfaceJESTCommand
-
isBooleanQualifier
protected boolean isBooleanQualifier(java.lang.String key)
-
getQualifiers
public java.util.Map<java.lang.String,java.lang.String> getQualifiers()
Description copied from interface:JESTCommand
Get this command's qualifiers.- Specified by:
getQualifiers
in interfaceJESTCommand
-
parse
public void parse() throws ProcessingException
Parses HTTP Request for the qualifier and argument of a command.
Each servlet path segment, except the first (which is the command name itself), is a qualifier. Each qualifier can be either a key or a key-value pair separated by a = sign.
Each request parameter key-value pair is an argument. A concrete command may specify mandatory arguments (e.g.type
must be mandatory argument forfind
command, orq
forquery
. The mandatory arguments, if any, are not captured in the argument list.
The qualifiers and arguments are immutable after parse.- Specified by:
parse
in interfaceJESTCommand
- Throws:
ProcessingException
-
getMandatoryArguments
protected java.util.Collection<java.lang.String> getMandatoryArguments()
Gets the mandatory arguments.- Returns:
- empty list by default.
-
getMinimumArguments
protected int getMinimumArguments()
Gets the minimum number of arguments excluding the mandatory arguments.- Returns:
- zero by default.
-
getValidQualifiers
protected java.util.Collection<java.lang.String> getValidQualifiers()
Gets the valid qualifiers.- Returns:
- empty list by default.
-
validate
protected void validate()
Called post-parse to validate this command has requisite qualifiers and arguments.
-
getObjectFormatter
public ObjectFormatter<?> getObjectFormatter()
-
toStateManager
protected OpenJPAStateManager toStateManager(java.lang.Object obj)
-
toStateManager
protected java.util.List<OpenJPAStateManager> toStateManager(java.util.Collection<?> objects)
-
pushFetchPlan
protected void pushFetchPlan(java.lang.Object target)
-
popFetchPlan
protected void popFetchPlan(boolean finder)
-
debug
protected void debug(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, JPAServletContext ctx) throws java.io.IOException
- Throws:
java.io.IOException
-
-