niclas 2004/01/19 21:26:17
Modified:
merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl
AbstractBlock.java DefaultAppliance.java
merlin/activation/impl/src/test/conf secure.xml
merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant
CodeSecurityDisabledTestCase.java
CodeSecurityEnabledTestCase.java
merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/components
AnotherTestComponent.java AnotherTestService.java
TestService.java
Log:
Even though Testcases doesn't pass, I am committing...
Revision Changes Path
1.16 +16 -3
avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/AbstractBlock.java
Index: AbstractBlock.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/AbstractBlock.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- AbstractBlock.java 19 Jan 2004 21:45:06 -0000 1.15
+++ AbstractBlock.java 20 Jan 2004 05:26:17 -0000 1.16
@@ -134,6 +134,7 @@
private final Engine m_engine;
private final AccessControlContext m_accessControlContext;
+ private final boolean m_secured;
//-------------------------------------------------------------------
// constructor
@@ -150,9 +151,19 @@
super( model );
ClassLoaderModel clmodel = model.getClassLoaderModel();
if( model.isSecureExecutionEnabled() )
+ {
m_accessControlContext = createAccessControlContext( clmodel );
+ m_secured = true;
+ if( getLogger().isDebugEnabled() )
+ getLogger().debug( "AccessControlContext created: " +
m_accessControlContext );
+ }
else
+ {
m_accessControlContext = null;
+ m_secured = false;
+ if( getLogger().isDebugEnabled() )
+ getLogger().debug( "Non-Secure Execution!" );
+ }
m_model = model;
m_engine = engine;
@@ -212,7 +223,7 @@
/**
* Return an appliance relative to a specific path.
* @param source the appliance path
- * @return the appliance
+ * @return the appliance, or null if it couldn't be found.
* @exception IllegalArgumentException if the supplied path is invalid
* @exception ApplianceException if an error occurs during appliance
* resolution
@@ -221,6 +232,8 @@
{
DeploymentModel model =
getContainmentModel().getModel( source );
+ if( model == null )
+ return null;
return locate( model );
}
@@ -444,7 +457,7 @@
{
getLogger().debug( "creating appliance: " + path );
ComponentModel component = (ComponentModel) model;
- appliance = new DefaultAppliance( component, this,
m_accessControlContext );
+ appliance = new DefaultAppliance( component, this,
m_accessControlContext, m_secured );
}
else if( model instanceof ContainmentModel )
{
1.22 +19 -14
avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DefaultAppliance.java
Index: DefaultAppliance.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/java/org/apache/avalon/activation/appliance/impl/DefaultAppliance.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- DefaultAppliance.java 20 Jan 2004 00:10:29 -0000 1.21
+++ DefaultAppliance.java 20 Jan 2004 05:26:17 -0000 1.22
@@ -158,6 +158,8 @@
private AccessControlContext m_accessControlContext;
+ private boolean m_secured;
+
//-------------------------------------------------------------------
// mutable state
//-------------------------------------------------------------------
@@ -191,12 +193,14 @@
public DefaultAppliance( ComponentModel model,
Engine engine,
- AccessControlContext access )
+ AccessControlContext access,
+ boolean secured )
{
super( model );
m_model = (ComponentModel) model;
m_engine = engine;
m_accessControlContext = access;
+ m_secured = secured;
// Enabled the SecurityManager is none already exists, and that
// the kernel setting for enabling the secure execution has been
@@ -214,6 +218,7 @@
m_model = (ComponentModel) model;
m_engine = engine;
m_accessControlContext = null;
+ m_secured = false;
}
//-------------------------------------------------------------------
@@ -554,7 +559,7 @@
getLogger().debug( "applying logger to: " + id );
}
final Logger logger = m_model.getLogger();
- if( m_accessControlContext == null )
+ if( ! m_secured )
{
((LogEnabled)instance).enableLogging( logger );
}
@@ -591,7 +596,7 @@
}
try
{
- if( m_accessControlContext == null )
+ if( ! m_secured )
{
m_contextualization.contextualize( instance, context );
}
@@ -626,7 +631,7 @@
try
{
- if( m_accessControlContext == null )
+ if( ! m_secured )
{
((Contextualizable)instance).contextualize( context );
}
@@ -666,7 +671,7 @@
Map providers = getServiceProviders();
final ServiceManager manager = new DefaultServiceManager( getLogger(),
providers );
- if( m_accessControlContext == null )
+ if( ! m_secured )
{
((Serviceable)instance).service( manager );
}
@@ -694,7 +699,7 @@
int id = System.identityHashCode( instance );
getLogger().debug( "applying configuration to: " + id );
}
- if( m_accessControlContext == null )
+ if( ! m_secured )
{
((Configurable)instance).configure( m_model.getConfiguration() );
}
@@ -722,7 +727,7 @@
int id = System.identityHashCode( instance );
getLogger().debug( "applying parameters to: " + id );
}
- if( m_accessControlContext == null )
+ if( ! m_secured )
{
((Parameterizable)instance).parameterize( m_model.getParameters() );
}
@@ -932,7 +937,7 @@
}
try
{
- if( m_accessControlContext == null )
+ if( ! m_secured )
{
((Initializable)instance).initialize();
}
@@ -969,7 +974,7 @@
}
try
{
- if( m_accessControlContext == null )
+ if( ! m_secured )
{
((Startable)instance).start();
}
@@ -1001,7 +1006,7 @@
}
try
{
- if( m_accessControlContext == null )
+ if( ! m_secured )
{
((Executable)instance).execute();
}
@@ -1037,7 +1042,7 @@
}
try
{
- if( m_accessControlContext == null )
+ if( ! m_secured )
{
((Startable)instance).stop();
}
@@ -1073,7 +1078,7 @@
}
try
{
- if( m_accessControlContext == null )
+ if( ! m_secured )
{
((Disposable)instance).dispose();
}
@@ -1288,7 +1293,7 @@
private Object secureInvocation( final Method method, final Object object,
final Object[] args )
throws Exception
{
- if( m_accessControlContext == null )
+ if( ! m_secured )
{
return method.invoke( object, args );
}
1.4 +5 -0 avalon/merlin/activation/impl/src/test/conf/secure.xml
Index: secure.xml
===================================================================
RCS file: /home/cvs/avalon/merlin/activation/impl/src/test/conf/secure.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- secure.xml 20 Jan 2004 03:57:10 -0000 1.3
+++ secure.xml 20 Jan 2004 05:26:17 -0000 1.4
@@ -25,6 +25,11 @@
</classloader>
<container name="Component1" >
+ <services>
+ <service
type="org.apache.avalon.activation.appliance.grant.components.TestService">
+ <source>test</source>
+ </service>
+ </services>
<component name="test"
class="org.apache.avalon.activation.appliance.grant.components.TestComponent"
activation="startup"/>
1.4 +1 -1
avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/CodeSecurityDisabledTestCase.java
Index: CodeSecurityDisabledTestCase.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/CodeSecurityDisabledTestCase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CodeSecurityDisabledTestCase.java 20 Jan 2004 00:59:23 -0000 1.3
+++ CodeSecurityDisabledTestCase.java 20 Jan 2004 05:26:17 -0000 1.4
@@ -154,7 +154,7 @@
m_model.assemble();
Block block = new DefaultBlock( m_model );
block.deploy();
- Appliance appliance = block.locate( "/test" );
+ Appliance appliance = block.locate( "/Component1/test" );
Object test = appliance.resolve();
return (TestService) appliance.resolve();
}
1.4 +1 -1
avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/CodeSecurityEnabledTestCase.java
Index: CodeSecurityEnabledTestCase.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/CodeSecurityEnabledTestCase.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CodeSecurityEnabledTestCase.java 20 Jan 2004 00:59:23 -0000 1.3
+++ CodeSecurityEnabledTestCase.java 20 Jan 2004 05:26:17 -0000 1.4
@@ -170,7 +170,7 @@
m_model.assemble();
Block block = new DefaultBlock( m_model );
block.deploy();
- Appliance appliance = block.locate( "/test" );
+ Appliance appliance = block.locate( "/Component1/test" );
Object test = appliance.resolve();
return (TestService) appliance.resolve();
}
1.3 +3 -1
avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/components/AnotherTestComponent.java
Index: AnotherTestComponent.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/components/AnotherTestComponent.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AnotherTestComponent.java 20 Jan 2004 03:58:21 -0000 1.2
+++ AnotherTestComponent.java 20 Jan 2004 05:26:17 -0000 1.3
@@ -74,8 +74,10 @@
private TestService m_TestService;
/**
+ * Service from the container.
+ *
* @avalon.dependency
type="org.apache.avalon.activation.appliance.grant.components.TestService"
key="TestService"
- **/
+ */
public void service( ServiceManager man )
throws ServiceException
{
1.2 +0 -1
avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/components/AnotherTestService.java
Index: AnotherTestService.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/components/AnotherTestService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AnotherTestService.java 20 Jan 2004 03:57:10 -0000 1.1
+++ AnotherTestService.java 20 Jan 2004 05:26:17 -0000 1.2
@@ -67,7 +67,6 @@
* assigned permissions.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a>
- * @avalon.component name="test" lifestyle="singleton"
*/
public interface AnotherTestService
{
1.4 +0 -1
avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/components/TestService.java
Index: TestService.java
===================================================================
RCS file:
/home/cvs/avalon/merlin/activation/impl/src/test/org/apache/avalon/activation/appliance/grant/components/TestService.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestService.java 20 Jan 2004 00:59:23 -0000 1.3
+++ TestService.java 20 Jan 2004 05:26:17 -0000 1.4
@@ -67,7 +67,6 @@
* assigned permissions.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a>
- * @avalon.component name="test" lifestyle="singleton"
*/
public interface TestService
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]