[jboss-cvs] JBossAS SVN: r66473 - in projects/metadata/trunk/src/main/java/org/jboss: metamodel/descriptor and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Oct 26 02:52:21 EDT 2007
Author: thomas.diesler at jboss.com
Date: 2007-10-26 02:52:21 -0400 (Fri, 26 Oct 2007)
New Revision: 66473
Added:
projects/metadata/trunk/src/main/java/org/jboss/metadata/serviceref/VirtualFileAdaptor.java
projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/ServiceRefDelegate.java
projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/ServiceRefObjectFactory.java
Removed:
projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/DeprecatedServiceRefDelegate.java
projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/DeprecatedServiceRefObjectFactory.java
Modified:
projects/metadata/trunk/src/main/java/org/jboss/metadata/serviceref/ServiceReferenceHandler.java
projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/DDObjectFactory.java
Log:
More work on service-ref handling
Modified: projects/metadata/trunk/src/main/java/org/jboss/metadata/serviceref/ServiceReferenceHandler.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/serviceref/ServiceReferenceHandler.java 2007-10-26 04:43:04 UTC (rev 66472)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/serviceref/ServiceReferenceHandler.java 2007-10-26 06:52:21 UTC (rev 66473)
@@ -99,12 +99,14 @@
result.setMappingFile(sref.getJaxrpcMappingFile());
result.setServiceQName(sref.getServiceQname());
- // TODO: should be unbounded
- PortComponentRef pcRef = sref.getPortComponentRef();
- if (pcRef != null)
+ List<? extends PortComponentRef> pcRefs = sref.getPortComponentRef();
+ if (pcRefs != null)
{
- UnifiedPortComponentRefMetaData upcRef = getUnifiedPortComponentRefMetaData(result, pcRef);
- result.addPortComponentRef(upcRef);
+ for (PortComponentRef pcRef : pcRefs)
+ {
+ UnifiedPortComponentRefMetaData upcRef = getUnifiedPortComponentRefMetaData(result, pcRef);
+ result.addPortComponentRef(upcRef);
+ }
}
ServiceReferenceHandlersMetaData srHandlers = sref.getHandlers();
@@ -127,10 +129,9 @@
for (ServiceReferenceHandlerChainMetaData srHandlerChain : srHandlerChainList)
{
UnifiedHandlerChainMetaData uHandlerChain = new UnifiedHandlerChainMetaData();
- // TODO: soapHeader should be a QName
- uHandlerChain.setServiceNamePattern(new QName(srHandlerChain.getServiceNamePattern()));
- uHandlerChain.setPortNamePattern(new QName(srHandlerChain.getPortNamePattern()));
- //uHandlerChain.setProtocolBindings(srHandlerChain.get);
+ uHandlerChain.setServiceNamePattern(srHandlerChain.getServiceNamePattern());
+ uHandlerChain.setPortNamePattern(srHandlerChain.getPortNamePattern());
+ uHandlerChain.setProtocolBindings(srHandlerChain.getProtocolBindings());
List<ServiceReferenceHandlerMetaData> srHandlerChainHandlers = srHandlerChain.getHandler();
Iterator<ServiceReferenceHandlerMetaData> it = srHandlerChainHandlers.iterator();
while (it.hasNext())
@@ -174,13 +175,12 @@
uhmd.addInitParam(param);
}
}
- List<String> soapHeaders = srhmd.getSoapHeader();
+ List<QName> soapHeaders = srhmd.getSoapHeader();
if (soapHeaders != null)
{
- for (String soapHeader : soapHeaders)
+ for (QName soapHeader : soapHeaders)
{
- // TODO: soapHeader should be a QName
- uhmd.addSoapHeader(new QName(soapHeader));
+ uhmd.addSoapHeader(soapHeader);
}
}
List<String> soapRoles = srhmd.getSoapRole();
Added: projects/metadata/trunk/src/main/java/org/jboss/metadata/serviceref/VirtualFileAdaptor.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metadata/serviceref/VirtualFileAdaptor.java (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/metadata/serviceref/VirtualFileAdaptor.java 2007-10-26 06:52:21 UTC (rev 66473)
@@ -0,0 +1,77 @@
+/*
+ * 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.metadata.serviceref;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+
+import java.io.IOException;
+import java.net.URL;
+
+// $Id: VirtualFileAdaptor.java 4049 2007-08-01 11:26:30Z thomas.diesler at jboss.com $
+
+/**
+ * A JBoss50 VirtualFile adaptor
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 05-May-2006
+ */
+public class VirtualFileAdaptor implements UnifiedVirtualFile
+{
+ private static final long serialVersionUID = 6547394037548338042L;
+
+ private VirtualFile root;
+
+ public VirtualFileAdaptor(VirtualFile root)
+ {
+ this.root = root;
+ }
+
+ public UnifiedVirtualFile findChild(String child) throws IOException
+ {
+ VirtualFile vf = root;
+ while (child.startsWith("./"))
+ {
+ child = child.substring(2);
+ }
+ while (child.startsWith("../"))
+ {
+ child = child.substring(3);
+ vf = vf.getParent();
+ }
+
+ vf = vf.findChild(child);
+ return new VirtualFileAdaptor(vf);
+ }
+
+ public URL toURL()
+ {
+ try
+ {
+ return root.toURL();
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+}
Modified: projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/DDObjectFactory.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/DDObjectFactory.java 2007-10-26 04:43:04 UTC (rev 66472)
+++ projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/DDObjectFactory.java 2007-10-26 06:52:21 UTC (rev 66473)
@@ -32,7 +32,7 @@
* @author Thomas.Diesler at jboss.com
* @version <tt>$Revision$</tt>
*/
-public abstract class DDObjectFactory extends DeprecatedServiceRefObjectFactory implements ObjectModelFactory
+public abstract class DDObjectFactory extends ServiceRefObjectFactory implements ObjectModelFactory
{
public Object newChild(PersistenceUnitRef ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
{
@@ -427,7 +427,7 @@
}
else if (localName.equals("service-ref"))
{
- child = new DeprecatedServiceRefDelegate().newServiceRefMetaData();
+ child = new ServiceRefDelegate().newServiceRefMetaData();
}
else if (localName.equals("jndi-ref"))
{
Deleted: projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/DeprecatedServiceRefDelegate.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/DeprecatedServiceRefDelegate.java 2007-10-26 04:43:04 UTC (rev 66472)
+++ projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/DeprecatedServiceRefDelegate.java 2007-10-26 06:52:21 UTC (rev 66473)
@@ -1,150 +0,0 @@
-/*
- * 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.metamodel.descriptor;
-
-// $Id$
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-
-import org.jboss.logging.Logger;
-import org.jboss.metadata.serviceref.ServiceReferenceHandler;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
-import org.jboss.wsf.spi.serviceref.ServiceRefElement;
-import org.jboss.wsf.spi.serviceref.ServiceRefHandler;
-import org.jboss.wsf.spi.serviceref.ServiceRefHandlerFactory;
-import org.jboss.wsf.spi.serviceref.ServiceRefMetaData;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.w3c.dom.Element;
-import org.xml.sax.Attributes;
-
-/**
- * Factory for ServiceRefHandler
- *
- * @author Thomas.Diesler at jboss.org
- * @since 05-May-2004
- */
- at Deprecated
-class DeprecatedServiceRefDelegate implements ServiceRefHandler
-{
- // provide logging
- private static final Logger log = Logger.getLogger(DeprecatedServiceRefDelegate.class);
-
- private static ServiceRefHandler delegate;
-
- public DeprecatedServiceRefDelegate()
- {
- if (delegate == null)
- {
- SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
- delegate = spiProvider.getSPI(ServiceRefHandlerFactory.class).getServiceRefHandler();
- }
-
- if (delegate == null)
- log.warn("ServiceRefHandler not available");
- }
-
- public ServiceRefMetaData newServiceRefMetaData()
- {
- ServiceRefMetaData sref;
- if (delegate != null)
- sref = delegate.newServiceRefMetaData();
- else
- sref = new DummyServiceRef();
- return sref;
- }
-
- public Object newChild(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
- {
- Object child = null;
- if (delegate != null)
- child = delegate.newChild(ref, navigator, namespaceURI, localName, attrs);
- return child;
- }
-
- public void setValue(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
- {
- if (delegate != null)
- delegate.setValue(ref, navigator, namespaceURI, localName, value);
- }
-
- public void bindServiceRef(Context encCtx, String encName, UnifiedVirtualFile vfsRoot, ClassLoader loader, ServiceRefMetaData sref) throws NamingException
- {
- throw new IllegalStateException("Invalid usage of deprecated method. Use " + ServiceReferenceHandler.class.getName());
- }
-
- public static class DummyServiceRef extends ServiceRefMetaData
- {
- private String refName;
-
- @Override
- public void setServiceRefName(String name)
- {
- this.refName = name;
- }
-
- @Override
- public String getServiceRefName()
- {
- return refName;
- }
-
- @Override
- public Object getAnnotatedElement()
- {
- return null;
- }
-
- @Override
- public void setAnnotatedElement(Object anElement)
- {
- }
-
- @Override
- public void importJBossXml(Element element)
- {
- }
-
- @Override
- public void importStandardXml(Element element)
- {
- }
-
- @Override
- public boolean isProcessed()
- {
- return false;
- }
-
- @Override
- public void setProcessed(boolean flag)
- {
- }
-
- @Override
- public void merge(ServiceRefMetaData serviceRef)
- {
- }
- }
-}
Deleted: projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/DeprecatedServiceRefObjectFactory.java
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/DeprecatedServiceRefObjectFactory.java 2007-10-26 04:43:04 UTC (rev 66472)
+++ projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/DeprecatedServiceRefObjectFactory.java 2007-10-26 06:52:21 UTC (rev 66473)
@@ -1,81 +0,0 @@
-/*
- * 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.metamodel.descriptor;
-
-// $Id$
-
-import org.jboss.logging.Logger;
-import org.jboss.wsf.spi.serviceref.ServiceRefElement;
-import org.jboss.xb.binding.ObjectModelFactory;
-import org.jboss.xb.binding.UnmarshallingContext;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.Element;
-import org.xml.sax.Attributes;
-
-/**
- * A object model factory for <service-ref>
- *
- * @author Thomas.Diesler at jboss.com
- */
- at Deprecated
-abstract class DeprecatedServiceRefObjectFactory implements ObjectModelFactory
-{
- // provide logging
- private static Logger log = Logger.getLogger(DeprecatedServiceRefObjectFactory.class);
-
-
- public Object newChild(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
- {
- return new DeprecatedServiceRefDelegate().newChild(ref, navigator, namespaceURI, localName, attrs);
- }
-
- public void setValue(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
- {
- new DeprecatedServiceRefDelegate().setValue(ref, navigator, namespaceURI, localName, value);
- }
-
- public static boolean isJ2EE14Descriptor(Element element)
- {
- // Verify J2EE-1.4
- String nsURI = element.getOwnerDocument().getDocumentElement().getNamespaceURI();
- boolean isValid = "http://java.sun.com/xml/ns/j2ee".equals(nsURI);
-
- // Verify JBoss-4.0
- DocumentType doctype = element.getOwnerDocument().getDoctype();
- if (isValid == false && doctype != null)
- {
- String publicId = doctype.getPublicId();
- isValid |= "-//JBoss//DTD JBOSS 4.0//EN".equals(publicId);
- isValid |= "-//JBoss//DTD JBOSS 4.2//EN".equals(publicId);
- isValid |= "-//JBoss//DTD Web Application 2.4//EN".equals(publicId);
- isValid |= "-//JBoss//DTD Application Client 4.0//EN".equals(publicId);
- isValid |= "-//JBoss//DTD Application Client 4.2//EN".equals(publicId);
- }
-
- if (isValid == false)
- {
- String dtstr = (doctype != null ? "[public=" + doctype.getPublicId() + ",system=" + doctype.getSystemId() + "]" : null);
- log.debug("Skip <service-ref> for: nsURI=" + nsURI + ",doctype=" + dtstr);
- }
- return isValid;
- }
-}
Copied: projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/ServiceRefDelegate.java (from rev 66472, projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/DeprecatedServiceRefDelegate.java)
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/ServiceRefDelegate.java (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/ServiceRefDelegate.java 2007-10-26 06:52:21 UTC (rev 66473)
@@ -0,0 +1,150 @@
+/*
+ * 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.metamodel.descriptor;
+
+// $Id$
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.jboss.logging.Logger;
+import org.jboss.metadata.serviceref.ServiceReferenceHandler;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.serviceref.ServiceRefElement;
+import org.jboss.wsf.spi.serviceref.ServiceRefHandler;
+import org.jboss.wsf.spi.serviceref.ServiceRefHandlerFactory;
+import org.jboss.wsf.spi.serviceref.ServiceRefMetaData;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+
+/**
+ * Factory for ServiceRefHandler
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 05-May-2004
+ */
+ at Deprecated
+public class ServiceRefDelegate implements ServiceRefHandler
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(ServiceRefDelegate.class);
+
+ private static ServiceRefHandler delegate;
+
+ public ServiceRefDelegate()
+ {
+ if (delegate == null)
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ delegate = spiProvider.getSPI(ServiceRefHandlerFactory.class).getServiceRefHandler();
+ }
+
+ if (delegate == null)
+ log.warn("ServiceRefHandler not available");
+ }
+
+ public ServiceRefMetaData newServiceRefMetaData()
+ {
+ ServiceRefMetaData sref;
+ if (delegate != null)
+ sref = delegate.newServiceRefMetaData();
+ else
+ sref = new DummyServiceRef();
+ return sref;
+ }
+
+ public Object newChild(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ if (delegate != null)
+ child = delegate.newChild(ref, navigator, namespaceURI, localName, attrs);
+ return child;
+ }
+
+ public void setValue(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+ {
+ if (delegate != null)
+ delegate.setValue(ref, navigator, namespaceURI, localName, value);
+ }
+
+ public void bindServiceRef(Context encCtx, String encName, UnifiedVirtualFile vfsRoot, ClassLoader loader, ServiceRefMetaData sref) throws NamingException
+ {
+ throw new IllegalStateException("Invalid usage of deprecated method. Use " + ServiceReferenceHandler.class.getName());
+ }
+
+ public static class DummyServiceRef extends ServiceRefMetaData
+ {
+ private String refName;
+
+ @Override
+ public void setServiceRefName(String name)
+ {
+ this.refName = name;
+ }
+
+ @Override
+ public String getServiceRefName()
+ {
+ return refName;
+ }
+
+ @Override
+ public Object getAnnotatedElement()
+ {
+ return null;
+ }
+
+ @Override
+ public void setAnnotatedElement(Object anElement)
+ {
+ }
+
+ @Override
+ public void importJBossXml(Element element)
+ {
+ }
+
+ @Override
+ public void importStandardXml(Element element)
+ {
+ }
+
+ @Override
+ public boolean isProcessed()
+ {
+ return false;
+ }
+
+ @Override
+ public void setProcessed(boolean flag)
+ {
+ }
+
+ @Override
+ public void merge(ServiceRefMetaData serviceRef)
+ {
+ }
+ }
+}
Copied: projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/ServiceRefObjectFactory.java (from rev 66472, projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/DeprecatedServiceRefObjectFactory.java)
===================================================================
--- projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/ServiceRefObjectFactory.java (rev 0)
+++ projects/metadata/trunk/src/main/java/org/jboss/metamodel/descriptor/ServiceRefObjectFactory.java 2007-10-26 06:52:21 UTC (rev 66473)
@@ -0,0 +1,81 @@
+/*
+ * 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.metamodel.descriptor;
+
+// $Id$
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.serviceref.ServiceRefElement;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.w3c.dom.DocumentType;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+
+/**
+ * A object model factory for <service-ref>
+ *
+ * @author Thomas.Diesler at jboss.com
+ */
+ at Deprecated
+public abstract class ServiceRefObjectFactory implements ObjectModelFactory
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(ServiceRefObjectFactory.class);
+
+
+ public Object newChild(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ return new ServiceRefDelegate().newChild(ref, navigator, namespaceURI, localName, attrs);
+ }
+
+ public void setValue(ServiceRefElement ref, UnmarshallingContext navigator, String namespaceURI, String localName, String value)
+ {
+ new ServiceRefDelegate().setValue(ref, navigator, namespaceURI, localName, value);
+ }
+
+ public static boolean isJ2EE14Descriptor(Element element)
+ {
+ // Verify J2EE-1.4
+ String nsURI = element.getOwnerDocument().getDocumentElement().getNamespaceURI();
+ boolean isValid = "http://java.sun.com/xml/ns/j2ee".equals(nsURI);
+
+ // Verify JBoss-4.0
+ DocumentType doctype = element.getOwnerDocument().getDoctype();
+ if (isValid == false && doctype != null)
+ {
+ String publicId = doctype.getPublicId();
+ isValid |= "-//JBoss//DTD JBOSS 4.0//EN".equals(publicId);
+ isValid |= "-//JBoss//DTD JBOSS 4.2//EN".equals(publicId);
+ isValid |= "-//JBoss//DTD Web Application 2.4//EN".equals(publicId);
+ isValid |= "-//JBoss//DTD Application Client 4.0//EN".equals(publicId);
+ isValid |= "-//JBoss//DTD Application Client 4.2//EN".equals(publicId);
+ }
+
+ if (isValid == false)
+ {
+ String dtstr = (doctype != null ? "[public=" + doctype.getPublicId() + ",system=" + doctype.getSystemId() + "]" : null);
+ log.debug("Skip <service-ref> for: nsURI=" + nsURI + ",doctype=" + dtstr);
+ }
+ return isValid;
+ }
+}
More information about the jboss-cvs-commits
mailing list