KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > ejb > codegen > GenericHomeGenerator


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.ejb.codegen;
24
25 import java.lang.reflect.Method JavaDoc;
26 import java.io.*;
27 import java.util.*;
28 import java.util.logging.*;
29 import com.sun.logging.*;
30 import com.sun.ejb.EJBUtils;
31
32 import com.sun.enterprise.util.LocalStringManagerImpl;
33
34 import static java.lang.reflect.Modifier JavaDoc.*;
35 import static com.sun.corba.ee.spi.codegen.Wrapper.*;
36 import com.sun.corba.ee.spi.codegen.Type;
37 import com.sun.corba.ee.impl.codegen.ClassGenerator;
38
39 /**
40  * This class is used to generate a sub-interface of the
41  * GenericEJBHome interface that will be loaded within each
42  * application.
43  */

44
45 public class GenericHomeGenerator extends Generator
46     implements ClassGeneratorFactory {
47
48     private static LocalStringManagerImpl localStrings =
49     new LocalStringManagerImpl(GenericHomeGenerator.class);
50     private static Logger _logger=null;
51     static{
52        _logger=LogDomains.getLogger(LogDomains.DPL_LOGGER);
53     }
54
55     private String JavaDoc genericEJBHomeClassName;
56     private ClassLoader JavaDoc loader;
57
58     /**
59      * Get the fully qualified name of the generated class.
60      * @return the name of the generated class.
61      */

62     public String JavaDoc getGeneratedClass() {
63         return genericEJBHomeClassName;
64     }
65
66     // For corba codegen infrastructure
67
public String JavaDoc className() {
68         return getGeneratedClass();
69     }
70
71     public GenericHomeGenerator(ClassLoader JavaDoc cl)
72     throws GeneratorException
73     {
74     super();
75
76         genericEJBHomeClassName = EJBUtils.getGenericEJBHomeClassName();
77         loader = cl;
78     }
79
80     public ClassGenerator evaluate() {
81
82         _clear();
83
84         String JavaDoc packageName = getPackageName(genericEJBHomeClassName);
85         String JavaDoc simpleName = getBaseName (genericEJBHomeClassName);
86
87         _package(packageName);
88
89         _interface(PUBLIC, simpleName,
90                    _t("com.sun.ejb.containers.GenericEJBHome"));
91
92         _method(PUBLIC | ABSTRACT, _t("java.rmi.Remote"),
93                 "create", _t("java.rmi.RemoteException"));
94
95         _arg(_String(), "generatedBusinessIntf");
96
97         _end();
98
99         _end();
100
101         return _classGenerator() ;
102     }
103
104     public void generate(OutputStream out)
105     throws GeneratorException, IOException
106     {
107         throw new IllegalStateException JavaDoc("not supported");
108     }
109
110 }
111
Popular Tags