You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2004/07/11 20:14:38 UTC
svn commit: rev 22821 - in avalon/trunk/runtime: activation/impl/src/java/org/apache/avalon/activation/impl composition/api/src/java/org/apache/avalon/composition/model composition/impl/src/java/org/apache/avalon/composition/model/impl
Author: mcconnell
Date: Sun Jul 11 11:14:38 2004
New Revision: 22821
Modified:
avalon/trunk/runtime/activation/impl/src/java/org/apache/avalon/activation/impl/DefaultAppliance.java
avalon/trunk/runtime/composition/api/src/java/org/apache/avalon/composition/model/ComponentModel.java
avalon/trunk/runtime/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultComponentModel.java
Log:
Add proxy policy handling into the composition model and runtime. This closed issue RUNTIME-18 at the composition and activation level - just need to add cli support.
Modified: avalon/trunk/runtime/activation/impl/src/java/org/apache/avalon/activation/impl/DefaultAppliance.java
==============================================================================
--- avalon/trunk/runtime/activation/impl/src/java/org/apache/avalon/activation/impl/DefaultAppliance.java (original)
+++ avalon/trunk/runtime/activation/impl/src/java/org/apache/avalon/activation/impl/DefaultAppliance.java Sun Jul 11 11:14:38 2004
@@ -128,15 +128,24 @@
* @throws Exception if an error occurs
*/
public Object resolve() throws Exception
- {
+ {
+ //
+ // handle the legacy 3.3.0 usage of the "urn:activation:proxy" key
+ // if after handle the 3.4.0 semantics for resolution against the model
+ //
+
if( getComponentModel().getType().getInfo().
getAttribute( "urn:activation:proxy", "true" ).equals( "false" ) )
- {
+ {
+ final String message =
+ "Component type references the deprecated 'urn:activation:proxy' key."
+ + " Please update to the key '" + ComponentModel.PROXY_KEY + "'.";
+ getLogger().warn( message );
return resolve( false );
}
- else
- {
- return resolve( true );
+ else
+ {
+ return resolve( getComponentModel().getProxyPolicy() );
}
}
Modified: avalon/trunk/runtime/composition/api/src/java/org/apache/avalon/composition/model/ComponentModel.java
==============================================================================
--- avalon/trunk/runtime/composition/api/src/java/org/apache/avalon/composition/model/ComponentModel.java (original)
+++ avalon/trunk/runtime/composition/api/src/java/org/apache/avalon/composition/model/ComponentModel.java Sun Jul 11 11:14:38 2004
@@ -30,14 +30,25 @@
* @version $Revision: 1.9 $ $Date: 2004/03/17 10:30:08 $
*/
public interface ComponentModel extends DeploymentModel
-{
+{
+ static final String PROXY_KEY = "urn:composition:proxy";
/**
* Return the deployment type.
*
* @return the type
*/
- Type getType();
+ Type getType();
+
+ /**
+ * Return the proxy enabled policy for the model. If the system wide
+ * proxy enabled is disabled the operation will return false otherwise the
+ * value returned is true unless overriden by the "urn:composition:proxy"
+ * attribute.
+ *
+ * @return the proxy policy
+ */
+ boolean getProxyPolicy();
/**
* Return the activation policy for the model.
Modified: avalon/trunk/runtime/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultComponentModel.java
==============================================================================
--- avalon/trunk/runtime/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultComponentModel.java (original)
+++ avalon/trunk/runtime/composition/impl/src/java/org/apache/avalon/composition/model/impl/DefaultComponentModel.java Sun Jul 11 11:14:38 2004
@@ -76,7 +76,7 @@
private static final Resources REZ =
ResourceManager.getPackageResources( DefaultComponentModel.class );
- private static final String CONTEXTUALIZABLE =
+ private static final String CONTEXTUALIZABLE =
"org.apache.avalon.framework.context.Contextualizable";
private static final Configuration EMPTY_CONFIGURATION =
@@ -479,6 +479,33 @@
return m_context.getType().getInfo().getCollectionPolicy();
}
+ /**
+ * Return the proxy enabled policy for the model. If the system wide
+ * proxy enabled is disabled the operation will return false otherwise the
+ * value returned is true unless overriden by the "urn:composition:proxy"
+ * attribute.
+ *
+ * @return the proxy policy
+ */
+ public boolean getProxyPolicy()
+ {
+ if( m_context.getSystemContext().isProxyEnabled() )
+ {
+ if( getType().getInfo().getAttribute( PROXY_KEY, "true" ).equals( "false" ) )
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ else
+ {
+ return false;
+ }
+ }
+
/**
* Return the activation policy for the model.
* @return the activaltion policy
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org