Shi Zhuolin's Blog - 2014 - 4
type: channel
link: https://shizhuolin.com/2014/04/
description: This guy is lazy, leaving nothing left.
items: Java EE 7 教程 第一部分 简介 第2章 使用教程示例 第2.2节 启动和停止GlassFish服务器
items: Java EE 7 教程 第一部分 简介 第2章 使用教程示例 第2.1节 需要的软件
items: Java EE 7 教程 第一部分 简介 第2章 使用教程示例
items: Java EE 7 教程 第一部分 简介 第1章 概述 第1.9节 GlassFish服务器工具
items: Java EE 7 教程 第一部分 简介 第1章 概述 第1.8节 Java平台中的Java EE 7 API, 标准版7
items: Java EE 7 教程 第一部分 简介 第1章 概述 第1.7节 Java EE 7 APIs
items: 在Yaf中使用Zf2的配置和服务管理器
items: Java EE 7 教程 第一部分 简介 第1章 概述 第1.7节 开发角色

Java EE 7 教程 第一部分 简介 第2章 使用教程示例 第2.2节 启动和停止GlassFish服务器
type: item
date: 2014-04-30T13:11:00+00:00
description: 原文：http://docs.oracle.com/javaee/7/tutorial/doc/usingexamples002.htm翻译：石卓林 shizhuolin@hotmail.com2.2 Starting and Stopping GlassFish ServerYou can start and stop GlassFish Server using either NetBeans IDE or the command line.2.2 启动和停止GlassFish服务器你可以使用NetBeans IDE或命令行启动和停止GlassFish服务器.2.2.1 To Start GlassFish Server Using NetBeans IDEClick the Services tab.Expand Servers.Right-click the GlassFish Server instance and select Start.2.2.1 使用NetBeans IDE启动GlassFish服务器点击Services选项卡.展开Servers.右键点击GlassFish服务器实例，选择Start.2.2.2 To Stop GlassFish Server Using NetBeans IDETo stop GlassFish Server using NetBeans IDE, right-click the GlassFish Server instance and select Stop.2.2.2 使用NetBeans IDE停止GlassFish服务器要使用NetBeans IDE停止服务器,请右键点击GlassFish服务器实例并选择Stop.2.2.3 To Start GlassFish Server Using the Command LineTo start GlassFish Server from the command line, open a terminal window or command prompt and execute the following:asadmin start-domain --verboseA domain is a set of one or more GlassFish Server instances managed by one administration server. The following elements are associated with a domain:The GlassFish Server port number: The default is 8080.The administration server's port number: The default is 4848.An administration user name and password: The default user name is admin, and by default no password is required.You specify these values when you install GlassFish Server. The examples in this tutorial assume that you chose the default ports as well as the default user name and lack of password.With no arguments, the start-domain command initiates the default domain, which is domain1. The --verbose flag causes all logging and debugging output to appear on the terminal window or command prompt. The output also goes into the server log, which is located in domain-dir/logs/server.log.Or, on Windows, from the Start menu, choose All Programs, then choose Java EE 7 SDK, then choose Start Application Server.2.2.3 使用命令行启动GlassFish服务器要从命令行启动GlassFish服务器, 打开一个终端窗口或命令提示框并执行以下操作:asadm…

Java EE 7 教程 第一部分 简介 第2章 使用教程示例 第2.1节 需要的软件
type: item
date: 2014-04-24T13:11:00+00:00
description: 原文：http://docs.oracle.com/javaee/7/tutorial/doc/usingexamples001.htm翻译：石卓林 shizhuolin@hotmail.com2.1 Required SoftwareThe following software is required to run the examples:Java Platform, Standard EditionJava EE 7 Software Development KitJava EE 7 Tutorial ComponentNetBeans IDEApache Maven2.1 需要的软件以下是运行示例需要的软件:Java平台,标准版Java EE 7软件开发工具包Java EE 7教程组件NetBeans IDEApache Maven2.1.1 Java Platform, Standard EditionTo build, deploy, and run the examples, you need a copy of the Java Platform, Standard Edition 7 Development Kit (JDK 7). Some distributions of the Java EE 7 SDK include JDK 7. You can download JDK 7 software separately from http://www.oracle.com/technetwork/java/javase/downloads/index.html.2.1.1 Java平台,标准版要构建，部署和运行此示例, 你需要一个Java平台副本, 标准版 7开发工具包(JDK 7). 在一些Java EE 7 SDK发行版中包含JDK 7. 你可以在 http://www.oracle.com/technetwork/java/javase/downloads/index.html 单独下载JDK7.2.1.2 Java EE 7 Software Development KitGlassFish Server Open Source Edition 4 is targeted as the build and runtime environment for the tutorial examples. To build, deploy, and run the examples, you need a copy of GlassFish Server and, optionally, NetBeans IDE. To obtain GlassFish Server, you must install the Java EE 7 Software Development Kit (SDK), which you can download from http://www.oracle.com/technetwork/java/javaee/downloads/index.html. Make sure that you download the Java EE 7 SDK, not the Java EE 7 Web Profile SDK. There are distributions of the Java EE 7 SDK with and without the Java Platform, Standard Edition 7 Development Kit.2.1.2 Java EE 7软件开发工具包GlassFish服务器开源版4是针对本示例的构建和运行环境.要构建，部署和运行本示例, 你需要一份GlassFish服务器副本和可选的NetBeans IDE. 要获得GlassFish服务器,你必须安装Java EE 7软件开发工具包(SDK), 你可以在 http://www.oracle.com/technetwork/java/javaee/downloads/index.html 下载这些软件. 确认你下载的是Java EE 7 SDK而不是Java EE 7 Web Profile SDK. 这些是Java EE 7 SDK发行而不是Java平台标准版7软件开发包.2.1.2.1 SDK Installation TipsDo the following during the installation of the SDK.Allow the installer to download and configure the Update Tool. If you access th…

