[jboss-cvs] JBossAS SVN: r73683 - in trunk/connector: src/main/org/jboss/resource/deployers and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon May 26 10:41:17 EDT 2008
Author: adrian at jboss.org
Date: 2008-05-26 10:41:17 -0400 (Mon, 26 May 2008)
New Revision: 73683
Added:
trunk/connector/src/main/org/jboss/resource/deployers/ManagedConnectionFactoryClassLoaderDeployer.java
trunk/connector/src/main/org/jboss/resource/metadata/mcf/LoaderRepositoryAdapter.java
Modified:
trunk/connector/build.xml
trunk/connector/src/main/org/jboss/resource/metadata/mcf/ManagedConnectionFactoryDeploymentGroup.java
trunk/connector/src/resources/deployers/jca-deployers-beans.xml
Log:
[JBAS-5547] - Parse and use loader-repository in -ds.xml files in the new MCF deployer
Modified: trunk/connector/build.xml
===================================================================
--- trunk/connector/build.xml 2008-05-26 14:40:00 UTC (rev 73682)
+++ trunk/connector/build.xml 2008-05-26 14:41:17 UTC (rev 73683)
@@ -81,6 +81,7 @@
<path refid="quartz.quartz.classpath"/>
<path refid="jboss.metadata.classpath"/>
<path refid="jboss.jboss.deployers.classpath"/>
+ <path refid="jboss.jboss.cl.classpath"/>
<path refid="jboss.jboss.man.classpath"/>
<path refid="jboss.jboss.mdr.classpath"/>
<path refid="jboss.jboss.reflect.classpath"/>
Added: trunk/connector/src/main/org/jboss/resource/deployers/ManagedConnectionFactoryClassLoaderDeployer.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/deployers/ManagedConnectionFactoryClassLoaderDeployer.java (rev 0)
+++ trunk/connector/src/main/org/jboss/resource/deployers/ManagedConnectionFactoryClassLoaderDeployer.java 2008-05-26 14:41:17 UTC (rev 73683)
@@ -0,0 +1,107 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.resource.deployers;
+
+import java.io.ByteArrayInputStream;
+import java.util.Properties;
+
+import javax.management.ObjectName;
+
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.classloading.spi.metadata.ExportAll;
+import org.jboss.classloading.spi.version.Version;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfig;
+import org.jboss.resource.metadata.mcf.ManagedConnectionFactoryDeploymentGroup;
+
+/**
+ * ManagedConnectionFactoryClassLoaderDeployer.
+ *
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class ManagedConnectionFactoryClassLoaderDeployer extends AbstractSimpleRealDeployer<ManagedConnectionFactoryDeploymentGroup>
+{
+ public ManagedConnectionFactoryClassLoaderDeployer()
+ {
+ super(ManagedConnectionFactoryDeploymentGroup.class);
+ setStage(DeploymentStages.POST_PARSE);
+ setOutput(ClassLoadingMetaData.class);
+ }
+
+ public void deploy(DeploymentUnit unit, ManagedConnectionFactoryDeploymentGroup deployment) throws DeploymentException
+ {
+ ClassLoadingMetaData classLoadingMetaData = unit.getAttachment(ClassLoadingMetaData.class);
+ if (classLoadingMetaData != null)
+ {
+ log.warn("Not converting LoaderRepositoryConfig to ClassLoadingMetaData for " + unit.getName() + " since it already exists: " + classLoadingMetaData);
+ return;
+ }
+
+ LoaderRepositoryConfig loaderConfig = deployment.getLoaderRepositoryConfig();
+ if (loaderConfig == null)
+ return;
+
+ ObjectName name = loaderConfig.repositoryName;
+ if (name != null)
+ {
+ String domain = name.getCanonicalName().trim();
+ if (domain.length() != 0)
+ {
+ ClassLoadingMetaData metaData = new ClassLoadingMetaData();
+ metaData.setName(unit.getName());
+ metaData.setDomain(domain);
+ metaData.setExportAll(ExportAll.NON_EMPTY);
+ metaData.setImportAll(true);
+ metaData.setVersion(Version.DEFAULT_VERSION);
+
+ Properties props = new Properties();
+ String config = loaderConfig.repositoryConfig;
+ try
+ {
+ if (config != null)
+ {
+ ByteArrayInputStream bais = new ByteArrayInputStream(config.getBytes());
+ props.load(bais);
+ }
+ }
+ catch (Exception e)
+ {
+ throw DeploymentException.rethrowAsDeploymentException("Error parsing repository config " + config, e);
+ }
+ String java2ParentDelegation = props.getProperty("java2ParentDelegation");
+ if( java2ParentDelegation == null )
+ {
+ // Check for previous mis-spelled property name
+ java2ParentDelegation = props.getProperty("java2ParentDelegaton", "false");
+ }
+ boolean useParentFirst = Boolean.valueOf(java2ParentDelegation).booleanValue();
+ metaData.setJ2seClassLoadingCompliance(useParentFirst);
+
+ unit.addAttachment(ClassLoadingMetaData.class, metaData);
+ }
+ }
+ }
+}
Added: trunk/connector/src/main/org/jboss/resource/metadata/mcf/LoaderRepositoryAdapter.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/metadata/mcf/LoaderRepositoryAdapter.java (rev 0)
+++ trunk/connector/src/main/org/jboss/resource/metadata/mcf/LoaderRepositoryAdapter.java 2008-05-26 14:41:17 UTC (rev 73683)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.resource.metadata.mcf;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+
+import org.jboss.mx.loading.LoaderRepositoryFactory;
+import org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfig;
+import org.w3c.dom.Element;
+
+/**
+ * A ServiceMetaDataAdapter.
+ *
+ * @author <a href="weston.price at jboss.org">Weston Price</a>
+ * @version $Revision: 1.1 $
+ */
+public class LoaderRepositoryAdapter extends XmlAdapter<Object, LoaderRepositoryConfig>
+{
+
+ @Override
+ public LoaderRepositoryConfig unmarshal(Object e) throws Exception
+ {
+ return LoaderRepositoryFactory.parseRepositoryConfig((Element) e);
+ }
+
+ @Override
+ public Element marshal(LoaderRepositoryConfig arg0) throws Exception
+ {
+ // TODO implement marshalling
+ return null;
+ }
+}
Modified: trunk/connector/src/main/org/jboss/resource/metadata/mcf/ManagedConnectionFactoryDeploymentGroup.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/metadata/mcf/ManagedConnectionFactoryDeploymentGroup.java 2008-05-26 14:40:00 UTC (rev 73682)
+++ trunk/connector/src/main/org/jboss/resource/metadata/mcf/ManagedConnectionFactoryDeploymentGroup.java 2008-05-26 14:41:17 UTC (rev 73683)
@@ -36,6 +36,7 @@
import org.jboss.managed.api.annotation.ManagementObject;
import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.mx.loading.LoaderRepositoryFactory.LoaderRepositoryConfig;
import org.jboss.system.metadata.ServiceMetaData;
/**
@@ -68,6 +69,11 @@
@XmlElement(name="mbean")
@XmlJavaTypeAdapter(ServiceMetaDataAdapter.class)
private List<ServiceMetaData> services = new ArrayList<ServiceMetaData>();
+
+ /** The loader repository config */
+ @XmlElement(name="loader-repository")
+ @XmlJavaTypeAdapter(LoaderRepositoryAdapter.class)
+ private LoaderRepositoryConfig loaderRepositoryConfig;
public void addManagedConnectionFactoryDeployment(ManagedConnectionFactoryDeploymentMetaData deployment)
{
@@ -130,6 +136,26 @@
public void setServices(List<ServiceMetaData> services)
{
this.services = services;
+ }
+
+ /**
+ * Get the loaderRepositoryConfig.
+ *
+ * @return the loaderRepositoryConfig.
+ */
+ public LoaderRepositoryConfig getLoaderRepositoryConfig()
+ {
+ return loaderRepositoryConfig;
+ }
+
+ /**
+ * Set the loaderRepositoryConfig.
+ *
+ * @param loaderRepositoryConfig the loaderRepositoryConfig.
+ */
+ public void setLoaderRepositoryConfig(LoaderRepositoryConfig loaderRepositoryConfig)
+ {
+ this.loaderRepositoryConfig = loaderRepositoryConfig;
}
}
Modified: trunk/connector/src/resources/deployers/jca-deployers-beans.xml
===================================================================
--- trunk/connector/src/resources/deployers/jca-deployers-beans.xml 2008-05-26 14:40:00 UTC (rev 73682)
+++ trunk/connector/src/resources/deployers/jca-deployers-beans.xml 2008-05-26 14:41:17 UTC (rev 73683)
@@ -21,6 +21,8 @@
</bean>
+ <!-- Legacy MCF loader-repository support -->
+ <bean name="MCFClassLoaderDeployer" class="org.jboss.resource.deployers.ManagedConnectionFactoryClassLoaderDeployer"/>
<!-- ConnectionFactory Deployment - ->
More information about the jboss-cvs-commits
mailing list