[jboss-cvs] JBossAS SVN: r79925 - trunk/tomcat/src/main/org/jboss/web/tomcat/metadata.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 22 11:16:44 EDT 2008
Author: remy.maucherat at jboss.com
Date: 2008-10-22 11:16:44 -0400 (Wed, 22 Oct 2008)
New Revision: 79925
Removed:
trunk/tomcat/src/main/org/jboss/web/tomcat/metadata/ContextXMLObjectModelFactory.java
trunk/tomcat/src/main/org/jboss/web/tomcat/metadata/ServerXMLObjectModelFactory.java
Log:
- Remove useless factories.
Deleted: trunk/tomcat/src/main/org/jboss/web/tomcat/metadata/ContextXMLObjectModelFactory.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/metadata/ContextXMLObjectModelFactory.java 2008-10-22 14:51:55 UTC (rev 79924)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/metadata/ContextXMLObjectModelFactory.java 2008-10-22 15:16:44 UTC (rev 79925)
@@ -1,209 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.web.tomcat.metadata;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.xb.binding.GenericObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-
-/**
- * A context.xml ObjectModelFactory.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ContextXMLObjectModelFactory implements GenericObjectModelFactory
-{
-
- public Object newRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs)
- {
- ContextMetaData metaData = new ContextMetaData();
- if(attrs != null)
- {
- for(int i = 0; i <attrs.getLength(); i++)
- {
- String key = attrs.getLocalName(i);
- String value = attrs.getValue(i);
- if( metaData.getAttributes() == null)
- metaData.setAttributes(new HashMap<String, Object>());
- metaData.getAttributes().put(key, value);
- }
- }
- return metaData;
- }
-
- public Object completeRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName)
- {
- return root;
- }
-
- public void addChild(Object parent, Object child, UnmarshallingContext ctx, String namespaceURI, String localName)
- {
- if(parent instanceof ContextMetaData)
- {
- ContextMetaData metaData = (ContextMetaData) parent;
- if(child instanceof ListenerMetaData)
- {
- if(metaData.getListeners() == null)
- metaData.setListeners(new ArrayList<ListenerMetaData>());
- metaData.getListeners().add((ListenerMetaData) child);
- }
- else if(child instanceof ValveMetaData)
- {
- if(metaData.getValves() == null)
- metaData.setValves(new ArrayList<ValveMetaData>());
- metaData.getValves().add((ValveMetaData) child);
- }
- else if(child instanceof RealmMetaData)
- {
- metaData.setRealm((RealmMetaData) child);
- }
- else if(child instanceof LoaderMetaData)
- {
- metaData.setLoader((LoaderMetaData) child);
- }
- else if(child instanceof ManagerMetaData)
- {
- metaData.setManager((ManagerMetaData) child);
- }
- else if(child instanceof ResourcesMetaData)
- {
- metaData.setResources((ResourcesMetaData) child);
- }
- else if(child instanceof SessionCookieMetaData)
- {
- metaData.setSessionCookie((SessionCookieMetaData) child);
- }
- else if(child instanceof ParameterMetaData)
- {
- if(metaData.getParameters() == null)
- metaData.setParameters(new ArrayList<ParameterMetaData>());
- metaData.getParameters().add((ParameterMetaData) child);
- }
- }
-
- // ...
- }
-
- public Object newChild(Object parent, UnmarshallingContext ctx, String namespaceURI, String localName,
- Attributes attrs)
- {
- Set<String> excludeAttributes = new HashSet<String>();
- Object child = null;
-
- if(parent instanceof ContextMetaData)
- {
- // <Valve/>
- if("Valve".equals(localName))
- child = new ValveMetaData();
- // <Listener/>
- else if("Listener".equals(localName))
- child = new ListenerMetaData();
- // <Parameter/>
- else if("Parameter".equals(localName))
- child = new ParameterMetaData();
- // <Realm/>
- else if("Realm".equals(localName))
- child = new RealmMetaData();
- // <SessionCookie/>
- else if("SessionCookie".equals(localName))
- {
- SessionCookieMetaData sessionCookie = new SessionCookieMetaData();
- sessionCookie.setComment(getAttribute("comment", null, attrs));
- sessionCookie.setDomain(getAttribute("domain", null, attrs));
- sessionCookie.setPath(getAttribute("path", null, attrs));
- sessionCookie.setHttpOnly(Boolean.parseBoolean(getAttribute("httpOnly", null, attrs)));
- sessionCookie.setSecure(Boolean.parseBoolean(getAttribute("secure", null, attrs)));
- child = sessionCookie;
- }
- // <Resources/>
- else if("Resources".equals(localName))
- child = new ResourcesMetaData();
- // <Loader/>
- else if("Loader".equals(localName))
- child = new LoaderMetaData();
- // <Manager/>
- else if("Manager".equals(localName))
- child = new ManagerMetaData();
- }
-
- // Handle attributes for AnyXmlMetaData
- if(child instanceof AnyXmlMetaData)
- {
- AnyXmlMetaData metaData = (AnyXmlMetaData) child;
- if( metaData.getAttributes() == null)
- metaData.setAttributes(new HashMap<String, Object>());
-
- // ClassName
- String className = getAttribute("className", excludeAttributes, attrs);
- metaData.setClassName(className);
-
- if(attrs != null)
- {
- for(int i = 0; i <attrs.getLength(); i++)
- {
- String key = attrs.getLocalName(i);
- if(excludeAttributes.contains(key))
- continue;
- //
- String value = attrs.getValue(i);
- metaData.getAttributes().put(key, value);
- }
- }
- return metaData;
- }
-
- return child;
- }
-
- public void setValue(Object o, UnmarshallingContext ctx, String namespaceURI, String localName, String value)
- {
- if(o instanceof ContextMetaData)
- {
- ContextMetaData metaData = (ContextMetaData) o;
- // <InstanceListener/>
- if("InstanceListener".equals(localName))
- {
- if(metaData.getInstanceListeners() == null)
- metaData.setInstanceListeners(new ArrayList<String>());
- metaData.getInstanceListeners().add(value);
- }
- }
- }
-
- protected String getAttribute(String name, Set<String> excludeList, Attributes attrs)
- {
- if(attrs == null) return null;
-
- if(excludeList != null)
- excludeList.add(name);
-
- return attrs.getValue(name);
- }
-
-}
-
Deleted: trunk/tomcat/src/main/org/jboss/web/tomcat/metadata/ServerXMLObjectModelFactory.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/metadata/ServerXMLObjectModelFactory.java 2008-10-22 14:51:55 UTC (rev 79924)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/metadata/ServerXMLObjectModelFactory.java 2008-10-22 15:16:44 UTC (rev 79925)
@@ -1,287 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.web.tomcat.metadata;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.xb.binding.GenericObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.xml.sax.Attributes;
-
-/**
- * A Server.xml ObjectModelFactory.
- *
- * @author <a href="mailto:emuckenh at redhat.com">Emanuel Muckenhuber</a>
- * @version $Revision$
- */
-public class ServerXMLObjectModelFactory implements GenericObjectModelFactory
-{
-
- public Object newRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName, Attributes attrs)
- {
- ServerMetaData metaData = new ServerMetaData();
- return metaData;
- }
-
- public Object completeRoot(Object root, UnmarshallingContext ctx, String namespaceURI, String localName)
- {
- return root;
- }
-
- public void addChild(Object parent, Object child, UnmarshallingContext ctx, String namespaceURI, String localName)
- {
- if(parent instanceof ServerMetaData)
- {
- ServerMetaData metaData = (ServerMetaData) parent;
- if(child instanceof ListenerMetaData)
- {
- if(metaData.getListeners() == null)
- metaData.setListeners(new ArrayList<ListenerMetaData>());
- metaData.getListeners().add((ListenerMetaData) child);
- }
- else if(child instanceof ServiceMetaData)
- {
- if(metaData.getServices() == null)
- metaData.setServices(new ArrayList<ServiceMetaData>());
- metaData.getServices().add((ServiceMetaData) child);
- }
- }
-
- if(parent instanceof ServiceMetaData)
- {
- ServiceMetaData metaData = (ServiceMetaData) parent;
- if(child instanceof ConnectorMetaData)
- {
- if(metaData.getConnectors() == null)
- metaData.setConnectors(new ArrayList<ConnectorMetaData>());
- metaData.getConnectors().add((ConnectorMetaData) child);
- }
- else if(child instanceof ListenerMetaData)
- {
- if(metaData.getListeners() == null)
- metaData.setListeners(new ArrayList<ListenerMetaData>());
- metaData.getListeners().add((ListenerMetaData) child);
- }
- else if(child instanceof EngineMetaData)
- {
- metaData.setEngine((EngineMetaData) child);
- }
- else if(child instanceof ExecutorMetaData)
- {
- metaData.setExecutor((ExecutorMetaData) child);
- }
- }
-
- if(parent instanceof EngineMetaData)
- {
- EngineMetaData metaData = (EngineMetaData) parent;
- if(child instanceof HostMetaData)
- {
- if(metaData.getHosts() == null)
- metaData.setHosts(new ArrayList<HostMetaData>());
- metaData.getHosts().add((HostMetaData) child);
- }
- else if(child instanceof ListenerMetaData)
- {
- if(metaData.getListeners() == null)
- metaData.setListeners(new ArrayList<ListenerMetaData>());
- metaData.getListeners().add((ListenerMetaData) child);
- }
- else if(child instanceof ValveMetaData)
- {
- if(metaData.getValves() == null)
- metaData.setValves(new ArrayList<ValveMetaData>());
- metaData.getValves().add((ValveMetaData) child);
- }
- else if(child instanceof RealmMetaData)
- {
- metaData.setRealm((RealmMetaData) child);
- }
- }
-
- if(parent instanceof HostMetaData)
- {
- HostMetaData metaData = (HostMetaData) parent;
- if(child instanceof ListenerMetaData)
- {
- if(metaData.getListeners() == null)
- metaData.setListeners(new ArrayList<ListenerMetaData>());
- metaData.getListeners().add((ListenerMetaData) child);
- }
- else if(child instanceof ValveMetaData)
- {
- if(metaData.getValves() == null)
- metaData.setValves(new ArrayList<ValveMetaData>());
- metaData.getValves().add((ValveMetaData) child);
- }
- else if(child instanceof RealmMetaData)
- {
- metaData.setRealm((RealmMetaData) child);
- }
- }
-
- // ...
- }
-
- public Object newChild(Object parent, UnmarshallingContext ctx, String namespaceURI, String localName,
- Attributes attrs)
- {
- Set<String> excludeAttributes = new HashSet<String>();
- Object child = null;
-
- // <Server/>
- if(parent instanceof ServerMetaData)
- {
- // <Service/>
- if("Service".equals(localName))
- child = new ServiceMetaData();
- // <Listener/>
- else if("Listener".equals(localName))
- child = new ListenerMetaData();
- }
-
- // <Service/>
- if(parent instanceof ServiceMetaData)
- {
- // <Connector/>
- if("Connector".equals(localName))
- {
- ConnectorMetaData connector = new ConnectorMetaData();
- connector.setProtocol(getAttribute("protocol", excludeAttributes, attrs));
- connector.setExecutor(getAttribute("executor", excludeAttributes, attrs));
- child = connector;
- }
- // <Engine/>
- else if("Engine".equals(localName))
- {
- EngineMetaData engine = new EngineMetaData();
-
- engine.setDefaultHost(getAttribute("defaultHost", excludeAttributes, attrs));
- engine.setJvmRoute(getAttribute("jvmRoute", excludeAttributes, attrs));
- engine.setName(getAttribute("name", excludeAttributes, attrs));
-
- child = engine;
-
- }
- // <Executor/>
- else if("Executor".equals(localName))
- child = new ExecutorMetaData();
- // <Listener/>
- else if("Listener".equals(localName))
- child = new ListenerMetaData();
- }
-
- if(parent instanceof EngineMetaData)
- {
- // <Valve/>
- if("Valve".equals(localName))
- child = new ValveMetaData();
- // <Host/>
- else if("Host".equals(localName))
- {
- HostMetaData host = new HostMetaData();
-
- host.setName(getAttribute("name", excludeAttributes, attrs));
-
- child = host;
-
- }
- // <Listener/>
- else if("Listener".equals(localName))
- child = new ListenerMetaData();
- // <Realm/>
- else if("Realm".equals(localName))
- child = new RealmMetaData();
- }
-
- if(parent instanceof HostMetaData)
- {
- // <Valve/>
- if("Valve".equals(localName))
- child = new ValveMetaData();
- // <Listener/>
- else if("Listener".equals(localName))
- child = new ListenerMetaData();
- // <Realm/>
- else if("Realm".equals(localName))
- child = new RealmMetaData();
- }
-
- // Handle attributes for AnyXmlMetaData
- if(child instanceof AnyXmlMetaData)
- {
- AnyXmlMetaData metaData = (AnyXmlMetaData) child;
- if( metaData.getAttributes() == null)
- metaData.setAttributes(new HashMap<String, Object>());
-
- // ClassName
- String className = getAttribute("className", excludeAttributes, attrs);
- metaData.setClassName(className);
-
- if(attrs != null)
- {
- for(int i = 0; i <attrs.getLength(); i++)
- {
- String key = attrs.getLocalName(i);
- if(excludeAttributes.contains(key))
- continue;
- //
- String value = attrs.getValue(i);
- metaData.getAttributes().put(key, value);
- }
- }
- return metaData;
- }
-
- return child;
- }
-
- public void setValue(Object o, UnmarshallingContext ctx, String namespaceURI, String localName, String value)
- {
- if(o instanceof HostMetaData)
- {
- HostMetaData metaData = (HostMetaData) o;
- // <Alias/>
- if("Alias".equals(localName))
- {
- if(metaData.getAliases() == null)
- metaData.setAliases(new ArrayList<String>());
- metaData.getAliases().add(value);
- }
- }
- }
-
- protected String getAttribute(String name, Set<String> excludeList, Attributes attrs)
- {
- if(attrs == null) return null;
-
- if(excludeList != null)
- excludeList.add(name);
-
- return attrs.getValue(name);
- }
-
-}
-
More information about the jboss-cvs-commits
mailing list