-
Notifications
You must be signed in to change notification settings - Fork 8
Developing on the service registry
Check out the EasySOA repository, do a mvn eclipse:eclipse
at the root of the maven projects (in easysoa-registry/
), import them all in Eclipse and you're ready to go !
In order to build and deploy the service registry plugins, you can either:
- Use [Buildr](Development Environment) (recommended). Configure your Nuxeo location thanks to
easysoa-distribution/build.yaml
, then build and deploy by typingbuildr nx_mvn nx_dist
from theeasysoa-distribution
folder. - Build them using Maven (
mvn clean install
from theeasysoa-registry
folder), them move theeasysoa-registry/target
contents to your Nuxeo root folder.
This pom project has only been set up to resolve compatibility issues between Nuxeo and Sonatype's M2Eclipse. You should keep this project open in your Eclipse workspace so that M2E refers to this projects pom.xml
, and not to the "real one".
If you're having errors in the easysoa-registry-* projects, use M2Eclipse's "Update project configuration" option to update the dependencies references.
- Document types : see in [OSGI-INF/CoreExtensions.xml] (http://explorer.nuxeo.org/nuxeo/site/distribution/current/viewComponent/org.nuxeo.ecm.core.CoreExtensions) in nuxeo-core-xxx.jar in $NUXEO_HOME/nxserver/bundles
- Query reference & examples
- Bundles, components & contributions : see [Nuxeo Explorer] (http://explorer.nuxeo.org/nuxeo/site/distribution/current)
- [Javadoc] (http://community.nuxeo.com/api/nuxeo/5.4/javadoc)
To debug Nuxeo, in bin/nuxeo.conf uncomment or adapt the following line :
JAVA_OPTS=$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
Then restart the server, connect your debugging environment (ex. Eclipse > Debug configurations... > Remote Application) to said local port (here 8787), and start placing breakpoints. You can switch suspend=n
to suspend=y
if you want to monitor Nuxeo right from the start (Java will wait for you to connect with Eclipse before to start Nuxeo).
To get the Nuxeo code in Eclipse : if you're using working with the latest (HEAD) EasySOA code, do as Nuxeo says to get the source and you'll then be able to link to it from Eclipse. Otherwise if you're using a released version's source, check in Eclipse Preferences > Maven the "download sources" checkbox.
To test (with JUnit) Nuxeo developments, there must be a runnning Nuxeo server, or at least part of it. There are several ways :
Use a custom JUnit Feature, and annotations to configure an embedded Nuxeo deployment. Available features :
- EasySOAFeature : adds EasySOA bundle & document types to CoreFeature. Example : [SCAImportTest] (https://github.com/easysoa/easysoa-model-demo/blob/master/plugins/easysoa-model-demo-core/src/test/java/org/easysoa/sca/SCAImportTest.java)
- EasySOAServerFeature : adds a Jetty HTTP server. Example (still in the works, also adds custom vocabulary) : [VocabulariesTest] (https://github.com/easysoa/easysoa-model-demo/blob/master/plugins/easysoa-model-demo-core/src/test/java/org/easysoa/tests/VocabulariesTest.java)
- original Nuxeo Features : RuntimeFeature (bare runtime), CoreFeature (adds base document API). More at http://doc.nuxeo.com/display/CORG/Unit+Testing
Extend org.nuxeo.runtime.test.NXRuntimeTestCase, and use the deployBundle, deployContrib methods & others to configure an embedded Nuxeo deployment. Example : see org.nuxeo.ecm.core.storage.sql.SQLRepositoryTestCase
Write tests that interact remotely with a manually deployed Nuxeo by extending [NotificationTestCase] (https://github.com/easysoa/easysoa-model-demo/blob/master/plugins/easysoa-model-demo-rest/src/test/java/org/easysoa/test/rest/tools/NotificationTestCase.java), or using other remote interaction alternatives as described above.
Developing a new feature for the Service Registry implies one or more of :
- Enriching the model
- Displaying it in Nuxeo's JSF interface
- Developing new services
- Exposing them as REST using the Nuxeo Web Engine
- External development using them
- There is a problem with Nuxeo 5.7 (maybe with earlier versions, not tested ..) and js files. When a script tag is included in a freemarker template in the web engine, Nuxeo returns the the path of the script instead of the script itself when the script name finish with '.js'. A solution, waiting for correction, is to rename the script with the extension '._js'.
- To use Bootstrap, you have to add a script tag referencing JQuery before referencing the bootstrap.js file. Bootstrap is dependent of JQuery and if the JQuery script is not loaded before the bootstrap script, the bootstrap stuff will not work properly.
- to get a DocumentModel from a Nuxeo ID : see "how to create new objects" below and do
service['session'].getDocument(new_f('org.nuxeo.ecm.core.api.IdRef', providerActor))
. A better way would be to use customs methods on business adapters (InformationServiceAdapter...). - to create new objects (from there) :
new_f('org.nuxeo.ecm.core.api.IdRef', providerActor)
after having put in the freemarker context "new_f" asnew freemarker.template.utility.ObjectConstructor()
As said in Hot reload doc, enable hot deploy & reload (of bundles, Seam & JSF UI, WebEngine...) by setting in nuxeo.conf (or in the Admin center) :
org.nuxeo.dev=true
This can alternatively be done in Nuxeo Admin Center, or using the Nuxeo Studio Eclipse plugin. More info about hot reload without the plugin here.
Otherwise, also possible :
to reload WebEngine templates, copy their sources in your deployed Nuxeo server, ex. :
cp -rf easysoa-registry-rest-server/src/main/resources/skin easysoa-registry-marketplace/target/nuxeo-cap-5.7-I20130111_0115-tomcat/nxserver/web/root.war/modules/org.easysoa.registry.rest.server/
then go to the Nuxeo site Admin page and hit "reload". More info about WebEngine hot reload here