J2C configuration scripts
The scripting library provides many script procedures to manage the Java 2 Connector (J2C) configurations. Use the scripts in this topic to create activation specifications, administrative objects, and connection factories, and to install resource adapters. We can run each script individually or combine many procedures to create custom automation scripts for the environment.
Each J2C management script procedure is located in the app_server_root/scriptLibraries/resources/J2C directory.
Use the following script procedures to configure J2C in the environment:
createJ2CActivationSpec
This script creates a J2C activation specification in the configuration. The script returns the configuration ID of the new J2C activation specification.
To run the script, specify the resource adapter, activation specification name, message listener type, and the JNDI name arguments. We can optionally specify attributes. The arguments and attributes are defined in the following tables:
Argument Description resourceAdapterID Configuration ID of the resource adapter of interest. activationSpecName Name to assign to the new activation specification. messageListenerType Message listener type. jndiName Specifies the JNDI name. attributes Optionally specifies additional attributes in a particular format:
- List format
- [["attr1", "value1"], ["attr2", "value2"]]
- String format
- "attr1=value1, attr2=value2"
Attributes Description Example authenticationAlias Authentication alias of the created J2C activation specification. ["authenticationAlias", "myAlias"]
description Description for the created J2C activation specification. ["description", "My description"]
destinationJndiName Destination JNDI name of the created J2C activation specification. ["destinationJndiName", "myDestinationJndi"]
Syntax
AdminJ2C.createJ2CActivationSpec(resourceAdapterID, activationSpecName, messageListenerType, jndiName, attributes)
Example usage
The following example script contains required attributes only:
AdminJ2C.createJ2CActivationSpec( "J2CTest(cells/myCell/nodes/myNode|resources.xml#J2CResourceAdapter_1184091767578))", "J2CASTest", "javax.jms.MessageListener2", "jndiAS")The following example script includes optional attributes in a string format:
AdminJ2C.createJ2CActivationSpec( "J2CTest(cells/AMYLIN4Cell01/nodes/AMYLIN4CellManager03|resources.xml#J2CResourceAdapter_1245171531343)", "J2CASTest","javax.jms.MessageListener", "jndi/as1", "description=this is my J2C ActivationSpecification, destinationJndiName=jndi/J2CAS, authenticationAlias=J2CASTest")The following example script includes optional attributes in a list format:
AdminJ2C.createJ2CActivationSpec( "myj2c(cells/AMYLIN4Cell01/nodes/AMYLIN4CellManager03|resources.xml#J2CResourceAdapter_1238380711218)", "J2CAC1", "javax.jms.MessageListener", "jndi/as", [['description','new j2cActivationSpec'], ['destinationJndiName','ds/jndi'], ['authenticationAlias','test']])
createJ2CAdminObject
This script creates a J2C administrative object in the configuration. The script returns the configuration ID of the new J2C administrative object.
To run the script, specify the resource adapter, activation specification name, JNDI name, and the administrative object interface name arguments. We can optionally specify attributes. The arguments and attributes are defined in the following tables:
Argument Description resourceAdapterID Configuration ID of the resource adapter of interest. activationSpecName Name to assign to the new activation specification. adminObjectInterface Name of the administrative object interface. jndiName Specifies the JNDI name. attributes Optionally specifies additional attributes in a particular format:
- List format
- [["attr1", "value1"], ["attr2", "value2"]]
- String format
- "attr1=value1, attr2=value2"
Attributes Description Example description Description for the created J2C administrative object. ["description", "My description"]
Syntax
AdminJ2C.createJ2CAdminObject(resourceAdapterID, activationSpecName, adminObjectInterface, jndiName, attributes)
Example usage
The following example script contains required attributes only:
AdminJ2C.createJ2CAdminObject( "J2CTest(cells/myCell/nodes/myNode|resources.xml#J2CResourceAdapter_1184091767578)", "J2CAOTest", "fvt.adapter.message.FVTMessageProvider2", "jndiAO")The following example script includes optional attributes in a string format:
AdminJ2C.createJ2CAdminObject( "J2CTest(cells/AMYLIN4Cell01/nodes/AMYLIN4CellManager03|resources.xml#J2CResourceAdapter_1245171531343)", "J2CAOTest", "fvt.adapter.message.FVTMessageProvider", "jndi/ao1", "description=this is my J2C AdminObject")The following example script includes optional attributes in a list format:
AdminJ2C.createJ2CAdminObject( "myj2c(cells/AMYLIN4Cell01/nodes/AMYLIN4CellManager03|resources.xml#J2CResourceAdapter_1238380711218)", "J2CAO1", "fvt.adapter.message.FVTMessageProvider", "jndi/ao", [['description','new j2cAdminObject']])
createJ2CConnectionFactory
This script creates a new J2C connection factory in the configuration. The script returns the configuration ID of the new J2C connection factory.
To run the script, specify the resource adapter, connection factory name, the connection factory interface, and the JNDI name arguments. We can optionally specify attributes. The arguments and attributes are defined in the following tables:
Argument Description resourceAdapterID Configuration ID of the resource adapter of interest. connFactoryName Name to assign to the new connection factory. connFactoryInterface Connection factory interface. jndiName Specifies the JNDI name. attributes Optionally specifies additional attributes in a particular format:
- List format
- [["attr1", "value1"], ["attr2", "value2"]]
- String format
- "attr1=value1, attr2=value2"
Attribute Description Example authDataAlias Component-managed authentication data alias of the created connection factory. ["authDataAlias", "myAuthDataAlias"]
description Description of the created J2C connection factory. ["description", "My description"]
Syntax
AdminJ2C.createJ2CConnectionFactory(resourceAdapterID, connFactoryName, connFactoryInterface, jndiName, attributes)
Example usage
AdminJ2C.createJ2CConnectionFactory( "J2CTest(cells/myCell/nodes/myNode|resources.xml#J2CResourceAdapter_11840917675 578)", "J2CCFTest", "javax.sql.DataSource2", "jndiCF")The following example script includes optional attributes in a string format:
AdminJ2C.createJ2CConnectionFactory( "J2CTest(cells/AMYLIN4Cell01/nodes/AMYLIN4CellManager03|resources.xml#J2CResourceAdapter_1245171531343)", "J2CCFTest", "javax.sql.DataSource", "jndi/j2ccftest", "description=this is my J2CConnectionFactory, authDataAlias=J2CTest")The following example script includes optional attributes in a list format:
AdminJ2C.createJ2CConnectionFactory( "myj2c(cells/AMYLIN4Cell01/nodes/AMYLIN4CellManager03|resources.xml#J2CResourceAdapter_1238380711218)", "J2CCFTest", "javax.sql.DataSource2", "jndi/cf", [['description', 'new j2ccf'], ['authDataAlias', 'test']])
installJ2CResourceAdapter
This script installs a J2C resource adapter in the configuration. The script returns the configuration ID of the new J2C resource adapter.
To run the script, specify the node name, resource adapter archive (RAR) file, and the resource adapter name arguments. We can optionally specify attributes. The arguments and attributes are defined in the following tables:
Argument Description nodeName Name of the node of interest. rarFile Fully qualified file path for the RAR file to install. resourceAdapterName Name to assign to the new resource adapter. attributes Optionally specifies additional attributes in a particular format:
- List format
- [["attr1", "value1"], ["attr2", "value2"]]
- String format
- "attr1=value1, attr2=value2"
Attributes Description rar.desc Description of the J2C resource adapter. rar.archivePath Name of the path where the file is extracted. If this path is not specified, then the archive is extracted to the $CONNECTOR_INSTALL_ ROOT directory. rar.classpath Additional classpath. rar.nativePath Native path. rar.threadPoolAlias Alias of the thread pool. rar.propertiesSet Property set of the J2C resource adapter. rar.DeleteSourceRar Whether to delete the source RAR file. rar.isolatedClassLoader Boolean value of the isolated class loader. rar.enableHASupport Boolean value of the enabled high availability. rar.HACapability Kind of high availability capability. Syntax
AdminJ2C.installJ2CResourceAdapter(nodeName, rarFile, resourceAdapterName, attributes)
Example usage
The following example script contains required attributes only:
AdminJ2C.installJ2CResourceAdapter("myNode", "C:\temp\jca15cmd.rar", "J2CTest")
AdminJ2C.installJ2CResourceAdapter("myNode", "/temp/jca15cmd.rar", "J2CTest")
The following example script includes optional attributes in a string format:
AdminJ2C.installJ2CResourceAdapter("AMYLIN4CellManager03", "c:\ears\jca15cmd.rar", "J2CTest", "rar.desc=this is J2C, rar.archivePath=c:\temp\test.rar, rar.classpath=c:\temp, rar.isolatedClassLoader=false, rar.enableHASupport=true, rar.DeleteSourceRar=false")
AdminJ2C.installJ2CResourceAdapter("AMYLIN4CellManager03", "/ears/jca15cmd.rar", "J2CTest", "rar.desc=this is J2C, rar.archivePath=/temp/test.rar, rar.classpath=/temp, rar.isolatedClassLoader=false, rar.enableHASupport=true, rar.DeleteSourceRar=false")
The following example script includes optional attributes in a list format:
AdminJ2C.installJ2CResourceAdapter("AMYLIN4Node09", "c:\ears\jca15cmd.rar", "j2ctest", [['rar.desc', 'this is J2C'], ['rar.archivePath', 'c:\temp\test.rar'], ['rar.classpath', 'c:\temp'], ['rar.nativePath', ''], ['rar.threadPoolAlias', 'test'], ['rar.isolatedClassLoader', 'false'], ['rar.enableHASupport', 'true'], ['rar.DeleteSourceRar', 'false']])
AdminJ2C.installJ2CResourceAdapter("AMYLIN4Node09", "/ears/jca15cmd.rar", "j2ctest", [['rar.desc', 'this is J2C'], ['rar.archivePath', '/temp/test.rar'], ['rar.classpath', '/temp'], ['rar.nativePath', ''], ['rar.threadPoolAlias', 'test'], ['rar.isolatedClassLoader', 'false'], ['rar.enableHASupport', 'true'], ['rar.DeleteSourceRar', 'false']])
Related tasks
Use the script library to automate the application serving environment
J2C query scripts JMS configuration scripts JMS query scripts JDBC configuration scripts JDBC query scripts