Q:

Conditionally depend on a library?

I have an XPage that runs in the browser and in the Notes client. In the client I want to talk to the Java client UI. So I built an Extlib that encapsulated the calls. And I built one with the same signature for the web. 
How can I make the app depend on one or the other based on running in the client or on the server? 

A:

You should use OSGi Services for this.

Define your API in terms of Java interfaces. Write a single bundle that exports the API package.
Write two implementations of the API, one that implements it for "thick client" and the other that implements it for the web. Each bundle provides its implementation as a Service.
Include the thick client bundle in the thick client app; include the web bundle in the web app.

To ease the task of implementing and consuming the service, I strongly recommend using Declarative Services (DS).

