24.08.2015 Views

Oxygen XML Author plugin 13.2.0

Oxygen XML Author plugin 13.2.0

Oxygen XML Author plugin 13.2.0

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Author</strong> Developer Guide | 184Figure 97: Selecting the Operation10. Add the action to the toolbar, using the Toolbar panel.To test the action, you can open the sdf_sample.xml sample, then place the caret inside a section between twopara elements for instance. Press the button associated with the action from the toolbar. In the dialog select an imageURL and press OK. The image is inserted into the document.Example 2. Operations with Arguments. Report from Database Operation.In this example you will create an operation that connects to a relational database and executes an SQL statement. Theresult should be inserted in the edited <strong>XML</strong> document as a table. To make the operation fully configurable, it willhave arguments for the database connection string, the user name, the password and the SQL expression.1. Create a new Java project in your preferred IDE. Create the lib folder in the Java project directory and copy theoxygen.jar file from the {oXygen_installation_directory}/lib directory.2. Create the class simple.documentation.framework.QueryDatabaseOperation. This class mustimplements the ro.sync.ecss.extensions.api.<strong>Author</strong>Operation interface.import ro.sync.ecss.extensions.api.ArgumentDescriptor;import ro.sync.ecss.extensions.api.ArgumentsMap;import ro.sync.ecss.extensions.api.<strong>Author</strong>Access;import ro.sync.ecss.extensions.api.<strong>Author</strong>Operation;import ro.sync.ecss.extensions.api.<strong>Author</strong>OperationException;public class QueryDatabaseOperation implements <strong>Author</strong>Operation{3. Now define the operation's arguments. For each of them you will use a String constant representing the argumentname:private static final String ARG_JDBC_DRIVER ="jdbc_driver";private static final String ARG_USER ="user";

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!