Class PropertiesCommand
- java.lang.Object
-
- org.apache.openjpa.persistence.jest.PropertiesCommand
-
- All Implemented Interfaces:
JESTCommand
public class PropertiesCommand extends java.lang.ObjectRepresents 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_ctxprotected ObjectFormatter<?>_formatterprotected static Localizer_locstatic java.util.Collection<java.lang.String>EMPTY_LISTstatic charEQUALstatic java.lang.StringPATH_SEPARATOR
-
Constructor Summary
Constructors Constructor Description PropertiesCommand(JPAServletContext ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddebug(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, JPAServletContext ctx)java.lang.StringgetArgument(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.FormatgetDefaultFormat()JPAServletContextgetExecutionContext()Get the execution context of this command.java.lang.StringgetMandatoryArgument(java.lang.String key)protected java.util.Collection<java.lang.String>getMandatoryArguments()Gets the mandatory arguments.protected intgetMaximumArguments()Gets the maximum number of arguments excluding the mandatory arguments.protected intgetMinimumArguments()Gets the minimum number of arguments excluding the mandatory arguments.ObjectFormatter<?>getObjectFormatter()java.lang.StringgetQualifier(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.booleanhasArgument(java.lang.String key)Affirm this command contains an argument of the given name.booleanhasQualifier(java.lang.String key)Affirm this command contains an qualifier of the given name.protected booleanisBooleanQualifier(java.lang.String key)voidparse()Parses HTTP Request for the qualifier and argument of a command.protected voidpopFetchPlan(boolean finder)voidprocess()Process the given request and write the output on to the given response in the given context.protected voidpushFetchPlan(java.lang.Object target)protected OpenJPAStateManagertoStateManager(java.lang.Object obj)protected java.util.List<OpenJPAStateManager>toStateManager(java.util.Collection<?> objects)protected voidvalidate()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.IOExceptionDescription copied from interface:JESTCommandProcess the given request and write the output on to the given response in the given context.- Throws:
ProcessingExceptionjava.io.IOException
-
getDefaultFormat
protected JESTCommand.Format getDefaultFormat()
-
getExecutionContext
public JPAServletContext getExecutionContext()
Description copied from interface:JESTCommandGet the execution context of this command.- Specified by:
getExecutionContextin 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:JESTCommandGet the value of this command's argument of the given name.- Specified by:
getArgumentin interfaceJESTCommand- Returns:
- null if the argument does not exist.
-
hasArgument
public boolean hasArgument(java.lang.String key)
Description copied from interface:JESTCommandAffirm this command contains an argument of the given name.- Specified by:
hasArgumentin interfaceJESTCommand
-
getArguments
public java.util.Map<java.lang.String,java.lang.String> getArguments()
Description copied from interface:JESTCommandGet this command's arguments.- Specified by:
getArgumentsin interfaceJESTCommand
-
getQualifier
public java.lang.String getQualifier(java.lang.String key)
Description copied from interface:JESTCommandGet the value of this command's qualifier of the given name.- Specified by:
getQualifierin interfaceJESTCommand- Returns:
- null if the qualifier does not exist.
-
hasQualifier
public boolean hasQualifier(java.lang.String key)
Description copied from interface:JESTCommandAffirm this command contains an qualifier of the given name.- Specified by:
hasQualifierin 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:JESTCommandGet this command's qualifiers.- Specified by:
getQualifiersin interfaceJESTCommand
-
parse
public void parse() throws ProcessingExceptionParses 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.typemust be mandatory argument forfindcommand, orqforquery. The mandatory arguments, if any, are not captured in the argument list.
The qualifiers and arguments are immutable after parse.- Specified by:
parsein 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
-
-