Java EE 7 教程 第一部分 简介 第2章 使用教程示例
type: item
date: 2014-04-24T12:58:00+00:00
description: 原文：http://docs.oracle.com/javaee/7/tutorial/doc/usingexamples.htm翻译：石卓林 shizhuolin@hotmail.com2 Using the Tutorial ExamplesThis chapter tells you everything you need to know to install, build, and run the examples.The following topics are addressed here:Required SoftwareStarting and Stopping GlassFish ServerStarting the Administration ConsoleStarting and Stopping the Java DB ServerBuilding the ExamplesTutorial Example Directory StructureJava EE 7 Maven Archetypes in the TutorialGetting the Latest Updates to the TutorialDebugging Java EE Applications2 使用教程示例本章将告诉你你需要知道的安装，构建和运行示例的一切.以下是话题链接:需要的软件启动和停止GlassFish服务器启动管理控制台启动和停止Java DB服务器构建示例学习示例的目录结构教程中的Java EE 7 Maven原型获取最新的教程更新调试Java EE应用程序

Java EE 7 教程 第一部分 简介 第1章 概述 第1.9节 GlassFish服务器工具
type: item
date: 2014-04-24T12:00:00+00:00
description: 原文：http://docs.oracle.com/javaee/7/tutorial/doc/overview009.htm翻译：石卓林 shizhuolin@hotmail.com1.9 GlassFish Server ToolsGlassFish Server is a compliant implementation of the Java EE 7 platform. In addition to supporting all the APIs described in the previous sections, GlassFish Server includes a number of Java EE tools that are not part of the Java EE 7 platform but are provided as a convenience to the developer.This section briefly summarizes the tools that make up GlassFish Server. Instructions for starting and stopping GlassFish Server, starting the Administration Console, and starting and stopping the Java DB server are in Chapter 2, "Using the Tutorial Examples".GlassFish Server contains the tools listed in Table 1-1. Basic usage information for many of the tools appears throughout the tutorial. For detailed information, see the online help in the GUI tools. *Table 1-1 GlassFish Server Tools* Tool Description Administration Console A web-based GUI GlassFish Server administration utility. Used to stop GlassFish Server and to manage users, resources, and applications. asadmin A command-line GlassFish Server administration utility. Used to start and stop GlassFish Server and to manage users, resources, and applications. appclient A command-line tool that launches the application client container and invokes the client application packaged in the application client JAR file. capture-schema A command-line tool to extract schema information from a database, producing a schema file that GlassFish Server can use for container-managed persistence. package-appclient A command-line tool to package the application client container libraries and JAR files. Java DB database A copy of the Java DB server. xjc A command-line tool to transform, or bind, a source XML schema to a set of JAXB content classes in the Java programming language. schemagen A command-line tool to create a schema file for each namespace referenced in your Java classes. wsimport A command-line tool to genera…

