Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EclipseLink/UserGuide/DBWS/DBWSBuilderAPI"
(→DBWSBuilder API) |
|||
Line 37: | Line 37: | ||
[[Image:DBWSPackagerHierarchy.png]] | [[Image:DBWSPackagerHierarchy.png]] | ||
− | Once all the | + | The primary responsibility of a <code>DBWSPackager</code> is to provide <code>java.io.OutputStream</code>'s for the output generated by <code>DBWSBuilder</code>: |
− | <source lang="java" | + | <source lang="java" enclose="div"> |
+ | // call-backs for stream management | ||
+ | public OutputStream getSchemaStream() throws FileNotFoundException; | ||
+ | public void closeSchemaStream(OutputStream schemaStream); | ||
+ | |||
+ | public OutputStream getSessionsStream(String sessionsFileName) throws FileNotFoundException; | ||
+ | public void closeSessionsStream(OutputStream sessionsStream); | ||
+ | |||
+ | public OutputStream getServiceStream() throws FileNotFoundException; | ||
+ | public void closeServiceStream(OutputStream serviceStream); | ||
+ | |||
+ | public OutputStream getOrStream() throws FileNotFoundException; | ||
+ | public void closeOrStream(OutputStream orStream); | ||
+ | |||
+ | public OutputStream getOxStream() throws FileNotFoundException; | ||
+ | public void closeOxStream(OutputStream oxStream); | ||
+ | |||
+ | public OutputStream getWSDLStream() throws FileNotFoundException; | ||
+ | public void closeWSDLStream(OutputStream wsdlStream); | ||
+ | |||
+ | public OutputStream getSWARefStream() throws FileNotFoundException; | ||
+ | public void closeSWARefStream(OutputStream swarefStream); | ||
+ | |||
+ | public OutputStream getWebXmlStream() throws FileNotFoundException; | ||
+ | public void closeWebXmlStream(OutputStream webXmlStream); | ||
+ | |||
+ | public OutputStream getProviderClassStream() throws FileNotFoundException; | ||
+ | public void closeProviderClassStream(OutputStream codeGenProviderStream); | ||
+ | |||
+ | public OutputStream getProviderSourceStream() throws FileNotFoundException; | ||
+ | public void closeProviderSourceStream(OutputStream sourceProviderStream); | ||
+ | </source> | ||
+ | Once all the model objects have been built, the builder is invoked either through the <b><code>start()</code></b> method, | ||
+ | or alternatively via the <b><code>build(...)</code></b> metho, which overrides the streams from the <code>DBWSPackager</code>, | ||
+ | allowing the user to managed the streams. | ||
+ | <source lang="java" enclose="div"> | ||
+ | public void start() ... | ||
+ | |||
public void build(OutputStream dbwsSchemaStream, OutputStream dbwsSessionsStream, | public void build(OutputStream dbwsSchemaStream, OutputStream dbwsSessionsStream, | ||
OutputStream dbwsServiceStream, OutputStream dbwsOrStream, OutputStream dbwsOxStream, | OutputStream dbwsServiceStream, OutputStream dbwsOrStream, OutputStream dbwsOxStream, | ||
OutputStream swarefStream, OutputStream webXmlStream, OutputStream wsdlStream, | OutputStream swarefStream, OutputStream webXmlStream, OutputStream wsdlStream, | ||
OutputStream codeGenProviderStream, OutputStream sourceProviderStream, Logger logger) | OutputStream codeGenProviderStream, OutputStream sourceProviderStream, Logger logger) | ||
− | + | ... | |
</source> | </source> | ||
Revision as of 16:17, 17 April 2009
DBWSBuilder API
The EclipseLink DBWS design-time utility - DBWSBuilder - is a Java application that generates EclipseLink DBWS files and assembles them into deployable archives.
It is normally invoked from the command-line via its main
method:
prompt > dbwsbuilder.cmd -builderFile {path_to_builder.xml} -stageDir {path_to_stageDir} -packageAs {packager}
The given builder XML file is parsed:
<?xml version="1.0" encoding="UTF-8"?> <dbws-builder xmlns:xsd="http://www.w3.org/2001/XMLSchema" <properties> <property name="projectName">test</property> <property name="driver">oracle.jdbc.OracleDriver</property> <property name="password">tiger</property> <property name="url">jdbc:oracle:thin:@localhost:1521:ORCL</property> <property name="username">scott</property> </properties> <table catalogPattern="%" schemaPattern="SCOTT" tableNamePattern="EMP" /> </dbws-builder>
by the OXM Project o.e.p.tools.dbws.DBWSBuilderModelProject
producing model objects that represent properties and <table> operations. Thus the public class org.eclipse.persistence.tools.dbws.DBWSBuilder
can be populated
programmatically through property setters (i.e. setDriver()
, setUrl()
) - table or procedure operations
can be added via the public addDbTable()
and addDbStoredProcedure()
methods; SQL operations via addSqlOperation()
.
The packager specified on the command-line is represented by a class that implements the o.e.p.tools.dbws.DBWSPackager
interface. There is a hierarchy of concrete implementations of this interface:
The primary responsibility of a DBWSPackager
is to provide java.io.OutputStream
's for the output generated by DBWSBuilder
:
public OutputStream getSchemaStream() throws FileNotFoundException;
public void closeSchemaStream(OutputStream schemaStream);
public OutputStream getSessionsStream(String sessionsFileName) throws FileNotFoundException;
public void closeSessionsStream(OutputStream sessionsStream);
public OutputStream getServiceStream() throws FileNotFoundException;
public void closeServiceStream(OutputStream serviceStream);
public OutputStream getOrStream() throws FileNotFoundException;
public void closeOrStream(OutputStream orStream);
public OutputStream getOxStream() throws FileNotFoundException;
public void closeOxStream(OutputStream oxStream);
public OutputStream getWSDLStream() throws FileNotFoundException;
public void closeWSDLStream(OutputStream wsdlStream);
public OutputStream getSWARefStream() throws FileNotFoundException;
public void closeSWARefStream(OutputStream swarefStream);
public OutputStream getWebXmlStream() throws FileNotFoundException;
public void closeWebXmlStream(OutputStream webXmlStream);
public OutputStream getProviderClassStream() throws FileNotFoundException;
public void closeProviderClassStream(OutputStream codeGenProviderStream);
public OutputStream getProviderSourceStream() throws FileNotFoundException;
public void closeProviderSourceStream(OutputStream sourceProviderStream);
Once all the model objects have been built, the builder is invoked either through the start()
method,
or alternatively via the build(...)
metho, which overrides the streams from the DBWSPackager
,
allowing the user to managed the streams.
public void build(OutputStream dbwsSchemaStream, OutputStream dbwsSessionsStream,
OutputStream dbwsServiceStream, OutputStream dbwsOrStream, OutputStream dbwsOxStream,
OutputStream swarefStream, OutputStream webXmlStream, OutputStream wsdlStream,
OutputStream codeGenProviderStream, OutputStream sourceProviderStream, Logger logger)
...