[jboss-cvs] jboss-seam-tools/src/org/jboss/seam/tools/freemarker ...
Thomas Heute
theute at jboss.com
Tue Aug 8 07:33:13 EDT 2006
User: theute
Date: 06/08/08 07:33:13
Modified: src/org/jboss/seam/tools/freemarker
WebHashModel.java ConfigurationFactory.java
EjbHashModel.java TemplateProcessor.java
UtilityJarHashModel.java EjbBeanWrapper.java
UtilityJarsBeanWrapper.java EarHashModel.java
Added: src/org/jboss/seam/tools/freemarker
WebBeanWrapper.java RootHashModel.java
Removed: src/org/jboss/seam/tools/freemarker
WarBeanWrapper.java
Log:
- WTP and Maven support
- Legal headers
- Moved the templates
Revision Changes Path
1.2 +32 -4 jboss-seam-tools/src/org/jboss/seam/tools/freemarker/WebHashModel.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WebHashModel.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam-tools/src/org/jboss/seam/tools/freemarker/WebHashModel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- WebHashModel.java 19 Jul 2006 16:11:34 -0000 1.1
+++ WebHashModel.java 8 Aug 2006 11:33:12 -0000 1.2
@@ -1,10 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.seam.tools.freemarker;
import java.util.HashMap;
import java.util.Map;
-import org.jboss.seam.tools.Context;
import org.jboss.seam.tools.WebProject;
+import org.jboss.seam.tools.contexts.Context;
import freemarker.ext.beans.BeanModel;
import freemarker.ext.beans.BeansWrapper;
@@ -13,6 +34,10 @@
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version <tt>$Revision: 1.2 $</tt>
+ */
public class WebHashModel implements TemplateHashModel {
protected Map<String, TemplateModel> map;
@@ -23,13 +48,16 @@
map.put("context", contextHash);
}
-
public WebHashModel(WebProject webProject) {
map = new HashMap<String, TemplateModel>();
- map.put("id", new SimpleScalar(webProject.getId()));
+ TemplateHashModel webContextHash = new BeanModel(webProject.getWebContext(), new BeansWrapper());
+ map.put("webContext", webContextHash);
map.put("projectName", new SimpleScalar(webProject.getProjectName()));
- map.put("contextRoot", new SimpleScalar(webProject.getContextRoot()));
map.put("filename", new SimpleScalar(webProject.getFilename()));
+
+ TemplateHashModel rootContextHash = new BeanModel(webProject.getRootProject().getRootContext(), new BeansWrapper());
+ map.put("rootContext", rootContextHash);
+
}
public TemplateModel get(String arg0) throws TemplateModelException {
1.2 +26 -1 jboss-seam-tools/src/org/jboss/seam/tools/freemarker/ConfigurationFactory.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ConfigurationFactory.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam-tools/src/org/jboss/seam/tools/freemarker/ConfigurationFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ConfigurationFactory.java 19 Jul 2006 16:11:33 -0000 1.1
+++ ConfigurationFactory.java 8 Aug 2006 11:33:12 -0000 1.2
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.seam.tools.freemarker;
import java.io.File;
@@ -6,11 +27,15 @@
import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapper;
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version <tt>$Revision: 1.2 $</tt>
+ */
public class ConfigurationFactory {
private static Configuration configuration;
- public static final String TEMPLATE_DIRECTORY = "bin/org/jboss/seam/tools/templates";
+ public static final String TEMPLATE_DIRECTORY = "templates";
public static Configuration getConfiguration()
{
1.2 +12 -6 jboss-seam-tools/src/org/jboss/seam/tools/freemarker/EjbHashModel.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: EjbHashModel.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam-tools/src/org/jboss/seam/tools/freemarker/EjbHashModel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- EjbHashModel.java 19 Jul 2006 16:11:34 -0000 1.1
+++ EjbHashModel.java 8 Aug 2006 11:33:12 -0000 1.2
@@ -3,8 +3,8 @@
import java.util.HashMap;
import java.util.Map;
-import org.jboss.seam.tools.Context;
import org.jboss.seam.tools.EjbProject;
+import org.jboss.seam.tools.contexts.Context;
import freemarker.ext.beans.BeanModel;
import freemarker.ext.beans.BeansWrapper;
@@ -13,6 +13,10 @@
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version <tt>$Revision: 1.2 $</tt>
+ */
public class EjbHashModel implements TemplateHashModel {
private Map<String, TemplateModel> map;
@@ -25,13 +29,15 @@
public EjbHashModel(EjbProject ejbProject) {
map = new HashMap<String, TemplateModel>();
- map.put("id", new SimpleScalar(ejbProject.getId()));
+ TemplateHashModel ejbContextHash = new BeanModel(ejbProject.getEjbContext(), new BeansWrapper());
+ map.put("ejbContext", ejbContextHash);
map.put("projectName", new SimpleScalar(ejbProject.getProjectName()));
- map.put("contentDirectory", new SimpleScalar(ejbProject.getContentDirectory()));
map.put("filename", new SimpleScalar(ejbProject.getFilename()));
- map.put("jtaDataSource", new SimpleScalar(ejbProject.getJtaDataSource()));
- map.put("persistenceUnitName", new SimpleScalar(ejbProject.getPersistenceUnitName()));
- map.put("ear", new EarHashModel(ejbProject.getEarProject()));
+ map.put("ear", new EarHashModel(ejbProject.getRootProject().getEarProject()));
+
+ TemplateHashModel rootContextHash = new BeanModel(ejbProject.getRootProject().getRootContext(), new BeansWrapper());
+ map.put("rootContext", rootContextHash);
+
}
public TemplateModel get(String arg0) throws TemplateModelException {
1.3 +25 -0 jboss-seam-tools/src/org/jboss/seam/tools/freemarker/TemplateProcessor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TemplateProcessor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam-tools/src/org/jboss/seam/tools/freemarker/TemplateProcessor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- TemplateProcessor.java 24 Jul 2006 15:00:22 -0000 1.2
+++ TemplateProcessor.java 8 Aug 2006 11:33:12 -0000 1.3
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.seam.tools.freemarker;
import java.io.File;
@@ -10,6 +31,10 @@
import freemarker.template.Template;
import freemarker.template.TemplateException;
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version <tt>$Revision: 1.3 $</tt>
+ */
public class TemplateProcessor {
public static void process(Configuration cfg, String templateName, Object data, File destination) throws GenerationException
1.2 +25 -0 jboss-seam-tools/src/org/jboss/seam/tools/freemarker/UtilityJarHashModel.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UtilityJarHashModel.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam-tools/src/org/jboss/seam/tools/freemarker/UtilityJarHashModel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- UtilityJarHashModel.java 19 Jul 2006 16:11:34 -0000 1.1
+++ UtilityJarHashModel.java 8 Aug 2006 11:33:12 -0000 1.2
@@ -1,3 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.seam.tools.freemarker;
import java.util.HashMap;
@@ -10,6 +31,10 @@
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version <tt>$Revision: 1.2 $</tt>
+ */
public class UtilityJarHashModel implements TemplateHashModel {
private Map<String, TemplateModel> map;
1.2 +25 -0 jboss-seam-tools/src/org/jboss/seam/tools/freemarker/EjbBeanWrapper.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: EjbBeanWrapper.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam-tools/src/org/jboss/seam/tools/freemarker/EjbBeanWrapper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- EjbBeanWrapper.java 19 Jul 2006 16:11:34 -0000 1.1
+++ EjbBeanWrapper.java 8 Aug 2006 11:33:12 -0000 1.2
@@ -1,9 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.seam.tools.freemarker;
import org.jboss.seam.tools.EjbProject;
import freemarker.ext.beans.BeansWrapper;
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version <tt>$Revision: 1.2 $</tt>
+ */
public class EjbBeanWrapper extends BeansWrapper {
@Override
1.2 +25 -0 jboss-seam-tools/src/org/jboss/seam/tools/freemarker/UtilityJarsBeanWrapper.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UtilityJarsBeanWrapper.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam-tools/src/org/jboss/seam/tools/freemarker/UtilityJarsBeanWrapper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- UtilityJarsBeanWrapper.java 19 Jul 2006 16:11:34 -0000 1.1
+++ UtilityJarsBeanWrapper.java 8 Aug 2006 11:33:12 -0000 1.2
@@ -1,9 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.seam.tools.freemarker;
import org.jboss.seam.tools.UtilityJar;
import freemarker.ext.beans.BeansWrapper;
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version <tt>$Revision: 1.2 $</tt>
+ */
public class UtilityJarsBeanWrapper extends BeansWrapper {
@Override
1.2 +36 -9 jboss-seam-tools/src/org/jboss/seam/tools/freemarker/EarHashModel.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: EarHashModel.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam-tools/src/org/jboss/seam/tools/freemarker/EarHashModel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- EarHashModel.java 19 Jul 2006 16:11:34 -0000 1.1
+++ EarHashModel.java 8 Aug 2006 11:33:12 -0000 1.2
@@ -1,10 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.seam.tools.freemarker;
import java.util.HashMap;
import java.util.Map;
-import org.jboss.seam.tools.Context;
import org.jboss.seam.tools.EarProject;
+import org.jboss.seam.tools.contexts.Context;
import freemarker.ext.beans.BeanModel;
import freemarker.ext.beans.BeansWrapper;
@@ -16,6 +37,10 @@
import freemarker.template.TemplateModelException;
import freemarker.template.TemplateScalarModel;
+/**
+ * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
+ * @version <tt>$Revision: 1.2 $</tt>
+ */
public class EarHashModel implements TemplateHashModel {
private Map<String, TemplateModel> map;
@@ -27,20 +52,22 @@
TemplateCollectionModel utilityJars = new CollectionModel(earProject.getUtilityJars(), new UtilityJarsBeanWrapper());
map.put("utilityJars", utilityJars);
- TemplateCollectionModel ejbProjects = new CollectionModel(earProject.getEjbProjects(), new EjbBeanWrapper());
+ TemplateCollectionModel ejbProjects = new CollectionModel(earProject.getRootProject().getEjbProjects(), new EjbBeanWrapper());
map.put("ejbProjects", ejbProjects);
- TemplateCollectionModel webProjects = new CollectionModel(earProject.getWebProjects(), new WarBeanWrapper());
+ TemplateCollectionModel webProjects = new CollectionModel(earProject.getRootProject().getWebProjects(), new WebBeanWrapper());
map.put("webProjects", webProjects);
- TemplateScalarModel displayName = new SimpleScalar(earProject.getDisplayName());
- map.put("displayName", displayName);
-
- TemplateScalarModel contentDirectory = new SimpleScalar(earProject.getContentDirectory());
- map.put("contentDirectory", contentDirectory);
-
TemplateScalarModel projectName = new SimpleScalar(earProject.getProjectName());
map.put("projectName", projectName);
+
+ TemplateHashModel earContextHash = new BeanModel(earProject.getEarContext(), new BeansWrapper());
+ map.put("earContext", earContextHash);
+
+ TemplateHashModel rootContextHash = new BeanModel(earProject.getRootProject().getRootContext(), new BeansWrapper());
+ map.put("rootContext", rootContextHash);
+
+
}
public EarHashModel(EarProject earProject, Context context)
1.1 date: 2006/08/08 11:33:12; author: theute; state: Exp;jboss-seam-tools/src/org/jboss/seam/tools/freemarker/WebBeanWrapper.java
Index: WebBeanWrapper.java
===================================================================
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.seam.tools.freemarker;
import org.jboss.seam.tools.WebProject;
import freemarker.ext.beans.BeansWrapper;
/**
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
* @version <tt>$Revision: 1.1 $</tt>
*/
public class WebBeanWrapper extends BeansWrapper {
@Override
public WebHashModel wrap(Object webProject)
{
return new WebHashModel((WebProject) webProject);
}
}
1.1 date: 2006/08/08 11:33:12; author: theute; state: Exp;jboss-seam-tools/src/org/jboss/seam/tools/freemarker/RootHashModel.java
Index: RootHashModel.java
===================================================================
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.seam.tools.freemarker;
import java.util.HashMap;
import java.util.Map;
import org.jboss.seam.tools.EjbProject;
import org.jboss.seam.tools.RootProject;
import org.jboss.seam.tools.contexts.Context;
import freemarker.ext.beans.BeanModel;
import freemarker.ext.beans.BeansWrapper;
import freemarker.ext.beans.CollectionModel;
import freemarker.template.SimpleScalar;
import freemarker.template.TemplateCollectionModel;
import freemarker.template.TemplateHashModel;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
/**
* @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
* @version <tt>$Revision: 1.1 $</tt>
*/
public class RootHashModel implements TemplateHashModel {
private Map<String, TemplateModel> map;
public RootHashModel(RootProject rootProject, Context context) {
this(rootProject);
TemplateHashModel contextHash = new BeanModel(context, new BeansWrapper());
map.put("context", contextHash);
}
public RootHashModel(RootProject rootProject) {
map = new HashMap<String, TemplateModel>();
TemplateHashModel rootContextHash = new BeanModel(rootProject.getRootContext(), new BeansWrapper());
map.put("rootContext", rootContextHash);
TemplateCollectionModel ejbProjects = new CollectionModel(rootProject.getEjbProjects(), new EjbBeanWrapper());
map.put("ejbProjects", ejbProjects);
TemplateCollectionModel webProjects = new CollectionModel(rootProject.getWebProjects(), new WebBeanWrapper());
map.put("webProjects", webProjects);
TemplateHashModel earProjectHash = new EarHashModel(rootProject.getEarProject());
map.put("earProject", earProjectHash);
}
public TemplateModel get(String arg0) throws TemplateModelException {
return map.get(arg0);
}
public boolean isEmpty() throws TemplateModelException {
return map.isEmpty();
}
}
More information about the jboss-cvs-commits
mailing list