Example: Configuring a shared library for an application
You can use the AdminApp object to set certain configurations in the application. This example uses the AdminConfig object to configure a shared library for an application.
- Identify the shared library and assign it to the library variable.
- To create a new shared library, perform the following steps:
- Idenitfy the node and assign it to a variable, for example:
Using Jacl:
set node [$AdminConfig getid /Cell:mycell/Node:mynode/]
Using Jython:
node = AdminConfig.getid('/Cell:mycell/Node:mynode/') print nodeExample output:
mynode(cells/mycell/nodes/mynode:node.xml#Node_1)
- Create the shared library in the node, for example:
Using Jacl:
set library [$AdminConfig create Library $node {{name mySharedLibrary} {classPath c:/mySharedLibraryClasspath}}]
Using Jython:
library = AdminConfig.create('Library', node, [['name', 'mySharedLibrary'], ['classPath', 'c:/mySharedLibraryClasspath']]) print libraryExample output:
MySharedLibrary(cells/mycell/nodes/mynode:libraries.xml#Library_1)This example creates a new shared library in the node scope. You can modify it to use the cell or server scope.
- To use an existing shared library, issue the following command:
Using Jacl:
set library [$AdminConfig getid /Library:mySharedLibrary/]
Using Jython:
library = AdminConfig.getid('/Library:mySharedLibrary/') print libraryExample output:
MySharedLibrary(cells/mycell/nodes/mynode:libraries.xml#Library_1)
- Identify the deployment configuration object for the application and assign it to the deployment variable:
Using Jacl:
set deployment [$AdminConfig getid /Deployment:myApp/]
Using Jython:
deployment = AdminConfig.getid('/Deployment:myApp/') print deploymentExample output:
myApp(cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#Deployment_1)
- Retrieve the application deployment and assign it to the appDeploy variable:
Using Jacl:
set appDeploy [$AdminConfig showAttribute $deployment deployedObject]
Using Jython:
appDeploy = AdminConfig.showAttribute(deployment, 'deployedObject') print appDeployExample output:
(cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#ApplicationDeployment_1)
- Identify the class loader in the application deployment and assign it to the classLoader variable:
Using Jacl:
set classLoader [$AdminConfig showAttribute $appDeploy classloader]
Using Jython:
classLoader = AdminConfig.showAttribute(appDeploy, 'classloader') print classLoaderExample output:
(cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#Classloader_1)
- Associate the shared library in the application through the class loader:
Using Jacl:
$AdminConfig create LibraryRef $classLoader {{libraryName MyshareLibrary} {sharedClassloader true}}
Using Jython:
print AdminConfig.create('LibraryRef', classLoader, [['libraryName', 'MyshareLibrary'], ['sharedClassloader', 'true']])Example output:
(cells/mycell/applications/myApp.ear/deployments/myApp:deployment.xml#LibraryRef_1)
- Save the changes:
Using Jacl:
$AdminConfig save
Using Jython:
AdminConfig.save()