Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python ibm websphere
#1
Hello i have a problem with understanding question for job interview
i created with jython wsadmin websphere resources
code is on the bottom of the question.

Now i have to do this
"It all comes down to writing a Python script that will round out this troublesome piece of work that has already been done.

So the idea is to type in a private script that will be able to define a profile based on the input.
Input data was defined in the configuration files described in the assignment.

In translation, the idea wrote a script that executed command commands (which were so far manually released) on the data files in the configuration.
So what you were doing now should be rewritten into a script and configured so that the parameters of each resource are defined in that configuration.
The script would read and configure the files and take concrete values ​​from them that would then invoke the wsadmin commands to be created to resurrect on the server.
The same configuration files were also not used by IBM by this standard, but also produced created files that fit the relevant data."


question is what em i really supossed to do?
what langugages except python should i use....
i dont understand task...



JYTHON

RUN
C:\Program Files\IBM\WebSphere\AppServer\bin>wsadmin -lang jython

1.PROVIDER

AdminTask.createJDBCProvider('[-scope "Cell=DESKTOP-FV4HTU3Node02Cell, Node=DESKTOP-FV4HTU3Node01, Server=server2" -databaseType DB2 -providerType "DB2 Universal JDBC Driver Provider" -implementationType "XA data source" -name Provider3 -description no -implementationClassName className -classpath [${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc.jar ] ]')
u'Provider3(cells/DESKTOP-FV4HTU3Node02Cell/nodes/DESKTOP-FV4HTU3Node01/servers/server2|resources.xml#JDBCProvider_1585318340069)'

Create a new JDBC provider that is used to connect with a relational database for data access.

