mcconnell 2002/12/17 01:55:24
Modified: assembly/src/java/org/apache/avalon/assembly/appliance
Appliance.java ApplianceContext.java
DefaultAppliance.java
assembly/src/java/org/apache/avalon/assembly/engine
EngineClassLoader.java
assembly/src/java/org/apache/avalon/assembly/lifecycle
ContextHandler.java
assembly/src/java/org/apache/avalon/assembly/lifecycle/composition
DefaultCompositionService.java
assembly/src/java/org/apache/avalon/assembly/lifecycle/context
DefaultContextualizationService.java
assembly/src/test/org/apache/avalon/playground
BasicComponent.xinfo ComplexComponent.xinfo
DemoManager.xinfo ExploitationManager.xinfo
InvalidComponent.xinfo SimpleComponent.xinfo
Log:
Reworking some of the context handling mechanisms, updating of the meta descriptors,
and addition of URL resolution on appliance instances.
Revision Changes Path
1.8 +8 -1
avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/Appliance.java
Index: Appliance.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/Appliance.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Appliance.java 17 Dec 2002 04:52:15 -0000 1.7
+++ Appliance.java 17 Dec 2002 09:55:23 -0000 1.8
@@ -51,6 +51,7 @@
package org.apache.avalon.assembly.appliance;
import java.util.Map;
+import java.net.URL;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.assembly.lifestyle.LifestyleException;
@@ -92,6 +93,12 @@
* Get the appliance path.
*/
String getPath();
+
+ /**
+ * Get the appliance URL.
+ * @return the appliance URL
+ */
+ URL getURL();
/**
* Return the profile backing the appliance.
1.2 +6 -1
avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/ApplianceContext.java
Index: ApplianceContext.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/ApplianceContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ApplianceContext.java 15 Dec 2002 14:08:55 -0000 1.1
+++ ApplianceContext.java 17 Dec 2002 09:55:23 -0000 1.2
@@ -115,6 +115,11 @@
*/
private String m_path;
+ /**
+ * The appliance domain.
+ */
+ private String m_domain;
+
/**
* The deployment context.
*/
1.11 +49 -1
avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/DefaultAppliance.java
Index: DefaultAppliance.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/DefaultAppliance.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DefaultAppliance.java 17 Dec 2002 04:52:15 -0000 1.10
+++ DefaultAppliance.java 17 Dec 2002 09:55:23 -0000 1.11
@@ -52,6 +52,7 @@
import java.util.Map;
import java.util.Hashtable;
+import java.net.URL;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.logger.Logger;
@@ -82,6 +83,12 @@
public class DefaultAppliance implements Appliance
{
//=====================================================================
+ // static
+ //=====================================================================
+
+ protected static String PROTOCOL = "native";
+
+ //=====================================================================
// state
//=====================================================================
@@ -131,6 +138,16 @@
*/
private Logger m_logger;
+ /**
+ * The appliance URL.
+ */
+ private URL m_url;
+
+ /**
+ * The system domain.
+ */
+ private String m_domain;
+
//==============================================================
// constructor
//==============================================================
@@ -162,6 +179,15 @@
m_enabled = context.getEnabled();
m_system = system;
+ try
+ {
+ m_domain = (String) m_system.get( "urn:assembly:domain" );
+ }
+ catch( Throwable e )
+ {
+ m_domain = "localhost";
+ }
+
if( getPartitionName() != null )
{
m_path = getPartitionName()
@@ -197,6 +223,28 @@
protected Logger getLogger()
{
return m_logger;
+ }
+
+ /**
+ * Get the appliance URL.
+ * @return the appliance URL
+ */
+ public URL getURL()
+ {
+ if( m_url == null )
+ {
+ try
+ {
+ m_url = new URL( PROTOCOL, m_domain, -1, getPath() );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Protocol handler for protocol '" + PROTOCOL + "' has not been
established.";
+ throw new IllegalStateException( error );
+ }
+ }
+ return m_url;
}
/**
1.11 +12 -2
avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/EngineClassLoader.java
Index: EngineClassLoader.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/EngineClassLoader.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- EngineClassLoader.java 17 Dec 2002 04:55:01 -0000 1.10
+++ EngineClassLoader.java 17 Dec 2002 09:55:24 -0000 1.11
@@ -1175,7 +1175,7 @@
if( getLogger().isDebugEnabled() )
{
- getLogger().debug( "bootstrap system context" );
+ getLogger().debug( "resolving system context" );
}
DefaultContext context;
@@ -1197,6 +1197,16 @@
final File home = new File( System.getProperty( "user.dir" ) );
context.put( "urn:avalon:home", home );
}
+
+ try
+ {
+ context.get( "urn:assembly:domain" );
+ }
+ catch( ContextException ce )
+ {
+ context.put( "urn:assembly:domain", "localhost" );
+ }
+
m_system = context;
return m_system;
}
1.6 +23 -9
avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/ContextHandler.java
Index: ContextHandler.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/ContextHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ContextHandler.java 17 Dec 2002 04:55:47 -0000 1.5
+++ ContextHandler.java 17 Dec 2002 09:55:24 -0000 1.6
@@ -213,19 +213,33 @@
* Internal utility to construct a context instance using a descriptor,
directive and source
* context instances.
*
- * @param descriptors the descriptor containing the context dependency
declarations
- * @param directive an optional context directive containing import and context
value
- * creation parameters
+ * @param appliance the apliance containing the context dependency declarations
* @param context a supplimentary context object to used during value resolution
* @return a context object containing only those context entries desribed
under the
* supplied descriptor
* @exception Exception if a required context value cannot be resolved or an
error
* occurs during context value creation
*/
- protected Context buildContext(
- ContextDescriptor descriptors,
- ContextDirective directive,
- Context context )
+ protected Context buildContext( Appliance appliance, Context context )
+ throws Exception
+ {
+ ContextDescriptor descriptor =
appliance.getProfile().getType().getContext();
+ ContextDirective directive = appliance.getProfile().getContext();
+ return buildContext( descriptor, directive, context );
+ }
+
+ /**
+ * Internal utility to construct a context instance using a descriptor,
directive and source
+ * context instances.
+ *
+ * @param appliance the apliance containing the context dependency declarations
+ * @param context a supplimentary context object to used during value resolution
+ * @return a context object containing only those context entries desribed
under the
+ * supplied descriptor
+ * @exception Exception if a required context value cannot be resolved or an
error
+ * occurs during context value creation
+ */
+ protected Context buildContext( ContextDescriptor descriptor, ContextDirective
directive, Context context )
throws Exception
{
if( !m_initialized )
@@ -276,7 +290,7 @@
result = new DefaultContext( map );
}
- EntryDescriptor[] entries = descriptors.getEntrys();
+ EntryDescriptor[] entries = descriptor.getEntrys();
for( int i = 0; i < entries.length; i++ )
{
EntryDescriptor entry = entries[ i ];
1.4 +2 -2
avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/composition/DefaultCompositionService.java
Index: DefaultCompositionService.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/composition/DefaultCompositionService.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultCompositionService.java 17 Dec 2002 05:00:59 -0000 1.3
+++ DefaultCompositionService.java 17 Dec 2002 09:55:24 -0000 1.4
@@ -114,7 +114,7 @@
"[" + appliance.getProfile().getName() + "]";
getLogger().debug( message );
}
- DefaultServiceManager manager = new DefaultServiceManager( appliance );
+ StandardServiceManager manager = new StandardServiceManager( appliance
);
manager.enableLogging( getLogger().getChildLogger( "manager" ) );
try
{
1.5 +6 -8
avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/context/DefaultContextualizationService.java
Index: DefaultContextualizationService.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/lifecycle/context/DefaultContextualizationService.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DefaultContextualizationService.java 17 Dec 2002 05:01:53 -0000 1.4
+++ DefaultContextualizationService.java 17 Dec 2002 09:55:24 -0000 1.5
@@ -143,7 +143,7 @@
source = context;
}
Context standard =
- createStandardContext( appliance.getProfile(), source );
+ createStandardContext( appliance, source );
try
{
@@ -180,20 +180,18 @@
* @throws DeploymentException if an error occurs in standard
* context creation
*/
- public Context createStandardContext( Profile profile, Context context )
+ public Context createStandardContext( Appliance appliance, Context context )
throws ContextException
{
try
{
- ContextDescriptor descriptor = profile.getType().getContext();
- ContextDirective directive = profile.getContext();
- return buildContext( descriptor, directive, context );
+ return buildContext( appliance, context );
}
catch( Throwable e )
{
final String error =
- "Unexpected error while preparing standard context for the profile: "
- + profile.getName();
+ "Unexpected error while preparing standard context for the appliance:
"
+ + appliance;
throw new ContextException( error, e );
}
}
1.3 +2 -6
avalon-sandbox/assembly/src/test/org/apache/avalon/playground/BasicComponent.xinfo
Index: BasicComponent.xinfo
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/playground/BasicComponent.xinfo,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BasicComponent.xinfo 7 Dec 2002 09:34:29 -0000 1.2
+++ BasicComponent.xinfo 17 Dec 2002 09:55:24 -0000 1.3
@@ -25,12 +25,8 @@
</context>
<services>
- <service>
- <reference type="org.apache.avalon.playground.BasicService" version="1.1"/>
- </service>
- <service>
- <reference type="org.apache.avalon.playground.NullService"/>
- </service>
+ <service type="org.apache.avalon.playground.BasicService:1.1"/>
+ <service type="org.apache.avalon.playground.NullService"/>
</services>
</type>
1.4 +3 -11
avalon-sandbox/assembly/src/test/org/apache/avalon/playground/ComplexComponent.xinfo
Index: ComplexComponent.xinfo
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/playground/ComplexComponent.xinfo,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ComplexComponent.xinfo 17 Dec 2002 05:04:45 -0000 1.3
+++ ComplexComponent.xinfo 17 Dec 2002 09:55:24 -0000 1.4
@@ -24,20 +24,12 @@
</loggers>
<services>
- <service>
- <reference type="org.apache.avalon.playground.ComplexService"/>
- </service>
+ <service type="org.apache.avalon.playground.ComplexService"/>
</services>
<dependencies>
- <dependency>
- <role>basic</role>
- <reference type="org.apache.avalon.playground.BasicService" version="1.1"/>
- </dependency>
- <dependency>
- <role>simple</role>
- <reference type="org.apache.avalon.playground.SimpleService"/>
- </dependency>
+ <dependency type="org.apache.avalon.playground.BasicService:1.1"
role="basic"/>
+ <dependency type="org.apache.avalon.playground.SimpleService" role="simple"/>
</dependencies>
</type>
1.3 +3 -4
avalon-sandbox/assembly/src/test/org/apache/avalon/playground/DemoManager.xinfo
Index: DemoManager.xinfo
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/playground/DemoManager.xinfo,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DemoManager.xinfo 3 Dec 2002 06:57:27 -0000 1.2
+++ DemoManager.xinfo 17 Dec 2002 09:55:24 -0000 1.3
@@ -21,7 +21,7 @@
<type>
<info>
- <name>demonstratable</name>
+ <name>demonstrator</name>
<attributes>
<attribute key="urn:avalon:lifestyle" value="thread"/>
</attributes>
@@ -36,9 +36,8 @@
Each extension has a name, a versioned interface reference, and optional
attributes.
-->
- <extension stage="ALL">
- <name>demonstrate</name>
- <reference type="org.apache.avalon.playground.Demonstratable" version="1.0"/>
+
+ <extension type="org.apache.avalon.playground.Demonstratable:1.0">
<attributes>
<attribute key="status" value="experimental"/>
</attributes>
1.2 +1 -13
avalon-sandbox/assembly/src/test/org/apache/avalon/playground/ExploitationManager.xinfo
Index: ExploitationManager.xinfo
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/playground/ExploitationManager.xinfo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ExploitationManager.xinfo 24 Nov 2002 12:50:46 -0000 1.1
+++ ExploitationManager.xinfo 17 Dec 2002 09:55:24 -0000 1.2
@@ -27,19 +27,7 @@
Declaration of the lifecycle support phases that this manager provides.
-->
<extensions>
-
- <!--
- Each extension has a name, a versioned interface reference, and optional
- attributes.
- -->
- <extension stage="ALL">
- <name>exploit</name>
- <reference type="org.apache.avalon.playground.Exploitable" version="1.0"/>
- <attributes>
- <attribute key="status" value="experimental"/>
- </attributes>
- </extension>
-
+ <extension type="org.apache.avalon.playground.Exploitable" />
</extensions>
</type>
1.2 +1 -4
avalon-sandbox/assembly/src/test/org/apache/avalon/playground/InvalidComponent.xinfo
Index: InvalidComponent.xinfo
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/playground/InvalidComponent.xinfo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- InvalidComponent.xinfo 24 Nov 2002 12:50:46 -0000 1.1
+++ InvalidComponent.xinfo 17 Dec 2002 09:55:24 -0000 1.2
@@ -20,10 +20,7 @@
</info>
<dependencies>
- <dependency>
- <role>silly</role>
- <reference type="org.apache.avalon.playground.InvalidService"/>
- </dependency>
+ <dependency type="org.apache.avalon.playground.InvalidService" role="silly"/>
</dependencies>
</type>
1.5 +1 -4
avalon-sandbox/assembly/src/test/org/apache/avalon/playground/SimpleComponent.xinfo
Index: SimpleComponent.xinfo
===================================================================
RCS file:
/home/cvs/avalon-sandbox/assembly/src/test/org/apache/avalon/playground/SimpleComponent.xinfo,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SimpleComponent.xinfo 15 Dec 2002 14:08:56 -0000 1.4
+++ SimpleComponent.xinfo 17 Dec 2002 09:55:24 -0000 1.5
@@ -37,10 +37,7 @@
Declaration of the services that this component type is
dependent on.
-->
- <dependency>
- <role>basic</role>
- <reference type="org.apache.avalon.playground.BasicService" version="1.1"/>
- </dependency>
+ <dependency type="org.apache.avalon.playground.BasicService:1.1"
role="basic"/>
</dependencies>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>