Package org.apache.catalina.storeconfig
Class StoreAppender
java.lang.Object
org.apache.catalina.storeconfig.StoreAppender
- Direct Known Subclasses:
CertificateStoreAppender
,ConnectorStoreAppender
,StoreContextAppender
StoreAppends generate really the xml tag elements
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Object
checkAttribute
(StoreDescription desc, PropertyDescriptor descriptor, String attributeName, Object bean, Object bean2) Check if the attribute should be printed.convertStr
(String input) Deprecated.This method will be removed in Tomcat 9defaultInstance
(Object bean) Generate default Instance for the specified bean.protected boolean
isPersistable
(Class<?> clazz) Is the specified property type one for which we should generate a persistence attribute?boolean
isPrintValue
(Object bean, Object bean2, String attrName, StoreDescription desc) Determine if the attribute value needs to be stored.protected void
printAttribute
(PrintWriter writer, int indent, Object bean, StoreDescription desc, String attributeName, Object bean2, Object value) Store the specified of the specified JavaBean.void
printAttributes
(PrintWriter writer, int indent, boolean include, Object bean, StoreDescription desc) Store the relevant attributes of the specified JavaBean.void
printAttributes
(PrintWriter writer, int indent, Object bean, StoreDescription desc) Store the relevant attributes of the specified JavaBean, plus aclassName
attribute defining the fully qualified Java class name of the bean.void
printCloseTag
(PrintWriter aWriter, StoreDescription aDesc) Print the closing tag.void
printIndent
(PrintWriter aWriter, int indent) Print some spaces.void
printOpenTag
(PrintWriter aWriter, int indent, Object bean, StoreDescription aDesc) Print only the open tag with all attributes.void
printTag
(PrintWriter aWriter, int indent, Object bean, StoreDescription aDesc) Print tag with all attributesvoid
printTagArray
(PrintWriter aWriter, String tag, int indent, String[] elements) Print an array of elements.void
printTagContent
(PrintWriter aWriter, String tag, String content) Print the value from tag as content.void
printTagValueArray
(PrintWriter aWriter, String tag, int indent, String[] elements) Print an array of values.void
printValue
(PrintWriter writer, int indent, String name, Object value) Print an attribute value.
-
Constructor Details
-
StoreAppender
public StoreAppender()
-
-
Method Details
-
printCloseTag
Print the closing tag.- Parameters:
aWriter
- The output writeraDesc
- Store description of the current element- Throws:
Exception
- A store error occurred
-
printOpenTag
public void printOpenTag(PrintWriter aWriter, int indent, Object bean, StoreDescription aDesc) throws Exception Print only the open tag with all attributes.- Parameters:
aWriter
- The output writerindent
- Indentation levelbean
- The current bean that is storedaDesc
- Store description of the current element- Throws:
Exception
- A store error occurred
-
printTag
public void printTag(PrintWriter aWriter, int indent, Object bean, StoreDescription aDesc) throws Exception Print tag with all attributes- Parameters:
aWriter
- The output writerindent
- Indentation levelbean
- The current bean that is storedaDesc
- Store description of the current element- Throws:
Exception
- A store error occurred
-
printTagContent
Print the value from tag as content.- Parameters:
aWriter
- The output writertag
- The element namecontent
- Element content- Throws:
Exception
- A store error occurred
-
printTagValueArray
Print an array of values.- Parameters:
aWriter
- The output writertag
- The element nameindent
- Indentation levelelements
- Array of element values
-
printTagArray
public void printTagArray(PrintWriter aWriter, String tag, int indent, String[] elements) throws Exception Print an array of elements.- Parameters:
aWriter
- The output writertag
- The element nameindent
- Indentation levelelements
- Array of elements- Throws:
Exception
- Store error occurred
-
printIndent
Print some spaces.- Parameters:
aWriter
- The output writerindent
- The number of spaces
-
printAttributes
public void printAttributes(PrintWriter writer, int indent, Object bean, StoreDescription desc) throws Exception Store the relevant attributes of the specified JavaBean, plus aclassName
attribute defining the fully qualified Java class name of the bean.- Parameters:
writer
- PrintWriter to which we are storingindent
- Indentation levelbean
- Bean whose properties are to be rendered as attributes,desc
- Store description of the current element- Throws:
Exception
- if an exception occurs while storing
-
printAttributes
public void printAttributes(PrintWriter writer, int indent, boolean include, Object bean, StoreDescription desc) throws Exception Store the relevant attributes of the specified JavaBean.- Parameters:
writer
- PrintWriter to which we are storingindent
- Indentation levelinclude
- Should we include aclassName
attribute?bean
- Bean whose properties are to be rendered as attributes,desc
- RegistryDescriptor from this bean- Throws:
Exception
- if an exception occurs while storing
-
checkAttribute
protected Object checkAttribute(StoreDescription desc, PropertyDescriptor descriptor, String attributeName, Object bean, Object bean2) Check if the attribute should be printed.- Parameters:
desc
- RegistryDescriptor from this beandescriptor
- PropertyDescriptor from this bean propertyattributeName
- The attribute name to storebean
- The current beanbean2
- A default instance of the bean for comparison- Returns:
- null if the value should be skipped, the value to print otherwise
-
printAttribute
protected void printAttribute(PrintWriter writer, int indent, Object bean, StoreDescription desc, String attributeName, Object bean2, Object value) Store the specified of the specified JavaBean.- Parameters:
writer
- PrintWriter to which we are storingindent
- Indentation levelbean
- The current beandesc
- RegistryDescriptor from this beanattributeName
- The attribute name to storebean2
- A default instance of the bean for comparisonvalue
- The attribute value
-
isPrintValue
Determine if the attribute value needs to be stored.- Parameters:
bean
- original beanbean2
- default beanattrName
- attribute namedesc
- StoreDescription from bean- Returns:
true
if the value should be stored
-
defaultInstance
Generate default Instance for the specified bean.- Parameters:
bean
- The bean- Returns:
- an object from same class as bean parameter
- Throws:
ReflectiveOperationException
- Error creating a new instance
-
printValue
Print an attribute value.- Parameters:
writer
- PrintWriter to which we are storingindent
- Indentation levelname
- Attribute namevalue
- Attribute value
-
convertStr
Deprecated.This method will be removed in Tomcat 9Given a string, this method replaces all occurrences of '<', '>', '&', and '"'.- Parameters:
input
- The string to escape- Returns:
- the escaped string
-
isPersistable
Is the specified property type one for which we should generate a persistence attribute?- Parameters:
clazz
- Java class to be tested- Returns:
true
if the specified class should be stored
-