Author: mwringe
Date: 2009-04-02 15:36:56 -0400 (Thu, 02 Apr 2009)
New Revision: 13123
Added:
modules/deployer/trunk/deployer/src/main/deployer/tld/portal-layout.tld
modules/deployer/trunk/portal/src/main/java/org/jboss/portal/deployer/portal/webapp/TLDDeployer.java
modules/deployer/trunk/theme/src/main/java/org/jboss/portal/deployer/theme/webapp/
modules/deployer/trunk/theme/src/main/java/org/jboss/portal/deployer/theme/webapp/LayoutTLDDeployer.java
modules/deployer/trunk/theme/src/test/
modules/deployer/trunk/theme/src/test/java/
modules/deployer/trunk/theme/src/test/java/org/
modules/deployer/trunk/theme/src/test/java/org/jboss/
modules/deployer/trunk/theme/src/test/java/org/jboss/portal/
modules/deployer/trunk/theme/src/test/java/org/jboss/portal/deployer/
Modified:
modules/deployer/trunk/.classpath
modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml
Log:
Add layout TLD deployer.
Modified: modules/deployer/trunk/.classpath
===================================================================
--- modules/deployer/trunk/.classpath 2009-04-02 18:14:35 UTC (rev 13122)
+++ modules/deployer/trunk/.classpath 2009-04-02 19:36:56 UTC (rev 13123)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="theme/src/main/java"/>
+ <classpathentry kind="src" path="theme/src/test/java"/>
<classpathentry kind="src" path="portal/src/main/java"/>
<classpathentry kind="src" path="portlet/src/main/java"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
Modified:
modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml
===================================================================
---
modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml 2009-04-02
18:14:35 UTC (rev 13122)
+++
modules/deployer/trunk/deployer/src/main/deployer/META-INF/deployer-jboss-beans.xml 2009-04-02
19:36:56 UTC (rev 13123)
@@ -200,5 +200,10 @@
<bean name="LayoutDeployer"
class="org.jboss.portal.deployer.theme.LayoutDeployer"/>
<bean name="RenderSetDeployer"
class="org.jboss.portal.deployer.theme.RenderSetDeployer"/>
+
+ <bean name="LayoutTLDDeployer"
class="org.jboss.portal.deployer.theme.webapp.LayoutTLDDeployer">
+ <property name="MBeanServer"><inject
bean="JMXKernel" property="mbeanServer"/></property>
+ <property name="TLDDirectory">tld</property>
+ </bean>
</deployment>
Added: modules/deployer/trunk/deployer/src/main/deployer/tld/portal-layout.tld
===================================================================
--- modules/deployer/trunk/deployer/src/main/deployer/tld/portal-layout.tld
(rev 0)
+++ modules/deployer/trunk/deployer/src/main/deployer/tld/portal-layout.tld 2009-04-02
19:36:56 UTC (rev 13123)
@@ -0,0 +1,77 @@
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, 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. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<taglib
+
xmlns="http://java.sun.com/xml/ns/j2ee"
+
xmlns:xsi="http://www.w3c.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ version="2.0">
+ <tlib-version>1.0</tlib-version>
+ <jsp-version>2.0</jsp-version>
+ <short-name></short-name>
+ <
uri>http://www.jboss.org/portal</uri>
+ <tag>
+ <name>region</name>
+ <tag-class>org.jboss.portal.theme.tag.RegionTagHandler</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <name>orientation</name>
+ </attribute>
+ <attribute>
+ <name>regionName</name>
+ </attribute>
+ <attribute>
+ <name>regionID</name>
+ </attribute>
+ </tag>
+ <tag>
+ <name>portlet</name>
+ <tag-class>org.jboss.portal.theme.tag.PortletTagHandler</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <name>windowName</name>
+ </attribute>
+ </tag>
+ <tag>
+ <name>theme</name>
+ <tag-class>org.jboss.portal.theme.tag.ThemeTagHandler</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <name>themeName</name>
+ </attribute>
+ </tag>
+ <tag>
+ <name>headerContent</name>
+
<tag-class>org.jboss.portal.theme.tag.HeaderContentTagHandler</tag-class>
+ <body-content>empty</body-content>
+ </tag>
+ <tag>
+ <name>title</name>
+ <tag-class>org.jboss.portal.theme.tag.TitleTagHandler</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <name>default</name>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+</taglib>
Property changes on:
modules/deployer/trunk/deployer/src/main/deployer/tld/portal-layout.tld
___________________________________________________________________
Name: svn:executable
+ *
Added:
modules/deployer/trunk/portal/src/main/java/org/jboss/portal/deployer/portal/webapp/TLDDeployer.java
===================================================================
---
modules/deployer/trunk/portal/src/main/java/org/jboss/portal/deployer/portal/webapp/TLDDeployer.java
(rev 0)
+++
modules/deployer/trunk/portal/src/main/java/org/jboss/portal/deployer/portal/webapp/TLDDeployer.java 2009-04-02
19:36:56 UTC (rev 13123)
@@ -0,0 +1,102 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, 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.portal.deployer.portal.webapp;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.web.WebApplication;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public abstract class TLDDeployer extends AbstractDeployer
+{
+
+ protected String tldDirectory;
+
+ protected MBeanServer server;
+
+ public void setTLDDirectory(String path)
+ {
+ this.tldDirectory = path;
+ }
+
+ public void setMBeanServer(MBeanServer server)
+ {
+ this.server = server;
+ }
+
+ protected String getDocLocation (WebApplication webApp) throws DeploymentException
+ {
+ ObjectName objectName = (ObjectName) webApp.getAppData();
+ try
+ {
+ return (String) server.getAttribute(objectName, "docBase");
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException ("Could get doc base for " +
webApp.getName(), e);
+ }
+ }
+
+ protected void copyTld(String tldFileLocation, String tldName, String location) throws
IOException
+ {
+ File fileLocation = new File(location);
+
+ if (!fileLocation.exists())
+ {
+ fileLocation.mkdirs();
+ }
+
+ if (fileLocation.isFile())
+ {
+ throw new IOException("The directory for the tld [" + fileLocation +
"] is a file instead of a directory");
+ }
+ else if (fileLocation.isDirectory())
+ {
+ InputStream fileInput =
Thread.currentThread().getContextClassLoader().getResourceAsStream(tldFileLocation);
+ FileOutputStream fileOutput = new FileOutputStream(new File(fileLocation,
tldName));
+
+ int in = fileInput.read();
+ while (in > 0)
+ {
+ fileOutput.write(in);
+ in = fileInput.read();
+ }
+ fileInput.close();
+ fileOutput.close();
+ }
+
+ }
+
+}
+
Added:
modules/deployer/trunk/theme/src/main/java/org/jboss/portal/deployer/theme/webapp/LayoutTLDDeployer.java
===================================================================
---
modules/deployer/trunk/theme/src/main/java/org/jboss/portal/deployer/theme/webapp/LayoutTLDDeployer.java
(rev 0)
+++
modules/deployer/trunk/theme/src/main/java/org/jboss/portal/deployer/theme/webapp/LayoutTLDDeployer.java 2009-04-02
19:36:56 UTC (rev 13123)
@@ -0,0 +1,67 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, Red Hat Middleware, LLC, 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.portal.deployer.theme.webapp;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.portal.deployer.portal.webapp.TLDDeployer;
+import org.jboss.portal.metadata.layout.PortalLayoutsMetaData;
+import org.jboss.web.WebApplication;
+
+/**
+ * @author <a href="mailto:mwringe@redhat.com">Matt Wringe</a>
+ * @version $Revision$
+ */
+public class LayoutTLDDeployer extends TLDDeployer
+{
+
+ public LayoutTLDDeployer()
+ {
+ setAllInputs(false);
+ setInput(PortalLayoutsMetaData.class);
+ addInput(WebApplication.class);
+ setStage(DeploymentStages.INSTALLED);
+ }
+
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ WebApplication webApp = (WebApplication)unit.getAttachment(WebApplication.class);
+ if (webApp == null)
+ {
+ throw new DeploymentException("Could not deploy Theme TLD file. Could not
find WebApplication class");
+ }
+ String location = getDocLocation(webApp);
+
+ try
+ {
+ copyTld(tldDirectory + "/portal-layout.tld",
"portal-layout.tld", location + "/WEB-INF/theme");
+ }
+ catch (Exception e)
+ {
+ throw new DeploymentException ("Error trying to deploy theme tld
file.", e);
+ }
+ }
+
+}
+