zaterdag 29 september 2012

Sharing a File-based MDS repository

If you want to use a file-based MDS repository within JDeveloper, most textbooks explain that you have to create this repository in a very specific directory: <Jdev home>/jdeveloper/integration/seed. In this directory, you have to create the subdirectory 'apps' and your project MDS repositories. This is all very well when you're the only developer in the project, once you're in a team this is a nuisance. Especially in the early stages of a project, the MDS artifacts and structure that your team creates change frequently. If you're not using a database-based MDS during development, you'd like your file-based MDS to be on a share. Thanks to a tip I got from Geoffrey de Lamalle during a SOA summer camp, it is possible to do just that! This is how you do it:

Create, within in your application, a generic project in JDeveloper, call it what you like, for instance myProjectMDS. Create it on a share (e.g. Z:/mds/myApplicationMDS) and create the following subdirectory structure:

(Z:/mds/myApplicationMDS)/src/apps/myMDS/xsd

This directory will hold the XML schema's that are shared in this project (obviously this is a very simplified example). You can extend or change this structure as you like.

Now, how do we let JDeveloper know where this project specific MDS repository is located?

First, change the file jdev.conf, you can find it in the map <Jdev home>/jdeveloper/jdev/bin. Add the following line:

AddVMOption -Dmyapp.home=Z:\mds

Next, change the file ant-sca-compile.xml, found in the map <Jdev home>/jdeveloper/bin. You have to add to <target name ="scac"> the following line:

<jvmarg value="-Dmyapp.home=Z:\mds"/>

Finally, change one more file, called adf-config.xml. It is located in your application directory in the subdirectory .adf/META-INF. Here, you will tell your application which metadata stores to use. Add the following lines:

<metadata-namespaces>
...
   <namespace path="/apps/myMDS" metadata-store-usage="mstore-usage_2"/>
...
</metadata-namespaces>

 <metadata-store-usages>
...
<metadata-store-usage id="mstore-usage_2">
    <metadata-store class-name="oracle.mds.persistence.stores.file.FileMetadataStore">
      <property value="${myapp.home}/myApplicationMDS" name="metadata-path"/>
      <property value="src" name="partition-name"/>    
   </metadata-store>
 </metadata-store-usage>
...
</metadata-store-usages>
  
Restart JDeveloper and the changes should take effect.

Geen opmerkingen:

Een reactie posten