001: package org.drools.xml;
002:
003: /*
004: * Copyright 2005 JBoss Inc
005: *
006: * Licensed under the Apache License, Version 2.0 (the "License");
007: * you may not use this file except in compliance with the License.
008: * You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: */
018:
019: /**
020: * Configuration passed to a configurable <code>SemanticComponent</code>.
021: *
022: * <p>
023: * A <code>Configuration</code> may actually form a tree-shaped structure in
024: * order to hold complex configuration data. Each node in the tree is
025: * represented by a <code>Configuration</code> object that has a name and may
026: * contain attributes, children and text.
027: * </p>
028: *
029: * @author <a href="mailto:bob@werken.com">bob mcwhirter </a>
030: *
031: * @version $Id: Configuration.java,v 1.5 2005/01/23 18:16:20 mproctor Exp $
032: */
033: public interface Configuration {
034: // ----------------------------------------------------------------------
035: // Constants
036: // ----------------------------------------------------------------------
037:
038: /** Empty <code>Configuration</code> array. */
039: Configuration[] EMPTY_ARRAY = new Configuration[0];
040:
041: // ----------------------------------------------------------------------
042: // Interface
043: // ----------------------------------------------------------------------
044:
045: /**
046: * Retrieve the node name.
047: *
048: * @return The node name.
049: */
050: String getName();
051:
052: /**
053: * Retrieve the node text.
054: *
055: * @return The node text.
056: */
057: String getText();
058:
059: /**
060: * Retrieve an attribute value.
061: *
062: * @param name The attribute name.
063: *
064: * @return The attribute value or <code>null</code> if no attribute
065: * matches the specified name.
066: */
067: String getAttribute(String name);
068:
069: /**
070: * Retrieve all attribute names.
071: *
072: * @return The attribute names.
073: */
074: String[] getAttributeNames();
075:
076: /**
077: * Retrieve a child node.
078: *
079: * @param name The child name.
080: *
081: * @return The first child matching the specified name, otherwise
082: * <code>null</code> if none match.
083: */
084: Configuration getChild(String name);
085:
086: /**
087: * Retrieve children nodes.
088: *
089: * @param name The child name.
090: *
091: * @return All children matching the specified name, otherwise an empty
092: * array if none match.
093: */
094: Configuration[] getChildren(String name);
095:
096: /**
097: * Retrieve all children nodes.
098: *
099: * @return All children nodes, otherwise an empty array if this node
100: * contains no children.
101: */
102: Configuration[] getChildren();
103: }
|