Conflict between component name and library name?

Hello,

Using OCL 1.10, I get warnings similar to that below from the deployer:

[ Warning][DeploymentComponent::loadLibrary] Component type name Trigger
already used: overriding.

The cause is that my component class name (Trigger) is the same as the
library name (Trigger.so), and that the deployment component inserts the
component and library names in the same lookup table.

There is of course an easy work around for this; for example, I could
insert my component classes in a namespace. But this still leaves me
wondering whether the current behavior is intended, and what is the
rationale behind putting library names and component names in the same
lookup table.

Can someone more experienced than me shed a light on this?

Regards,
Johan Cockx

PS: Here is the offending deployer code (part of
DeploymentComponent::import):

factory = (TaskContext*(*)(std::string))(dlsym(handle,
"createComponent") );
if ((error = dlerror()) == NULL) {
// store factory.
if ( ComponentFactories::Instance().count(libname) == 1 ) {
log(Warning) << "Library name "<<libname<<" already used:
overriding."<<endlog();
}
ComponentFactories::Instance()[libname] = factory;
tname = (std::string(*)(void))(dlsym(handle, "getComponentType")
);
if ((error = dlerror()) == NULL) {
std::string cname = (*tname)();
if ( ComponentFactories::Instance().count(cname) == 1 ) {
log(Warning) << "Component type name "<<cname<<" already
used: overriding."<<endlog();
}
ComponentFactories::Instance()[ cname ] = factory;
log(Info) << "Loaded component type '"<< cname
<<"'"<<endlog();
loading_lib.components_type.push_back( cname );

} else {
log(Info) << "Loaded single component library '"<< libname
<<"'"<<endlog();
loading_lib.components_type.push_back( libname );
}
is_component = true;
} else {
log(Debug) << error << endlog();
}

Conflict between component name and library name?

On Tuesday 05 January 2010 17:14:25 Johan Cockx wrote:
> Hello,
>
> Using OCL 1.10, I get warnings similar to that below from the deployer:
>
> [ Warning][DeploymentComponent::loadLibrary] Component type name Trigger
> already used: overriding.
>
> The cause is that my component class name (Trigger) is the same as the
> library name (Trigger.so), and that the deployment component inserts the
> component and library names in the same lookup table.
>
> There is of course an easy work around for this; for example, I could
> insert my component classes in a namespace. But this still leaves me
> wondering whether the current behavior is intended, and what is the
> rationale behind putting library names and component names in the same
> lookup table.
>
> Can someone more experienced than me shed a light on this?

We allow to load a component by library name or by component name. Loading by
library name is only allowed if the library contains only one component. Both
names are indeed stored in the same lookup table. I wouldn't create a second
lookup table to just cover this case. I think its easier to update the
offending code to detect this corner case and not let it issue the warning.

Peter