KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > amber > cfg > MappedSuperIntrospector


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  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Rodrigo Westrupp
28  */

29
30 package com.caucho.amber.cfg;
31
32 import com.caucho.amber.manager.AmberPersistenceUnit;
33 import com.caucho.amber.type.AbstractEnhancedType;
34 import com.caucho.bytecode.JAnnotation;
35 import com.caucho.bytecode.JClass;
36 import com.caucho.config.ConfigException;
37 import com.caucho.util.L10N;
38
39 import java.sql.SQLException JavaDoc;
40 import java.util.logging.Logger JavaDoc;
41
42 /**
43  * Configuration for a mapped superclass type
44  */

45 public class MappedSuperIntrospector extends BaseConfigIntrospector {
46   private static final L10N L = new L10N(MappedSuperIntrospector.class);
47   private static final Logger JavaDoc log
48     = Logger.getLogger(MappedSuperIntrospector.class.getName());
49
50   // HashMap<String, MappedSuperType> _mappedSuperMap
51
// = new HashMap<String, MappedSuperType>();
52

53   /**
54    * Creates the introspector.
55    */

56   public MappedSuperIntrospector(AmberPersistenceUnit persistenceUnit)
57   {
58     super(persistenceUnit);
59   }
60
61   /**
62    * Returns true for mapped superclass type.
63    */

64   public boolean isMappedSuper(JClass type)
65   {
66     getInternalMappedSuperclassConfig(type);
67     JAnnotation mappedSuperAnn = _annotationCfg.getAnnotation();
68     MappedSuperclassConfig mappedSuperConfig
69       = _annotationCfg.getMappedSuperclassConfig();
70
71     return (! _annotationCfg.isNull());
72   }
73
74   /**
75    * Introspects.
76    */

77   //XXX: public MappedSuperType introspect(JClass type)
78
public AbstractEnhancedType introspect(JClass type)
79     throws ConfigException, SQLException JavaDoc
80   {
81     return null;
82
83     /* XXX:
84     String typeName = type.getName();
85
86     MappedSuperType mappedSuperType = _mappedSuperMap.get(typeName);
87
88     if (mappedSuperType != null)
89       return mappedSuperType;
90
91     try {
92       mappedSuperType = _persistenceUnit.createMappedSuper(typeName, type);
93       _mappedSuperMap.put(typeName, mappedSuperType);
94
95       boolean isField = isField(type, mappedSuperConfig);
96
97       if (isField)
98         mappedSuperType.setFieldAccess(true);
99
100       mappedSuperType.setInstanceClassName(type.getName() +
101                                            "__ResinExt");
102       mappedSuperType.setEnhanced(true);
103
104       if (isField)
105         introspectFields(_persistenceUnit, mappedSuperType, null,
106                          type, entityConfig, false);
107       else
108         introspectMethods(_persistenceUnit, mappedSuperType, null,
109                           type, entityConfig);
110
111     } catch (ConfigException e) {
112       mappedSuperType.setConfigException(e);
113
114       throw e;
115     } catch (SQLException e) {
116       mappedSuperType.setConfigException(e);
117
118       throw e;
119     } catch (RuntimeException e) {
120       mappedSuperType.setConfigException(e);
121
122       throw e;
123     }
124
125     return mappedSuperType;
126     */

127   }
128 }
129
Popular Tags