Resource configuration scripts
Overview
The scripting library provides multiple script procedures to automate the appserver configurations. Use the mail, URL, and resource environment configuration scripts to create and configure resources in the environment.
We can run each script individually or combine procedures to create custom automation scripts.
The mail, URL, and resource management script procedures are located in the WAS_HOME/scriptLibraries/resources/V70 directory.
Configure the mail settings
Configure the resource environment settings
- createCompleteResourceEnvProvider
- createResourceEnvEntries
- createResourceEnvProvider
- createResourceEnvProviderRef
Configure the URL provider settings
Configure additional JEE resources
- createJAASAuthenticationAlias
- createLibraryRef
- createSharedLibrary
- createScheduler
- createWorkManager
- help
createCompleteMailProvider
This script configures additional configuration attributes for the mail provider.
A mail provider encapsulates a collection of protocol providers like SMTP, IMAP and POP3, while mail sessions authenticate users and controls user access to messaging systems. Set the own mail providers and sessions to customize how Java Mail is handled. To run the script, specify the following arguments:
createCompleteMailProvider arguments
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. mailProviderName Mail provider that the appserver uses for this mail session. propName Name of the custom property. propValue Value of the custom property. protocolName Name of the protocol provider. The application server contains protocol providers for SMTP, IMAP and POP3. className Implementation class name of the protocol provider. mailSessionName Administrative name of the Java Mail session object. JNDIName JNDI name for the resource, including any naming subcontexts. This name provides the link between the platform binding information for resources defined in the client application deployment descriptor and the actual resources bound into JNDI by the platform. mailStoreHost Server that is accessed when receiving the mail. This setting, combined with the mail store user ID and password, represents a valid mail account. For example, if the mail account is john_william@my.company.com, then the mail store host is my.company.com. mailStoreUser User ID for the given mail account. For example, if the mail account is john_william@my.company.com then the user is john_william. mailStorePassword for the given mail account . For example, if the mail account is john_william@my.company.com then enter the password for ID john_william.
Syntax
AdminResources.createCompleteMailProvider(nodeName, serverName, mailProviderName, propName, propValue, protocolName, className, mailSessionName, JNDIName, mailStoreHost, mailStoreUser, mailStorePassword)Example usage
AdminResources.createCompleteMailProvider("myNode", "myServer", "myMailProvider", "myProp", "myPropValue", "myMailProtocol", "com.ibm.mail.myMailProtocol.myMailStore", "myMailSession", "myMailSession/jndi", "server1", "mailuser", "password")
createMailProvider
This script creates a mail provider in the environment. The appserver includes a default mail provider called the built-in provider. If we use the default mail provider you only have to configure the mail session. To use the customized mail provider first create the mail provider and session. To run the script, specify the node, server, and mail provider names, as defined in the following table:
createMailProvider arguments
Argument Description nodeName Name of the node on which to create the mail provider. serverName Name of the server for which to create the mail provider. mailProviderName Name to assign to the new mail provider.
Syntax
AdminResources.createMailProvider(nodeName, serverName, mailProviderName)Example usage
AdminResources.createMailProvider("myNode", "myServer", "myMailProvider")
createMailSession
This script creates a new mail session for the mail provider. Mail sessions are represented by the javax.mail.Session class. A mail session object authenticates users, and controls user access to messaging systems. To run the script, specify the node name, server name, mail provider name, mail session name, and Java Naming and Directory Interface (JNDI) name arguments, as defined in the following table:
createMailSession arguments
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. mailProviderName Mail provider that the appserver uses for this mail session. mailSessionName Administrative name of the Java Mail session object. JNDIName JNDI name for the resource, including any naming subcontexts. This name provides the link between the platform binding information for resources defined in the client application deployment descriptor and the actual resources bound into JNDI by the platform.
Syntax
AdminResources.createMailSession(nodeName, serverName, mailProviderName, mailSessionName, JNDIName)Example usage
AdminResources.createMailSession("myNode", "myServer", "myMailProvider", "myMailSession", "myMailSession/jndi")
createProtocolProvider
This script creates a protocol provider in the configuration, which provides the implementation class for a specific protocol to support communication between the Java Mail application and mail servers. The appserver contains protocol providers for SMTP, IMAP and POP3. If we require custom providers for different protocols, install them in the application serving environment before configuring the providers. See the Java Mail API design specification for guidelines. After configuring the protocol providers, return to the mail provider page to find the link for configuring mail sessions. To run the script, specify the following arguments:
createProtocolProvider arguments
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. mailProviderName Name of the mail provider that the application server uses in association with the protocol provider. protocolName Name of the protocol provider. The application server contains protocol providers for SMTP, IMAP and POP3. className Implementation class name of the protocol provider. type Type of protocol provider. Valid options are STORE or TRANSPORT.
Syntax
AdminResources.createProtocolProvider(nodeName, serverName, mailProviderName, protocolName, className, type)Example usage
AdminResources.createProtocolProvider("myNode", "myServer", "myMailProvider", "myMailProtocol", "com.ibm.mail.myMailProtocol.myMailStore", "STORE")
createCompleteResourceEnvProvider
This script configures a resource environment provider, which encapsulate the referenceables that convert resource environment entry data into resource objects in the configuration. To run the script, specify the following arguments:
createCompleteResourceEnvProvider arguments
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. resourceEnvProviderName Name to assign to the resource environment provider. propName Name of a custom property to set. propValue Value of the custom property. factoryClass Factory that converts resource environment entry data into a class instance for a physical resource. className Class name for the referenceable. resourceEnvEntryName Name of the resource environment entry. JNDIName JNDI name for the resource environment entry, including any naming subcontexts. This name is used as the linkage between the platform binding information for resources defined by a module deployment descriptor and actual resources bound into JNDI by the platform.
Syntax
AdminResources.createCompleteResourceEnvProvider(nodeName, serverName, resourceEnvProviderName, propName, propValue, factoryClass, className, resourceEnvEntryName, JNDIName)Example usage
AdminResources.createCompleteResourceEnvProvider("myNode", "myServer", "myResEnvProvider", "myProp", "myPropValue", "com.ibm.resource.res1", "java.lang.String", "myResEnvEntry", "res1/myResEnv")
createResourceEnvEntries
This script creates a resource environment entry in the configuration. Within an appserver name space, the data contained in a resource environment entry is converted into an object that represents a physical resource. This resource is frequently called an environment resource. To run the script, specify the following arguments:
createResourceEnvEntries arguments
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. resourceEnvProviderName Resource environment provider for this entry. The provider encapsulates the classes that, when implemented, convert resource environment entry data into resource objects. referenceable Referenceable, which encapsulates the class name of the factory that converts resource environment entry data into a class instance for a physical resource. resourceEnvEntry Specifies a name for the resource environment entry to create. JNDIName String to use to look up this environment resource using JNDI. This is the string to which you bind resource environment reference deployment descriptors.
Syntax
AdminResources.createResourceEnvEntries(nodeName, serverName, resourceEnvProviderName, referenceable, resourceEnvEntry, JNDIName)Example usage
AdminResources.createResourceEnvEntries("myNode", "myServer", "myResEnvProvider", "com.ibm.resource.res1", "myResEnvEntry", "res1/myResEnv")
createResourceEnvProvider
This script creates a resource environment provider in the configuration. The resource environment provider encapsulates the classes that, when implemented, convert resource environment entry data into resource objects. To run the script, specify the node name, server name, and resource environment provider name arguments, as defined in the following table:
createResourceEnvProvider arguments
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. resourceEnvProviderName Resource environment provider to create.
Syntax
AdminResources.createResourceEnvProvider(nodeName, serverName, resourceEnvProviderName)Example usage
AdminResources.createResEnvProvider("myNode", "myServer", "myResEnvProvider")
createResourceEnvProviderRef
This script creates a resource environment provider reference in the configuration. Resource environment references are different than resource references. Resource environment references allow the application client to use a logical name to look up a resource bound into the server JNDI namespace. A resource reference allows the application to use a logical name to look up a local JEE resource.
The JEE spec does not specify a particular implementation of a resource. To run the script, specify the following arguments:
createResourceEnvProviderRef arguments
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. resourceEnvProviderName Resource environment provider for this reference. The provider encapsulates the classes that, when implemented, convert resource environment entry data into resource objects. factoryClass Class of the factory that converts resource environment entry data into a class instance for a physical resource. className Class name to associate with the referenceable.
Syntax
AdminResources.createResourceEnvProviderRef(nodeName, serverName, resourceEnvProviderName, factoryClass, className)Example usage
AdminResources.createResourceEnvProviderRef("myNode", "myServer", "myResEnvProvider", "com.ibm.resource.res1", "java.lang.String")
configURLProvider
This script configures a URL provider, which supplies the implementation classes that are necessary for the appserver to access a URL through a specific protocol. The default URL provider provides connectivity through protocols that are supported by the IBM Developer Kit. These protocols include HTTP and File
Transfer Protocol (FTP), which work for must URLs. To run the script, specify the following arguments:
configURLProvider arguments
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. URLProviderName Name of the URL provider to configure. URLStreamHandlerClass Specifies fully qualified name of a user-defined Java class that extends the java.net.URLStreamHandler class for a particular URL protocol, such as FTP. URLProtocol Protocol supported by this stream handler. For example, NNTP, SMTP, FTP.
propName Name of the custom property to set for the URL provider. propValue Value of the custom property to set for the URL provider. URLName Name of a URL name that points to an Internet or intranet resource. For example: http://www.ibm.com. JNDIName JNDI name. Do not assign duplicate JNDI names across different resource types, such as mail sessions versus URL configurations. Do not assign duplicate JNDI names for multiple resources of the same type in the same scope. URLSpec String from which to form a URL.
Syntax
AdminResources.configURLProvider(nodeName, serverName,URLProviderName, URLStreamHandlerClass, URLProtocol, propName, propValue, URLName, JNDIName,
URLSpec)
Example usage
AdminResources.configURLProvider("myNode", "myServer", "myURLProvider", "com.ibm.resource.url1", "ftp", "myProp", "myPropValue", "myURL", "url1/myURL", "myURLSpec")
createCompleteURLProvider
This script creates a URL provider, which supplies the implementation classes that are necessary for the appserver to access a URL through a specific protocol. The default URL provider provides connectivity through protocols that are supported by the IBM Developer Kit. These protocols include HTTP and File
Transfer Protocol (FTP), which work for must URLs. To run the script, specify the following arguments:
createCompleteURLProvider arguments
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. URLProviderName Name of the URL provider to configure. URLStreamHandlerClass Specifies fully qualified name of a user-defined Java class that extends the java.net.URLStreamHandler class for a particular URL protocol, such as FTP. URLProtocol Protocol supported by this stream handler. For example, NNTP, SMTP, FTP.
Syntax
AdminResources.createCompleteURLProvider(nodeName, serverName, URLProviderName, URLStreamHandlerClass,URLProtocol)
Example usage
AdminResources.createCompleteURLProvider("myNode", "myServer", "myURLProvider", "com.ibm.resource.url1", "ftp")
createURL
This script creates a URL provider, which supplies the implementation classes that are necessary for the appserver to access a URL through a specific protocol. The default URL provider provides connectivity through protocols that are supported by the IBM Developer Kit. These protocols include HTTP and File
Transfer Protocol (FTP), which work for must URLs. To run the script, specify the following arguments:
createURL arguments
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. URLProviderName Name of the URL provider to assign the URL to.
URLName Name of the URL to create. JNDIName JNDI name. Do not assign duplicate JNDI names across different resource types, such as mail sessions versus URL configurations. Do not assign duplicate JNDI names for multiple resources of the same type in the same scope. URLSpec String from which to form a URL.
Syntax
AdminResources.createURL(nodeName, serverName,URLProviderName, URLName, JNDIName,
URLSpec)
Example usage
AdminResources.createURL("myNode", "myServer", "myURLProvider", "myURL", "url1/myURL", "myURLSpec")
createJAASAuthenticationAlias
This script creates a (JAAS) authentication alias. The alias identifies the authentication data entry.
When configuring resource adapters or data sources, the administrator can specify which authentication data to choose using the corresponding alias. To run the script, specify the following arguments:
createJAASAuthenticationAlias arguments
Argument Description authAliasName Name of the authentication alias to create. authAliasID A user identity of the intended security domain. For example, if a particular authentication data entry is used to open a new connection to DB2, this entry contains a DB2 user identity. authAliasPW of the user identity is encoded in the configuration repository.
Syntax
AdminResources.createJAASAuthenticationAlias(authAliasName, authAliasID, authAliasPW)Example usage
AdminResources.createJAASAuthenticationAlias("myJAAS", "user01", "password")
createLibraryRef
This script creates a library reference, which defines how to use global libraries. The first step for making a library file available to multiple applications deployed on a server is to create a shared library for each library file that the applications need. By creating the shared libraries, set variables for the library files. To run the script, specify the following arguments:
createLibraryRef arguments
Argument Description libraryRefName Name of the library reference to create. applicationName Name of the application to associate with the library reference.
Syntax
AdminResources.createLibraryRef(libraryRefName, applicationName)Example usage
AdminResources.createLibraryRef("myLibrary", "myApplication")
createSharedLibrary
This script creates a shared library in the configuration. The first step for making a library file available to multiple applications deployed on a server is to create a shared library for each library file that the applications need. By creating the shared libraries, set variables for the library files. To run the script, specify the following arguments:
createSharedLibrary arguments
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. sharedLibName Name to assign to the shared library. sharedLibClassPath File path where WAS searches for classes and resources of the shared library. If a path in the list is a file, WAS searches the contents of that .jar or .zip file. If a path in the list is a directory, then WAS searches the contents of .jar and .zip files in that directory. For performance reasons, WAS searches the directory itself only if the directory contains subdirectories or files other than .jar or .zip files.
Syntax
AdminResources.createSharedLibrary(nodeName, serverName, sharedLibName, sharedLibClassPath)Example usage
(Windows)
AdminResources.createSharedLibrary("myNode", "myServer", "myLibrary", "c:\myLibrary.zip")[AIX] [Solaris][Linux] [HP-UX]
AdminResources.createSharedLibrary("myNode", "myServer", "myLibrary", "/myLibrary.zip")
createScheduler
This script creates a scheduler in the configuration. Schedulers are persistent and transactional timer services that can run business logic. Each scheduler runs tasks independently and has a programming interface accessible from JEE applications using the JNDI.
We can also manage schedulers using a Java Management Extensions (JMX) MBean.
See the scheduler documentation in the Information Center for details on how to configure and use schedulers. To run the script, specify the following arguments:
createScheduler arguments
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. schedulerName Name by which this scheduler is known for admin purposes. JNDIName JNDI name that determines where this scheduler instance is bound in the name space. Clients can look this name up directly, although the use of resource references is recommended. scheduleCategory String that can be used to classify or group this scheduler. datasourceJNDI Name of the data source where persistent tasks are stored. Any data source available in the name space can be used with a scheduler. Multiple schedulers can share a single data source while using different tables by specifying a table prefix. tablePrefix String prefix to affix to the scheduler tables. Multiple independent schedulers can share the same database if each instance specifies a different prefix string. pollInterval Interval, in seconds, that a scheduler polls the database. The default value is appropriate for most applications. Each poll operation can be consuming. If the interval is extremely small and there are many scheduled tasks, polling can consume a large portion of system resources. The default value is 30. workMgmtJNDI JNDI name of the work manager, which is used to manage the number of tasks that can run concurrently with the scheduler. The work manager also can limit the amount of JEE context applied to the task.
Syntax
AdminResources.createScheduler(nodeName, serverName, schedulerName, JNDIName, scheduleCategory, datasourceJNDI, tablePrefix, pollInterval, workMgmtJNDI)Example usage
AdminResources.createScheduler("myNode", "myServer", "myScheduler", "myScheduleJndi", "Default", "jdbc/MyDatasource", "sch1", "30", "myWorkManager")
createWorkManager
This script creates a work manager in the configuration. Work managers contain a pool of threads that are bound into Java Naming and Directory Interface. To run the script, specify the following arguments:
createWorkManager arguments
Argument Description nodeName Name of the node of interest. serverName Name of the server of interest. workMgrName Name by which this work manager is known for admin purposes. JNDIName JNDI name used to look up the work manager in the namespace. workMgrCategory String that we can use to classify or group this work manager. alarmThreads Desired maximum number of threads used for alarms. The default value is 2. minThreads Minimum number of threads available in this work manager. maxThreads Maximum number of threads available in this work manager. threadPriority Priority of the threads available in this work manager. Every thread has a priority. Threads with higher priority are run before threads with lower priority. See about how thread priorities are used, see the API documentation for the setPriority method of the java.lang.Thread class in the Java EE specification.
isGrowable Specifies whether the number of threads in this work manager can be increased. Specify a value of true to indicate that the number of threads can increase. serviceNames List of services to make available to this work manager.
Syntax
AdminResources.createWorkManager(nodeName, serverName, workMgrName, JNDIName, workMgrCategory, alarmThreads, minThreads, maxThreads, threadPriority, isGrowable, serviceNames)Example usage
AdminResources.createWorkManager("myNode", "myServer", "myWorkManager", "Work Manager", "wm/myWorkManager", "Default", 5, 1, 10, 5, "true", "AppProfileService UserWorkArea com.ibm.ws.i18n security")
help
This script displays the script procedures that the AdminResources script library supports. To display detailed help for a specific script, specify the name of the script of interest, as defined in the following table:
help arguments
Argument Description script Name of the script of interest.
Syntax
AdminResources.help(script)Example usage
AdminResources.help("createWorkManager")
Related tasks
Use the script library to automate the application serving environment
Set mail providers and sessions
Set new resource environment providers for application clients
Set new URL providers for application clients
Related
JDBC configuration scripts
J2C configuration scripts
JMS configuration scripts
Java Mail system properties