Hi all,

In order to completely switch to the Platform API and remove hard coded JNDI lookups each module owner need to refactor it's modules to contribute service bindings to the platform api server extension point.

I will give here a simple example. For more information you can directly ask me or to Julien or Dragos since they already used
these extensions.

If you want to make available your services through NXRuntime (for local use - for example in an embeded repository in a RCP application) you must declare the same services at NXRuntime level by using OSGi services declaration into the component XML
(there is an email about this I sent some time ago)

How to contribute an EJB service binding:
--------------------------------------------------------------------------

The platform-api module is declaring a component org.nuxeo.ecm.platform.api.PlatformService with an extension point named servers. Se the documentation of the extension point for a complete description.

Through this extension point the platform service register new entities named servers. A server is a represent a Nuxeo5 instance (a JBoss instance) remotely accessible through a JNDI server The server has a name a host and a port. The host and port is the same as the host and port of the JBoss JNDI server. There are other advanced attribute you can use - they are documented in the servers extension point

The platform-api declares a default server as is:

 <extension target="org.nuxeo.ecm.platform.api.PlatformService"
         point="servers">
       <documentation>The default platform layout</documentation>

       <server name="default" host="localhost" port="1099">
           ...
       </server>
 </extension>

This is the default server - located on the localhost and using the default JNDI port of JBoss.

Each server may contain several EJB service bindings or repository bindings.
If you want to add new bindings to an already declared server you should declare the server only with the name paramater (do not use host or/and port - otherwise you will declare a new server)
Example:

 <extension target="org.nuxeo.ecm.platform.api.PlatformService"
         point="servers">

       <server name="default">

<service class="org.nuxeo.ecm.platform.types.ejb.TypeManager" jndiName="%TypeManagerBean"/>

       </server>

   </extension>

This extension will declare a new binding between the remote interface org.nuxeo.ecm.platform.types.ejb.TypeManager
and the bean having as the JNDI name %TypeManagerBean
Note that %NAME will be expanded to nuxeo/NAME/remote. THis will make easier to refactor the application if the nuxeo.ear will be renamed - this way you will need to redefine only the server declaration and leave as is the service bindings.
For more info see  the documentation

You can also specify complete JNDI names (not the default one in the form nuxeo/BEAN_NAME/remote)
For this you simply write the full name (do not use anymore the % character)

Now that you have declared your binding you can instantiate the TypeManagerBean by using the following code:

TypeManager typeMgr = ECM.getPlatform().getService(TypeManager.class);

If the service is not bound in a server declaration NXRuntime will be used to locate the service

To define clustered nuxeo5 instances we will simply create multiple server extensions each one with their own bindings. This will be autyomated in the future by using nxruntime remoting to discover server configurations.

So you must replace all the JNDI lookups using the method described above.

Regards,
Bogdan

_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm

Reply via email to