notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r2682 - in development/main/magic: core/src/main/net/dpml/magic core/src/main/net/dpml/magic/builder core/src/main/net/dpml/magic/model core/src/main/net/dpml/magic/project core/src/main/net/dpml/magic/tasks core/src/test/net/dpml/magic/builder/test core/src/test/net/dpml/magic/test spells/eclipse/src/main/net/dpml/magic/eclipse
- From: peter AT neubauer.se
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r2682 - in development/main/magic: core/src/main/net/dpml/magic core/src/main/net/dpml/magic/builder core/src/main/net/dpml/magic/model core/src/main/net/dpml/magic/project core/src/main/net/dpml/magic/tasks core/src/test/net/dpml/magic/builder/test core/src/test/net/dpml/magic/test spells/eclipse/src/main/net/dpml/magic/eclipse
- Date: Tue, 31 May 2005 04:06:07 -0400
Author: peter AT neubauer.se
Date: Tue May 31 04:06:06 2005
New Revision: 2682
Added:
development/main/magic/core/src/main/net/dpml/magic/AntFileIndex.java
development/main/magic/core/src/main/net/dpml/magic/builder/AntFileIndexBuilder.java
Modified:
development/main/magic/core/src/main/net/dpml/magic/Index.java
development/main/magic/core/src/main/net/dpml/magic/builder/XMLDefinitionBuilder.java
development/main/magic/core/src/main/net/dpml/magic/model/Definition.java
development/main/magic/core/src/main/net/dpml/magic/model/Module.java
development/main/magic/core/src/main/net/dpml/magic/model/Resource.java
development/main/magic/core/src/main/net/dpml/magic/project/Context.java
development/main/magic/core/src/main/net/dpml/magic/project/ProjectPath.java
development/main/magic/core/src/main/net/dpml/magic/tasks/CheckstyleTask.java
development/main/magic/core/src/main/net/dpml/magic/tasks/ContextualTask.java
development/main/magic/core/src/main/net/dpml/magic/tasks/InfoTask.java
development/main/magic/core/src/main/net/dpml/magic/tasks/JavadocTask.java
development/main/magic/core/src/main/net/dpml/magic/tasks/ModuleTask.java
development/main/magic/core/src/main/net/dpml/magic/tasks/ReactorTask.java
development/main/magic/core/src/test/net/dpml/magic/builder/test/IndexBuilderTestCase.java
development/main/magic/core/src/test/net/dpml/magic/test/IndexTestCase.java
development/main/magic/spells/eclipse/src/main/net/dpml/magic/eclipse/EclipseTask.java
Log:
starting to refactor the index, extracted a first interface, but not moved
build related functions out the the builder yet.
Added: development/main/magic/core/src/main/net/dpml/magic/AntFileIndex.java
==============================================================================
--- (empty file)
+++ development/main/magic/core/src/main/net/dpml/magic/AntFileIndex.java
Tue May 31 04:06:06 2005
@@ -0,0 +1,788 @@
+/*
+ * Copyright 2004 Stephen McConnell
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.magic;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+import net.dpml.lang.NullArgumentException;
+import net.dpml.magic.builder.ElementHelper;
+import net.dpml.magic.builder.AntFileIndexBuilder;
+import net.dpml.magic.builder.XMLDefinitionBuilder;
+import net.dpml.magic.model.Definition;
+import net.dpml.magic.model.Info;
+import net.dpml.magic.model.Module;
+import net.dpml.magic.model.Resource;
+import net.dpml.magic.model.ResourceRef;
+import net.dpml.transit.Transit;
+import net.dpml.transit.TransitException;
+import net.dpml.transit.artifact.Handler;
+import net.dpml.transit.repository.Repository;
+import net.dpml.transit.repository.StandardLoader;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Location;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.taskdefs.Property;
+import org.apache.tools.ant.types.DataType;
+import org.w3c.dom.Element;
+
+/**
+ * A Index is an immutable data object that aggregates a suite of buildable
+ * project defintions relative to local and external dependencies.
+ *
+ * @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class AntFileIndex extends DataType implements Index
+{
+ //-------------------------------------------------------------
+ // static
+ //-------------------------------------------------------------
+
+ public static final String BANNER =
+
"------------------------------------------------------------------------";
+
+ public static final String HOME_KEY = "project.home";
+ public static final String INDEX_KEY = "project.index";
+ public static final String HOSTS_KEY = "project.hosts";
+ public static final String GPG_EXE_KEY = "project.gpg.exe";
+
+ //-------------------------------------------------------------
+ // immutable state
+ //-------------------------------------------------------------
+
+ private final File m_index;
+ private final Hashtable m_resources = new Hashtable();
+ private final ArrayList m_includes = new ArrayList();
+ private final AntFileIndexBuilder m_builder;
+ private Repository m_repository;
+
+ //-------------------------------------------------------------
+ // constructor
+ //-------------------------------------------------------------
+
+ /**
+ * Creation of a new home using a supplied index.
+ * @param proj the ant project establishing the home
+ * @param system the magic system instance
+ * @param index the magic project index
+ * @exception NullArgumentException if any of the supplied arguments are
null.
+ */
+ public AntFileIndex( Project proj, AntFileIndexBuilder system, File
index )
+ throws TransitException, NullArgumentException
+ {
+ if( null == proj )
+ {
+ throw new NullArgumentException( "project" );
+ }
+
+ if( null == system )
+ {
+ throw new NullArgumentException( "system" );
+ }
+
+ if( null == index )
+ {
+ throw new NullArgumentException( "index" );
+ }
+
+ setProject( proj );
+
+ if( !index.exists() )
+ {
+ throw new BuildException(
+ new FileNotFoundException( index.toString() ) );
+ }
+
+ m_builder = system;
+
+ m_index = resolveIndex( index );
+
+ final File user = new File( System.getProperty( "user.home" ) );
+ final File props = new File( user, "magic.properties" );
+ loadProperties( proj, props );
+
+ File base = m_index.getParentFile();
+ processModuleProperties( proj, base );
+
+ //
+ // load the initial context
+ //
+
+ m_repository = new StandardLoader();
+ File home = getHomeDirectory();
+ if( null == proj.getProperty( HOME_KEY ) )
+ {
+ proj.setNewProperty( HOME_KEY, home.getAbsolutePath() );
+ }
+ File magic = new File( home, "magic.properties" );
+ loadProperties( proj, magic );
+
+ //
+ // load the system wide properties
+ //
+
+ File siteUserProperties = new File( Transit.DPML_PREFS,
"magic/user.properties" );
+ loadProperties( proj, siteUserProperties );
+
+ File siteProperties = new File( Transit.DPML_PREFS,
"magic/magic.properties" );
+ loadProperties( proj, siteProperties );
+
+ //
+ // build the index
+ //
+
+ buildList( m_index );
+ int n = m_resources.size();
+ log( "Resources: " + n, Project.MSG_VERBOSE );
+ }
+
+ private void processModuleProperties( Project proj, File base )
+ {
+ if( null == base )
+ {
+ return;
+ }
+ File module = new File( base, "module.properties" );
+ loadProperties( proj, module );
+ File parent = base.getParentFile();
+ processModuleProperties( proj, parent );
+ }
+
+ //-------------------------------------------------------------
+ // implementation
+ //-------------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#getHomeDirectory()
+ */
+ public File getHomeDirectory()
+ {
+ return new File( Transit.DPML_PREFS, "transit" );
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#getCacheDirectory()
+ */
+ public File getCacheDirectory()
+ {
+ return new File( Transit.DPML_DATA, "cache" );
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#getDocsDirectory()
+ */
+ public File getDocsDirectory()
+ {
+ return new File( Transit.DPML_DATA, "docs" );
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#getRepository()
+ */
+ public Repository getRepository()
+ {
+ return m_repository;
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#getIndexFile()
+ */
+ public File getIndexFile()
+ {
+ return m_index;
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#getIndexLastModified()
+ */
+ public long getIndexLastModified()
+ {
+ return m_index.lastModified();
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#getProperty(java.lang.String)
+ */
+ public String getProperty( String key )
+ {
+ return getProperty( key, null );
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#getProperty(java.lang.String, java.lang.String)
+ */
+ public String getProperty( String key, String fallback )
+ {
+ String value = getProject().getProperty( key );
+ if( null == value )
+ {
+ return fallback;
+ }
+ else
+ {
+ return value;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#isaResourceKey(java.lang.String)
+ */
+ public boolean isaResourceKey( String key )
+ {
+ return ( null != m_resources.get( key ) );
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#isaRelease()
+ */
+ public boolean isaRelease()
+ {
+ return m_builder.isaRelease();
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#getReleaseSignature()
+ */
+ public String getReleaseSignature()
+ {
+ return m_builder.getReleaseSignature();
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#getResources()
+ */
+ public Resource[] getResources()
+ {
+ return (Resource[]) m_resources.values().toArray( new Resource[0] );
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#isaDefinition(net.dpml.magic.model.ResourceRef)
+ */
+ public boolean isaDefinition( final ResourceRef reference )
+ {
+ return ( getResource( reference ) instanceof Definition );
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#getDefinitions()
+ */
+ public Definition[] getDefinitions()
+ throws BuildException
+ {
+ final ArrayList list = new ArrayList();
+ final Resource[] resources = getResources();
+ for( int i=0; i<resources.length; i++ )
+ {
+ final Resource resource = resources[i];
+ if( resource instanceof Definition )
+ {
+ list.add( resource );
+ }
+ }
+ return (Definition[]) list.toArray( new Definition[0] );
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#getSubsidiaryRefs(net.dpml.magic.model.Resource)
+ */
+ public ResourceRef[] getSubsidiaryRefs( Resource module )
+ throws BuildException
+ {
+ if( !"module".equals( module.getInfo().getType() ) )
+ {
+ final String error =
+ "Resource argument [" + module + "] is not a module.";
+ throw new BuildException( error );
+ }
+
+ final String group = module.getInfo().getGroup();
+ final ArrayList list = new ArrayList();
+ Resource[] resources = getResources();
+ for( int i=0; i<resources.length; i++ )
+ {
+ Resource resource = resources[i];
+ if( resource.getInfo().getGroup().startsWith( group + "/" ) )
+ {
+ list.add( new ResourceRef( resource.getKey() ) );
+ }
+ else if( resource.getInfo().getGroup().equals( group )
+ && !resource.getKey().equals( module.getKey() ) )
+ {
+ list.add( new ResourceRef( resource.getKey() ) );
+ }
+ }
+ if( module instanceof Definition )
+ {
+ Definition def = (Definition) module;
+ ResourceRef[] parts = def.getPartRefs();
+ for( int i=0; i<parts.length; i++ )
+ {
+ list.add( parts[i] );
+ }
+ }
+ return (ResourceRef[]) list.toArray( new ResourceRef[0] );
+ }
+
+ /* (non-Javadoc)
+ * @see
net.dpml.magic.Index#getSubsidiaryDefinitions(net.dpml.magic.model.Resource)
+ */
+ public Definition[] getSubsidiaryDefinitions( Resource module )
+ throws BuildException
+ {
+ final String group = module.getInfo().getGroup();
+ final ArrayList list = new ArrayList();
+ Definition[] defs = getDefinitions();
+ for( int i=0; i<defs.length; i++ )
+ {
+ Definition d = defs[i];
+ if( d.getInfo().getGroup().startsWith( group + "/" ) )
+ {
+ list.add( d );
+ }
+ else if( d.getInfo().getGroup().equals( group )
+ && !d.getKey().equals( module.getKey() ) )
+ {
+ list.add( d );
+ }
+ }
+ return (Definition[]) list.toArray( new Definition[0] );
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#getResource(java.lang.String)
+ */
+ public Resource getResource( final String key )
+ throws BuildException
+ {
+ final ResourceRef reference = new ResourceRef( key );
+ return getResource( reference );
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#getResource(net.dpml.magic.model.ResourceRef)
+ */
+ public Resource getResource( final ResourceRef reference )
+ throws BuildException
+ {
+ final String key = reference.getKey();
+ final Resource resource = (Resource) m_resources.get( key );
+ if( null == resource )
+ {
+ throw new UnknownResourceException( key );
+ }
+ return resource;
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#getDefinition(java.lang.String)
+ */
+ public Definition getDefinition( final String key )
+ throws BuildException
+ {
+ final ResourceRef reference = new ResourceRef( key );
+ return getDefinition( reference );
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#getDefinition(net.dpml.magic.model.ResourceRef)
+ */
+ public Definition getDefinition( final ResourceRef reference )
+ throws BuildException
+ {
+ final Resource resource = getResource( reference );
+ if( resource instanceof Definition )
+ {
+ return (Definition) resource;
+ }
+ else
+ {
+ final String error =
+ "Reference [" + reference + "] does not refer to a projects.";
+ throw new BuildException( error );
+ }
+ }
+
+ //-------------------------------------------------------------
+ // internal
+ //-------------------------------------------------------------
+
+ /**
+ * Populate the index from the contents of the supplied XML source.
+ * @param source the index source file
+ */
+ private void buildList( final File source )
+ {
+ buildList( source, null );
+ }
+
+ private void buildList( final File source, String uri )
+ {
+ final String filename = source.toString();
+ final boolean exists = m_includes.contains( filename );
+ if( exists )
+ {
+ return;
+ }
+
+ log( "import: " + source, Project.MSG_DEBUG );
+ m_includes.add( filename );
+
+ try
+ {
+ final Element root = ElementHelper.getRootElement( source );
+ final String rootElementName = root.getTagName();
+ if( "index".equals( rootElementName ) )
+ {
+ buildIndex( source, root, uri );
+ }
+ else if( "module".equals( rootElementName ) )
+ {
+ buildModule( root, source );
+ }
+ else
+ {
+ final String error =
+ "Unrecognized root element [" + rootElementName + "].";
+ throw new BuildException( error );
+ }
+ }
+ catch( Throwable e )
+ {
+ throw new BuildException( e, new Location( source.toString() ) );
+ }
+ }
+
+ private void buildIndex( File source, Element root, String uri )
+ {
+ //
+ // its a native magic index
+ //
+
+ String key = ElementHelper.getAttribute( root, "key", null );
+ final Element[] elements = ElementHelper.getChildren( root );
+ final File anchor = source.getParentFile();
+
+ if( ( null != key ) && ( key.length() > 0 ) )
+ {
+ buildLocalList( anchor, elements, "key:" + key );
+ }
+ else if( ( null != uri ) && uri.length() > 0 )
+ {
+ buildLocalList( anchor, elements, uri );
+ }
+ else
+ {
+ buildLocalList( anchor, elements, "key:UNKNOWN" );
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see net.dpml.magic.Index#buildModule(java.io.File)
+ */
+ public Module buildModule( File source )
+ {
+ try
+ {
+ final Element root = ElementHelper.getRootElement( source );
+ final String rootElementName = root.getTagName();
+ if( "module".equals( rootElementName ) )
+ {
+ return buildModule( root, source );
+ }
+ else
+ {
+ final String error =
+ "Unexpected root module element name ["
+ + rootElementName
+ + "] while reading source ["
+ + source + "].";
+ throw new BuildException( error );
+ }
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Module construction failure using source ["
+ + source
+ + "]";
+ throw new BuildException( error, e );
+ }
+ }
+
+ private Module buildModule( String uri )
+ {
+ try
+ {
+ URL artifact = new URL( null, uri, new Handler() );
+ File local = (File) artifact.getContent( new Class[]{ File.class
} );
+ final Element root = ElementHelper.getRootElement( local );
+ return buildModule( root, local );
+ }
+ catch( IOException ioe )
+ {
+ final String error =
+ "Failed to load module ["
+ + uri
+ + "]."
+ + ioe.toString();
+ throw new BuildException( error, ioe );
+ }
+ }
+
+ private Module buildModule( Element root, File source )
+ {
+ //
+ // its a module definition so we need to add the module as an
available
+ // resources and add all of the resources defined by the module
+ //
+
+ final String moduleUri = ElementHelper.getAttribute( root, "uri" );
+ if( "".equals( moduleUri ) || ( null == moduleUri ) )
+ {
+ String mess =
+ "Modules must contain a \"uri\" attribute in the root module
element: "
+ + source;
+ throw new BuildException( mess );
+ }
+
+ Info info = createInfo( moduleUri );
+ String key = info.getName();
+
+ if( m_resources.containsKey( key ) )
+ {
+ Resource resource = getResource( key );
+ if( resource instanceof Module )
+ {
+ return (Module) resource;
+ }
+ else
+ {
+ final String error =
+ "Source index or module ["
+ + source
+ + "] declares the key ["
+ + key
+ + "] that is already bound.";
+ throw new BuildException( error );
+ }
+ }
+
+ Module.Header header = Module.Header.create( root );
+ String[] imports = Module.createImports( root );
+ ResourceRef[] refs = new ResourceRef[ imports.length ];
+ for( int i=0; i < imports.length; i++ )
+ {
+ String spec = imports[i];
+ Module link = buildModule( spec );
+ refs[i] = new ResourceRef( link.getKey() );
+ }
+
+ final Element resources = ElementHelper.getChild( root, "resources"
);
+ final ResourceRef[] children = buildResources( resources, source,
moduleUri );
+
+ Module module = new Module( this, key, info, refs, "key:NULL",
header, children );
+ m_resources.put( key, module );
+ log( "module: " + module, Project.MSG_VERBOSE );
+
+ return module;
+ }
+
+ private ResourceRef[] buildResources( final Element resources, File
source, final String moduleUri )
+ {
+ final Element[] elements = ElementHelper.getChildren( resources,
"resource" );
+ final File anchor = source.getParentFile();
+ final ResourceRef[] children = new ResourceRef[ elements.length ];
+ for( int i=0; i < elements.length; i++ )
+ {
+ final Resource resource = createResource( elements[i], anchor,
moduleUri );
+ final String k = resource.getKey();
+ if( !m_resources.containsKey( k ) )
+ {
+ m_resources.put( k, resource );
+ log( "resource: " + resource, Project.MSG_VERBOSE );
+ }
+ }
+ return children;
+ }
+
+ private Info createInfo( String uri )
+ {
+ try
+ {
+ return Info.create( uri );
+ }
+ catch( Exception e )
+ {
+ throw new BuildException( e );
+ }
+ }
+
+ private File resolveIndex( File file )
+ {
+ if( file.isDirectory() )
+ {
+ return new File( file, "index.xml" );
+ }
+ else
+ {
+ return file;
+ }
+ }
+
+ private void buildLocalList( final File anchor, final Element[]
children, String uri )
+ {
+ log( "entries: " + children.length, Project.MSG_VERBOSE );
+ for( int i = 0; i < children.length; i++ )
+ {
+ final Element element = children[i];
+ final String tag = element.getTagName();
+ if( "import".equals( element.getTagName() ) )
+ {
+ buildImport( element, anchor, uri );
+ }
+ else if( isaResource( tag ) )
+ {
+ buildResource( element, anchor, uri );
+ }
+ else
+ {
+ final String error =
+ "Unrecognized element type \"" + tag + "\" found in
index.";
+ throw new BuildException( error );
+ }
+ }
+ }
+
+ private void buildResource(final Element element, final File anchor,
String uri)
+ {
+ final Resource resource = createResource( element, anchor, uri );
+ final String key = resource.getKey();
+ if( !m_resources.containsKey( key ) )
+ {
+ m_resources.put( key, resource );
+ if( key.equals( resource.getInfo().getName() ) )
+ {
+ log( "resource: " + resource, Project.MSG_VERBOSE );
+ }
+ else
+ {
+ log( "resource: " + resource + " key=" + key,
Project.MSG_VERBOSE );
+ }
+ }
+ else
+ {
+ Resource r = (Resource) m_resources.get( key );
+ if( !r.equals( resource ) )
+ {
+ final String error =
+ "WARNING: Ignoring duplicate key reference ["
+ + key
+ + "].";
+ log( error, Project.MSG_WARN );
+ }
+ }
+ }
+
+ private void buildImport(final Element element, final File anchor,
String uri)
+ {
+ final String filename = element.getAttribute( "index" );
+ final String uriAttribute = element.getAttribute( "uri" );
+ String urn = parse( uriAttribute );
+ if(( null != filename ) && ( !"".equals( filename )))
+ {
+ final File index = AntFileIndexBuilder.getFile( anchor, filename
);
+ buildList( index, uri );
+ }
+ else if(null == urn || "".equals(urn))
+ {
+ final String error =
+ "Invalid import statement. No uri, index attribute.";
+ throw new BuildException( error );
+ }
+ else
+ {
+ // switch to artifact
+ if( !m_includes.contains( urn ) )
+ {
+ m_includes.add( urn );
+ try
+ {
+ URL artifact = new URL( null, urn, new Handler() );
+ File local = (File) artifact.getContent( new Class[]{
File.class } );
+ buildList( local, urn );
+ }
+ catch( IOException ioe )
+ {
+ final String error =
+ "Failed to load module ["
+ + urn
+ + "]."
+ + ioe.toString();
+ throw new BuildException( error, ioe );
+ }
+ }
+ }
+ }
+
+ private String parse( String value )
+ {
+ if( null == value )
+ {
+ return value;
+ }
+ String result = getProject().replaceProperties( value );
+ if( !result.equals( value ) )
+ {
+ return parse( result );
+ }
+ else
+ {
+ return result;
+ }
+ }
+
+ private Resource createResource( final Element element, final File
anchor, String uri )
+ {
+ return XMLDefinitionBuilder.createResource( this, element, anchor,
uri );
+ }
+
+ private boolean isaResource( final String tag )
+ {
+ return (
+ "resource".equals( tag )
+ || "project".equals( tag ) );
+ }
+
+ protected void loadProperties( final Project proj, final File file )
+ throws BuildException
+ {
+ final Property props = (Property) proj.createTask( "property" );
+ props.init();
+ props.setFile( file );
+ props.execute();
+ }
+}
Modified: development/main/magic/core/src/main/net/dpml/magic/Index.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/Index.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/Index.java Tue
May 31 04:06:06 2005
@@ -1,806 +1,144 @@
-/*
- * Copyright 2004 Stephen McConnell
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied.
- *
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
package net.dpml.magic;
import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Hashtable;
-
-import net.dpml.lang.NullArgumentException;
-import net.dpml.magic.builder.ElementHelper;
-import net.dpml.magic.builder.IndexBuilder;
-import net.dpml.magic.builder.XMLDefinitionBuilder;
+
import net.dpml.magic.model.Definition;
-import net.dpml.magic.model.Info;
import net.dpml.magic.model.Module;
import net.dpml.magic.model.Resource;
import net.dpml.magic.model.ResourceRef;
-import net.dpml.transit.Transit;
-import net.dpml.transit.TransitException;
-import net.dpml.transit.artifact.Handler;
import net.dpml.transit.repository.Repository;
-import net.dpml.transit.repository.StandardLoader;
import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Location;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Property;
-import org.apache.tools.ant.types.DataType;
-import org.w3c.dom.Element;
-
-/**
- * A Index is an immutable data object that aggregates a suite of buildable
- * project defintions relative to local and external dependencies.
- *
- * @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
- * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
- */
-public class Index extends DataType
-{
- //-------------------------------------------------------------
- // static
- //-------------------------------------------------------------
-
- public static final String BANNER =
-
"------------------------------------------------------------------------";
-
- public static final String HOME_KEY = "project.home";
- public static final String INDEX_KEY = "project.index";
- public static final String HOSTS_KEY = "project.hosts";
- public static final String GPG_EXE_KEY = "project.gpg.exe";
-
- //-------------------------------------------------------------
- // immutable state
- //-------------------------------------------------------------
-
- private final File m_index;
- private final Hashtable m_resources = new Hashtable();
- private final ArrayList m_includes = new ArrayList();
- private final IndexBuilder m_builder;
- private Repository m_repository;
-
- //-------------------------------------------------------------
- // constructor
- //-------------------------------------------------------------
-
- /**
- * Creation of a new home using a supplied index.
- * @param proj the ant project establishing the home
- * @param system the magic system instance
- * @param index the magic project index
- * @exception NullArgumentException if any of the supplied arguments are
null.
- */
- public Index( Project proj, IndexBuilder system, File index )
- throws TransitException, NullArgumentException
- {
- if( null == proj )
- {
- throw new NullArgumentException( "project" );
- }
-
- if( null == system )
- {
- throw new NullArgumentException( "system" );
- }
-
- if( null == index )
- {
- throw new NullArgumentException( "index" );
- }
-
- setProject( proj );
-
- if( !index.exists() )
- {
- throw new BuildException(
- new FileNotFoundException( index.toString() ) );
- }
-
- m_builder = system;
-
- m_index = resolveIndex( index );
-
- final File user = new File( System.getProperty( "user.home" ) );
- final File props = new File( user, "magic.properties" );
- loadProperties( proj, props );
-
- File base = m_index.getParentFile();
- processModuleProperties( proj, base );
-
- //
- // load the initial context
- //
-
- m_repository = new StandardLoader();
- File home = getHomeDirectory();
- if( null == proj.getProperty( HOME_KEY ) )
- {
- proj.setNewProperty( HOME_KEY, home.getAbsolutePath() );
- }
- File magic = new File( home, "magic.properties" );
- loadProperties( proj, magic );
-
- //
- // load the system wide properties
- //
-
- File siteUserProperties = new File( Transit.DPML_PREFS,
"magic/user.properties" );
- loadProperties( proj, siteUserProperties );
-
- File siteProperties = new File( Transit.DPML_PREFS,
"magic/magic.properties" );
- loadProperties( proj, siteProperties );
-
- //
- // build the index
- //
-
- buildList( m_index );
- int n = m_resources.size();
- log( "Resources: " + n, Project.MSG_VERBOSE );
- }
-
- private void processModuleProperties( Project proj, File base )
- {
- if( null == base )
- {
- return;
- }
- File module = new File( base, "module.properties" );
- loadProperties( proj, module );
- File parent = base.getParentFile();
- processModuleProperties( proj, parent );
- }
-
- //-------------------------------------------------------------
- // implementation
- //-------------------------------------------------------------
-
- public File getHomeDirectory()
- {
- return new File( Transit.DPML_PREFS, "transit" );
- }
-
- public File getCacheDirectory()
- {
- return new File( Transit.DPML_DATA, "cache" );
- }
-
- public File getDocsDirectory()
- {
- return new File( Transit.DPML_DATA, "docs" );
- }
-
- public Repository getRepository()
- {
- return m_repository;
- }
-
- /**
- * Return the index file used to establish this home.
- * @return the index file
- */
- public File getIndexFile()
- {
- return m_index;
- }
-
- /**
- * Return the last modification time of the index file as a long.
- * @return the last modification time
- */
- public long getIndexLastModified()
- {
- return m_index.lastModified();
- }
-
- /**
- * Return a property declared under the project that established the root
index.
- * @param key the property key
- * @return the value matching the supplied property key
- */
- public String getProperty( String key )
- {
- return getProperty( key, null );
- }
-
- /**
- * Return a property declared undr the project that established the root
index.
- * @param key the property key
- * @param fallback the default value if the property is undefined
- * @return the value matching the supplied property key or the default
- */
- public String getProperty( String key, String fallback )
- {
- String value = getProject().getProperty( key );
- if( null == value )
- {
- return fallback;
- }
- else
- {
- return value;
- }
- }
-
-
- /**
- * Return TRUE if the supplied key is the name of a key of a resource
- * declared within this home.
- * @param key the key
- */
- public boolean isaResourceKey( String key )
- {
- return ( null != m_resources.get( key ) );
- }
-
- /**
- * Return TRUE if this is a release build.
- * @return TRUE if this is a release build sequence
- */
- public boolean isaRelease()
- {
- return m_builder.isaRelease();
- }
-
- /**
- * Return the release signature.
- * @return a string corresponding to the svn revision or null
- * if this is not a release build
- */
- public String getReleaseSignature()
- {
- return m_builder.getReleaseSignature();
- }
-
- /**
- * Return all of the resource declared within this home.
- * @return the resource defintions
- */
- public Resource[] getResources()
- {
- return (Resource[]) m_resources.values().toArray( new Resource[0] );
- }
-
- /**
- * Return TRUE if the suppied resource ref references a project
- * definition.
- * @return TRUE is the resource is a definition
- */
- public boolean isaDefinition( final ResourceRef reference )
- {
- return ( getResource( reference ) instanceof Definition );
- }
-
- /**
- * Return all definitions with the home.
- *
- * @return array of know definitions
- */
- public Definition[] getDefinitions()
- throws BuildException
- {
- final ArrayList list = new ArrayList();
- final Resource[] resources = getResources();
- for( int i=0; i<resources.length; i++ )
- {
- final Resource resource = resources[i];
- if( resource instanceof Definition )
- {
- list.add( resource );
- }
- }
- return (Definition[]) list.toArray( new Definition[0] );
- }
-
- /**
- * Return all resource refs within the index that are members of the
- * group identified by the supplied resource and not equal to the
- * supplied resource key.
- *
- * @return array of subsidiary resources
- */
- public ResourceRef[] getSubsidiaryRefs( Resource module )
- throws BuildException
- {
- if( !"module".equals( module.getInfo().getType() ) )
- {
- final String error =
- "Resource argument [" + module + "] is not a module.";
- throw new BuildException( error );
- }
-
- final String group = module.getInfo().getGroup();
- final ArrayList list = new ArrayList();
- Resource[] resources = getResources();
- for( int i=0; i<resources.length; i++ )
- {
- Resource resource = resources[i];
- if( resource.getInfo().getGroup().startsWith( group + "/" ) )
- {
- list.add( new ResourceRef( resource.getKey() ) );
- }
- else if( resource.getInfo().getGroup().equals( group )
- && !resource.getKey().equals( module.getKey() ) )
- {
- list.add( new ResourceRef( resource.getKey() ) );
- }
- }
- if( module instanceof Definition )
- {
- Definition def = (Definition) module;
- ResourceRef[] parts = def.getPartRefs();
- for( int i=0; i<parts.length; i++ )
- {
- list.add( parts[i] );
- }
- }
- return (ResourceRef[]) list.toArray( new ResourceRef[0] );
- }
-
- /**
- * Return all definitions with the index that are members of the
- * group identified by the supplied resource and not equal to the
- * supplied resoruce key.
- *
- * @return array of subsidiary definitions
- */
- public Definition[] getSubsidiaryDefinitions( Resource module )
- throws BuildException
- {
- final String group = module.getInfo().getGroup();
- final ArrayList list = new ArrayList();
- Definition[] defs = getDefinitions();
- for( int i=0; i<defs.length; i++ )
- {
- Definition d = defs[i];
- if( d.getInfo().getGroup().startsWith( group + "/" ) )
- {
- list.add( d );
- }
- else if( d.getInfo().getGroup().equals( group )
- && !d.getKey().equals( module.getKey() ) )
- {
- list.add( d );
- }
- }
- return (Definition[]) list.toArray( new Definition[0] );
- }
-
- /**
- * Return a resource matching the supplied key.
- * @return the resource mathing the key
- * @exception BuildException if the resource is unknown
- */
- public Resource getResource( final String key )
- throws BuildException
- {
- final ResourceRef reference = new ResourceRef( key );
- return getResource( reference );
- }
-
- /**
- * Return a resource matching the supplied reference.
- * @return the resource mathing the reference
- * @exception BuildException if the resource is unknown
- */
- public Resource getResource( final ResourceRef reference )
- throws BuildException
- {
- final String key = reference.getKey();
- final Resource resource = (Resource) m_resources.get( key );
- if( null == resource )
- {
- throw new UnknownResourceException( key );
- }
- return resource;
- }
-
- /**
- * Return a definition matching the supplied key.
- * @return the definition mathing the key
- * @exception BuildException if the definition is unknown
- */
- public Definition getDefinition( final String key )
- throws BuildException
- {
- final ResourceRef reference = new ResourceRef( key );
- return getDefinition( reference );
- }
-
- /**
- * Return a definition matching the supplied reference.
- * @return the definition mathing the reference
- * @exception BuildException if the definition is unknown
- */
- public Definition getDefinition( final ResourceRef reference )
- throws BuildException
- {
- final Resource resource = getResource( reference );
- if( resource instanceof Definition )
- {
- return (Definition) resource;
- }
- else
- {
- final String error =
- "Reference [" + reference + "] does not refer to a projects.";
- throw new BuildException( error );
- }
- }
-
- //-------------------------------------------------------------
- // internal
- //-------------------------------------------------------------
-
- /**
- * Populate the index from the contents of the supplied XML source.
- * @param source the index source file
- */
- private void buildList( final File source )
- {
- buildList( source, null );
- }
-
- private void buildList( final File source, String uri )
- {
- final String filename = source.toString();
- final boolean exists = m_includes.contains( filename );
- if( exists )
- {
- return;
- }
-
- log( "import: " + source, Project.MSG_DEBUG );
- m_includes.add( filename );
-
- try
- {
- final Element root = ElementHelper.getRootElement( source );
- final String rootElementName = root.getTagName();
- if( "index".equals( rootElementName ) )
- {
- buildIndex( source, root, uri );
- }
- else if( "module".equals( rootElementName ) )
- {
- buildModule( root, source );
- }
- else
- {
- final String error =
- "Unrecognized root element [" + rootElementName + "].";
- throw new BuildException( error );
- }
- }
- catch( Throwable e )
- {
- throw new BuildException( e, new Location( source.toString() ) );
- }
- }
-
- private void buildIndex( File source, Element root, String uri )
- {
- //
- // its a native magic index
- //
-
- String key = ElementHelper.getAttribute( root, "key", null );
- final Element[] elements = ElementHelper.getChildren( root );
- final File anchor = source.getParentFile();
-
- if( ( null != key ) && ( key.length() > 0 ) )
- {
- buildLocalList( anchor, elements, "key:" + key );
- }
- else if( ( null != uri ) && uri.length() > 0 )
- {
- buildLocalList( anchor, elements, uri );
- }
- else
- {
- buildLocalList( anchor, elements, "key:UNKNOWN" );
- }
- }
-
- public Module buildModule( File source )
- {
- try
- {
- final Element root = ElementHelper.getRootElement( source );
- final String rootElementName = root.getTagName();
- if( "module".equals( rootElementName ) )
- {
- return buildModule( root, source );
- }
- else
- {
- final String error =
- "Unexpected root module element name ["
- + rootElementName
- + "] while reading source ["
- + source + "].";
- throw new BuildException( error );
- }
- }
- catch( Throwable e )
- {
- final String error =
- "Module construction failure using source ["
- + source
- + "]";
- throw new BuildException( error, e );
- }
- }
-
- private Module buildModule( String uri )
- {
- try
- {
- URL artifact = new URL( null, uri, new Handler() );
- File local = (File) artifact.getContent( new Class[]{ File.class
} );
- final Element root = ElementHelper.getRootElement( local );
- return buildModule( root, local );
- }
- catch( IOException ioe )
- {
- final String error =
- "Failed to load module ["
- + uri
- + "]."
- + ioe.toString();
- throw new BuildException( error, ioe );
- }
- }
-
- private Module buildModule( Element root, File source )
- {
- //
- // its a module definition so we need to add the module as an
available
- // resources and add all of the resources defined by the module
- //
-
- final String moduleUri = ElementHelper.getAttribute( root, "uri" );
- if( "".equals( moduleUri ) || ( null == moduleUri ) )
- {
- String mess =
- "Modules must contain a \"uri\" attribute in the root module
element: "
- + source;
- throw new BuildException( mess );
- }
-
- Info info = createInfo( moduleUri );
- String key = info.getName();
-
- if( m_resources.containsKey( key ) )
- {
- Resource resource = getResource( key );
- if( resource instanceof Module )
- {
- return (Module) resource;
- }
- else
- {
- final String error =
- "Source index or module ["
- + source
- + "] declares the key ["
- + key
- + "] that is already bound.";
- throw new BuildException( error );
- }
- }
-
- Module.Header header = Module.Header.create( root );
- String[] imports = Module.createImports( root );
- ResourceRef[] refs = new ResourceRef[ imports.length ];
- for( int i=0; i < imports.length; i++ )
- {
- String spec = imports[i];
- Module link = buildModule( spec );
- refs[i] = new ResourceRef( link.getKey() );
- }
-
- final Element resources = ElementHelper.getChild( root, "resources"
);
- final ResourceRef[] children = buildResources( resources, source,
moduleUri );
-
- Module module = new Module( this, key, info, refs, "key:NULL",
header, children );
- m_resources.put( key, module );
- log( "module: " + module, Project.MSG_VERBOSE );
-
- return module;
- }
-
- private ResourceRef[] buildResources( final Element resources, File
source, final String moduleUri )
- {
- final Element[] elements = ElementHelper.getChildren( resources,
"resource" );
- final File anchor = source.getParentFile();
- final ResourceRef[] children = new ResourceRef[ elements.length ];
- for( int i=0; i < elements.length; i++ )
- {
- final Resource resource = createResource( elements[i], anchor,
moduleUri );
- final String k = resource.getKey();
- if( !m_resources.containsKey( k ) )
- {
- m_resources.put( k, resource );
- log( "resource: " + resource, Project.MSG_VERBOSE );
- }
- }
- return children;
- }
-
- private Info createInfo( String uri )
- {
- try
- {
- return Info.create( uri );
- }
- catch( Exception e )
- {
- throw new BuildException( e );
- }
- }
-
- private File resolveIndex( File file )
- {
- if( file.isDirectory() )
- {
- return new File( file, "index.xml" );
- }
- else
- {
- return file;
- }
- }
-
- private void buildLocalList( final File anchor, final Element[]
children, String uri )
- {
- log( "entries: " + children.length, Project.MSG_VERBOSE );
- for( int i = 0; i < children.length; i++ )
- {
- final Element element = children[i];
- final String tag = element.getTagName();
- if( "import".equals( element.getTagName() ) )
- {
- buildImport( element, anchor, uri );
- }
- else if( isaResource( tag ) )
- {
- buildResource( element, anchor, uri );
- }
- else
- {
- final String error =
- "Unrecognized element type \"" + tag + "\" found in
index.";
- throw new BuildException( error );
- }
- }
- }
-
- private void buildResource(final Element element, final File anchor,
String uri)
- {
- final Resource resource = createResource( element, anchor, uri );
- final String key = resource.getKey();
- if( !m_resources.containsKey( key ) )
- {
- m_resources.put( key, resource );
- if( key.equals( resource.getInfo().getName() ) )
- {
- log( "resource: " + resource, Project.MSG_VERBOSE );
- }
- else
- {
- log( "resource: " + resource + " key=" + key,
Project.MSG_VERBOSE );
- }
- }
- else
- {
- Resource r = (Resource) m_resources.get( key );
- if( !r.equals( resource ) )
- {
- final String error =
- "WARNING: Ignoring duplicate key reference ["
- + key
- + "].";
- log( error, Project.MSG_WARN );
- }
- }
- }
-
- private void buildImport(final Element element, final File anchor,
String uri)
- {
- final String filename = element.getAttribute( "index" );
- final String uriAttribute = element.getAttribute( "uri" );
- String urn = parse( uriAttribute );
- if(( null != filename ) && ( !"".equals( filename )))
- {
- final File index = IndexBuilder.getFile( anchor, filename );
- buildList( index, uri );
- }
- else if(null == urn || "".equals(urn))
- {
- final String error =
- "Invalid import statement. No uri, index attribute.";
- throw new BuildException( error );
- }
- else
- {
- // switch to artifact
- if( !m_includes.contains( urn ) )
- {
- m_includes.add( urn );
- try
- {
- URL artifact = new URL( null, urn, new Handler() );
- File local = (File) artifact.getContent( new Class[]{
File.class } );
- buildList( local, urn );
- }
- catch( IOException ioe )
- {
- final String error =
- "Failed to load module ["
- + urn
- + "]."
- + ioe.toString();
- throw new BuildException( error, ioe );
- }
- }
- }
- }
-
- private String parse( String value )
- {
- if( null == value )
- {
- return value;
- }
- String result = getProject().replaceProperties( value );
- if( !result.equals( value ) )
- {
- return parse( result );
- }
- else
- {
- return result;
- }
- }
-
- private Resource createResource( final Element element, final File
anchor, String uri )
- {
- return XMLDefinitionBuilder.createResource( this, element, anchor,
uri );
- }
-
- private boolean isaResource( final String tag )
- {
- return (
- "resource".equals( tag )
- || "project".equals( tag ) );
- }
-
- protected void loadProperties( final Project proj, final File file )
- throws BuildException
- {
- final Property props = (Property) proj.createTask( "property" );
- props.init();
- props.setFile( file );
- props.execute();
- }
-}
+
+public interface Index {
+
+ public abstract File getHomeDirectory();
+
+ public abstract File getCacheDirectory();
+
+ public abstract File getDocsDirectory();
+
+ public abstract Repository getRepository();
+
+ /**
+ * Return the index file used to establish this home.
+ * @return the index file
+ */
+ public abstract File getIndexFile();
+
+ /**
+ * Return the last modification time of the index file as a long.
+ * @return the last modification time
+ */
+ public abstract long getIndexLastModified();
+
+ /**
+ * Return a property declared under the project that established the
root index.
+ * @param key the property key
+ * @return the value matching the supplied property key
+ */
+ public abstract String getProperty(String key);
+
+ /**
+ * Return a property declared undr the project that established the
root index.
+ * @param key the property key
+ * @param fallback the default value if the property is undefined
+ * @return the value matching the supplied property key or the default
+ */
+ public abstract String getProperty(String key, String fallback);
+
+ /**
+ * Return TRUE if the supplied key is the name of a key of a resource
+ * declared within this home.
+ * @param key the key
+ */
+ public abstract boolean isaResourceKey(String key);
+
+ /**
+ * Return TRUE if this is a release build.
+ * @return TRUE if this is a release build sequence
+ */
+ public abstract boolean isaRelease();
+
+ /**
+ * Return the release signature.
+ * @return a string corresponding to the svn revision or null
+ * if this is not a release build
+ */
+ public abstract String getReleaseSignature();
+
+ /**
+ * Return all of the resource declared within this home.
+ * @return the resource defintions
+ */
+ public abstract Resource[] getResources();
+
+ /**
+ * Return TRUE if the suppied resource ref references a project
+ * definition.
+ * @return TRUE is the resource is a definition
+ */
+ public abstract boolean isaDefinition(final ResourceRef reference);
+
+ /**
+ * Return all definitions with the home.
+ *
+ * @return array of know definitions
+ */
+ public abstract Definition[] getDefinitions() throws BuildException;
+
+ /**
+ * Return all resource refs within the index that are members of the
+ * group identified by the supplied resource and not equal to the
+ * supplied resource key.
+ *
+ * @return array of subsidiary resources
+ */
+ public abstract ResourceRef[] getSubsidiaryRefs(Resource module)
+ throws BuildException;
+
+ /**
+ * Return all definitions with the index that are members of the
+ * group identified by the supplied resource and not equal to the
+ * supplied resoruce key.
+ *
+ * @return array of subsidiary definitions
+ */
+ public abstract Definition[] getSubsidiaryDefinitions(Resource module)
+ throws BuildException;
+
+ /**
+ * Return a resource matching the supplied key.
+ * @return the resource mathing the key
+ * @exception BuildException if the resource is unknown
+ */
+ public abstract Resource getResource(final String key)
+ throws BuildException;
+
+ /**
+ * Return a resource matching the supplied reference.
+ * @return the resource mathing the reference
+ * @exception BuildException if the resource is unknown
+ */
+ public abstract Resource getResource(final ResourceRef reference)
+ throws BuildException;
+
+ /**
+ * Return a definition matching the supplied key.
+ * @return the definition mathing the key
+ * @exception BuildException if the definition is unknown
+ */
+ public abstract Definition getDefinition(final String key)
+ throws BuildException;
+
+ /**
+ * Return a definition matching the supplied reference.
+ * @return the definition mathing the reference
+ * @exception BuildException if the definition is unknown
+ */
+ public abstract Definition getDefinition(final ResourceRef reference)
+ throws BuildException;
+
+ public abstract Module buildModule(File source);
+
+}
\ No newline at end of file
Added:
development/main/magic/core/src/main/net/dpml/magic/builder/AntFileIndexBuilder.java
==============================================================================
--- (empty file)
+++
development/main/magic/core/src/main/net/dpml/magic/builder/AntFileIndexBuilder.java
Tue May 31 04:06:06 2005
@@ -0,0 +1,322 @@
+/*
+ * Copyright 2004-2005 Stephen McConnell
+ * Copyright 2005 Niclas Hedhman
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.magic.builder;
+
+import net.dpml.lang.NullArgumentException;
+
+import net.dpml.magic.AntFileIndex;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.types.DataType;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+/**
+ * The Magic class is the application root of the magic system. It is
responsible
+ * for the onetime establishment of an index
+ *
+ * @author <a href="http://www.dpml.net">The Digital Product Meta Library</a>
+ * @version $Revision: 1.2 $ $Date: 2004/03/17 10:30:09 $
+ */
+public class AntFileIndexBuilder extends DataType
+{
+ //-------------------------------------------------------------
+ // static
+ //-------------------------------------------------------------
+
+ /**
+ * Immutable key to the signature identifier used.
+ */
+ private static final String RELEASE_SIGNATURE_KEY =
"dpml.release.signature";
+
+ /**
+ * Immutable key to the build identifier.
+ */
+ private static final String BUILD_SIGNATURE_KEY = "dpml.build.signature";
+
+ /**
+ * Immutable key to the magic docs cache directory.
+ */
+ public static final String DOCS_KEY = "magic.docs";
+
+ //-------------------------------------------------------------
+ // immutable state
+ //-------------------------------------------------------------
+
+ private final AntFileIndex m_index;
+
+ //-------------------------------------------------------------
+ // constructor
+ //-------------------------------------------------------------
+
+ public AntFileIndexBuilder( final Project proj )
+ throws BuildException
+ {
+ this( proj, null );
+ }
+
+ public AntFileIndexBuilder( final Project proj, File index )
+ throws BuildException
+ {
+ setProject( proj );
+
+ log( "magic builder established", Project.MSG_VERBOSE );
+
+ String signature = getBuildSignature();
+
+ if( null == signature )
+ {
+ signature = "SNAPSHOT";
+ }
+
+ proj.setProperty( BUILD_SIGNATURE_KEY, signature );
+ log( "release: " + signature, Project.MSG_VERBOSE );
+
+ if( null == index )
+ {
+ log( "locating index", Project.MSG_VERBOSE );
+ File file = getIndexFile( proj );
+ m_index = constructIndex( proj, file );
+ }
+ else
+ {
+ m_index = constructIndex( proj, index );
+ }
+ }
+
+ private AntFileIndex constructIndex( Project proj, File file )
+ {
+ try
+ {
+ return new AntFileIndex( proj, this, file );
+ }
+ catch( Throwable e )
+ {
+ e.printStackTrace();
+ final String error =
+ "Internal error while attempting to construct index."+
+ "file:" + file.getAbsolutePath() +
+ "project:" + proj.toString();
+ throw new BuildException( error );
+ }
+ }
+
+ //-------------------------------------------------------------
+ // public
+ //-------------------------------------------------------------
+
+ /**
+ * Return the index.
+ * @return the index instance
+ */
+ public AntFileIndex getIndex()
+ {
+ return m_index;
+ }
+
+ /**
+ * Return TRUE if this is a release build.
+ * @return the release build flag
+ */
+ public boolean isaRelease()
+ {
+ String signature = getReleaseSignature();
+ return signature != null;
+ }
+
+ /**
+ * Return the signature.
+ *
+ * @return the release signature
+ */
+ public String getReleaseSignature()
+ {
+ Project project = getProject();
+ String signature = project.getProperty( BUILD_SIGNATURE_KEY );
+ return signature;
+ }
+
+ //-------------------------------------------------------------
+ // implementation
+ //-------------------------------------------------------------
+
+ private String getBuildSignature()
+ {
+ String signature = System.getProperty( BUILD_SIGNATURE_KEY );
+ if( null != signature )
+ {
+ return signature;
+ }
+ else
+ {
+ Project proj = getProject();
+ signature = proj.getProperty( RELEASE_SIGNATURE_KEY );
+ return signature;
+ }
+ }
+
+ private File getIndexFile( Project proj )
+ {
+ File basedir = proj.getBaseDir();
+ return resolve( basedir, true );
+ }
+
+ private File resolve( File index, boolean traverse )
+ {
+ if( index.isFile() )
+ return index;
+ if( index.isDirectory() )
+ {
+ File file = new File( index, "index.xml" );
+ if( file.isFile() )
+ return file;
+ if( traverse )
+ {
+ File resolved = traverse( index );
+ if( resolved != null )
+ return resolved;
+ }
+ }
+
+ final FileNotFoundException fnfe =
+ new FileNotFoundException( index.toString() );
+ throw new BuildException( fnfe );
+ }
+
+ private File traverse( File dir )
+ {
+ File file = new File( dir, "index.xml" );
+ if( file.isFile() )
+ return file;
+ File parent = dir.getParentFile();
+ if( null != parent )
+ return traverse( parent );
+ return null;
+ }
+
+ /**
+ * Return a file using a supplied root and path. If the path is absolute
+ * an absolute file is retured relative to the supplied path otherwise the
+ * path is resolved relative to the supplied root directory.
+ *
+ * @param root the root directory
+ * @param path the absolute or relative file path
+ * @return the file instance
+ */
+ public static File getFile( final File root, final String path )
+ {
+ return getFile( root, path, false );
+ }
+
+ /**
+ * Return a file using a supplied root and path. If the path is absolute
+ * an absolute file is retured relative to the supplied path otherwise the
+ * path is resolved relative to the supplied root directory. If the
create
+ * parameter is TRUE then the file will be created if it does not exist.
+ *
+ * @param root the root directory
+ * @param path the absolute or relative file path
+ * @param create flag to indicate creation policy if the file does not
exists
+ * @return the file instance
+ * @throws NullArgumentException if the path argument is null, or if the
path
+ * argument is not an absolute path and the root argument is null.
+ */
+ public static File getFile( final File root, final String path, boolean
create )
+ throws NullArgumentException
+ {
+ if( null == path )
+ {
+ throw new NullArgumentException( "path" );
+ }
+ final File file = new File( path );
+
+ if( file.isAbsolute() )
+ {
+ return getCanonicalFile( file, create );
+ }
+
+ if( null == root )
+ {
+ throw new NullArgumentException( "root" );
+ }
+ return getCanonicalFile( new File( root, path ), create );
+ }
+
+ /**
+ * Return the concatonal variant of a file.
+ * @param file the file argument
+ * @return the concatonal variant
+ */
+ public static File getCanonicalFile( final File file ) throws
BuildException
+ {
+ return getCanonicalFile( file, false );
+ }
+
+ /**
+ * Return the concatonal variant of a file and ensure that the parent
directory
+ * path is created.
+ *
+ * @param file the file argument
+ * @return the concatonal variant
+ */
+ public static File getCanonicalFile( final File file, boolean create )
throws BuildException
+ {
+ try
+ {
+ File result = file.getCanonicalFile();
+ if( create )
+ {
+ if( result.isDirectory() )
+ {
+ result.mkdirs();
+ }
+ else
+ {
+ result.getParentFile().mkdirs();
+ }
+ }
+ return result;
+ }
+ catch( IOException ioe )
+ {
+ throw new BuildException( ioe );
+ }
+ }
+
+ /**
+ * Return the concatonal path of a file.
+ * @param file the file argument
+ * @return the concatonal path
+ */
+ public static String getCanonicalPath( final File file ) throws
BuildException
+ {
+ try
+ {
+ return file.getCanonicalPath();
+ }
+ catch( IOException ioe )
+ {
+ throw new BuildException( ioe );
+ }
+ }
+}
Modified:
development/main/magic/core/src/main/net/dpml/magic/builder/XMLDefinitionBuilder.java
==============================================================================
---
development/main/magic/core/src/main/net/dpml/magic/builder/XMLDefinitionBuilder.java
(original)
+++
development/main/magic/core/src/main/net/dpml/magic/builder/XMLDefinitionBuilder.java
Tue May 31 04:06:06 2005
@@ -17,7 +17,7 @@
package net.dpml.magic.builder;
-import net.dpml.magic.Index;
+import net.dpml.magic.AntFileIndex;
import net.dpml.magic.model.Definition;
import net.dpml.magic.model.Info;
import net.dpml.magic.model.Policy;
@@ -42,7 +42,7 @@
* @param element the DOM element definition
* @return the resource
*/
- public static Resource createResource( final Index home, final Element
element, String uri )
+ public static Resource createResource( final AntFileIndex home, final
Element element, String uri )
{
boolean external = isExternal( element );
final Element infoElement = ElementHelper.getChild( element, "info"
);
@@ -65,7 +65,7 @@
}
}
- public static Resource createResource( Index home, Element element, File
anchor, String uri )
+ public static Resource createResource( AntFileIndex home, Element
element, File anchor, String uri )
{
final String tag = element.getTagName();
@@ -166,7 +166,7 @@
return key;
}
- public static Info createInfo( Index home, final Element info, boolean
external )
+ public static Info createInfo( AntFileIndex home, final Element info,
boolean external )
{
final Element groupElement = ElementHelper.getChild( info, "group" );
final String group = ElementHelper.getValue( groupElement );
@@ -217,7 +217,7 @@
}
}
- private static String createVersion( Index home, Element info, boolean
external )
+ private static String createVersion( AntFileIndex home, Element info,
boolean external )
{
final Element versionElement = ElementHelper.getChild( info,
"version" );
String version = ElementHelper.getValue( versionElement );
Modified:
development/main/magic/core/src/main/net/dpml/magic/model/Definition.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/model/Definition.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/model/Definition.java
Tue May 31 04:06:06 2005
@@ -19,7 +19,7 @@
import net.dpml.lang.NullArgumentException;
-import net.dpml.magic.Index;
+import net.dpml.magic.AntFileIndex;
import org.apache.tools.ant.Location;
import org.apache.tools.ant.Project;
@@ -59,7 +59,7 @@
* @param uri containing module uri
*/
public Definition(
- final Index index, final String key, final File basedir, String build,
+ final AntFileIndex index, final String key, final File basedir, String
build,
final String path, final Info info,
final ResourceRef[] resources, final ResourceRef[] plugins,
final ResourceRef[] parts, String uri )
Modified:
development/main/magic/core/src/main/net/dpml/magic/model/Module.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/model/Module.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/model/Module.java
Tue May 31 04:06:06 2005
@@ -17,7 +17,7 @@
package net.dpml.magic.model;
-import net.dpml.magic.Index;
+import net.dpml.magic.AntFileIndex;
import net.dpml.magic.builder.ElementHelper;
import java.net.URL;
@@ -61,7 +61,7 @@
private ResourceRef[] m_entries;
public Module(
- final Index index, final String key, final Info info, final
ResourceRef[] resources,
+ final AntFileIndex index, final String key, final Info info, final
ResourceRef[] resources,
String uri, Header header, ResourceRef[] entries )
{
super( index, key, info, resources, uri );
Modified:
development/main/magic/core/src/main/net/dpml/magic/model/Resource.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/model/Resource.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/model/Resource.java
Tue May 31 04:06:06 2005
@@ -24,7 +24,7 @@
import java.util.List;
import net.dpml.lang.NullArgumentException;
-import net.dpml.magic.Index;
+import net.dpml.magic.AntFileIndex;
import net.dpml.magic.UnknownResourceException;
import net.dpml.transit.artifact.Handler;
@@ -43,11 +43,11 @@
private final String m_key;
private Info m_info;
private ResourceRef[] m_resources;
- private Index m_index;
+ private AntFileIndex m_index;
private String m_uri;
public Resource(
- final Index index, final String key, final Info info, final
ResourceRef[] resources, String uri )
+ final AntFileIndex index, final String key, final Info info, final
ResourceRef[] resources, String uri )
throws IllegalArgumentException, NullArgumentException
{
assertNotNull( index, "index" );
@@ -144,7 +144,7 @@
}
}
- protected Index getIndex()
+ protected AntFileIndex getIndex()
{
return m_index;
}
Modified:
development/main/magic/core/src/main/net/dpml/magic/project/Context.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/project/Context.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/project/Context.java
Tue May 31 04:06:06 2005
@@ -20,9 +20,9 @@
import net.dpml.lang.NullArgumentException;
-import net.dpml.magic.Index;
+import net.dpml.magic.AntFileIndex;
import net.dpml.magic.UnknownResourceException;
-import net.dpml.magic.builder.IndexBuilder;
+import net.dpml.magic.builder.AntFileIndexBuilder;
import net.dpml.magic.model.Definition;
import org.apache.tools.ant.BuildException;
@@ -55,7 +55,7 @@
public static final String USER_PROPERTIES = "user.properties";
public static final String BUILD_PROPERTIES = "build.properties";
- public static Index INDEX;
+ public static AntFileIndex INDEX;
/**
* Return the UTC YYMMDD.HHMMSSS signature.
@@ -190,7 +190,7 @@
*
* @return the index
*/
- public Index getIndex()
+ public AntFileIndex getIndex()
{
return INDEX;
}
@@ -354,7 +354,7 @@
}
else
{
- IndexBuilder builder = new IndexBuilder( project );
+ AntFileIndexBuilder builder = new AntFileIndexBuilder( project );
INDEX = builder.getIndex();
}
}
Modified:
development/main/magic/core/src/main/net/dpml/magic/project/ProjectPath.java
==============================================================================
---
development/main/magic/core/src/main/net/dpml/magic/project/ProjectPath.java
(original)
+++
development/main/magic/core/src/main/net/dpml/magic/project/ProjectPath.java
Tue May 31 04:06:06 2005
@@ -17,7 +17,7 @@
package net.dpml.magic.project;
-import net.dpml.magic.Index;
+import net.dpml.magic.AntFileIndex;
import net.dpml.magic.model.Policy;
import net.dpml.magic.model.Resource;
import org.apache.tools.ant.BuildException;
@@ -237,7 +237,7 @@
return getContext().getKey();
}
- private Index getIndex()
+ private AntFileIndex getIndex()
{
return getContext().getIndex();
}
Modified:
development/main/magic/core/src/main/net/dpml/magic/tasks/CheckstyleTask.java
==============================================================================
---
development/main/magic/core/src/main/net/dpml/magic/tasks/CheckstyleTask.java
(original)
+++
development/main/magic/core/src/main/net/dpml/magic/tasks/CheckstyleTask.java
Tue May 31 04:06:06 2005
@@ -23,7 +23,7 @@
import net.dpml.magic.model.Resource;
import net.dpml.magic.model.ResourceRef;
import net.dpml.magic.project.Context;
-import net.dpml.magic.Index;
+import net.dpml.magic.AntFileIndex;
import net.dpml.transit.artifact.Handler;
@@ -136,7 +136,7 @@
return getIndex().getResource( getKey() );
}
- private Index getIndex()
+ private AntFileIndex getIndex()
{
return getContext().getIndex();
}
Modified:
development/main/magic/core/src/main/net/dpml/magic/tasks/ContextualTask.java
==============================================================================
---
development/main/magic/core/src/main/net/dpml/magic/tasks/ContextualTask.java
(original)
+++
development/main/magic/core/src/main/net/dpml/magic/tasks/ContextualTask.java
Tue May 31 04:06:06 2005
@@ -18,7 +18,7 @@
package net.dpml.magic.tasks;
-import net.dpml.magic.Index;
+import net.dpml.magic.AntFileIndex;
import net.dpml.magic.project.Context;
import org.apache.tools.ant.Task;
@@ -59,7 +59,7 @@
return m_context;
}
- public Index getIndex()
+ public AntFileIndex getIndex()
{
return getContext().getIndex();
}
Modified:
development/main/magic/core/src/main/net/dpml/magic/tasks/InfoTask.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/tasks/InfoTask.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/tasks/InfoTask.java
Tue May 31 04:06:06 2005
@@ -20,7 +20,7 @@
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
-import net.dpml.magic.Index;
+import net.dpml.magic.AntFileIndex;
/**
* Announce the initiation of a build.
@@ -45,7 +45,7 @@
public void execute() throws BuildException
{
final Project project = getProject();
- project.log( Index.BANNER );
+ project.log( AntFileIndex.BANNER );
String key = getContext().getKey();
project.log( "key: " + key );
@@ -57,6 +57,6 @@
project.log( " memory max: " + rt.maxMemory() );
project.log( " memory free: " + rt.freeMemory() );
}
- project.log( Index.BANNER );
+ project.log( AntFileIndex.BANNER );
}
}
Modified:
development/main/magic/core/src/main/net/dpml/magic/tasks/JavadocTask.java
==============================================================================
---
development/main/magic/core/src/main/net/dpml/magic/tasks/JavadocTask.java
(original)
+++
development/main/magic/core/src/main/net/dpml/magic/tasks/JavadocTask.java
Tue May 31 04:06:06 2005
@@ -17,7 +17,7 @@
package net.dpml.magic.tasks;
-import net.dpml.magic.Index;
+import net.dpml.magic.AntFileIndex;
import net.dpml.magic.builder.ElementHelper;
import net.dpml.magic.model.Definition;
import net.dpml.magic.model.Policy;
@@ -396,7 +396,7 @@
m_href = href;
}
- public String getHref( Index index, Definition def )
+ public String getHref( AntFileIndex index, Definition def )
{
if( null == m_key )
{
@@ -444,7 +444,7 @@
m_dir = dir;
}
- public File getDir( Index index )
+ public File getDir( AntFileIndex index )
{
if( null == m_key )
{
Modified:
development/main/magic/core/src/main/net/dpml/magic/tasks/ModuleTask.java
==============================================================================
--- development/main/magic/core/src/main/net/dpml/magic/tasks/ModuleTask.java
(original)
+++ development/main/magic/core/src/main/net/dpml/magic/tasks/ModuleTask.java
Tue May 31 04:06:06 2005
@@ -17,8 +17,8 @@
package net.dpml.magic.tasks;
-import net.dpml.magic.Index;
-import net.dpml.magic.builder.IndexBuilder;
+import net.dpml.magic.AntFileIndex;
+import net.dpml.magic.builder.AntFileIndexBuilder;
import net.dpml.magic.model.*;
import net.dpml.magic.project.Context;
import net.dpml.magic.project.DeliverableHelper;
@@ -60,7 +60,7 @@
//-----------------------------------------------------------------------
// state
//-----------------------------------------------------------------------
- private Index m_target;
+ private AntFileIndex m_target;
private Header m_header;
//-----------------------------------------------------------------------
@@ -69,11 +69,11 @@
public void setIndex( File target )
{
- IndexBuilder builder = new IndexBuilder( getProject(), target );
+ AntFileIndexBuilder builder = new AntFileIndexBuilder( getProject(),
target );
m_target = builder.getIndex();
}
- private Index getPrivateIndex()
+ private AntFileIndex getPrivateIndex()
{
if( null == m_target )
{
@@ -425,14 +425,14 @@
public static class Resolver
{
- private Index m_index;
+ private AntFileIndex m_index;
- public Resolver( Index index )
+ public Resolver( AntFileIndex index )
{
m_index = index;
}
- public Index getIndex()
+ public AntFileIndex getIndex()
{
return m_index;
}
@@ -457,7 +457,7 @@
private String m_key;
private String m_default;
- public Href( Index index, String key, String fallback )
+ public Href( AntFileIndex index, String key, String fallback )
{
super( index );
m_key = key;
@@ -494,7 +494,7 @@
{
private String m_name;
- public Publisher( Index index )
+ public Publisher( AntFileIndex index )
{
super( index );
}
@@ -530,7 +530,7 @@
{
private String m_name;
- public Package( Index index )
+ public Package( AntFileIndex index )
{
super( index );
}
@@ -565,9 +565,9 @@
public static class Packages
{
private List m_packages = new ArrayList();
- private Index m_index;
+ private AntFileIndex m_index;
- public Packages( Index index )
+ public Packages( AntFileIndex index )
{
m_index = index;
}
@@ -588,7 +588,7 @@
public static class License extends Href
{
- public License( Index index )
+ public License( AntFileIndex index )
{
super( index, LICENSE_KEY, "" );
}
@@ -596,7 +596,7 @@
public static class Notice extends Href
{
- public Notice( Index index )
+ public Notice( AntFileIndex index )
{
super( index, NOTICE_KEY, "" );
}
@@ -604,7 +604,7 @@
public static class Svn extends Href
{
- public Svn( Index index )
+ public Svn( AntFileIndex index )
{
super( index, SVN_KEY, "" );
}
@@ -612,7 +612,7 @@
public static class Home extends Href
{
- public Home( Index index )
+ public Home( AntFileIndex index )
{
super( index, HOME_KEY, "" );
}
@@ -620,7 +620,7 @@
public static class Repository extends Href
{
- public Repository( Index index )
+ public Repository( AntFileIndex index )
{
super( index, REPOSITORY_KEY, "" );
}
@@ -628,7 +628,7 @@
public static class Docs extends Href
{
- public Docs( Index index )
+ public Docs( AntFileIndex index )
{
super( index, DOCS_KEY, "" );
}
@@ -639,7 +639,7 @@
private License m_license;
private Notice m_notice;
- public Legal( Index index )
+ public Legal( AntFileIndex index )
{
super( index );
}
@@ -699,7 +699,7 @@
private Repository m_repository;
private Docs m_docs;
- public Header( Index index )
+ public Header( AntFileIndex index )
{
super( index );
m_packages = new Packages( index );
Modified:
development/main/magic/core/src/main/net/dpml/magic/tasks/ReactorTask.java
==============================================================================
---
development/main/magic/core/src/main/net/dpml/magic/tasks/ReactorTask.java
(original)
+++
development/main/magic/core/src/main/net/dpml/magic/tasks/ReactorTask.java
Tue May 31 04:06:06 2005
@@ -17,7 +17,7 @@
package net.dpml.magic.tasks;
-import net.dpml.magic.Index;
+import net.dpml.magic.AntFileIndex;
import net.dpml.magic.UnknownResourceException;
import net.dpml.magic.model.Definition;
import net.dpml.magic.model.ResourceRef;
@@ -72,7 +72,7 @@
return m_context;
}
- private Index getIndex()
+ private AntFileIndex getIndex()
{
return getContext().getIndex();
}
@@ -90,13 +90,13 @@
getProject().log( "Candidates: " + defs.length );
- project.log( Index.BANNER );
+ project.log( AntFileIndex.BANNER );
for( int i=0; i<defs.length; i++ )
{
final Definition def = defs[i];
project.log( def.toString() );
}
- project.log( Index.BANNER );
+ project.log( AntFileIndex.BANNER );
for( int i=0; i<defs.length; i++ )
{
Modified:
development/main/magic/core/src/test/net/dpml/magic/builder/test/IndexBuilderTestCase.java
==============================================================================
---
development/main/magic/core/src/test/net/dpml/magic/builder/test/IndexBuilderTestCase.java
(original)
+++
development/main/magic/core/src/test/net/dpml/magic/builder/test/IndexBuilderTestCase.java
Tue May 31 04:06:06 2005
@@ -19,7 +19,7 @@
package net.dpml.magic.builder.test;
import junit.framework.TestCase;
-import net.dpml.magic.builder.IndexBuilder;
+import net.dpml.magic.builder.AntFileIndexBuilder;
import org.apache.tools.ant.Project;
@@ -30,13 +30,13 @@
*/
public class IndexBuilderTestCase extends TestCase
{
- private IndexBuilder m_builder;
+ private AntFileIndexBuilder m_builder;
public void setUp()
{
Project project = new Project();
project.setName( "test" );
- m_builder = new IndexBuilder( project );
+ m_builder = new AntFileIndexBuilder( project );
}
public void testIndexBuilder() throws Exception
Modified:
development/main/magic/core/src/test/net/dpml/magic/test/IndexTestCase.java
==============================================================================
---
development/main/magic/core/src/test/net/dpml/magic/test/IndexTestCase.java
(original)
+++
development/main/magic/core/src/test/net/dpml/magic/test/IndexTestCase.java
Tue May 31 04:06:06 2005
@@ -19,7 +19,7 @@
package net.dpml.magic.test;
import junit.framework.TestCase;
-import net.dpml.magic.Index;
+import net.dpml.magic.AntFileIndex;
import net.dpml.magic.project.Context;
import org.apache.tools.ant.Project;
@@ -31,7 +31,7 @@
*/
public class IndexTestCase extends TestCase
{
- private Index m_index;
+ private AntFileIndex m_index;
public void setUp()
{
Modified:
development/main/magic/spells/eclipse/src/main/net/dpml/magic/eclipse/EclipseTask.java
==============================================================================
---
development/main/magic/spells/eclipse/src/main/net/dpml/magic/eclipse/EclipseTask.java
(original)
+++
development/main/magic/spells/eclipse/src/main/net/dpml/magic/eclipse/EclipseTask.java
Tue May 31 04:06:06 2005
@@ -35,7 +35,7 @@
import java.util.Set;
import java.util.StringTokenizer;
-import net.dpml.magic.Index;
+import net.dpml.magic.AntFileIndex;
import net.dpml.magic.model.Definition;
import net.dpml.magic.model.Info;
import net.dpml.magic.model.Resource;
@@ -308,7 +308,7 @@
private Definition getProjectDefinition( String key )
{
- Index index = getIndex();
+ AntFileIndex index = getIndex();
return index.getDefinition( key );
}
- svn commit: r2682 - in development/main/magic: core/src/main/net/dpml/magic core/src/main/net/dpml/magic/builder core/src/main/net/dpml/magic/model core/src/main/net/dpml/magic/project core/src/main/net/dpml/magic/tasks core/src/test/net/dpml/magic/builder/test core/src/test/net/dpml/magic/test spells/eclipse/src/main/net/dpml/magic/eclipse, peter, 05/30/2005
Archive powered by MHonArc 2.6.24.