Archive

Archive for the ‘MDS’ Category

SOA 11G MDS Deployment through ANT Script

August 25, 2012 Leave a comment

Here I have given the ANT script to deploy shared resources to MDS.

This script can be used to deploy all shared resources to MDS or
to deploy particular folder to MDS.
 
1. My MDS Folder structure
 

MDSFolderStructure

MDSFolderStructure


 

2. Resource structure of MDS Deployment
 
The below is the way I have kept the resources to be deployed to MDS while executing the Ant script.
 
Inside the MDS folder , I have followed same folder structure as mentioned above.
 

MDSDeploymentStructure

MDSDeploymentStructure

 

3. build.properties
 

mds.application=mds-application
# mds.all key is for deployment
mds.all=MDS/apps
# specify the path for undeploying MDS resources
#example like (/apps/int/util/DVM or /apps/int/util/resources)
#mds.folderName=
# Specify the path to place MDS backup as jar
#mds.export.backup.dir=
#SOA 11G installation location
wls.bea.home=C:/Saba/soa11g/soa11.1.1.5/Middleware
oracle.home=${wls.bea.home}/Oracle_SOA1
java.passed.home=${wls.bea.home}/jdk160_24
wl.home=${wls.bea.home}/wlserver_10.3
#Admin Server Hostname and Port number
admin.server.host=localhost
admin.server.port=7011
# connection information for the managed server, used for soa-deployment
managed.server.host=localhost
managed.server.port=8011
# User and credentials for the servers
server.user=weblogic
server.password=welcome1

 
4. build.xml
 

