本文整理汇总了Java中org.apache.commons.digester.Digester.addCallParam方法的典型用法代码示例。如果您正苦于以下问题:Java Digester.addCallParam方法的具体用法?Java Digester.addCallParam怎么用?Java Digester.addCallParam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.digester.Digester
的用法示例。
在下文中一共展示了Digester.addCallParam方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseXML
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public static GoPluginDescriptor parseXML(InputStream pluginXML, String pluginJarFileLocation, File pluginBundleLocation, boolean isBundledPlugin) throws IOException, SAXException {
Digester digester = initDigester();
GoPluginDescriptorParser parserForThisXML = new GoPluginDescriptorParser(pluginJarFileLocation, pluginBundleLocation, isBundledPlugin);
digester.push(parserForThisXML);
digester.addCallMethod("go-plugin", "createPlugin", 2);
digester.addCallParam("go-plugin", 0, "id");
digester.addCallParam("go-plugin", 1, "version");
digester.addCallMethod("go-plugin/about", "createAbout", 4);
digester.addCallParam("go-plugin/about/name", 0);
digester.addCallParam("go-plugin/about/version", 1);
digester.addCallParam("go-plugin/about/target-go-version", 2);
digester.addCallParam("go-plugin/about/description", 3);
digester.addCallMethod("go-plugin/about/vendor", "createVendor", 2);
digester.addCallParam("go-plugin/about/vendor/name", 0);
digester.addCallParam("go-plugin/about/vendor/url", 1);
digester.addCallMethod("go-plugin/about/target-os/value", "addTargetOS", 1);
digester.addCallParam("go-plugin/about/target-os/value", 0);
digester.parse(pluginXML);
return parserForThisXML.descriptor;
}
示例2: get
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
* Reading the checksum file (xml) from an InputSream and put it in a Map.
*
* @param in
* @return A Map with the file name as key and the checksum as value.
*/
public static Map<String, String> get(final InputStream in) {
Digester digester = new Digester();
digester.setValidating(false);
digester.addObjectCreate("checksums", HashMap.class);
digester.addCallMethod("checksums/file", "put", 2);
digester.addCallParam("checksums/file/name", 0);
digester.addCallParam("checksums/file/checksum", 1);
try {
@SuppressWarnings("unchecked")
Map<String, String> checksums = (Map<String, String>) digester.parse(in);
return checksums;
} catch (Exception e) {
throw new FatalException("Error while parsing checksums: " + e.getMessage(), e);
}
}
示例3: xml2Object
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public void xml2Object() throws SAXException
{
Digester digester = new Digester();
digester.push(this);
digester.addCallMethod("datasources/datasource", "addDataSource", 5 );
digester.addCallParam("datasources/datasource/name", 0);
digester.addCallParam("datasources/datasource/driver", 1);
digester.addCallParam("datasources/datasource/url", 2);
digester.addCallParam("datasources/datasource/username", 3);
digester.addCallParam("datasources/datasource/password", 4);
try{
//java.io.InputStream xmlFile = getClass().getResourceAsStream("xml/datasource.xml");
java.io.InputStream xmlFile
= new java.io.FileInputStream(gafetes.util.VariablesAmbiente.getArchivoDBConfiguracion());
digester.parse(xmlFile);
}catch( java.io.IOException ioex ){
System.out.println();
}
}
示例4: xmlConfiguration2Object
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public void xmlConfiguration2Object() throws SAXException
{
Digester digester = new Digester();
digester.push(this);
digester.addCallMethod("datasources/datasource", "addDataConfigurationSource", 4 );
digester.addCallParam("datasources/datasource/rutaFotos", 0);
digester.addCallParam("datasources/datasource/rutaCarpetaFotos", 1);
digester.addCallParam("datasources/datasource/rutaFotoNoExiste", 2);
digester.addCallParam("datasources/datasource/passPhrase", 3);
try{
//java.io.InputStream xmlFile = getClass().getResourceAsStream("xml/datasource.xml");
java.io.InputStream xmlFile
= new java.io.FileInputStream(gafetes.util.VariablesAmbiente.getArchivoConfiguracion());
digester.parse(xmlFile);
}catch( java.io.IOException ioex ){
System.out.println();
}
}
示例5: getDefaultBook
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
public static OpeningBook getDefaultBook() {
if(defaultBook != null) {
return defaultBook;
}
Digester digester = new Digester();
digester.addObjectCreate("calculon/opening-book", OpeningBook.class);
digester.addObjectCreate("calculon/opening-book/moves", OpeningBook.MoveList.class);
digester.addCallMethod("calculon/opening-book/moves/move", "addMove", 2, new Class[] { String.class, Integer.class});
digester.addCallParam("calculon/opening-book/moves/move", 0, "pgn");
digester.addCallParam("calculon/opening-book/moves/move", 1, "count");
digester.addCallMethod("calculon/opening-book/moves/position", "setPosition", 1);
digester.addCallParam("calculon/opening-book/moves/position", 0);
digester.addSetNext("calculon/opening-book/moves", "addMoveList");
try {
log.fine("Creating opening book");
defaultBook = (OpeningBook) digester.parse(OpeningBook.class.getResourceAsStream("/calculon.xml"));
return defaultBook;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例6: addNonNullPrioritizedProperty
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
protected void addNonNullPrioritizedProperty(Digester digester, String property, PrioritizedPropertyNameEnum name,
int paramCount) {
for (int i = 1; i <= paramCount; i++) {
String key = property + '.' + i;
String pattern = mappingProps.getProperty(key);
if (pattern != null) {
pattern = pattern.trim();
LOG.debug("adding prioritized property [{}] with pattern [{}]", key, pattern);
// note order of rule addition is critical
digester.addObjectCreate(pattern, PrioritizedProperty.class);
digester.addSetNext(pattern, "addPrioritizedProperty");
digester.addRule(pattern, new SetLiteralRule("setPriority", i));
digester.addRule(pattern, new SetLiteralRule("setName", name));
digester.addCallMethod(pattern, "setProperty", 1);
digester.addCallParam(pattern, 0);
}
}
}
示例7: TestConfigFactory
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
* Creates a factory instance.
*/
public TestConfigFactory() {
digester = new Digester();
digester.setClassLoader(Thread.currentThread().getContextClassLoader());
digester.addObjectCreate("testportlet-config", ArrayList.class);
digester.addObjectCreate("testportlet-config/testsuite-config",
TestConfig.class);
digester.addBeanPropertySetter("testportlet-config/testsuite-config/name",
"name");
digester.addBeanPropertySetter("testportlet-config/testsuite-config/class",
"testClassName");
digester.addBeanPropertySetter("testportlet-config/testsuite-config/display-uri",
"displayURI");
digester.addCallMethod("testportlet-config/testsuite-config/init-param", "addInitParameter", 2);
digester.addCallParam("testportlet-config/testsuite-config/init-param/name", 0);
digester.addCallParam("testportlet-config/testsuite-config/init-param/value", 1);
digester.addCallMethod("testportlet-config/testsuite-config/action-param", "addActionParameter", 2);
digester.addCallParam("testportlet-config/testsuite-config/action-param/name", 0);
digester.addCallParam("testportlet-config/testsuite-config/action-param/value", 1);
digester.addCallMethod("testportlet-config/testsuite-config/render-param", "addRenderParameter", 2);
digester.addCallParam("testportlet-config/testsuite-config/render-param/name", 0);
digester.addCallParam("testportlet-config/testsuite-config/render-param/value", 1);
digester.addSetRoot("testportlet-config/testsuite-config", "add");
}
示例8: StemmerFactory
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
private StemmerFactory() {
initParams = new Properties();
try {
Digester digester = new Digester();
digester.push(this);
digester.addCallMethod("jsre-config/stemmer-list/stemmer",
"addStemmer", 2);
digester.addCallParam(
"jsre-config/stemmer-list/stemmer/stemmer-name", 0);
digester.addCallParam(
"jsre-config/stemmer-list/stemmer/stemmer-class", 1);
String configFile = System.getProperty("config.file");
if (configFile == null) {
logger.debug("StemmerFactory uses the default config file: jsre-config.xml");
checkFileExists(JSRE_HOME + RESOURCES_PATH + "jsre-config.xml");
digester.parse(JSRE_HOME + RESOURCES_PATH + "jsre-config.xml");
} else {
logger.debug("StemmerFactory uses the config file: "
+ configFile);
digester.parse(configFile);
}
} catch (Exception e) {
logger.error("", e);
}
}
示例9: getDigester
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
protected static Digester getDigester() {
Digester digester = new Digester();
digester.setValidating(false);
digester.addObjectCreate("feed", Atom.class);
digester.addSetProperties("feed");
digester.addCallMethod("feed/title", "setTitle", 0);
digester.addObjectCreate("feed/entry", Entry.class);
digester.addSetProperties("feed/entry");
digester.addCallMethod("feed/entry/title", "setTitle", 0);
digester.addCallMethod("feed/entry/id", "setId", 0);
digester.addCallMethod("feed/entry/published", "setPublished", 0);
digester.addCallMethod("feed/entry/category", "addCategory", 1);
digester.addCallParam("feed/entry/category", 0);
digester.addSetNext("feed/entry", "addEntry");
digester.addObjectCreate("feed/entry/author", Author.class);
digester.addSetProperties("feed/entry/author");
digester.addCallMethod("feed/entry/author/name", "setName", 0);
digester.addCallMethod("feed/entry/author/email", "setEmail", 0);
digester.addSetNext("feed/entry/author", "setAuthor");
digester.addObjectCreate("feed/entry/link", Link.class);
digester.addSetProperties("feed/entry/link");
digester.addSetNext("feed/entry/link", "addLink");
digester.addObjectCreate("feed/entry/content", Content.class);
digester.addSetProperties("feed/entry/content");
digester.addCallMethod("feed/entry/content", "setValue", 0);
digester.addSetNext("feed/entry/content", "setContent");
return digester;
}
示例10: getDigester
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
protected static Digester getDigester() {
Digester digester = new Digester();
digester.setValidating(false);
digester.addObjectCreate("rss", RSS.class);
digester.addSetProperties("rss");
digester.addObjectCreate("rss/channel", Channel.class);
digester.addSetProperties("rss/channel");
digester.addCallMethod("rss/channel/title", "setTitle", 0);
digester.addSetNext("rss/channel", "addChannel");
digester.addObjectCreate("rss/channel/item", Item.class);
digester.addSetProperties("rss/channel/item");
digester.addCallMethod("rss/channel/item/title", "setTitle", 0);
digester.addCallMethod("rss/channel/item/guid", "setGuid", 0);
digester.addCallMethod("rss/channel/item/link", "setLink", 0);
digester.addCallMethod("rss/channel/item/description", "setDescription", 0);
digester.addCallMethod("rss/channel/item/author", "setAuthor", 0);
digester.addCallMethod("rss/channel/item/pubDate", "setPubDate", 0);
digester.addCallMethod("rss/channel/item/category", "addCategory", 1);
digester.addCallParam("rss/channel/item/category", 0);
digester.addSetNext("rss/channel/item", "addItem");
digester.addObjectCreate("rss/channel/item/enclosure", Enclosure.class);
digester.addSetProperties("rss/channel/item/enclosure");
digester.addSetNext("rss/channel/item/enclosure", "addEnclosure");
digester.setNamespaceAware(true);
digester.setRuleNamespaceURI("http://purl.org/rss/1.0/modules/content/");
// some feeds use <content:encoded> for their HTML
digester.addCallMethod("rss/channel/item/encoded", "setDescription", 0);
return digester;
}
示例11: addNonNullParam
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
protected void addNonNullParam(Digester digester, String property, int argPosition) {
String pattern = mappingProps.getProperty(property);
if (pattern != null) {
pattern = pattern.trim();
LOG.debug("adding call param for pattern [{}] from property [{}]", pattern, property);
digester.addCallParam(pattern, argPosition);
}
}
示例12: addNonNullAttParam
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
protected void addNonNullAttParam(Digester digester, String elementProperty, String attributeProperty,
int argPosition) {
String elemPattern = mappingProps.getProperty(elementProperty);
String attPattern = mappingProps.getProperty(attributeProperty);
if (elemPattern != null && attPattern != null) {
elemPattern = elemPattern.trim();
attPattern = attPattern.trim();
LOG.debug(
"adding call param from attribute for element pattern [{}] from property [{}], seeking attribute [{}] from property [{}]",
new Object[] {elemPattern, elementProperty, attPattern, attributeProperty});
digester.addCallParam(elemPattern, argPosition, attPattern);
}
}
示例13: createServerList
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
* Creates the rules.
*
* @return The rules all put into a rule chain
*/
private LinkedList createServerList(File data) throws Exception {
Digester digester = new Digester();
digester.setUseContextClassLoader(true);
// Construct server list
digester.addObjectCreate("config", LinkedList.class);
// Create servers
digester.addObjectCreate("config/server", null, "className");
digester.addSetProperties("config/server");
// Create rule
digester.addObjectCreate("config/server/rule", null, "className");
digester.addSetProperties("config/server/rule");
digester.addSetNext("config/server/rule", "setRule");
// Create composite rule
digester.addObjectCreate("config/server/composite-rule", null,
"className");
digester.addSetProperties("config/server/composite-rule");
digester.addObjectCreate("config/server/composite-rule/rule", null,
"className");
digester.addSetProperties("config/server/composite-rule/rule");
digester.addSetNext("config/server/composite-rule/rule", "addRule");
digester.addSetNext("config/server/composite-rule", "setRule");
// Add server to list
digester.addSetNext("config/server", "add");
// Create cluster servers
digester.addObjectCreate("config/cluster-server", null, "className");
digester.addSetProperties("config/cluster-server");
// Create the servers in this cluster
digester.addCallMethod("config/cluster-server/server", "addServer", 2);
digester.addCallParam("config/cluster-server/server", 0, "domainName");
digester.addCallParam("config/cluster-server/server", 1, "path");
// Create rule
digester.addObjectCreate("config/cluster-server/rule", null,
"className");
digester.addSetProperties("config/cluster-server/rule");
digester.addSetNext("config/cluster-server/rule", "setRule");
// Create composite rule
digester.addObjectCreate("config/cluster-server/composite-rule", null,
"className");
digester.addSetProperties("config/cluster-server/composite-rule");
digester.addObjectCreate("config/cluster-server/composite-rule/rule",
null, "className");
digester.addSetProperties("config/cluster-server/composite-rule/rule");
digester.addSetNext("config/cluster-server/composite-rule/rule",
"addRule");
digester.addSetNext("config/cluster-server/composite-rule", "setRule");
// Add server to list
digester.addSetNext("config/cluster-server", "add");
return (LinkedList) digester.parse(data);
}
示例14: addRuleInstances
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
/**
* <p>Add the set of Rule instances defined in this RuleSet to the
* specified <code>Digester</code> instance, associating them with
* our namespace URI (if any). This method should only be called
* by a Digester instance.</p>
*
* @param digester Digester instance to which the new Rule instances
* should be added.
*/
public void addRuleInstances(Digester digester) {
digester.addObjectCreate(prefix + "Ejb",
"org.apache.catalina.deploy.ContextEjb");
digester.addSetProperties(prefix + "Ejb");
digester.addSetNext(prefix + "Ejb",
"addEjb",
"org.apache.catalina.deploy.ContextEjb");
digester.addObjectCreate(prefix + "Environment",
"org.apache.catalina.deploy.ContextEnvironment");
digester.addSetProperties(prefix + "Environment");
digester.addSetNext(prefix + "Environment",
"addEnvironment",
"org.apache.catalina.deploy.ContextEnvironment");
digester.addObjectCreate(prefix + "LocalEjb",
"org.apache.catalina.deploy.ContextLocalEjb");
digester.addSetProperties(prefix + "LocalEjb");
digester.addSetNext(prefix + "LocalEjb",
"addLocalEjb",
"org.apache.catalina.deploy.ContextLocalEjb");
digester.addObjectCreate(prefix + "Resource",
"org.apache.catalina.deploy.ContextResource");
digester.addSetProperties(prefix + "Resource");
digester.addSetNext(prefix + "Resource",
"addResource",
"org.apache.catalina.deploy.ContextResource");
digester.addCallMethod(prefix + "ResourceEnvRef",
"addResourceEnvRef", 2);
digester.addCallParam(prefix + "ResourceEnvRef/name", 0);
digester.addCallParam(prefix + "ResourceEnvRef/type", 1);
digester.addObjectCreate(prefix + "ResourceParams",
"org.apache.catalina.deploy.ResourceParams");
digester.addSetProperties(prefix + "ResourceParams");
digester.addSetNext(prefix + "ResourceParams",
"addResourceParams",
"org.apache.catalina.deploy.ResourceParams");
digester.addCallMethod(prefix + "ResourceParams/parameter",
"addParameter", 2);
digester.addCallParam(prefix + "ResourceParams/parameter/name", 0);
digester.addCallParam(prefix + "ResourceParams/parameter/value", 1);
}
示例15: ContextMappingFactory
import org.apache.commons.digester.Digester; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private ContextMappingFactory() {
// defaultParameters = new Properties();
try {
Digester digester = new Digester();
digester.setValidating(false);
digester.addObjectCreate("jsre-config/mapping-list",
ArrayList.class);
digester.addObjectCreate("jsre-config/mapping-list/mapping",
MappingParameters.class);
digester.addBeanPropertySetter(
"jsre-config/mapping-list/mapping/mapping-name", "name");
digester.addBeanPropertySetter(
"jsre-config/mapping-list/mapping/mapping-class",
"className");
digester.addCallMethod(
"jsre-config/mapping-list/mapping/init-param",
"setParameters", 2);
digester.addCallParam(
"jsre-config/mapping-list/mapping/init-param/param-name", 0);
digester.addCallParam(
"jsre-config/mapping-list/mapping/init-param/param-value",
1);
digester.addSetNext("jsre-config/mapping-list/mapping", "add");
String configFile = System.getProperty("config.file");
if (configFile == null) {
LOG.debug("ContextMappingFactory uses the default config file: jsre-config.xml");
checkFileExists(JSRE_HOME + RESOURCES_PATH + "jsre-config.xml");
mappingList = (List<MappingParameters>) digester
.parse(new File(JSRE_HOME + RESOURCES_PATH
+ "jsre-config.xml"));
} else {
LOG.debug("ContextMappingFactory uses the config file: "
+ configFile);
mappingList = (List<MappingParameters>) digester
.parse(new File(configFile));
}
LOG.debug("mapping-list size: " + mappingList.size());
for (MappingParameters mp : mappingList)
LOG.debug("{}", mp);
} catch (Exception e) {
LOG.error("woops", e);
}
}