Skip Headers
Oracle® Application Development Framework Developer's Guide
10g Release 3 (10.1.3)
B25386-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

20.7 Create an XML File to Define Your Adapter

To define your adapter for JDeveloper, create a file called adapter-definition.xml and place it in a directory called meta-inf. Note that the file and directory names are case-sensitive.

A typical adapter-definition.xml file contains the following entries:

Example 20-32 Description of adapter-definition.xml File

<AdapterDefinition>
   <Adapter Name="unique name for the adapter"
            ClassName="full name of class that implements AbstractAdapter">

      <Schema Namespace="name of schema that defines the data control metadata for this adapter"
              Location="location of schema definition file"/>

      <Source>
         <Type Name="name of source type that the adapter can handle to create a data control"
               JDevNode="full class name of supported node"/>
      </Source>
 
      <JDevContextHook Class="full name of class that provides the JDeveloper context hook, if any"/>

      <Dependencies>
         <Library Path="full path name of the JAR file that the adapter needs in order to run"/>
      </Dependencies>

   </Adapter>
</AdapterDefinition>

The AdapterDefinition tag is the container tag for all adapters.

Each Adapter tag describes an adapter. It has the following attributes:

The Schema tag defines the namespace and the schema definition for the adapter metadata. JDeveloper registers the schema so that the metadata can be validated at design time. You can define all the namespaces and schemas supported by the adapters. This is optional.

The Source tag specifies the node (or data source) types that the adapter supports. It has the following attributes:

The JDevContextHook tag specifies additions to the context menu (the menu that appears when the user right clicks on the metadata node for the data control instance in the Structure Pane).

The Dependencies tag lists the library files that your adapter requires during runtime. The framework adds the library files to the project when the user uses a data control based on your adapter.

The adapter-definition.xml file for the simple CSV data control adapter looks like the following:

Example 20-33 adapter-definition.xml File for the Simple CSV Adapter

<AdapterDefinition>
   <Adapter Name="oracle.adfm.adapter.SampleDataControl"
            ClassName="oracle.adfinternal.model.adapter.sample.SampleDCAdapter">
      <Schema Namespace="http://xmlns.oracle.com/adfm/adapter/sample"
            Location="/oracle/adfinternal/model/adapter/sample/sampleDC.xsd"/>
      <Source>
         <Type Name="csvNode" JDevNode="oracle.ide.model.TextNode"/>
      </Source>
      <Dependencies>
         <Library Path="${oracle.home}/jlib/sampledc.jar"/>
      </Dependencies>
   </Adapter>
</AdapterDefinition>

The sampleDC.xsd file is shown in Section 20.11.1, "sampleDC.xsd".