<?xml version="1.0" encoding="UTF-8" ?>
<project name="mds-application" default="display" basedir=".">    
	<!-- build.properties -->
	<property file="build.properties" />
	<property name="deploy.dir" value="${basedir}/deploy" />
	<property name="mds.deploy.dir" value="${deploy.dir}" />
	<property name="mds.faultpolicies.dir" value="int/util/fault-policies" />
	<property name="mds.dvm.dir" value="int/util/DVM" />
	<property name="mds.xref.dir" value="int/util/XREF" />
	<property name="mds.schema.dir" value="int/util/resources" />
	<property name="mds.soaConstant.dir" value="int/util/constants" />
	
	<!-- This will display the targets available -->
	<target name="display">
		<input message="Please enter target to Run MDS" addproperty="target" defaultvalue="deployAll" validargs="deployAll,deployFaultPolicy,deployDVM,deployXREF,deployXSDWSDL,deploySOAConstant,undeployMDS,exportMDS" />
		<antcall target="${target}"/>
	</target>
	
	<target name="clean">
		<echo>remove and create local MDS temp</echo>
		<delete dir="${mds.deploy.dir}"/>	
	</target>
	<target name="init" depends="clean">
		<echo>remove and create local MDS temp</echo>
		<mkdir dir="${mds.deploy.dir}"/>	
	</target>
	
	<target name="buildAll" depends="init">
		<echo>+++++++ copy required files to ${mds.deploy.dir} +++++++++</echo>
		<copy todir="${mds.deploy.dir}" verbose="true" overwrite="true">
			<fileset dir="${basedir}/${mds.all}/" includes="**/*"/>
		</copy>               
		<echo>create zip from file MDS store</echo>
		<zip destfile="${mds.deploy.dir}/${mds.application}.jar" compress="false">         
			<fileset dir="${mds.deploy.dir}" includes="**/*" />
		</zip>
		<echo>create zip with MDS jar</echo>
		<zip destfile="${mds.deploy.dir}/${mds.application}.zip" compress="false">
			<fileset dir="${mds.deploy.dir}" includes="*.jar" />
		</zip>	
	</target>
	
	<target name="buildFaultPolicy" depends="init">
		<echo>+++++++ copy required files to ${mds.deploy.dir} +++++++++</echo>
		<copy todir="${mds.deploy.dir}" verbose="true" overwrite="true">
			<fileset dir="${basedir}/${mds.all}/" includes="**/${mds.faultpolicies.dir}/**"/>
		</copy>               
		<echo>create zip from file MDS store</echo>
		<zip destfile="${mds.deploy.dir}/${mds.application}.jar" compress="false">         
			<fileset dir="${mds.deploy.dir}" includes="**/*" />
		</zip>
		<echo>create zip with MDS jar</echo>
		<zip destfile="${mds.deploy.dir}/${mds.application}.zip" compress="false">
			<fileset dir="${mds.deploy.dir}" includes="*.jar" />
		</zip>	
	</target>
	
	<target name="buildDVM" depends="init">
		<echo>+++++++ copy required files to ${mds.deploy.dir} +++++++++</echo>
		<copy todir="${mds.deploy.dir}" verbose="true" overwrite="true">
			<fileset dir="${basedir}/${mds.all}/" includes="**/${mds.dvm.dir}/**"/>
		</copy>               
		<echo>create zip from file MDS store</echo>
		<zip destfile="${mds.deploy.dir}/${mds.application}.jar" compress="false">         
			<fileset dir="${mds.deploy.dir}" includes="**/*" />
		</zip>
		<echo>create zip with MDS jar</echo>
		<zip destfile="${mds.deploy.dir}/${mds.application}.zip" compress="false">
			<fileset dir="${mds.deploy.dir}" includes="*.jar" />
		</zip>	
	</target>
	
	<target name="buildXREF" depends="init">
		<echo>+++++++ copy required files to ${mds.deploy.dir} +++++++++</echo>
		<copy todir="${mds.deploy.dir}" verbose="true" overwrite="true">
			<fileset dir="${basedir}/${mds.all}/" includes="**/${mds.xref.dir}/**"/>
		</copy>               
		<echo>create zip from file MDS store</echo>
		<zip destfile="${mds.deploy.dir}/${mds.application}.jar" compress="false">         
			<fileset dir="${mds.deploy.dir}" includes="**/*" />
		</zip>
		<echo>create zip with MDS jar</echo>
		<zip destfile="${mds.deploy.dir}/${mds.application}.zip" compress="false">
			<fileset dir="${mds.deploy.dir}" includes="*.jar" />
		</zip>	
	</target>
	
	<target name="buildXSDWsdl" depends="init">
		<echo>+++++++ copy required files to ${mds.deploy.dir} +++++++++</echo>
		<copy todir="${mds.deploy.dir}" verbose="true" overwrite="true">
		     <fileset dir="${basedir}/${mds.all}/" includes="**/${mds.schema.dir}/**"/>
		</copy>               
		<echo>create zip from file MDS store</echo>
		<zip destfile="${mds.deploy.dir}/${mds.application}.jar" compress="false">         
		    <fileset dir="${mds.deploy.dir}" includes="**/*" />
		</zip>
		<echo>create zip with MDS jar</echo>
		<zip destfile="${mds.deploy.dir}/${mds.application}.zip" compress="false">
			<fileset dir="${mds.deploy.dir}" includes="*.jar" />
		</zip>	
	</target>
	
	<target name="buildSOAConstant" depends="init">
		<echo>copy required files to ${mds.deploy.dir}</echo>
		<copy todir="${mds.deploy.dir}" verbose="true" overwrite="true">
			<fileset dir="${basedir}/${mds.all}/" includes="**/${mds.soaConstant.dir}/**"/>
		</copy>               
		<echo>create zip from file MDS store</echo>
		<zip destfile="${mds.deploy.dir}/${mds.application}.jar" compress="false">         
			<fileset dir="${mds.deploy.dir}" includes="**/*" />
		</zip>
		<echo>create zip with MDS jar</echo>
		<zip destfile="${mds.deploy.dir}/${mds.application}.zip" compress="false">
			<fileset dir="${mds.deploy.dir}" includes="*.jar" />
		</zip>	
	</target>
	
	<target name="genericDeployer">
		<echo>deploy MDS application ${mds.application}</echo>
		<echo>deploy on	http://${managed.server.host}:${managed.server.port}/soa-infra/deployer	with user ${server.user}</echo>
		<echo>deploy sarFile ${mds.deploy.dir}\${mds.application}.zip</echo>
		<ant antfile="${oracle.home}/bin/ant-sca-deploy.xml" inheritAll="false"	target="deploy">
			<property name="wl_home" value="${wl.home}" />
			<property name="oracle.home" value="${oracle.home}" />
			<property name="serverURL" value="http://${managed.server.host}:${managed.server.port}/soa-infra/deployer"/>
			<property name="user" value="${server.user}" />
			<property name="password" value="${server.password}" />
			<property name="overwrite" value="true" />
			<property name="forceDefault" value="false" />
			<property name="sarLocation" value="${mds.deploy.dir}/${mds.application}.zip"/>
		</ant>
	</target>
	
	<!-- This target is to deploy all required sources to MDS -->
	<target name="deployAll" depends="buildAll">
		<antcall target="genericDeployer"/>
	</target>
	
	<!-- This target is to deploy fault-policies files to MDS -->
	<target name="deployFaultPolicy" depends="buildFaultPolicy">
		<antcall target="genericDeployer"/>
	</target>
	
	<!-- This target is to deploy DVM files to MDS -->
	<target name="deployDVM" depends="buildDVM">
		<antcall target="genericDeployer"/>
	</target>
	
	<!-- This target is to deploy XREF files to MDS -->
	<target name="deployXREF" depends="buildXREF">
		<antcall target="genericDeployer"/>
	</target>
	
	<!-- This target is to deploy Schemas and WSDLs files to MDS -->
	<target name="deployXSDWSDL" depends="buildXSDWsdl">
		<antcall target="genericDeployer"/>
	</target>
	
	<!-- This target is to deploy SOA Constants file to MDS -->
	<target name="deploySOAConstant" depends="buildSOAConstant">
		<antcall target="genericDeployer"/>
	</target>
	
	<target name="undeployMDS">
		<echo>undeploy MDS application ${mds.application}</echo>
		<ant antfile="${oracle.home}/bin/ant-sca-deploy.xml" inheritAll="false"	target="removeSharedData">
			<property name="wl_home" value="${wl.home}" />
			<property name="oracle.home" value="${oracle.home}" />
			<property name="serverURL" value="http://${managed.server.host}:${managed.server.port}/soa-infra/deployer"/>
			<property name="user" value="${server.user}" />
			<property name="password" value="${server.password}" />
			<property name="folderName" value="${mds.folderName}" />
		</ant>
	</target>
	<target name="exportMDS">
	    <tstamp>
	      <format property="start.timestamp" pattern="yyyy-MM-dd_HHmm" />
	    </tstamp>
	    <echo>
		================================================================================
			EXPORT MDS: ${local.mds.export}/MDSbackup.${start.timestamp}.jar
		================================================================================
	    </echo>
	    <ant antfile="${oracle.home}/bin/ant-sca-deploy.xml" inheritAll="false" target="exportSharedData">
	      <property name="serverURL"        value="${serverURL}"/>
	      <property name="jarFile"          value="${mds.export.backup.dir}/MDSbackup.${start.timestamp}.jar"/>
	      <property name="pattern"          value="**"/>
	      <property name="user"             value="${server.user}"/>
	      <property name="password"         value="${server.password}"/>
	    </ant>
	  </target>
