1 Reply Latest reply: Apr 30, 2013 7:56 AM by MichaelBaygeldin RSS

    Check if MDS repository already registered

    MichaelBaygeldin
      Hello Experts!
      I have three similar questions.
      How can I check in my WLST script if a specified MDS repository already registered?
      Also how can I check in my WLST script if a specified MDS repository partition already exists?
      Also How can I check in my WLST script if a specified application already deployed?
        • 1. Re: Check if MDS repository already registered
          MichaelBaygeldin
          I solved this problem.
          How can I check in my WLST script if a specified MDS repository already registered?
          def MDSRepositoryExists(MDSRepositoryName):
               try:
                    domainRuntime()
                    mdsBean = ObjectName('oracle.mds.lcm:name=MDSDomainRuntime,type=MDSDomainRuntime')
                    repositories = mbs.invoke(mdsBean, 'listRepositories',None,None)
                    for repository in repositories:
                         mdsObject = ObjectName(repository)
                         Name = mbs.getAttribute(mdsObject, 'Name')
                         if MDSRepositoryName == Name:
                              return true
                    return false
               except:
                    print '***** CANNOT IDENTIFY IF SPECIFIED MDS REPOSITORY EXISTS !!! *****'
                    print "[Deployment Script]: Unexpected error:", sys.exc_info()[0]
                    sys.exit()
          Also how can I check in my WLST script if a specified MDS repository partition already exists?
          def MDSPartitionExists(MDSPartitionName):
               try:
                    domainRuntime()
                    mdsBean = ObjectName('oracle.mds.lcm:name=MDSDomainRuntime,type=MDSDomainRuntime')
                    params = ['someRepositoryName']
                    sign = ['java.lang.String']
                    partitions = mbs.invoke(mdsBean, 'listPartitions',params,sign)
                    for partition in partitions:               
                         if partition == MDSPartitionName:
                              return true
                    return false
               except:
                    print '***** CANNOT IDENTIFY IF SPECIFIED MDS PARTITION EXISTS !!! *****'
                    print "[Deployment Script]: Unexpected error:", sys.exc_info()[0]
                    sys.exit()
          Also How can I check in my WLST script if a specified application already deployed?
          def ApplicationExists(ApplicationName):
               try:
                    domainConfig()
                    cd('/')
                    apps=cmo.getAppDeployments()
                    for app in apps:               
                         if app.getName() == ApplicationName:
                              return true
                    return false
               except:
                    print '***** CANNOT IDENTIFY IF SPECIFIED APPLICATION EXISTS !!! *****'
                    print "[Deployment Script]: Unexpected error:", sys.exc_info()[0]
                    sys.exit()