Version 4

    EJB 3.0 TrailBlazer: Hike 2: Service Object Management

     

    &12495;&12452;&12461;&12531;&12464;&65298;&65306;&12469;&12540;&12499;&12473;&12458;&12502;&12472;&12455;&12463;&12488;&12398;&31649;&29702;

     

    Service object management is a core service provided by any Application Server. Compared with application-managed regular Java objects, container managed service objects have some key advantages.

     

    &12469;&12540;&12499;&12473;&12458;&12502;&12472;&12455;&12463;&12488;&31649;&29702;&12399;&12289;&12393;&12398;&12450;&12503;&12522;&12465;&12540;&12471;&12519;&12531;&12469;&12540;&12496;&12395;&12418;&20633;&12431;&12387;&12390;&12356;&12427;&12467;&12450;&12469;&12540;&12499;&12473;&12391;&12377;&12290;&12450;&12503;&12522;&12465;&12540;&12471;&12519;&12531;&12364;&31649;&29702;&12377;&12427;&19968;&33324;&12398;Java&12458;&12502;&12472;&12455;&12463;&12488;&12392;&27604;&12409;&12289;&12467;&12531;&12486;&12490;&12398;&31649;&29702;&12377;&12427;&12469;&12540;&12499;&12473;&12458;&12502;&12472;&12455;&12463;&12488;&12395;&12399;&20197;&19979;&12398;&12424;&12358;&12394;&12356;&12367;&12388;&12363;&12398;&37325;&35201;&12394;&20778;&20301;&24615;&12364;&12354;&12426;&12414;&12377;&12290;

     

    • Loose coupling: Since the client application does not directly instantiate the service objects, it does not need to know the name of the implementation class. It only needs to know the service interface and look up the service stub object from the server using the interface name or a pre-argeed string name. That allows the server to support multiple alternative service implementations without code changes in the client.

     

    • &30094;&32080;&21512;&65306;&12463;&12521;&12452;&12450;&12531;&12488;&12450;&12503;&12522;&12465;&12540;&12471;&12519;&12531;&12364;&30452;&25509;&12469;&12540;&12499;&12473;&12458;&12502;&12472;&12455;&12463;&12488;&12434;&12452;&12531;&12473;&12479;&12531;&12473;&21270;&12377;&12427;&12371;&12392;&12399;&28961;&12356;&12398;&12391;&12289;&12463;&12521;&12452;&12450;&12531;&12488;&12399;&23455;&35013;&12463;&12521;&12473;&12398;&21517;&21069;&12434;&30693;&12427;&24517;&35201;&12399;&12354;&12426;&12414;&12379;&12435;&12290;&24517;&35201;&12394;&12398;&12399;&12469;&12540;&12499;&12473;&12452;&12531;&12479;&12501;&12455;&12540;&12473;&12398;&12415;&12391;&12289;&12452;&12531;&12479;&12501;&12455;&12540;&12473;&21517;&12414;&12383;&12399;&20107;&21069;&12395;&23450;&12417;&12383;&25991;&23383;&21015;&12391;&12289;&12469;&12540;&12496;&12363;&12425;&12469;&12540;&12499;&12473;&12398;&12473;&12479;&12502;&12458;&12502;&12472;&12455;&12463;&12488;&12434;&12523;&12483;&12463;&12450;&12483;&12503;&12377;&12427;&12384;&12369;&12391;&12377;&12290;&12371;&12358;&12377;&12427;&12371;&12392;&12391;&12289;&12463;&12521;&12452;&12450;&12531;&12488;&12398;&12467;&12540;&12489;&12434;&22793;&26356;&12379;&12378;&12395;&12469;&12540;&12499;&12473;&23455;&35013;&12434;&35079;&25968;&25552;&20379;&12377;&12427;&12371;&12392;&12364;&12391;&12365;&12427;&12398;&12391;&12377;&12290;

     

    • Network independent: The server services can be provided over almost any network transport, including HTTP, TCP, and messaging queues. The service can also be offered by any number of clustered servers. The client just looks up a stub of service object and call any method defined in the service interface as if it is a local call. The call is automatically routed via the right network transport (or via local reference if the client and server are in the same JVM) to the right server node.

     

    • &12493;&12483;&12488;&12527;&12540;&12463;&38750;&20381;&23384;&65306;&12469;&12540;&12499;&12473;&12399;&12289;HTTP&12289;TCP&12289;&12513;&12483;&12475;&12540;&12472;&12461;&12517;&12540;&12394;&12393;&12289;&12411;&12392;&12435;&12393;&12354;&12425;&12422;&12427;&12493;&12483;&12488;&12527;&12540;&12463;&12488;&12521;&12531;&12473;&12509;&12540;&12488;&32076;&30001;&12391;&21033;&29992;&12391;&12365;&12414;&12377;&12290;&12414;&12383;&12289;&12469;&12540;&12499;&12473;&12399;&35079;&25968;&21488;&27083;&25104;&12398;&12463;&12521;&12473;&12479;&29872;&22659;&12391;&12418;&21033;&29992;&12391;&12365;&12414;&12377;&12290;&12463;&12521;&12452;&12450;&12531;&12488;&12399;&12469;&12540;&12499;&12473;&12398;&12473;&12479;&12502;&12458;&12502;&12472;&12455;&12463;&12488;&12434;&12523;&12483;&12463;&12450;&12483;&12503;&12375;&12289;&12525;&12540;&12459;&12523;&12452;&12531;&12479;&12501;&12455;&12540;&12473;&12392;&21516;&12376;&12424;&12358;&12395;&12469;&12540;&12499;&12473;&12452;&12531;&12479;&12501;&12455;&12540;&12473;&12398;&12513;&12477;&12483;&12489;&12434;&21628;&12406;&12384;&12369;&12391;&12377;&12290;&12513;&12477;&12483;&12489;&12398;&21628;&12403;&20986;&12375;&12399;&12289;&36969;&20999;&12394;&12493;&12483;&12488;&12527;&12540;&12463;&12488;&12521;&12531;&12473;&12509;&12540;&12488;&12434;&32076;&30001;{FOOTNOTE DEF 1 1}&12375;&12390;&33258;&21205;&30340;&12395;&36969;&20999;&12394;&12469;&12540;&12496;&12395;&12523;&12540;&12486;&12451;&12531;&12464;&12373;&12428;&12414;&12377;&12290;

     

    {FOOTNOTE RED #1 1} (or via local reference if the client and server are in the same JVM)&12364;&25244;&12369;&12390;&12414;&12377; -tokobayashi

     

    • Resource pools: By managing the service objects, the server controls and manages critical resources centrally. The client application does not need to remember to destroy objects or close connections etc. The server could also create and maintain a pool of service objects to avoid excessive object creation operations.

     

    • &12522;&12477;&12540;&12473;&12539;&12503;&12540;&12523;&65306;&12469;&12540;&12499;&12473;&12458;&12502;&12472;&12455;&12463;&12488;&12434;&31649;&29702;&12377;&12427;&12371;&12392;&12391;&12289;&12469;&12540;&12496;&12399;&37325;&35201;&12394;&12522;&12477;&12540;&12473;&12434;&38598;&20013;&31649;&29702;&12377;&12427;&12371;&12392;&12364;&12391;&12365;&12414;&12377;&12290;&12463;&12521;&12452;&12450;&12531;&12488;&12450;&12503;&12522;&12465;&12540;&12471;&12519;&12531;&12399;&12289;&12458;&12502;&12472;&12455;&12463;&12488;&12434;&21066;&38500;&12375;&12383;&12426;&12467;&12493;&12463;&12471;&12519;&12531;&12434;&12463;&12525;&12540;&12474;&12375;&12383;&12426;&12377;&12427;&12371;&12392;&12395;&29033;&12431;&12373;&12428;&12427;&12371;&12392;&12399;&12354;&12426;&12414;&12379;&12435;&12290;&12469;&12540;&12496;&12399;&12469;&12540;&12499;&12473;&12458;&12502;&12472;&12455;&12463;&12488;&12434;&20316;&25104;&12375;&12390;&12503;&12540;&12522;&12531;&12464;&12375;&12289;&20313;&20998;&12394;&12458;&12502;&12472;&12455;&12463;&12488;&29983;&25104;&12434;&36605;&28187;&12375;&12414;&12377;&12290;

     

    In EJB 3.0, all the managed service objects are POJOs (e.g., session beans) or very lightweight components (e.g., message driven beans). In addition to EJB 3.0 standard components, the JBoss EJB 3.0 extension further supports JMX POJOs and message driven POJOs, which allow us to invoke POJO methods over the JMX bus or message channels. The configurations for those managed service objects are declared in simple annotations. The trails in this hike cover how to develop container-managed service objects in JBoss application server. You will learn about the architectural models and annotations. In the last trail, we will also discuss how to use the dependency injection design pattern to make service objects automatically available for applications.

     

    EJB 3.0&12391;&12399;&12289;&31649;&29702;&23550;&35937;&12398;&12469;&12540;&12499;&12473;&12458;&12502;&12472;&12455;&12463;&12488;&12399;&12377;&12409;&12390;&12289;POJO&65288;&12383;&12392;&12360;&12400;&12475;&12483;&12471;&12519;&12531;Bean&65289;&12414;&12383;&12399;&38750;&24120;&12395;&36605;&37327;&12394;&12467;&12531;&12509;&12540;&12493;&12531;&12488;&65288;&12383;&12392;&12360;&12400;&12513;&12483;&12475;&12540;&12472;&39366;&21205;&22411;Bean&65289;&12391;&12377;&12290;EJB 3.0&12398;&27161;&28310;&12467;&12531;&12509;&12540;&12493;&12531;&12488;&12395;&21152;&12360;&12289;JBoss EJB 3.0&25313;&24373;&27231;&33021;&12391;&12399;&12373;&12425;&12395;JMX&12398;POJO&12420;&12513;&12483;&12475;&12540;&12472;&39366;&21205;&22411;POJO&12434;&12469;&12509;&12540;&12488;&12375;&12390;&12362;&12426;&12289;JMX&12496;&12473;&12420;&12513;&12483;&12475;&12540;&12472;&12481;&12515;&12493;&12523;&12434;&20171;&12375;&12390;POJO&12434;&36215;&21205;&12391;&12365;&12427;&20181;&32068;&12415;&12434;&25552;&20379;&12375;&12390;&12356;&12414;&12377;&12290;&31649;&29702;&23550;&35937;&12398;&12469;&12540;&12499;&12473;&12458;&12502;&12472;&12455;&12463;&12488;&12398;&35373;&23450;&12399;&12289;&31777;&21336;&12394;&12450;&12494;&12486;&12540;&12471;&12519;&12531;&12391;&23459;&35328;&12375;&12414;&12377;&12290;&12371;&12398;&12495;&12452;&12461;&12531;&12464;&12398;&12488;&12524;&12452;&12523;&12391;&12399;&12289;JBoss&12450;&12503;&12522;&12465;&12540;&12471;&12519;&12531;&12469;&12540;&12496;&12395;&12362;&12369;&12427;&12467;&12531;&12486;&12490;&31649;&29702;&12469;&12540;&12499;&12473;&12458;&12502;&12472;&12455;&12463;&12488;&12398;&38283;&30330;&26041;&27861;&12395;&12388;&12356;&12390;&23398;&32722;&12375;&12414;&12377;&12290;&26368;&24460;&12398;&12488;&12524;&12452;&12523;&12391;&12399;&12289;&20381;&23384;&24615;&27880;&20837;&12398;&12487;&12470;&12452;&12531;&12497;&12479;&12540;&12531;&12395;&12388;&12356;&12390;&12418;&35696;&35542;&12375;&12289;&12469;&12540;&12499;&12473;&12458;&12502;&12472;&12455;&12463;&12488;&12434;&33258;&21205;&30340;&12395;&12450;&12503;&12522;&12465;&12540;&12471;&12519;&12531;&12391;&21033;&29992;&12391;&12365;&12427;&12424;&12358;&12395;&12377;&12427;&26041;&27861;&12434;&23398;&12403;&12414;&12377;&12290;

     

    ステートレスセッションBean

     

    This trail illustrates how to develop and use EJB 3.0 stateless session beans. Those beans can be used to build the programming interface between the middleware and the front-end servlets or rich UI clients.

     

    &12371;&12398;&12488;&12524;&12452;&12523;&12391;&12399;&12289;EJB 3.0&12398;&12473;&12486;&12540;&12488;&12524;&12473;&12475;&12483;&12471;&12519;&12531;Bean&12395;&12388;&12356;&12390;&23398;&32722;&12375;&12414;&12377;&12290;&12473;&12486;&12540;&12488;&12524;&12473;&12475;&12483;&12471;&12519;&12531;Bean&12399;&12289;&12511;&12489;&12523;&12454;&12455;&12450;&12392;&12501;&12525;&12531;&12488;&12456;&12531;&12489;&12398;&12469;&12540;&12502;&12524;&12483;&12488;&12392;&12398;&38291;&12289;&12414;&12383;&12399;&12522;&12483;&12481;&12518;&12540;&12470;&12452;&12531;&12479;&12501;&12455;&12540;&12473;&12463;&12521;&12452;&12450;&12531;&12488;&12392;&12398;&38291;&12398;&12503;&12525;&12464;&12521;&12511;&12531;&12464;&12452;&12531;&12479;&12501;&12455;&12540;&12473;&12398;&27083;&31689;&12395;&21033;&29992;&12375;&12414;&12377;&12290;

     

    ステートフルセッションBean

     

    This trail disucsses how to build and use EJB 3.0 stateful session beans, which have field variables tied to a specific client session (e.g., an HTTP session). Those beans are very useful in session-based web applications (e.g., a shopping cart).

     

    &12371;&12398;&12488;&12524;&12452;&12523;&12391;&12399;&12289;EJB 3.0&12398;&12473;&12486;&12540;&12488;&12501;&12523;&12475;&12483;&12471;&12519;&12531;Bean&12395;&12388;&12356;&12390;&35696;&35542;&12375;&12414;&12377;&12290;&12473;&12486;&12540;&12488;&12501;&12523;&12475;&12483;&12471;&12519;&12531;Bean&12399;&29305;&23450;&12398;&12463;&12521;&12452;&12450;&12531;&12488;&12475;&12483;&12471;&12519;&12531;&65288;&12383;&12392;&12360;&12400;HTTP&12475;&12483;&12471;&12519;&12531;&65289;&12395;&32080;&12403;&20184;&12369;&12425;&12428;&12383;&12501;&12451;&12540;&12523;&12489;&20516;{FOOTNOTE DEF 2 2}&12434;&25345;&12385;&12414;&12377;&12290;&12473;&12486;&12540;&12488;&12501;&12523;&12475;&12483;&12471;&12519;&12531;Bean&12399;&12475;&12483;&12471;&12519;&12531;&12434;&12505;&12540;&12473;&12392;&12375;&12383;Web&12450;&12503;&12522;&12465;&12540;&12471;&12519;&12531;&65288;&12383;&12392;&12360;&12400;&12471;&12519;&12483;&12500;&12531;&12464;&12459;&12540;&12488;&65289;&12395;&26368;&36969;&12391;&12377;&12290;

     

    {FOOTNOTE RED #2 2} &8594;&12501;&12451;&12540;&12523;&12489;&22793;&25968; -tokobayashi

     

    セッションBeanのライフサイクル

     

    This trail discusses how the EJB 3.0 container creates, activates, destroyes session bean instances. We will cover callback methods you can use to automate the bean behavior in its life cycle.

     

    &12371;&12398;&12488;&12524;&12452;&12523;&12391;&12399;&12289;EJB 3.0&12467;&12531;&12486;&12490;&12364;&12393;&12398;&12424;&12358;&12395;&12475;&12483;&12471;&12519;&12531;Bean&12398;&12452;&12531;&12473;&12479;&12531;&12473;&12434;&29983;&25104;&12289;&36215;&21205;&12289;&21066;&38500;&12377;&12427;&12363;&12395;&12388;&12356;&12390;&35696;&35542;&12375;&12414;&12377;&12290;&12475;&12483;&12471;&12519;&12531;Bean&12398;&12521;&12452;&12501;&12469;&12452;&12463;&12523;&12395;&12362;&12369;&12427;&25391;&12427;&33310;&12356;&12434;&33258;&21205;&21270;&12377;&12427;&12467;&12540;&12523;&12496;&12483;&12463;&12513;&12477;&12483;&12489;&12395;&12388;&12356;&12390;&12418;&25201;&12356;&12414;&12377;&12290;

     

    JMXサービスオブジェクト

     

    Internally, the core of the JBoss Application Server is a JMX (Java Management eXtension) server. All JBoss services are configured as MBeans and registered with the JMX server. This trail covers how to use the JBoss EJB 3.0 extension to quickly develop MBean services.

     

    JBoss&12450;&12503;&12522;&12465;&12540;&12471;&12519;&12531;&12469;&12540;&12496;&12399;&20869;&37096;&30340;&12395;&12399;JMX&65288;Java Management eXtension&65289;&12469;&12540;&12496;&12391;&12377;&12290;&12377;&12409;&12390;&12398;JBoss&12469;&12540;&12499;&12473;&12399;&12289;JMX&12469;&12540;&12496;&12395;&30331;&37682;&12373;&12428;&12383;MBean&12392;&12375;&12390;&21205;&20316;&12375;&12414;&12377;&12290;&12371;&12398;&12488;&12524;&12452;&12523;&12391;&12399;JBoss EJB 3.0&25313;&24373;&27231;&33021;&12434;&20351;&29992;&12375;&12390;&12289;MBean&12469;&12540;&12499;&12473;&12434;&36805;&36895;&12395;&38283;&30330;&12377;&12427;&26041;&27861;&12395;&12388;&12356;&12390;&12418;&25201;&12356;&12414;&12377;&12290;

     

    メッセージ駆動型Bean

     

    This trail discusses the EJB 3.0 Message Driven Beans (MDBs), which serve as JMS endpoints in enterprise applications.

     

    &12371;&12398;&12488;&12524;&12452;&12523;&12391;&12399;&12289;EJB 3.0&12398;&12513;&12483;&12475;&12540;&12472;&39366;&21205;&22411;Bean&65288;MDB&65289;&12395;&12388;&12356;&12390;&35696;&35542;&12375;&12414;&12377;&12290;&12513;&12483;&12475;&12540;&12472;&39366;&21205;&22411;Bean&12399;&12456;&12531;&12479;&12540;&12503;&12521;&12452;&12474;&12450;&12503;&12522;&12465;&12540;&12471;&12519;&12531;&12395;&12362;&12356;&12390;JMS&12398;&32066;&31471;&12392;&12375;&12390;&27231;&33021;&12375;&12414;&12377;&12290;

     

    メッセージ駆動型POJO

     

    This trail introduces the JBoss message driven POJOs. You can construct end-to-end and fully typed messaging applications using message driven POJOs.

     

    &12371;&12398;&12488;&12524;&12452;&12523;&12391;&12399;&12289;JBoss&12398;&12513;&12483;&12475;&12540;&12472;&39366;&21205;&22411;POJO&12395;&12388;&12356;&12390;&32057;&20171;&12375;&12414;&12377;&12290;&12513;&12483;&12475;&12540;&12472;&39366;&21205;&22411;POJO&12434;&20351;&29992;&12375;&12390;&32066;&31471;&38291;&12391;&12391;fully typed&65288;&35379;&27880;&65306;&65311;&65289;{FOOTNOTE DEF 3 3}&12394;&12513;&12483;&12475;&12540;&12472;&12531;&12464;&12450;&12503;&12522;&12465;&12540;&12471;&12519;&12531;&12434;&27083;&31689;&12377;&12427;&12371;&12392;&12364;&12391;&12365;&12414;&12377;&12290;

     

    {FOOTNOTE RED #3 3} &12300;&22411;&20184;&12369;&12373;&12428;&12383;&12301;&12363;&12394;�&26222;&36890;&12398;java&12398;&12513;&12477;&12483;&12489;&21628;&12403;&20986;&12375;&12473;&12479;&12452;&12523;&12391;&20351;&12360;&12427;&12371;&12392;&12434;&25351;&12375;&12390;&12356;&12427;&12392;&24605;&12356;&12414;&12377;&12290; -tokobayashi

     

    サービスオブジェクトの注入

     

    This trail discusses how to wire service objects altogether to construct an application. Compared with JNDI lookup, the dependency injection pattern makes the wiring much easier and allows more flexible application architecture. EJB 3.0 provides excellent support for dependency injection via annotations.

     

    &12371;&12398;&12488;&12524;&12452;&12523;&12391;&12399;&12289;&12393;&12398;&12424;&12358;&12395;&12469;&12540;&12499;&12473;&12458;&12502;&12472;&12455;&12463;&12488;&12434;&32080;&21512;&12375;&12390;&12450;&12503;&12522;&12465;&12540;&12471;&12519;&12531;&12434;&27083;&31689;&12377;&12427;&12363;&12395;&12388;&12356;&12390;&35696;&35542;&12375;&12414;&12377;&12290;&20381;&23384;&24615;&27880;&20837;&12398;&12487;&12470;&12452;&12531;&12497;&12479;&12540;&12531;&12399;JNDI&12398;&12523;&12483;&12463;&12450;&12483;&12503;&12395;&27604;&12409;&12289;&12399;&12427;&12363;&12395;&23481;&26131;&12394;&32080;&21512;&12364;&21487;&33021;&12391;&12289;&12450;&12503;&12522;&12465;&12540;&12471;&12519;&12531;&27083;&36896;&12434;&12424;&12426;&26580;&36575;&12395;&12375;&12414;&12377;&12290;EJB 3.0&12391;&12399;&12289;&12450;&12494;&12486;&12540;&12471;&12519;&12531;&12434;&29992;&12356;&12383;&20381;&23384;&24615;&27880;&20837;&12434;&24375;&21147;&12395;&12469;&12509;&12540;&12488;&12375;&12414;&12377;&12290;

     

    (c)2002-2005 JBoss Inc. All rights reserved. JBoss is a registered trademark and servicemark of JBoss, Inc.

    Privacy Policy