Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 335848

Summary: ServerManager couldn't use server.xml
Product: [RT] ECF Reporter: ekkehard gentz <ekke>
Component: ecf.serverAssignee: Scott Lewis <slewis>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: slewis
Version: 3.4.0   
Target Milestone: 3.5.0   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
added test for extension point none

Description ekkehard gentz CLA 2011-01-31 09:40:31 EST
public ServerManager() {
		final IExtensionRegistry reg = Activator.getDefault().getExtensionRegistry();
		try {
			if (reg != null) {
				createServersFromExtensionRegistry(reg);
			} else {
				createServersFromConfigurationFile(Activator.getDefault().getBundle().getEntry("server.xml").openStream());
			}
		} catch (final Exception e) {
			Activator.log("Exception creating servers", e); //$NON-NLS-1$
		}
	}
....
some lines later:
private void createServersFromExtensionRegistry(IExtensionRegistry registry) throws Exception {
		final IExtensionPoint extensionPoint = registry.getExtensionPoint(EXTENSION_POINT);
		if (extensionPoint == null)
			return;
----------------
so: if the EXTENSION_POINT wasn't found then:
* no config from extension
and
* no config from server.xml

the test should be in the first method:

                        if (reg != null && reg.getExtensionPoint(EXTENSION_POINT) != null) {
				createServersFromExtensionRegistry(reg);
			} else {
				createServersFromConfigurationFile(A...).openStream());
			}
Comment 1 Scott Lewis CLA 2011-01-31 11:53:29 EST
Would you like to attach a fix?  (i.e. a revised version of the relevant file)?  Then I could apply, test, and release fairly quickly.
Comment 2 ekkehard gentz CLA 2011-01-31 12:07:37 EST
(In reply to comment #1)
> Would you like to attach a fix?  (i.e. a revised version of the relevant file)?
>  Then I could apply, test, and release fairly quickly.

no problem - will provide this later

ekke
Comment 3 ekkehard gentz CLA 2011-01-31 15:56:33 EST
Created attachment 188006 [details]
added test for extension point

only in line 69

&& reg.getExtensionPoint(EXTENSION_POINT) != null

inserted
Comment 4 Scott Lewis CLA 2011-01-31 16:26:54 EST
Released fix to master.  Resolving as fixed.  Thanks for the bug report and fix.

BTW, the ServerManager is kind of an old class...which predates a lot of the more recent work in IGenericServerContainerGroupFactory (a osgi service for creating/using generic server instances), and all the work on the discovery API and OSGi remote services/remote service admin.
Comment 5 ekkehard gentz CLA 2011-01-31 16:33:18 EST
(In reply to comment #4)

> 
> BTW, the ServerManager is kind of an old class...which predates a lot of the
> more recent work in IGenericServerContainerGroupFactory (a osgi service for
> creating/using generic server instances), and all the work on the discovery API
> and OSGi remote services/remote service admin.

ECF is new for me and I got the hint to try out the GenericServer
and the Activator creates the ServerManager
so I thought this is the recommended way
Comment 6 Scott Lewis CLA 2011-01-31 16:47:02 EST
(In reply to comment #5)
> (In reply to comment #4)
> 
> > 
> > BTW, the ServerManager is kind of an old class...which predates a lot of the
> > more recent work in IGenericServerContainerGroupFactory (a osgi service for
> > creating/using generic server instances), and all the work on the discovery API
> > and OSGi remote services/remote service admin.
> 
> ECF is new for me and I got the hint to try out the GenericServer
> and the Activator creates the ServerManager
> so I thought this is the recommended way

The Activator starting the ServerManager is for backward compatibility (i.e. so those using the ServerManager don't have things stop working).

Notice the Activator also now creates an IGenericServerContainerGroupFactory and registers it as an OSGi service...so that generic server instances can be created/started/stopped dynamically via an OSGi service (rather than statically via configuration file or extension registry).

It would obviously be desirable to have documentation for all this, but alas our resources don't currently allow it.