Initial Commit
[packages] / xemacs-packages / jde / lisp / jde-ejb.el
1 ;;; jde-ejb.el -- EJB Extensions to Java Development Environment for Emacs
2 ;; $Revision: 1.7 $
3
4 ;; Author: David T. Smith
5 ;; Maintainers: David T. Smith, Yoon Kyung Koo
6 ;; Keywords: java, tools, ejb
7
8 ;; Copyright (C) 2002, 2003, 2004, David T. Smith
9
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; Gnu Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24 ;;
25 ;; This module uses the concept of an Enterprise Java Bean as a component
26 ;; comprised of a class (xxxBean.java), a Remote Interface (xxx.java), a home
27 ;; interface (xxxHome.java), and a deployment descriptor (xxxEJB.xml).  These
28 ;; files are all interrelated and therefore, changes to one should be
29 ;; propagated to all.  The obvious thing is to treat it as an entity
30 ;; with appropriate linkages between the files.  In this version however, 
31 ;; I will simply provide a wizard to create all three elements and
32 ;; leave referential integrity alone.
33
34 (require 'jde-wiz)
35 (require 'jde-gen)
36
37
38 (defgroup jde-ejb nil
39   "JDE EJB Electric Class Builder"
40   :group 'jde
41   :prefix "jde-ejb-")
42
43 (defvar jde-current-ejb-name ""
44 "Name used by all EJB components.")
45
46 (defvar jde-current-ejb-package ""
47 "Package that contains all EJB components.")
48
49 (defvar jde-ejb-dir nil
50   "Directory containing all EJB components.")
51
52
53 ;; (makunbound 'jde-ejb-remote-format)
54 (defcustom jde-ejb-remote-format "%s.java"
55   "*Default format for EJB Remote Interface"
56   :type 'string
57   :group 'jde-ejb)
58
59 ;; (makunbound 'jde-ejb-home-format)
60 (defcustom jde-ejb-home-format "%sHome.java"
61   "*Default format for EJB Home Interface
62 Setting this also resets jde-ejb-home to the
63 name portion of the filename string."
64   :type 'string
65   :group 'jde-ejb
66   :set '(lambda (sym val)
67           (set-default 'jde-ejb-home
68                       (file-name-sans-extension val))
69           (set-default sym val)))
70
71 ;; (makunbound 'jde-ejb-local-format)
72 (defcustom jde-ejb-local-format "%sLocal.java"
73   "*Default format for EJB Local Interface"
74   :type 'string
75   :group 'jde-ejb
76   :set '(lambda (sym val)
77           (set-default 'jde-ejb-local
78                       (file-name-sans-extension val))
79           (set-default sym val)))
80
81 ;; (makunbound 'jde-ejb-local-home-format)
82 (defcustom jde-ejb-local-home-format "%sLocalHome.java"
83   "*Default format for EJB LocalHome Interface
84 Setting this also resets jde-ejb-local-home to the
85 name portion of the filename string."
86   :type 'string
87   :group 'jde-ejb
88   :set '(lambda (sym val)
89           (set-default 'jde-ejb-local-home
90                       (file-name-sans-extension val))
91           (set-default sym val)))
92
93
94 ;; (makunbound 'jde-ejb-class-format)
95 (defcustom jde-ejb-class-format "%sBean.java"
96   "*Default format for EJB Class.
97 Setting this also resets jde-ejb-class to the
98 name portion of the filename string."
99   :type 'string
100   :group 'jde-ejb
101   :set '(lambda (sym val)
102           (set-default 'jde-ejb-class
103                       (file-name-sans-extension val))
104           (set-default sym val)))
105
106 ;; (makunbound 'jde-ejb-descriptor-format)
107 (defcustom jde-ejb-descriptor-format "%sEJB.xml"
108   "*Default format for EJB Deployment Descriptor"
109   :type 'string
110   :group 'jde-ejb)
111
112 (defun jde-ejb-format-filename (fmt name &optional dir)
113   (let ((thisdir (or dir default-directory)))
114     (format "%s/%s" thisdir  (format fmt name))))
115   
116 ;; (makunbound 'jde-ejb-remote-buffer-template)
117 (defcustom jde-ejb-remote-buffer-template
118   (list
119    "(funcall jde-gen-boilerplate-function)"
120    "jde-ejb-package '>'n"
121    "'>'n"
122    "\"public interface \""
123    "(file-name-sans-extension (file-name-nondirectory buffer-file-name))"
124    "\" extends javax.ejb.EJBObject \""
125
126    "(if jde-gen-k&r "
127    " ()"
128    " '>'n)"
129    "\"{\"'>'n"
130
131 ;;;Add standard interface components for Remote Interface
132    "'>'n"
133    "\"}\">"
134    "\" // \""
135    "(file-name-sans-extension (file-name-nondirectory buffer-file-name))"
136    "'>'n")
137   "*Template for new EJB Remote interface.
138 This is the interface that contains all user methods.
139 Setting this variable defines a template instantiation
140 command `jde-ejb-remote', as a side-effect."
141   :group 'jde-ejb
142   :type '(repeat string)
143   :set '(lambda (sym val)
144           (defalias 'jde-ejb-remote
145             (tempo-define-template "java-ejb-remote-buffer-template"
146                                    (jde-gen-read-template val)
147                                    nil
148                                    "Insert a generic Java class buffer skeleton."))
149           (set-default sym val)))
150
151 ;; (makunbound 'jde-ejb-home-buffer-template)
152 (defcustom jde-ejb-home-buffer-template
153   (list
154    "(funcall jde-gen-boilerplate-function)"
155    "jde-ejb-package '>'n"
156    "'>'n"
157    "\"public interface \""
158    "(file-name-sans-extension (file-name-nondirectory buffer-file-name))"
159    "\" extends javax.ejb.EJBHome \""
160
161    "(if jde-gen-k&r "
162    " ()"
163    " '>'n)"
164    "\"{\"'>'n"
165
166 ;;;Add standard interface components for Home Interface
167    "'>'n"
168    "\"}\">"
169    "\" // \""
170    "(file-name-sans-extension (file-name-nondirectory buffer-file-name))"
171    "'>'n")
172   "*Template for new EJB Home interface.
173 This interface defines the create/find (for entity beans)/remove
174 methods. Setting this variable defines a template instantiation
175 command `jde-ejb-home', as a side-effect."
176   :group 'jde-ejb
177   :type '(repeat string)
178   :set '(lambda (sym val)
179           (defalias 'jde-ejb-home
180             (tempo-define-template "java-ejb-home-buffer-template"
181                                    (jde-gen-read-template val)
182                                    nil
183                                    "Insert a generic Java class buffer skeleton."))
184           (set-default sym val)))
185
186 ;;;;;;; start - by yoonforh 2003-01-15 17:09:14
187 ;; (makunbound 'jde-ejb-local-buffer-template)
188 (defcustom jde-ejb-local-buffer-template
189   (list
190    "(funcall jde-gen-boilerplate-function)"
191    "jde-ejb-package '>'n"
192    "'>'n"
193    "\"public interface \""
194    "(file-name-sans-extension (file-name-nondirectory buffer-file-name))"
195    "\" extends javax.ejb.EJBLocalObject \""
196
197    "(if jde-gen-k&r "
198    " ()"
199    " '>'n)"
200    "\"{\"'>'n"
201
202 ;;;Add standard interface components for Remote Interface
203    "'>'n"
204    "\"}\">"
205    "\" // \""
206    "(file-name-sans-extension (file-name-nondirectory buffer-file-name))"
207    "'>'n")
208   "*Template for new EJB Local interface.
209 This is the interface that contains all user methods.
210 Setting this variable defines a template instantiation
211 command `jde-ejb-local', as a side-effect."
212   :group 'jde-ejb
213   :type '(repeat string)
214   :set '(lambda (sym val)
215           (defalias 'jde-ejb-local
216             (tempo-define-template "java-ejb-local-buffer-template"
217                                    (jde-gen-read-template val)
218                                    nil
219                                    "Insert a generic Java class buffer skeleton."))
220           (set-default sym val)))
221
222 ;; (makunbound 'jde-ejb-local-home-buffer-template)
223 (defcustom jde-ejb-local-home-buffer-template
224   (list
225    "(funcall jde-gen-boilerplate-function)"
226    "jde-ejb-package '>'n"
227    "'>'n"
228    "\"public interface \""
229    "(file-name-sans-extension (file-name-nondirectory buffer-file-name))"
230    "\" extends javax.ejb.EJBLocalHome \""
231
232    "(if jde-gen-k&r "
233    " ()"
234    " '>'n)"
235    "\"{\"'>'n"
236
237 ;;;Add standard interface components for LocalHome Interface
238    "'>'n"
239    "\"}\">"
240    "\" // \""
241    "(file-name-sans-extension (file-name-nondirectory buffer-file-name))"
242    "'>'n")
243   "*Template for new EJB LocalHome interface.
244 This interface defines the create/find (for entity beans)/remove
245 methods. Setting this variable defines a template instantiation
246 command `jde-ejb-local-home', as a side-effect."
247   :group 'jde-ejb
248   :type '(repeat string)
249   :set '(lambda (sym val)
250           (defalias 'jde-ejb-local-home
251             (tempo-define-template "java-ejb-local-home-buffer-template"
252                                    (jde-gen-read-template val)
253                                    nil
254                                    "Insert a generic Java class buffer skeleton."))
255           (set-default sym val)))
256
257
258 ;;;;;;;;;;; end - by yoonforh 2003-01-15 17:09:19
259
260 ;; (makunbound 'jde-ejb-entity-bean-template)
261 (defcustom jde-ejb-entitiy-bean-template
262   (list
263    "(funcall jde-gen-boilerplate-function)"
264    "jde-ejb-package '>'n"
265     "'>"
266    "'>'n"
267    "\"public class \""
268    "(file-name-sans-extension (file-name-nondirectory buffer-file-name))"
269    " \" implements EntityBean \" "
270
271    "(if jde-gen-k&r "
272    " ()"
273    " '>'n)"
274    "\"{\"'>'n'n"
275    "'>'p'n"
276
277     "'>"
278     "(jde-gen-method-signature"
279     "  \"public\""
280     "  \"void\""
281     "  \"ejbCreate\""
282     "  nil"
283     "  \"CreateException\""
284     " )"
285
286     "(if jde-gen-k&r "
287     " ()"
288     " 'n)"
289     "\"{\"'>'n"
290     "\"}\"'>'n 'n"
291
292
293     "(jde-gen-method-signature"
294     "   \"public\""
295     "  \"void\""
296     "  \"ejbActivate\""
297     "  nil"
298     "  nil"
299     " )"
300     "'>"
301
302     ;;we open the bracket according to k&r style or not
303     "(if jde-gen-k&r "
304     " ()"
305     " 'n)"
306     "\"{\"'>'n"
307     "\"}\"'>'n 'n"
308
309     "'>"
310     "(jde-gen-method-signature"
311     "  \"public\""
312     "  \"void\""
313     "  \"ejbPassivate\""
314     "  nil"
315     "  nil"
316     " )"
317
318     "(if jde-gen-k&r "
319     " ()"
320     " 'n)"
321     "\"{\"'>'n"
322     "\"}\"'>'n 'n"
323
324     "'>"
325     "(jde-gen-method-signature"
326     "  \"public\""
327     "  \"void\""
328     "  \"ejbLoad\""
329     "  nil"
330     "  nil"
331     " )"
332
333     "(if jde-gen-k&r "
334     " ()"
335     " 'n)"
336     "\"{\"'>'n"
337     "\"}\"'>'n 'n"
338
339     "'>"
340     "(jde-gen-method-signature"
341     "  \"public\""
342     "  \"void\""
343     "  \"ejbStore\""
344     "  nil"
345     "  nil"
346     " )"
347
348     "(if jde-gen-k&r "
349     " ()"
350     " 'n)"
351     "\"{\"'>'n"
352     "\"}\"'>'n 'n"
353
354     "'>"
355     "(jde-gen-method-signature"
356     "  \"public\""
357     "  \"void\""
358     "  \"ejbRemove\""
359     "  nil"
360     "  \"RemoveException\""
361     " )"
362
363     "(if jde-gen-k&r "
364     " ()"
365     " 'n)"
366     "\"{\"'>'n"
367     "\"}\"'>'n 'n"
368
369     "'>"
370     "(jde-gen-method-signature"
371     "  \"public\""
372     "  \"void\""
373     "  \"setEntityContext\""
374     "  \"EntityContext ctx\""
375     "  nil"
376     " )"
377
378     "(if jde-gen-k&r "
379     " ()"
380     " 'n)"
381     "\"{\"'>'n"
382     "\"}\"'>'n 'n"
383
384     "'>"
385     "(jde-gen-method-signature"
386     "  \"public\""
387     "  \"void\""
388     "  \"unsetEntityContext\""
389     "  nil"
390     "  nil"
391     " )"
392
393     "(if jde-gen-k&r "
394     " ()"
395     " 'n)"
396     "\"{\"'>'n"
397     "\"}\"'>'n 'n '>"
398    "\"}\">"
399    "\" // \""
400
401    "(file-name-sans-extension (file-name-nondirectory buffer-file-name))"
402    "'>'n")
403   "*Template for new Entity Bean class.
404 Entity beans must have  a Find method using a primary key.
405 The method is defined in the Home interface and implemented
406 here under a slightly different name (see EJB specifications for details.
407 Similarly, any create methods defined in the Home interface
408 will also be instantiated here, but under a slightly different name.
409 Setting this variable defines a template instantiation
410 command `jde-ejb-entity-bean', as a side-effect."
411   :group 'jde-ejb
412   :type '(repeat string)
413   :set '(lambda (sym val)
414           (defalias 'jde-ejb-entity-bean
415             (tempo-define-template "java-ejb-entity-bean-template"
416                                    (jde-gen-read-template val)
417                                    nil
418                                    "Insert a generic Entity Bean skeleton."))
419           (set-default sym val)))
420
421            
422 ;; (makunbound 'jde-ejb-session-bean-template)
423 (defcustom jde-ejb-session-bean-template
424   (list
425    "(funcall jde-gen-boilerplate-function)"
426    "jde-ejb-package '>'n"
427     "'>"
428    "'>'n"
429    "\"public class \""
430    "(file-name-sans-extension (file-name-nondirectory buffer-file-name))"
431    " \" implements SessionBean \" "
432
433     ;;we open the bracket according to k&r style or not
434    "(if jde-gen-k&r "
435    " ()"
436    " '>'n)"
437    "\"{\"'>'n'n"
438    "'>'p'n"
439
440     "(jde-gen-method-signature"
441     "  \"public\""
442     "  \"void\""
443     "  \"ejbCreate\""
444     "  nil"
445     "  \"CreateException\""
446     " )"
447     "'>"
448
449     ;;we open the bracket according to k&r style or not
450     "(if jde-gen-k&r "
451     " ()"
452     " 'n)"
453     "\"{\"'>'n"
454     "\"}\"'>'n 'n"
455
456     "(jde-gen-method-signature"
457     "  \"public\""
458     "  \"void\""
459     "  \"ejbActivate\""
460     "  nil"
461     "  nil"
462     " )"
463     "'>"
464
465     ;;we open the bracket according to k&r style or not
466     "(if jde-gen-k&r "
467     " ()"
468     " 'n)"
469     "\"{\"'>'n"
470     "\"}\"'>'n 'n"
471
472     "(jde-gen-method-signature"
473     "  \"public\""
474     "  \"void\""
475     "  \"ejbPassivate\""
476     "  nil"
477     "  nil"
478     " )"
479     "'>"
480
481     ;;we open the bracket according to k&r style or not
482     "(if jde-gen-k&r "
483     " ()"
484     " 'n)"
485     "\"{\"'>'n"
486     "\"}\"'>'n 'n"
487
488     "(jde-gen-method-signature"
489     "  \"public\""
490     "  \"void\""
491     "  \"ejbRemove\""
492     "  nil"
493     "  nil"
494     " )"
495     "'>"
496
497     ;;we open the bracket according to k&r style or not
498     "(if jde-gen-k&r "
499     " ()"
500     " 'n)"
501     "\"{\"'>'n"
502     "\"}\"'>'n 'n"
503
504     "(jde-gen-method-signature"
505     "  \"public\""
506     "  \"void\""
507     "  \"setSessionContext\""
508     "  \"SessionContext ctx\""
509     "  nil"
510     " )"
511     "'>"
512
513 ;;     ;;we open the bracket according to k&r style or not
514 ;;     "(if jde-gen-k&r "
515 ;;     " ()"
516 ;;     " 'n)"
517 ;;     "\"{\"'>'n"
518 ;;     "\"}\"'>'n 'n"
519
520 ;;     "(jde-gen-method-signature"
521 ;;     "  \"public\""
522 ;;     "  \"void\""
523 ;;     "  \"unsetSessionContext\""
524 ;;     "  nil"
525 ;;     "  \"RemoteException\""
526 ;;     " )"
527 ;;     "'>"
528
529     ;;we open the bracket according to k&r style or not
530     "(if jde-gen-k&r "
531     " ()"
532     " 'n)"
533     "\"{\"'>'n"
534     "\"}\"'>'n 'n"
535     "'>"
536    "\"}\">"
537    "\" // \""
538
539    "(file-name-sans-extension (file-name-nondirectory buffer-file-name))"
540    "'>'n")
541   "*Template for new Session Bean class.
542 This creates the class for a session bean.  It includes the
543 necessary interface implementations.
544 Setting this variable defines a template instantiation
545 command `jde-ejb-session-bean', as a side-effect."
546   :group 'jde-ejb
547   :type '(repeat string)
548   :set '(lambda (sym val)
549           (defalias 'jde-ejb-session-bean
550             (tempo-define-template "java-ejb-session-bean-template"
551                                    (jde-gen-read-template val)
552                                    nil
553                                    "Insert a generic Session Bean skeleton."))
554           (set-default sym val)))
555
556
557 ;; (makunbound 'jde-ejb-session-descriptor-buffer-template)
558 (defcustom jde-ejb-session-descriptor-buffer-template
559   (list
560    "\"<?xml version=\\\"1.0\\\"?>\"'n"
561    "\"<!DOCTYPE ejb-jar PUBLIC \\\"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN\\\" \" "
562    "\" \\\"http://java.sun.com/dtd/ejb-jar_2_0.dtd\\\" > \"'>'n'n"
563    "\"<ejb-jar>\"'>'n"
564    "\"<enterprise-beans>\" '>'n"
565    "\"<session> \"'>'n"
566    "\"<ejb-name>\""
567    "(format jde-ejb-class  jde-current-ejb-name)"
568    "\"</ejb-name>\"'>'n"
569    "\"<home>\""
570    "(format (concat \"%s.\" jde-ejb-home) jde-current-ejb-package jde-current-ejb-name)"
571    "\"</home>\"'>'n"
572    "\"<remote>\""
573    "(format \"%s.%s\" jde-current-ejb-package jde-current-ejb-name)"
574    "\"</remote>\"'>'n"
575    "\"<local-home>\""
576    "(format (concat \"%s.\" jde-ejb-local-home) jde-current-ejb-package jde-current-ejb-name)"
577    "\"</local-home>\"'>'n"
578    "\"<local>\""
579    "(format (concat \"%s.\" jde-ejb-local) jde-current-ejb-package jde-current-ejb-name)"
580    "\"</local>\"'>'n"
581    "\"<ejb-class>\""
582    "(format \"%s.%s\" jde-current-ejb-package (format jde-ejb-class  jde-current-ejb-name))"
583    "\"</ejb-class>\"'>'n"
584    "\"<session-type>Stateless</session-type>\"'>'n"
585    "\"<transaction-type>Container</transaction-type>\"'>'n"
586    "\"</session>\"'>'n"
587    "\"</enterprise-beans>\"'>'n"
588    "\"<ejb-client-jar>\""
589    "(format \"%sClient.jar\" jde-current-ejb-name )"
590    "\"</ejb-client-jar>\"'>'n"
591    "\"</ejb-jar>\"'>'n"
592    "'>'n")
593   "*Template for new EJB Session Bean Deployment Descriptor interface.
594 This template uses internal functions to get the package and ejb names
595 interpolated when the XML file is generated from the template.
596 Setting this variable defines a template instantiation
597 command `jde-ejb-session-descriptor', as a side-effect."
598   :group 'jde-ejb
599   :type '(repeat string)
600   :set '(lambda (sym val)
601             (defalias 'jde-ejb-session-descriptor
602               (tempo-define-template "java-ejb-session-descriptor-buffer-template"
603                                      (jde-gen-read-template val)
604                                      nil
605                                      "Insert a generic XML Deployment Descriptor buffer skeleton."))
606             (set-default sym val)))
607
608 ;; (makunbound 'jde-ejb-entity-descriptor-buffer-template)
609 (defcustom jde-ejb-entity-descriptor-buffer-template
610   (list
611    "\"<?xml version=\\\"1.0\\\"?>\"'n"
612    "\"<!DOCTYPE ejb-jar PUBLIC \\\"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN\\\" \" "
613    "\" \\\"http://java.sun.com/dtd/ejb-jar_2_0.dtd\\\" > \"'>'n'n"
614    "\"<ejb-jar>\"'>'n"
615    "\"<enterprise-beans>\" '>'n"
616    "\"<entity> \"'>'n"
617    "\"<ejb-name>\""
618    "(format jde-ejb-class  jde-current-ejb-name)"
619    "\"</ejb-name>\"'>'n"
620    "\"<home>\""
621    "(format (concat \"%s.\" jde-ejb-home) jde-current-ejb-package jde-current-ejb-name)"
622    "\"</home>\"'>'n"
623    "\"<remote>\""
624    "(format \"%s.%s\" jde-current-ejb-package jde-current-ejb-name)"
625    "\"</remote>\"'>'n"
626    "\"<local-home>\""
627    "(format (concat \"%s.\" jde-ejb-local-home) jde-current-ejb-package jde-current-ejb-name)"
628    "\"</local-home>\"'>'n"
629    "\"<local>\""
630    "(format (concat \"%s.\" jde-ejb-local) jde-current-ejb-package jde-current-ejb-name)"
631    "\"</local>\"'>'n"
632    "\"<ejb-class>\""
633    "(format \"%s.%s\" jde-current-ejb-package (format jde-ejb-class  jde-current-ejb-name))"
634    "\"</ejb-class>\"'>'n"
635    "\"<persistence-type>Container</persistence-type>\"'>'n"
636    "\"<prim-key-class>\""
637    "(format \"%s.%sPK\" jde-current-ejb-package jde-current-ejb-name)"
638    "\"</prim-key-class>\"'>'n"
639    "\"<reentrant>False</reentrant>\"'>'n"
640    "\"</entity>\"'>'n"
641    "\"</enterprise-beans>\"'>'n"
642    "\"<assembly-descriptor>\"'>'n"
643    "\"<container-transaction>\"'>'n"
644    "\"<method>\"'>'n"
645    "\"<ejb-name>\""
646    "(format jde-ejb-class  jde-current-ejb-name)"
647    "\"</ejb-name>\"'>'n"
648    "\"<method-intf>Local</method-intf>\"'>'n"
649    "\"<method-name>*</method-name>\"'>'n"
650    "\"</method>\"'>'n"
651    "\"<method>\"'>'n"
652    "\"<ejb-name>\""
653    "(format jde-ejb-class  jde-current-ejb-name)"
654    "\"</ejb-name>\"'>'n"
655    "\"<method-intf>Remote</method-intf>\"'>'n"
656    "\"<method-name>*</method-name>\"'>'n"
657    "\"</method>\"'>'n"
658    "\"<trans-attribute>Required</trans-attribute>\"'>'n"
659    "\"</container-transaction>\"'>'n"
660    "\"</assembly-descriptor>\"'>'n"
661    "\"</ejb-jar>\"'>'n"
662    "'>'n")
663   "*Template for new EJB Entity Bean Deployment Descriptor interface.
664 This template uses internal functions to get the package and ejb names
665 interpolated when the XML file is generated from the template.
666 Setting this variable defines a template instantiation
667 command `jde-ejb-session-descriptor', as a side-effect."
668   :group 'jde-ejb
669   :type '(repeat string)
670   :set '(lambda (sym val)
671             (defalias 'jde-ejb-entity-descriptor
672               (tempo-define-template "java-ejb-entity-descriptor-buffer-template"
673                                      (jde-gen-read-template val)
674                                      nil
675                                      "Insert a generic XML Deployment Descriptor buffer skeleton."))
676             (set-default sym val)))
677
678 ;;;###autoload
679 (defun jde-ejb-session-bean-buffer (ejb-name)
680   "Create a new Java buffer containing an EJB session bean class of the same name.
681 This command also creates buffers with the EJB Home and EJB Remote interfaces
682 and the XML Deployment descriptor defined
683 by the jde-ejb templates.  This includes naming the files according 
684 to the EJB naming convention."
685   (interactive 
686    (let* ((insert-default-directory t)
687           (file (read-file-name "EJB Name (no extension): ")))
688      (setq jde-ejb-dir  (file-name-directory file))
689      (list (file-name-sans-extension (file-name-nondirectory file)))))
690                                
691   ;; Find the package name
692   (setq jde-current-ejb-name ejb-name)
693   (jde-ejb-gen-bean 'session))
694
695 ;;;###autoload
696 (defun jde-ejb-entity-bean-buffer ( ejb-name)
697   "Create a new Java buffer containing an EJB entity bean class of the same name.
698 This command also creates buffers with the EJB Home and EJB Remote interfaces
699 and the XML Deployment descriptor defined
700 by the jde-ejb templates.  This includes naming the files according 
701 to the EJB naming convention."
702   (interactive
703    (let* ((insert-default-directory t)
704           (file (read-file-name "EJB Name (no extension): ")))
705      (setq jde-ejb-dir  (file-name-directory file))
706      (list (file-name-sans-extension (file-name-nondirectory file)))))
707                                
708   ;; Find the package name
709   (setq jde-current-ejb-name ejb-name)
710   (jde-ejb-gen-bean 'entity))
711
712 (defun jde-ejb-gen-bean (beantype)
713   "Internal function used by session and entity bean creators.
714 This command uses jde package wizards and template commands to build
715 the bean skeleton using the Bean name and package name supplied by the
716 Bean-specific interactive function"
717 (let* ((jde-ejb-package (jde-gen-get-package-statement))
718        (jde-bean (format "jde-ejb-%s-bean" beantype))
719        (jde-desc (format "jde-ejb-%s-descriptor" beantype)))
720   
721 ;; We use the package to generate a default directory
722   (setq jde-current-ejb-package   (cadr (split-string jde-ejb-package "[ ;]+")))
723   (find-file (jde-ejb-format-filename jde-ejb-remote-format jde-current-ejb-name jde-ejb-dir))
724   (tempo-template-java-ejb-remote-buffer-template)
725   (find-file (jde-ejb-format-filename jde-ejb-home-format jde-current-ejb-name jde-ejb-dir ))
726   (tempo-template-java-ejb-home-buffer-template)
727   (find-file (jde-ejb-format-filename jde-ejb-local-format jde-current-ejb-name jde-ejb-dir))
728   (tempo-template-java-ejb-local-buffer-template)
729   (find-file (jde-ejb-format-filename jde-ejb-local-home-format jde-current-ejb-name jde-ejb-dir ))
730   (tempo-template-java-ejb-local-home-buffer-template)
731   (find-file (jde-ejb-format-filename jde-ejb-descriptor-format jde-current-ejb-name jde-ejb-dir))
732   (funcall (intern-soft jde-desc))
733   (find-file (jde-ejb-format-filename jde-ejb-class-format jde-current-ejb-name jde-ejb-dir))
734   (funcall (intern-soft jde-bean))
735   (beginning-of-buffer)
736   (search-forward "{")
737   (backward-char 1)
738   (c-indent-exp)
739   (tempo-forward-mark)))
740
741 (provide 'jde-ejb)  
742
743 ;;; Change History: 
744
745 ;; $Log: jde-ejb.el,v $
746 ;; Revision 1.7  2004/07/06 04:03:40  paulk
747 ;; Replace calls to template aliases to the actual template function
748 ;; names. This is intended to eliminate undefined function messages when
749 ;; byte-compiling this library.
750 ;;
751 ;; Revision 1.6  2004/07/06 03:43:56  paulk
752 ;; Provide defvars and jde- prefixes for global variables used in
753 ;; templates, e.g., jde-current-ejb-name. This eliminates
754 ;; byte-compilation warnings about undefined variables. Also, replace
755 ;; references to functions that get the values of these variables with
756 ;; the values themselves as this eliminates a function evaluation that
757 ;; seems to serve no useful purpose.
758 ;;
759 ;; Revision 1.5  2003/03/28 05:33:29  andyp
760 ;; XEmacs optimizations for JDEbug and efc.
761 ;;
762 ;; Revision 1.4  2003/01/19 05:11:36  paulk
763 ;; Updated to reflect EJB 2.x. Thanks to Yoon Kyung Koo.
764 ;;
765 ;; Revision 1.3  2002/12/02 14:38:17  jslopez
766 ;; Changes current-ejb-name to a function from a macro to fix byte-compilation.
767 ;;
768 ;; Revision 1.2  2002/09/30 04:40:23  paulk
769 ;; Made jde-ejb commands autoloadable.
770 ;;
771 ;; Revision 1.1  2002/09/26 06:12:27  paulk
772 ;; Initial revision.
773 ;;
774
775
776 ;; End of jde-ejb.el