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); } }
/** * Gets the child of the specified element having the * specified name. If the child with this name doesn't exist * then the supplied default element is returned instead. * * @param element the parent element * @param tagName the name of the desired child * @param defaultElement the element to return if the child * doesn't exist * @return either the named child or the supplied default */ public static Element getOptionalChild(Element element, String tagName, Element defaultElement) { Iterator goodChildren = getChildrenByTagName(element, tagName); if (goodChildren != null && goodChildren.hasNext()) { Element child = (Element)goodChildren.next(); if (goodChildren.hasNext()) { throw new IllegalStateException("expected only one " + tagName + " tag"); } return child; } else { return defaultElement; } }
/** * Gets the child of the specified element having the * specified name. If the child with this name doesn't exist * then the supplied default element is returned instead. * * @param element the parent element * @param tagName the name of the desired child * @param defaultElement the element to return if the child * doesn't exist * @return either the named child or the supplied default */ public static Element getOptionalChild(Element element, String tagName, Element defaultElement) { Iterator goodChildren = getChildrenByTagName(element, tagName); if (goodChildren != null && goodChildren.hasNext()) { Element child = (Element)goodChildren.next(); if (goodChildren.hasNext()) { throw new IllegalStateException("expected only one " + tagName + " tag"); } return child; } else { return defaultElement; } }
/** * Gets the child of the specified element having the specified unique * name. If there are more than one children elements with the same name * and exception is thrown. * * @param element The parent element * @param tagName The name of the desired child * @return The named child. * * @throws DeploymentException Child was not found or was not unique. */ public static Element getUniqueChild(Element element, String tagName) { Iterator goodChildren = getChildrenByTagName(element, tagName); if (goodChildren != null && goodChildren.hasNext()) { Element child = (Element)goodChildren.next(); if (goodChildren.hasNext()) { throw new IllegalStateException("expected only one " + tagName + " tag"); } return child; } else { throw new IllegalStateException("expected one " + tagName + " tag"); } }
/** * Gets the child of the specified element having the specified unique * name. If there are more than one children elements with the same name * and exception is thrown. * * @param element The parent element * @param tagName The name of the desired child * @return The named child. * * @throws DeploymentException Child was not found or was not unique. */ public static Element getUniqueChild(Element element, String tagName) { Iterator goodChildren = getChildrenByTagName(element, tagName); if (goodChildren != null && goodChildren.hasNext()) { Element child = (Element)goodChildren.next(); if (goodChildren.hasNext()) { throw new IllegalStateException("expected only one " + tagName + " tag"); } return child; } else { throw new IllegalStateException("expected one " + tagName + " tag"); } }
public JDBCLeftJoinMetaData(Element element) throws DeploymentException { cmrField = element.getAttribute("cmr-field"); if(cmrField == null || cmrField.trim().length() == 0) { throw new DeploymentException("left-join MUST have non-empty cmr-field attribute."); } String eagerLoadGroup = element.getAttribute("eager-load-group"); if(eagerLoadGroup == null || eagerLoadGroup.trim().length() == 0) { this.eagerLoadGroup = "*"; } else { this.eagerLoadGroup = eagerLoadGroup; } Iterator leftJoinIterator = MetaData.getChildrenByTagName(element, "left-join"); leftJoinList = readLeftJoinList(leftJoinIterator); }
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); } }
/** * Constructs a value class metadata class with the data contained in * the dependent-value-class xml element from a jbosscmp-jdbc xml file. * * @param classElement the xml Element which contains the metadata about * this value class * @param classLoader the ClassLoader which is used to load this value class * @throws DeploymentException if the xml element is not semantically correct */ public JDBCValueClassMetaData(Element classElement, ClassLoader classLoader) throws DeploymentException { String className = MetaData.getUniqueChildContent(classElement, "class"); try { javaType = classLoader.loadClass(className); } catch (ClassNotFoundException e) { throw new DeploymentException("dependent-value-class not found: " + className); } List propertyList = new ArrayList(); Iterator iterator = MetaData.getChildrenByTagName(classElement, "property"); while(iterator.hasNext()) { Element propertyElement = (Element)iterator.next(); propertyList.add(new JDBCValuePropertyMetaData(propertyElement, javaType)); } properties = Collections.unmodifiableList(propertyList); }
throws Exception Iterator interceptorElements = MetaData.getChildrenByTagName(interceptors, "interceptor"); ClassLoader loader = container.getClassLoader(); while(interceptorElements != null && interceptorElements.hasNext())
public void startService() throws Exception { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); URL stdJDBCUrl = classLoader.getResource("standardjbosscmp-jdbc.xml"); if(stdJDBCUrl == null) { throw new DeploymentException("No standardjbosscmp-jdbc.xml found"); } boolean debug = log.isDebugEnabled(); if(debug) { log.debug("Loading standardjbosscmp-jdbc.xml : " + stdJDBCUrl.toString()); } Element stdJDBCElement = XmlFileLoader.getDocument(stdJDBCUrl, true).getDocumentElement(); Element typeMaps = MetaData.getOptionalChild(stdJDBCElement, "type-mappings"); if(typeMaps != null) { for(Iterator i = MetaData.getChildrenByTagName(typeMaps, "type-mapping"); i.hasNext();) { Element typeMappingElement = (Element)i.next(); JDBCTypeMappingMetaData typeMapping = new JDBCTypeMappingMetaData(typeMappingElement); typeMappings.put(typeMapping.getName(), typeMapping); log.debug("added type-mapping: " + typeMapping.getName()); } } }
Iterator loadGroupNames = MetaData.getChildrenByTagName(lazyLoadGroupsElement, "load-group-name"); while(loadGroupNames.hasNext())
for( Iterator iter = MetaData.getChildrenByTagName( element, "attribute" ); iter.hasNext(); )
for( Iterator iter = MetaData.getChildrenByTagName( element, "attribute" ); iter.hasNext(); )
private Method[] getQueryMethods(Element queryElement) throws DeploymentException { // query-method sub-element Element queryMethod = MetaData.getUniqueChild(queryElement, "query-method"); // method name String methodName = MetaData.getUniqueChildContent(queryMethod, "method-name"); // method params ArrayList methodParams = new ArrayList(); Element methodParamsElement = MetaData.getUniqueChild(queryMethod, "method-params"); Iterator iterator = MetaData.getChildrenByTagName(methodParamsElement, "method-param"); while(iterator.hasNext()) { methodParams.add(MetaData.getElementContent((Element) iterator.next())); } try { Class[] parameters = Classes.convertToJavaClasses(methodParams.iterator(), entity.getClassLoader()); return getQueryMethods(methodName, parameters); } catch(ClassNotFoundException cnfe) { throw new DeploymentException(cnfe.getMessage()); } }
throw new DeploymentException("No ejb-relationship-role-name element found"); Iterator iter = MetaData.getChildrenByTagName(element, "ejb-relationship-role"); if (!iter.hasNext())
Iterator groups = MetaData.getChildrenByTagName(loadGroupsElement, "load-group"); while(groups.hasNext()) Iterator fields = MetaData.getChildrenByTagName(groupElement, "field-name"); while(fields.hasNext())
Iterator iter = MetaData.getChildrenByTagName(keysElement, "key-field");
if (activationConfig != null) Iterator<Element> iterator = MetaData.getChildrenByTagName(activationConfig, "activation-config-property"); while (iterator.hasNext())
Iterator iter = MetaData.getChildrenByTagName(element, "left-join"); leftJoinList = JDBCLeftJoinMetaData.readLeftJoinList(iter);