~ubuntu-branches/ubuntu/quantal/netbeans/quantal

« back to all changes in this revision

Viewing changes to j2ee/platform/javahelp/org/netbeans/modules/j2ee/platform/docs/enterprise/general/service_locator.html

  • Committer: Bazaar Package Importer
  • Author(s): Marek Slama
  • Date: 2008-01-29 14:11:22 UTC
  • Revision ID: james.westby@ubuntu.com-20080129141122-fnzjbo11ntghxfu7
Tags: upstream-6.0.1
Import upstream version 6.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
2
<!--
 
3
 *        Copyright � 2007 Sun Microsystems, Inc. All rights reserved. 
 
4
 *        Use is subject to license terms.
 
5
> -->
 
6
<html>
 
7
<head>
 
8
 
 
9
<title>Using a Service Locator</title>
 
10
<link rel="StyleSheet" href="nbdocs://org.netbeans.modules.usersguide/org/netbeans/modules/usersguide/ide.css" type="text/css">
 
11
</head>
 
12
<body>
 
13
 
 
14
<h2>Using a Service Locator</h2>
 
15
<p><small> 
 
16
<a href="#seealso">See Also</a> 
 
17
</small></p> 
 
18
 
 
19
<p>A service locator is a class that provides a single, reusable way to obtain 
 
20
  a reference to the following:</p>
 
21
<ul>
 
22
  <li>An enterprise bean's local and/or remote home interfaces</li>
 
23
  <li>A JMS connection factory and topic destination</li>
 
24
  <li>An e-mail session</li>
 
25
  <li>A JDBC data source</li>
 
26
  <li>The URL, name, or boolean value for an environment entry</li>
 
27
</ul>
 
28
<p>You can create a regular service locator or one that caches the obtained reference 
 
29
  for further use. Generally you use a caching service regulator in web applications 
 
30
  and a regular service locator in the business tier. Enterprise beans especially 
 
31
  need non-caching service locators. Because each enterprise bean has a unique 
 
32
  JNDI name space, a resource reference with the same name can be declared in 
 
33
  multiple enterprise beans, potentially with different types.</p>
 
34
<p><b>To create a service locator:</b></p>
 
35
<ol>
 
36
  <li>Choose File &gt; New.</li>
 
37
  <li>From the Enterprise category, select Service Locator or Caching Service 
 
38
    Locator. </li>
 
39
</ol>
 
40
<p><b>To use a service locator:</b></p>
 
41
<ol>
 
42
  <li>Run any of the following commands: 
 
43
    <ul>
 
44
      <li>Call Enterprise Bean</li>
 
45
      <li>Use Database</li>
 
46
      <li>Send JMS Message</li>
 
47
      <li>Send E-Mail</li>
 
48
    </ul>
 
49
  </li>
 
50
  <li>In the Service Locator Strategy section, select Use Existing Class and specify 
 
51
    the class name of the service locator. You can use the Browse button to search 
 
52
    for the class.</li>
 
53
</ol>
 
54
<p><b>Notes:</b></p>
 
55
<ul>
 
56
  <li>The service locator template is fully functional. You do not need to modify 
 
57
    the code, although you can customize its caching behavior.</li>
 
58
  <li>You can only create a service locator in a web application project or EJB 
 
59
    module project.</li>
 
60
</ul>
 
61
<dl>
 
62
    <dt><a name="seealso">See Also</a></dt>
 
63
  <dd><a href="../../ejb/editing/call_ejb.html">Calling an Enterprise Bean</a></dd>
 
64
  <dd><a href="send_jms.html">Sending a JMS Message</a></dd>
 
65
  <dd><a href="use_db.html">Accessing a Connection Pool from a Java Class</a></dd>
 
66
  <dd><a href="send_email.html">Sending an E-mail from a Java File</a></dd>
 
67
</dl>
 
68
 
 
69
 
 
70
<hr>
 
71
<small><a href="../../credits.html">Legal Notices</a></small> 
 
72
<table cellpadding="50" border="0"> 
 
73
<tr><td>&nbsp;</td></tr> 
 
74
</table> 
 
75
 
 
76
  </body>
 
77
</html>