Java EE 7 教程 第二部分 平台基础 第3章 创建资源 第3.3节 创建资源管理

原文:https://docs.oracle.com/javaee/7/tutorial/resource-creation003.htm
翻译:石卓林 shizhuolin@hotmail.com

3.3 Creating Resources Administratively

Before you deploy or run many applications, you may need to create resources for them. An application can include a glassfish-resources.xml file that can be used to define resources for that application and others. You can then use the asadmin command, specifying as the argument a file named glassfish-resources.xml, to create the resources administratively, as shown.

asadmin add-resources glassfish-resources.xml

The glassfish-resources.xml file can be created in any project using NetBeans IDE or by hand. Some of the JMS examples use this approach to resource creation. A file for creating the resources needed for the JMS simple producer example can be found in the jms/simple/producer/src/main/setup directory.

You could also use the asadmin create-jms-resource command to create the resources for this example. When you are done using the resources, you would use the asadmin list-jms-resources command to display their names, and the asadmin delete-jms-resource command to remove them, regardless of the way you created the resources.

3.3 创建资源管理

部署或创建多数应用前,你可能需要为它们创建资源. 一个应用包含glassfish-resources.xml文件,其作用是为应用和其它服务定义资源. 可以使用asadmin命令, 指定参数为一个文件命名glassfish-resources.xml, 要创建资源管理可以使用如下命令:

asadmin add-resources glassfish-resources.xml

可以在任意项目中通过NetBeans IDE或手动创建glassfish-resources.xml文件.
一些JMS范例使用这些方法创建资源. 在jms/simple/producer/src/main/setup目录可以找到一些简单的JMS生成范例所需要的资源文件

也可以使用asadmin create-jms-resource 命令创建这些范例。 当你使用资源时, 可以使用asadmin list-jms-resources命令显示它们的名称,并且通过asadmin delete-jms-resource命令删除它们,而无需考虑其是被何方法所创建.

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload the CAPTCHA.

Proudly powered by WordPress   Premium Style Theme by www.gopiplus.com