Browse Source

Add in proposals for replacement of the Avalon Configuration system

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271941 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Donald 23 years ago
parent
commit
6e94185c88
2 changed files with 109 additions and 0 deletions
  1. +80
    -0
      proposal/myrmidon/src/java/org/apache/myrmidon/api/metadata/ModelElement.java
  2. +29
    -0
      proposal/myrmidon/src/java/org/apache/myrmidon/api/metadata/Modeller.java

+ 80
- 0
proposal/myrmidon/src/java/org/apache/myrmidon/api/metadata/ModelElement.java View File

@@ -0,0 +1,80 @@
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.myrmidon.api.metadata;

/**
* A ModelElement represents the data necessary to configure
* the task or sub-object. It usually represents an XML element in a
* build file and has similar features to XML elements.
*
* <p>It has a set of un-ordered attributes with each attribute mapping
* a key to a value. The ModelElement can also have either a set of ordered
* sub-elements or text content (one or the other - not both).</p>
*
* @author <a href="mailto:peter@apache.org">Peter Donald</a>
* @version $Revision$ $Date$
*/
public class ModelElement
{
/**
* Return an array containing all the child <code>ModelElement</code>s
* that are contained within this <code>ModelElement</code>. If this method
* returns an array containing 1 or more elements then it must return null
* for getContent() method.
*
* @todo determine whether we return null or an empty array when no
* child elements.
* @return all the child <code>ModelElement</code>s
* @see #getContent()
*/
public ModelElement[] getChildren()
{
return null;
}

/**
* Return an array containing the names of all the attributes stored
* in this <code>ModelElement</code>. The user can then pass these
* parameters into the getAttribute() method of this class to get the
* value of the attribute.
*
* @return an array of the attribute names
* @see #getAttribute(String)
*/
public String[] getAttributeNames()
{
return null;
}

/**
* Get the value of the attribute passed in.
* If no such attribute exists return null.
*
* @param name the name of the attribute to retrieve value for
* @return the value of the attribute with specified name or null
* if no such element.
*/
public String getAttribute( final String name )
{
return null;
}

/**
* Retrieve the content of this element if any. Will return
* null if no content available. Note it is invalid for this
* method to return a non-null value and the getChildren()
* method to return an array of 1 or more child elements.
*
* @return the content value if any, else null
* @see #getChildren()
*/
public String getContent()
{
return null;
}
}

+ 29
- 0
proposal/myrmidon/src/java/org/apache/myrmidon/api/metadata/Modeller.java View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE.txt file.
*/
package org.apache.myrmidon.api.metadata;

/**
* The Modeller interface specifies that the implementing object
* wishes to handle its own configuration stage. In which case the
* object is passed the ModelElement representing itself and it uses
* the element to configure itself.
*
* @author <a href="mailto:peter@apache.org">Peter Donald</a>
* @version $Revision$ $Date$
* @see ModelElement
*/
public interface Modeller
{
/**
* Pass the object a read-only instance of it's own
* model.
*
* @param element the ModelElement representing object
*/
void model( ModelElement element );
}

Loading…
Cancel
Save