jcommon.extract.processors.EchoProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of init Show documentation
Show all versions of init Show documentation
Java library for simple extracting and processing of embedded resources at runtime.
The newest version!
package jcommon.extract.processors;
import jcommon.core.StringUtil;
import jcommon.extract.*;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathException;
/**
* Deletes every file/subdirectory from the provided directory.
*
* @author David Hoyt
*/
@ResourceProcessor(
tagName = "Echo",
supportsSize = false
)
public class EchoProcessor extends DefaultResourceProcessor {
//
public static final String
ATTRIBUTE_MESSAGE = "msg"
, ATTRIBUTE_KEY = "key"
;
//
//
private String msg = StringUtil.empty;
private String key = StringUtil.empty;
//
//
public EchoProcessor() {
}
public EchoProcessor(String message) {
this(StringUtil.empty, message, StringUtil.empty, StringUtil.empty);
}
public EchoProcessor(String message, String Title, String Description) {
this(StringUtil.empty, message, Title, Description);
}
public EchoProcessor(String i18nKey, String message, String Title, String Description) {
super(false, StringUtil.empty, StringUtil.empty, StringUtil.empty, Title, Description);
this.msg = message;
}
//
@Override
protected boolean loadSettings(final String fullResourceName, final IResourcePackage pkg, final XPath xpath, final Node node, final Document document, final IVariableProcessor varproc, final ResourceProcessorFactory factory) throws XPathException {
this.msg = stringAttributeValue(varproc, StringUtil.empty, node, ATTRIBUTE_MESSAGE);
this.key = stringAttributeValue(varproc, StringUtil.empty, node, ATTRIBUTE_KEY);
return true;
}
@Override
protected boolean processResource(final String fullResourceName, final IResourcePackage pkg, final IResourceFilter filter, final IResourceProgressListener progress) {
if (progress != null)
progress.reportMessage(this, pkg, StringUtil.isNullOrEmpty(key) ? StringUtil.empty : key, !StringUtil.isNullOrEmpty(msg) ? msg : StringUtil.empty);
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy