/* * JBoss, Home of Professional Open Source. * Copyright 2006, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.metadata; import java.util.ArrayList; import java.util.Iterator; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.w3c.dom.Node; import org.jboss.deployment.DeploymentException; import org.jboss.logging.Logger; import org.jboss.util.StringPropertyReplacer; /** * An abstract base class for metadata containers. * * @author Sebastien Alborini * @version $Revision: 57209 $ */ public abstract class MetaData implements Cloneable, XmlLoadable { // Constants ----------------------------------------------------- protected static Logger log = Logger.getLogger(MetaData.class); // These do not really belong here public static final byte TX_NOT_SUPPORTED = 0; public static final byte TX_REQUIRED = 1; public static final byte TX_SUPPORTS = 2; public static final byte TX_REQUIRES_NEW = 3; public static final byte TX_MANDATORY = 4; public static final byte TX_NEVER = 5; public static final byte TX_UNKNOWN = 6; // Attributes ---------------------------------------------------- // Static -------------------------------------------------------- /** * Returns an iterator over the children of the given element with * the given tag name. * * @param element The parent element * @param tagName The name of the desired child * @return An interator of children or null if element is null. */ public static Iterator getChildrenByTagName(Element element, String tagName) { if (element == null) return null; // getElementsByTagName gives the corresponding elements in the whole // descendance. We want only children NodeList children = element.getChildNodes(); ArrayList goodChildren = new ArrayList(); for (int i=0; i= 0; } // Private ------------------------------------------------------- // Inner classes ------------------------------------------------- } /* vim:ts=3:sw=3:et */