</project>
Advertisements

Import, Export, Delete Files from MDS

August 16, 2012 Leave a comment

Oracle SOA 11G MDS used as a shared repository for managing and reusing shared resources like WSDL, XSD, DVM, XREF, FAULT-POLICIES and CONSTANTS across applications.

Here below are the WLST commands to import , export and delete contents from MDS

1. Execute wlst.cmd :


cd ${ORACLE_HOME}/oracle_common/common/bin

Execute wlst.sh file:
----------------------
wlst.sh

 
2. Connect to WL Server :


connect('weblogic','welcome1','t3://localhost:7011')

 
3. Import Contents to MDS :


Import all files and folder :
-----------------------------
importMetadata(application='soa-infra',server='soa_server1',
               fromLocation='C:/Saba/soa11g/mds/',docs='/apps/**')

Import files under specified directory to MDS:
----------------------------------------------
importMetadata(application='soa-infra',server='soa_server1',
           fromLocation='C:/Saba/soa11g/mds/',docs='/apps/util/DVM/**')
importMetadata(application='soa-infra',server='soa_server1',
           fromLocation='C:/Saba/soa11g/mds/',docs='/apps/util/XREF/**')

Import specific file to MDS:
---------------------------------
importMetadata(application='soa-infra',server='soa_server1',
               fromLocation='C:/Saba/soa11g/mds/',
               docs='/apps/util/DVM/COUNTRYCODE.dvm')

 

4. Export Contents from MDS :


Export all files and folders from MDS:
--------------------------------------
exportMetadata(application='soa-infra', server='soa_server1',
               toLocation='C:/Saba/soa11g/mds/', docs='/**')

Export all files and folders inside "/apps" folder :
----------------------------------------------------
exportMetadata(application='soa-infra', server='soa_server1',
              toLocation='C:/Saba/soa11g/mds/', docs='/apps/**')

Export specific folder :
-----------------------
exportMetadata(application='soa-infra', server='soa_server1',
               toLocation='C:/Saba/soa11g/mds/', 
               docs='/apps/util/fault-policies/**')
exportMetadata(application='soa-infra', server='soa_server1',
           toLocation='C:/Saba/soa11g/mds/', docs='/apps/util/DVM/**')
exportMetadata(application='soa-infra', server='soa_server1',
           toLocation='C:/Saba/soa11g/mds/', docs='/apps/util/XREF/**')

Export specific file:
---------------------
exportMetadata(application='soa-infra', server='soa_server1',
               toLocation='C:/Saba/soa11g/mds/',
               docs='/apps/util/DVM/COUNTRYCODE.dvm')

 
5. Delete Contents from MDS :


Delete all files:
-----------------------------
deleteMetadata(application='soa-infra',server='soa_server1',docs='/apps/')

Delete files under specific folder:
-----------------------------------
deleteMetadata(application='soa-infra',server='soa_server1',
               docs='/apps/util/DVM')

Delete specific file:
---------------------
deleteMetadata(application='soa-infra',server='soa_server1',
               docs='/apps/util/DVM/COUNTRYCODE.dvm')

 
5. Delete Folder from MDS :


1. Go to ${ORACLE_HOME}/Oracle_SOA1/common/bin
2. Execute wlst.sh file.
3. wls:/offline>connect('weblogic','welcome1','t3://localhost:7011')
4. wls:/SOA-domain/serverConfig> sca_removeSharedData('http://localhost:8011',
                                    'DVM')
Example: sca_removeSharedData('http://<ManagerServerHost>:<ManagedServerPort>',
                              'DVM')

Just mention the any folder name inside root folder "/apps", that folder 
and files inside that folder will be deleted.

Categories: MDS Tags: , , , ,