Java EE 7 教程 第一部分 简介 第1章 概述 第1.8节 Java平台中的Java EE 7 API, 标准版7
type: item
date: 2014-04-24T05:03:00+00:00
description: 原文：http://docs.oracle.com/javaee/7/tutorial/doc/overview008.htm翻译：石卓林 shizhuolin@hotmail.com1.8 Java EE 7 APIs in the Java Platform, Standard Edition 7Several APIs that are required by the Java EE 7 platform are included in the Java Platform, Standard Edition 7 (Java SE 7) and are thus available to Java EE applications.1.8 Java平台中的Java EE 7 API, 标准版 7Java EE 7平台所必须的Several API包含在Java平台标准版7(Java SE 7)中,从而可用于Java EE应用.1.8.1 Java Database Connectivity APIThe Java Database Connectivity (JDBC) API lets you invoke SQL commands from Java programming language methods. You use the JDBC API in an enterprise bean when you have a session bean access the database. You can also use the JDBC API from a servlet or a JSP page to access the database directly without going through an enterprise bean.The JDBC API has two parts:An application-level interface used by the application components to access a databaseA service provider interface to attach a JDBC driver to the Java EE platformThe Java SE 7 platform requires JDBC 4.1.1.8.1 Java数据库连接APIJava数据库连接(JDBC) API让你可以在Java程序语言方法中调用SQL命令. 当你有一个会话bean访问数据库时你可以在企业bean中使用JDBC API. 当然你也可以在servlet或jsp页面中使用JDBC API直接连接数据库而不需要通过企业bean.JDBC API包含两部分:一个用于应用组件访问数据库的应用级接口一个用于在Java EE平台中附加JDBC驱动的服务提供接口Java SE 7平台要求JDBC 4.1.1.8.2 Java Naming and Directory Interface APIThe Java Naming and Directory Interface (JNDI) API provides naming and directory functionality, enabling applications to access multiple naming and directory services, such as LDAP, DNS, and NIS. The JNDI API provides applications with methods for performing standard directory operations, such as associating attributes with objects and searching for objects using their attributes. Using JNDI, a Java EE application can store and retrieve any type of named Java object, allowing Java EE applications to coexist with many legacy applications and systems.Java EE naming services provide application clients, enterprise beans, and web components with access to a JNDI naming environment. A naming…

Java EE 7 教程 第一部分 简介 第1章 概述 第1.7节 Java EE 7 APIs
type: item
date: 2014-04-16T15:27:00+00:00
description: 原文：http://docs.oracle.com/javaee/7/tutorial/doc/overview007.htm翻译：石卓林 shizhuolin@hotmail.com注意：此章是1.8章前移而来,不知为何oracle删除了原1.7开发角色章节1.7 Java EE 7 APIsFigure 1-6 shows the relationships among the Java EE containers.Figure 1-6 Java EE ContainersDescription of "Figure 1-6 Java EE Containers"Figure 1-7 shows the availability of the Java EE 7 APIs in the web container.Figure 1-7 Java EE APIs in the Web ContainerDescription of "Figure 1-7 Java EE APIs in the Web Container"Figure 1-8 shows the availability of the Java EE 7 APIs in the EJB container.Figure 1-8 Java EE APIs in the EJB ContainerDescription of "Figure 1-8 Java EE APIs in the EJB Container"Figure 1-9 shows the availability of the Java EE 7 APIs in the application client container.Figure 1-9 Java EE APIs in the Application Client ContainerDescription of "Figure 1-9 Java EE APIs in the Application Client Container"The following sections give a brief summary of the technologies required by the Java EE platform and the APIs used in Java EE applications.1.7 Java EE 7 APIs图 1-6 显示了Java EE容器之间的关系.图 1-6 Java EE 容器"图 1-6 Java EE 容器"简介图 1-7 显示了在web容器中可以使用的Java EE 7 APIs.图 1-7 Web容器中的 Java EE APIs"图 1-7 Web容器中的 Java EE APIs"简介图 1-8 显示了在EJB容器中可用的Java EE 7 APIs.图 1-8 EJB容器中的Java EE APIs"图 1-8 EJB容器中的Java EE APIs"简介图 1-9显示了在应用客户端容器中可用的Java EE 7 APIs.图 1-9 应用客户端容器中的Java EE 7 APIs"图 1-9 应用客户端容器中的Java EE 7 APIs"简介以下章节简要叙述了Java EE平台所需技术和Java EE应用中使用的APIs.1.7.1 Enterprise JavaBeans TechnologyAn Enterprise JavaBeans (EJB) component, or enterprise bean, is a body of code that has fields and methods to implement modules of business logic. You can think of an enterprise bean as a building block that can be used alone or with other enterprise beans to execute business logic on the Java EE server.Enterprise beans are either session beans or message-driven beans.A session bean represents a transient conversation with a client. When the client finishes executing, the session bean and its data are gone.A message-driven bean combines feature…

