You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "TangYong (JIRA)" <ji...@apache.org> on 2013/05/03 11:14:16 UTC

[jira] [Created] (ARIES-1062) org.apache.aries.subsystem.core.internal.Activator needs to be improved

TangYong created ARIES-1062:
-------------------------------

             Summary: org.apache.aries.subsystem.core.internal.Activator needs to be improved
                 Key: ARIES-1062
                 URL: https://issues.apache.org/jira/browse/ARIES-1062
             Project: Aries
          Issue Type: Improvement
          Components: Subsystem
    Affects Versions: 1.0
            Reporter: TangYong
            Priority: Minor


Currently, org.apache.aries.subsystem.core.internal.Activator class and org.apache.aries.subsystem.core.internal.SubsystemResolverHookFactory class have some curious coding as following:

1. activate()
"new Subsystems()" can not throw SubsystemException.

2. addingService method
I suggest the following writing:

        @Override
	public synchronized Object addingService(ServiceReference<Object> reference) {
		Object service = bundleContext.getService(reference);
		
		if (service instanceof IDirectoryFinder){
			finders.add((IDirectoryFinder)service);
			return service;
		}
		else if (service instanceof Repository){
			repositories.add((Repository)service);
			return service;
		}
		else if (service instanceof Coordinator){
			if (coordinator == null) {
				coordinator = (Coordinator)service;
			}
		}
		else if (service instanceof RegionDigraph) {
			if (regionDigraph == null) {
				regionDigraph = (RegionDigraph)service;
			}
		}
		else if (service instanceof Resolver) {
			if (resolver == null) {
				resolver = (Resolver)service;
			}
		}
		else if (service instanceof ModelledResourceManager) {
			if (modelledResourceManager == null) {
				modelledResourceManager = (ModelledResourceManager)service;
			}
		}
		
		activate();
		return service;
	}

3. SubsystemResolverHookFactory class's constructor

I have never seen the following and explicitly throw NPE

if (subsystems == null)
 throw new NullPointerException("Missing required parameter: subsystems");

I suggest that we'd better use RuntimeException or IllegalArgumentException



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira