aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John Ross (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (ARIES-1062) org.apache.aries.subsystem.core.internal.Activator needs to be improved
Date Fri, 27 Sep 2013 15:36:04 GMT

     [ https://issues.apache.org/jira/browse/ARIES-1062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

John Ross updated ARIES-1062:
-----------------------------

    Labels: nextrelease  (was: )
    
> 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
>            Assignee: John Ross
>            Priority: Minor
>              Labels: nextrelease
>         Attachments: Activator.java.patch
>
>
> 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

Mime
View raw message