*Scope string (scope): Cell=DESKTOP-FV4HTU3Node02Cell, Node=DESKTOP-FV4HTU3Node01, Server=server2
*Type of database (databaseType): DB2
*Type of JDBC provider (providerType): DB2 Universal JDBC Driver Provider
*Type of implementation (implementationType): XA data source
The JDBC provider name (name): Provider3
The JDBC provider description (description): no
The class name of the implementation of the JDBC provider. (implementationClassName): className
The classpath for the JDBC provider. (classpath): ${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc.jar
The native path for the JDBC provider. (nativePath):
Isolate this JDBC Provider. (isolated): [false]

Create a new JDBC provider

F (Finish)
C (Cancel)


2.ALIAS
wsadmin>print AdminConfig.required('JAASAuthData')
Attribute Type
alias String
userId String
password String
wsadmin>alias = ['alias', 'component-managedauth.alias']
wsadmin>userid = ['userId', '[email protected]']
wsadmin>password = ['password', 'secret']
wsadmin>jassAttrs=[alias,userid,password]
wsadmin>print jassAttrs
[['alias', 'component-managedauth.alias'], ['userId', '[email protected]'], ['password', 'secret']]
wsadmin>security = AdminConfig.getid('/Cell:DESKTOP-FV4HTU3Node02Cell/Security:/')
wsadmin>print security
(cells/DESKTOP-FV4HTU3Node02Cell|security.xml#Security_1)
print AdminConfig.create('JAASAuthData', security, jassAttrs)
(cells/DESKTOP-FV4HTU3Node02Cell|security.xml#JAASAuthData_1585763896796)


2.DATASOURCE

AdminJDBC.createDataSourceAtScope("Cell=DESKTOP-FV4HTU3Node02Cell,Node=DESKTOP-FV4HTU3Node01,Server=server2", "Provider6", "newds2", "jdbc/test_ds", "com.ibm.websphere.rsadapter.DB2UniversalDataStoreHelper", "db1", [['category', 'myCategory'],['componentManagedAuthenticationAlias','component-managedauth.alias'], ['containerManagedPersistence', 'true'], ['description', 'My description'], ['xaRecoveryAuthAlias', 'component-managedauth.alias']] , [['serverName', 'localhost'], ['driverType', 4], ['portNumber', 50000]])

3.NEW CUSTOM PROPERTY

wsadmin>dataSource = AdminConfig.getid('/DataSource:newds2/')
wsadmin>resourcePropertySet = AdminConfig.showAttribute(dataSource,'propertySet')
wsadmin>property = ['name','useJDBC4ColumnNameAndLabelSemantics']
wsadmin>value = ['value',2]
wsadmin>type = ['type','java.lang.Integer']
wsadmin>required = ['required','false']
wsadmin>resourceProperty = [property,value,type,required]
wsadmin>AdminConfig.create('J2EEResourceProperty',resourcePropertySet,resourceProperty)
u'useJDBC4ColumnNameAndLabelSemantics(cells/DESKTOP-FV4HTU3Node02Cell/nodes/DESKTOP-FV4HTU3Node01/servers/server2|resources.xml#J2EEResourceProperty_1585830176020)'
wsadmin>AdminConfig.save()


4. EXEC PYTHON SCRIPT
exit
C:\Program Files\IBM\WebSphere\AppServer\bin>
wsadmin.bat -lang jython -profile C:\Users\ja\Desktop\pyscript\isolation.py

4.1 isolation.py

datasource = AdminConfig.getid('/DataSource:MyDataSource/')
propertySet = AdminConfig.showAttribute(datasource,'propertySet')
propertyList = AdminConfig.list('J2EEResourceProperty', propertySet).splitlines()

for property in propertyList:
if ("webSphereDefaultIsolationLevel' == AdminConfig.showAttribute(property, 'Name')"):
AdminConfig.modify(property, '[[Value "2"]]')
print ('Modified DataSource')

AdminConfig.save()


5. WMQConnectionFactory

AdminTask.createWMQConnectionFactory("DESKTOP-FV4HTU3Node01(cells/DESKTOP-FV4HTU3Node02Cell/nodes/DESKTOP-FV4HTU3Node01|node.xml#Node_1)", ["-name TEST_QCF -jndiName 'jms/qcf/test_qcf' -type QCF -description 'aa' -qmgrName TEST.QUEUE.MANAGER -containerAuthAlias component-managedauth.alias -wmqTransportType 'CLIENT' -qmgrHostname localhost -qmgrPortNumber 1414 -qmgrSvrconnChannel TEST.CHANNEL"])

6. QUEUE
>AdminJMS.listJMSProviders()
dd = AdminConfig.getid("/Cell:DESKTOP-FV4HTU3Node02Cell/JMSProvider:WebSphere MQ JMS Provider/")

wsadmin>print AdminConfig.required('WASQueue')
Attribute Type
name String
jndiName String
wsadmin>name = ['name', 'TEST_QUEUE']
wsadmin>jndi = ['jndiName', 'jms/queue/test_queue']
wsadmin>wqAttrs = [name, jndi]
wsadmin>print AdminConfig.create('WASQueue', dd, wqAttrs)
TEST_QUEUE(cells/DESKTOP-FV4HTU3Node02Cell|resources.xml#WASQueue_1586090214976)

7 Shared library

n1 = AdminConfig.getid('/Cell:DESKTOP-FV4HTU3Node02Cell/Node:DESKTOP-FV4HTU3Node01/')

library = AdminConfig.create('Library', n1, [['name', 'TEST_SL'], ['classPath', 'C:\Users\ja\Desktop\jython_installer-2.5.2']])

8.App CREATE
AdminApp.install('C:\Program Files\IBM\WebSphere\AppServer\installableApps\PerfServletApp.ear', ['-appname', 'PerfServletApp', '-MapSharedLibForMod [[PerfServletApp META-INF/application.xml TEST_SL]]'])
AdminApp.edit("PerfServletApp", ['-CtxRootForWebMod', [[".*",".*","/test"]]])


manageprofiles.bat -backupProfile -profileName profil2 -backupFile c:\backup\profil2.zip
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020