/** * Get the content of the given element. * * @param element The element to get the content for. * @return The content of the element or null. */ public static String getElementContent(final Element element) { return getElementContent(element, null); }
/** * Get the content of the given element. * * @param element The element to get the content for. * @param defaultStr The default to return when there is no content. * @return The content of the element or the default. */ public static String getElementContent(Element element, String defaultStr) { return getElementContent(element, defaultStr, true); }
/** * Get the content of the given element. * * @param element The element to get the content for. * @return The content of the element or null. */ public static String getElementContent(final Element element) { return getElementContent(element, null); }
/** * Get the content of the given element. * * @param element The element to get the content for. * @param defaultStr The default to return when there is no content. * @return The content of the element or the default. */ public static String getElementContent(Element element, String defaultStr) { return getElementContent(element, defaultStr, true); }
public static boolean getOptionalChildBooleanContent(Element element, String name) { Element child = getOptionalChild(element, name); if (child != null) { String value = getElementContent(child).toLowerCase(); return value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes"); } return false; }
/** * Macro to get the content of an optional child element with default value. * * @param element The parent element. * @param tagName The name of the desired child. * @return The element content or null. */ public static String getOptionalChildContent(Element element, String tagName, String defaultValue) { return getElementContent(getOptionalChild(element, tagName), defaultValue); }
public static boolean getOptionalChildBooleanContent(Element element, String name) { Element child = getOptionalChild(element, name); if (child != null) { String value = getElementContent(child).toLowerCase(); return value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes"); } return false; }
public static boolean getOptionalChildBooleanContent(Element element, String name, boolean defaultValue) { Element child = getOptionalChild(element, name); boolean flag = defaultValue; if (child != null) { String value = getElementContent(child).toLowerCase(); flag = value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes"); } return flag; }
public void importXml(Element element) throws DeploymentException { Element synch = MetaData.getUniqueChild(element, "Synchronized"); isSynchronized = Boolean.valueOf(MetaData.getElementContent(synch)).booleanValue(); }
/** * Macro to get the content of an optional child element. * * @param element The parent element. * @param tagName The name of the desired child. * @return The element content or null. */ public static String getOptionalChildContent(Element element, String tagName) { return getElementContent(getOptionalChild(element, tagName)); }
/** * Macro to get the content of an optional child element with default value. * * @param element The parent element. * @param tagName The name of the desired child. * @return The element content or null. */ public static String getOptionalChildContent(Element element, String tagName, String defaultValue) { return getElementContent(getOptionalChild(element, tagName), defaultValue); }
/** * Macro to get the content of a unique child element. * * @param element The parent element. * @param tagName The name of the desired child. * @return The element content or null. */ public static String getUniqueChildContent(Element element, String tagName) { return getElementContent(getUniqueChild(element, tagName)); }
/** * Macro to get the content of an optional child element. * * @param element The parent element. * @param tagName The name of the desired child. * @return The element content or null. */ public static String getOptionalChildContent(Element element, String tagName) { return getElementContent(getOptionalChild(element, tagName)); }
public void importXml(Element element) throws DeploymentException { String flushString = MetaData.getElementContent(MetaData.getOptionalChild(element, "flush-enabled")); flushEnabled = Boolean.valueOf(flushString).booleanValue(); }
public static boolean getOptionalChildBooleanContent(Element element, String name, boolean defaultValue) { Element child = getOptionalChild(element, name); boolean flag = defaultValue; if (child != null) { String value = getElementContent(child).toLowerCase(); flag = value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes"); } return flag; }
/** * Macro to get the content of a unique child element. * * @param element The parent element. * @param tagName The name of the desired child. * @return The element content or null. */ public static String getUniqueChildContent(Element element, String tagName) { return getElementContent(getUniqueChild(element, tagName)); }
public void setClientInterceptors(Element config) throws Exception { this.interceptorConfig = config; Iterator interceptorElements = MetaData.getChildrenByTagName(interceptorConfig, "interceptor"); ClassLoader loader = Thread.currentThread().getContextClassLoader(); interceptorClasses.clear(); while( interceptorElements != null && interceptorElements.hasNext() ) { Element ielement = (Element) interceptorElements.next(); String className = null; className = MetaData.getElementContent(ielement); Class clazz = loader.loadClass(className); interceptorClasses.add(clazz); log.debug("added interceptor type: "+clazz); } }
public void setClientInterceptors(Element config) throws Exception { this.interceptorConfig = config; Iterator interceptorElements = MetaData.getChildrenByTagName(interceptorConfig, "interceptor"); ClassLoader loader = Thread.currentThread().getContextClassLoader(); if( interceptorClasses != null ) interceptorClasses.clear(); else interceptorClasses = new ArrayList(); while( interceptorElements != null && interceptorElements.hasNext() ) { Element ielement = (Element) interceptorElements.next(); String className = null; className = MetaData.getElementContent(ielement); Class clazz = loader.loadClass(className); interceptorClasses.add(clazz); } }
/** * Constructs a JDBCJBossQLQueryMetaData with JBossQL declared in the * jboss-ql elemnt and is invoked by the specified method. */ public JDBCJBossQLQueryMetaData(boolean resultTypeMappingLocal, Element element, Method method, JDBCReadAheadMetaData readAhead, Class compiler, boolean lazyResultSetLoading) throws DeploymentException { this.method = method; this.readAhead = readAhead; jbossQL = MetaData.getElementContent(element); if(jbossQL == null || jbossQL.trim().length() == 0) { throw new DeploymentException("jboss-ql element is empty"); } this.resultTypeMappingLocal = resultTypeMappingLocal; this.compiler = compiler; this.lazyResultSetLoading = lazyResultSetLoading; }
public void importXml(Element ielement) { try { Element element = MetaData.getOptionalChild(ielement, "retry-handlers"); if (element == null) return; ArrayList list = new ArrayList(); Iterator handlers = MetaData.getChildrenByTagName(element, "handler"); while (handlers.hasNext()) { Element handler = (Element)handlers.next(); String className = MetaData.getElementContent(handler).trim(); Class clazz = SecurityActions.getContextClassLoader().loadClass(className); list.add(clazz.newInstance()); } retryHandlers = (TxRetryExceptionHandler[])list.toArray(new TxRetryExceptionHandler[list.size()]); } catch (Exception ex) { log.warn("Unable to importXml for the TxInterceptorCMT", ex); } }