[jboss-cvs] JBossAS SVN: r108639 - in projects/jboss-jca/trunk: core/src/main/java/org/jboss/jca/core/management and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 18 16:23:01 EDT 2010
Author: jesper.pedersen
Date: 2010-10-18 16:23:00 -0400 (Mon, 18 Oct 2010)
New Revision: 108639
Added:
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/AdminObject.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/ConfigProperty.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/Connector.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/ManagedConnectionFactory.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/ManagementRepository.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/ResourceAdapter.java
projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/package.html
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractFungalDeployment.java
Modified:
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/CommonDeployment.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractFungalRADeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivatorDeployment.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployment.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployment.java
projects/jboss-jca/trunk/embedded/src/main/resources/jca.xml
projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/jca.xml
Log:
[JBJCA-445] Create management model
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/AdminObject.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/AdminObject.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/AdminObject.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jca.core.management;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents an admin object instance
+ *
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class AdminObject
+{
+ /** The object instance */
+ private WeakReference<Object> instance;
+
+ /** The config property's */
+ private List<ConfigProperty> configProperties;
+
+ /**
+ * Constructor
+ * @param ao The admin object instance
+ */
+ public AdminObject(Object ao)
+ {
+ this.instance = new WeakReference<Object>(ao);
+ this.configProperties = null;
+ }
+
+ /**
+ * Get the admin object instance.
+ *
+ * Note, that the value may be <code>null</code> if the admin object was
+ * undeployed and this object wasn't cleared up correctly.
+ * @return The instance
+ */
+ public Object getAdminObject()
+ {
+ return instance.get();
+ }
+
+ /**
+ * Get the list of config property's
+ * @return The value
+ */
+ public List<ConfigProperty> getConfigProperties()
+ {
+ if (configProperties == null)
+ configProperties = new ArrayList<ConfigProperty>(1);
+
+ return configProperties;
+ }
+}
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/ConfigProperty.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/ConfigProperty.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/ConfigProperty.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jca.core.management;
+
+/**
+ * Represents a config property
+ *
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class ConfigProperty
+{
+ /** The name */
+ private String name;
+
+ /** The dynamic flag */
+ private boolean dynamic;
+
+ /** The confidential flag */
+ private boolean confidential;
+
+ /**
+ * Constructor
+ * @param name The name
+ */
+ public ConfigProperty(String name)
+ {
+ this(name, false, false);
+ }
+
+ /**
+ * Constructor
+ * @param name The name
+ * @param dynamic Does this config property support dynamic updates
+ * @param confidential Is this config property confidential
+ */
+ public ConfigProperty(String name, boolean dynamic, boolean confidential)
+ {
+ this.name = name;
+ this.dynamic = dynamic;
+ this.confidential = confidential;
+ }
+
+ /**
+ * Get the name
+ * @return The value
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Get the dynamic flag
+ * @return The value
+ */
+ public boolean isDynamic()
+ {
+ return dynamic;
+ }
+
+ /**
+ * Get the confidential flag
+ * @return The value
+ */
+ public boolean isConfidential()
+ {
+ return confidential;
+ }
+}
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/Connector.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/Connector.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/Connector.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jca.core.management;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents a connector instance
+ *
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class Connector
+{
+ /** The unique id */
+ private String uniqueId;
+
+ /** The resource adapter instance */
+ private ResourceAdapter resourceAdapter;
+
+ /** The managed connection factories */
+ private List<ManagedConnectionFactory> managedConnectionFactories;
+
+ /** The admin objects */
+ private List<AdminObject> adminObjects;
+
+ /**
+ * Constructor
+ * @param uniqueId The unique id
+ */
+ public Connector(String uniqueId)
+ {
+ this.uniqueId = uniqueId;
+ this.resourceAdapter = null;
+ this.managedConnectionFactories = null;
+ this.adminObjects = null;
+ }
+
+ /**
+ * Get the unique id
+ * @return The value
+ */
+ public String getUniqueId()
+ {
+ return uniqueId;
+ }
+
+ /**
+ * Get the resource adapter
+ * @return The value
+ */
+ public ResourceAdapter getResourceAdapter()
+ {
+ return resourceAdapter;
+ }
+
+ /**
+ * Set the resource adapter
+ * @param ra The value
+ */
+ public void setResourceAdapter(ResourceAdapter ra)
+ {
+ this.resourceAdapter = ra;
+ }
+
+ /**
+ * Get the list of managed connection factories
+ * @return The value
+ */
+ public List<ManagedConnectionFactory> getManagedConnectionFactories()
+ {
+ if (managedConnectionFactories == null)
+ managedConnectionFactories = new ArrayList<ManagedConnectionFactory>(1);
+
+ return managedConnectionFactories;
+ }
+
+ /**
+ * Get the list of admin objects
+ * @return The value
+ */
+ public List<AdminObject> getAdminObjects()
+ {
+ if (adminObjects == null)
+ adminObjects = new ArrayList<AdminObject>(1);
+
+ return adminObjects;
+ }
+}
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/ManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/ManagedConnectionFactory.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/ManagedConnectionFactory.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jca.core.management;
+
+import org.jboss.jca.core.connectionmanager.pool.api.Pool;
+import org.jboss.jca.core.connectionmanager.pool.api.PoolConfiguration;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents a managed connection factory instance
+ *
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class ManagedConnectionFactory
+{
+ /** The object instance */
+ private WeakReference<javax.resource.spi.ManagedConnectionFactory> instance;
+
+ /** The config property's */
+ private List<ConfigProperty> configProperties;
+
+ /** The pool instance */
+ private WeakReference<Pool> pool;
+
+ /** The pool configuration instance */
+ private WeakReference<PoolConfiguration> poolConfiguration;
+
+ /**
+ * Constructor
+ * @param mcf The managed connection factory instance
+ */
+ public ManagedConnectionFactory(javax.resource.spi.ManagedConnectionFactory mcf)
+ {
+ this.instance = new WeakReference<javax.resource.spi.ManagedConnectionFactory>(mcf);
+ this.configProperties = null;
+ this.pool = null;
+ this.poolConfiguration = null;
+ }
+
+ /**
+ * Get the managed connection factory instance.
+ *
+ * Note, that the value may be <code>null</code> if the managed connection factory was
+ * undeployed and this object wasn't cleared up correctly.
+ * @return The instance
+ */
+ public javax.resource.spi.ManagedConnectionFactory getManagedConnectionFactory()
+ {
+ return instance.get();
+ }
+
+ /**
+ * Get the list of config property's
+ * @return The value
+ */
+ public List<ConfigProperty> getConfigProperties()
+ {
+ if (configProperties == null)
+ configProperties = new ArrayList<ConfigProperty>(1);
+
+ return configProperties;
+ }
+
+ /**
+ * Get the pool instance.
+ *
+ * Note, that the value may be <code>null</code> if the pool was
+ * undeployed and this object wasn't cleared up correctly.
+ * @return The instance
+ */
+ public Pool getPool()
+ {
+ if (pool == null)
+ return null;
+
+ return pool.get();
+ }
+
+ /**
+ * Set the pool
+ * @param p The pool
+ */
+ public void setPool(Pool p)
+ {
+ this.pool = new WeakReference<Pool>(p);
+ }
+
+ /**
+ * Get the pool configuration instance.
+ *
+ * Note, that the value may be <code>null</code> if the pool configuration was
+ * undeployed and this object wasn't cleared up correctly.
+ * @return The instance
+ */
+ public PoolConfiguration getPoolConfiguration()
+ {
+ if (poolConfiguration == null)
+ return null;
+
+ return poolConfiguration.get();
+ }
+
+ /**
+ * Set the pool configuration
+ * @param pc The pool configuration
+ */
+ public void setPoolConfiguration(PoolConfiguration pc)
+ {
+ this.poolConfiguration = new WeakReference<PoolConfiguration>(pc);
+ }
+}
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/ManagementRepository.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/ManagementRepository.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/ManagementRepository.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jca.core.management;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * The management repository
+ *
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class ManagementRepository
+{
+ /** The instance */
+ private static final ManagementRepository INSTANCE = new ManagementRepository();
+
+ /** Resource adapter archives */
+ private List<Connector> connectors;
+
+ /**
+ * Constructor
+ */
+ private ManagementRepository()
+ {
+ this.connectors = Collections.synchronizedList(new ArrayList<Connector>(1));
+ }
+
+ /**
+ * Get the instance
+ * @return The instance
+ */
+ public ManagementRepository getInstance()
+ {
+ return INSTANCE;
+ }
+
+ /**
+ * Get the list of connectors
+ * @return The value
+ */
+ public List<Connector> getConnectors()
+ {
+ if (connectors == null)
+ connectors = new ArrayList<Connector>(1);
+
+ return connectors;
+ }
+}
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/ResourceAdapter.java
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/ResourceAdapter.java (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/ResourceAdapter.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, 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.jca.core.management;
+
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Represents a resource adapter instance
+ *
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class ResourceAdapter
+{
+ /** The object instance */
+ private WeakReference<javax.resource.spi.ResourceAdapter> instance;
+
+ /** The config property's */
+ private List<ConfigProperty> configProperties;
+
+ /**
+ * Constructor
+ * @param ra The resource adapter instance
+ */
+ public ResourceAdapter(javax.resource.spi.ResourceAdapter ra)
+ {
+ this.instance = new WeakReference<javax.resource.spi.ResourceAdapter>(ra);
+ this.configProperties = null;
+ }
+
+ /**
+ * Get the resource adapter instance.
+ *
+ * Note, that the value may be <code>null</code> if the resource adapter was
+ * undeployed and this object wasn't cleared up correctly.
+ * @return The instance
+ */
+ public javax.resource.spi.ResourceAdapter getResourceAdapter()
+ {
+ return instance.get();
+ }
+
+ /**
+ * Get the list of config property's
+ * @return The value
+ */
+ public List<ConfigProperty> getConfigProperties()
+ {
+ if (configProperties == null)
+ configProperties = new ArrayList<ConfigProperty>(1);
+
+ return configProperties;
+ }
+}
Added: projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/package.html
===================================================================
--- projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/package.html (rev 0)
+++ projects/jboss-jca/trunk/core/src/main/java/org/jboss/jca/core/management/package.html 2010-10-18 20:23:00 UTC (rev 108639)
@@ -0,0 +1,3 @@
+<body>
+This package contains management view of the container in a non-technology specific way.
+</body>
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java 2010-10-18 20:20:24 UTC (rev 108638)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractDsDeployer.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -268,7 +268,7 @@
return new CommonDeployment(url, deploymentName, true, null,
cfs.toArray(new Object[cfs.size()]), jndis.toArray(new String[jndis.size()]),
- null, null,
+ null, null, null,
parentClassLoader, log);
}
catch (Throwable t)
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2010-10-18 20:20:24 UTC (rev 108638)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/AbstractResourceAdapterDeployer.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -578,6 +578,7 @@
* @param aosIronJacamar Admin object definitions from ironjacamar.xml
* @param aos The resulting array of admin objects
* @param aoJndiNames The resulting array of JNDI names
+ * @param mgtConnector The management view of the connector
* @return failures updated after implemented operations
* @throws DeployException DeployException in case of errors
*/
@@ -586,7 +587,8 @@
URL url, String deploymentName, boolean activateDeployment,
List<org.jboss.jca.common.api.metadata.common.CommonAdminObject> aosRaXml,
List<org.jboss.jca.common.api.metadata.common.CommonAdminObject> aosIronJacamar,
- Object[] aos, String[] aoJndiNames)
+ Object[] aos, String[] aoJndiNames,
+ org.jboss.jca.core.management.Connector mgtConnector)
throws DeployException
{
// AdminObject
@@ -657,6 +659,14 @@
aos[i] = ao;
aoJndiNames[i] = jndiName;
+
+ org.jboss.jca.core.management.AdminObject mgtAo =
+ new org.jboss.jca.core.management.AdminObject(ao);
+
+ mgtAo.getConfigProperties().
+ addAll(createManagementView(aoMeta.getConfigProperties()));
+
+ mgtConnector.getAdminObjects().add(mgtAo);
}
catch (Throwable t)
{
@@ -731,6 +741,13 @@
if (cmd != null && cmd.getLicense() != null && cmd.getLicense().isLicenseRequired())
log.info("Required license terms for " + url.toExternalForm());
+ String mgtUniqueId = url.getFile();
+ if (mgtUniqueId.indexOf("/") != -1)
+ mgtUniqueId = mgtUniqueId.substring(mgtUniqueId.lastIndexOf("/") + 1);
+
+ org.jboss.jca.core.management.Connector mgtConnector =
+ new org.jboss.jca.core.management.Connector(mgtUniqueId);
+
ResourceAdapter resourceAdapter = null;
List<Validate> archiveValidationObjects = new ArrayList<Validate>();
List<Object> beanValidationObjects = new ArrayList<Object>();
@@ -773,6 +790,12 @@
archiveValidationObjects.add(new ValidateObject(Key.RESOURCE_ADAPTER, resourceAdapter, ra1516
.getConfigProperties()));
beanValidationObjects.add(resourceAdapter);
+
+ org.jboss.jca.core.management.ResourceAdapter mgtRa =
+ new org.jboss.jca.core.management.ResourceAdapter(resourceAdapter);
+
+ mgtRa.getConfigProperties().addAll(createManagementView(ra1516.getConfigProperties()));
+ mgtConnector.setResourceAdapter(mgtRa);
}
}
}
@@ -995,6 +1018,15 @@
cm.setJndiName(cfJndiNames[0]);
}
+
+ org.jboss.jca.core.management.ManagedConnectionFactory mgtMcf =
+ new org.jboss.jca.core.management.ManagedConnectionFactory(mcf);
+
+ mgtMcf.getConfigProperties().addAll(createManagementView(ra10.getConfigProperties()));
+ mgtMcf.setPoolConfiguration(pc);
+ mgtMcf.setPool(pool);
+
+ mgtConnector.getManagedConnectionFactories().add(mgtMcf);
}
}
}
@@ -1243,6 +1275,15 @@
cm.setJndiName(cfJndiNames[0]);
}
+ org.jboss.jca.core.management.ManagedConnectionFactory mgtMcf =
+ new org.jboss.jca.core.management.ManagedConnectionFactory(mcf);
+
+ mgtMcf.getConfigProperties().
+ addAll(createManagementView(cdMeta.getConfigProperties()));
+ mgtMcf.setPoolConfiguration(pc);
+ mgtMcf.setPool(pool);
+
+ mgtConnector.getManagedConnectionFactories().add(mgtMcf);
}
}
}
@@ -1259,7 +1300,7 @@
deploymentName, activateDeployment,
raxml != null ? raxml.getAdminObjects() : null,
ijmd != null ? ijmd.getAdminObjects() : null,
- aos, aoJndiNames);
+ aos, aoJndiNames, mgtConnector);
}
// Archive validation
@@ -1345,7 +1386,7 @@
}
return new CommonDeployment(url, deploymentName, activateDeployment, resourceAdapter, cfs, cfJndiNames,
- aos, aoJndiNames, cl, log);
+ aos, aoJndiNames, mgtConnector, cl, log);
}
catch (DeployException de)
@@ -1371,6 +1412,54 @@
}
/**
+ * Get management views for config property's
+ * @param cps The config property's
+ * @return The management view of these
+ */
+ private List<org.jboss.jca.core.management.ConfigProperty> createManagementView(List<? extends ConfigProperty> cps)
+ {
+ List<org.jboss.jca.core.management.ConfigProperty> result =
+ new ArrayList<org.jboss.jca.core.management.ConfigProperty>();
+
+ if (cps != null)
+ {
+ for (ConfigProperty cp : cps)
+ {
+ org.jboss.jca.core.management.ConfigProperty mgtCp = null;
+
+ if (cp instanceof org.jboss.jca.common.api.metadata.ra.ra16.ConfigProperty16)
+ {
+ org.jboss.jca.common.api.metadata.ra.ra16.ConfigProperty16 cp16 =
+ (org.jboss.jca.common.api.metadata.ra.ra16.ConfigProperty16)cp;
+
+ Boolean dynamic = cp16.getConfigPropertySupportsDynamicUpdates();
+ if (dynamic == null)
+ dynamic = Boolean.FALSE;
+
+ Boolean confidential = cp16.getConfigPropertyConfidential();
+ if (confidential == null)
+ confidential = Boolean.FALSE;
+
+ mgtCp =
+ new org.jboss.jca.core.management.ConfigProperty(
+ cp.getConfigPropertyName().getValue(),
+ dynamic.booleanValue(), confidential.booleanValue());
+ }
+ else
+ {
+ mgtCp =
+ new org.jboss.jca.core.management.ConfigProperty(
+ cp.getConfigPropertyName().getValue());
+ }
+
+ result.add(mgtCp);
+ }
+ }
+
+ return result;
+ }
+
+ /**
*
* get The directory where write error reports
*
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/CommonDeployment.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/CommonDeployment.java 2010-10-18 20:20:24 UTC (rev 108638)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/CommonDeployment.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -21,6 +21,8 @@
*/
package org.jboss.jca.deployers.common;
+import org.jboss.jca.core.management.Connector;
+
import java.net.URL;
import java.util.Arrays;
@@ -54,6 +56,8 @@
private final String[] aoJndiNames;
+ private final Connector connector;
+
private final ClassLoader cl;
private final Logger log;
@@ -69,12 +73,14 @@
* @param cfJndiNames The JNDI names for the connection factories
* @param aos The admin objects
* @param aoJndiNames The JNDI names for the admin objects
+ * @param connector The management view of a connector
* @param cl cl
* @param log log
*/
public CommonDeployment(URL url, String deploymentName, boolean activateDeployment,
ResourceAdapter resourceAdapter, Object[] cfs, String[] cfJndiNames,
Object[] aos, String[] aoJndiNames,
+ Connector connector,
ClassLoader cl, Logger log)
{
super();
@@ -86,6 +92,7 @@
this.cfJndiNames = cfJndiNames != null ? Arrays.copyOf(cfJndiNames, cfJndiNames.length) : null;
this.aos = aos != null ? Arrays.copyOf(aos, aos.length) : null;
this.aoJndiNames = aoJndiNames != null ? Arrays.copyOf(aoJndiNames, aoJndiNames.length) : null;
+ this.connector = connector;
this.cl = cl;
this.log = log;
}
@@ -171,6 +178,15 @@
}
/**
+ * Get the management view of the connector
+ * @return The value
+ */
+ public final Connector getConnector()
+ {
+ return connector;
+ }
+
+ /**
* Get the cl.
*
* @return the cl.
Added: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractFungalDeployment.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractFungalDeployment.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractFungalDeployment.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -0,0 +1,264 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2010, 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.jca.deployers.fungal;
+
+import org.jboss.jca.core.spi.mdr.MetadataRepository;
+import org.jboss.jca.core.spi.mdr.NotFoundException;
+import org.jboss.jca.core.spi.naming.JndiStrategy;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.resource.spi.ResourceAdapter;
+
+import org.jboss.logging.Logger;
+
+import com.github.fungal.spi.deployers.Deployment;
+
+/**
+ * A resource adapter deployment for JCA/SJC
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public abstract class AbstractFungalDeployment implements Deployment
+{
+ /** The logger */
+ protected Logger log;
+
+ /** The deployment */
+ protected URL deployment;
+
+ /** The deployment name */
+ protected String deploymentName;
+
+ /** Activator */
+ protected boolean activator;
+
+ /** The resource adapter instance */
+ protected ResourceAdapter ra;
+
+ /** The JNDI strategy */
+ protected JndiStrategy jndiStrategy;
+
+ /** The MDR */
+ protected MetadataRepository mdr;
+
+ /** The connection factories */
+ protected Object[] cfs;
+
+ /** The JNDI names of the connection factories */
+ protected String[] cfJndis;
+
+ /** The admin objects */
+ protected Object[] aos;
+
+ /** The JNDI names of the admin objects */
+ protected String[] aoJndis;
+
+ /** The MBeanServer */
+ protected MBeanServer server;
+
+ /** The ObjectName's */
+ protected List<ObjectName> objectNames;
+
+ /** The classloader */
+ protected ClassLoader cl;
+
+ /**
+ * Constructor
+ * @param deployment The deployment
+ * @param deploymentName The deployment name
+ * @param activator Is this the activator of the deployment
+ * @param ra The resource adapter instance if present
+ * @param jndiStrategy The JNDI strategy
+ * @param metadataRepository The metadata repository
+ * @param cfs The connection factories
+ * @param cfJndis The JNDI names of the connection factories
+ * @param aos The admin objects
+ * @param aoJndis The JNDI names of the admin objects
+ * @param server The MBeanServer
+ * @param objectNames The ObjectNames
+ * @param cl The classloader for the deployment
+ * @param log The logger
+ */
+ public AbstractFungalDeployment(URL deployment, String deploymentName, boolean activator, ResourceAdapter ra,
+ JndiStrategy jndiStrategy, MetadataRepository metadataRepository,
+ Object[] cfs, String[] cfJndis,
+ Object[] aos, String[] aoJndis,
+ MBeanServer server, List<ObjectName> objectNames,
+ ClassLoader cl, Logger log)
+ {
+ this.deployment = deployment;
+ this.deploymentName = deploymentName;
+ this.activator = activator;
+ this.ra = ra;
+ this.jndiStrategy = jndiStrategy;
+ this.mdr = metadataRepository;
+ this.cfs = cfs;
+ this.cfJndis = cfJndis;
+ this.aos = aos;
+ this.aoJndis = aoJndis;
+ this.server = server;
+ this.objectNames = objectNames;
+ this.cl = cl;
+ this.log = log;
+ }
+
+ /**
+ * Get the unique URL for the deployment
+ * @return The URL
+ */
+ @Override
+ public URL getURL()
+ {
+ return deployment;
+ }
+
+ /**
+ * Get the classloader
+ * @return The classloader
+ */
+ @Override
+ public ClassLoader getClassLoader()
+ {
+ return cl;
+ }
+
+ /**
+ * Stop
+ */
+ public void stop()
+ {
+ if (activator)
+ {
+ log.debug("Undeploying: " + deployment.toExternalForm());
+
+ if (server != null && objectNames != null)
+ {
+ for (ObjectName on : objectNames)
+ {
+ try
+ {
+ server.unregisterMBean(on);
+ }
+ catch (Throwable t)
+ {
+ log.warn("Exception during unregistering deployment", t);
+ }
+ }
+ }
+
+ if (mdr != null && cfs != null && cfJndis != null)
+ {
+ for (int i = 0; i < cfs.length; i++)
+ {
+ try
+ {
+ String cf = cfs[i].getClass().getName();
+ String jndi = cfJndis[i];
+
+ mdr.unregisterJndiMapping(deployment.toExternalForm(), cf, jndi);
+ }
+ catch (NotFoundException nfe)
+ {
+ log.warn("Exception during unregistering deployment", nfe);
+ }
+ }
+ }
+
+ if (mdr != null && aos != null && aoJndis != null)
+ {
+ for (int i = 0; i < aos.length; i++)
+ {
+ try
+ {
+ String ao = aos[i].getClass().getName();
+ String jndi = aoJndis[i];
+
+ mdr.unregisterJndiMapping(deployment.toExternalForm(), ao, jndi);
+ }
+ catch (NotFoundException nfe)
+ {
+ log.warn("Exception during unregistering deployment", nfe);
+ }
+ }
+ }
+
+ if (cfs != null && cfJndis != null)
+ {
+ try
+ {
+ jndiStrategy.unbindConnectionFactories(deploymentName, cfs, cfJndis);
+ }
+ catch (Throwable t)
+ {
+ log.warn("Exception during JNDI unbinding", t);
+ }
+ }
+
+ if (aos != null && aoJndis != null)
+ {
+ try
+ {
+ jndiStrategy.unbindAdminObjects(deploymentName, aos, aoJndis);
+ }
+ catch (Throwable t)
+ {
+ log.warn("Exception during JNDI unbinding", t);
+ }
+ }
+
+ if (ra != null)
+ {
+ ra.stop();
+ ra = null;
+ }
+ }
+ }
+
+ /**
+ * Destroy
+ */
+ public void destroy()
+ {
+ if (cl != null && cl instanceof Closeable)
+ {
+ try
+ {
+ ((Closeable) cl).close();
+ }
+ catch (IOException ioe)
+ {
+ // Swallow
+ }
+ }
+
+ if (activator)
+ {
+ log.info("Undeployed: " + deployment.toExternalForm());
+ }
+ }
+}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractFungalRADeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractFungalRADeployer.java 2010-10-18 20:20:24 UTC (rev 108638)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/AbstractFungalRADeployer.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -35,14 +35,24 @@
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
+import java.util.Set;
+import javax.management.DynamicMBean;
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
import javax.transaction.TransactionManager;
import org.jboss.logging.Logger;
+import com.github.fungal.api.Kernel;
import com.github.fungal.api.util.Injection;
+import com.github.fungal.api.util.JMX;
import com.github.fungal.api.util.JarFilter;
/**
@@ -52,6 +62,8 @@
*/
public abstract class AbstractFungalRADeployer extends AbstractResourceAdapterDeployer
{
+ /** The kernel */
+ protected Kernel kernel;
/**
* Create a new AbstractResourceAdapterDeployer.
@@ -62,9 +74,40 @@
public AbstractFungalRADeployer(boolean validateClasses, Logger log)
{
super(validateClasses, log);
+ kernel = null;
}
/**
+ * Get the kernel
+ * @return The kernel
+ */
+ public Kernel getKernel()
+ {
+ return kernel;
+ }
+
+ /**
+ * Set the kernel
+ * @param kernel The kernel
+ */
+ public void setKernel(Kernel kernel)
+ {
+ this.kernel = kernel;
+ }
+
+ /**
+ * Start
+ */
+ @Override
+ public void start()
+ {
+ super.start();
+
+ if (kernel == null)
+ throw new IllegalStateException("Kernel not defined");
+ }
+
+ /**
* Initialize and inject configuration properties
* @param className The fully qualified class name
* @param configs The configuration properties
@@ -213,4 +256,173 @@
((RAConfiguration) getConfiguration()).getMetadataRepository().
registerResourceAdapter(url.toExternalForm(), root, cmd, ijmd);
}
+
+ /**
+ * Register management view of a connector in JMX
+ * @param mgtConnector The management view of the connector
+ * @param server The MBeanServer instance
+ * @return The ObjectName's generated for this connector
+ * @exception JMException Thrown in case of an error
+ */
+ protected List<ObjectName> registerManagementView(org.jboss.jca.core.management.Connector mgtConnector,
+ MBeanServer server)
+ throws JMException
+ {
+ if (server == null)
+ throw new IllegalArgumentException("MBeanServer is null");
+
+ List<ObjectName> ons = new ArrayList<ObjectName>();
+
+ if (mgtConnector != null)
+ {
+ String baseName = server.getDefaultDomain() + ":deployment=" + mgtConnector.getUniqueId();
+
+ if (mgtConnector.getResourceAdapter() != null)
+ {
+ org.jboss.jca.core.management.ResourceAdapter mgtRa = mgtConnector.getResourceAdapter();
+
+ if (mgtRa.getResourceAdapter() != null)
+ {
+ Set<String> writeable = new HashSet<String>();
+ Set<String> excludeAttributes = new HashSet<String>();
+
+ for (org.jboss.jca.core.management.ConfigProperty mgtCp : mgtRa.getConfigProperties())
+ {
+ if (mgtCp.isDynamic())
+ writeable.add(mgtCp.getName());
+
+ if (mgtCp.isConfidential())
+ excludeAttributes.add(mgtCp.getName());
+ }
+
+ String raName = baseName + ",type=ResourceAdapter,class=" +
+ getClassName(mgtRa.getResourceAdapter().getClass().getName());
+
+ DynamicMBean raDMB = JMX.createMBean(mgtRa.getResourceAdapter(),
+ "Resource adapter",
+ writeable,
+ null,
+ excludeAttributes,
+ null);
+ ObjectName raON = new ObjectName(raName);
+
+ server.registerMBean(raDMB, raON);
+
+ ons.add(raON);
+ }
+ }
+
+ for (org.jboss.jca.core.management.ManagedConnectionFactory mgtMcf :
+ mgtConnector.getManagedConnectionFactories())
+ {
+ if (mgtMcf.getManagedConnectionFactory() != null)
+ {
+ Set<String> writeable = new HashSet<String>();
+ Set<String> excludeAttributes = new HashSet<String>();
+
+ for (org.jboss.jca.core.management.ConfigProperty mgtCp : mgtMcf.getConfigProperties())
+ {
+ if (mgtCp.isDynamic())
+ writeable.add(mgtCp.getName());
+
+ if (mgtCp.isConfidential())
+ excludeAttributes.add(mgtCp.getName());
+ }
+
+ String mcfName = baseName + ",type=ManagedConnectionFactory,class=" +
+ getClassName(mgtMcf.getManagedConnectionFactory().getClass().getName());
+
+ DynamicMBean mcfDMB = JMX.createMBean(mgtMcf.getManagedConnectionFactory(),
+ "Managed connection factory",
+ writeable,
+ null,
+ excludeAttributes,
+ null);
+ ObjectName mcfON = new ObjectName(mcfName);
+
+ server.registerMBean(mcfDMB, mcfON);
+
+ ons.add(mcfON);
+ }
+
+ if (mgtMcf.getPoolConfiguration() != null)
+ {
+ String mcfPCName = baseName + ",type=ManagedConnectionFactory,class=" +
+ getClassName(mgtMcf.getManagedConnectionFactory().getClass().getName()) +
+ ",subcategory=PoolConfiguration";
+
+ DynamicMBean mcfPCDMB = JMX.createMBean(mgtMcf.getPoolConfiguration(), "Pool configuration");
+ ObjectName mcfPCON = new ObjectName(mcfPCName);
+
+ server.registerMBean(mcfPCDMB, mcfPCON);
+
+ ons.add(mcfPCON);
+ }
+
+ if (mgtMcf.getPool() != null)
+ {
+ String mcfPName = baseName + ",type=ManagedConnectionFactory,class=" +
+ getClassName(mgtMcf.getManagedConnectionFactory().getClass().getName()) + ",subcategory=Pool";
+
+ DynamicMBean mcfPDMB = JMX.createMBean(mgtMcf.getPool(), "Pool");
+ ObjectName mcfPON = new ObjectName(mcfPName);
+
+ server.registerMBean(mcfPDMB, mcfPON);
+
+ ons.add(mcfPON);
+ }
+ }
+
+ for (org.jboss.jca.core.management.AdminObject mgtAo : mgtConnector.getAdminObjects())
+ {
+ if (mgtAo.getAdminObject() != null)
+ {
+ Set<String> writeable = new HashSet<String>();
+ Set<String> excludeAttributes = new HashSet<String>();
+
+ for (org.jboss.jca.core.management.ConfigProperty mgtCp : mgtAo.getConfigProperties())
+ {
+ if (mgtCp.isDynamic())
+ writeable.add(mgtCp.getName());
+
+ if (mgtCp.isConfidential())
+ excludeAttributes.add(mgtCp.getName());
+ }
+
+ String aoName = baseName + ",type=AdminObject,class=" +
+ getClassName(mgtAo.getAdminObject().getClass().getName());
+
+ DynamicMBean aoDMB = JMX.createMBean(mgtAo.getAdminObject(),
+ "Admin object",
+ writeable,
+ null,
+ excludeAttributes,
+ null);
+ ObjectName aoON = new ObjectName(aoName);
+
+ server.registerMBean(aoDMB, aoON);
+
+ ons.add(aoON);
+ }
+ }
+ }
+
+ return ons;
+ }
+
+ /**
+ * Get the class name without package name
+ * @param clz The fully qualified class name
+ * @return The class name
+ */
+ private String getClassName(String clz)
+ {
+ if (clz.indexOf(".") != -1)
+ {
+ int lastIndex = clz.lastIndexOf(".");
+ return clz.substring(lastIndex + 1);
+ }
+
+ return clz;
+ }
}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java 2010-10-18 20:20:24 UTC (rev 108638)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivator.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -35,9 +35,10 @@
import java.util.List;
import java.util.Set;
+import javax.management.ObjectName;
+
import org.jboss.logging.Logger;
-import com.github.fungal.api.Kernel;
import com.github.fungal.api.classloading.ClassLoaderFactory;
import com.github.fungal.api.classloading.KernelClassLoader;
import com.github.fungal.api.util.FileUtil;
@@ -57,9 +58,6 @@
/** Trace enabled */
static boolean trace = log.isTraceEnabled();
- /** The kernel */
- private Kernel kernel;
-
/** Enabled */
private boolean enabled;
@@ -75,32 +73,12 @@
public RAActivator()
{
super(false, log);
- kernel = null;
enabled = true;
excludeArchives = null;
deployments = null;
-
}
/**
- * Get the kernel
- * @return The kernel
- */
- public Kernel getKernel()
- {
- return kernel;
- }
-
- /**
- * Set the kernel
- * @param kernel The kernel
- */
- public void setKernel(Kernel kernel)
- {
- this.kernel = kernel;
- }
-
- /**
* Get the exclude archives
* @return The archives
*/
@@ -284,11 +262,15 @@
cmd = (new Merger()).mergeConnectorWithCommonIronJacamar(ijmd, cmd);
CommonDeployment c = createObjectsAndInjectValue(url, deploymentName, root, cl, cmd, ijmd);
+
+ List<ObjectName> ons = registerManagementView(c.getConnector(), kernel.getMBeanServer());
+
JndiStrategy jndiStrategy = ((RAConfiguration) getConfiguration()).getJndiStrategy();
return new RAActivatorDeployment(c.getURL(), c.getDeploymentName(), c.getResourceAdapter(), jndiStrategy,
metadataRepository, c.getCfs(), c.getCfJndiNames(),
- c.getAos(), c.getAoJndiNames(), c.getCl(), c.getLog());
-
+ c.getAos(), c.getAoJndiNames(),
+ kernel.getMBeanServer(), ons,
+ c.getCl(), c.getLog());
}
catch (DeployException de)
{
@@ -312,22 +294,9 @@
}
}
- /**
- * Start
- */
@Override
- public void start()
- {
- super.start();
-
- if (kernel == null)
- throw new IllegalStateException("Kernel not defined");
- }
-
- @Override
protected boolean checkActivation(Connector cmd, IronJacamar ijmd)
{
return true;
}
-
}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivatorDeployment.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivatorDeployment.java 2010-10-18 20:20:24 UTC (rev 108638)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RAActivatorDeployment.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -23,202 +23,47 @@
package org.jboss.jca.deployers.fungal;
import org.jboss.jca.core.spi.mdr.MetadataRepository;
-import org.jboss.jca.core.spi.mdr.NotFoundException;
import org.jboss.jca.core.spi.naming.JndiStrategy;
-import java.io.Closeable;
-import java.io.IOException;
import java.net.URL;
+import java.util.List;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
import javax.resource.spi.ResourceAdapter;
import org.jboss.logging.Logger;
-import com.github.fungal.spi.deployers.Deployment;
-
/**
* A resource adapter activator deployment for JCA/SJC
* @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
*/
-public class RAActivatorDeployment implements Deployment
+public class RAActivatorDeployment extends AbstractFungalDeployment
{
- /** The logger */
- private Logger log;
-
- /** The deployment */
- private URL deployment;
-
- /** The deployment name */
- private String deploymentName;
-
- /** The resource adapter instance */
- private ResourceAdapter ra;
-
- /** The JNDI strategy */
- private JndiStrategy jndiStrategy;
-
- /** The MDR */
- private MetadataRepository mdr;
-
- /** The connection factories */
- private Object[] cfs;
-
- /** The JNDI names for the connection factories */
- private String[] cfJndis;
-
- /** The admin objects */
- private Object[] aos;
-
- /** The JNDI names for the admin objects */
- private String[] aoJndis;
-
- /** The classloader */
- private ClassLoader cl;
-
/**
* Constructor
* @param deployment The deployment
* @param deploymentName The deployment name
* @param ra The resource adapter instance if present
* @param jndiStrategy The JNDI strategy
- * @param metadataRepository The metadata repository
+ * @param mdr The metadata repository
* @param cfs The connection factories
* @param cfJndis The JNDI names for the connection factories
* @param aos The admin objects
* @param aoJndis The JNDI names for the admin objects
+ * @param server The MBeanServer
+ * @param objectNames The ObjectNames
* @param cl The classloader for the deployment
* @param log The logger
*/
public RAActivatorDeployment(URL deployment, String deploymentName, ResourceAdapter ra, JndiStrategy jndiStrategy,
- MetadataRepository metadataRepository,
+ MetadataRepository mdr,
Object[] cfs, String[] cfJndis,
Object[] aos, String[] aoJndis,
+ MBeanServer server, List<ObjectName> objectNames,
ClassLoader cl, Logger log)
{
- this.deployment = deployment;
- this.deploymentName = deploymentName;
- this.ra = ra;
- this.jndiStrategy = jndiStrategy;
- this.mdr = metadataRepository;
- this.cfs = cfs;
- this.cfJndis = cfJndis;
- this.aos = aos;
- this.aoJndis = aoJndis;
- this.cl = cl;
- this.log = log;
+ super(deployment, deploymentName, true, ra, jndiStrategy, mdr,
+ cfs, cfJndis, aos, aoJndis, server, objectNames, cl, log);
}
-
- /**
- * Get the unique URL for the deployment
- * @return The URL
- */
- @Override
- public URL getURL()
- {
- return deployment;
- }
-
- /**
- * Get the classloader
- * @return The classloader
- */
- @Override
- public ClassLoader getClassLoader()
- {
- return cl;
- }
-
- /**
- * Stop
- */
- public void stop()
- {
- log.debug("Undeploying: " + deployment.toExternalForm());
-
- if (mdr != null && cfs != null && cfJndis != null)
- {
- for (int i = 0; i < cfs.length; i++)
- {
- try
- {
- String cf = cfs[i].getClass().getName();
- String jndi = cfJndis[i];
-
- mdr.unregisterJndiMapping(deployment.toExternalForm(), cf, jndi);
- }
- catch (NotFoundException nfe)
- {
- log.warn("Exception during unregistering deployment", nfe);
- }
- }
- }
-
- if (mdr != null && aos != null && aoJndis != null)
- {
- for (int i = 0; i < aos.length; i++)
- {
- try
- {
- String ao = aos[i].getClass().getName();
- String jndi = aoJndis[i];
-
- mdr.unregisterJndiMapping(deployment.toExternalForm(), ao, jndi);
- }
- catch (NotFoundException nfe)
- {
- log.warn("Exception during unregistering deployment", nfe);
- }
- }
- }
-
- if (cfs != null)
- {
- try
- {
- jndiStrategy.unbindConnectionFactories(deploymentName, cfs);
- }
- catch (Throwable t)
- {
- log.warn("Exception during JNDI unbinding", t);
- }
- }
-
- if (aos != null)
- {
- try
- {
- jndiStrategy.unbindAdminObjects(deploymentName, aos);
- }
- catch (Throwable t)
- {
- log.warn("Exception during JNDI unbinding", t);
- }
- }
-
- if (ra != null)
- {
- ra.stop();
- ra = null;
- }
- }
-
- /**
- * Destroy
- */
- public void destroy()
- {
- if (cl != null && cl instanceof Closeable)
- {
- try
- {
- ((Closeable) cl).close();
- }
- catch (IOException ioe)
- {
- // Swallow
- }
- }
-
- log.info("Undeployed: " + deployment.toExternalForm());
- }
}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2010-10-18 20:20:24 UTC (rev 108638)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -45,6 +45,8 @@
import java.util.List;
import java.util.Set;
+import javax.management.ObjectName;
+
import org.jboss.logging.Logger;
import com.github.fungal.api.classloading.ClassLoaderFactory;
@@ -155,11 +157,15 @@
cmd = (new Merger()).mergeConnectorWithCommonIronJacamar(ijmd, cmd);
CommonDeployment c = createObjectsAndInjectValue(url, deploymentName, root, cl, cmd, ijmd);
+
+ List<ObjectName> ons = registerManagementView(c.getConnector(), kernel.getMBeanServer());
+
JndiStrategy jndiStrategy = ((RAConfiguration) getConfiguration()).getJndiStrategy();
MetadataRepository metadataRepository = ((RAConfiguration) getConfiguration()).getMetadataRepository();
return new RADeployment(c.getURL(), c.getDeploymentName(), c.isActivateDeployment(), c.getResourceAdapter(),
jndiStrategy, metadataRepository, c.getCfs(), c.getCfJndiNames(),
- c.getAos(), c.getAoJndiNames(), destination, c.getCl(), c.getLog());
+ c.getAos(), c.getAoJndiNames(), destination, kernel.getMBeanServer(), ons,
+ c.getCl(), c.getLog());
}
catch (DeployException de)
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployment.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployment.java 2010-10-18 20:20:24 UTC (rev 108638)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployment.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -23,66 +23,30 @@
package org.jboss.jca.deployers.fungal;
import org.jboss.jca.core.spi.mdr.MetadataRepository;
-import org.jboss.jca.core.spi.mdr.NotFoundException;
import org.jboss.jca.core.spi.naming.JndiStrategy;
-import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.net.URL;
+import java.util.List;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
import javax.resource.spi.ResourceAdapter;
import org.jboss.logging.Logger;
import com.github.fungal.api.util.FileUtil;
-import com.github.fungal.spi.deployers.Deployment;
/**
* A resource adapter deployment for JCA/SJC
* @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
*/
-public class RADeployment implements Deployment
+public class RADeployment extends AbstractFungalDeployment
{
- /** The logger */
- private Logger log;
-
- /** The deployment */
- private URL deployment;
-
- /** The deployment name */
- private String deploymentName;
-
- /** Activator */
- private boolean activator;
-
- /** The resource adapter instance */
- private ResourceAdapter ra;
-
- /** The JNDI strategy */
- private JndiStrategy jndiStrategy;
-
- /** The MDR */
- private MetadataRepository mdr;
-
- /** The connection factories */
- private Object[] cfs;
-
- /** The JNDI names of the connection factories */
- private String[] cfJndis;
-
- /** The admin objects */
- private Object[] aos;
-
- /** The JNDI names of the admin objects */
- private String[] aoJndis;
-
/** The temporary directory */
private File tmpDirectory;
- /** The classloader */
- private ClassLoader cl;
-
/**
* Constructor
* @param deployment The deployment
@@ -90,61 +54,39 @@
* @param activator Is this the activator of the deployment
* @param ra The resource adapter instance if present
* @param jndiStrategy The JNDI strategy
- * @param metadataRepository The metadata repository
+ * @param mdr The metadata repository
* @param cfs The connection factories
* @param cfJndis The JNDI names of the connection factories
* @param aos The admin objects
* @param aoJndis The JNDI names of the admin objects
* @param tmpDirectory The temporary directory
+ * @param server The MBeanServer
+ * @param objectNames The ObjectNames
* @param cl The classloader for the deployment
* @param log The logger
*/
public RADeployment(URL deployment, String deploymentName, boolean activator, ResourceAdapter ra,
- JndiStrategy jndiStrategy, MetadataRepository metadataRepository,
+ JndiStrategy jndiStrategy, MetadataRepository mdr,
Object[] cfs, String[] cfJndis,
Object[] aos, String[] aoJndis,
- File tmpDirectory, ClassLoader cl, Logger log)
+ File tmpDirectory,
+ MBeanServer server, List<ObjectName> objectNames,
+ ClassLoader cl, Logger log)
{
- this.deployment = deployment;
- this.deploymentName = deploymentName;
- this.activator = activator;
- this.ra = ra;
- this.jndiStrategy = jndiStrategy;
- this.mdr = metadataRepository;
- this.cfs = cfs;
- this.cfJndis = cfJndis;
- this.aos = aos;
- this.aoJndis = aoJndis;
+ super(deployment, deploymentName, activator, ra, jndiStrategy, mdr,
+ cfs, cfJndis, aos, aoJndis, server, objectNames, cl, log);
+
this.tmpDirectory = tmpDirectory;
- this.cl = cl;
- this.log = log;
}
/**
- * Get the unique URL for the deployment
- * @return The URL
- */
- @Override
- public URL getURL()
- {
- return deployment;
- }
-
- /**
- * Get the classloader
- * @return The classloader
- */
- @Override
- public ClassLoader getClassLoader()
- {
- return cl;
- }
-
- /**
* Stop
*/
+ @Override
public void stop()
{
+ super.stop();
+
if (mdr != null)
{
try
@@ -156,95 +98,15 @@
log.warn("Exception during unregistering deployment", t);
}
}
-
- if (activator)
- {
- log.debug("Undeploying: " + deployment.toExternalForm());
-
- if (mdr != null && cfs != null && cfJndis != null)
- {
- for (int i = 0; i < cfs.length; i++)
- {
- try
- {
- String cf = cfs[i].getClass().getName();
- String jndi = cfJndis[i];
-
- mdr.unregisterJndiMapping(deployment.toExternalForm(), cf, jndi);
- }
- catch (NotFoundException nfe)
- {
- log.warn("Exception during unregistering deployment", nfe);
- }
- }
- }
-
- if (mdr != null && aos != null && aoJndis != null)
- {
- for (int i = 0; i < aos.length; i++)
- {
- try
- {
- String ao = aos[i].getClass().getName();
- String jndi = aoJndis[i];
-
- mdr.unregisterJndiMapping(deployment.toExternalForm(), ao, jndi);
- }
- catch (NotFoundException nfe)
- {
- log.warn("Exception during unregistering deployment", nfe);
- }
- }
- }
-
- if (cfs != null && cfJndis != null)
- {
- try
- {
- jndiStrategy.unbindConnectionFactories(deploymentName, cfs, cfJndis);
- }
- catch (Throwable t)
- {
- log.warn("Exception during JNDI unbinding", t);
- }
- }
-
- if (aos != null && aoJndis != null)
- {
- try
- {
- jndiStrategy.unbindAdminObjects(deploymentName, aos, aoJndis);
- }
- catch (Throwable t)
- {
- log.warn("Exception during JNDI unbinding", t);
- }
- }
-
- if (ra != null)
- {
- ra.stop();
- ra = null;
- }
- }
}
/**
* Destroy
*/
+ @Override
public void destroy()
{
- if (cl != null && cl instanceof Closeable)
- {
- try
- {
- ((Closeable) cl).close();
- }
- catch (IOException ioe)
- {
- // Swallow
- }
- }
+ super.destroy();
if (tmpDirectory != null && tmpDirectory.exists())
{
@@ -258,10 +120,5 @@
// Ignore
}
}
-
- if (activator)
- {
- log.info("Undeployed: " + deployment.toExternalForm());
- }
}
}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java 2010-10-18 20:20:24 UTC (rev 108638)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployer.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -40,9 +40,10 @@
import java.util.List;
import java.util.Set;
+import javax.management.ObjectName;
+
import org.jboss.logging.Logger;
-import com.github.fungal.api.Kernel;
import com.github.fungal.api.classloading.ClassLoaderFactory;
import com.github.fungal.api.classloading.KernelClassLoader;
import com.github.fungal.spi.deployers.DeployException;
@@ -65,9 +66,6 @@
{
private static Logger log = Logger.getLogger(RaXmlDeployer.class);
- /** The kernel */
- private Kernel kernel;
-
/** The list of generated deployments */
private List<Deployment> deployments;
@@ -90,24 +88,6 @@
}
/**
- * Get the kernel
- * @return The kernel
- */
- public Kernel getKernel()
- {
- return kernel;
- }
-
- /**
- * Set the kernel
- * @param kernel The kernel
- */
- public void setKernel(Kernel kernel)
- {
- this.kernel = kernel;
- }
-
- /**
* Pre deploy
* @exception Throwable Thrown if an error occurs
*/
@@ -291,11 +271,15 @@
String deploymentName = archive.substring(0, archive.indexOf(".rar"));
CommonDeployment c = createObjectsAndInjectValue(url, deploymentName, root, cl, cmd, ijmd, raxml);
+
+ List<ObjectName> ons = registerManagementView(c.getConnector(), kernel.getMBeanServer());
+
JndiStrategy jndiStrategy = ((RAConfiguration) getConfiguration()).getJndiStrategy();
MetadataRepository metadataRepository = ((RAConfiguration) getConfiguration()).getMetadataRepository();
return new RaXmlDeployment(c.getURL(), deployment, c.getDeploymentName(), c.getResourceAdapter(),
jndiStrategy, metadataRepository, c.getCfs(), c.getCfJndiNames(),
- c.getAos(), c.getAoJndiNames(), c.getCl(), c.getLog());
+ c.getAos(), c.getAoJndiNames(), kernel.getMBeanServer(), ons,
+ c.getCl(), c.getLog());
}
catch (DeployException de)
{
@@ -319,22 +303,9 @@
}
}
- /**
- * Start
- */
@Override
- public void start()
- {
- super.start();
-
- if (kernel == null)
- throw new IllegalStateException("Kernel not defined");
- }
-
- @Override
protected boolean checkActivation(Connector cmd, IronJacamar ijmd)
{
return true;
}
-
}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployment.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployment.java 2010-10-18 20:20:24 UTC (rev 108638)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RaXmlDeployment.java 2010-10-18 20:23:00 UTC (rev 108639)
@@ -26,58 +26,24 @@
import org.jboss.jca.core.spi.mdr.NotFoundException;
import org.jboss.jca.core.spi.naming.JndiStrategy;
-import java.io.Closeable;
-import java.io.IOException;
import java.net.URL;
+import java.util.List;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
import javax.resource.spi.ResourceAdapter;
import org.jboss.logging.Logger;
-import com.github.fungal.spi.deployers.Deployment;
-
/**
* A -ra.xml deployment for JCA/SJC
* @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
*/
-public class RaXmlDeployment implements Deployment
+public class RaXmlDeployment extends AbstractFungalDeployment
{
- /** The logger */
- private Logger log;
-
- /** The deployment */
- private URL deployment;
-
/** The resource adapter deployment */
private URL raDeployment;
- /** The deployment name */
- private String deploymentName;
-
- /** The resource adapter instance */
- private ResourceAdapter ra;
-
- /** The JNDI strategy */
- private JndiStrategy jndiStrategy;
-
- /** The MDR */
- private MetadataRepository mdr;
-
- /** The connection factories */
- private Object[] cfs;
-
- /** The JNDI names of the connection factories */
- private String[] cfJndis;
-
- /** The admin objects */
- private Object[] aos;
-
- /** The JNDI names of the admin objects */
- private String[] aoJndis;
-
- /** The classloader */
- private ClassLoader cl;
-
/**
* Constructor
* @param deployment The deployment
@@ -85,59 +51,37 @@
* @param deploymentName The deployment name
* @param ra The resource adapter instance if present
* @param jndiStrategy The JNDI strategy
- * @param metadataRepository The metadata repository
+ * @param mdr The metadata repository
* @param cfs The connection factories
* @param cfJndis The JNDI names of the connection factories
* @param aos The admin objects
* @param aoJndis The JNDI names of the admin objects
+ * @param server The MBeanServer
+ * @param objectNames The ObjectNames
* @param cl The classloader for the deployment
* @param log The logger
*/
public RaXmlDeployment(URL deployment, URL raDeployment, String deploymentName, ResourceAdapter ra,
- JndiStrategy jndiStrategy, MetadataRepository metadataRepository,
+ JndiStrategy jndiStrategy, MetadataRepository mdr,
Object[] cfs, String[] cfJndis,
Object[] aos, String[] aoJndis,
+ MBeanServer server, List<ObjectName> objectNames,
ClassLoader cl, Logger log)
{
- this.deployment = deployment;
+ super(deployment, deploymentName, true, ra, jndiStrategy, mdr,
+ cfs, cfJndis, aos, aoJndis, server, objectNames, cl, log);
+
this.raDeployment = raDeployment;
- this.deploymentName = deploymentName;
- this.ra = ra;
- this.jndiStrategy = jndiStrategy;
- this.mdr = metadataRepository;
- this.cfs = cfs;
- this.cfJndis = cfJndis;
- this.aos = aos;
- this.aoJndis = aoJndis;
- this.cl = cl;
- this.log = log;
}
/**
- * Get the unique URL for the deployment
- * @return The URL
- */
- @Override
- public URL getURL()
- {
- return deployment;
- }
-
- /**
- * Get the classloader
- * @return The classloader
- */
- @Override
- public ClassLoader getClassLoader()
- {
- return cl;
- }
-
- /**
* Stop
*/
+ @Override
public void stop()
{
+ super.stop();
+
log.debug("Undeploying: " + deployment.toExternalForm());
if (mdr != null && cfs != null && cfJndis != null)
@@ -175,55 +119,5 @@
}
}
}
-
- if (cfs != null && cfJndis != null)
- {
- try
- {
- jndiStrategy.unbindConnectionFactories(deploymentName, cfs, cfJndis);
- }
- catch (Throwable t)
- {
- log.warn("Exception during JNDI unbinding", t);
- }
- }
-
- if (aos != null && aoJndis != null)
- {
- try
- {
- jndiStrategy.unbindAdminObjects(deploymentName, aos, aoJndis);
- }
- catch (Throwable t)
- {
- log.warn("Exception during JNDI unbinding", t);
- }
- }
-
- if (ra != null)
- {
- ra.stop();
- ra = null;
- }
}
-
- /**
- * Destroy
- */
- public void destroy()
- {
- if (cl != null && cl instanceof Closeable)
- {
- try
- {
- ((Closeable) cl).close();
- }
- catch (IOException ioe)
- {
- // Swallow
- }
- }
-
- log.info("Undeployed: " + deployment.toExternalForm());
- }
}
Modified: projects/jboss-jca/trunk/embedded/src/main/resources/jca.xml
===================================================================
--- projects/jboss-jca/trunk/embedded/src/main/resources/jca.xml 2010-10-18 20:20:24 UTC (rev 108638)
+++ projects/jboss-jca/trunk/embedded/src/main/resources/jca.xml 2010-10-18 20:23:00 UTC (rev 108639)
@@ -172,6 +172,7 @@
interface="com.github.fungal.spi.deployers.Deployer"
class="org.jboss.jca.deployers.fungal.RADeployer">
<property name="Configuration"><inject bean="DeployerConfiguration"/></property>
+ <property name="Kernel"><inject bean="Kernel"/></property>
<depends>BeanValidation</depends>
<depends>JBossStdioContextSelector</depends>
</bean>
Modified: projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/jca.xml
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/jca.xml 2010-10-18 20:20:24 UTC (rev 108638)
+++ projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/jca.xml 2010-10-18 20:23:00 UTC (rev 108639)
@@ -175,6 +175,7 @@
interface="com.github.fungal.spi.deployers.Deployer"
class="org.jboss.jca.deployers.fungal.RADeployer">
<property name="Configuration"><inject bean="DeployerConfiguration"/></property>
+ <property name="Kernel"><inject bean="Kernel"/></property>
<depends>BeanValidation</depends>
<depends>JBossStdioContextSelector</depends>
</bean>
More information about the jboss-cvs-commits
mailing list