def FindService(f, s, session, n): msg("Find proxy service: " + f + "/" + s) pxyConf = "ProxyServiceConfiguration." + n mbean = findService(pxyConf, 'com.bea.wli.sb.management.configuration.ProxyServiceConfigurationMBean') folderRef = Refs.makeParentRef(f + '/') serviceRef = Refs.makeProxyRef(folderRef, s) return serviceRef, mbean
def findProxyService(folder, serviceName, sessionName): '''Find a proxy service''' msg("Find proxy service: " + folder + "/" + serviceName, _LOG_LEVEL.INFO) pxyConf = "ProxyServiceConfiguration." + sessionName mbean = findService( pxyConf, 'com.bea.wli.sb.management.configuration.ProxyServiceConfigurationMBean' ) folderRef = Refs.makeParentRef(folder + '/') serviceRef = Refs.makeProxyRef(folderRef, serviceName) return serviceRef, mbean
def removeFolderFromOSBDomain(folder): '''remove a folder''' try: domainRuntime() sessionName = "RemoveFolderSession_" + str(System.currentTimeMillis()) msg("Trying to remove " + folder, _LOG_LEVEL.INFO) sessionManagementMBean = findService(SessionManagementMBean.NAME, SessionManagementMBean.TYPE) msg("SessionMBean started session", _LOG_LEVEL.INFO) sessionManagementMBean.createSession(sessionName) msg('Created session <' + sessionName + '>', _LOG_LEVEL.INFO) folderRef = Refs.makeParentRef(folder) alsbConfigurationMBean = findService( ALSBConfigurationMBean.NAME + "." + sessionName, ALSBConfigurationMBean.TYPE) if alsbConfigurationMBean.exists(folderRef): msg("#### removing OSB folder: " + folder, _LOG_LEVEL.INFO) alsbConfigurationMBean.delete(Collections.singleton(folderRef)) sessionManagementMBean.activateSession( sessionName, "Complete service removal with customization using wlst") else: msg("OSB folder <" + folder + "> does not exist", _LOG_LEVEL.WARNING) discardSession(sessionManagementMBean, sessionName) print except: msg("Error whilst removing project:" + sys.exc_info()[0], _LOG_LEVEL.ERROR) discardSession(sessionManagementMBean, sessionName)
def findWLService(serviceType, f, s, session, n): '''Find a service''' if (serviceType == _PROXY): srvConf = "ProxyServiceConfiguration." + n mbeanConfig = 'com.bea.wli.sb.management.configuration.ProxyServiceConfigurationMBean' elif (serviceType == _BUSINESS): srvConf = "BusinessServiceConfiguration." + n mbeanConfig = 'com.bea.wli.sb.management.configuration.BusinessServiceConfigurationMBean' else: raise 'Invalid Service Type ' + serviceType msg("Finding service: " + f + "/" + s, _LOG_LEVEL.INFO) mbean = findService(srvConf, mbeanConfig) folderRef = Refs.makeParentRef(f + '/') if (serviceType == _PROXY): serviceRef = Refs.makeProxyRef(folderRef, s) elif (serviceType == _BUSINESS): serviceRef = Refs.makeBusinessSvcRef(folderRef, s) else: raise 'Invalid Service Type ' + serviceType return serviceRef, mbean
serviceStatus = "" action = "" if e.getMax() > 1000: sessionName = String( "Troy-OSB-Disable-PS" + service + "-" + Long(System.currentTimeMillis()).toString()) sessionMBean = findService(SessionManagementMBean.NAME, SessionManagementMBean.TYPE) sessionMBean.createSession(sessionName) mbean = findService( String("ProxyServiceConfiguration.").concat( sessionName), 'com.bea.wli.sb.management.configuration.ProxyServiceConfigurationMBean' ) projectName = Refs.makeParentRef(project) proxyRef = Refs.makeProxyRef(projectName, service) #print "Disabling... " + service serviceStatus = str(mbean.isEnabled(proxyRef)) if mbean.isEnabled(proxyRef) == 1: mbean.disableService(proxyRef) refArray = [] refArray.append(Ref(typeID, projectName, service)) cmo.resetStatistics(refArray) #print " === Resetting statistics for this service." action = "Disable/reset Data" else: #print "Service already disabled." action = "Already disabled" sessionMBean.activateSession(sessionName, "Auto Disabled BS ")