"Stephen McConnell" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED]
Eike Stepper wrote:
"Facility" gets the model via context and can create a "Dynamic". Dynamic needs a "Needed" but doesn't get one ;-(((
<snip>
Caused by: java.lang.IllegalStateException: Unknown resource. Bundle: 'org.apache.avalon.activation.impl.Resources' Key: 'service.error.null-provider' Args: 'test.Needed'
There i18n resource bundle is missing a value for the key 'service.error.null-provider' which is making this error a little more obtuse than it should be - I've just corrected this in the source with the following:
# # ServiceManager # --------------
service.error.null-provider = A valid request was received for a service using the key [{0}] but the supplied dependency model returned a null provider. This is an internal an internal system error reflecting an inconsistent assembly state.
I.e. you should not see this condition as it represents an invalid assembly. In you scenario the component model has successfully passed assembly - which is strange but also an indication of where the problem is. I'm going to put a test case together and see if I can simulate this.
i'm using the following code to dynamically commission the DefaultDynamic component:
Was about to ask you for this!
:-)
public Dynamic createDynamic() throws Exception { String componentName = "dynamic-" + (++counter); String componentType = DefaultDynamic.class.getName();
TypeRepository repo = model.getClassLoaderModel().getTypeRepository(); Type type = repo.getType(componentType);
ComponentProfile template = repo.getProfile(type, "fake"); ComponentProfile profile = new ComponentProfile(componentName, template); ComponentModel component = (ComponentModel) model.addModel(profile);
component.getContextModel().setEntry("intVal", new Integer(4711)); component.getContextModel().setEntry("socketChannel", SocketChannel.open());
OK - nothing wrong with the above.
component.commission();
At this point we should be able to validate a couple of things. Could you add the following:
if( !component.isAssembled() )
{
throw IllegalStateException( "not-assembled" );
} DependencyModel[] dependencies = component.getDependencyModels();
for( int i=0; i<dependencies.length; i++ )
{
DependencyModel dependency = dependencies[i];
if( null == dependency.getProvider() )
{
throw IllegalStateException( "null-provider" );
}
}It would be helpful to get a quick confirmation of the assembly state of the component model.
Stephen.
--
|---------------------------------------| | Magic by Merlin | | Production by Avalon | | | | http://avalon.apache.org | |---------------------------------------|
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
