[jboss-cvs] JBossAS SVN: r57377 - in trunk/server: . src/main/org/jboss/deployment src/main/org/jboss/metadata src/main/org/jboss/metadata/web
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Oct 3 01:44:45 EDT 2006
Author: scott.stark at jboss.org
Date: 2006-10-03 01:44:39 -0400 (Tue, 03 Oct 2006)
New Revision: 57377
Added:
trunk/server/src/main/org/jboss/deployment/JBossWebAppParsingDeployer.java
trunk/server/src/main/org/jboss/deployment/WebAppParsingDeployer.java
trunk/server/src/main/org/jboss/metadata/web/JBossWebMetaDataObjectFactory.java
trunk/server/src/main/org/jboss/metadata/web/ParamValue.java
Modified:
trunk/server/.classpath
trunk/server/src/main/org/jboss/metadata/WebMetaData.java
trunk/server/src/main/org/jboss/metadata/web/WebMetaDataObjectFactory.java
Log:
Move the web metadata deployers to the server module since they only depend on the server module metadata
Modified: trunk/server/.classpath
===================================================================
--- trunk/server/.classpath 2006-10-03 03:01:20 UTC (rev 57376)
+++ trunk/server/.classpath 2006-10-03 05:44:39 UTC (rev 57377)
@@ -4,9 +4,9 @@
<classpathentry kind="src" path="output/gen-src"/>
<classpathentry kind="src" path="src/main"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/common-core/lib/jboss-common-core.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-spi/lib/jboss-logging-spi.jar"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-log4j/lib/jboss-logging-log4j.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/common-core/lib/jboss-common-core.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-spi/lib/jboss-logging-spi.jar"/>
+ <classpathentry kind="lib" path="/thirdparty/jboss/common-logging-log4j/lib/jboss-logging-log4j.jar"/>
<classpathentry kind="src" path="/system"/>
<classpathentry kind="src" path="/j2ee"/>
<classpathentry kind="src" path="/naming"/>
@@ -28,7 +28,8 @@
<classpathentry kind="lib" path="/thirdparty/jboss/security/lib/jbosssx.jar"/>
<classpathentry kind="lib" path="/thirdparty/jboss/security-spi/lib/jboss-security-spi.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/system-jmx"/>
- <classpathentry kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers.jar"/>
+ <classpathentry sourcepath="C:/svn/JBossMC/jbossmc/deployers/src/main" kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-deployers.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/transaction"/>
+ <classpathentry sourcepath="/home/svn/JBossMC/jbossmc/container/src/main" kind="lib" path="/thirdparty/jboss/microcontainer/lib/jboss-container.jar"/>
<classpathentry kind="output" path="output/eclipse-classes"/>
</classpath>
Added: trunk/server/src/main/org/jboss/deployment/JBossWebAppParsingDeployer.java
===================================================================
--- trunk/server/src/main/org/jboss/deployment/JBossWebAppParsingDeployer.java 2006-10-03 03:01:20 UTC (rev 57376)
+++ trunk/server/src/main/org/jboss/deployment/JBossWebAppParsingDeployer.java 2006-10-03 05:44:39 UTC (rev 57377)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * 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.deployment;
+
+import org.jboss.deployers.plugins.deployers.helpers.ObjectModelFactoryDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.metadata.web.JBossWebMetaDataObjectFactory;
+import org.jboss.metadata.web.WebMetaDataObjectFactory;
+import org.jboss.xb.binding.ObjectModelFactory;
+
+/**
+ * An ObjectModelFactoryDeployer for
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class JBossWebAppParsingDeployer extends ObjectModelFactoryDeployer<WebMetaData>
+{
+ private String webXmlPath = "jboss-web.xml";
+ private WebMetaData metaData;
+
+ public JBossWebAppParsingDeployer()
+ {
+ super(WebMetaData.class);
+ }
+
+ public String getWebXmlPath()
+ {
+ return webXmlPath;
+ }
+ public void setWebXmlPath(String webXmlPath)
+ {
+ this.webXmlPath = webXmlPath;
+ }
+
+ @Override
+ public int getRelativeOrder()
+ {
+ return PARSER_DEPLOYER+1;
+ }
+
+ @Override
+ protected void init(DeploymentUnit unit, WebMetaData metaData, VirtualFile file) throws Exception
+ {
+ log.debug("init, metaData: "+metaData);
+ this.metaData = metaData;
+ super.init(unit, metaData, file);
+ }
+
+ @Override
+ protected ObjectModelFactory getObjectModelFactory()
+ {
+ log.debug("getObjectModelFactory");
+ return new JBossWebMetaDataObjectFactory(metaData);
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ log.debug("deploy, unit: "+unit);
+ String key = getDeploymentType().getName();
+ metaData = unit.getTransientManagedObjects().getAttachment(key, getDeploymentType());
+ createMetaData(unit, webXmlPath, null);
+ }
+
+}
Copied: trunk/server/src/main/org/jboss/deployment/WebAppParsingDeployer.java (from rev 57306, trunk/tomcat/src/main/org/jboss/web/tomcat/deployers/WebAppParsingDeployer.java)
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/deployers/WebAppParsingDeployer.java 2006-09-30 17:32:29 UTC (rev 57306)
+++ trunk/server/src/main/org/jboss/deployment/WebAppParsingDeployer.java 2006-10-03 05:44:39 UTC (rev 57377)
@@ -0,0 +1,78 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * 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.deployment;
+
+import org.jboss.deployers.plugins.deployers.helpers.ObjectModelFactoryDeployer;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentUnit;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.metadata.web.WebMetaDataObjectFactory;
+import org.jboss.xb.binding.ObjectModelFactory;
+
+/**
+ * An ObjectModelFactoryDeployer for
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class WebAppParsingDeployer extends ObjectModelFactoryDeployer<WebMetaData>
+{
+ private String webXmlPath = "web.xml";
+
+ public WebAppParsingDeployer()
+ {
+ super(WebMetaData.class);
+ }
+
+ public String getWebXmlPath()
+ {
+ return webXmlPath;
+ }
+ public void setWebXmlPath(String webXmlPath)
+ {
+ this.webXmlPath = webXmlPath;
+ }
+
+ @Override
+ protected void init(DeploymentUnit unit, WebMetaData metaData, VirtualFile file) throws Exception
+ {
+ // TODO Auto-generated method stub
+ super.init(unit, metaData, file);
+ }
+
+ @Override
+ protected ObjectModelFactory getObjectModelFactory()
+ {
+ return new WebMetaDataObjectFactory();
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ createMetaData(unit, webXmlPath, null);
+ }
+
+}
Modified: trunk/server/src/main/org/jboss/metadata/WebMetaData.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/WebMetaData.java 2006-10-03 03:01:20 UTC (rev 57376)
+++ trunk/server/src/main/org/jboss/metadata/WebMetaData.java 2006-10-03 05:44:39 UTC (rev 57377)
@@ -39,6 +39,7 @@
import org.jboss.metadata.web.Filter;
import org.jboss.metadata.web.FilterMapping;
import org.jboss.metadata.web.LoginConfig;
+import org.jboss.metadata.web.ParamValue;
import org.jboss.metadata.web.ReplicationConfig;
import org.jboss.metadata.web.Servlet;
import org.jboss.metadata.web.ServletMapping;
@@ -54,7 +55,7 @@
* descriptors as used by the AbstractWebContainer web container integration
* support class.
*
- * @see XmlLoadable
+ * @see org.jboss.metadata.web.WebMetaDataObjectFactory
* @see org.jboss.web.AbstractWebContainer
*
* @author Scott.Stark at jboss.org
@@ -64,6 +65,15 @@
{
private static Logger log = Logger.getLogger(WebMetaData.class);
+ /** web-app/description */
+ private String description;
+ /** web-app/display-name */
+ private String displayName;
+ /** web-app/context-param */
+ private List<ParamValue> contextParams = new ArrayList<ParamValue>();
+ /** web-app/init-param */
+ private List<ParamValue> initParams = new ArrayList<ParamValue>();
+
/** The web.xml servlet to class mapping */
private HashMap<String, String> servletClassNames = new HashMap<String, String>();
private HashMap<String, Servlet> servlets = new HashMap<String, Servlet>();
@@ -103,7 +113,7 @@
/** web.xml ejb-refs */
private HashMap ejbReferences = new HashMap();
/** web.xml ejb-local-refs */
- private HashMap ejbLocalReferences = new HashMap();
+ private HashMap<String, EjbLocalRefMetaData> ejbLocalReferences = new HashMap<String, EjbLocalRefMetaData>();
/** The web.xml service-refs */
private HashMap serviceReferences = new HashMap();
/** web.xml security-role-refs <String servlet-name, ArrayList<SecurityRoleRefMetaData>> */
@@ -215,6 +225,43 @@
/** The ClassLoader to load additional resources */
private URLClassLoader resourceCl;
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ public String getDisplayName()
+ {
+ return displayName;
+ }
+
+ public void setDisplayName(String displayName)
+ {
+ this.displayName = displayName;
+ }
+
+ public List<ParamValue> getContextParams()
+ {
+ return contextParams;
+ }
+ public void addContextParam(ParamValue pv)
+ {
+ contextParams.add(pv);
+ }
+ public List<ParamValue> getInitParams()
+ {
+ return initParams;
+ }
+ public void addInitParam(ParamValue pv)
+ {
+ initParams.add(pv);
+ }
+
public HashMap getArbitraryMetadata()
{
return arbitraryMetadata;
@@ -417,7 +464,7 @@
/** Return an iterator of the env-entry mappings.
@return Iterator of EnvEntryMetaData objects.
*/
- public Iterator getEnvironmentEntries()
+ public Iterator<EnvEntryMetaData> getEnvironmentEntries()
{
return environmentEntries.iterator();
}
@@ -451,10 +498,14 @@
/** Return an iterator of the ejb-local-ref mappings.
@return Iterator of EjbLocalRefMetaData objects.
*/
- public Iterator getEjbLocalReferences()
+ public Iterator<EjbLocalRefMetaData> getEjbLocalReferences()
{
return ejbLocalReferences.values().iterator();
}
+ public Map<String, EjbLocalRefMetaData> getEjbLocalReferenceMap()
+ {
+ return ejbLocalReferences;
+ }
/**
*
* @param ejbReferences - Map<String, EjbRefMetaData>
Added: trunk/server/src/main/org/jboss/metadata/web/JBossWebMetaDataObjectFactory.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/web/JBossWebMetaDataObjectFactory.java 2006-10-03 03:01:20 UTC (rev 57376)
+++ trunk/server/src/main/org/jboss/metadata/web/JBossWebMetaDataObjectFactory.java 2006-10-03 05:44:39 UTC (rev 57377)
@@ -0,0 +1,276 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * 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.metadata.web;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.jboss.logging.Logger;
+import org.jboss.metadata.DDObjectFactory;
+import org.jboss.metadata.EjbLocalRefMetaData;
+import org.jboss.metadata.EjbRefMetaData;
+import org.jboss.metadata.EnvEntryMetaData;
+import org.jboss.metadata.MessageDestinationMetaData;
+import org.jboss.metadata.MessageDestinationRefMetaData;
+import org.jboss.metadata.ResourceEnvRefMetaData;
+import org.jboss.metadata.ResourceRefMetaData;
+import org.jboss.metadata.SecurityRoleMetaData;
+import org.jboss.metadata.WebMetaData;
+import org.jboss.util.xml.JBossEntityResolver;
+import org.jboss.xb.binding.JBossXBException;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+public class JBossWebMetaDataObjectFactory extends DDObjectFactory
+{
+ private static Logger log = Logger.getLogger(JBossWebMetaDataObjectFactory.class);
+ /** The current WebMetaData being parsed */
+ private static final ThreadLocal<WebMetaData> activeMetaData = new ThreadLocal<WebMetaData>();
+ private WebMetaData metaData;
+
+ public static WebMetaData parse(URL ddResource, WebMetaData dd)
+ throws JBossXBException, IOException
+ {
+ if (ddResource == null) return null;
+ log.debug("found jboss-web.xml " + ddResource);
+
+ InputStream is = ddResource.openStream();
+
+ return parse(dd, is);
+ }
+
+ public static WebMetaData parse(WebMetaData metaData, InputStream is)
+ throws JBossXBException
+ {
+ ObjectModelFactory factory = null;
+ Unmarshaller unmarshaller = null;
+
+ if (metaData == null)
+ metaData = new WebMetaData();
+
+ activeMetaData.set(metaData);
+ factory = new JBossWebMetaDataObjectFactory(metaData);
+ UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
+ // unmarshallerFactory.setFeature(Unmarshaller.SCHEMA_VALIDATION, Boolean.TRUE);
+ unmarshaller = unmarshallerFactory.newUnmarshaller();
+ JBossEntityResolver entityResolver = new JBossEntityResolver();
+ unmarshaller.setEntityResolver(entityResolver);
+
+ metaData = (WebMetaData) unmarshaller.unmarshal(is, factory, null);
+ return metaData;
+ }
+
+ public JBossWebMetaDataObjectFactory(WebMetaData dd)
+ {
+ super();
+ this.metaData = dd;
+ }
+
+ /**
+ * Return the root.
+ */
+ public Object newRoot(Object root, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ return root == null ? metaData : root;
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext ctx,
+ String uri, String name)
+ {
+ return root;
+ }
+
+ // Methods discovered by introspection
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(WebMetaData dd, UnmarshallingContext navigator,
+ String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ log.debug("newChild, "+localName);
+ if ((child = newEnvRefGroupChild(localName)) != null)
+ return child;
+ else if (localName.equals("security-role"))
+ child = new SecurityRoleMetaData();
+ else if (localName.equals("servlet"))
+ child = new Servlet();
+ else if (localName.equals("replication-config"))
+ child = new ReplicationConfig();
+ else if (localName.equals("message-destination"))
+ {
+ child = new MessageDestinationMetaData();
+ }
+ return child;
+ }
+
+ public void addChild(WebMetaData parent, ReplicationConfig config,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ parent.setReplicationConfig(config);
+ }
+
+ public void addChild(WebMetaData parent, EjbLocalRefMetaData ref,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ parent.addEjbLocalRef(ref);
+ }
+
+ public void addChild(WebMetaData parent, EjbRefMetaData ref,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ parent.addEjbRef(ref);
+ }
+
+ public void addChild(WebMetaData parent, EnvEntryMetaData ref,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ parent.addEnvEntry(ref);
+ }
+
+ public void addChild(WebMetaData parent, MessageDestinationMetaData destination,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ log.debug("addMessageDestinationMetaData, "+destination);
+ parent.addMessageDestination(destination);
+ // See if this message-destination resolves to an existing ref link
+ String link = destination.getJndiName();
+ if( link != null )
+ {
+ MessageDestinationMetaData ref = parent.getMessageDestination(link);
+ if( ref != null )
+ {
+ log.debug("ressolved "+ref+" to link JndiName: "+destination.getJndiName());
+ ref.setJndiName(destination.getJndiName());
+ }
+ }
+ }
+ public void addChild(WebMetaData parent, MessageDestinationRefMetaData ref,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ log.debug("addMessageDestinationMetaDataRef, "+ref);
+ parent.addMessageDestinationRef(ref);
+ }
+
+ public void addChild(WebMetaData parent, ResourceEnvRefMetaData ref,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ parent.addResourceEnvRef(ref);
+ }
+
+ public void addChild(WebMetaData parent, ResourceRefMetaData ref,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ parent.addResourceRef(ref);
+ }
+
+ public void addChild(WebMetaData parent, SecurityRoleMetaData role,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ parent.addSecurityRole(role);
+ }
+
+ public void addChild(WebMetaData parent, Servlet servlet,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ parent.updateServlet(servlet);
+ }
+
+ public void setValue(WebMetaData dd,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if (localName.equals("depends"))
+ {
+ dd.addDependency(value);
+ }
+ else if (localName.equals("security-domain"))
+ {
+ dd.setSecurityDomain(value);
+ }
+ }
+
+ public void setValue(ReplicationConfig config,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if (localName.equals("replication-trigger"))
+ {
+ config.setTrigger(value);
+ }
+ else if (localName.equals("replication-granularity"))
+ {
+ config.setGranularity(value);
+ }
+ else if (localName.equals("replication-field-batch-mode"))
+ {
+ config.setFieldBatchMode(value);
+ }
+ }
+
+ public void setValue(Servlet servlet,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if (localName.equals("servlet-name"))
+ {
+ servlet.setName(value);
+ }
+ else if (localName.equals("run-as-principal"))
+ {
+ servlet.addRunAsPrincipal(value);
+ }
+ }
+
+ public void setValue(ServletMapping mapping,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if (localName.equals("servlet-name"))
+ {
+ mapping.setName(value);
+ }
+ else if (localName.equals("url-pattern"))
+ {
+ mapping.setUrlPattern(value);
+ }
+ }
+
+ public void setValue(SecurityRoleMetaData role,
+ UnmarshallingContext navigator, String namespaceURI, String localName,
+ String value)
+ {
+ if (localName.equals("principal-name"))
+ {
+ role.setRoleName(value);
+ }
+ else
+ super.setValue(role, navigator, namespaceURI, localName, value);
+ }
+
+}
Added: trunk/server/src/main/org/jboss/metadata/web/ParamValue.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/web/ParamValue.java 2006-10-03 03:01:20 UTC (rev 57376)
+++ trunk/server/src/main/org/jboss/metadata/web/ParamValue.java 2006-10-03 05:44:39 UTC (rev 57377)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * 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.metadata.web;
+
+/**
+ * Represents a context-param/init-param
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class ParamValue
+{
+ public static enum ParamType {CONTEXT_PARAM, INIT_PARAM};
+
+ private ParamType type;
+ private String description;
+ private String name;
+ private String value;
+
+ public ParamType getType()
+ {
+ return type;
+ }
+ public void setType(ParamType type)
+ {
+ this.type = type;
+ }
+ public String getDescription()
+ {
+ return description;
+ }
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+ public String getName()
+ {
+ return name;
+ }
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+ public String getValue()
+ {
+ return value;
+ }
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+}
Modified: trunk/server/src/main/org/jboss/metadata/web/WebMetaDataObjectFactory.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/web/WebMetaDataObjectFactory.java 2006-10-03 03:01:20 UTC (rev 57376)
+++ trunk/server/src/main/org/jboss/metadata/web/WebMetaDataObjectFactory.java 2006-10-03 05:44:39 UTC (rev 57377)
@@ -94,6 +94,18 @@
else if (localName.equals("distributable"))
dd.setDistributable(true);
+ else if(localName.equals("context-param"))
+ {
+ ParamValue pv = new ParamValue();
+ pv.setType(ParamValue.ParamType.CONTEXT_PARAM);
+ child = pv;
+ }
+ else if(localName.equals("init-param"))
+ {
+ ParamValue pv = new ParamValue();
+ pv.setType(ParamValue.ParamType.INIT_PARAM);
+ child = pv;
+ }
else if (localName.equals("security-role"))
child = new SecurityRoleMetaData();
else if (localName.equals("servlet"))
@@ -204,6 +216,15 @@
return child;
}
+ public void addChild(WebMetaData parent, ParamValue pv,
+ UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ if( pv.getType() == ParamValue.ParamType.CONTEXT_PARAM )
+ parent.addContextParam(pv);
+ else if( pv.getType() == ParamValue.ParamType.INIT_PARAM )
+ parent.addInitParam(pv);
+ }
+
public void addChild(WebMetaData parent, Filter filter,
UnmarshallingContext navigator, String namespaceURI, String localName)
{
@@ -355,6 +376,36 @@
parent.setFormLoginConfig(config);
}
+ public void setValue(WebMetaData wmd, UnmarshallingContext navigator,
+ String namespaceURI, String localName, String value)
+ {
+ if (localName.equals("description"))
+ {
+ wmd.setDescription(value);
+ }
+ else if(localName.equals("display-name"))
+ {
+ wmd.setDisplayName(value);
+ }
+ }
+
+ public void setValue(ParamValue pv, UnmarshallingContext navigator,
+ String namespaceURI, String localName, String value)
+ {
+ if (localName.equals("description"))
+ {
+ pv.setDescription(value);
+ }
+ else if(localName.equals("param-name"))
+ {
+ pv.setName(value);
+ }
+ else if(localName.equals("param-value"))
+ {
+ pv.setValue(value);
+ }
+ }
+
public void setValue(Filter filter, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
{
More information about the jboss-cvs-commits
mailing list