Using XML Schemas
iPOJO provides XML schemas to check iPOJO descriptors (i.e. metadata.xml). Several schemas are provided in order to describe the core syntax, compositions and external handlers.
Schema |
URL |
---|---|
iPOJO Core |
|
iPOJO Composite |
|
Temporal Dependency Handler |
|
Whiteboard pattern handler |
http://felix.apache.org/ipojo/schemas/CURRENT/whiteboard-pattern.xsd |
Extender pattern handler |
http://felix.apache.org/ipojo/schemas/CURRENT/extender-pattern.xsd |
Event Admin handlers |
http://felix.apache.org/ipojo/schemas/CURRENT/event-admin.xsd |
JMX handler |
Note: the schemas are also provided inside implicated bundles.
Note: to use trunk version schemas, replace CURRENT
by SNAPSHOT
in the URL.
To use those schemas you have to declares those schemas in your metadata.xml file such as in the next snippet using the iPOJO core XML-schema:
<ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="org.apache.felix.ipojo http://felix.apache.org/ipojo/schemas/CURRENT/core.xsd" xmlns="org.apache.felix.ipojo"> <component ....> </component> </ipojo>
First, declares the 'XMLSChema-instance' namespace. Then, declares used namespaces and schemas in the 'xsi:schemaLocation' attribute. This attribute contains pairs 'namespace url' separated by spaces. Finally, declares the default namespace to "org.apache.felix.ipojo".
You can also use several schemas in the same descriptor by using a header like:
<ipojo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="org.apache.felix.ipojo http://felix.apache.org/ipojo/schemas/CURRENT/core.xsd org.apache.felix.ipojo.extender http://felix.apache.org/ipojo/schemas/CURRENT/extender-pattern.xsd" xmlns="org.apache.felix.ipojo" xmlns:extender="org.apache.felix.ipojo.extender"> <component classname="org.apache.felix.ipojo.junit4osgi.impl.JunitExtender"> <extender:extender extension="Test-Suite" onArrival="onBundleArrival" onDeparture="onBundleDeparture" /> <callback transition="invalidate" method="stopping" /> <callback transition="validate" method="starting" /> <provides /> </component> <instance component="org.apache.felix.ipojo.junit4osgi.impl.JunitExtender" /> </ipojo>
The only difference is contained in the 'schemaLocation' attribute, which contains several pairs. You also need to declare the namespace of the used external handler.
If you declare schemas, the iPOJO manipulator automatically checks the validity of the descriptor against the declared schemas. Moreover, if you use 'advanced' XML Editor supporting schemas, editing iPOJO descriptors should be eased with auto-completion features.
Avoiding XML Schemas downloads during the build process [1.1.0-SNAPSHOT]
The manipulator embeds the iPOJO XML Schemas to avoid using a network connection to download them during the validation process. Keep the same url, the manipulator will just resolve the URL differently to use embedded schemas. You can also skipped this shortcut thanks the the ignoreEmbeddedSchemas
parameter (refer to the ant task guide and to the maven plugin guide for further information).
Overview
Getting Started
- iPOJO in 10 minutes
- How to use iPOJO Annotations
- iPOJO Hello Word (Maven-Based) tutorial
- iPOJO Advanced Tutorial
- iPOJO Composition Tutorial
User Guide
- Describing components (handler list)
- Using XML Schemas
- Describing components with the iPOJO-API
- Testing components
- Advanced Topics
- Eclipse Integration
- FAQ
- iPOJO Reference Card
Tools
- iPOJO Eclipse Plug-in
- iPOJO Ant Task
- iPOJO Maven Plug-in
- Online-Manipulator
- iPOJO Arch Command
- iPOJO Webconsole plugin
- Junit4OSGi
Developer Guide
- Javadoc: 1.2
- How to write your own handler
- How to use iPOJO Manipulation Metadata
- Dive into the iPOJO Manipulation depths
Misc & Contact
- Issues Tracker
- Supported JVMs
- Supported OSGi Implementations
- iPOJO's Dark Side Blog
- Future Ideas
- Article & Presentations
Experimentation