在Yaf中使用Zf2的配置和服务管理器
type: item
date: 2014-04-05T11:23:00+00:00
description: 测试条件: I3 380M + 4G + Windows7 + iis7 + PHP5.4(fastcgi) + Zend2.3网站设置: 使用默认的模块和控制器,配置config和module缓存. 不连接任何服务和数据库.为避免带宽不足清空view测试软件: Jmeter 20并发用户.测试机和被测试机是不同的电脑，它们之间用100M5类线直连在测试结果中,平均响应时间需要0.637秒,每秒处理30个请求.这个数据比zf1低一半. 同一台机zf1可以达到每秒60多个请求我看到这个测试结果后有点想放弃zf2,可是在开发灵活和便捷性上zf2确实要比zf1要好得多. 分析发现,在zf2中路由，派遣和服务注册，模块注册拖累了整个速度. 以前做项目用到过yaf,发现yaf性能挺好的,于是计划用yaf代替zf2的mvc模块.一. 在yaf项目中加载zf2类库首先你得有一个能正常运行的yaf项目.在这个基础上改动以增加zf2支持.可以参考yaf官方教程做一个yaf的基本架构站点. 这里假设你已按照官方教程架设好yaf站点1. 在yaf项目中使用composeryaf官网示范中默认没有zf2的类加载器，考虑到今后还要加载其它的类库代码，这里使用composer加载zf2依赖. 要在yaf项目中引用composer需要对yaf项目的/public/index.php和/conf/application.ini做少量改动.<?php /** * This makes our life easier when dealing with paths. Everything is relative * to the application root now. */ chdir(dirname(__DIR__)); // Decline static file requests back to the PHP built-in webserver if (php_sapi_name() === 'cli-server' && is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))) { return false; } // Setup autoloading require 'init_autoloader.php'; // Define path to application directory define("APP_PATH", dirname(__DIR__)); // Create application, bootstrap, and run $app = new Yaf_Application(APP_PATH . "/conf/application.ini"); $app->bootstrap() ->run();改动后的文件和yaf默认文件主要的区别:要增加chdir(dirname(__DIR__)). 目的是让zf2能正常读取配置文件require 'init_autoloader.php'; 这个文件是在ZendSkeletonApplication.zip中复制出来的，目的是引用composer, zf2类库就要通过这个文件加载进来.$app->bootstrap() 必须要有引导器，因为后面要在bootstrap里面加载zf2配置和服务因为yaf默认会禁用spl加载器，这会造成无法加载非yaf前缀命名的类.所以我们还需要更改yaf运行配置.在/conf/application.ini中设置 application.system.use_spl_autoload = true[product] application.directory = APP_PATH "/application/" application.dispatcher.catchException = true application.system.use_spl_autoload = true总结一下，你需要更改 index.php,application.ini增加init_autoloader.php文件，哦!别忘记了编辑composer.json在其中增加zf2依赖配置. 我这里用的是zf2.3. 然后更新composer依赖. 等待composer依赖更新完成后测试项目，看看在yaf项目中是否可以用zf2的类库,这里应该可以引用，如果还是不行就请下载本文后面提供的完整代码.<?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/Z…

Java EE 7 教程 第一部分 简介 第1章 概述 第1.7节 开发角色
type: item
date: 2014-04-01T09:44:00+00:00
description: 原文：http://docs.oracle.com/javaee/7/tutorial/doc/overview007.htm翻译：石卓林 shizhuolin@hotmail.com1.7 Development RolesReusable modules make it possible to divide the application development and deployment process into distinct roles so that different people or companies can perform different parts of the process.The first two roles, Java EE product provider and tool provider, involve purchasing and installing the Java EE product and tools. After software is purchased and installed, Java EE components can be developed by application component providers, assembled by application assemblers, and deployed by application deployers. In a large organization, each of these roles might be executed by different individuals or teams. This division of labor works because each of the earlier roles outputs a portable file that is the input for a subsequent role. For example, in the application component development phase, an enterprise bean software developer delivers EJB JAR files. In the application assembly role, another developer may combine these EJB JAR files into a Java EE application and save it in an EAR file. In the application deployment role, a system administrator at the customer site uses the EAR file to install the Java EE application into a Java EE server.The different roles are not always executed by different people. If you work for a small company, for example, or if you are prototyping a sample application, you might perform tasks in every phase.1.7 开发角色可重复使用的模块制作尽可能划分为不同的应用开发和部署过程以分配给不同的角色,让不同的人或公司可以执行其过程的不同部分.前两个角色, Java EE产品提供商和工具提供商,涉及购买和安装Java EE产品与工具, 在购买并安装软件后,Java EE组件可以由应用组件开发人员开发, 由应用装配人员打包, 由应用部署人员部署. 在大型组织中.每个角色可以由不同的个人或团队来执行.在分工工作中，因为每个角色前面的输出文件是后续作用的输入. 例如,在应用组件的开发阶段，企业Bean软件开发人员提供EJB JAR文件.在应用打包过程中，另一个开发人员可以将这些EJB JAR文件包含到Java EE应用程序中并将其保存为一个EAR文件。在应用部署时，系统管理员在客户现场把EAR文件格式的Java EE应用程序安装到Java EE服务器.不同的角色并不总是由不同的人执行.如果你工作在一家小公司，例如，或者如果你是编写一个示例应用程序，您可能会执行每一个阶段任务.1.7.1 Java EE Product ProviderThe Java EE product provider is the company that designs and m…