使用 wsadmin 脚本编制的 AdminTask 对象的 PropertiesBasedConfiguration 命令组
您可以使用脚本编制来利用属性文件定制一部分系统配置。WebSphere 配置库存储许多不同类型的配置。您可以使用属性文件来定制其中一些配置。您可以定制由 WebSphere 公共配置模型 (WCCM) 创建的某些配置或者部署为 Java EE 应用程序的配置。
在脚本编制中使用 AdminConfig 命令来配置 WebSphere 公共配置模型。AdminConfig.types() 列示 WCCM 中的类型,且 AdminConfig.attributes("type") 列示特定类型的属性。使用属性文件来定制这些类型常常比编写脚本来进行相同更改更容易。在生产环境中,Java EE 应用程序常常是通过脚本编制中的 AdminApp 命令来部署的。对于开发环境,使用属性文件将在构造管理应用程序所需的参数时提供易于理解的语法。请注意应用程序部署使用自己的 WCCM 类型组。
- SIBus
- 业务级应用程序
- 密钥和信任库文件
- Web Service 策略集文件
- 基于文件的用户注册表
- 检查“使用属性文件管理特定配置对象”中记录的样本。
- 将适用的样本复制并粘贴到文本文件中,根据需要编辑样本,然后在进行合适的变量替换后将样本应用于您的环境。存在涵盖了范围广泛的常用配置的许多样本。
- 对于受支持的 WCCM 类型,一开始您可以从现有单元抽取该类型,编辑抽取的文件,然后将其应用于现有单元。
对于并非单元、节点、服务器或服务器集群的受支持 WCCM 类型,请使用 -options [[PortablePropertiesFile true]] 选项从现有单元抽取特定类型以创建可移植文件格式。然后,编辑属性文件,在进行相应变量替换后将其应用于其他单元。 您可能使用此方式将常用的配置子集(例如,资源定义和 Java 虚拟机 (JVM) 设置)从一个环境移到另一环境。

