[jboss-cvs] JBossAS SVN: r93407 - in projects/jboss-jca/trunk: deployers/src/main/java/org/jboss/jca/deployers and 7 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Sep 11 09:30:00 EDT 2009
Author: jesper.pedersen
Date: 2009-09-11 09:30:00 -0400 (Fri, 11 Sep 2009)
New Revision: 93407
Added:
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/Annotations.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/BeanValidation.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/JCATraversableResolver.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/Metadata.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/SecurityActions.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/package.html
projects/jboss-jca/trunk/deployers/src/main/resources/fungal-ra-manifest.mf
Removed:
projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/Annotations.java
projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/BeanValidation.java
projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/JCATraversableResolver.java
projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/Metadata.java
projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/RADeployer.java
projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/RADeployment.java
projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/SecurityActions.java
projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/package.html
projects/jboss-jca/trunk/sjc/src/main/resources/sjc-ra-manifest.mf
projects/jboss-jca/trunk/sjc/src/main/resources/sjc-services-manifest.mf
Modified:
projects/jboss-jca/trunk/deployers/build.xml
projects/jboss-jca/trunk/sjc/build.xml
projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/jca.xml
projects/jboss-jca/trunk/standalone/build.xml
Log:
Move SJC deployer chain into deployers module
Modified: projects/jboss-jca/trunk/deployers/build.xml
===================================================================
--- projects/jboss-jca/trunk/deployers/build.xml 2009-09-11 13:03:59 UTC (rev 93406)
+++ projects/jboss-jca/trunk/deployers/build.xml 2009-09-11 13:30:00 UTC (rev 93407)
@@ -56,7 +56,7 @@
<copy todir="${build.deployers.dir}/jars/main">
<fileset dir="${build.deployers.dir}/impl"
- includes="**/hack/**"/>
+ includes="**/mc/hack/**"/>
</copy>
<jar destfile="${target.dir}/jboss-jca-deployers-main.jar"
@@ -69,7 +69,7 @@
<copy todir="${build.deployers.dir}/jars/rar">
<fileset dir="${build.deployers.dir}/impl"
- includes="**/rar/**"/>
+ includes="**/mc/rar/**"/>
</copy>
<copy file="src/main/resources/jca-deployers-jboss-beans.xml"
@@ -78,6 +78,19 @@
<jar destfile="${target.dir}/jboss-jca-deployers-rar.jar"
manifest="src/main/resources/rar-manifest.mf"
basedir="${build.deployers.dir}/jars/rar"/>
+
+ <!-- Fungal -->
+ <mkdir dir="${build.deployers.dir}/jars/fungal" />
+
+ <copy todir="${build.deployers.dir}/jars/fungal">
+ <fileset dir="${build.deployers.dir}/impl"
+ includes="**/fungal/**"/>
+ </copy>
+
+ <jar destfile="${target.dir}/jboss-jca-deployers-fungal.jar"
+ manifest="src/main/resources/fungal-ra-manifest.mf"
+ basedir="${build.deployers.dir}/jars/fungal"/>
+
</target>
Copied: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/Annotations.java (from rev 93406, projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/Annotations.java)
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/Annotations.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/Annotations.java 2009-09-11 13:30:00 UTC (rev 93407)
@@ -0,0 +1,661 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, 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.fungal.deployers.DeployException;
+
+import java.lang.reflect.Array;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import javax.resource.spi.Activation;
+import javax.resource.spi.AdministeredObject;
+import javax.resource.spi.AuthenticationMechanism;
+import javax.resource.spi.AuthenticationMechanism.CredentialInterface;
+import javax.resource.spi.ConfigProperty;
+import javax.resource.spi.ConnectionDefinition;
+import javax.resource.spi.ConnectionDefinitions;
+import javax.resource.spi.Connector;
+import javax.resource.spi.SecurityPermission;
+import javax.resource.spi.TransactionSupport;
+import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
+import javax.resource.spi.work.WorkContext;
+
+import org.jboss.logging.Logger;
+
+import org.jboss.metadata.rar.spec.AdminObjectMetaData;
+import org.jboss.metadata.rar.spec.AuthenticationMechanismMetaData;
+import org.jboss.metadata.rar.spec.ConnectorMetaData;
+import org.jboss.metadata.rar.spec.InboundRaMetaData;
+import org.jboss.metadata.rar.spec.JCA16DTDMetaData;
+import org.jboss.metadata.rar.spec.JCA16DefaultNSMetaData;
+import org.jboss.metadata.rar.spec.JCA16MetaData;
+import org.jboss.metadata.rar.spec.LicenseMetaData;
+import org.jboss.metadata.rar.spec.OutboundRaMetaData;
+import org.jboss.metadata.rar.spec.ResourceAdapterMetaData;
+import org.jboss.metadata.rar.spec.SecurityPermissionMetaData;
+import org.jboss.metadata.rar.spec.TransactionSupportMetaData;
+import org.jboss.papaki.Annotation;
+import org.jboss.papaki.AnnotationRepository;
+
+/**
+ * The annotation processor for JCA 1.6
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class Annotations
+{
+ private static Logger log = Logger.getLogger(Annotations.class);
+ private static boolean trace = log.isTraceEnabled();
+
+ /**
+ * Constructor
+ */
+ private Annotations()
+ {
+ }
+
+ /**
+ * Process annotations
+ * @param md The metadata
+ * @param annotationRepository The annotation repository
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ public static ConnectorMetaData process(ConnectorMetaData md, AnnotationRepository annotationRepository)
+ throws Exception
+ {
+ /* Process
+ -------
+ javax.resource.spi.Activation
+ javax.resource.spi.AdministeredObject
+ javax.resource.spi.AuthenticationMechanism
+ javax.resource.spi.ConfigProperty
+ javax.resource.spi.ConnectionDefinition
+ javax.resource.spi.ConnectionDefinitions
+ javax.resource.spi.Connector
+ javax.resource.spi.SecurityPermission
+ */
+
+ if (md == null)
+ {
+ JCA16MetaData jmd = new JCA16MetaData();
+ jmd.setMetadataComplete(false);
+ md = jmd;
+ }
+
+ // @Connector
+ md = processConnector(md, annotationRepository);
+
+ // @ConnectionDefinitions
+ md = processConnectionDefinitions(md, annotationRepository);
+
+ // @ConnectionDefinition (outside of @ConnectionDefinitions)
+ md = processConnectionDefinition(md, annotationRepository);
+
+ // @ConfigProperty
+ md = processConfigProperty(md, annotationRepository);
+
+ // @AuthenticationMechanism
+ md = processAuthenticationMechanism(md, annotationRepository);
+
+ // @AdministeredObject
+ md = processAdministeredObject(md, annotationRepository);
+
+ // @Activation
+ md = processActivation(md, annotationRepository);
+
+ //log.debug("ConnectorMetadata " + md);
+
+ return md;
+ }
+
+ /**
+ * Process: @Connector
+ * @param md The metadata
+ * @param annotationRepository The annotation repository
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private static ConnectorMetaData processConnector(ConnectorMetaData md, AnnotationRepository annotationRepository)
+ throws Exception
+ {
+ Collection<Annotation> values = annotationRepository.getAnnotation(Connector.class);
+ if (values != null)
+ {
+ if (values.size() == 1)
+ {
+ Annotation annotation = values.iterator().next();
+ Connector c = (Connector)annotation.getAnnotation();
+
+ if (trace)
+ log.trace("Processing: " + c);
+
+ md = attachConnector(md, c);
+ }
+ else
+ throw new DeployException("More than one @Connector defined");
+ }
+
+ return md;
+ }
+
+ /**
+ * Attach @Connector
+ * @param md The metadata
+ * @param c The connector
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private static ConnectorMetaData attachConnector(ConnectorMetaData md, Connector c)
+ throws Exception
+ {
+ // AuthenticationMechanism
+ AuthenticationMechanism[] authMechanisms = c.authMechanisms();
+ if (authMechanisms != null)
+ {
+ for (AuthenticationMechanism authMechanism : authMechanisms)
+ {
+ attachAuthenticationMechanism(md, authMechanism);
+ }
+ }
+
+ // Description
+ String[] description = c.description();
+ if (description != null)
+ {
+ // TODO
+ }
+
+ // Display name
+ String[] displayName = c.displayName();
+ if (displayName != null)
+ {
+ // TODO
+ }
+
+ // EIS type
+ String eisType = c.eisType();
+ if (eisType != null)
+ {
+ if (md.getEISType() == null)
+ md.setEISType(eisType);
+ }
+
+ // Large icon
+ String[] largeIcon = c.largeIcon();
+ if (largeIcon != null)
+ {
+ // TODO
+ }
+
+ // License description
+ String[] licenseDescription = c.licenseDescription();
+ if (licenseDescription != null)
+ {
+ if (md.getLicense() == null)
+ md.setLicense(new LicenseMetaData());
+
+ // TODO
+ }
+
+ // License required
+ boolean licenseRequired = c.licenseRequired();
+ if (md.getLicense() == null)
+ md.setLicense(new LicenseMetaData());
+ md.getLicense().setRequired(licenseRequired);
+
+ // Reauthentication support
+ boolean reauthenticationSupport = c.reauthenticationSupport();
+ if (md.getRa() != null && md.getRa().getOutboundRa() != null)
+ {
+ md.getRa().getOutboundRa().setReAuthSupport(reauthenticationSupport);
+ }
+
+ // RequiredWorkContext
+ Class<? extends WorkContext>[] requiredWorkContexts = c.requiredWorkContexts();
+ if (requiredWorkContexts != null)
+ {
+ for (Class<? extends WorkContext> requiredWorkContext : requiredWorkContexts)
+ {
+ if (md instanceof JCA16MetaData)
+ {
+ JCA16MetaData jmd = (JCA16MetaData)md;
+ if (jmd.getRequiredWorkContexts() == null)
+ jmd.setRequiredWorkContexts(new ArrayList<String>());
+
+ if (!jmd.getRequiredWorkContexts().contains(requiredWorkContext.getName()))
+ {
+ if (trace)
+ log.trace("RequiredWorkContext=" + requiredWorkContext.getName());
+
+ jmd.getRequiredWorkContexts().add(requiredWorkContext.getName());
+ }
+ }
+ else if (md instanceof JCA16DefaultNSMetaData)
+ {
+ JCA16DefaultNSMetaData jmd = (JCA16DefaultNSMetaData)md;
+ if (jmd.getRequiredWorkContexts() == null)
+ jmd.setRequiredWorkContexts(new ArrayList<String>());
+
+ if (!jmd.getRequiredWorkContexts().contains(requiredWorkContext.getName()))
+ {
+ if (trace)
+ log.trace("RequiredWorkContext=" + requiredWorkContext.getName());
+
+ jmd.getRequiredWorkContexts().add(requiredWorkContext.getName());
+ }
+ }
+ else if (md instanceof JCA16DTDMetaData)
+ {
+ JCA16DTDMetaData jmd = (JCA16DTDMetaData)md;
+ if (jmd.getRequiredWorkContexts() == null)
+ jmd.setRequiredWorkContexts(new ArrayList<String>());
+
+ if (!jmd.getRequiredWorkContexts().contains(requiredWorkContext.getName()))
+ {
+ if (trace)
+ log.trace("RequiredWorkContext=" + requiredWorkContext.getName());
+
+ jmd.getRequiredWorkContexts().add(requiredWorkContext.getName());
+ }
+ }
+ }
+ }
+
+ // Security permission
+ SecurityPermission[] securityPermissions = c.securityPermissions();
+ if (securityPermissions != null)
+ {
+ if (md.getRa() == null)
+ md.setRa(new ResourceAdapterMetaData());
+
+ if (md.getRa().getSecurityPermissions() == null)
+ md.getRa().setSecurityPermissions(new ArrayList<SecurityPermissionMetaData>());
+
+ for (SecurityPermission securityPermission : securityPermissions)
+ {
+ SecurityPermissionMetaData spmd = new SecurityPermissionMetaData();
+ spmd.setSecurityPermissionSpec(securityPermission.permissionSpec());
+ md.getRa().getSecurityPermissions().add(spmd);
+ }
+ }
+
+ // Small icon
+ String[] smallIcon = c.smallIcon();
+ if (smallIcon != null)
+ {
+ // TODO
+ }
+
+ // Spec version
+ String specVersion = c.specVersion();
+ md.setVersion("1.6");
+
+ // Transaction support
+ TransactionSupport.TransactionSupportLevel transactionSupport = c.transactionSupport();
+ if (md.getRa() != null && md.getRa().getOutboundRa() != null)
+ {
+ if (transactionSupport.equals(TransactionSupportLevel.NoTransaction))
+ {
+ md.getRa().getOutboundRa().setTransSupport(TransactionSupportMetaData.NoTransaction);
+ }
+ else if (transactionSupport.equals(TransactionSupportLevel.XATransaction))
+ {
+ md.getRa().getOutboundRa().setTransSupport(TransactionSupportMetaData.XATransaction);
+ }
+ else if (transactionSupport.equals(TransactionSupportLevel.LocalTransaction))
+ {
+ md.getRa().getOutboundRa().setTransSupport(TransactionSupportMetaData.LocalTransaction);
+ }
+ }
+
+ // Vendor name
+ String vendorName = c.vendorName();
+ if (vendorName != null)
+ {
+ if (md.getVendorName() == null)
+ md.setVendorName(vendorName);
+ }
+
+ // Version
+ String version = c.version();
+ if (version != null)
+ {
+ if (md.getRAVersion() == null)
+ md.setRAVersion(version);
+ }
+
+ return md;
+ }
+
+ /**
+ * Process: @ConnectionDefinitions
+ * @param md The metadata
+ * @param annotationRepository The annotation repository
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private static ConnectorMetaData processConnectionDefinitions(ConnectorMetaData md,
+ AnnotationRepository annotationRepository)
+ throws Exception
+ {
+ Collection<Annotation> values = annotationRepository.getAnnotation(ConnectionDefinitions.class);
+ if (values != null)
+ {
+ if (values.size() == 1)
+ {
+ Annotation annotation = values.iterator().next();
+ ConnectionDefinitions c = (ConnectionDefinitions)annotation.getAnnotation();
+
+ if (trace)
+ log.trace("Processing: " + c);
+
+ md = attachConnectionDefinitions(md , c);
+ }
+ else
+ throw new DeployException("More than one @ConnectionDefinitions defined");
+ }
+
+ return md;
+ }
+
+ /**
+ * Attach @ConnectionDefinitions
+ * @param md The metadata
+ * @param cds The connection definitions
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private static ConnectorMetaData attachConnectionDefinitions(ConnectorMetaData md,
+ ConnectionDefinitions cds)
+ throws Exception
+ {
+ return md;
+ }
+
+ /**
+ * Process: @ConnectionDefinition
+ * @param md The metadata
+ * @param annotationRepository The annotation repository
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private static ConnectorMetaData processConnectionDefinition(ConnectorMetaData md,
+ AnnotationRepository annotationRepository)
+ throws Exception
+ {
+ Collection<Annotation> values = annotationRepository.getAnnotation(ConnectionDefinition.class);
+ if (values != null)
+ {
+ for (Annotation annotation : values)
+ {
+ ConnectionDefinition c = (ConnectionDefinition)annotation.getAnnotation();
+
+ if (trace)
+ log.trace("Processing: " + c);
+
+ md = attachConnectionDefinition(md, c);
+ }
+ }
+
+ return md;
+ }
+
+ /**
+ * Attach @ConnectionDefinition
+ * @param md The metadata
+ * @param cd The connection definition
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private static ConnectorMetaData attachConnectionDefinition(ConnectorMetaData md,
+ ConnectionDefinition cd)
+ throws Exception
+ {
+ return md;
+ }
+
+ /**
+ * Process: @ConfigProperty
+ * @param md The metadata
+ * @param annotationRepository The annotation repository
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private static ConnectorMetaData processConfigProperty(ConnectorMetaData md,
+ AnnotationRepository annotationRepository)
+ throws Exception
+ {
+ Collection<Annotation> values = annotationRepository.getAnnotation(ConfigProperty.class);
+ if (values != null)
+ {
+ for (Annotation annotation : values)
+ {
+ ConfigProperty c = (ConfigProperty)annotation.getAnnotation();
+
+ if (trace)
+ log.trace("Processing: " + c);
+
+ md = attachConfigProperty(md, c);
+ }
+ }
+
+ return md;
+ }
+
+ /**
+ * Attach @ConfigProperty
+ * @param md The metadata
+ * @param configProperty The config property
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private static ConnectorMetaData attachConfigProperty(ConnectorMetaData md,
+ ConfigProperty configProperty)
+ throws Exception
+ {
+ return md;
+ }
+
+ /**
+ * Process: @AuthenticationMechanism
+ * @param md The metadata
+ * @param annotationRepository The annotation repository
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private static ConnectorMetaData processAuthenticationMechanism(ConnectorMetaData md,
+ AnnotationRepository annotationRepository)
+ throws Exception
+ {
+ Collection<Annotation> values = annotationRepository.getAnnotation(AuthenticationMechanism.class);
+ if (values != null)
+ {
+ for (Annotation annotation : values)
+ {
+ AuthenticationMechanism a = (AuthenticationMechanism)annotation.getAnnotation();
+
+ if (trace)
+ log.trace("Processing: " + a);
+
+ md = attachAuthenticationMechanism(md, a);
+ }
+ }
+
+ return md;
+ }
+
+ /**
+ * Attach @AuthenticationMechanism
+ * @param md The metadata
+ * @param authenticationmechanism The authentication mechanism
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private static ConnectorMetaData attachAuthenticationMechanism(ConnectorMetaData md,
+ AuthenticationMechanism authenticationmechanism)
+ throws Exception
+ {
+ if (md.getRa() == null)
+ {
+ md.setRa(new ResourceAdapterMetaData());
+ }
+ if (md.getRa().getOutboundRa() == null)
+ {
+ md.getRa().setOutboundRa(new OutboundRaMetaData());
+ }
+ if (md.getRa().getOutboundRa().getAuthMechanisms() == null)
+ {
+ md.getRa().getOutboundRa().setAuthMechanisms(new ArrayList<AuthenticationMechanismMetaData>());
+ }
+ AuthenticationMechanismMetaData ammd = new AuthenticationMechanismMetaData();
+ ammd.setAuthenticationMechanismType(authenticationmechanism.authMechanism());
+
+ String credentialInterfaceClass = null;
+ if (authenticationmechanism.credentialInterface().equals(CredentialInterface.GenericCredential))
+ {
+ credentialInterfaceClass = "javax.resource.spi.security.GenericCredential";
+ }
+ else if (authenticationmechanism.credentialInterface().equals(CredentialInterface.GSSCredential))
+ {
+ credentialInterfaceClass = "org.ietf.jgss.GSSCredential";
+ }
+ else if (authenticationmechanism.credentialInterface().equals(CredentialInterface.PasswordCredential))
+ {
+ credentialInterfaceClass = "javax.resource.spi.security.PasswordCredential";
+ }
+ ammd.setCredentialInterfaceClass(credentialInterfaceClass);
+ md.getRa().getOutboundRa().getAuthMechanisms().add(ammd);
+
+ return md;
+ }
+
+ /**
+ * Process: @AdministeredObject
+ * @param md The metadata
+ * @param annotationRepository The annotation repository
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private static ConnectorMetaData processAdministeredObject(ConnectorMetaData md,
+ AnnotationRepository annotationRepository)
+ throws Exception
+ {
+ Collection<Annotation> values = annotationRepository.getAnnotation(AdministeredObject.class);
+ if (values != null)
+ {
+ for (Annotation annotation : values)
+ {
+ AdministeredObject a = (AdministeredObject)annotation.getAnnotation();
+
+ if (trace)
+ log.trace("Processing: " + a);
+
+ md = attachAdministeredObject(md, a);
+ }
+ }
+
+ return md;
+ }
+
+ /**
+ * Attach @AdministeredObject
+ * @param md The metadata
+ * @param a The administered object
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private static ConnectorMetaData attachAdministeredObject(ConnectorMetaData md, AdministeredObject a)
+ throws Exception
+ {
+ if (md.getRa() == null)
+ {
+ md.setRa(new ResourceAdapterMetaData());
+ }
+ if (md.getRa().getAdminObjects() == null)
+ {
+ md.getRa().setAdminObjects(new ArrayList<AdminObjectMetaData>());
+ }
+ String aoName = null;
+ if (a.adminObjectInterfaces().length > 0)
+ {
+ aoName = ((Class)Array.get(a.adminObjectInterfaces(), 0)).getName();
+ }
+ AdminObjectMetaData aomd = new AdminObjectMetaData();
+ aomd.setAdminObjectInterfaceClass(aoName);
+ md.getRa().getAdminObjects().add(aomd);
+ return md;
+ }
+
+ /**
+ * Process: @Activation
+ * @param md The metadata
+ * @param annotationRepository The annotation repository
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private static ConnectorMetaData processActivation(ConnectorMetaData md,
+ AnnotationRepository annotationRepository)
+ throws Exception
+ {
+ Collection<Annotation> values = annotationRepository.getAnnotation(Activation.class);
+ if (values != null)
+ {
+ for (Annotation annotation : values)
+ {
+ Activation a = (Activation)annotation.getAnnotation();
+
+ if (trace)
+ log.trace("Processing: " + a);
+
+ md = attachActivation(md, a);
+ }
+ }
+
+ return md;
+ }
+
+ /**
+ * Attach @Activation
+ * @param md The metadata
+ * @param activation The activation
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private static ConnectorMetaData attachActivation(ConnectorMetaData md, Activation activation)
+ throws Exception
+ {
+ if (md.getRa() == null)
+ {
+ md.setRa(new ResourceAdapterMetaData());
+ }
+ if (md.getRa().getInboundRa() == null)
+ {
+ md.getRa().setInboundRa(new InboundRaMetaData());
+ }
+ //TODO
+ return md;
+ }
+}
Copied: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/BeanValidation.java (from rev 93406, projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/BeanValidation.java)
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/BeanValidation.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/BeanValidation.java 2009-09-11 13:30:00 UTC (rev 93407)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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 java.util.List;
+import java.util.Set;
+
+import javax.validation.Configuration;
+import javax.validation.ConstraintViolationException;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+import javax.validation.groups.Default;
+
+import org.jboss.logging.Logger;
+
+/**
+ *
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @version $Revision: $
+ */
+public class BeanValidation
+{
+ private static Logger log = Logger.getLogger(BeanValidation.class);
+ private static boolean trace = log.isTraceEnabled();
+
+ /**
+ * Validate the object against the Bean Validation specification (JSR-303).
+ * The object must be fully initialized
+ * @param object The object that should be validated
+ * @param groupsClasses groups targeted for validation
+ * @exception ConstraintViolationException Thrown if the object can't be validated
+ */
+ @SuppressWarnings("unchecked")
+ public static void validate(Object object, List<Class> groupsClasses) throws ConstraintViolationException
+ {
+ if (object == null)
+ {
+ throw new IllegalArgumentException("Object is null");
+ }
+
+ Configuration configuration = Validation.byDefaultProvider().configure();
+ Configuration<?> conf = configuration.traversableResolver(new JCATraversableResolver());
+ ValidatorFactory vf = conf.buildValidatorFactory();
+ Validator v = vf.getValidator();
+
+ if (trace)
+ {
+ log.trace("Validating: " + object + " against groups "
+ + Default.class.getName());
+ }
+
+ Set errors = null;
+ if (groupsClasses == null)
+ {
+ errors = v.validate(object, Default.class);
+ }
+ else
+ {
+ Class[] vargs = (Class[])groupsClasses.toArray(new Class[groupsClasses.size()]);
+ errors = v.validate(object, vargs);
+ }
+ if (errors != null && errors.size() > 0)
+ {
+ log.debug("Validated: " + errors.size() + " validate failing");
+ throw new ConstraintViolationException(errors);
+ }
+ }
+
+}
Copied: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/JCATraversableResolver.java (from rev 93406, projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/JCATraversableResolver.java)
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/JCATraversableResolver.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/JCATraversableResolver.java 2009-09-11 13:30:00 UTC (rev 93407)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, 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 java.lang.annotation.ElementType;
+
+import javax.validation.Path;
+import javax.validation.TraversableResolver;
+
+/**
+ * JCATraversableResolver
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class JCATraversableResolver implements TraversableResolver
+{
+ /**
+ * Determine if Bean Validation is allowed to reach the property state
+ *
+ * @param traversableObject
+ * object hosting <code>traversableProperty</code> or null if
+ * validateValue is called
+ * @param traversableProperty
+ * the traversable property.
+ * @param rootBeanType
+ * type of the root object passed to the Validator.
+ * @param pathToTraversableObject
+ * path from the root object to <code>traversableObject</code>
+ * (using the path specification defined by Bean Validator).
+ * @param elementType
+ * either <code>FIELD</code> or <code>METHOD</code>.
+ *
+ * @return <code>true</code> if Bean Validation is allowed to reach the
+ * property state, <code>false</code> otherwise.
+ */
+ public boolean isReachable(Object traversableObject, Path.Node traversableProperty,
+ Class<?> rootBeanType, Path pathToTraversableObject,
+ ElementType elementType)
+ {
+ return true;
+ }
+
+ /**
+ * Determine if Bean Validation is allowed to cascade validation on the bean
+ * instance returned by the property value marked as <code>@Valid</code>.
+ * Note that this method is called only if isReachable returns true for the
+ * same set of arguments and if the property is marked as <code>@Valid</code>
+ *
+ * @param traversableObject
+ * object hosting <code>traversableProperty</code> or null if
+ * validateValue is called
+ * @param traversableProperty
+ * the traversable property.
+ * @param rootBeanType
+ * type of the root object passed to the Validator.
+ * @param pathToTraversableObject
+ * path from the root object to <code>traversableObject</code>
+ * (using the path specification defined by Bean Validator).
+ * @param elementType
+ * either <code>FIELD</code> or <code>METHOD</code>.
+ *
+ * @return <code>true</code> if Bean Validation is allowed to cascade
+ * validation, <code>false</code> otherwise.
+ */
+ public boolean isCascadable(Object traversableObject,
+ Path.Node traversableProperty, Class<?> rootBeanType,
+ Path pathToTraversableObject, ElementType elementType)
+ {
+ return true;
+ }
+}
Copied: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/Metadata.java (from rev 93406, projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/Metadata.java)
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/Metadata.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/Metadata.java 2009-09-11 13:30:00 UTC (rev 93407)
@@ -0,0 +1,280 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, 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 java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.logging.Logger;
+//import org.jboss.metadata.rar.jboss.JBossRA10DefaultNSMetaData;
+import org.jboss.metadata.rar.jboss.JBossRA10MetaData;
+import org.jboss.metadata.rar.jboss.JBossRA20DefaultNSMetaData;
+import org.jboss.metadata.rar.jboss.JBossRA20MetaData;
+import org.jboss.metadata.rar.jboss.JBossRAMetaData;
+import org.jboss.metadata.rar.jboss.RaConfigPropertyMetaData;
+import org.jboss.metadata.rar.spec.ConfigPropertyMetaData;
+import org.jboss.metadata.rar.spec.ConnectorMetaData;
+import org.jboss.metadata.rar.spec.JCA15DTDMetaData;
+import org.jboss.metadata.rar.spec.JCA15MetaData;
+import org.jboss.metadata.rar.spec.JCA16DTDMetaData;
+import org.jboss.metadata.rar.spec.JCA16DefaultNSMetaData;
+import org.jboss.metadata.rar.spec.JCA16MetaData;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.resolver.MutableSchemaResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
+
+/**
+ * The metadata processor for JCA 1.x
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @author <a href="mailto:jeff.zhang at redhat.com">Jeff Zhang</a>
+ */
+public class Metadata
+{
+ private static Logger log = Logger.getLogger(Metadata.class);
+ private static boolean trace = log.isTraceEnabled();
+
+ /**
+ * Constructor
+ */
+ private Metadata()
+ {
+ }
+
+ /**
+ * Get the JCA standard metadata
+ * @param root The root of the deployment
+ * @return The metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ public static ConnectorMetaData getStandardMetaData(File root) throws Exception
+ {
+ ConnectorMetaData result = null;
+
+ UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
+ Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
+
+ MutableSchemaResolver resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
+ resolver.mapLocationToClass("connector_1_6.xsd", JCA16MetaData.class);
+ resolver.mapLocationToClass("connector_1_5.xsd", JCA15MetaData.class);
+ resolver.mapLocationToClass("connector_1_5.dtd", JCA15DTDMetaData.class);
+ resolver.mapLocationToClass("connector_1_6.dtd", JCA16DTDMetaData.class);
+ resolver.mapLocationToClass("connector", JCA16DefaultNSMetaData.class);
+
+ File metadataFile = new File(root, "/META-INF/ra.xml");
+
+ if (metadataFile.exists())
+ {
+ String url = metadataFile.getAbsolutePath();
+ try
+ {
+ long start = System.currentTimeMillis();
+
+ result = (ConnectorMetaData)unmarshaller.unmarshal(url, resolver);
+
+ log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms");
+
+ if (trace)
+ {
+ log.trace("successful parse " + result.getVersion() + " rar package " + result);
+ }
+
+ }
+ catch (Exception e)
+ {
+ log.error("Error during parsing: " + url, e);
+ throw e;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Get the JBoss specific metadata
+ * @param root The root of the deployment
+ * @return The metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ public static JBossRAMetaData getJBossMetaData(File root) throws Exception
+ {
+ JBossRAMetaData result = null;
+
+ UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
+ Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
+
+ MutableSchemaResolver resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
+ resolver.mapLocationToClass("http://www.jboss.org/schema/jboss-ra_1_0.xsd", JBossRA10MetaData.class);
+ resolver.mapLocationToClass("http://www.jboss.org/schema/jboss-ra_2_0.xsd", JBossRA20MetaData.class);
+ resolver.mapLocationToClass("jboss-ra", JBossRA20DefaultNSMetaData.class);
+
+ File metadataFile = new File(root, "/META-INF/jboss-ra.xml");
+
+ if (metadataFile.exists())
+ {
+ String url = metadataFile.getAbsolutePath();
+ try
+ {
+ long start = System.currentTimeMillis();
+
+ result = (JBossRAMetaData)unmarshaller.unmarshal(url, resolver);
+
+ log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms");
+
+ if (trace)
+ log.trace(result);
+ }
+ catch (Exception e)
+ {
+ log.error("Error during parsing: " + url, e);
+ throw e;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Merge specification metadata with vendor metadata
+ * @param cmd The specification metadata
+ * @param jmd The vendor metadata
+ * @return The merged metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ public static ConnectorMetaData merge(ConnectorMetaData cmd, JBossRAMetaData jmd) throws Exception
+ {
+ if (cmd != null && jmd != null)
+ {
+ /*
+ <xs:restriction base="javaee:string">
+ <xs:enumeration value="connection-definition"/>
+ <xs:enumeration value="resourceadapter"/>
+ <xs:enumeration value="activationspec"/>
+ <xs:enumeration value="adminobject"/>
+ </xs:restriction>
+ */
+
+ List<RaConfigPropertyMetaData> props = jmd.getRaConfigProps();
+
+ List<ConfigPropertyMetaData> append = null;
+
+ if (props != null)
+ {
+ for (RaConfigPropertyMetaData rcmd : props)
+ {
+ List<ConfigPropertyMetaData> listConfigProp = null;
+ String override = rcmd.getOverride();
+ if (override == null || override.equals("resourceadapter"))
+ {
+ if (cmd.getRa() != null)
+ {
+ listConfigProp = cmd.getRa().getConfigProperty();
+ }
+ }
+ else if (override.equals("connection-definition"))
+ {
+ if (cmd.getRa() != null &&
+ cmd.getRa().getOutboundRa() != null &&
+ cmd.getRa().getOutboundRa().getConDefs() != null &&
+ cmd.getRa().getOutboundRa().getConDefs().size() > 0 &&
+ cmd.getRa().getOutboundRa().getConDefs().get(0) != null)
+ {
+ listConfigProp = cmd.getRa().getOutboundRa().getConDefs().get(0).getConfigProps();
+ }
+ }
+ else if (override.equals("activationspec"))
+ {
+ if (cmd.getRa() != null &&
+ cmd.getRa().getInboundRa() != null &&
+ cmd.getRa().getInboundRa().getMessageAdapter() != null &&
+ cmd.getRa().getInboundRa().getMessageAdapter().getMessageListeners() != null &&
+ cmd.getRa().getInboundRa().getMessageAdapter().getMessageListeners().size() > 0 &&
+ cmd.getRa().getInboundRa().getMessageAdapter().getMessageListeners().get(0) != null &&
+ cmd.getRa().getInboundRa().getMessageAdapter().getMessageListeners().get(0).
+ getActivationSpecType() != null)
+ {
+ listConfigProp = cmd.getRa().getInboundRa().getMessageAdapter().getMessageListeners().
+ get(0).getActivationSpecType().getConfigProps();
+ }
+ }
+ else if (override.equals("adminobject"))
+ {
+ if (cmd.getRa() != null &&
+ cmd.getRa().getAdminObjects() != null &&
+ cmd.getRa().getAdminObjects().size() > 0 &&
+ cmd.getRa().getAdminObjects().get(0) != null)
+ {
+ listConfigProp = cmd.getRa().getAdminObjects().get(0).getConfigProps();
+ }
+ }
+
+ boolean found = false;
+
+ if (listConfigProp != null)
+ {
+ Iterator<ConfigPropertyMetaData> it = listConfigProp.iterator();
+
+ while (!found && it.hasNext())
+ {
+ ConfigPropertyMetaData cpmd = it.next();
+ if (cpmd.getName().equals(rcmd.getName()) &&
+ cpmd.getType().equals(rcmd.getType()))
+ {
+ cpmd.setValue(rcmd.getValue());
+ found = true;
+ }
+ }
+ }
+
+ if (!found)
+ {
+ if (append == null)
+ append = new ArrayList<ConfigPropertyMetaData>();
+
+ ConfigPropertyMetaData cpmd = new ConfigPropertyMetaData();
+ cpmd.setName(rcmd.getName());
+ cpmd.setType(rcmd.getType());
+ cpmd.setValue(rcmd.getValue());
+
+ append.add(cpmd);
+ }
+ }
+
+ if (append != null)
+ {
+ if (cmd.getRa().getConfigProperty() == null)
+ cmd.getRa().setConfigProperty(new ArrayList<ConfigPropertyMetaData>());
+
+ for (ConfigPropertyMetaData cpmd : append)
+ {
+ cmd.getRa().getConfigProperty().add(cpmd);
+ }
+ }
+ }
+ }
+
+ return cmd;
+ }
+}
Copied: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java (from rev 93406, projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/RADeployer.java)
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2009-09-11 13:30:00 UTC (rev 93407)
@@ -0,0 +1,357 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, 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.fungal.deployers.DeployException;
+import org.jboss.jca.fungal.deployers.Deployer;
+import org.jboss.jca.fungal.deployers.Deployment;
+import org.jboss.jca.fungal.util.FileUtil;
+import org.jboss.jca.fungal.util.Injection;
+import org.jboss.jca.fungal.util.JarFilter;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+
+import org.jboss.metadata.rar.jboss.BvGroupMetaData;
+import org.jboss.metadata.rar.jboss.JBossRA20Base;
+import org.jboss.metadata.rar.jboss.JBossRAMetaData;
+import org.jboss.metadata.rar.spec.AdminObjectMetaData;
+import org.jboss.metadata.rar.spec.ConfigPropertyMetaData;
+import org.jboss.metadata.rar.spec.ConnectionDefinitionMetaData;
+import org.jboss.metadata.rar.spec.ConnectorMetaData;
+import org.jboss.metadata.rar.spec.JCA16DTDMetaData;
+import org.jboss.metadata.rar.spec.JCA16DefaultNSMetaData;
+import org.jboss.metadata.rar.spec.JCA16MetaData;
+import org.jboss.metadata.rar.spec.MessageListenerMetaData;
+import org.jboss.papaki.Annotation;
+import org.jboss.papaki.AnnotationRepository;
+import org.jboss.papaki.AnnotationScanner;
+import org.jboss.papaki.AnnotationScannerFactory;
+
+/**
+ * The RA deployer for JCA/SJC
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
+ */
+public class RADeployer implements Deployer
+{
+ private static Logger log = Logger.getLogger(RADeployer.class);
+ private static boolean trace = log.isTraceEnabled();
+
+ /**
+ * validation optional
+ */
+ private boolean beanValidation = true;
+
+ /**
+ * Constructor
+ */
+ public RADeployer()
+ {
+ }
+
+ /**
+ * setBeanValidation
+ * @param value validation optional
+ */
+ public void setBeanValidation(boolean value)
+ {
+ beanValidation = value;
+ }
+
+ /**
+ * getBeanValidation
+ * @return validation optional
+ */
+ public boolean getBeanValidation()
+ {
+ return beanValidation;
+ }
+
+ /**
+ * Deploy
+ * @param url The url
+ * @param parent The parent classloader
+ * @return The deployment
+ * @exception DeployException Thrown if an error occurs during deployment
+ */
+ public Deployment deploy(URL url, ClassLoader parent) throws DeployException
+ {
+ if (url == null || !(url.toExternalForm().endsWith(".rar") || url.toExternalForm().endsWith(".rar/")))
+ return null;
+
+ log.info("Deploying: " + url.toExternalForm());
+
+ ClassLoader oldTCCL = SecurityActions.getThreadContextClassLoader();
+ try
+ {
+ File f = new File(url.toURI());
+
+ File root = null;
+
+ if (f.isFile())
+ {
+ File destination = new File(SecurityActions.getSystemProperty("jboss.jca.home"), "/tmp/");
+ root = FileUtil.extract(f, destination);
+ }
+ else
+ {
+ root = f;
+ }
+
+ // Create classloader
+ URL[] urls = getUrls(root);
+ URLClassLoader cl = SecurityActions.createURLCLassLoader(urls, parent);
+ SecurityActions.setThreadContextClassLoader(cl);
+
+ // Parse metadata
+ ConnectorMetaData cmd = Metadata.getStandardMetaData(root);
+ JBossRAMetaData jrmd = Metadata.getJBossMetaData(root);
+ boolean isMetadataComplete = true;
+
+ // Process annotations
+ if (cmd == null || cmd.is16())
+ {
+ AnnotationScanner annotationScanner =
+ AnnotationScannerFactory.getStrategy(AnnotationScannerFactory.JAVASSIST_INPUT_STREAM);
+ AnnotationRepository annotationRepository = annotationScanner.scan(cl.getURLs(), cl);
+
+ isMetadataComplete = false;
+ if (cmd != null)
+ {
+ if (cmd instanceof JCA16MetaData)
+ {
+ JCA16MetaData jmd = (JCA16MetaData)cmd;
+ isMetadataComplete = jmd.isMetadataComplete();
+ }
+ else if (cmd instanceof JCA16DefaultNSMetaData)
+ {
+ JCA16DefaultNSMetaData jmd = (JCA16DefaultNSMetaData)cmd;
+ isMetadataComplete = jmd.isMetadataComplete();
+ }
+ else if (cmd instanceof JCA16DTDMetaData)
+ {
+ JCA16DTDMetaData jmd = (JCA16DTDMetaData)cmd;
+ isMetadataComplete = jmd.isMetadataComplete();
+ }
+ }
+
+ if (cmd == null || !isMetadataComplete)
+ cmd = Annotations.process(cmd, annotationRepository);
+ }
+
+ // Validate metadata
+
+ // Merge metadata
+ cmd = Metadata.merge(cmd, jrmd);
+
+ // Create objects
+ // And
+ // Inject values
+ List<Object> objects = new ArrayList<Object>();
+ if (cmd != null)
+ {
+ // ResourceAdapter
+ if (cmd.getRa() != null && cmd.getRa().getRaClass() != null)
+ {
+ initAndInject(cmd.getRa().getRaClass(),
+ cmd.getRa().getConfigProperty(), objects, cl);
+ }
+
+ // ManagedConnectionFactory
+ if (cmd.getRa() != null &&
+ cmd.getRa().getOutboundRa() != null &&
+ cmd.getRa().getOutboundRa().getConDefs() != null)
+ {
+ List<ConnectionDefinitionMetaData> cdMetas = cmd.getRa().getOutboundRa().getConDefs();
+ if (cdMetas.size() > 0)
+ {
+ //mcfs = new ArrayList<Object>();
+ for (ConnectionDefinitionMetaData cdMeta : cdMetas)
+ {
+ if (cdMeta.getManagedConnectionFactoryClass() != null)
+ {
+ initAndInject(cdMeta.getManagedConnectionFactoryClass(),
+ cdMeta.getConfigProps(), objects, cl);
+ }
+ }
+ }
+ }
+ // activationspec
+ if (cmd.getRa() != null &&
+ cmd.getRa().getInboundRa() != null &&
+ cmd.getRa().getInboundRa().getMessageAdapter() != null &&
+ cmd.getRa().getInboundRa().getMessageAdapter().getMessageListeners() != null)
+ {
+ List<MessageListenerMetaData> mlMetas = cmd.getRa().getInboundRa().
+ getMessageAdapter().getMessageListeners();
+ if (mlMetas.size() > 0)
+ {
+ for (MessageListenerMetaData mlMeta : mlMetas)
+ {
+ if (mlMeta.getActivationSpecType() != null && mlMeta.getActivationSpecType().getAsClass() != null)
+ {
+ initAndInject(mlMeta.getActivationSpecType().getAsClass(),
+ mlMeta.getActivationSpecType().getConfigProps(), objects, cl);
+ }
+ }
+ }
+ }
+
+ //adminobject
+ if (cmd.getRa() != null &&
+ cmd.getRa().getAdminObjects() != null)
+ {
+ List<AdminObjectMetaData> aoMetas = cmd.getRa().getAdminObjects();
+ if (aoMetas.size() > 0)
+ {
+ for (AdminObjectMetaData aoMeta : aoMetas)
+ {
+ if (aoMeta.getAdminObjectImplementationClass() != null)
+ {
+ initAndInject(aoMeta.getAdminObjectImplementationClass(),
+ aoMeta.getConfigProps(), objects, cl);
+ }
+ }
+ }
+ }
+ }
+
+
+ // Bean validation
+ if (beanValidation)
+ {
+ JBossRA20Base jrmd20 = null;
+ List<Class> groupsClasses = null;
+ if (jrmd instanceof JBossRA20Base)
+ {
+ jrmd20 = (JBossRA20Base)jrmd;
+ }
+ if (jrmd20 != null && jrmd20.getBvGroupsList() != null && jrmd20.getBvGroupsList().size() > 0)
+ {
+ BvGroupMetaData bvGroups = jrmd20.getBvGroupsList().get(0);
+ groupsClasses = new ArrayList<Class>();
+ for (String group : bvGroups.getBvGroups())
+ {
+ groupsClasses.add(Class.forName(group, true, cl));
+ }
+ }
+
+ if (objects != null && objects.size() > 0)
+ {
+ for (Object mcf : objects)
+ {
+ BeanValidation.validate(mcf, groupsClasses);
+ }
+ }
+ }
+
+ // Activate deployment
+
+ return new RADeployment(f, cl);
+ }
+ catch (Throwable t)
+ {
+ throw new DeployException("Deployment " + url.toExternalForm() + " failed", t);
+ }
+ finally
+ {
+ SecurityActions.setThreadContextClassLoader(oldTCCL);
+ }
+ }
+
+ /**
+ * initAndInject
+ * @param mlMeta
+ * @param mcfs
+ * @param cl
+ * @throws DeployException
+ */
+ private void initAndInject(String className, List<ConfigPropertyMetaData> cpMetas,
+ List<Object> mcfs, URLClassLoader cl) throws DeployException
+ {
+ Object mcf = null;
+ try
+ {
+ Class mcfClass = Class.forName(className, true, cl);
+ mcf = mcfClass.newInstance();
+ mcfs.add(mcf);
+
+ if (mcf != null)
+ {
+ if (cpMetas != null)
+ {
+ for (ConfigPropertyMetaData cpmd : cpMetas)
+ {
+ Injection.inject(cpmd.getType(), cpmd.getName(), cpmd.getValue(), mcf);
+ }
+ }
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ log.trace("can't constractor " + className + " class");
+ }
+ catch (Throwable t)
+ {
+ throw new DeployException("Deployment " + className + " failed", t);
+ }
+
+ }
+
+ /**
+ * Get the URLs for the directory and all libraries located in the directory
+ * @param directrory The directory
+ * @return The URLs
+ * @exception MalformedURLException MalformedURLException
+ * @exception IOException IOException
+ */
+ private URL[] getUrls(File directory) throws MalformedURLException, IOException
+ {
+ List<URL> list = new LinkedList<URL>();
+
+ if (directory.exists() && directory.isDirectory())
+ {
+ // Add directory
+ list.add(directory.toURI().toURL());
+
+ // Add the contents of the directory too
+ File[] jars = directory.listFiles(new JarFilter());
+
+ for (int j = 0; jars != null && j < jars.length; j++)
+ {
+ list.add(jars[j].getCanonicalFile().toURI().toURL());
+ }
+ }
+ return list.toArray(new URL[list.size()]);
+ }
+}
Copied: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployment.java (from rev 93406, projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/RADeployment.java)
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployment.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployment.java 2009-09-11 13:30:00 UTC (rev 93407)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, 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.fungal.deployers.Deployment;
+
+import java.io.Closeable;
+import java.io.File;
+import java.io.IOException;
+
+import org.jboss.logging.Logger;
+
+/**
+ * A resource adapter deployment for JCA/SJC
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class RADeployment implements Deployment
+{
+ private static Logger log = Logger.getLogger(RADeployer.class);
+ private static boolean trace = log.isTraceEnabled();
+
+ /** The resource adapter file */
+ private File adapter;
+
+ /** The classloader */
+ private ClassLoader cl;
+
+ /**
+ * Constructor
+ * @param adapter The adapter
+ * @param cl The classloader for the deployment
+ */
+ public RADeployment(File adapter, ClassLoader cl)
+ {
+ this.adapter = adapter;
+ this.cl = cl;
+ }
+
+ /**
+ * Get the name
+ * @return The name
+ */
+ public String getName()
+ {
+ return adapter.getName();
+ }
+
+ /**
+ * Get the classloader
+ * @return The classloader
+ */
+ public ClassLoader getClassLoader()
+ {
+ return cl;
+ }
+
+ /**
+ * Destroy
+ */
+ public void destroy()
+ {
+ log.info("Undeploying: " + adapter.getAbsolutePath());
+
+ if (cl != null && cl instanceof Closeable)
+ {
+ try
+ {
+ ((Closeable)cl).close();
+ }
+ catch (IOException ioe)
+ {
+ // Swallow
+ }
+ }
+ }
+}
Copied: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/SecurityActions.java (from rev 93406, projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/SecurityActions.java)
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/SecurityActions.java (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/SecurityActions.java 2009-09-11 13:30:00 UTC (rev 93407)
@@ -0,0 +1,139 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2009, 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 java.net.URL;
+import java.net.URLClassLoader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Properties;
+
+/**
+ * Privileged Blocks
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+class SecurityActions
+{
+ /**
+ * Constructor
+ */
+ private SecurityActions()
+ {
+ }
+
+ /**
+ * Get the thread context class loader
+ * @return The class loader
+ */
+ static ClassLoader getThreadContextClassLoader()
+ {
+ return (ClassLoader)AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+
+ /**
+ * Set the thread context class loader
+ * @param cl The class loader
+ */
+ static void setThreadContextClassLoader(final ClassLoader cl)
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ Thread.currentThread().setContextClassLoader(cl);
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Get the system properties
+ * @return The properties
+ */
+ static Properties getSystemProperties()
+ {
+ return (Properties)AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ return System.getProperties();
+ }
+ });
+ }
+
+ /**
+ * Get a system property
+ * @param name The property name
+ * @return The property value
+ */
+ static String getSystemProperty(final String name)
+ {
+ return (String)AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ return System.getProperty(name);
+ }
+ });
+ }
+
+ /**
+ * Set a system property
+ * @param name The property name
+ * @param value The property value
+ */
+ static void setSystemProperty(final String name, final String value)
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ System.setProperty(name, value);
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Create an URLClassLoader
+ * @param urls The urls
+ * @param parent The parent class loader
+ * @return The class loader
+ */
+ static URLClassLoader createURLCLassLoader(final URL[] urls, final ClassLoader parent)
+ {
+ return (URLClassLoader)AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ return new URLClassLoader(urls, parent);
+ }
+ });
+ }
+}
Copied: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/package.html (from rev 93406, projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/package.html)
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/package.html (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/package.html 2009-09-11 13:30:00 UTC (rev 93407)
@@ -0,0 +1,3 @@
+<body>
+This package contains the resource adapter deployer for the JBoss JCA/SJC container.
+</body>
Copied: projects/jboss-jca/trunk/deployers/src/main/resources/fungal-ra-manifest.mf (from rev 93406, projects/jboss-jca/trunk/sjc/src/main/resources/sjc-ra-manifest.mf)
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/resources/fungal-ra-manifest.mf (rev 0)
+++ projects/jboss-jca/trunk/deployers/src/main/resources/fungal-ra-manifest.mf 2009-09-11 13:30:00 UTC (rev 93407)
@@ -0,0 +1,4 @@
+Implementation-Title: JBoss JCA SJC RA Deployer
+Implementation-Vendor: Red Hat Middleware LLC
+Implementation-Vendor-Id: org.jboss
+Implementation-Version: 0.1
Modified: projects/jboss-jca/trunk/sjc/build.xml
===================================================================
--- projects/jboss-jca/trunk/sjc/build.xml 2009-09-11 13:03:59 UTC (rev 93406)
+++ projects/jboss-jca/trunk/sjc/build.xml 2009-09-11 13:30:00 UTC (rev 93407)
@@ -56,18 +56,7 @@
<target name="jars" depends="compile">
<jar destfile="${target.dir}/jboss-jca-sjc.jar"
manifest="src/main/resources/sjc-manifest.mf"
- basedir="${build.sjc.dir}/impl"
- excludes="**/*.java,**/annotationscanner/**,,**/hack/**,**/ra/**,**/util/**"/>
- <jar destfile="${target.dir}/jboss-jca-sjc-services.jar"
- manifest="src/main/resources/sjc-services-manifest.mf"
- basedir="${build.sjc.dir}/impl"
- includes="**/annotationscanner/**,**/hack/**,**/util/**"
- excludes="**/*.java"/>
- <jar destfile="${target.dir}/jboss-jca-sjc-ra-deployer.jar"
- manifest="src/main/resources/sjc-ra-manifest.mf"
- basedir="${build.sjc.dir}/impl"
- includes="**/ra/**"
- excludes="**/*.java"/>
+ basedir="${build.sjc.dir}/impl"/>
</target>
<!-- =================================
@@ -140,10 +129,11 @@
<copy todir="${target.dir}/sjc/lib">
<fileset dir="${target.dir}">
<include name="*.jar"/>
- <exclude name="*fungal.jar"/>
- <exclude name="*sjc.jar"/>
- <exclude name="jboss-jca-deployers*.jar"/>
- <exclude name="jboss-jca-standalone*.jar"/>
+ <exclude name="jboss-jca-fungal.jar"/>
+ <exclude name="jboss-jca-sjc.jar"/>
+ <exclude name="jboss-jca-deployers-main.jar"/>
+ <exclude name="jboss-jca-deployers-rar.jar"/>
+ <exclude name="jboss-jca-standalone.jar"/>
</fileset>
</copy>
Deleted: projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/Annotations.java
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/Annotations.java 2009-09-11 13:03:59 UTC (rev 93406)
+++ projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/Annotations.java 2009-09-11 13:30:00 UTC (rev 93407)
@@ -1,661 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008-2009, 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.sjc.deployers.ra;
-
-import org.jboss.jca.fungal.deployers.DeployException;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import javax.resource.spi.Activation;
-import javax.resource.spi.AdministeredObject;
-import javax.resource.spi.AuthenticationMechanism;
-import javax.resource.spi.AuthenticationMechanism.CredentialInterface;
-import javax.resource.spi.ConfigProperty;
-import javax.resource.spi.ConnectionDefinition;
-import javax.resource.spi.ConnectionDefinitions;
-import javax.resource.spi.Connector;
-import javax.resource.spi.SecurityPermission;
-import javax.resource.spi.TransactionSupport;
-import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
-import javax.resource.spi.work.WorkContext;
-
-import org.jboss.logging.Logger;
-
-import org.jboss.metadata.rar.spec.AdminObjectMetaData;
-import org.jboss.metadata.rar.spec.AuthenticationMechanismMetaData;
-import org.jboss.metadata.rar.spec.ConnectorMetaData;
-import org.jboss.metadata.rar.spec.InboundRaMetaData;
-import org.jboss.metadata.rar.spec.JCA16DTDMetaData;
-import org.jboss.metadata.rar.spec.JCA16DefaultNSMetaData;
-import org.jboss.metadata.rar.spec.JCA16MetaData;
-import org.jboss.metadata.rar.spec.LicenseMetaData;
-import org.jboss.metadata.rar.spec.OutboundRaMetaData;
-import org.jboss.metadata.rar.spec.ResourceAdapterMetaData;
-import org.jboss.metadata.rar.spec.SecurityPermissionMetaData;
-import org.jboss.metadata.rar.spec.TransactionSupportMetaData;
-import org.jboss.papaki.Annotation;
-import org.jboss.papaki.AnnotationRepository;
-
-/**
- * The annotation processor for JCA 1.6
- * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
- */
-public class Annotations
-{
- private static Logger log = Logger.getLogger(Annotations.class);
- private static boolean trace = log.isTraceEnabled();
-
- /**
- * Constructor
- */
- private Annotations()
- {
- }
-
- /**
- * Process annotations
- * @param md The metadata
- * @param annotationRepository The annotation repository
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- public static ConnectorMetaData process(ConnectorMetaData md, AnnotationRepository annotationRepository)
- throws Exception
- {
- /* Process
- -------
- javax.resource.spi.Activation
- javax.resource.spi.AdministeredObject
- javax.resource.spi.AuthenticationMechanism
- javax.resource.spi.ConfigProperty
- javax.resource.spi.ConnectionDefinition
- javax.resource.spi.ConnectionDefinitions
- javax.resource.spi.Connector
- javax.resource.spi.SecurityPermission
- */
-
- if (md == null)
- {
- JCA16MetaData jmd = new JCA16MetaData();
- jmd.setMetadataComplete(false);
- md = jmd;
- }
-
- // @Connector
- md = processConnector(md, annotationRepository);
-
- // @ConnectionDefinitions
- md = processConnectionDefinitions(md, annotationRepository);
-
- // @ConnectionDefinition (outside of @ConnectionDefinitions)
- md = processConnectionDefinition(md, annotationRepository);
-
- // @ConfigProperty
- md = processConfigProperty(md, annotationRepository);
-
- // @AuthenticationMechanism
- md = processAuthenticationMechanism(md, annotationRepository);
-
- // @AdministeredObject
- md = processAdministeredObject(md, annotationRepository);
-
- // @Activation
- md = processActivation(md, annotationRepository);
-
- //log.debug("ConnectorMetadata " + md);
-
- return md;
- }
-
- /**
- * Process: @Connector
- * @param md The metadata
- * @param annotationRepository The annotation repository
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private static ConnectorMetaData processConnector(ConnectorMetaData md, AnnotationRepository annotationRepository)
- throws Exception
- {
- Collection<Annotation> values = annotationRepository.getAnnotation(Connector.class);
- if (values != null)
- {
- if (values.size() == 1)
- {
- Annotation annotation = values.iterator().next();
- Connector c = (Connector)annotation.getAnnotation();
-
- if (trace)
- log.trace("Processing: " + c);
-
- md = attachConnector(md, c);
- }
- else
- throw new DeployException("More than one @Connector defined");
- }
-
- return md;
- }
-
- /**
- * Attach @Connector
- * @param md The metadata
- * @param c The connector
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private static ConnectorMetaData attachConnector(ConnectorMetaData md, Connector c)
- throws Exception
- {
- // AuthenticationMechanism
- AuthenticationMechanism[] authMechanisms = c.authMechanisms();
- if (authMechanisms != null)
- {
- for (AuthenticationMechanism authMechanism : authMechanisms)
- {
- attachAuthenticationMechanism(md, authMechanism);
- }
- }
-
- // Description
- String[] description = c.description();
- if (description != null)
- {
- // TODO
- }
-
- // Display name
- String[] displayName = c.displayName();
- if (displayName != null)
- {
- // TODO
- }
-
- // EIS type
- String eisType = c.eisType();
- if (eisType != null)
- {
- if (md.getEISType() == null)
- md.setEISType(eisType);
- }
-
- // Large icon
- String[] largeIcon = c.largeIcon();
- if (largeIcon != null)
- {
- // TODO
- }
-
- // License description
- String[] licenseDescription = c.licenseDescription();
- if (licenseDescription != null)
- {
- if (md.getLicense() == null)
- md.setLicense(new LicenseMetaData());
-
- // TODO
- }
-
- // License required
- boolean licenseRequired = c.licenseRequired();
- if (md.getLicense() == null)
- md.setLicense(new LicenseMetaData());
- md.getLicense().setRequired(licenseRequired);
-
- // Reauthentication support
- boolean reauthenticationSupport = c.reauthenticationSupport();
- if (md.getRa() != null && md.getRa().getOutboundRa() != null)
- {
- md.getRa().getOutboundRa().setReAuthSupport(reauthenticationSupport);
- }
-
- // RequiredWorkContext
- Class<? extends WorkContext>[] requiredWorkContexts = c.requiredWorkContexts();
- if (requiredWorkContexts != null)
- {
- for (Class<? extends WorkContext> requiredWorkContext : requiredWorkContexts)
- {
- if (md instanceof JCA16MetaData)
- {
- JCA16MetaData jmd = (JCA16MetaData)md;
- if (jmd.getRequiredWorkContexts() == null)
- jmd.setRequiredWorkContexts(new ArrayList<String>());
-
- if (!jmd.getRequiredWorkContexts().contains(requiredWorkContext.getName()))
- {
- if (trace)
- log.trace("RequiredWorkContext=" + requiredWorkContext.getName());
-
- jmd.getRequiredWorkContexts().add(requiredWorkContext.getName());
- }
- }
- else if (md instanceof JCA16DefaultNSMetaData)
- {
- JCA16DefaultNSMetaData jmd = (JCA16DefaultNSMetaData)md;
- if (jmd.getRequiredWorkContexts() == null)
- jmd.setRequiredWorkContexts(new ArrayList<String>());
-
- if (!jmd.getRequiredWorkContexts().contains(requiredWorkContext.getName()))
- {
- if (trace)
- log.trace("RequiredWorkContext=" + requiredWorkContext.getName());
-
- jmd.getRequiredWorkContexts().add(requiredWorkContext.getName());
- }
- }
- else if (md instanceof JCA16DTDMetaData)
- {
- JCA16DTDMetaData jmd = (JCA16DTDMetaData)md;
- if (jmd.getRequiredWorkContexts() == null)
- jmd.setRequiredWorkContexts(new ArrayList<String>());
-
- if (!jmd.getRequiredWorkContexts().contains(requiredWorkContext.getName()))
- {
- if (trace)
- log.trace("RequiredWorkContext=" + requiredWorkContext.getName());
-
- jmd.getRequiredWorkContexts().add(requiredWorkContext.getName());
- }
- }
- }
- }
-
- // Security permission
- SecurityPermission[] securityPermissions = c.securityPermissions();
- if (securityPermissions != null)
- {
- if (md.getRa() == null)
- md.setRa(new ResourceAdapterMetaData());
-
- if (md.getRa().getSecurityPermissions() == null)
- md.getRa().setSecurityPermissions(new ArrayList<SecurityPermissionMetaData>());
-
- for (SecurityPermission securityPermission : securityPermissions)
- {
- SecurityPermissionMetaData spmd = new SecurityPermissionMetaData();
- spmd.setSecurityPermissionSpec(securityPermission.permissionSpec());
- md.getRa().getSecurityPermissions().add(spmd);
- }
- }
-
- // Small icon
- String[] smallIcon = c.smallIcon();
- if (smallIcon != null)
- {
- // TODO
- }
-
- // Spec version
- String specVersion = c.specVersion();
- md.setVersion("1.6");
-
- // Transaction support
- TransactionSupport.TransactionSupportLevel transactionSupport = c.transactionSupport();
- if (md.getRa() != null && md.getRa().getOutboundRa() != null)
- {
- if (transactionSupport.equals(TransactionSupportLevel.NoTransaction))
- {
- md.getRa().getOutboundRa().setTransSupport(TransactionSupportMetaData.NoTransaction);
- }
- else if (transactionSupport.equals(TransactionSupportLevel.XATransaction))
- {
- md.getRa().getOutboundRa().setTransSupport(TransactionSupportMetaData.XATransaction);
- }
- else if (transactionSupport.equals(TransactionSupportLevel.LocalTransaction))
- {
- md.getRa().getOutboundRa().setTransSupport(TransactionSupportMetaData.LocalTransaction);
- }
- }
-
- // Vendor name
- String vendorName = c.vendorName();
- if (vendorName != null)
- {
- if (md.getVendorName() == null)
- md.setVendorName(vendorName);
- }
-
- // Version
- String version = c.version();
- if (version != null)
- {
- if (md.getRAVersion() == null)
- md.setRAVersion(version);
- }
-
- return md;
- }
-
- /**
- * Process: @ConnectionDefinitions
- * @param md The metadata
- * @param annotationRepository The annotation repository
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private static ConnectorMetaData processConnectionDefinitions(ConnectorMetaData md,
- AnnotationRepository annotationRepository)
- throws Exception
- {
- Collection<Annotation> values = annotationRepository.getAnnotation(ConnectionDefinitions.class);
- if (values != null)
- {
- if (values.size() == 1)
- {
- Annotation annotation = values.iterator().next();
- ConnectionDefinitions c = (ConnectionDefinitions)annotation.getAnnotation();
-
- if (trace)
- log.trace("Processing: " + c);
-
- md = attachConnectionDefinitions(md , c);
- }
- else
- throw new DeployException("More than one @ConnectionDefinitions defined");
- }
-
- return md;
- }
-
- /**
- * Attach @ConnectionDefinitions
- * @param md The metadata
- * @param cds The connection definitions
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private static ConnectorMetaData attachConnectionDefinitions(ConnectorMetaData md,
- ConnectionDefinitions cds)
- throws Exception
- {
- return md;
- }
-
- /**
- * Process: @ConnectionDefinition
- * @param md The metadata
- * @param annotationRepository The annotation repository
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private static ConnectorMetaData processConnectionDefinition(ConnectorMetaData md,
- AnnotationRepository annotationRepository)
- throws Exception
- {
- Collection<Annotation> values = annotationRepository.getAnnotation(ConnectionDefinition.class);
- if (values != null)
- {
- for (Annotation annotation : values)
- {
- ConnectionDefinition c = (ConnectionDefinition)annotation.getAnnotation();
-
- if (trace)
- log.trace("Processing: " + c);
-
- md = attachConnectionDefinition(md, c);
- }
- }
-
- return md;
- }
-
- /**
- * Attach @ConnectionDefinition
- * @param md The metadata
- * @param cd The connection definition
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private static ConnectorMetaData attachConnectionDefinition(ConnectorMetaData md,
- ConnectionDefinition cd)
- throws Exception
- {
- return md;
- }
-
- /**
- * Process: @ConfigProperty
- * @param md The metadata
- * @param annotationRepository The annotation repository
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private static ConnectorMetaData processConfigProperty(ConnectorMetaData md,
- AnnotationRepository annotationRepository)
- throws Exception
- {
- Collection<Annotation> values = annotationRepository.getAnnotation(ConfigProperty.class);
- if (values != null)
- {
- for (Annotation annotation : values)
- {
- ConfigProperty c = (ConfigProperty)annotation.getAnnotation();
-
- if (trace)
- log.trace("Processing: " + c);
-
- md = attachConfigProperty(md, c);
- }
- }
-
- return md;
- }
-
- /**
- * Attach @ConfigProperty
- * @param md The metadata
- * @param configProperty The config property
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private static ConnectorMetaData attachConfigProperty(ConnectorMetaData md,
- ConfigProperty configProperty)
- throws Exception
- {
- return md;
- }
-
- /**
- * Process: @AuthenticationMechanism
- * @param md The metadata
- * @param annotationRepository The annotation repository
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private static ConnectorMetaData processAuthenticationMechanism(ConnectorMetaData md,
- AnnotationRepository annotationRepository)
- throws Exception
- {
- Collection<Annotation> values = annotationRepository.getAnnotation(AuthenticationMechanism.class);
- if (values != null)
- {
- for (Annotation annotation : values)
- {
- AuthenticationMechanism a = (AuthenticationMechanism)annotation.getAnnotation();
-
- if (trace)
- log.trace("Processing: " + a);
-
- md = attachAuthenticationMechanism(md, a);
- }
- }
-
- return md;
- }
-
- /**
- * Attach @AuthenticationMechanism
- * @param md The metadata
- * @param authenticationmechanism The authentication mechanism
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private static ConnectorMetaData attachAuthenticationMechanism(ConnectorMetaData md,
- AuthenticationMechanism authenticationmechanism)
- throws Exception
- {
- if (md.getRa() == null)
- {
- md.setRa(new ResourceAdapterMetaData());
- }
- if (md.getRa().getOutboundRa() == null)
- {
- md.getRa().setOutboundRa(new OutboundRaMetaData());
- }
- if (md.getRa().getOutboundRa().getAuthMechanisms() == null)
- {
- md.getRa().getOutboundRa().setAuthMechanisms(new ArrayList<AuthenticationMechanismMetaData>());
- }
- AuthenticationMechanismMetaData ammd = new AuthenticationMechanismMetaData();
- ammd.setAuthenticationMechanismType(authenticationmechanism.authMechanism());
-
- String credentialInterfaceClass = null;
- if (authenticationmechanism.credentialInterface().equals(CredentialInterface.GenericCredential))
- {
- credentialInterfaceClass = "javax.resource.spi.security.GenericCredential";
- }
- else if (authenticationmechanism.credentialInterface().equals(CredentialInterface.GSSCredential))
- {
- credentialInterfaceClass = "org.ietf.jgss.GSSCredential";
- }
- else if (authenticationmechanism.credentialInterface().equals(CredentialInterface.PasswordCredential))
- {
- credentialInterfaceClass = "javax.resource.spi.security.PasswordCredential";
- }
- ammd.setCredentialInterfaceClass(credentialInterfaceClass);
- md.getRa().getOutboundRa().getAuthMechanisms().add(ammd);
-
- return md;
- }
-
- /**
- * Process: @AdministeredObject
- * @param md The metadata
- * @param annotationRepository The annotation repository
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private static ConnectorMetaData processAdministeredObject(ConnectorMetaData md,
- AnnotationRepository annotationRepository)
- throws Exception
- {
- Collection<Annotation> values = annotationRepository.getAnnotation(AdministeredObject.class);
- if (values != null)
- {
- for (Annotation annotation : values)
- {
- AdministeredObject a = (AdministeredObject)annotation.getAnnotation();
-
- if (trace)
- log.trace("Processing: " + a);
-
- md = attachAdministeredObject(md, a);
- }
- }
-
- return md;
- }
-
- /**
- * Attach @AdministeredObject
- * @param md The metadata
- * @param a The administered object
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private static ConnectorMetaData attachAdministeredObject(ConnectorMetaData md, AdministeredObject a)
- throws Exception
- {
- if (md.getRa() == null)
- {
- md.setRa(new ResourceAdapterMetaData());
- }
- if (md.getRa().getAdminObjects() == null)
- {
- md.getRa().setAdminObjects(new ArrayList<AdminObjectMetaData>());
- }
- String aoName = null;
- if (a.adminObjectInterfaces().length > 0)
- {
- aoName = ((Class)Array.get(a.adminObjectInterfaces(), 0)).getName();
- }
- AdminObjectMetaData aomd = new AdminObjectMetaData();
- aomd.setAdminObjectInterfaceClass(aoName);
- md.getRa().getAdminObjects().add(aomd);
- return md;
- }
-
- /**
- * Process: @Activation
- * @param md The metadata
- * @param annotationRepository The annotation repository
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private static ConnectorMetaData processActivation(ConnectorMetaData md,
- AnnotationRepository annotationRepository)
- throws Exception
- {
- Collection<Annotation> values = annotationRepository.getAnnotation(Activation.class);
- if (values != null)
- {
- for (Annotation annotation : values)
- {
- Activation a = (Activation)annotation.getAnnotation();
-
- if (trace)
- log.trace("Processing: " + a);
-
- md = attachActivation(md, a);
- }
- }
-
- return md;
- }
-
- /**
- * Attach @Activation
- * @param md The metadata
- * @param activation The activation
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private static ConnectorMetaData attachActivation(ConnectorMetaData md, Activation activation)
- throws Exception
- {
- if (md.getRa() == null)
- {
- md.setRa(new ResourceAdapterMetaData());
- }
- if (md.getRa().getInboundRa() == null)
- {
- md.getRa().setInboundRa(new InboundRaMetaData());
- }
- //TODO
- return md;
- }
-}
Deleted: projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/BeanValidation.java
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/BeanValidation.java 2009-09-11 13:03:59 UTC (rev 93406)
+++ projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/BeanValidation.java 2009-09-11 13:30:00 UTC (rev 93407)
@@ -1,91 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, 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.sjc.deployers.ra;
-
-import java.util.List;
-import java.util.Set;
-
-import javax.validation.Configuration;
-import javax.validation.ConstraintViolationException;
-import javax.validation.Validation;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
-
-import javax.validation.groups.Default;
-
-import org.jboss.logging.Logger;
-
-/**
- *
- * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
- * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
- * @version $Revision: $
- */
-public class BeanValidation
-{
- private static Logger log = Logger.getLogger(BeanValidation.class);
- private static boolean trace = log.isTraceEnabled();
-
- /**
- * Validate the object against the Bean Validation specification (JSR-303).
- * The object must be fully initialized
- * @param object The object that should be validated
- * @param groupsClasses groups targeted for validation
- * @exception ConstraintViolationException Thrown if the object can't be validated
- */
- @SuppressWarnings("unchecked")
- public static void validate(Object object, List<Class> groupsClasses) throws ConstraintViolationException
- {
- if (object == null)
- {
- throw new IllegalArgumentException("Object is null");
- }
-
- Configuration configuration = Validation.byDefaultProvider().configure();
- Configuration<?> conf = configuration.traversableResolver(new JCATraversableResolver());
- ValidatorFactory vf = conf.buildValidatorFactory();
- Validator v = vf.getValidator();
-
- if (trace)
- {
- log.trace("Validating: " + object + " against groups "
- + Default.class.getName());
- }
-
- Set errors = null;
- if (groupsClasses == null)
- {
- errors = v.validate(object, Default.class);
- }
- else
- {
- Class[] vargs = (Class[])groupsClasses.toArray(new Class[groupsClasses.size()]);
- errors = v.validate(object, vargs);
- }
- if (errors != null && errors.size() > 0)
- {
- log.debug("Validated: " + errors.size() + " validate failing");
- throw new ConstraintViolationException(errors);
- }
- }
-
-}
Deleted: projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/JCATraversableResolver.java
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/JCATraversableResolver.java 2009-09-11 13:03:59 UTC (rev 93406)
+++ projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/JCATraversableResolver.java 2009-09-11 13:30:00 UTC (rev 93407)
@@ -1,90 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, 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.sjc.deployers.ra;
-
-import java.lang.annotation.ElementType;
-
-import javax.validation.Path;
-import javax.validation.TraversableResolver;
-
-/**
- * JCATraversableResolver
- * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
- * @version $Revision: $
- */
-public class JCATraversableResolver implements TraversableResolver
-{
- /**
- * Determine if Bean Validation is allowed to reach the property state
- *
- * @param traversableObject
- * object hosting <code>traversableProperty</code> or null if
- * validateValue is called
- * @param traversableProperty
- * the traversable property.
- * @param rootBeanType
- * type of the root object passed to the Validator.
- * @param pathToTraversableObject
- * path from the root object to <code>traversableObject</code>
- * (using the path specification defined by Bean Validator).
- * @param elementType
- * either <code>FIELD</code> or <code>METHOD</code>.
- *
- * @return <code>true</code> if Bean Validation is allowed to reach the
- * property state, <code>false</code> otherwise.
- */
- public boolean isReachable(Object traversableObject, Path.Node traversableProperty,
- Class<?> rootBeanType, Path pathToTraversableObject,
- ElementType elementType)
- {
- return true;
- }
-
- /**
- * Determine if Bean Validation is allowed to cascade validation on the bean
- * instance returned by the property value marked as <code>@Valid</code>.
- * Note that this method is called only if isReachable returns true for the
- * same set of arguments and if the property is marked as <code>@Valid</code>
- *
- * @param traversableObject
- * object hosting <code>traversableProperty</code> or null if
- * validateValue is called
- * @param traversableProperty
- * the traversable property.
- * @param rootBeanType
- * type of the root object passed to the Validator.
- * @param pathToTraversableObject
- * path from the root object to <code>traversableObject</code>
- * (using the path specification defined by Bean Validator).
- * @param elementType
- * either <code>FIELD</code> or <code>METHOD</code>.
- *
- * @return <code>true</code> if Bean Validation is allowed to cascade
- * validation, <code>false</code> otherwise.
- */
- public boolean isCascadable(Object traversableObject,
- Path.Node traversableProperty, Class<?> rootBeanType,
- Path pathToTraversableObject, ElementType elementType)
- {
- return true;
- }
-}
Deleted: projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/Metadata.java
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/Metadata.java 2009-09-11 13:03:59 UTC (rev 93406)
+++ projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/Metadata.java 2009-09-11 13:30:00 UTC (rev 93407)
@@ -1,280 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008-2009, 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.sjc.deployers.ra;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jboss.logging.Logger;
-//import org.jboss.metadata.rar.jboss.JBossRA10DefaultNSMetaData;
-import org.jboss.metadata.rar.jboss.JBossRA10MetaData;
-import org.jboss.metadata.rar.jboss.JBossRA20DefaultNSMetaData;
-import org.jboss.metadata.rar.jboss.JBossRA20MetaData;
-import org.jboss.metadata.rar.jboss.JBossRAMetaData;
-import org.jboss.metadata.rar.jboss.RaConfigPropertyMetaData;
-import org.jboss.metadata.rar.spec.ConfigPropertyMetaData;
-import org.jboss.metadata.rar.spec.ConnectorMetaData;
-import org.jboss.metadata.rar.spec.JCA15DTDMetaData;
-import org.jboss.metadata.rar.spec.JCA15MetaData;
-import org.jboss.metadata.rar.spec.JCA16DTDMetaData;
-import org.jboss.metadata.rar.spec.JCA16DefaultNSMetaData;
-import org.jboss.metadata.rar.spec.JCA16MetaData;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.resolver.MutableSchemaResolver;
-import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
-
-/**
- * The metadata processor for JCA 1.x
- * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
- * @author <a href="mailto:jeff.zhang at redhat.com">Jeff Zhang</a>
- */
-public class Metadata
-{
- private static Logger log = Logger.getLogger(Metadata.class);
- private static boolean trace = log.isTraceEnabled();
-
- /**
- * Constructor
- */
- private Metadata()
- {
- }
-
- /**
- * Get the JCA standard metadata
- * @param root The root of the deployment
- * @return The metadata
- * @exception Exception Thrown if an error occurs
- */
- public static ConnectorMetaData getStandardMetaData(File root) throws Exception
- {
- ConnectorMetaData result = null;
-
- UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
- Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
-
- MutableSchemaResolver resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
- resolver.mapLocationToClass("connector_1_6.xsd", JCA16MetaData.class);
- resolver.mapLocationToClass("connector_1_5.xsd", JCA15MetaData.class);
- resolver.mapLocationToClass("connector_1_5.dtd", JCA15DTDMetaData.class);
- resolver.mapLocationToClass("connector_1_6.dtd", JCA16DTDMetaData.class);
- resolver.mapLocationToClass("connector", JCA16DefaultNSMetaData.class);
-
- File metadataFile = new File(root, "/META-INF/ra.xml");
-
- if (metadataFile.exists())
- {
- String url = metadataFile.getAbsolutePath();
- try
- {
- long start = System.currentTimeMillis();
-
- result = (ConnectorMetaData)unmarshaller.unmarshal(url, resolver);
-
- log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms");
-
- if (trace)
- {
- log.trace("successful parse " + result.getVersion() + " rar package " + result);
- }
-
- }
- catch (Exception e)
- {
- log.error("Error during parsing: " + url, e);
- throw e;
- }
- }
-
- return result;
- }
-
- /**
- * Get the JBoss specific metadata
- * @param root The root of the deployment
- * @return The metadata
- * @exception Exception Thrown if an error occurs
- */
- public static JBossRAMetaData getJBossMetaData(File root) throws Exception
- {
- JBossRAMetaData result = null;
-
- UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
- Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
-
- MutableSchemaResolver resolver = SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
- resolver.mapLocationToClass("http://www.jboss.org/schema/jboss-ra_1_0.xsd", JBossRA10MetaData.class);
- resolver.mapLocationToClass("http://www.jboss.org/schema/jboss-ra_2_0.xsd", JBossRA20MetaData.class);
- resolver.mapLocationToClass("jboss-ra", JBossRA20DefaultNSMetaData.class);
-
- File metadataFile = new File(root, "/META-INF/jboss-ra.xml");
-
- if (metadataFile.exists())
- {
- String url = metadataFile.getAbsolutePath();
- try
- {
- long start = System.currentTimeMillis();
-
- result = (JBossRAMetaData)unmarshaller.unmarshal(url, resolver);
-
- log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms");
-
- if (trace)
- log.trace(result);
- }
- catch (Exception e)
- {
- log.error("Error during parsing: " + url, e);
- throw e;
- }
- }
-
- return result;
- }
-
- /**
- * Merge specification metadata with vendor metadata
- * @param cmd The specification metadata
- * @param jmd The vendor metadata
- * @return The merged metadata
- * @exception Exception Thrown if an error occurs
- */
- public static ConnectorMetaData merge(ConnectorMetaData cmd, JBossRAMetaData jmd) throws Exception
- {
- if (cmd != null && jmd != null)
- {
- /*
- <xs:restriction base="javaee:string">
- <xs:enumeration value="connection-definition"/>
- <xs:enumeration value="resourceadapter"/>
- <xs:enumeration value="activationspec"/>
- <xs:enumeration value="adminobject"/>
- </xs:restriction>
- */
-
- List<RaConfigPropertyMetaData> props = jmd.getRaConfigProps();
-
- List<ConfigPropertyMetaData> append = null;
-
- if (props != null)
- {
- for (RaConfigPropertyMetaData rcmd : props)
- {
- List<ConfigPropertyMetaData> listConfigProp = null;
- String override = rcmd.getOverride();
- if (override == null || override.equals("resourceadapter"))
- {
- if (cmd.getRa() != null)
- {
- listConfigProp = cmd.getRa().getConfigProperty();
- }
- }
- else if (override.equals("connection-definition"))
- {
- if (cmd.getRa() != null &&
- cmd.getRa().getOutboundRa() != null &&
- cmd.getRa().getOutboundRa().getConDefs() != null &&
- cmd.getRa().getOutboundRa().getConDefs().size() > 0 &&
- cmd.getRa().getOutboundRa().getConDefs().get(0) != null)
- {
- listConfigProp = cmd.getRa().getOutboundRa().getConDefs().get(0).getConfigProps();
- }
- }
- else if (override.equals("activationspec"))
- {
- if (cmd.getRa() != null &&
- cmd.getRa().getInboundRa() != null &&
- cmd.getRa().getInboundRa().getMessageAdapter() != null &&
- cmd.getRa().getInboundRa().getMessageAdapter().getMessageListeners() != null &&
- cmd.getRa().getInboundRa().getMessageAdapter().getMessageListeners().size() > 0 &&
- cmd.getRa().getInboundRa().getMessageAdapter().getMessageListeners().get(0) != null &&
- cmd.getRa().getInboundRa().getMessageAdapter().getMessageListeners().get(0).
- getActivationSpecType() != null)
- {
- listConfigProp = cmd.getRa().getInboundRa().getMessageAdapter().getMessageListeners().
- get(0).getActivationSpecType().getConfigProps();
- }
- }
- else if (override.equals("adminobject"))
- {
- if (cmd.getRa() != null &&
- cmd.getRa().getAdminObjects() != null &&
- cmd.getRa().getAdminObjects().size() > 0 &&
- cmd.getRa().getAdminObjects().get(0) != null)
- {
- listConfigProp = cmd.getRa().getAdminObjects().get(0).getConfigProps();
- }
- }
-
- boolean found = false;
-
- if (listConfigProp != null)
- {
- Iterator<ConfigPropertyMetaData> it = listConfigProp.iterator();
-
- while (!found && it.hasNext())
- {
- ConfigPropertyMetaData cpmd = it.next();
- if (cpmd.getName().equals(rcmd.getName()) &&
- cpmd.getType().equals(rcmd.getType()))
- {
- cpmd.setValue(rcmd.getValue());
- found = true;
- }
- }
- }
-
- if (!found)
- {
- if (append == null)
- append = new ArrayList<ConfigPropertyMetaData>();
-
- ConfigPropertyMetaData cpmd = new ConfigPropertyMetaData();
- cpmd.setName(rcmd.getName());
- cpmd.setType(rcmd.getType());
- cpmd.setValue(rcmd.getValue());
-
- append.add(cpmd);
- }
- }
-
- if (append != null)
- {
- if (cmd.getRa().getConfigProperty() == null)
- cmd.getRa().setConfigProperty(new ArrayList<ConfigPropertyMetaData>());
-
- for (ConfigPropertyMetaData cpmd : append)
- {
- cmd.getRa().getConfigProperty().add(cpmd);
- }
- }
- }
- }
-
- return cmd;
- }
-}
Deleted: projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/RADeployer.java
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/RADeployer.java 2009-09-11 13:03:59 UTC (rev 93406)
+++ projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/RADeployer.java 2009-09-11 13:30:00 UTC (rev 93407)
@@ -1,357 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008-2009, 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.sjc.deployers.ra;
-
-import org.jboss.jca.fungal.deployers.DeployException;
-import org.jboss.jca.fungal.deployers.Deployer;
-import org.jboss.jca.fungal.deployers.Deployment;
-import org.jboss.jca.fungal.util.FileUtil;
-import org.jboss.jca.fungal.util.Injection;
-import org.jboss.jca.fungal.util.JarFilter;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.logging.Logger;
-
-import org.jboss.metadata.rar.jboss.BvGroupMetaData;
-import org.jboss.metadata.rar.jboss.JBossRA20Base;
-import org.jboss.metadata.rar.jboss.JBossRAMetaData;
-import org.jboss.metadata.rar.spec.AdminObjectMetaData;
-import org.jboss.metadata.rar.spec.ConfigPropertyMetaData;
-import org.jboss.metadata.rar.spec.ConnectionDefinitionMetaData;
-import org.jboss.metadata.rar.spec.ConnectorMetaData;
-import org.jboss.metadata.rar.spec.JCA16DTDMetaData;
-import org.jboss.metadata.rar.spec.JCA16DefaultNSMetaData;
-import org.jboss.metadata.rar.spec.JCA16MetaData;
-import org.jboss.metadata.rar.spec.MessageListenerMetaData;
-import org.jboss.papaki.Annotation;
-import org.jboss.papaki.AnnotationRepository;
-import org.jboss.papaki.AnnotationScanner;
-import org.jboss.papaki.AnnotationScannerFactory;
-
-/**
- * The RA deployer for JCA/SJC
- * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
- * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
- */
-public class RADeployer implements Deployer
-{
- private static Logger log = Logger.getLogger(RADeployer.class);
- private static boolean trace = log.isTraceEnabled();
-
- /**
- * validation optional
- */
- private boolean beanValidation = true;
-
- /**
- * Constructor
- */
- public RADeployer()
- {
- }
-
- /**
- * setBeanValidation
- * @param value validation optional
- */
- public void setBeanValidation(boolean value)
- {
- beanValidation = value;
- }
-
- /**
- * getBeanValidation
- * @return validation optional
- */
- public boolean getBeanValidation()
- {
- return beanValidation;
- }
-
- /**
- * Deploy
- * @param url The url
- * @param parent The parent classloader
- * @return The deployment
- * @exception DeployException Thrown if an error occurs during deployment
- */
- public Deployment deploy(URL url, ClassLoader parent) throws DeployException
- {
- if (url == null || !(url.toExternalForm().endsWith(".rar") || url.toExternalForm().endsWith(".rar/")))
- return null;
-
- log.info("Deploying: " + url.toExternalForm());
-
- ClassLoader oldTCCL = SecurityActions.getThreadContextClassLoader();
- try
- {
- File f = new File(url.toURI());
-
- File root = null;
-
- if (f.isFile())
- {
- File destination = new File(SecurityActions.getSystemProperty("jboss.jca.home"), "/tmp/");
- root = FileUtil.extract(f, destination);
- }
- else
- {
- root = f;
- }
-
- // Create classloader
- URL[] urls = getUrls(root);
- URLClassLoader cl = SecurityActions.createURLCLassLoader(urls, parent);
- SecurityActions.setThreadContextClassLoader(cl);
-
- // Parse metadata
- ConnectorMetaData cmd = Metadata.getStandardMetaData(root);
- JBossRAMetaData jrmd = Metadata.getJBossMetaData(root);
- boolean isMetadataComplete = true;
-
- // Process annotations
- if (cmd == null || cmd.is16())
- {
- AnnotationScanner annotationScanner =
- AnnotationScannerFactory.getStrategy(AnnotationScannerFactory.JAVASSIST_INPUT_STREAM);
- AnnotationRepository annotationRepository = annotationScanner.scan(cl.getURLs(), cl);
-
- isMetadataComplete = false;
- if (cmd != null)
- {
- if (cmd instanceof JCA16MetaData)
- {
- JCA16MetaData jmd = (JCA16MetaData)cmd;
- isMetadataComplete = jmd.isMetadataComplete();
- }
- else if (cmd instanceof JCA16DefaultNSMetaData)
- {
- JCA16DefaultNSMetaData jmd = (JCA16DefaultNSMetaData)cmd;
- isMetadataComplete = jmd.isMetadataComplete();
- }
- else if (cmd instanceof JCA16DTDMetaData)
- {
- JCA16DTDMetaData jmd = (JCA16DTDMetaData)cmd;
- isMetadataComplete = jmd.isMetadataComplete();
- }
- }
-
- if (cmd == null || !isMetadataComplete)
- cmd = Annotations.process(cmd, annotationRepository);
- }
-
- // Validate metadata
-
- // Merge metadata
- cmd = Metadata.merge(cmd, jrmd);
-
- // Create objects
- // And
- // Inject values
- List<Object> objects = new ArrayList<Object>();
- if (cmd != null)
- {
- // ResourceAdapter
- if (cmd.getRa() != null && cmd.getRa().getRaClass() != null)
- {
- initAndInject(cmd.getRa().getRaClass(),
- cmd.getRa().getConfigProperty(), objects, cl);
- }
-
- // ManagedConnectionFactory
- if (cmd.getRa() != null &&
- cmd.getRa().getOutboundRa() != null &&
- cmd.getRa().getOutboundRa().getConDefs() != null)
- {
- List<ConnectionDefinitionMetaData> cdMetas = cmd.getRa().getOutboundRa().getConDefs();
- if (cdMetas.size() > 0)
- {
- //mcfs = new ArrayList<Object>();
- for (ConnectionDefinitionMetaData cdMeta : cdMetas)
- {
- if (cdMeta.getManagedConnectionFactoryClass() != null)
- {
- initAndInject(cdMeta.getManagedConnectionFactoryClass(),
- cdMeta.getConfigProps(), objects, cl);
- }
- }
- }
- }
- // activationspec
- if (cmd.getRa() != null &&
- cmd.getRa().getInboundRa() != null &&
- cmd.getRa().getInboundRa().getMessageAdapter() != null &&
- cmd.getRa().getInboundRa().getMessageAdapter().getMessageListeners() != null)
- {
- List<MessageListenerMetaData> mlMetas = cmd.getRa().getInboundRa().
- getMessageAdapter().getMessageListeners();
- if (mlMetas.size() > 0)
- {
- for (MessageListenerMetaData mlMeta : mlMetas)
- {
- if (mlMeta.getActivationSpecType() != null && mlMeta.getActivationSpecType().getAsClass() != null)
- {
- initAndInject(mlMeta.getActivationSpecType().getAsClass(),
- mlMeta.getActivationSpecType().getConfigProps(), objects, cl);
- }
- }
- }
- }
-
- //adminobject
- if (cmd.getRa() != null &&
- cmd.getRa().getAdminObjects() != null)
- {
- List<AdminObjectMetaData> aoMetas = cmd.getRa().getAdminObjects();
- if (aoMetas.size() > 0)
- {
- for (AdminObjectMetaData aoMeta : aoMetas)
- {
- if (aoMeta.getAdminObjectImplementationClass() != null)
- {
- initAndInject(aoMeta.getAdminObjectImplementationClass(),
- aoMeta.getConfigProps(), objects, cl);
- }
- }
- }
- }
- }
-
-
- // Bean validation
- if (beanValidation)
- {
- JBossRA20Base jrmd20 = null;
- List<Class> groupsClasses = null;
- if (jrmd instanceof JBossRA20Base)
- {
- jrmd20 = (JBossRA20Base)jrmd;
- }
- if (jrmd20 != null && jrmd20.getBvGroupsList() != null && jrmd20.getBvGroupsList().size() > 0)
- {
- BvGroupMetaData bvGroups = jrmd20.getBvGroupsList().get(0);
- groupsClasses = new ArrayList<Class>();
- for (String group : bvGroups.getBvGroups())
- {
- groupsClasses.add(Class.forName(group, true, cl));
- }
- }
-
- if (objects != null && objects.size() > 0)
- {
- for (Object mcf : objects)
- {
- BeanValidation.validate(mcf, groupsClasses);
- }
- }
- }
-
- // Activate deployment
-
- return new RADeployment(f, cl);
- }
- catch (Throwable t)
- {
- throw new DeployException("Deployment " + url.toExternalForm() + " failed", t);
- }
- finally
- {
- SecurityActions.setThreadContextClassLoader(oldTCCL);
- }
- }
-
- /**
- * initAndInject
- * @param mlMeta
- * @param mcfs
- * @param cl
- * @throws DeployException
- */
- private void initAndInject(String className, List<ConfigPropertyMetaData> cpMetas,
- List<Object> mcfs, URLClassLoader cl) throws DeployException
- {
- Object mcf = null;
- try
- {
- Class mcfClass = Class.forName(className, true, cl);
- mcf = mcfClass.newInstance();
- mcfs.add(mcf);
-
- if (mcf != null)
- {
- if (cpMetas != null)
- {
- for (ConfigPropertyMetaData cpmd : cpMetas)
- {
- Injection.inject(cpmd.getType(), cpmd.getName(), cpmd.getValue(), mcf);
- }
- }
- }
- }
- catch (ClassNotFoundException e)
- {
- log.trace("can't constractor " + className + " class");
- }
- catch (Throwable t)
- {
- throw new DeployException("Deployment " + className + " failed", t);
- }
-
- }
-
- /**
- * Get the URLs for the directory and all libraries located in the directory
- * @param directrory The directory
- * @return The URLs
- * @exception MalformedURLException MalformedURLException
- * @exception IOException IOException
- */
- private URL[] getUrls(File directory) throws MalformedURLException, IOException
- {
- List<URL> list = new LinkedList<URL>();
-
- if (directory.exists() && directory.isDirectory())
- {
- // Add directory
- list.add(directory.toURI().toURL());
-
- // Add the contents of the directory too
- File[] jars = directory.listFiles(new JarFilter());
-
- for (int j = 0; jars != null && j < jars.length; j++)
- {
- list.add(jars[j].getCanonicalFile().toURI().toURL());
- }
- }
- return list.toArray(new URL[list.size()]);
- }
-}
Deleted: projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/RADeployment.java
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/RADeployment.java 2009-09-11 13:03:59 UTC (rev 93406)
+++ projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/RADeployment.java 2009-09-11 13:30:00 UTC (rev 93407)
@@ -1,96 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008-2009, 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.sjc.deployers.ra;
-
-import org.jboss.jca.fungal.deployers.Deployment;
-
-import java.io.Closeable;
-import java.io.File;
-import java.io.IOException;
-
-import org.jboss.logging.Logger;
-
-/**
- * A resource adapter deployment for JCA/SJC
- * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
- */
-public class RADeployment implements Deployment
-{
- private static Logger log = Logger.getLogger(RADeployer.class);
- private static boolean trace = log.isTraceEnabled();
-
- /** The resource adapter file */
- private File adapter;
-
- /** The classloader */
- private ClassLoader cl;
-
- /**
- * Constructor
- * @param adapter The adapter
- * @param cl The classloader for the deployment
- */
- public RADeployment(File adapter, ClassLoader cl)
- {
- this.adapter = adapter;
- this.cl = cl;
- }
-
- /**
- * Get the name
- * @return The name
- */
- public String getName()
- {
- return adapter.getName();
- }
-
- /**
- * Get the classloader
- * @return The classloader
- */
- public ClassLoader getClassLoader()
- {
- return cl;
- }
-
- /**
- * Destroy
- */
- public void destroy()
- {
- log.info("Undeploying: " + adapter.getAbsolutePath());
-
- if (cl != null && cl instanceof Closeable)
- {
- try
- {
- ((Closeable)cl).close();
- }
- catch (IOException ioe)
- {
- // Swallow
- }
- }
- }
-}
Deleted: projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/SecurityActions.java
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/SecurityActions.java 2009-09-11 13:03:59 UTC (rev 93406)
+++ projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/SecurityActions.java 2009-09-11 13:30:00 UTC (rev 93407)
@@ -1,139 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008-2009, 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.sjc.deployers.ra;
-
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Properties;
-
-/**
- * Privileged Blocks
- * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
- */
-class SecurityActions
-{
- /**
- * Constructor
- */
- private SecurityActions()
- {
- }
-
- /**
- * Get the thread context class loader
- * @return The class loader
- */
- static ClassLoader getThreadContextClassLoader()
- {
- return (ClassLoader)AccessController.doPrivileged(new PrivilegedAction<Object>()
- {
- public Object run()
- {
- return Thread.currentThread().getContextClassLoader();
- }
- });
- }
-
- /**
- * Set the thread context class loader
- * @param cl The class loader
- */
- static void setThreadContextClassLoader(final ClassLoader cl)
- {
- AccessController.doPrivileged(new PrivilegedAction<Object>()
- {
- public Object run()
- {
- Thread.currentThread().setContextClassLoader(cl);
- return null;
- }
- });
- }
-
- /**
- * Get the system properties
- * @return The properties
- */
- static Properties getSystemProperties()
- {
- return (Properties)AccessController.doPrivileged(new PrivilegedAction<Object>()
- {
- public Object run()
- {
- return System.getProperties();
- }
- });
- }
-
- /**
- * Get a system property
- * @param name The property name
- * @return The property value
- */
- static String getSystemProperty(final String name)
- {
- return (String)AccessController.doPrivileged(new PrivilegedAction<Object>()
- {
- public Object run()
- {
- return System.getProperty(name);
- }
- });
- }
-
- /**
- * Set a system property
- * @param name The property name
- * @param value The property value
- */
- static void setSystemProperty(final String name, final String value)
- {
- AccessController.doPrivileged(new PrivilegedAction<Object>()
- {
- public Object run()
- {
- System.setProperty(name, value);
- return null;
- }
- });
- }
-
- /**
- * Create an URLClassLoader
- * @param urls The urls
- * @param parent The parent class loader
- * @return The class loader
- */
- static URLClassLoader createURLCLassLoader(final URL[] urls, final ClassLoader parent)
- {
- return (URLClassLoader)AccessController.doPrivileged(new PrivilegedAction<Object>()
- {
- public Object run()
- {
- return new URLClassLoader(urls, parent);
- }
- });
- }
-}
Deleted: projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/package.html
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/package.html 2009-09-11 13:03:59 UTC (rev 93406)
+++ projects/jboss-jca/trunk/sjc/src/main/java/org/jboss/jca/sjc/deployers/ra/package.html 2009-09-11 13:30:00 UTC (rev 93407)
@@ -1,3 +0,0 @@
-<body>
-This package contains the resource adapter deployer for the JBoss JCA/SJC container.
-</body>
Modified: projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/jca.xml
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/jca.xml 2009-09-11 13:03:59 UTC (rev 93406)
+++ projects/jboss-jca/trunk/sjc/src/main/resources/bootstrap/jca.xml 2009-09-11 13:30:00 UTC (rev 93407)
@@ -29,7 +29,7 @@
</bean>
<!-- RA deployer -->
- <bean name="RADeployer" interface="org.jboss.jca.sjc.deployers.Deployer" class="org.jboss.jca.sjc.deployers.ra.RADeployer">
+ <bean name="RADeployer" interface="org.jboss.jca.fungal.deployers.Deployer" class="org.jboss.jca.deployers.fungal.RADeployer">
<depends>ConnectionManager</depends>
<depends>WorkManager</depends>
</bean>
Deleted: projects/jboss-jca/trunk/sjc/src/main/resources/sjc-ra-manifest.mf
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/resources/sjc-ra-manifest.mf 2009-09-11 13:03:59 UTC (rev 93406)
+++ projects/jboss-jca/trunk/sjc/src/main/resources/sjc-ra-manifest.mf 2009-09-11 13:30:00 UTC (rev 93407)
@@ -1,4 +0,0 @@
-Implementation-Title: JBoss JCA SJC RA Deployer
-Implementation-Vendor: Red Hat Middleware LLC
-Implementation-Vendor-Id: org.jboss
-Implementation-Version: 0.1
Deleted: projects/jboss-jca/trunk/sjc/src/main/resources/sjc-services-manifest.mf
===================================================================
--- projects/jboss-jca/trunk/sjc/src/main/resources/sjc-services-manifest.mf 2009-09-11 13:03:59 UTC (rev 93406)
+++ projects/jboss-jca/trunk/sjc/src/main/resources/sjc-services-manifest.mf 2009-09-11 13:30:00 UTC (rev 93407)
@@ -1,4 +0,0 @@
-Implementation-Title: JBoss JCA SJC Services
-Implementation-Vendor: Red Hat Middleware LLC
-Implementation-Vendor-Id: org.jboss
-Implementation-Version: 0.1
Modified: projects/jboss-jca/trunk/standalone/build.xml
===================================================================
--- projects/jboss-jca/trunk/standalone/build.xml 2009-09-11 13:03:59 UTC (rev 93406)
+++ projects/jboss-jca/trunk/standalone/build.xml 2009-09-11 13:30:00 UTC (rev 93407)
@@ -97,7 +97,7 @@
<copy todir="${target.dir}/standalone/bin">
<fileset dir="${target.dir}">
- <include name="*standalone.jar"/>
+ <include name="jboss-jca-standalone.jar"/>
</fileset>
</copy>
@@ -134,8 +134,11 @@
<copy todir="${target.dir}/standalone/lib">
<fileset dir="${target.dir}">
<include name="*.jar"/>
- <exclude name="*standalone.jar"/>
- <exclude name="jboss-jca-sjc*.jar"/>
+ <exclude name="jboss-jca-deployers-fungal.jar"/>
+ <exclude name="jboss-jca-fungal-services.jar"/>
+ <exclude name="jboss-jca-fungal.jar"/>
+ <exclude name="jboss-jca-sjc.jar"/>
+ <exclude name="jboss-jca-standalone.jar"/>
</fileset>
</copy>
More information about the jboss-cvs-commits
mailing list