hstaudacher / osgi-jax-rs-connector

An OSGi - JAX-RS 2.0 Connector, software repository available on the link below
http://hstaudacher.github.io/osgi-jax-rs-connector
Other
190 stars 98 forks source link

Contents of ApplicationConfiguration#getProperties not being integrated #120

Closed col-panic closed 8 years ago

col-panic commented 8 years ago

I have tried to provide additional configuration to the application startup, yet my method is not even called. While I tracked down, that my service is being registered in a ServiceContainer, it seems that during startup a different ServiceContainer is handed over to the specific code in JerseyContext

applyApplicationConfigurations where no Services are available

The call to initializing the properties in the beginning points to

// for testing purposes JAXRSConnector#createJerseyContext

any hint on this?? thank you!

col-panic commented 8 years ago

I found that during initialization, all resources get added to the resources, in JAXRSConnector (see lower), while during createJerseyContext the applicationConfigurations is passed?!

JAXRSConnector( BundleContext bundleContext ) {
    this.bundleContext = bundleContext;
    this.configuration = new Configuration( this );
    this.httpServices = new ServiceContainer( bundleContext );
    this.resources = new ServiceContainer( bundleContext );
    this.contextMap = new HashMap<HttpService, JerseyContext>();
    this.resourceCache = new ArrayList<ServiceHolder>();
    this.applicationConfigurations = new ServiceContainer( bundleContext );
  }

So by implementing ApplicationConfiguration in my @Path or @Provider classes those are added to this.resources, while instantiation is done via this.applicationConfigurations?!

col-panic commented 8 years ago

I see that the ApplicationConfigurationTracker is not considering the file, even though its implementing ApplicationConfiguration and the resource itself works - not sure why this is the case on the following file

@Path("/webdav")
public class ElexisWebDAVService implements ApplicationConfiguration {
col-panic commented 8 years ago

Allright, stupid me ... in the OSGI-INF DS description, the resp. service has to declare that it provides the ApplicationConfiguration service in order for the tracker to take care of it! Sorry for bothering, might be a good addition to the ds example however - interested in a pull request for that?