KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > ejb > cfg > EjbJar


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  * Free SoftwareFoundation, Inc.
23  * 59 Temple Place, Suite 330
24  * Boston, MA 02111-1307 USA
25  *
26  * @author Scott Ferguson
27  */

28
29 package com.caucho.ejb.cfg;
30
31 import com.caucho.config.ConfigException;
32 import com.caucho.config.types.Signature;
33 import com.caucho.j2ee.cfg.J2eeSecurityRole;
34 import com.caucho.util.L10N;
35
36 import javax.annotation.PostConstruct;
37
38 /**
39  * Configuration for an ejb bean.
40  */

41 public class EjbJar {
42   private static final L10N L = new L10N(EjbJar.class);
43
44   private final EjbConfig _config;
45   private final String JavaDoc _ejbModuleName;
46
47   public EjbJar(EjbConfig config, String JavaDoc ejbModuleName)
48   {
49     _config = config;
50     _ejbModuleName = ejbModuleName;
51   }
52
53   public void setVersion(String JavaDoc version)
54   {
55   }
56
57   public void setSchemaLocation(String JavaDoc value)
58   {
59   }
60
61   public void setDescription(String JavaDoc value)
62   {
63   }
64
65   public void setDisplayName(String JavaDoc value)
66   {
67   }
68   
69   public EjbEnterpriseBeans createEnterpriseBeans()
70     throws ConfigException
71   {
72     return new EjbEnterpriseBeans(_config, _ejbModuleName);
73   }
74   
75   public Relationships createRelationships()
76     throws ConfigException
77   {
78     return new Relationships(_config);
79   }
80   
81   public AssemblyDescriptor createAssemblyDescriptor()
82     throws ConfigException
83   {
84     return new AssemblyDescriptor(_config);
85   }
86
87   public void addQueryFunction(QueryFunction fun)
88   {
89     _config.addFunction(fun.getSignature(), null);
90   }
91
92   public void setBooleanLiteral(BooleanLiteral literal)
93   {
94     _config.setBooleanTrue(literal.getTrue());
95     _config.setBooleanFalse(literal.getFalse());
96   }
97
98   public static class Relationships {
99     EjbConfig _config;
100
101     Relationships(EjbConfig config)
102     {
103       _config = config;
104     }
105
106     public CmpRelation createEjbRelation()
107     {
108       return new CmpRelation(_config);
109     }
110
111     public void addEjbRelation(CmpRelation rel)
112       throws ConfigException
113     {
114       _config.addRelation(rel);
115     }
116   }
117
118   public static class AssemblyDescriptor {
119     EjbConfig _config;
120
121     AssemblyDescriptor(EjbConfig config)
122     {
123       _config = config;
124     }
125
126     public ContainerTransaction createContainerTransaction()
127     {
128       return new ContainerTransaction(_config);
129     }
130
131     public MethodPermission createMethodPermission()
132     {
133       return new MethodPermission(_config);
134     }
135
136     public void addSecurityRole(J2eeSecurityRole securityRole)
137     {
138     }
139   }
140
141   public static class QueryFunction {
142     FunctionSignature _sig;
143     String JavaDoc _sql;
144
145     public void setSignature(Signature sig)
146       throws ConfigException
147     {
148       _sig = new FunctionSignature(sig.getSignature());
149     }
150
151     public FunctionSignature getSignature()
152     {
153       return _sig;
154     }
155
156     public void setSQL(String JavaDoc sql)
157       throws ConfigException
158     {
159       _sql = sql;
160     }
161
162     public String JavaDoc getSQL()
163     {
164       return _sql;
165     }
166
167     @PostConstruct
168     public void init()
169     {
170       _sig.setSQL(_sql);
171     }
172   }
173
174   public static class MethodPermission {
175     EjbConfig _config;
176
177     MethodPermission(EjbConfig config)
178     {
179       _config = config;
180     }
181
182     public void setDescription(String JavaDoc description)
183     {
184     }
185     
186     public void setUnchecked(boolean unchecked)
187     {
188     }
189
190     public void setRoleName(String JavaDoc roleName)
191     {
192     }
193     
194     public void setMethod(MethodSignature method)
195     {
196     }
197   }
198 }
199
Popular Tags