Create a shared library for an application

 

Using Jacl

### Create shared library entry

set xnode [$AdminConfig getid /Cell:cell/Node:node/]

set library [$AdminConfig create Library $xnode {{name SharedLibrary} \
                                                 {classPath /path/to/library}}]


### Use an existing shared library...

set library [$AdminConfig getid /Library:SharedLibrary/]



### Identify the deployment configuration object for the application 
### and assign it to the deployment variable...

set deployment [$AdminConfig getid /Deployment:myApp/]



### Retrieve the application deployment and assign it to the appDeploy variable...

set appDeploy [$AdminConfig showAttribute $deployment deployedObject]



### Identify the class loader in the application deployment 
### and assign it to the classLoader variable...

set classLoader [$AdminConfig showAttribute $appDeploy classloader]


### Associate the shared library in the application through the class loader...

$AdminConfig create LibraryRef $classLoader {{libraryName MyshareLibrary} \
                                             {sharedClassloader true}}

$AdminConfig save

 

Using Jython

node = AdminConfig.getid('/Cell:cell/Node:node/')
print node


library = AdminConfig.create('Library', node, [['name', 'SharedLibrary'], 
                                               ['classPath', '/path/to/library']])
print library


### Use an existing shared library...
library = AdminConfig.getid('/Library:SharedLibrary/')
print library

MySharedLibrary(cells/cell/nodes/node:libraries.xml#Library_1)


### Identify the deployment configuration object for the application 
### and assign it to the deployment variable...

deployment = AdminConfig.getid('/Deployment:myApp/')
print deployment

### Retrieve the application deployment and assign it to the appDeploy variable...

appDeploy = AdminConfig.showAttribute(deployment, 'deployedObject')
print appDeploy


### Identify the class loader in the application deployment 
### and assign it to the classLoader variable...
classLoader = AdminConfig.showAttribute(appDeploy, 'classloader')
print classLoader


### Associate the shared library in the application through the class loader...

print AdminConfig.create('LibraryRef', classLoader, [['libraryName', 'MyshareLibrary'],  ['sharedClassloader', 'true']])

AdminConfig.save()