def getWebService(serviceName): """ Returns the server with the specified name. @type serviceName: String @param serviceName: the name of a web service @rtype: javax.management.MBeanServerInvocationHandler @return: a service """ currentPath = wl.pwd() wl.serverConfig() wl.cd('/AppDeployments') servicesList = wl.cmo.getAppDeployments() for service in servicesList: actualName = service.getName() if actualName==serviceName: wl.cd(currentPath) return service wl.cd(currentPath) raise NameError('The service \'' + serviceName + '\' doesn\'t exist!')
def getServer(serverName): """ Returns the server with the specified name. @type serverName: String @param serverName: the name of a managed server @rtype: javax.management.MBeanServerInvocationHandler @return: a managed server """ previousPath = wl.pwd() wl.serverConfig() wl.cd('/Servers') serverList = wl.cmo.getServers() for server in serverList: actualName = server.getName() if actualName==serverName: wl.cd(previousPath) return server wl.cd(previousPath) raise NameError('The server \'' + serverName + '\' doesn\'t exist!')
def importSecuritySettings(): global domain try: wl.serverConfig() # wl.setEditMBeanServerEnabled(1) # wl.edit() # wl.startEdit() wl.cd("SecurityConfiguration/" + domain.strip() + "/DefaultRealm/myrealm/Authorizers/XACMLAuthorizer") # wl.serverRuntime() # wl.cmo.exportData('XACML','exportPolicies.xml',wl.Properties()) wl.cmo.importData("XACML", "OSBSecurityExportESBDEV/XACMLAuthorizer.dat", wl.Properties()) # wl.save() # wl.activate(block="true") except: print "Error while trying to save and/or activate!!!" dumpStack()
import wl print "Connecting to the server ..." wl.connect('weblogic','welcome1','t3://localhost:7021') wl.serverConfig() #wl.serverRuntime() #wl.edit() #wl.startEdit() #wl.cd('/') currentDomainName=wl.cmo.getName() print "currentDomainName = " + currentDomainName currentDir = wl.pwd() print "we are in directory = " + currentDir # wl.cd("/servicebus/serverConfig/SecurityConfiguration/servicebus/DefaultRealm/myrealm/Authorizers/XACMLAuthorizer") wl.cd("SecurityConfiguration/servicebus/DefaultRealm/myrealm/Authorizers/XACMLAuthorizer") #wl.serverRuntime() wl.cmo.exportData('XACML','exportPolicies.xml',wl.Properties()) #wl.cd('serverConfig:/SecurityConfiguration/' + currentDomainName + '/Realms/myrealm/CredentialMappers/DefaultCredentialMapper') #prop=wl.Properties() # wl.cmo.exportData('DefaultCreds','credentialmapper_properties.txt',prop) #wl.cmo.exportData('XACML','exportPolicies.xml',Properties()) # wl.save() #wl.activate(block="true") #wl.disconnect() print "script returns SUCCESS"