Monday, July 19, 2010

Configuring MDS in AIA 3.0

AIA 3.0 or AIA 11gR1(rechristened name) brings along with it a lot of changes in comparison to earlier AIA 2.x releases, the most prominent being the way to access AIA artifacts. I have worked on AIA FP 2.x and accessing artificats like WSDLs , XSDs inside the code from Enterprise Object Library or Enterprise Business Service Library was done using http urls eg: http://hostname:port/AIAComponents/EnterpriseObjectLibrary/core/EBO/Invoice/V2/InvoiceEBO.xsd. When migrating between instances i.e Dev to QA to Prod we had to make sure the deployment scripts changed the partner link bindings in bpel.xml to change the http urls.


Now when I started development on AIA 3.0 the first thing I wondered was how to access these artifacts inside code because the AIAComponents folder was no longer hosted on http. I hadn't explored the new concept of MDS(Metadata Service) yet and hence thought of using a workaround. I created a war file out of the AIAComponents folder jar -vcf AIAMetaData.war $AIA_HOME/AIAMetaData/AIAComponents
I then deployed this war file into my weblogic server as an application and Enabled Index Directory. Now I was able to access the entire AIAComponents folder from URL again. 


However I started to think about the maintenance aspect of the above approach. If I had to modify any artifact or add a new one later then I had to place the file in relevant location under AIAComponents, regenerate the war and redeploy it to WLS. Secondly during code migration between instances I had to repeat this task on each server and also make sure my deployment scripts ensure proper URL replacement. Definitely doesn't sound like an Oracle recommended approach which made me search for better alternatives and I then stumbled across the concept of centralised repository called MDS. The MDS is metadata store which stores all AIA artifacts under AIAComponents folder and these are accessed inside code using oramds protocol.


In this post I would like to cover the details of how to setup Jdeveloper to create SOA-MDS connection, how to go about accessing the artifcats inside code and how to update/add artifacts into MDS.


Setup in Jdeveloper :


1. Create a database connection to connect to the repository with either DEV_MDS or equivalent user (prefix_MDS).
2. Then from resource palette create a new SOA-MDS connection. Make sure it uses the DB connection in step1 and also the partition is soa_infra.
3. Once completed you should be able to browse and choose the required AIAComponent files from MDS. These will be shown under /Apps/MetaData.
4. Next you have to update the adf-config.xml file in your Jdeveloper, application home (directory where .jws file exists). This will be used at design time to access files from MDS using oramds protocol. This is located in directory named .adf/META-INF.
    
  Make sure you add the below sections:
      <metadata-namespaces>
          <namespace metadata-store-usage="mstore-usage_2" path="/apps" />
      </metadata-namespaces>

     <metadata-store-usage id="mstore-usage_2">
-        <metadata-store class-name="oracle.mds.persistence.stores.db.DBMetadataStore">
         <property value="DEV_MDS" name="jdbc-userid" />
         <property value="welcome1" name="jdbc-password" />
         <property value="jdbc:oracle:thin:@hostname:port:sid" name="jdbc-url" />
         <property value="soa-infra" name="partition-name" />
     </metadata-store>
     </metadata-store-usage>

Thats it! You can now start accessing the artifacts like WSDLs, XSDs etc using oramds. Eg: oramds:/apps/AIAMetaData/AIAComponents/EnterpriseObjectLibrary/core/EBO/Invoice/V2/InvoiceEBO.xsd

How to update/add artifacts into MDS:

These have to be repeated every time new/modified files are to be loaded to MDS.
1. source AIA_HOME/aia_instances/instance_name/bin/aiaenv.sh

2. Modify the AIA_HOME/aia_instances/instance_name/config/UpdateMetaDataDP.xml

<?xml version="1.0" standalone="yes"?>
<!-- Do not modify the contents of this file manually -->
<DeploymentPlan component="Metadata" version="3.0">
        <Configurations>
                <UpdateMetadata wlserver="fp" >
                        <fileset dir="${AIA_HOME}/AIAMetaData">
                             <include name="AIAComponents/EnterpriseObjectLibrary/Core/Custom/EBO/Invoice/V2/*"/>
                        </fileset>
                </UpdateMetadata>
        </Configurations>
</DeploymentPlan>

NOTE:
 The path in "include" tag has to be relative to what is given in "fileset" tag. 

3.Run the below command to load the files to MDS from AIA_HOME/Infrastructure/Install/scripts

ant -f $AIA_HOME/Infrastructure/Install/AID/AIAInstallDriver.xml  -DDeploymentPlan=AIA_HOME/aia_instances/instance_name/config/UpdateMetaDataDP.xml -DPropertiesFile=AIA_HOME/aia_instances/instance_name/config/AIAInstallProperties.xml

1 comment:

  1. Very nice explanation for the people who worked on 2.x and planning to move 3.0.

    -Venkat

    ReplyDelete