Author: mcconnell
Date: Fri Jul 2 03:22:27 2004
New Revision: 22465
Modified:
avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Home.java
avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Magic.java
Log:
Fallback to a static home defintion.
Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Home.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Home.java (original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Home.java Fri Jul 2 03:22:27 2004
@@ -80,6 +80,8 @@
m_system = system;
m_project = project;
buildList( index );
+ int n = m_resources.size();
+ project.log( "count: " + n );
}
//-------------------------------------------------------------
@@ -262,20 +264,10 @@
{
final Element element = children[i];
final String tag = element.getTagName();
- if( isaResource( tag ) )
- {
- final Resource resource = createResource( element, anchor );
- final String key = resource.getKey();
- m_resources.put( key, resource );
- log(
- "resource: " + resource
- + " key=" + key, Project.MSG_VERBOSE );
- }
- else if( "import".equals( element.getTagName() ) )
+ if( "import".equals( element.getTagName() ) )
{
final String filename = element.getAttribute( "index" );
final String path = element.getAttribute( "href" );
-
if(( null != filename ) && ( !"".equals( filename )))
{
final File index = Context.getFile( anchor, filename );
@@ -296,6 +288,15 @@
"Invalid import statement. No href or index attribute.";
throw new BuildException( error );
}
+ }
+ else if( isaResource( tag ) )
+ {
+ final Resource resource = createResource( element, anchor );
+ final String key = resource.getKey();
+ m_resources.put( key, resource );
+ log(
+ "resource: " + resource
+ + " key=" + key, Project.MSG_VERBOSE );
}
else
{
Modified: avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Magic.java
==============================================================================
--- avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Magic.java (original)
+++ avalon/trunk/tools/magic/src/main/org/apache/avalon/tools/model/Magic.java Fri Jul 2 03:22:27 2004
@@ -58,8 +58,7 @@
public static final String PROXY_PASSWORD_KEY = "magic.proxy.password";
private static Magic SYSTEM;
- private static Repository MAIN;
- private static Repository DOCS;
+ private static Home HOME;
public static Magic getSystem( Project project )
{
@@ -169,6 +168,21 @@
public Home getHome( Project project, String value )
{
+ if( null == HOME )
+ {
+ File index = getIndexFile( project, value );
+ project.log(
+ "Creating home in project: "
+ + project.getName()
+ + " using index ["
+ + index
+ + "].", Project.MSG_VERBOSE );
+
+ HOME = new Home( project, this, index );
+ }
+ return HOME;
+
+ /*
File index = getIndexFile( project, value );
String path = Context.getCanonicalFile( index ).toString();
Home home = (Home) m_homes.get( path );
@@ -185,6 +199,7 @@
}
m_homes.put( path, home );
return home;
+ */
}
private File getIndexFile( Project project, String value )
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.