View Javadoc

1   /*
2       Copyright (C) 2004 PjEr
3       
4       This program is free software; you can redistribute it and/or modify
5       it under the terms of the GNU General Public License as published by
6       the Free Software Foundation; either version 2 of the License, or
7       (at your option) any later version.
8       
9       This program is distributed in the hope that it will be useful,
10      but WITHOUT ANY WARRANTY; without even the implied warranty of
11      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12      GNU General Public License for more details.
13      
14      You should have received a copy of the GNU General Public License
15      along with this program; if not, write to the Free Software
16      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18  package ca.pjer.cm.module.metadata.defaultimpl;
19  
20  import ca.pjer.cm.api.metadata.MetaData;
21  
22  import java.util.List;
23  import java.util.ArrayList;
24  
25  import org.apache.commons.logging.LogFactory;
26  import org.apache.commons.logging.Log;
27  
28  /***
29   * <br />
30   * $Id: MetaDataImpl.java,v 1.1 2004/05/18 23:37:14 pjer Exp $<br />
31   * <br />
32   * $RCSfile: MetaDataImpl.java,v $<br />
33   * $Revision: 1.1 $<br />
34   * $Author: pjer $<br />
35   * $Date: 2004/05/18 23:37:14 $<br />
36   * 
37   * @TODO comment me.<br />
38   */
39  public class MetaDataImpl extends MetaImpl implements MetaData {
40      private static final Log log = LogFactory.getLog(MetaDataImpl.class);
41      private static final ClassLoader CLASS_LOADER = Thread.currentThread().getContextClassLoader();
42  
43      private String className = Object.class.getName();
44  
45      private Boolean root = Boolean.FALSE;
46  
47      private List metaPropertyList = new ArrayList();
48      private List metaRelationManyToManyList = new ArrayList();
49      private List metaRelationManyToOneList = new ArrayList();
50      private List metaRelationOneToManyList = new ArrayList();
51      private List metaRelationOneToOneList = new ArrayList();
52  
53      private Class clazz = null;
54  
55      public Class getClazz() {
56          if (clazz == null) {
57              try {
58                  synchronized (this) {
59                      if (clazz == null) {
60                          clazz = CLASS_LOADER.loadClass(className);
61                      }
62                  }
63              } catch (ClassNotFoundException e) {
64                  String s = "Could not load [className:" + className + "] : " + e.getMessage();
65                  log.error(s);
66                  throw new RuntimeException(s, e);
67              }
68          }
69          return clazz;
70      }
71  
72      public String getClassName() {
73          return className;
74      }
75  
76      public void setClassName(String className) {
77          this.className = className;
78      }
79  
80      public Boolean getRoot() {
81          return root;
82      }
83  
84      public void setRoot(Boolean root) {
85          this.root = root;
86      }
87  
88      public List getMetaPropertyList() {
89          return metaPropertyList;
90      }
91  
92      public void setMetaPropertyList(List metaPropertyList) {
93          this.metaPropertyList = metaPropertyList;
94      }
95  
96      public List getMetaRelationManyToManyList() {
97          return metaRelationManyToManyList;
98      }
99  
100     public void setMetaRelationManyToManyList(List metaRelationManyToManyList) {
101         this.metaRelationManyToManyList = metaRelationManyToManyList;
102     }
103 
104     public List getMetaRelationManyToOneList() {
105         return metaRelationManyToOneList;
106     }
107 
108     public void setMetaRelationManyToOneList(List metaRelationManyToOneList) {
109         this.metaRelationManyToOneList = metaRelationManyToOneList;
110     }
111 
112     public List getMetaRelationOneToManyList() {
113         return metaRelationOneToManyList;
114     }
115 
116     public void setMetaRelationOneToManyList(List metaRelationOneToManyList) {
117         this.metaRelationOneToManyList = metaRelationOneToManyList;
118     }
119 
120     public List getMetaRelationOneToOneList() {
121         return metaRelationOneToOneList;
122     }
123 
124     public void setMetaRelationOneToOneList(List metaRelationOneToOneList) {
125         this.metaRelationOneToOneList = metaRelationOneToOneList;
126     }
127 }