AccessPointGroup | ActivationSpec | ActivationSpecTemplateProps | ActivitySessionService |
---|---|---|---|
AdminObject | AdminObjectTemplateProps | AdminServerAuthentication | AdminService |
AllActivePolicy | AllAuthenticatedUserExt | AllAuthenticatedUsersInTrustedRealmsExt | ApplicationProfileService |
ApplicationServer | Audit | AuditEventFactory | AuditNotificationMonitor |
AuditPolicy | AuditServiceProvider | AuditSpecification | AuthenticationMechanism |
AuthenticationTarget | AuthorizationConfig | AuthorizationGroup | AuthorizationGroupMember |
AuthorizationProvider | AuthorizationTableExt | AuthorizationTableImpl | BackupCluster |
BridgeInterface | CACertificate | CAClient | CMPConnectorFactory |
CacheProvider | Cell | Certificate | Chain |
Classloader | ClusterMember | CommonSecureInterop | CompensationService |
ConfigSynchronizationService | ConnectionDefTemplateProps | ConnectionDefinition | ConnectionPool |
ConnectionTest | Connector | Cookie | CoreGroup |
CoreGroupAccessPoint | CoreGroupBridgeService | CoreGroupBridgeSettings | CoreGroupServer |
CryptoHardwareToken | CustomAuthMechanism | CustomService | CustomUserRegistry |
DCSInboundChannel | DPClonableDeviceSettings | DPClonableDeviceSettingsVersion | DPDevice |
DPDomain | DPDomainVersion | DPFirmware | DPFirmwareVersion |
DPManagedSet | DPManager | DRSConnectionPool | DRSPartition |
DRSSerialization | DRSSettings | DataPowerMgrInboundChannel | DataReplication |
DataReplicationDomain | DataSource | DebugService | DiagnosticProviderService |
DigestAuthentication | DiskCacheCustomPerformanceSettings | DiskCacheEvictionPolicy | DistributionQueue |
DynamicCache | EJBCache | EJBContainer | EJBTimer |
EndPoint | EventGroupProfile | EventGroupProfileList | EventInfrastructureProvider |
EventInfrastructureService | EventServerProfile | EveryoneExt | ExtensionMBean |
ExtensionMBeanProvider | ExternalCacheGroup | ExternalCacheGroupMember | FileTransferService |
过滤器 | GenericChannelFactory | GenericInboundChannel | GenericJMSConnectionFactory |
GenericJMSDestination | GenericOutboundChannel | HAManagerService | HTTPConnector |
HTTPInboundChannel | HTTPOutboundChannel | HTTPTransport | HTTPTunnelInboundChannel |
HTTPTunnelOutboundChannel | HostAlias | I18NService | IIOPSecurityProtocol |
IIOPTransport | IconType | IdentityAssertionLayer | IdentityAssertionQOP |
IdentityAssertionTypeAssociation | InvalidationSchedule | J2CActivationSpec | J2CAdminObject |
J2CResourceAdapter | J2EEResourcePropertySet | JAASAuthData | JAASConfiguration |
JAASConfigurationEntry | JAASLoginModule | JDBCProvider | JFAPFactory |
JFAPInboundChannel | JFAPOutboundChannel | JMSProvider | JMSTransport |
JavaProcessDef | JavaVirtualMachine | KRB | Key |
KeyManager | KeyReference | KeySet | KeySetGroup |
KeyStore | KeyStoreFile | LDAPSearchFilter | LDAPUserRegistry |
LTPA | Library | LibraryRef | ListenerPort |
LocalOSUserRegistry | MOfNPolicy | MQConnectionFactory | MQFAPInboundChannel |
MQFAPOutboundChannel | MQQueue | MQQueueConnectionFactory | MQTopic |
MQTopicConnectionFactory | MailProvider | MailSession | ManagementScope |
MappingModule | MemoryCacheEvictionPolicy | MessageLayer | MessageListener |
MessageListenerService | MessageQOP | MimeEntry | MonitoringPolicy |
NameServer | NoOpPolicy | Node | NodeGroup |
ORBInboundChannel | ObjectCacheInstance | ObjectPool | ObjectPoolManagerInfo |
ObjectPoolProvider | ObjectPoolService | ObjectRequestBroker | OneOfNPolicy |
OutboundResourceAdapter | OutputRedirect | PME51ServerExtension | PMEServerExtension |
PMIModule | PMIService | PMRClusterExtension | PeerAccessPoint |
PeerCoreGroup | PluginConfigService | PluginProperties | PluginServerClusterProperties |
PortletContainer | PreferredServerPolicy | PrimaryAdminExt | ProcessExecution |
ProtocolProvider | ProxyInboundChannel | RASLoggingService | RMIConnector |
RMQChannelFactory | RMQOutboundChannel | RSAToken | Referenceable |
RepositoryService | ResourceAdapter | ResourceEnvironmentProvider | RoleAssignmentExt |
SecurityRoleExt | ServerEntry | ServerExt | ServerIndex |
SIPContainer | SIPContainerInboundChannel | SIPInboundChannel | SIPOutboundChannel |
SIPProxyInboundChannel | SOAPConnector | SPNEGO | SSLConfig |
SSLConfigGroup | SSLInboundChannel | SSLOutboundChannel | SWAMAuthentication |
SchedulerConfiguration | SchedulerProvider | SchedulerService | SecureAssociationService |
SecureSocketLayer | Security | SecurityDomain | SecurityPermission |
SecurityProtocolQOP | Server | ServerCluster | ServerIdentity |
ServiceLog | ServletCacheInstance | SessionBeanConfig | SessionDatabasePersistence |
SessionManager | SingleSignon | StartupBeansService | StateManageable |
StatefulSessionBeanConfig | StaticPolicy | StatisticsProvider | StreamRedirect |
StringNameSpaceBinding | SystemMessageServer | TAInterceptor | TCPFactory |
TCPInboundChannel | TCPOutboundChannel | TPVService | TaskProvider |
ThreadPool | TimerManagerInfo | TimerManagerProvider | TraceLog |
TraceService | TransactionService | TransportChannelFactory | TransportChannelService |
TransportLayer | TransportQOP | TrustAssociation | TrustManager |
TrustedAuthenticationRealm | TuningParams | TunnelAccessPointGroup | TunnelPeerAccessPoint |
TunnelTemplate | UDPInboundChannel | UDPOutboundChannel | URL |
URLProvider | UserExt | VariableMap | VirtualHost |
WAS40ConnectionPool | WAS40DataSource | WASQueue | WASQueueConnectionFactory |
WASTopic | WASTopicConnectionFactory | WIMUserRegistry | WLMCoreGroupBridgePlugin |
WSNotification | WSSchedule | WebContainer | WebContainerInboundChannel |
WebModuleConfig | WebModuleDeployment | WebServer | WebserverPluginSettings |
WeightAdvisor | WorkAreaPartition | WorkAreaPartitionService | WorkAreaService |
WorkManagerInfo | WorkManagerProvider | WorkManagerService |
applyConfigProperties
applyConfigProperties 命令将特定属性文件中的属性应用于配置。如果特定特性不存在,那么系统会将属性或配置数据添加至配置。如果配置中存在这些特性,那么系统会为属性设置新值。
目标对象
无。
必需参数
- -propertiesFileName
- 指定要应用的属性文件的名称。(字符串,必需)
可选参数
- -variablesMapFileName
- 指定变量映射文件的名称。此文件包含系统从属性文件中使用的变量的值。(字符串,可选)
- -variablesMap
- 指定要与属性文件一起使用的变量的值。(属性,可选)
- -reportFileName
- 指定包含 applyConfigProperties 命令输出的报告文件的名称。(字符串,可选)
- -reportFilterMechanism
- 指定报告过滤器机制的类型。指定 All 以显示所有报告信息。指定 Errors 以显示错误信息。指定 Errors_And_Changes 以显示错误和更改信息。(字符串,可选)
- -validate
- 指定在应用更改之前是否验证属性文件。缺省情况下,该命令会验证属性文件。指定 false 以禁用验证。(布尔值,可选)
- -zipFileName
- 指定压缩文件的名称,该文件包含您要应用于单元的策略集。(字符串,可选)
返回值
此命令不会返回输出。
批处理方式示例用法
- 使用 Jython 字符串:
AdminTask.applyConfigProperties('-propertiesFileName myPropFile.props -zipFileName myZipFile.zip -validate true')
- 使用 Jython 列表:
AdminTask.applyConfigProperties(['-propertiesFileName', 'myPropFile.props', '-zipFileName', 'myZipFile.zip', '-validate', 'true'])
交互方式示例用法
- 使用 Jython:
AdminTask.applyConfigProperties('-interactive')
createPropertiesFileTemplates
createPropertiesFileTemplates 命令创建要用来创建或删除特定对象类型的模板属性文件。该命令会将模板属性文件存储在 propertiesFileName 参数指定的属性文件中。
目标对象
无。
必需参数
- -propertiesFileName
- 指定存储模板的属性文件的名称。(字符串,必需)
- -configType
- 为要创建的模板指定资源类型。(字符串,必需)
- 指定 Server 以创建服务器类型属性文件模板。
- 指定 ServerCluster 以创建服务器集群类型属性文件模板。
- 指定 Application 以创建应用程序类型属性文件模板。
- 指定 AuthorizationGroup 以创建授权组类型属性文件模板。
可选参数
无返回值
此命令不会返回输出。
批处理方式示例用法
- 使用 Jython 字符串:
AdminTask.createPropertiesFileTemplates('-propertiesFileName serverTemplate.props -configType Server')
- 使用 Jython 列表:
AdminTask.createPropertiesFileTemplates(['-propertiesFileName', 'serverTemplate.props', '-configType', 'Server'])
交互方式示例用法
- 使用 Jython:
AdminTask.createPropertiesFileTemplates('-interactive')
deleteConfigProperties
deleteConfigProperties 命令删除配置中的属性(如属性文件中所指定)。系统会除去与特性 (property) 文件中每个特性 (property) 对应的属性或配置数据。
目标对象
无。
必需参数
- -propertiesFileName
- 指定要删除的属性文件的名称。(字符串,必需)
可选参数
- -variablesMapFileName
- 指定变量映射文件的名称。此文件包含系统从属性文件中使用的变量的值。(字符串,可选)
- -variablesMap
- 指定要与属性文件一起使用的变量的值。(属性,可选)
- -reportFileName
- 指定包含该命令输出的报告文件的名称。(字符串,可选)
- -reportFilterMechanism
- 指定报告过滤器机制的类型。指定 All 以显示所有报告信息。指定 Errors 以显示错误信息。指定 Errors_And_Changes 以显示错误和更改信息。(字符串,可选)
- -validate
- 指定在应用更改之前是否验证属性文件。缺省情况下,该命令会验证属性文件。指定 false 以禁用验证。(布尔值,可选)
返回值
此命令不会返回输出。
批处理方式示例用法
- 使用 Jython 字符串:
AdminTask.deleteConfigProperties('-propertiesFileName myPropFile.props')
- 使用 Jython 列表:
AdminTask.deleteConfigProperties(['-propertiesFileName', 'myPropFile.props'])
交互方式示例用法
- 使用 Jython:
AdminTask.deleteConfigProperties('-interactive')
extractConfigProperties
extractConfigProperties 命令以属性文件的形式抽取配置数据。系统会导出最常使用的配置数据和属性、将这些属性转换为特性 (property) 以及将该数据保存至文件。可以将相关资源与目标对象或 configData 参数一起指定。使用 configData 参数来指定服务器、节点、集群、策略集或应用程序实例。 如果未指定任何配置对象,那么该命令会抽取概要文件配置数据。
目标对象
使用以下格式来指定相关配置对象的对象名:Node=nodeName:Server=serverName
必需参数
- -propertiesFileName
- 指定要抽取的属性文件的名称。(字符串,必需)
可选参数
- -configData
- 使用格式 Node=node1 指定配置对象实例。(字符串,可选)
- -options
- 指定其他配置选项(例如 GENERATETEMPLATE=true)。(属性,可选)
- -filterMechanism
- 指定用于抽取配置属性的过滤器信息。(字符串,可选)
- 指定 All 以抽取所有配置属性。
- 指定 NO_SUBTYPES 以抽取给定对象的属性但不包括子类型。
- 指定 SELECTED_SUBTYPES 以抽取通过 selectedSubTypes 参数指定的特定配置对象子类型。这可包括配置对象的任何子类型或对象类型层次结构下存在的 任何 WCCM 类型。
- -selectedSubTypes
- 指定当命令抽取属性时要包括或排除的配置属性。如果将 filterMechanism
参数设置为 NO_SUBTYPES 或 SELECTED_SUBTYPES,那么指定此参数。下列字符串是子类型的示例:ApplicationServer 和 EJBContainer。(字符串,可选)
表 2. extractConfigProperties -selectedSubTypes 子类型和扩展. 您可以配置对象类型和子类型的属性。 配置对象类型 子类型 扩展名 AdminService 无 无 Deployment ApplicationName 无 ApplicationServer TransactionService、DynamicCache、WebContainer、EJBContainer、PortletContainer、SIPContainer 和 WebserverPluginSettings 无 AuthorizationGroup 无 无 AuthorizationTableExt 无 无 Cell VirtualHost、DataReplicationDomain、ServerCluster、CoreGroup、NodeGroup、AuthorizationGroup、AuthorizationTableExt、Security、J2CResourceAdapter、JDBCProvider、JMSProvider、MailProvider、URLProvider、EventInfrastructureProvider、ObjectPoolProvider、WorkManagerProvider、TimerManagerProvider、SchedulerProvider、Node 和 VariableMap 无 CoreGroup 无 无 CoreGroupBridgeService 无 无 DynamicCache 无 无 EJBContainer 无 无 EventInfrastructureProvider 无 无 EventInfrastructureService 无 无 HAManagerService 无 无 J2CResourceAdapter 无 无 JDBCProvider 无 无 JMSProvider 无 无 JavaVirtualMachine 无 无 Library 无 无 MailProvider 无 无 NameServer 无 无 Node Server、J2CResourceAdapter、JDBCProvider、JMSProvider、MailProvider、URLProvider、EventInfrastructureProvider、ObjectPoolProvider、WorkManagerProvider、TimerManagerProvider、SchedulerProvider 和 VariableMap NodeMetadata 扩展抽取节点元数据属性。 NodeGroup 无 无 ObjectPoolProvider 无 无 ObjectRequestBroker 无 无 PMEServerExtension 无 无 PMIModule 无 无 PMIService 无 无 PortletContainer 无 无 SIPContainer 无 无 SchedulerProvider 无 无 Security JAASAuthData 无 Server PMIService、AdminService、CoreGroupBridgeService、TPVService、ObjectRequestBroker、ApplicationServer、NameServer、J2CResourceAdapter、JDBCProvider、JMSProvider、MailProvider、URLProvider、EventInfrastructureProvider、ObjectPoolProvider、WorkManagerProvider、TimerManagerProvider、SchedulerProvider、VariableMap、EventInfrastructureService、PMEServerExtension、Library、HAManagerService、PMIModule 和 Security 扩展为特定服务器列示已部署的应用程序。 ServerCluster J2CResourceAdapter、JDBCProvider、JMSProvider、MailProvider、URLProvider、ObjectPoolProvider、WorkManagerProvider、TimerManagerProvider、SchedulerProvider 和 VariableMap 扩展为特定集群列示已部署的应用程序。 TPVService 无 无 TimerManagerProvider 无 无 TransactionService 无 无 URLProvider 无 无 VariableMap 无 无 VirtualHost 无 无 WebContainer 无 无 WebserverPluginSettings 无 无 WorkManagerProvider 无 无 - -zipFileName
- 指定您希望将策略集抽取到其中的压缩文件的名称。(字符串,可选)
返回值
该命令返回系统创建的属性文件的名称。
批处理方式示例用法
- 使用 Jython 字符串:
AdminTask.extractConfigProperties('-configData Node=myNode -propertiesFileName myNodeProperties.props -zipFileName myZipFile.zip')
- 使用 Jython 列表:
AdminTask.extractConfigProperties(['-configData', 'Node=myNode', '-propertiesFileName', 'myNodeProperties.props', '-zipFileName', 'myZipFile.zip'])
交互方式示例用法
- 使用 Jython 字符串:
AdminTask.extractConfigProperties('-interactive')
for vhost in AdminConfig.list( 'VirtualHost' ).splitlines() :
name = AdminConfig.showAttribute( vhost, 'name' )
parms = '[-propertiesFileName ' + name + '.properties -configData VirtualHost=' + name + '
-options [[PortablePropertiesFile true]] ]'
AdminTask.extractConfigProperties(parms)
此示例将为单元中的每个虚拟主机生成一个
<VIRTUALHOSTNAME>.properties 文件。validateConfigProperties
validateConfigProperties 命令验证属性文件中的属性是否有效以及是否可成功地应用于新配置。
目标对象
无。
必需参数
- -propertiesFileName
- 指定要验证的属性文件的名称。(字符串,必需)
可选参数
- -variablesMapFileName
- 指定变量映射文件的名称。此文件包含系统从属性文件中使用的变量的值。(字符串,可选)
- -variablesMap
- 指定要与属性文件一起使用的变量的值。(属性,可选)
- -reportFileName
- 指定包含 applyConfigProperties 命令输出的报告文件的名称。(字符串,可选)
- -reportFilterMechanism
- 指定报告过滤器机制的类型。指定 All 以显示所有报告信息。指定 Errors 以显示错误信息。指定 Errors_And_Changes 以显示错误和更改信息。(字符串,可选)
- -zipFileName
- 指定压缩文件的名称,该文件包含您要应用于单元的策略集。(字符串,可选)
返回值
如果系统验证属性文件或策略集 .zip 文件,那么该命令返回值 true。
批处理方式示例用法
- 使用 Jython 字符串:
AdminTask.validateConfigProperties('-propertiesFileName myNodeProperties.props -zipFileName myZipFile.zip -reportFileName report.txt')
- 使用 Jython 列表:
AdminTask.validateConfigProperties(['-propertiesFileName', 'myNodeProperties.props', '-zipFileName', 'myZipFile.zip', '-reportFileName', 'report.txt'])
交互方式示例用法
- 使用 Jython:
AdminTask.validateConfigProperties('-interactive')