公告 |
求真务实打基础, 宁缺毋滥读好书。
数据挖掘青年(DMman) |
链接 |
|
Blog信息 |
blog名称:DMman(数据挖掘青年) 日志总数:102 评论数量:564 留言数量:57 访问次数:1755985 建立时间:2007年4月9日 |

| |
[Java EE]转:Tomcat服务器配置参考(7)GlobalNamingResources组件 网上资源
数据挖掘青年 发表于 2007/4/19 21:43:14 |
概述
GlobalNamingResources定义了服务器的全局JNDI资源。
专有特征
环境条目
可以在GlobalNamingResources中嵌套<Environment>元素,配置命名的值,这些值作为环境条目资源(Environment Entry Resource),对整个web应用可见。比如,可以按照如下方法创建一个环境条目:
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
<GlobalNamingResources ...>
...
<Environment name="maxExemptions" value="10"
type="java.lang.Integer" override="false"/>
...
</GlobalNamingResources>
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
这与在/WEB-INF/web.xml中包含如下元素是等价的:
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
<env-entry>
<env-entry-name>maxExemptions</param-name>
<env-entry-value>10</env-entry-value>
<env-entry-type>java.lang.Integer</env-entry-type>
</env-entry>
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>区别是,前者不需要修改deployment descriptor来定制这个值。
<Environment>元素的有效属性所如下:
属性
描述
description
环境条目的文字描述(可选)
name
环境条目的名称,相对于java:comp/env context。
override
如果不希望/WEB-INF/web.xml中具有相同名称的<env-entry>覆盖这里指定的值,设为false。缺省值为true。
type
环境条目的Java类名的全称.在/WEB-INF/web.xml中,<env-entry-type>必须是如下的值:java.lang.Boolean, java.lang.Byte, java.lang.Character, java.lang.Double, java.lang.Float, java.lang.Integer, java.lang.Long, java.lang.Short, or java.lang.String.
value
通过JNDI context请求时,返回给应用的参数值。这个值必须转换成type属性定义的Java类型
(资源定义)Resource Definitions
可以在/WEB-INF/web.xml中定义资源的特性。使用JNDI查找<resource-ref>和<resource-env-ref>元素时,这些特性被返回。对同一资源名称,还必须定义资源参数(见下面“资源参数”小节),这些参数用来配置对象工厂(object factory)以及对象工厂的属性。
比如,你可以按照如下方式创建资源定义:
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
<GlobalNamingResources ...>
...
<Resource name="jdbc/EmployeeDB" auth="Container"
type="javax.sql.DataSource"
description="Employees Database for HR Applications"/>
...
</GlobalNamingResources>
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
这等价于在/WEB-INF/web.xml中包含如下元素:
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
<resource-ref>
<description>Employees Database for HR Applications</description>
<res-ref-name>jdbc/EmployeeDB</res-ref-name>
<res-ref-type>javax.sql.DataSource</res-ref-type>
<res-auth>Container</res-auth>
</resource-ref>
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
区别是,前者不需要修改deployment descriptor来定制这个值。
<Resource>元素的有效属性如下:
Attribute
Description
auth
指定是web应用代码本身sign on到对应的resource mananger,还是由container代表web应用sign on到resource manager。该属性的值必须是Application或者Container。如果在web application deployment descriptor中使用<resource-ref>,这个属性是必需的,如果使用<resource-env-ref>,这个属性是可选的。
description
资源的文字描述(可选)
name
资源的名称,相对于java:comp/env context
scope
指定通过这个resource manager得到的连接是否共享。该属性的值必须是Shareable或者Unshareable。缺省情况下,假定连接是共享的。
type
当web应用查找该资源的时候,返回的Java类名的全称。
资源参数(Resource Parameters)
资源参数用来配置资源管理器(resource manager,或对象工厂,object factory)。在做JNDI查找时,资源管理器返回查找的对象。在资源可以被访问之前,对<Context>或<DefaultContext>元素的每个<Resource>元素,或者/WEB-INF/web.xml中定义的每个<resource-ref>或<resource-env-ref>元素,都必须定义资源参数。
资源参数是用名称定义的,使用的资源管理器(或者object factory)不同,参数名称的集合也不一样。这些参数名和工厂类的JavaBeans属性相对应。JNDI实现通过调用对应的JavaBeans属性设置函数来配置特定的工厂类,然后通过lookup()调用使得该实例可见。
一个JDBC数据源的资源参数可以按照如下方式定义:
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
<GlobalNamingResources ...>
...
<ResourceParams name="jdbc/EmployeeDB">
<parameter>
<name>driverClassName</name>
<value>org.hsql.jdbcDriver</value>
</parameter>
<parameter>
<name>driverName</name>
</value>jdbc:HypersonicSQL:database</value>
</parameter>
<parameter>
<name>user</name>
<value>dbusername</value>
</parameter>
<parameter>
<name>password</name>
<value>dbpassword</value>
</parameter>
</ResourceParams>
...
</GlobalNamingResources>
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>
500)this.width=500'>如果你需要为某个特定的资源类型指定工厂内的Java类名,在<ResourceParams>元素中嵌套一个叫做factory的<parameter>条目。
<Resourceparams>元素的有效属性如下:
属性
描述
name
配置的资源名称,相对于java:comp/env context。这个名称必须与$CATALINA_HOME/conf/server.xml中某个<Resource>元素定义的资源名称匹配,或者在/WEB-INF/web.xml中通过<resource-ref>或者<resource-env-ref>元素应用。 |
|
Netbeans还是Eclipse? 网上资源
有所期待(游客)发表评论于2008/1/3 13:52:04 |
问一下,java的哪个开发环境更方便做数据挖掘啊?
以下为blog主人的回复:
至于做DM java的开发环境都没有特别的地方;看自己喜欢哪个了~ |
|
回复:聚类算法综述 网上资源
有所期待(游客)发表评论于2008/1/3 13:49:41 |
问一下,java的哪个开发环境更方便做数据挖掘啊? |
|
» 1 »
|