[jboss-cvs] JBossAS SVN: r101449 - in projects/jboss-jca/trunk: common/src/main/java/org/jboss/jca/common and 20 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Feb 25 02:18:08 EST 2010
Author: jeff.zhang
Date: 2010-02-25 02:18:02 -0500 (Thu, 25 Feb 2010)
New Revision: 101449
Added:
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/Annotations.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/Metadata.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/SecurityActions.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/ValidateException.java
projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/package.html
projects/jboss-jca/trunk/validator/
projects/jboss-jca/trunk/validator/.classpath
projects/jboss-jca/trunk/validator/.project
projects/jboss-jca/trunk/validator/build.xml
projects/jboss-jca/trunk/validator/src/
projects/jboss-jca/trunk/validator/src/main/
projects/jboss-jca/trunk/validator/src/main/java/
projects/jboss-jca/trunk/validator/src/main/java/org/
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Failure.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/FailureHelper.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Key.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Main.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Rule.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/SecurityActions.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Severity.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validate.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateClass.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateObject.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validator.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/package.html
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/
projects/jboss-jca/trunk/validator/src/main/resources/
projects/jboss-jca/trunk/validator/src/main/resources/validator-cli-manifest.mf
projects/jboss-jca/trunk/validator/src/main/resources/validator-manifest.mf
projects/jboss-jca/trunk/validator/src/main/resources/validator.properties
projects/jboss-jca/trunk/validator/src/main/resources/validator.sh
Removed:
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/Annotations.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/Metadata.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/SecurityActions.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/ValidateException.java
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/
projects/jboss-jca/trunk/deployers/src/main/resources/validator-manifest.mf
projects/jboss-jca/trunk/deployers/src/main/resources/validator.properties
projects/jboss-jca/trunk/deployers/src/main/resources/validator.sh
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Failure.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/FailureHelper.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Key.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Main.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Rule.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/SecurityActions.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Severity.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validate.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateClass.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateObject.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validator.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/package.html
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/
Modified:
projects/jboss-jca/trunk/build.xml
projects/jboss-jca/trunk/deployers/build.xml
projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/annotations/AnnotationsTestCase.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ao/AOConfigProperties.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ao/AOConstructor.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/as/ASConfigProperties.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/as/ASConstructor.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/cf/CFNull.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/cf/CFReferenceable.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/cf/CFSerializable.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mc/MC.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mc/MCGetMetaData.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCF.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFConfigProperties.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFConstructor.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFEquals.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFHashCode.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RA.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RAConfigProperties.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RAConstructor.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RAEquals.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RAHashCode.java
projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RANull.java
Log:
[JBJCA-291] Extract the validator code from deployers/ into validator module
Modified: projects/jboss-jca/trunk/build.xml
===================================================================
--- projects/jboss-jca/trunk/build.xml 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/build.xml 2010-02-25 07:18:02 UTC (rev 101449)
@@ -218,6 +218,7 @@
<ant dir="api" inheritRefs="true" target="jars"/>
<ant dir="common" inheritRefs="true" target="jars"/>
<ant dir="core" inheritRefs="true" target="jars"/>
+ <ant dir="validator" inheritRefs="true" target="jars"/>
<ant dir="deployers" inheritRefs="true" target="jars"/>
<ant dir="embedded" inheritRefs="true" target="jars"/>
<ant dir="web" inheritRefs="true" target="jars"/>
@@ -233,6 +234,7 @@
<ant dir="api" inheritRefs="true" target="docs"/>
<ant dir="common" inheritRefs="true" target="docs"/>
<ant dir="core" inheritRefs="true" target="docs"/>
+ <ant dir="validator" inheritRefs="true" target="docs"/>
<ant dir="deployers" inheritRefs="true" target="docs"/>
<ant dir="embedded" inheritRefs="true" target="docs"/>
<ant dir="web" inheritRefs="true" target="docs"/>
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/Annotations.java (from rev 101443, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/Annotations.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/Annotations.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/Annotations.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,1121 @@
+/*
+ * 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.common;
+
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+
+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.javaee.spec.DescriptionGroupMetaData;
+import org.jboss.metadata.javaee.spec.DescriptionImpl;
+import org.jboss.metadata.javaee.spec.DescriptionsImpl;
+import org.jboss.metadata.javaee.spec.DisplayNameImpl;
+import org.jboss.metadata.javaee.spec.DisplayNamesImpl;
+import org.jboss.metadata.javaee.spec.IconImpl;
+import org.jboss.metadata.javaee.spec.IconsImpl;
+
+import org.jboss.metadata.rar.spec.ActivationspecMetaData;
+import org.jboss.metadata.rar.spec.AdminObjectMetaData;
+import org.jboss.metadata.rar.spec.AuthenticationMechanismMetaData;
+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.InboundRaMetaData;
+import org.jboss.metadata.rar.spec.JCA16Base;
+import org.jboss.metadata.rar.spec.JCA16MetaData;
+import org.jboss.metadata.rar.spec.LicenseMetaData;
+import org.jboss.metadata.rar.spec.MessageAdapterMetaData;
+import org.jboss.metadata.rar.spec.MessageListenerMetaData;
+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;
+import org.jboss.papaki.AnnotationScanner;
+import org.jboss.papaki.AnnotationScannerFactory;
+import org.jboss.papaki.AnnotationType;
+
+/**
+ * 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
+ */
+ public Annotations()
+ {
+ }
+
+ /**
+ * Scan for annotations in the URLs specified
+ * @param cmd The resource adapter metadata
+ * @param urls The URLs to be scanned
+ * @param cl The referenced classloader
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ public ConnectorMetaData scan(ConnectorMetaData cmd, URL[] urls, ClassLoader cl) throws Exception
+ {
+ // Process annotations
+ if (cmd == null || cmd.is16())
+ {
+ AnnotationScanner annotationScanner =
+ AnnotationScannerFactory.getStrategy(AnnotationScannerFactory.JAVASSIST_INPUT_STREAM);
+ annotationScanner.configure().constructorLevel(false).parameterLevel(false);
+ AnnotationRepository annotationRepository = annotationScanner.scan(urls, cl);
+
+ boolean isMetadataComplete = false;
+ if (cmd != null && cmd instanceof JCA16Base)
+ {
+ JCA16Base jmd = (JCA16Base)cmd;
+ isMetadataComplete = jmd.isMetadataComplete();
+ }
+
+ if (cmd == null || !isMetadataComplete)
+ {
+ cmd = process(cmd, annotationRepository);
+ }
+ }
+ return cmd;
+ }
+ /**
+ * Process annotations
+ * @param md The metadata
+ * @param annotationRepository The annotation repository
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ public ConnectorMetaData process(ConnectorMetaData md, AnnotationRepository annotationRepository)
+ throws Exception
+ {
+ if (annotationRepository == null)
+ throw new ValidateException("AnnotationRepository reference is null");
+ /* 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);
+
+ // @Activation
+ md = processActivation(md, annotationRepository);
+
+ // @AuthenticationMechanism
+ //md = processAuthenticationMechanism(md, annotationRepository);
+
+ // @AdministeredObject
+ md = processAdministeredObject(md, annotationRepository);
+
+ // @ConfigProperty handle at last
+ md = processConfigProperty(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 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();
+ String raClass = annotation.getClassName();
+ Connector c = (Connector)annotation.getAnnotation();
+
+ if (trace)
+ log.trace("Processing: " + c + " for " + raClass);
+
+ md = attachConnector(md, raClass, c);
+ }
+ else if (values.size() == 0)
+ {
+ // JBJCA-240
+ if (md.getRa().getRaClass() == null || md.getRa().getRaClass().equals(""))
+ {
+ log.fatal("No @Connector was found and no definition in the ra.xml metadata either");
+ throw new ValidateException("No @Connector defined");
+ }
+ }
+ else
+ {
+ // JBJCA-240
+ if (md.getRa().getRaClass() == null || md.getRa().getRaClass().equals(""))
+ {
+ log.fatal("More than one @Connector was found but the correct one " +
+ "wasn't defined in the ra.xml metadata");
+ throw new ValidateException("More than one @Connector defined");
+ }
+ }
+ }
+
+ return md;
+ }
+
+ /**
+ * Attach @Connector
+ * @param md The metadata
+ * @param raClass The class name for the resource adapter
+ * @param c The connector
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private ConnectorMetaData attachConnector(ConnectorMetaData md, String raClass, Connector c)
+ throws Exception
+ {
+ // Class definition
+ if (md.getRa() == null)
+ md.setRa(new ResourceAdapterMetaData());
+
+ md.getRa().setRaClass(raClass);
+
+ // AuthenticationMechanism
+ AuthenticationMechanism[] authMechanisms = c.authMechanisms();
+ if (authMechanisms != null)
+ {
+ for (AuthenticationMechanism authMechanism : authMechanisms)
+ {
+ attachAuthenticationMechanism(md, authMechanism);
+ }
+ }
+
+ DescriptionGroupMetaData descGroup = new DescriptionGroupMetaData();
+ md.setDescriptionGroup(descGroup);
+
+ // Description
+ String[] description = c.description();
+ if (description != null)
+ {
+ if (descGroup.getDescriptions() == null)
+ {
+ DescriptionsImpl descsImpl = new DescriptionsImpl();
+ descGroup.setDescriptions(descsImpl);
+ }
+ for (String desc : description)
+ {
+ DescriptionImpl descImpl = new DescriptionImpl();
+ descImpl.setDescription(desc);
+ ((DescriptionsImpl)descGroup.getDescriptions()).add(descImpl);
+ }
+ }
+
+ // Display name
+ String[] displayName = c.displayName();
+ if (displayName != null)
+ {
+ if (descGroup.getDisplayNames() == null)
+ {
+ DisplayNamesImpl dnsImpl = new DisplayNamesImpl();
+ descGroup.setDisplayNames(dnsImpl);
+ }
+ for (String dn : displayName)
+ {
+ DisplayNameImpl dnImpl = new DisplayNameImpl();
+ dnImpl.setDisplayName(dn);
+ ((DisplayNamesImpl)descGroup.getDisplayNames()).add(dnImpl);
+ }
+ }
+
+ // 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)
+ {
+ if (descGroup.getIcons() == null)
+ {
+ IconsImpl icsImpl = new IconsImpl();
+ descGroup.setIcons(icsImpl);
+ }
+ for (String large : largeIcon)
+ {
+ IconImpl icImpl = new IconImpl();
+ icImpl.setLargeIcon(large);
+ ((IconsImpl)descGroup.getIcons()).add(icImpl);
+ }
+ }
+
+ // License description
+ String[] licenseDescription = c.licenseDescription();
+ if (licenseDescription != null)
+ {
+ if (md.getLicense() == null)
+ md.setLicense(new LicenseMetaData());
+
+ if (md.getLicense().getDescriptions() == null)
+ {
+ DescriptionsImpl descsImpl = new DescriptionsImpl();
+ md.getLicense().setDescriptions(descsImpl);
+ }
+ for (String desc : licenseDescription)
+ {
+ DescriptionImpl descImpl = new DescriptionImpl();
+ descImpl.setDescription(desc);
+ ((DescriptionsImpl)md.getLicense().getDescriptions()).add(descImpl);
+ }
+ }
+
+ // 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 JCA16Base)
+ {
+ JCA16Base jmd = (JCA16Base)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)
+ {
+ IconsImpl icsImpl;
+ if (descGroup.getIcons() == null)
+ {
+ icsImpl = new IconsImpl();
+ descGroup.setIcons(icsImpl);
+ }
+ else
+ {
+ icsImpl = (IconsImpl)descGroup.getIcons();
+ }
+ IconImpl[] icArray = icsImpl.toArray(new IconImpl[icsImpl.size()]);
+ for (int i = 0; i < smallIcon.length; i++)
+ {
+ if (i < icArray.length)
+ icArray[i].setSmallIcon(smallIcon[i]);
+ else
+ {
+ IconImpl icImpl = new IconImpl();
+ icImpl.setLargeIcon(smallIcon[i]);
+ icsImpl.add(icImpl);
+ }
+ }
+ }
+
+ // 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 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, annotation.getClassName());
+ }
+ else
+ throw new ValidateException("More than one @ConnectionDefinitions defined");
+ }
+
+ return md;
+ }
+
+ /**
+ * Attach @ConnectionDefinitions
+ * @param md The metadata
+ * @param cds The connection definitions
+ * @param mcf The managed connection factory
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private ConnectorMetaData attachConnectionDefinitions(ConnectorMetaData md,
+ ConnectionDefinitions cds,
+ String mcf)
+ throws Exception
+ {
+ createConDefs(md);
+
+ if (cds.value() != null)
+ {
+ for (ConnectionDefinition cd : cds.value())
+ {
+ md = attachConnectionDefinition(md, mcf, cd);
+ }
+ }
+
+ 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 ConnectorMetaData processConnectionDefinition(ConnectorMetaData md,
+ AnnotationRepository annotationRepository)
+ throws Exception
+ {
+ Collection<Annotation> values = annotationRepository.getAnnotation(ConnectionDefinition.class);
+ if (values != null)
+ {
+ for (Annotation annotation : values)
+ {
+ md = attachConnectionDefinition(md, annotation);
+ }
+ }
+
+ 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 ConnectorMetaData attachConnectionDefinition(ConnectorMetaData md, Annotation annotation)
+ throws Exception
+ {
+ ConnectionDefinition cd = (ConnectionDefinition)annotation.getAnnotation();
+
+ if (trace)
+ log.trace("Processing: " + annotation);
+
+ createConDefs(md);
+
+ for (ConnectionDefinitionMetaData cdMeta : md.getRa().getOutboundRa().getConDefs())
+ {
+ if (cdMeta.getManagedConnectionFactoryClass().equals(annotation.getClassName()))
+ {
+ //ra.xml define
+ return md;
+ }
+ }
+
+ return attachConnectionDefinition(md, annotation.getClassName(), cd);
+ }
+
+ /**
+ * Attach @ConnectionDefinition
+ * @param md The metadata
+ * @param mcf The managed connection factory
+ * @param cd The connection definition
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private ConnectorMetaData attachConnectionDefinition(ConnectorMetaData md,
+ String mcf,
+ ConnectionDefinition cd)
+ throws Exception
+ {
+ if (trace)
+ log.trace("Processing: " + cd);
+
+ createConDefs(md);
+
+ ConnectionDefinitionMetaData cdMeta = new ConnectionDefinitionMetaData();
+ cdMeta.setManagedConnectionFactoryClass(mcf);
+ cdMeta.setConnectionFactoryInterfaceClass(cd.connectionFactory().getName());
+ cdMeta.setConnectionFactoryImplementationClass(cd.connectionFactoryImpl().getName());
+ cdMeta.setConnectionInterfaceClass(cd.connection().getName());
+ cdMeta.setConnectionImplementationClass(cd.connectionImpl().getName());
+ md.getRa().getOutboundRa().getConDefs().add(cdMeta);
+ 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 ConnectorMetaData processConfigProperty(ConnectorMetaData md,
+ AnnotationRepository annotationRepository)
+ throws Exception
+ {
+ Collection<Annotation> values = annotationRepository.getAnnotation(ConfigProperty.class);
+ if (values != null)
+ {
+ for (Annotation annotation : values)
+ {
+ md = attachConfigProperty(md, annotation);
+ }
+ }
+
+ 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 ConnectorMetaData attachConfigProperty(ConnectorMetaData md, Annotation annotation)
+ throws Exception
+ {
+ ConfigProperty configProperty = (ConfigProperty)annotation.getAnnotation();
+
+ if (trace)
+ log.trace("Processing: " + configProperty);
+
+ // Ignore config-property which has ignore=true
+ if (configProperty.ignore())
+ return md;
+
+ ConfigPropertyMetaData cfgMeta = new ConfigPropertyMetaData();
+ cfgMeta.setName(getConfigPropertyName(annotation));
+ cfgMeta.setValue(configProperty.defaultValue());
+ if (!Object.class.equals(configProperty.type()))
+ {
+ cfgMeta.setType(configProperty.type().getName());
+ }
+ else
+ {
+ cfgMeta.setType(getConfigPropertyType(annotation));
+ }
+ cfgMeta.setIgnore(configProperty.ignore());
+
+ String[] description = configProperty.description();
+ if (description != null)
+ {
+ if (cfgMeta.getDescriptions() == null)
+ {
+ DescriptionsImpl descsImpl = new DescriptionsImpl();
+ cfgMeta.setDescriptions(descsImpl);
+ }
+ for (String desc : description)
+ {
+ DescriptionImpl descImpl = new DescriptionImpl();
+ descImpl.setDescription(desc);
+ ((DescriptionsImpl)cfgMeta.getDescriptions()).add(descImpl);
+ }
+ }
+
+ String attachedClassName = annotation.getClassName();
+ ClassLoader cl = SecurityActions.getThreadContextClassLoader();
+ Class attachedClass = Class.forName(attachedClassName, true, cl);
+
+ if (hasInterface(attachedClass, "javax.resource.spi.ResourceAdapter"))
+ {
+ if (md.getRa() == null)
+ {
+ md.setRa(new ResourceAdapterMetaData());
+ }
+ if (md.getRa().getConfigProperty() == null)
+ {
+ md.getRa().setConfigProperty(new ArrayList<ConfigPropertyMetaData>());
+ }
+ for (ConfigPropertyMetaData cpMeta : md.getRa().getConfigProperty())
+ {
+ if (cpMeta.getName().equals(cfgMeta.getName()))
+ {
+ return md;
+ }
+ }
+ md.getRa().getConfigProperty().add(cfgMeta);
+ }
+ else if (hasInterface(attachedClass, "javax.resource.spi.ManagedConnectionFactory"))
+ {
+ createConDefs(md);
+ for (ConnectionDefinitionMetaData cdMeta : md.getRa().getOutboundRa().getConDefs())
+ {
+ if (attachedClassName.equals(cdMeta.getManagedConnectionFactoryClass()))
+ {
+ if (cdMeta.getConfigProps() == null)
+ {
+ cdMeta.setConfigProps(new ArrayList<ConfigPropertyMetaData>());
+ }
+ for (ConfigPropertyMetaData cpMeta : cdMeta.getConfigProps())
+ {
+ if (cpMeta.getName().equals(cfgMeta.getName()))
+ {
+ return md;
+ }
+ }
+ cdMeta.getConfigProps().add(cfgMeta);
+ }
+ }
+ }
+ else if (hasInterface(attachedClass, "javax.resource.spi.ActivationSpec"))
+ {
+ createMessageListeners(md);
+ for (MessageListenerMetaData mlMeta : md.getRa().getInboundRa().getMessageAdapter().getMessageListeners())
+ {
+ if (attachedClassName.equals(mlMeta.getActivationSpecType().getAsClass()))
+ {
+ if (mlMeta.getActivationSpecType().getConfigProps() == null)
+ {
+ mlMeta.getActivationSpecType().setConfigProps(new ArrayList<ConfigPropertyMetaData>());
+ }
+ for (ConfigPropertyMetaData cpMeta : mlMeta.getActivationSpecType().getConfigProps())
+ {
+ if (cpMeta.getName().equals(cfgMeta.getName()))
+ {
+ return md;
+ }
+ }
+ mlMeta.getActivationSpecType().getConfigProps().add(cfgMeta);
+ }
+ }
+ }
+
+ return md;
+ }
+
+ /**
+ * hasInterface
+ *
+ * @param c
+ * @param targetClassName
+ * @return
+ */
+ private boolean hasInterface(Class c, String targetClassName)
+ {
+ for (Class face : c.getInterfaces())
+ {
+ if (face.getName().equals(targetClassName))
+ {
+ return true;
+ }
+ else
+ {
+ for (Class face2 : face.getInterfaces())
+ {
+ if (face2.getName().equals(targetClassName))
+ {
+ return true;
+ }
+ else if (hasInterface(face2, targetClassName))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ if (null != c.getSuperclass())
+ {
+ return hasInterface(c.getSuperclass(), targetClassName);
+ }
+ return false;
+ }
+
+ /**
+ * Attach @AuthenticationMechanism
+ * @param md The metadata
+ * @param authenticationmechanism The authentication mechanism
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private 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);
+
+ String[] description = authenticationmechanism.description();
+ if (description != null)
+ {
+ if (ammd.getDescriptions() == null)
+ {
+ DescriptionsImpl descsImpl = new DescriptionsImpl();
+ ammd.setDescriptions(descsImpl);
+ }
+ for (String desc : description)
+ {
+ DescriptionImpl descImpl = new DescriptionImpl();
+ descImpl.setDescription(desc);
+ ((DescriptionsImpl)ammd.getDescriptions()).add(descImpl);
+ }
+ }
+
+ 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 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 ConnectorMetaData attachAdministeredObject(ConnectorMetaData md, AdministeredObject a)
+ throws Exception
+ {
+ createAdminObject(md);
+ 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 ConnectorMetaData processActivation(ConnectorMetaData md,
+ AnnotationRepository annotationRepository)
+ throws Exception
+ {
+ Collection<Annotation> values = annotationRepository.getAnnotation(Activation.class);
+ if (values != null)
+ {
+ for (Annotation annotation : values)
+ {
+ md = attachActivation(md, annotation);
+ }
+ }
+
+ return md;
+ }
+
+ /**
+ * Attach @Activation
+ * @param md The metadata
+ * @param activation The activation
+ * @return The updated metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ private ConnectorMetaData attachActivation(ConnectorMetaData md, Annotation annotation)
+ throws Exception
+ {
+ Activation activation = (Activation)annotation.getAnnotation();
+
+ if (trace)
+ log.trace("Processing: " + activation);
+
+ createMessageListeners(md);
+ for (Class asClass : activation.messageListeners())
+ {
+ ActivationspecMetaData asMeta = new ActivationspecMetaData();
+ asMeta.setAsClass(annotation.getClassName());
+ MessageListenerMetaData mlMeta = new MessageListenerMetaData();
+ mlMeta.setActivationSpecType(asMeta);
+ mlMeta.setType(asClass.getName());
+ md.getRa().getInboundRa().getMessageAdapter().getMessageListeners().add(mlMeta);
+ }
+ return md;
+ }
+
+
+ /**
+ * createMessageListeners
+ * @param md
+ * @throws Exception
+ */
+ private void createMessageListeners(ConnectorMetaData md) throws Exception
+ {
+ if (md.getRa() == null)
+ {
+ md.setRa(new ResourceAdapterMetaData());
+ }
+ if (md.getRa().getInboundRa() == null)
+ {
+ md.getRa().setInboundRa(new InboundRaMetaData());
+ }
+ if (md.getRa().getInboundRa().getMessageAdapter() == null)
+ {
+ md.getRa().getInboundRa().setMessageAdapter(new MessageAdapterMetaData());
+ }
+ if (md.getRa().getInboundRa().getMessageAdapter().getMessageListeners() == null)
+ {
+ md.getRa().getInboundRa().getMessageAdapter().setMessageListeners(new ArrayList<MessageListenerMetaData>());
+ }
+ }
+
+ /**
+ * createAdminObject
+ * @param md
+ * @throws Exception
+ */
+ private void createAdminObject(ConnectorMetaData md) throws Exception
+ {
+ if (md.getRa() == null)
+ {
+ md.setRa(new ResourceAdapterMetaData());
+ }
+ if (md.getRa().getAdminObjects() == null)
+ {
+ md.getRa().setAdminObjects(new ArrayList<AdminObjectMetaData>());
+ }
+ }
+
+ /**
+ * createConDefs
+ * @param md
+ * @throws Exception
+ */
+ private void createConDefs(ConnectorMetaData md) throws Exception
+ {
+ if (md.getRa() == null)
+ {
+ md.setRa(new ResourceAdapterMetaData());
+ }
+ if (md.getRa().getOutboundRa() == null)
+ {
+ md.getRa().setOutboundRa(new OutboundRaMetaData());
+ }
+ if (md.getRa().getOutboundRa().getConDefs() == null)
+ {
+ md.getRa().getOutboundRa().setConDefs(new ArrayList<ConnectionDefinitionMetaData>());
+ }
+ }
+
+ /**
+ * Get the config-property-name for an annotation
+ * @param annotation The annotation
+ * @return The name
+ * @exception ClassNotFoundException Thrown if a class cannot be found
+ * @exception NoSuchFieldException Thrown if a field cannot be found
+ * @exception NoSuchMethodException Thrown if a method cannot be found
+ */
+ private String getConfigPropertyName(Annotation annotation)
+ throws ClassNotFoundException, NoSuchFieldException, NoSuchMethodException
+ {
+ if (AnnotationType.FIELD.equals(annotation.getType()))
+ {
+ return annotation.getMemberName();
+ }
+ else if (AnnotationType.METHOD.equals(annotation.getType()))
+ {
+ String name = annotation.getMemberName();
+
+ if (name.startsWith("set"))
+ {
+ name = name.substring(3);
+ }
+ else if (name.startsWith("get"))
+ {
+ name = name.substring(3);
+ }
+ else if (name.startsWith("is"))
+ {
+ name = name.substring(2);
+ }
+
+ if (name.length() > 1)
+ {
+ return Character.toLowerCase(name.charAt(0)) + name.substring(1);
+ }
+ else
+ {
+ return Character.toString(Character.toLowerCase(name.charAt(0)));
+ }
+ }
+
+ throw new IllegalArgumentException("Unknown annotation: " + annotation);
+ }
+
+ /**
+ * Get the config-property-type for an annotation
+ * @param annotation The annotation
+ * @return The fully qualified classname
+ * @exception ClassNotFoundException Thrown if a class cannot be found
+ */
+ @SuppressWarnings("unchecked")
+ private String getConfigPropertyType(Annotation annotation)
+ throws ClassNotFoundException
+ {
+ if (AnnotationType.FIELD.equals(annotation.getType()))
+ {
+ ClassLoader cl = SecurityActions.getThreadContextClassLoader();
+ Class clz = Class.forName(annotation.getClassName(), true, cl);
+
+ while (!Object.class.equals(clz))
+ {
+ try
+ {
+ Field field = clz.getDeclaredField(annotation.getMemberName());
+
+ return field.getType().getName();
+ }
+ catch (NoSuchFieldException nsfe)
+ {
+ clz = clz.getSuperclass();
+ }
+ }
+ }
+ else if (AnnotationType.METHOD.equals(annotation.getType()))
+ {
+ ClassLoader cl = SecurityActions.getThreadContextClassLoader();
+ Class clz = Class.forName(annotation.getClassName(), true, cl);
+
+ Class[] parameters = null;
+
+ if (annotation.getParameterTypes() != null)
+ {
+ parameters = new Class[annotation.getParameterTypes().length];
+
+ for (int i = 0; i < annotation.getParameterTypes().length; i++)
+ {
+ String parameter = annotation.getParameterTypes()[i];
+ parameters[i] = Class.forName(parameter, true, cl);
+ }
+ }
+
+ while (!Object.class.equals(clz))
+ {
+ try
+ {
+ Method method = clz.getDeclaredMethod(annotation.getMemberName(), parameters);
+
+ if (void.class.equals(method.getReturnType()))
+ {
+ if (parameters != null && parameters.length > 0)
+ {
+ return parameters[0].getName();
+ }
+ }
+ else
+ {
+ return method.getReturnType().getName();
+ }
+ }
+ catch (NoSuchMethodException nsme)
+ {
+ clz = clz.getSuperclass();
+ }
+ }
+ }
+
+ throw new IllegalArgumentException("Unknown annotation: " + annotation);
+ }
+}
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/Metadata.java (from rev 101443, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/Metadata.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/Metadata.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/Metadata.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,366 @@
+/*
+ * 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.common;
+
+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.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.ConnectionDefinitionMetaData;
+import org.jboss.metadata.rar.spec.ConnectorMetaData;
+import org.jboss.metadata.rar.spec.InboundRaMetaData;
+import org.jboss.metadata.rar.spec.JCA10DTDMetaData;
+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.metadata.rar.spec.MessageListenerMetaData;
+import org.jboss.metadata.rar.spec.OutboundRaMetaData;
+import org.jboss.metadata.rar.spec.RA10MetaData;
+
+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
+ */
+ public Metadata()
+ {
+ }
+
+ /**
+ * Get the JCA standard metadata
+ * @param root The root of the deployment
+ * @return The metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ public 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_1_0.dtd", JCA10DTDMetaData.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 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 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;
+ }
+
+ /**
+ * Validate specification metadata
+ * @param cmd The specification metadata
+ * @return The merged metadata
+ * @exception Exception Thrown if an error occurs
+ */
+ public ConnectorMetaData validate(ConnectorMetaData cmd) throws Exception
+ {
+ if (cmd.is10())
+ {
+ RA10MetaData ra10 = ((JCA10DTDMetaData)cmd).getRa10();
+ if (ra10 == null
+ || ra10.getManagedConnectionFactoryClass() == null
+ || ra10.getManagedConnectionFactoryClass().equals(""))
+ {
+ throw new ValidateException("ManagedConnectionFactoryClass should be defined");
+ }
+ return cmd;
+ }
+ //make sure all need metadata parsered and processed after annotation handle
+ if (cmd.getRa() == null)
+ throw new ValidateException("ResourceAdapter metadata should be defined");
+
+ //make sure ra metadata contains inbound or outbound at least
+ boolean inboundOrOutbound = false;
+ if (validateOutbound(cmd.getRa().getOutboundRa()))
+ inboundOrOutbound = true;
+ if (validateInbound(cmd.getRa().getInboundRa()) && cmd.getRa().getRaClass() != null)
+ inboundOrOutbound = true;
+ if (!inboundOrOutbound)
+ throw new ValidateException("ResourceAdapter metadata should contains inbound or outbound at least");
+ return cmd;
+ }
+
+ /**
+ * Validate outbound metadata
+ * @param omd The specification metadata
+ * @return validate
+ * @exception Exception Thrown if an error occurs
+ */
+ private boolean validateOutbound(OutboundRaMetaData omd) throws Exception
+ {
+ if (omd == null)
+ return false;
+ if (omd.getConDefs() == null || omd.getConDefs().size() == 0)
+ return false;
+ ConnectionDefinitionMetaData cdm = omd.getConDefs().get(0);
+ if (cdm.getManagedConnectionFactoryClass() == null ||
+ cdm.getConnectionFactoryInterfaceClass() == null ||
+ cdm.getConnectionFactoryImplementationClass() == null ||
+ cdm.getConnectionInterfaceClass() == null ||
+ cdm.getConnectionImplementationClass() == null)
+ return false;
+
+ return true;
+ }
+
+ /**
+ * Validate inbound metadata
+ * @param cmd The specification metadata
+ * @return validate
+ * @exception Exception Thrown if an error occurs
+ */
+ private boolean validateInbound(InboundRaMetaData imd) throws Exception
+ {
+ if (imd == null)
+ return false;
+ if (imd.getMessageAdapter() == null ||
+ imd.getMessageAdapter().getMessageListeners() == null ||
+ imd.getMessageAdapter().getMessageListeners().size() == 0)
+ return false;
+ MessageListenerMetaData mlmd = imd.getMessageAdapter().getMessageListeners().get(0);
+ if (mlmd.getType() == null ||
+ mlmd.getActivationSpecType() == null ||
+ mlmd.getActivationSpecType().getAsClass() == null)
+ return false;
+ return true;
+ }
+}
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/SecurityActions.java (from rev 101443, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/SecurityActions.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/SecurityActions.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/SecurityActions.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,106 @@
+/*
+ * 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.common;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * 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 AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader 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 a system property
+ * @param name The property name
+ * @return The property value
+ */
+ static String getSystemProperty(final String name)
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<String>()
+ {
+ public String run()
+ {
+ return System.getProperty(name);
+ }
+ });
+ }
+
+ /**
+ * 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 AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>()
+ {
+ public URLClassLoader run()
+ {
+ return new URLClassLoader(urls, parent);
+ }
+ });
+ }
+}
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/ValidateException.java (from rev 101443, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/ValidateException.java)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/ValidateException.java (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/ValidateException.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,52 @@
+/*
+ * 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.common;
+
+/**
+ * The validate exception
+ * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
+ */
+public class ValidateException extends Exception
+{
+ /** Serial version UID */
+ static final long serialVersionUID = 3820032266224196804L;
+
+ /**
+ * Constructs a new exception with the specified detail message.
+ * @param message The message
+ */
+ public ValidateException(String message)
+ {
+ super(message);
+ }
+
+ /**
+ * Constructs a new exception with the specified detail message and cause.
+ * @param message The message
+ * @param cause The cause
+ */
+ public ValidateException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Copied: projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/package.html (from rev 101443, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/package.html)
===================================================================
--- projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/package.html (rev 0)
+++ projects/jboss-jca/trunk/common/src/main/java/org/jboss/jca/common/package.html 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,3 @@
+<body>
+This package contains the common classes
+</body>
Modified: projects/jboss-jca/trunk/deployers/build.xml
===================================================================
--- projects/jboss-jca/trunk/deployers/build.xml 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/deployers/build.xml 2010-02-25 07:18:02 UTC (rev 101449)
@@ -101,22 +101,6 @@
manifest="src/main/resources/fungal-ra-manifest.mf"
basedir="${build.deployers.dir}/jars/fungal"/>
- <!-- Validator -->
- <mkdir dir="${build.deployers.dir}/jars/validator" />
-
- <copy todir="${build.deployers.dir}/jars/validator">
- <fileset dir="${build.deployers.dir}/impl"
- includes="**/common/**"/>
- </copy>
-
- <copy todir="${build.deployers.dir}/jars/validator">
- <fileset dir="src/main/resources/"
- includes="**/*.properties"/>
- </copy>
-
- <jar destfile="${target.dir}/jboss-jca-validator.jar"
- manifest="src/main/resources/validator-manifest.mf"
- basedir="${build.deployers.dir}/jars/validator"/>
</target>
Deleted: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/Annotations.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/Annotations.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/Annotations.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,1121 +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.deployers.common;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-
-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.javaee.spec.DescriptionGroupMetaData;
-import org.jboss.metadata.javaee.spec.DescriptionImpl;
-import org.jboss.metadata.javaee.spec.DescriptionsImpl;
-import org.jboss.metadata.javaee.spec.DisplayNameImpl;
-import org.jboss.metadata.javaee.spec.DisplayNamesImpl;
-import org.jboss.metadata.javaee.spec.IconImpl;
-import org.jboss.metadata.javaee.spec.IconsImpl;
-
-import org.jboss.metadata.rar.spec.ActivationspecMetaData;
-import org.jboss.metadata.rar.spec.AdminObjectMetaData;
-import org.jboss.metadata.rar.spec.AuthenticationMechanismMetaData;
-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.InboundRaMetaData;
-import org.jboss.metadata.rar.spec.JCA16Base;
-import org.jboss.metadata.rar.spec.JCA16MetaData;
-import org.jboss.metadata.rar.spec.LicenseMetaData;
-import org.jboss.metadata.rar.spec.MessageAdapterMetaData;
-import org.jboss.metadata.rar.spec.MessageListenerMetaData;
-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;
-import org.jboss.papaki.AnnotationScanner;
-import org.jboss.papaki.AnnotationScannerFactory;
-import org.jboss.papaki.AnnotationType;
-
-/**
- * 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
- */
- public Annotations()
- {
- }
-
- /**
- * Scan for annotations in the URLs specified
- * @param cmd The resource adapter metadata
- * @param urls The URLs to be scanned
- * @param cl The referenced classloader
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- public ConnectorMetaData scan(ConnectorMetaData cmd, URL[] urls, ClassLoader cl) throws Exception
- {
- // Process annotations
- if (cmd == null || cmd.is16())
- {
- AnnotationScanner annotationScanner =
- AnnotationScannerFactory.getStrategy(AnnotationScannerFactory.JAVASSIST_INPUT_STREAM);
- annotationScanner.configure().constructorLevel(false).parameterLevel(false);
- AnnotationRepository annotationRepository = annotationScanner.scan(urls, cl);
-
- boolean isMetadataComplete = false;
- if (cmd != null && cmd instanceof JCA16Base)
- {
- JCA16Base jmd = (JCA16Base)cmd;
- isMetadataComplete = jmd.isMetadataComplete();
- }
-
- if (cmd == null || !isMetadataComplete)
- {
- cmd = process(cmd, annotationRepository);
- }
- }
- return cmd;
- }
- /**
- * Process annotations
- * @param md The metadata
- * @param annotationRepository The annotation repository
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- public ConnectorMetaData process(ConnectorMetaData md, AnnotationRepository annotationRepository)
- throws Exception
- {
- if (annotationRepository == null)
- throw new ValidateException("AnnotationRepository reference is null");
- /* 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);
-
- // @Activation
- md = processActivation(md, annotationRepository);
-
- // @AuthenticationMechanism
- //md = processAuthenticationMechanism(md, annotationRepository);
-
- // @AdministeredObject
- md = processAdministeredObject(md, annotationRepository);
-
- // @ConfigProperty handle at last
- md = processConfigProperty(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 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();
- String raClass = annotation.getClassName();
- Connector c = (Connector)annotation.getAnnotation();
-
- if (trace)
- log.trace("Processing: " + c + " for " + raClass);
-
- md = attachConnector(md, raClass, c);
- }
- else if (values.size() == 0)
- {
- // JBJCA-240
- if (md.getRa().getRaClass() == null || md.getRa().getRaClass().equals(""))
- {
- log.fatal("No @Connector was found and no definition in the ra.xml metadata either");
- throw new ValidateException("No @Connector defined");
- }
- }
- else
- {
- // JBJCA-240
- if (md.getRa().getRaClass() == null || md.getRa().getRaClass().equals(""))
- {
- log.fatal("More than one @Connector was found but the correct one " +
- "wasn't defined in the ra.xml metadata");
- throw new ValidateException("More than one @Connector defined");
- }
- }
- }
-
- return md;
- }
-
- /**
- * Attach @Connector
- * @param md The metadata
- * @param raClass The class name for the resource adapter
- * @param c The connector
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private ConnectorMetaData attachConnector(ConnectorMetaData md, String raClass, Connector c)
- throws Exception
- {
- // Class definition
- if (md.getRa() == null)
- md.setRa(new ResourceAdapterMetaData());
-
- md.getRa().setRaClass(raClass);
-
- // AuthenticationMechanism
- AuthenticationMechanism[] authMechanisms = c.authMechanisms();
- if (authMechanisms != null)
- {
- for (AuthenticationMechanism authMechanism : authMechanisms)
- {
- attachAuthenticationMechanism(md, authMechanism);
- }
- }
-
- DescriptionGroupMetaData descGroup = new DescriptionGroupMetaData();
- md.setDescriptionGroup(descGroup);
-
- // Description
- String[] description = c.description();
- if (description != null)
- {
- if (descGroup.getDescriptions() == null)
- {
- DescriptionsImpl descsImpl = new DescriptionsImpl();
- descGroup.setDescriptions(descsImpl);
- }
- for (String desc : description)
- {
- DescriptionImpl descImpl = new DescriptionImpl();
- descImpl.setDescription(desc);
- ((DescriptionsImpl)descGroup.getDescriptions()).add(descImpl);
- }
- }
-
- // Display name
- String[] displayName = c.displayName();
- if (displayName != null)
- {
- if (descGroup.getDisplayNames() == null)
- {
- DisplayNamesImpl dnsImpl = new DisplayNamesImpl();
- descGroup.setDisplayNames(dnsImpl);
- }
- for (String dn : displayName)
- {
- DisplayNameImpl dnImpl = new DisplayNameImpl();
- dnImpl.setDisplayName(dn);
- ((DisplayNamesImpl)descGroup.getDisplayNames()).add(dnImpl);
- }
- }
-
- // 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)
- {
- if (descGroup.getIcons() == null)
- {
- IconsImpl icsImpl = new IconsImpl();
- descGroup.setIcons(icsImpl);
- }
- for (String large : largeIcon)
- {
- IconImpl icImpl = new IconImpl();
- icImpl.setLargeIcon(large);
- ((IconsImpl)descGroup.getIcons()).add(icImpl);
- }
- }
-
- // License description
- String[] licenseDescription = c.licenseDescription();
- if (licenseDescription != null)
- {
- if (md.getLicense() == null)
- md.setLicense(new LicenseMetaData());
-
- if (md.getLicense().getDescriptions() == null)
- {
- DescriptionsImpl descsImpl = new DescriptionsImpl();
- md.getLicense().setDescriptions(descsImpl);
- }
- for (String desc : licenseDescription)
- {
- DescriptionImpl descImpl = new DescriptionImpl();
- descImpl.setDescription(desc);
- ((DescriptionsImpl)md.getLicense().getDescriptions()).add(descImpl);
- }
- }
-
- // 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 JCA16Base)
- {
- JCA16Base jmd = (JCA16Base)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)
- {
- IconsImpl icsImpl;
- if (descGroup.getIcons() == null)
- {
- icsImpl = new IconsImpl();
- descGroup.setIcons(icsImpl);
- }
- else
- {
- icsImpl = (IconsImpl)descGroup.getIcons();
- }
- IconImpl[] icArray = icsImpl.toArray(new IconImpl[icsImpl.size()]);
- for (int i = 0; i < smallIcon.length; i++)
- {
- if (i < icArray.length)
- icArray[i].setSmallIcon(smallIcon[i]);
- else
- {
- IconImpl icImpl = new IconImpl();
- icImpl.setLargeIcon(smallIcon[i]);
- icsImpl.add(icImpl);
- }
- }
- }
-
- // 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 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, annotation.getClassName());
- }
- else
- throw new ValidateException("More than one @ConnectionDefinitions defined");
- }
-
- return md;
- }
-
- /**
- * Attach @ConnectionDefinitions
- * @param md The metadata
- * @param cds The connection definitions
- * @param mcf The managed connection factory
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private ConnectorMetaData attachConnectionDefinitions(ConnectorMetaData md,
- ConnectionDefinitions cds,
- String mcf)
- throws Exception
- {
- createConDefs(md);
-
- if (cds.value() != null)
- {
- for (ConnectionDefinition cd : cds.value())
- {
- md = attachConnectionDefinition(md, mcf, cd);
- }
- }
-
- 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 ConnectorMetaData processConnectionDefinition(ConnectorMetaData md,
- AnnotationRepository annotationRepository)
- throws Exception
- {
- Collection<Annotation> values = annotationRepository.getAnnotation(ConnectionDefinition.class);
- if (values != null)
- {
- for (Annotation annotation : values)
- {
- md = attachConnectionDefinition(md, annotation);
- }
- }
-
- 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 ConnectorMetaData attachConnectionDefinition(ConnectorMetaData md, Annotation annotation)
- throws Exception
- {
- ConnectionDefinition cd = (ConnectionDefinition)annotation.getAnnotation();
-
- if (trace)
- log.trace("Processing: " + annotation);
-
- createConDefs(md);
-
- for (ConnectionDefinitionMetaData cdMeta : md.getRa().getOutboundRa().getConDefs())
- {
- if (cdMeta.getManagedConnectionFactoryClass().equals(annotation.getClassName()))
- {
- //ra.xml define
- return md;
- }
- }
-
- return attachConnectionDefinition(md, annotation.getClassName(), cd);
- }
-
- /**
- * Attach @ConnectionDefinition
- * @param md The metadata
- * @param mcf The managed connection factory
- * @param cd The connection definition
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private ConnectorMetaData attachConnectionDefinition(ConnectorMetaData md,
- String mcf,
- ConnectionDefinition cd)
- throws Exception
- {
- if (trace)
- log.trace("Processing: " + cd);
-
- createConDefs(md);
-
- ConnectionDefinitionMetaData cdMeta = new ConnectionDefinitionMetaData();
- cdMeta.setManagedConnectionFactoryClass(mcf);
- cdMeta.setConnectionFactoryInterfaceClass(cd.connectionFactory().getName());
- cdMeta.setConnectionFactoryImplementationClass(cd.connectionFactoryImpl().getName());
- cdMeta.setConnectionInterfaceClass(cd.connection().getName());
- cdMeta.setConnectionImplementationClass(cd.connectionImpl().getName());
- md.getRa().getOutboundRa().getConDefs().add(cdMeta);
- 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 ConnectorMetaData processConfigProperty(ConnectorMetaData md,
- AnnotationRepository annotationRepository)
- throws Exception
- {
- Collection<Annotation> values = annotationRepository.getAnnotation(ConfigProperty.class);
- if (values != null)
- {
- for (Annotation annotation : values)
- {
- md = attachConfigProperty(md, annotation);
- }
- }
-
- 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 ConnectorMetaData attachConfigProperty(ConnectorMetaData md, Annotation annotation)
- throws Exception
- {
- ConfigProperty configProperty = (ConfigProperty)annotation.getAnnotation();
-
- if (trace)
- log.trace("Processing: " + configProperty);
-
- // Ignore config-property which has ignore=true
- if (configProperty.ignore())
- return md;
-
- ConfigPropertyMetaData cfgMeta = new ConfigPropertyMetaData();
- cfgMeta.setName(getConfigPropertyName(annotation));
- cfgMeta.setValue(configProperty.defaultValue());
- if (!Object.class.equals(configProperty.type()))
- {
- cfgMeta.setType(configProperty.type().getName());
- }
- else
- {
- cfgMeta.setType(getConfigPropertyType(annotation));
- }
- cfgMeta.setIgnore(configProperty.ignore());
-
- String[] description = configProperty.description();
- if (description != null)
- {
- if (cfgMeta.getDescriptions() == null)
- {
- DescriptionsImpl descsImpl = new DescriptionsImpl();
- cfgMeta.setDescriptions(descsImpl);
- }
- for (String desc : description)
- {
- DescriptionImpl descImpl = new DescriptionImpl();
- descImpl.setDescription(desc);
- ((DescriptionsImpl)cfgMeta.getDescriptions()).add(descImpl);
- }
- }
-
- String attachedClassName = annotation.getClassName();
- ClassLoader cl = SecurityActions.getThreadContextClassLoader();
- Class attachedClass = Class.forName(attachedClassName, true, cl);
-
- if (hasInterface(attachedClass, "javax.resource.spi.ResourceAdapter"))
- {
- if (md.getRa() == null)
- {
- md.setRa(new ResourceAdapterMetaData());
- }
- if (md.getRa().getConfigProperty() == null)
- {
- md.getRa().setConfigProperty(new ArrayList<ConfigPropertyMetaData>());
- }
- for (ConfigPropertyMetaData cpMeta : md.getRa().getConfigProperty())
- {
- if (cpMeta.getName().equals(cfgMeta.getName()))
- {
- return md;
- }
- }
- md.getRa().getConfigProperty().add(cfgMeta);
- }
- else if (hasInterface(attachedClass, "javax.resource.spi.ManagedConnectionFactory"))
- {
- createConDefs(md);
- for (ConnectionDefinitionMetaData cdMeta : md.getRa().getOutboundRa().getConDefs())
- {
- if (attachedClassName.equals(cdMeta.getManagedConnectionFactoryClass()))
- {
- if (cdMeta.getConfigProps() == null)
- {
- cdMeta.setConfigProps(new ArrayList<ConfigPropertyMetaData>());
- }
- for (ConfigPropertyMetaData cpMeta : cdMeta.getConfigProps())
- {
- if (cpMeta.getName().equals(cfgMeta.getName()))
- {
- return md;
- }
- }
- cdMeta.getConfigProps().add(cfgMeta);
- }
- }
- }
- else if (hasInterface(attachedClass, "javax.resource.spi.ActivationSpec"))
- {
- createMessageListeners(md);
- for (MessageListenerMetaData mlMeta : md.getRa().getInboundRa().getMessageAdapter().getMessageListeners())
- {
- if (attachedClassName.equals(mlMeta.getActivationSpecType().getAsClass()))
- {
- if (mlMeta.getActivationSpecType().getConfigProps() == null)
- {
- mlMeta.getActivationSpecType().setConfigProps(new ArrayList<ConfigPropertyMetaData>());
- }
- for (ConfigPropertyMetaData cpMeta : mlMeta.getActivationSpecType().getConfigProps())
- {
- if (cpMeta.getName().equals(cfgMeta.getName()))
- {
- return md;
- }
- }
- mlMeta.getActivationSpecType().getConfigProps().add(cfgMeta);
- }
- }
- }
-
- return md;
- }
-
- /**
- * hasInterface
- *
- * @param c
- * @param targetClassName
- * @return
- */
- private boolean hasInterface(Class c, String targetClassName)
- {
- for (Class face : c.getInterfaces())
- {
- if (face.getName().equals(targetClassName))
- {
- return true;
- }
- else
- {
- for (Class face2 : face.getInterfaces())
- {
- if (face2.getName().equals(targetClassName))
- {
- return true;
- }
- else if (hasInterface(face2, targetClassName))
- {
- return true;
- }
- }
- }
- }
- if (null != c.getSuperclass())
- {
- return hasInterface(c.getSuperclass(), targetClassName);
- }
- return false;
- }
-
- /**
- * Attach @AuthenticationMechanism
- * @param md The metadata
- * @param authenticationmechanism The authentication mechanism
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private 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);
-
- String[] description = authenticationmechanism.description();
- if (description != null)
- {
- if (ammd.getDescriptions() == null)
- {
- DescriptionsImpl descsImpl = new DescriptionsImpl();
- ammd.setDescriptions(descsImpl);
- }
- for (String desc : description)
- {
- DescriptionImpl descImpl = new DescriptionImpl();
- descImpl.setDescription(desc);
- ((DescriptionsImpl)ammd.getDescriptions()).add(descImpl);
- }
- }
-
- 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 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 ConnectorMetaData attachAdministeredObject(ConnectorMetaData md, AdministeredObject a)
- throws Exception
- {
- createAdminObject(md);
- 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 ConnectorMetaData processActivation(ConnectorMetaData md,
- AnnotationRepository annotationRepository)
- throws Exception
- {
- Collection<Annotation> values = annotationRepository.getAnnotation(Activation.class);
- if (values != null)
- {
- for (Annotation annotation : values)
- {
- md = attachActivation(md, annotation);
- }
- }
-
- return md;
- }
-
- /**
- * Attach @Activation
- * @param md The metadata
- * @param activation The activation
- * @return The updated metadata
- * @exception Exception Thrown if an error occurs
- */
- private ConnectorMetaData attachActivation(ConnectorMetaData md, Annotation annotation)
- throws Exception
- {
- Activation activation = (Activation)annotation.getAnnotation();
-
- if (trace)
- log.trace("Processing: " + activation);
-
- createMessageListeners(md);
- for (Class asClass : activation.messageListeners())
- {
- ActivationspecMetaData asMeta = new ActivationspecMetaData();
- asMeta.setAsClass(annotation.getClassName());
- MessageListenerMetaData mlMeta = new MessageListenerMetaData();
- mlMeta.setActivationSpecType(asMeta);
- mlMeta.setType(asClass.getName());
- md.getRa().getInboundRa().getMessageAdapter().getMessageListeners().add(mlMeta);
- }
- return md;
- }
-
-
- /**
- * createMessageListeners
- * @param md
- * @throws Exception
- */
- private void createMessageListeners(ConnectorMetaData md) throws Exception
- {
- if (md.getRa() == null)
- {
- md.setRa(new ResourceAdapterMetaData());
- }
- if (md.getRa().getInboundRa() == null)
- {
- md.getRa().setInboundRa(new InboundRaMetaData());
- }
- if (md.getRa().getInboundRa().getMessageAdapter() == null)
- {
- md.getRa().getInboundRa().setMessageAdapter(new MessageAdapterMetaData());
- }
- if (md.getRa().getInboundRa().getMessageAdapter().getMessageListeners() == null)
- {
- md.getRa().getInboundRa().getMessageAdapter().setMessageListeners(new ArrayList<MessageListenerMetaData>());
- }
- }
-
- /**
- * createAdminObject
- * @param md
- * @throws Exception
- */
- private void createAdminObject(ConnectorMetaData md) throws Exception
- {
- if (md.getRa() == null)
- {
- md.setRa(new ResourceAdapterMetaData());
- }
- if (md.getRa().getAdminObjects() == null)
- {
- md.getRa().setAdminObjects(new ArrayList<AdminObjectMetaData>());
- }
- }
-
- /**
- * createConDefs
- * @param md
- * @throws Exception
- */
- private void createConDefs(ConnectorMetaData md) throws Exception
- {
- if (md.getRa() == null)
- {
- md.setRa(new ResourceAdapterMetaData());
- }
- if (md.getRa().getOutboundRa() == null)
- {
- md.getRa().setOutboundRa(new OutboundRaMetaData());
- }
- if (md.getRa().getOutboundRa().getConDefs() == null)
- {
- md.getRa().getOutboundRa().setConDefs(new ArrayList<ConnectionDefinitionMetaData>());
- }
- }
-
- /**
- * Get the config-property-name for an annotation
- * @param annotation The annotation
- * @return The name
- * @exception ClassNotFoundException Thrown if a class cannot be found
- * @exception NoSuchFieldException Thrown if a field cannot be found
- * @exception NoSuchMethodException Thrown if a method cannot be found
- */
- private String getConfigPropertyName(Annotation annotation)
- throws ClassNotFoundException, NoSuchFieldException, NoSuchMethodException
- {
- if (AnnotationType.FIELD.equals(annotation.getType()))
- {
- return annotation.getMemberName();
- }
- else if (AnnotationType.METHOD.equals(annotation.getType()))
- {
- String name = annotation.getMemberName();
-
- if (name.startsWith("set"))
- {
- name = name.substring(3);
- }
- else if (name.startsWith("get"))
- {
- name = name.substring(3);
- }
- else if (name.startsWith("is"))
- {
- name = name.substring(2);
- }
-
- if (name.length() > 1)
- {
- return Character.toLowerCase(name.charAt(0)) + name.substring(1);
- }
- else
- {
- return Character.toString(Character.toLowerCase(name.charAt(0)));
- }
- }
-
- throw new IllegalArgumentException("Unknown annotation: " + annotation);
- }
-
- /**
- * Get the config-property-type for an annotation
- * @param annotation The annotation
- * @return The fully qualified classname
- * @exception ClassNotFoundException Thrown if a class cannot be found
- */
- @SuppressWarnings("unchecked")
- private String getConfigPropertyType(Annotation annotation)
- throws ClassNotFoundException
- {
- if (AnnotationType.FIELD.equals(annotation.getType()))
- {
- ClassLoader cl = SecurityActions.getThreadContextClassLoader();
- Class clz = Class.forName(annotation.getClassName(), true, cl);
-
- while (!Object.class.equals(clz))
- {
- try
- {
- Field field = clz.getDeclaredField(annotation.getMemberName());
-
- return field.getType().getName();
- }
- catch (NoSuchFieldException nsfe)
- {
- clz = clz.getSuperclass();
- }
- }
- }
- else if (AnnotationType.METHOD.equals(annotation.getType()))
- {
- ClassLoader cl = SecurityActions.getThreadContextClassLoader();
- Class clz = Class.forName(annotation.getClassName(), true, cl);
-
- Class[] parameters = null;
-
- if (annotation.getParameterTypes() != null)
- {
- parameters = new Class[annotation.getParameterTypes().length];
-
- for (int i = 0; i < annotation.getParameterTypes().length; i++)
- {
- String parameter = annotation.getParameterTypes()[i];
- parameters[i] = Class.forName(parameter, true, cl);
- }
- }
-
- while (!Object.class.equals(clz))
- {
- try
- {
- Method method = clz.getDeclaredMethod(annotation.getMemberName(), parameters);
-
- if (void.class.equals(method.getReturnType()))
- {
- if (parameters != null && parameters.length > 0)
- {
- return parameters[0].getName();
- }
- }
- else
- {
- return method.getReturnType().getName();
- }
- }
- catch (NoSuchMethodException nsme)
- {
- clz = clz.getSuperclass();
- }
- }
- }
-
- throw new IllegalArgumentException("Unknown annotation: " + annotation);
- }
-}
Deleted: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/Metadata.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/Metadata.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/Metadata.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,366 +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.deployers.common;
-
-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.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.ConnectionDefinitionMetaData;
-import org.jboss.metadata.rar.spec.ConnectorMetaData;
-import org.jboss.metadata.rar.spec.InboundRaMetaData;
-import org.jboss.metadata.rar.spec.JCA10DTDMetaData;
-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.metadata.rar.spec.MessageListenerMetaData;
-import org.jboss.metadata.rar.spec.OutboundRaMetaData;
-import org.jboss.metadata.rar.spec.RA10MetaData;
-
-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
- */
- public Metadata()
- {
- }
-
- /**
- * Get the JCA standard metadata
- * @param root The root of the deployment
- * @return The metadata
- * @exception Exception Thrown if an error occurs
- */
- public 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_1_0.dtd", JCA10DTDMetaData.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 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 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;
- }
-
- /**
- * Validate specification metadata
- * @param cmd The specification metadata
- * @return The merged metadata
- * @exception Exception Thrown if an error occurs
- */
- public ConnectorMetaData validate(ConnectorMetaData cmd) throws Exception
- {
- if (cmd.is10())
- {
- RA10MetaData ra10 = ((JCA10DTDMetaData)cmd).getRa10();
- if (ra10 == null
- || ra10.getManagedConnectionFactoryClass() == null
- || ra10.getManagedConnectionFactoryClass().equals(""))
- {
- throw new ValidateException("ManagedConnectionFactoryClass should be defined");
- }
- return cmd;
- }
- //make sure all need metadata parsered and processed after annotation handle
- if (cmd.getRa() == null)
- throw new ValidateException("ResourceAdapter metadata should be defined");
-
- //make sure ra metadata contains inbound or outbound at least
- boolean inboundOrOutbound = false;
- if (validateOutbound(cmd.getRa().getOutboundRa()))
- inboundOrOutbound = true;
- if (validateInbound(cmd.getRa().getInboundRa()) && cmd.getRa().getRaClass() != null)
- inboundOrOutbound = true;
- if (!inboundOrOutbound)
- throw new ValidateException("ResourceAdapter metadata should contains inbound or outbound at least");
- return cmd;
- }
-
- /**
- * Validate outbound metadata
- * @param omd The specification metadata
- * @return validate
- * @exception Exception Thrown if an error occurs
- */
- private boolean validateOutbound(OutboundRaMetaData omd) throws Exception
- {
- if (omd == null)
- return false;
- if (omd.getConDefs() == null || omd.getConDefs().size() == 0)
- return false;
- ConnectionDefinitionMetaData cdm = omd.getConDefs().get(0);
- if (cdm.getManagedConnectionFactoryClass() == null ||
- cdm.getConnectionFactoryInterfaceClass() == null ||
- cdm.getConnectionFactoryImplementationClass() == null ||
- cdm.getConnectionInterfaceClass() == null ||
- cdm.getConnectionImplementationClass() == null)
- return false;
-
- return true;
- }
-
- /**
- * Validate inbound metadata
- * @param cmd The specification metadata
- * @return validate
- * @exception Exception Thrown if an error occurs
- */
- private boolean validateInbound(InboundRaMetaData imd) throws Exception
- {
- if (imd == null)
- return false;
- if (imd.getMessageAdapter() == null ||
- imd.getMessageAdapter().getMessageListeners() == null ||
- imd.getMessageAdapter().getMessageListeners().size() == 0)
- return false;
- MessageListenerMetaData mlmd = imd.getMessageAdapter().getMessageListeners().get(0);
- if (mlmd.getType() == null ||
- mlmd.getActivationSpecType() == null ||
- mlmd.getActivationSpecType().getAsClass() == null)
- return false;
- return true;
- }
-}
Deleted: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/SecurityActions.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/SecurityActions.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/SecurityActions.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,106 +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.deployers.common;
-
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * 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 AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
- {
- public ClassLoader 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 a system property
- * @param name The property name
- * @return The property value
- */
- static String getSystemProperty(final String name)
- {
- return AccessController.doPrivileged(new PrivilegedAction<String>()
- {
- public String run()
- {
- return System.getProperty(name);
- }
- });
- }
-
- /**
- * 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 AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>()
- {
- public URLClassLoader run()
- {
- return new URLClassLoader(urls, parent);
- }
- });
- }
-}
Deleted: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/ValidateException.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/ValidateException.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/ValidateException.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,52 +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.deployers.common;
-
-/**
- * The validate exception
- * @author <a href="mailto:jesper.pedersen at jboss.org">Jesper Pedersen</a>
- */
-public class ValidateException extends Exception
-{
- /** Serial version UID */
- static final long serialVersionUID = 3820032266224196804L;
-
- /**
- * Constructs a new exception with the specified detail message.
- * @param message The message
- */
- public ValidateException(String message)
- {
- super(message);
- }
-
- /**
- * Constructs a new exception with the specified detail message and cause.
- * @param message The message
- * @param cause The cause
- */
- public ValidateException(String message, Throwable cause)
- {
- super(message, cause);
- }
-}
Modified: projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/fungal/RADeployer.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -22,20 +22,14 @@
package org.jboss.jca.deployers.fungal;
+import org.jboss.jca.common.Annotations;
+import org.jboss.jca.common.Metadata;
import org.jboss.jca.common.api.ConnectionFactoryBuilder;
import org.jboss.jca.common.util.LocalConnectionFactoryBuilder;
import org.jboss.jca.core.api.CloneableBootstrapContext;
import org.jboss.jca.core.connectionmanager.notx.NoTxConnectionManager;
import org.jboss.jca.core.connectionmanager.pool.PoolParams;
import org.jboss.jca.core.connectionmanager.pool.strategy.OnePool;
-import org.jboss.jca.deployers.common.Annotations;
-import org.jboss.jca.deployers.common.Metadata;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.FailureHelper;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.ValidateObject;
-import org.jboss.jca.deployers.common.validator.Validator;
import org.jboss.jca.fungal.deployers.CloneableDeployer;
import org.jboss.jca.fungal.deployers.DeployException;
import org.jboss.jca.fungal.deployers.Deployer;
@@ -43,6 +37,12 @@
import org.jboss.jca.fungal.util.FileUtil;
import org.jboss.jca.fungal.util.Injection;
import org.jboss.jca.fungal.util.JarFilter;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.FailureHelper;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.ValidateObject;
+import org.jboss.jca.validator.Validator;
import java.io.BufferedWriter;
import java.io.File;
Deleted: projects/jboss-jca/trunk/deployers/src/main/resources/validator-manifest.mf
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/resources/validator-manifest.mf 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/deployers/src/main/resources/validator-manifest.mf 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,6 +0,0 @@
-Implementation-Title: JBoss JCA Validator
-Implementation-Vendor: Red Hat Middleware LLC
-Implementation-Vendor-Id: org.jboss
-Implementation-Version: 0.1
-Main-Class: org.jboss.jca.deployers.common.validator.Main
-Class-Path: jbossxb.jar jboss-logging-spi.jar jboss-common-core.jar jboss-metadata-rar.jar jboss-metadata-common.jar jboss-reflect.jar jboss-mdr.jar jboss-jca-spec-api.jar papaki-core.jar javassist.jar
Deleted: projects/jboss-jca/trunk/deployers/src/main/resources/validator.properties
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/resources/validator.properties 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/deployers/src/main/resources/validator.properties 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,31 +0,0 @@
-severity=Severity
-severity.warn=WARNING
-severity.error=ERROR
-section=Section
-description=Description
-code=Code
-uncategorized=Uncategorized
-mcf.cnfe=ClassNotFoundException during ManagedConnectionFactory creation
-mcf.MCF=The class must implement the javax.resource.spi.ManagedConnectionFactory interface.
-mcf.MCFConfigProperties=Invalid config-property-type for ManagedConnectionFactory.
-mcf.MCFConstructor=A ManagedConnectionFactory must have a default constructor
-mcf.MCFEquals=A ManagedConnectionFactory must implement a "public boolean equals(Object)" method.
-mcf.MCFHashCode=A ManagedConnectionFactory must implement a "public int hashCode()" method.
-mc.MC=The class must provide an implementation of the ManagedConnection interface.
-mc.MCGetMetaData=ManagedConnection.getMetaData() must return a javax.resource.spi.ManagedConnectionMetaData instance
-ra.cnfe=ClassNotFoundException during ResourceAdapter creation
-ra.RA=A ResourceAdapter must implement the javax.resource.spi.ResourceAdapter interface.
-ra.RAConfigProperties=Invalid config-property-type for ResourceAdapter.
-ra.RAConstructor=A ResourceAdapter must have a default constructor
-ra.RAEquals=A ResourceAdapter must implement a "public boolean equals(Object)" method.
-ra.RAHashCode=A ResourceAdapter must implement a "public int hashCode()" method.
-ra.RANull=A ResourceAdapter must be a non-null instance.
-cf.CFNull=ConnectionFactory must be a non-null value
-cf.CFSerializable=ConnectionFactory must implement java.io.Serializable
-cf.CFReferenceable=ConnectionFactory must implement javax.resource.Referenceable
-as.cnfe=ClassNotFoundException during ActivationSpec creation
-as.ASConstructor=An ActivationSpec must have a default constructor
-as.ASConfigProperties=Invalid config-property-type for ActivationSpec.
-ao.cnfe=ClassNotFoundException during AdminObject creation
-ao.AOConstructor=An AdminObject must have a default constructor
-ao.AOConfigProperties=Invalid config-property-type for AdminObject.
Deleted: projects/jboss-jca/trunk/deployers/src/main/resources/validator.sh
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/resources/validator.sh 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/deployers/src/main/resources/validator.sh 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,3 +0,0 @@
-#!/bin/sh
-java -jar jboss-jca-validator.jar $*
-
Modified: projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/annotations/AnnotationsTestCase.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/annotations/AnnotationsTestCase.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/deployers/src/test/java/org/jboss/jca/test/deployers/annotations/AnnotationsTestCase.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -22,8 +22,8 @@
package org.jboss.jca.test.deployers.annotations;
-import org.jboss.jca.deployers.common.Annotations;
-import org.jboss.jca.deployers.common.ValidateException;
+import org.jboss.jca.common.Annotations;
+import org.jboss.jca.common.ValidateException;
import org.jboss.jca.embedded.EmbeddedJCA;
import java.io.File;
Added: projects/jboss-jca/trunk/validator/.classpath
===================================================================
--- projects/jboss-jca/trunk/validator/.classpath (rev 0)
+++ projects/jboss-jca/trunk/validator/.classpath 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
+ <classpathentry kind="src" output="eclipse-target/tests-classes" path="src/test/java"/>
+ <classpathentry excluding="**/*.java" kind="src" output="eclipse-target/tests-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/jboss-jca-api"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/jboss-jca-common"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/metadata-rar"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/metadata-common"/>
+ <classpathentry kind="output" path="eclipse-target/classes"/>
+</classpath>
Added: projects/jboss-jca/trunk/validator/.project
===================================================================
--- projects/jboss-jca/trunk/validator/.project (rev 0)
+++ projects/jboss-jca/trunk/validator/.project 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,17 @@
+<projectDescription>
+ <name>jboss-jca-validator</name>
+ <comment>JBoss JCA Validator</comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: projects/jboss-jca/trunk/validator/build.xml
===================================================================
--- projects/jboss-jca/trunk/validator/build.xml (rev 0)
+++ projects/jboss-jca/trunk/validator/build.xml 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,214 @@
+<!--
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<project name="jboss-jca-validator"
+ default="compile"
+ xmlns:ivy="antlib:org.apache.ivy.ant">
+
+ <!-- =================================
+ Properties
+ ================================= -->
+ <property name="build.validator.dir" value="${build.dir}/validator" />
+
+ <!-- =================================
+ Target: compile
+ ================================= -->
+ <target name="compile">
+ <mkdir dir="${build.validator.dir}" />
+ <mkdir dir="${build.validator.dir}/impl" />
+
+ <javac srcdir="src/main"
+ destdir="${build.validator.dir}/impl"
+ classpathref="standalone.lib.path.id"
+ debug="${javac.debug}"
+ deprecation="${javac.deprecation}"
+ optimize="${javac.optimize}">
+ <compilerarg value="-Xlint"/>
+ </javac>
+ </target>
+
+ <!-- =================================
+ Target: jars
+ ================================= -->
+ <target name="jars" depends="compile">
+ <mkdir dir="${build.validator.dir}/jars" />
+
+ <!-- Validator -->
+ <mkdir dir="${build.validator.dir}/jars/validator" />
+
+ <copy todir="${build.validator.dir}/jars/validator">
+ <fileset dir="${build.validator.dir}/impl"
+ includes="**"/>
+ </copy>
+
+ <copy todir="${build.validator.dir}/jars/validator">
+ <fileset dir="src/main/resources/"
+ includes="**/*.properties"/>
+ </copy>
+
+ <jar destfile="${target.dir}/jboss-jca-validator.jar"
+ manifest="src/main/resources/validator-manifest.mf"
+ basedir="${build.validator.dir}/jars/validator"
+ excludes="**/Main*.*"/>
+
+ <jar destfile="${target.dir}/jboss-jca-validator-cli.jar"
+ manifest="src/main/resources/validator-cli-manifest.mf"
+ basedir="${build.validator.dir}/jars/validator"
+ includes="**/Main*.class"/>
+ </target>
+
+ <!-- =================================
+ Target: docs
+ ================================= -->
+ <target name="docs" depends="compile">
+ <mkdir dir="${target.dir}/docs/validator"/>
+ <javadoc packagenames="org.*"
+ sourcepath="src/main/java"
+ destdir="${target.dir}/docs/validator"
+ doclet="org.jboss.apiviz.APIviz"
+ docletpathref="standalone.lib.path.id"
+ author="true"
+ version="true"
+ windowtitle="JBoss JCA validator"
+ doctitle="JBoss JCA validator"
+ use="true"
+ additionalparam="-author -version"
+ classpath="${build.validator.dir}/impl"
+ classpathref="standalone.lib.path.id"
+ bottom="Copyright © 2008-2009 Red Hat Middleware LLC (http://www.jboss.com/)">
+ <link offline="true" href="http://java.sun.com/j2se/5/docs/api/" packagelistLoc="${java.home}/../docs/api"/>
+ </javadoc>
+ <copy todir="${target.dir}/docs/validator" overwrite="true">
+ <fileset dir="${tools.dir}/api"/>
+ </copy>
+ </target>
+
+ <!-- =================================
+ Target: test
+ ================================= -->
+ <target name="test" depends="jars, prepare-test">
+ <mkdir dir="${reports.dir}"/>
+ <mkdir dir="${reports.dir}/validator"/>
+
+ <junit dir="src/test"
+ printsummary="${junit.printsummary}"
+ haltonerror="${junit.haltonerror}"
+ haltonfailure="${junit.haltonfailure}"
+ fork="${junit.fork}"
+ timeout="${junit.timeout}">
+
+ <jvmarg line="${junit.jvm.options}"/>
+ <sysproperty key="archives.dir" value="${build.validator.dir}"/>
+ <sysproperty key="java.util.logging.manager" value="org.jboss.logmanager.LogManager"/>
+ <sysproperty key="log4j.defaultInitOverride" value="true"/>
+ <sysproperty key="org.jboss.logging.Logger.pluginClass" value="org.jboss.logging.logmanager.LoggerPluginImpl"/>
+ <sysproperty key="test.dir" value="${test.dir}"/>
+ <sysproperty key="xb.builder.useUnorderedSequence" value="true"/>
+ <sysproperty key="javax.xml.stream.XMLInputFactory" value="com.sun.xml.internal.stream.XMLInputFactoryImpl"/>
+
+ <classpath>
+ <pathelement location="${build.validator.dir}/test"/>
+ <fileset dir="${target.dir}" includes="*.jar"/>
+ <fileset dir="${lib.dir}/test" includes="*.jar" />
+ </classpath>
+
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+
+ <batchtest todir="${reports.dir}/validator"
+ haltonerror="${junit.batchtest.haltonerror}"
+ haltonfailure="${junit.batchtest.haltonfailure}"
+ fork="${junit.batchtest.fork}">
+
+ <fileset dir="${build.validator.dir}/test">
+ <include name="**/*TestCase.class"/>
+ </fileset>
+ </batchtest>
+
+ </junit>
+
+ </target>
+
+
+ <!-- =================================
+ Target: one-test
+ ================================= -->
+ <target name="one-test" depends="jars, prepare-test">
+ <mkdir dir="${reports.dir}"/>
+ <mkdir dir="${reports.dir}/validator"/>
+
+ <junit dir="src/test"
+ printsummary="${junit.printsummary}"
+ haltonerror="${junit.haltonerror}"
+ haltonfailure="${junit.haltonfailure}"
+ fork="${junit.fork}"
+ timeout="${junit.timeout}">
+
+ <jvmarg line="${junit.jvm.options}"/>
+ <sysproperty key="archives.dir" value="${build.validator.dir}"/>
+ <sysproperty key="java.util.logging.manager" value="org.jboss.logmanager.LogManager"/>
+ <sysproperty key="log4j.defaultInitOverride" value="true"/>
+ <sysproperty key="org.jboss.logging.Logger.pluginClass" value="org.jboss.logging.logmanager.LoggerPluginImpl"/>
+ <sysproperty key="test.dir" value="${test.dir}"/>
+ <sysproperty key="xb.builder.useUnorderedSequence" value="true"/>
+ <sysproperty key="javax.xml.stream.XMLInputFactory" value="com.sun.xml.internal.stream.XMLInputFactoryImpl"/>
+
+ <classpath>
+ <pathelement location="${build.validator.dir}/test"/>
+ <fileset dir="${target.dir}" includes="*.jar"/>
+ <fileset dir="${lib.dir}/test" includes="*.jar" />
+ </classpath>
+
+ <formatter type="plain"/>
+ <formatter type="xml"/>
+
+ <test todir="${reports.dir}/validator" name="${test}"
+ haltonerror="${junit.batchtest.haltonerror}"
+ haltonfailure="${junit.batchtest.haltonfailure}"
+ fork="${junit.batchtest.fork}"/>
+ </junit>
+ </target>
+
+ <!-- =================================
+ Target: prepare-test
+ ================================= -->
+ <target name="prepare-test">
+ <mkdir dir="${build.validator.dir}" />
+ <mkdir dir="${build.validator.dir}/test" />
+
+ <javac srcdir="src/test"
+ destdir="${build.validator.dir}/test"
+ classpathref="test.lib.path.id"
+ debug="${javac.debug}"
+ deprecation="${javac.deprecation}"
+ optimize="${javac.optimize}">
+ <compilerarg value="-Xlint"/>
+ </javac>
+
+ <copy todir="${build.validator.dir}/test">
+ <fileset dir="src/test/resources"/>
+ </copy>
+
+ <ant target="test-jars"/>
+
+ </target>
+
+</project>
Copied: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator (from rev 101443, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator)
Deleted: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Failure.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Failure.java 2010-02-25 04:49:55 UTC (rev 101443)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Failure.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,165 +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.deployers.common.validator;
-
-import java.util.ResourceBundle;
-
-/**
- * Failure
- */
-public class Failure
-{
- /** New line character */
- private static final String NEW_LINE = System.getProperty("line.separator");
-
- /** Severity */
- private int severity;
-
- /** Section */
- private String section;
-
- /** Description */
- private String description;
-
- /** Code */
- private String code;
-
- /**
- * Constructor
- * @param severity The severity
- * @param section The section
- * @param description The description
- */
- public Failure(int severity,
- String section,
- String description)
- {
- this(severity, section, description, null);
- }
-
- /**
- * Constructor
- * @param severity The severity
- * @param section The section
- * @param description The description
- * @param code The code
- */
- public Failure(int severity,
- String section,
- String description,
- String code)
- {
- this.severity = severity;
- this.section = section;
- this.description = description;
- this.code = code;
- }
-
- /**
- * Get the severity
- * @return The severity
- */
- public int getSeverity()
- {
- return severity;
- }
-
- /**
- * Get the section
- * @return The section
- */
- public String getSection()
- {
- return section;
- }
-
- /**
- * Get the description
- * @return The description
- */
- public String getDescription()
- {
- return description;
- }
-
- /**
- * Get the code
- * @return The code
- */
- public String getCode()
- {
- return code;
- }
-
- /**
- * As text
- * @param rb The resource bundle
- * @return The text representation
- */
- public String asText(ResourceBundle rb)
- {
- StringBuilder sb = new StringBuilder();
-
- sb = sb.append(rb.getString("severity"));
- sb = sb.append(": ");
- if (severity == Severity.WARNING)
- {
- sb = sb.append(rb.getString("severity.warn"));
- }
- else
- {
- sb = sb.append(rb.getString("severity.error"));
- }
- sb = sb.append(NEW_LINE);
-
- sb = sb.append(rb.getString("section"));
- sb = sb.append(": ");
- sb = sb.append(section);
- sb = sb.append(NEW_LINE);
-
- sb = sb.append(rb.getString("description"));
- sb = sb.append(": ");
- sb = sb.append(description);
- sb = sb.append(NEW_LINE);
-
- if (code != null)
- {
- sb = sb.append(rb.getString("code"));
- sb = sb.append(": ");
- sb = sb.append(code);
- sb = sb.append(NEW_LINE);
- }
-
- return sb.toString();
- }
-
- /**
- * As XML
- * @param rb The resource bundle
- * @return The XML representation
- */
- public String asXML(ResourceBundle rb)
- {
- return "";
- }
-}
Copied: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Failure.java (from rev 101448, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Failure.java)
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Failure.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Failure.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,165 @@
+/*
+ * 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.validator;
+
+import java.util.ResourceBundle;
+
+/**
+ * Failure
+ */
+public class Failure
+{
+ /** New line character */
+ private static final String NEW_LINE = System.getProperty("line.separator");
+
+ /** Severity */
+ private int severity;
+
+ /** Section */
+ private String section;
+
+ /** Description */
+ private String description;
+
+ /** Code */
+ private String code;
+
+ /**
+ * Constructor
+ * @param severity The severity
+ * @param section The section
+ * @param description The description
+ */
+ public Failure(int severity,
+ String section,
+ String description)
+ {
+ this(severity, section, description, null);
+ }
+
+ /**
+ * Constructor
+ * @param severity The severity
+ * @param section The section
+ * @param description The description
+ * @param code The code
+ */
+ public Failure(int severity,
+ String section,
+ String description,
+ String code)
+ {
+ this.severity = severity;
+ this.section = section;
+ this.description = description;
+ this.code = code;
+ }
+
+ /**
+ * Get the severity
+ * @return The severity
+ */
+ public int getSeverity()
+ {
+ return severity;
+ }
+
+ /**
+ * Get the section
+ * @return The section
+ */
+ public String getSection()
+ {
+ return section;
+ }
+
+ /**
+ * Get the description
+ * @return The description
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /**
+ * Get the code
+ * @return The code
+ */
+ public String getCode()
+ {
+ return code;
+ }
+
+ /**
+ * As text
+ * @param rb The resource bundle
+ * @return The text representation
+ */
+ public String asText(ResourceBundle rb)
+ {
+ StringBuilder sb = new StringBuilder();
+
+ sb = sb.append(rb.getString("severity"));
+ sb = sb.append(": ");
+ if (severity == Severity.WARNING)
+ {
+ sb = sb.append(rb.getString("severity.warn"));
+ }
+ else
+ {
+ sb = sb.append(rb.getString("severity.error"));
+ }
+ sb = sb.append(NEW_LINE);
+
+ sb = sb.append(rb.getString("section"));
+ sb = sb.append(": ");
+ sb = sb.append(section);
+ sb = sb.append(NEW_LINE);
+
+ sb = sb.append(rb.getString("description"));
+ sb = sb.append(": ");
+ sb = sb.append(description);
+ sb = sb.append(NEW_LINE);
+
+ if (code != null)
+ {
+ sb = sb.append(rb.getString("code"));
+ sb = sb.append(": ");
+ sb = sb.append(code);
+ sb = sb.append(NEW_LINE);
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * As XML
+ * @param rb The resource bundle
+ * @return The XML representation
+ */
+ public String asXML(ResourceBundle rb)
+ {
+ return "";
+ }
+}
Deleted: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/FailureHelper.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/FailureHelper.java 2010-02-25 04:49:55 UTC (rev 101443)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/FailureHelper.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,105 +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.deployers.common.validator;
-
-import java.util.List;
-import java.util.ResourceBundle;
-
-/**
- * Failure helper
- */
-public class FailureHelper
-{
- /** New line character */
- private static final String NEW_LINE = System.getProperty("line.separator");
-
- /** List of failures */
- private List<Failure> failures;
-
- /**
- * Constructor
- * @param failures The list of failures
- */
- public FailureHelper(List<Failure> failures)
- {
- this.failures = failures;
- }
-
- /**
- * As text
- * @param rb The resource bundle
- * @return The text representation
- */
- public String asText(ResourceBundle rb)
- {
- StringBuilder sb = new StringBuilder();
-
- if (failures != null)
- {
- // PRE-TEXT
-
- for (int i = 0; i < failures.size(); i++)
- {
- Failure f = failures.get(i);
-
- sb = sb.append(f.asText(rb));
-
- if (i < failures.size() - 1)
- sb = sb.append(NEW_LINE);
- }
-
- // POST-TEXT
- }
-
- return sb.toString();
- }
-
- /**
- * As XML
- * @param rb The resource bundle
- * @return The XML representation
- */
- public String asXML(ResourceBundle rb)
- {
- StringBuilder sb = new StringBuilder();
-
- if (failures != null)
- {
- // PRE-XML
-
- for (int i = 0; i < failures.size(); i++)
- {
- Failure f = failures.get(i);
-
- sb = sb.append(f.asXML(rb));
-
- if (i < failures.size() - 1)
- sb = sb.append(NEW_LINE);
- }
-
- // POST-XML
- }
-
- return sb.toString();
- }
-}
Copied: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/FailureHelper.java (from rev 101448, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/FailureHelper.java)
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/FailureHelper.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/FailureHelper.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,105 @@
+/*
+ * 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.validator;
+
+import java.util.List;
+import java.util.ResourceBundle;
+
+/**
+ * Failure helper
+ */
+public class FailureHelper
+{
+ /** New line character */
+ private static final String NEW_LINE = System.getProperty("line.separator");
+
+ /** List of failures */
+ private List<Failure> failures;
+
+ /**
+ * Constructor
+ * @param failures The list of failures
+ */
+ public FailureHelper(List<Failure> failures)
+ {
+ this.failures = failures;
+ }
+
+ /**
+ * As text
+ * @param rb The resource bundle
+ * @return The text representation
+ */
+ public String asText(ResourceBundle rb)
+ {
+ StringBuilder sb = new StringBuilder();
+
+ if (failures != null)
+ {
+ // PRE-TEXT
+
+ for (int i = 0; i < failures.size(); i++)
+ {
+ Failure f = failures.get(i);
+
+ sb = sb.append(f.asText(rb));
+
+ if (i < failures.size() - 1)
+ sb = sb.append(NEW_LINE);
+ }
+
+ // POST-TEXT
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * As XML
+ * @param rb The resource bundle
+ * @return The XML representation
+ */
+ public String asXML(ResourceBundle rb)
+ {
+ StringBuilder sb = new StringBuilder();
+
+ if (failures != null)
+ {
+ // PRE-XML
+
+ for (int i = 0; i < failures.size(); i++)
+ {
+ Failure f = failures.get(i);
+
+ sb = sb.append(f.asXML(rb));
+
+ if (i < failures.size() - 1)
+ sb = sb.append(NEW_LINE);
+ }
+
+ // POST-XML
+ }
+
+ return sb.toString();
+ }
+}
Deleted: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Key.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Key.java 2010-02-25 04:49:55 UTC (rev 101443)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Key.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,54 +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.deployers.common.validator;
-
-/**
- * Key
- */
-public class Key
-{
- /** Resource adapter */
- public static final int RESOURCE_ADAPTER = 0;
-
- /** Managed connection factory */
- public static final int MANAGED_CONNECTION_FACTORY = 1;
-
- /** Activation spec */
- public static final int ACTIVATION_SPEC = 2;
-
- /** Admin object */
- public static final int ADMIN_OBJECT = 3;
-
- /** Managed connection */
- public static final int MANAGED_CONNECTION = 4;
-
- /** Connection factory */
- public static final int CONNECTION_FACTORY = 5;
-
- /**
- * Constructor
- */
- private Key()
- {
- }
-}
Copied: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Key.java (from rev 101448, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Key.java)
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Key.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Key.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,54 @@
+/*
+ * 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.validator;
+
+/**
+ * Key
+ */
+public class Key
+{
+ /** Resource adapter */
+ public static final int RESOURCE_ADAPTER = 0;
+
+ /** Managed connection factory */
+ public static final int MANAGED_CONNECTION_FACTORY = 1;
+
+ /** Activation spec */
+ public static final int ACTIVATION_SPEC = 2;
+
+ /** Admin object */
+ public static final int ADMIN_OBJECT = 3;
+
+ /** Managed connection */
+ public static final int MANAGED_CONNECTION = 4;
+
+ /** Connection factory */
+ public static final int CONNECTION_FACTORY = 5;
+
+ /**
+ * Constructor
+ */
+ private Key()
+ {
+ }
+}
Deleted: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Main.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Main.java 2010-02-25 04:49:55 UTC (rev 101443)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Main.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,620 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008-2010, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.jca.deployers.common.validator;
-
-import org.jboss.jca.deployers.common.Annotations;
-import org.jboss.jca.deployers.common.Metadata;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.ResourceBundle;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-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.MessageListenerMetaData;
-
-/**
- * A Main.
- *
- * @author Jeff Zhang</a>
- * @version $Revision: $
- */
-public class Main
-{
- private static final int SUCCESS = 0;
- private static final int FAIL = 1;
- private static final int OTHER = 2;
-
- /**
- * validate
- * @param url The url
- * @param output directory of output
- * @return The system exit code
- */
- private static int validate(URL url, String output)
- {
- if (url == null || !(url.toExternalForm().endsWith(".rar") || url.toExternalForm().endsWith(".rar/")))
- return FAIL;
-
- int exitCode = SUCCESS;
- File destination = null;
-
- try
- {
- File f = new File(url.toURI());
-
- if (!f.exists())
- throw new IOException("Archive " + url.toExternalForm() + " doesnt exists");
-
- File root = null;
-
- if (f.isFile())
- {
- destination = new File(SecurityActions.getSystemProperty("java.io.tmpdir"), "/tmp/");
- root = extract(f, destination);
- }
- else
- {
- root = f;
- }
-
- // Create classloader
- URL[] urls = getUrls(root);
- URLClassLoader cl = SecurityActions.createURLCLassLoader(urls, SecurityActions.getThreadContextClassLoader());
- SecurityActions.setThreadContextClassLoader(cl);
-
- // Parse metadata
- Metadata metadataHandler = new Metadata();
- ConnectorMetaData cmd = metadataHandler.getStandardMetaData(root);
-
-
- // Annotation scanning
- Annotations annotator = new Annotations();
- cmd = annotator.scan(cmd, cl.getURLs(), cl);
-
-
- List<Validate> validateClasses = new ArrayList<Validate>();
- List<Failure> failures = new ArrayList<Failure>();
-
- Validator validator = new Validator();
- validateClasses.addAll(createResourceAdapter(cmd, failures, validator.getResourceBundle(), cl));
- validateClasses.addAll(createManagedConnectionFactory(cmd, failures, validator.getResourceBundle(), cl));
- validateClasses.addAll(createActivationSpec(cmd, failures, validator.getResourceBundle(), cl));
- validateClasses.addAll(createAdminObject(cmd, failures, validator.getResourceBundle(), cl));
-
- List<Failure> classFailures = validator.validate(validateClasses.
- toArray(new Validate[validateClasses.size()]));
- if (classFailures != null && classFailures.size() > 0)
- failures.addAll(classFailures);
-
- if (failures != null && failures.size() > 0)
- {
- FailureHelper fh = new FailureHelper(failures);
- File reportDirectory = new File(output);
-
- if (!reportDirectory.mkdirs())
- {
- throw new IOException(output + " can't be created");
- }
-
- String reportName = url.getFile();
- int lastIndex = reportName.lastIndexOf(File.separator);
- if (lastIndex != -1)
- reportName = reportName.substring(lastIndex + 1);
- reportName += ".log";
-
- File report = new File(reportDirectory, reportName);
- FileWriter fw = null;
- try
- {
- fw = new FileWriter(report);
- BufferedWriter bw = new BufferedWriter(fw, 8192);
- bw.write(fh.asText(validator.getResourceBundle()));
- bw.flush();
- }
- catch (IOException ioe)
- {
- ioe.printStackTrace();
- }
- finally
- {
- if (fw != null)
- {
- try
- {
- fw.close();
- }
- catch (IOException ignore)
- {
- // Ignore
- }
- }
- }
-
- exitCode = FAIL;
- }
- exitCode = SUCCESS;
- }
- catch (Exception e)
- {
- exitCode = OTHER;
- }
-
- if (destination != null)
- {
- try
- {
- recursiveDelete(destination);
- }
- catch (IOException ioe)
- {
- // Ignore
- }
- }
-
- return exitCode;
- }
-
- /**
- * createResourceAdapter
- * @param cmd connector metadata
- * @param failures list of failures
- * @param rb ResourceBundle
- * @param cl classloador
- * @return list of validate objects
- */
- private static List<Validate> createResourceAdapter(ConnectorMetaData cmd,
- List<Failure> failures, ResourceBundle rb, ClassLoader cl)
- {
- List<Validate> result = new ArrayList<Validate>();
-
- if (cmd.getRa() != null && cmd.getRa().getRaClass() != null)
- {
- try
- {
- Class<?> clazz = Class.forName(cmd.getRa().getRaClass(), true, cl);
- List<ConfigPropertyMetaData> configProperties = cmd.getRa().getConfigProperty();
-
- ValidateClass vc = new ValidateClass(Key.RESOURCE_ADAPTER, clazz, configProperties);
- result.add(vc);
- }
- catch (ClassNotFoundException e)
- {
- Failure failure = new Failure(Severity.ERROR,
- rb.getString("uncategorized"),
- rb.getString("ra.cnfe"),
- e.getMessage());
- failures.add(failure);
- }
- }
- return result;
- }
-
- /**
- * createManagedConnectionFactory
- * @param cmd connector metadata
- * @param failures list of failures
- * @param rb ResourceBundle
- * @param cl classloador
- * @return list of validate objects
- */
- private static List<Validate> createManagedConnectionFactory(ConnectorMetaData cmd,
- List<Failure> failures, ResourceBundle rb, ClassLoader cl)
- {
- List<Validate> result = new ArrayList<Validate>();
-
- if (cmd.getRa() != null && cmd.getRa().getOutboundRa() != null
- && cmd.getRa().getOutboundRa().getConDefs() != null)
- {
- List<ConnectionDefinitionMetaData> cdMetas = cmd.getRa().getOutboundRa().getConDefs();
- if (cdMetas.size() > 0)
- {
- for (ConnectionDefinitionMetaData cdMeta : cdMetas)
- {
- if (cdMeta.getManagedConnectionFactoryClass() != null)
- {
- try
- {
- Class<?> clazz = Class.forName(cdMeta.getManagedConnectionFactoryClass(), true, cl);
- List<ConfigPropertyMetaData> configProperties = cdMeta.getConfigProps();
-
- ValidateClass vc = new ValidateClass(Key.MANAGED_CONNECTION_FACTORY, clazz, configProperties);
- result.add(vc);
- }
- catch (ClassNotFoundException e)
- {
- Failure failure = new Failure(Severity.ERROR,
- rb.getString("uncategorized"),
- rb.getString("mcf.cnfe"),
- e.getMessage());
- failures.add(failure);
- }
- }
-
- }
- }
- }
-
- return result;
- }
-
- /**
- * createActivationSpec
- * @param cmd connector metadata
- * @param failures list of failures
- * @param rb ResourceBundle
- * @param cl classloador
- * @return list of validate objects
- */
- private static List<Validate> createActivationSpec(ConnectorMetaData cmd,
- List<Failure> failures, ResourceBundle rb, ClassLoader cl)
- {
- List<Validate> result = new ArrayList<Validate>();
-
- 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)
- {
-
- try
- {
- Class<?> clazz = Class.forName(mlMeta.getActivationSpecType().getAsClass(), true, cl);
- List<ConfigPropertyMetaData> configProperties = mlMeta.getActivationSpecType().getConfigProps();
-
- ValidateClass vc = new ValidateClass(Key.ACTIVATION_SPEC, clazz, configProperties);
- result.add(vc);
- }
- catch (ClassNotFoundException e)
- {
- Failure failure = new Failure(Severity.ERROR,
- rb.getString("uncategorized"),
- rb.getString("as.cnfe"),
- e.getMessage());
- failures.add(failure);
- }
- }
- }
- }
- }
- return result;
- }
-
- /**
- * createAdminObject
- * @param cmd connector metadata
- * @param failures list of failures
- * @param rb ResourceBundle
- * @param cl classloador
- * @return list of validate objects
- */
- private static List<Validate> createAdminObject(ConnectorMetaData cmd,
- List<Failure> failures, ResourceBundle rb, ClassLoader cl)
- {
- List<Validate> result = new ArrayList<Validate>();
-
- 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)
- {
-
- try
- {
- Class<?> clazz = Class.forName(aoMeta.getAdminObjectImplementationClass(), true, cl);
- List<ConfigPropertyMetaData> configProperties = aoMeta.getConfigProps();
-
- ValidateClass vc = new ValidateClass(Key.ADMIN_OBJECT, clazz, configProperties);
- result.add(vc);
- }
- catch (ClassNotFoundException e)
- {
- Failure failure = new Failure(Severity.ERROR,
- rb.getString("uncategorized"),
- rb.getString("ao.cnfe"),
- e.getMessage());
- failures.add(failure);
- }
- }
- }
- }
- }
- return result;
- }
-
- /**
- * Validator standalone tool
- *
- * @param args command line arguments
- */
- public static void main(String[] args)
- {
- boolean quite = false;
- String outputDir = "."; //put report into current directory by default
- int arg = 0;
-
- if (args.length > 0)
- {
- while (args.length > arg + 1)
- {
- if (args[arg].startsWith("-"))
- {
- if (args[arg].endsWith("quite"))
- {
- quite = true;
- }
- else if (args[arg].endsWith("output"))
- {
- arg++;
- if (arg + 1 >= args.length)
- {
- usage();
- System.exit(OTHER);
- }
- outputDir = args[arg];
- }
- }
- else
- {
- usage();
- System.exit(OTHER);
- }
- arg++;
- }
-
- try
- {
- int systemExitCode = validate(new File(args[arg]).toURI().toURL(), outputDir);
-
- if (!quite && systemExitCode == FAIL)
- {
- System.out.println("Validation errors");
- }
- System.exit(systemExitCode);
- }
- catch (MalformedURLException e)
- {
- e.printStackTrace();
- }
- }
- else
- {
- usage();
- }
-
-
- }
-
- /**
- * Tool usage
- */
- private static void usage()
- {
- System.out.println("Usage: validator [-quite] [-output directory] <file>");
- }
-
-
- /**
- * Extract a JAR type file
- * @param file The file
- * @param directory The directory where the file should be extracted
- * @return The root of the extracted JAR file
- * @exception IOException Thrown if an error occurs
- */
- private static File extract(File file, File directory) throws IOException
- {
- if (file == null)
- throw new IllegalArgumentException("File is null");
-
- if (directory == null)
- throw new IllegalArgumentException("Directory is null");
-
- File target = new File(directory, file.getName());
-
- if (target.exists())
- recursiveDelete(target);
-
- if (!target.mkdirs())
- throw new IOException("Could not create " + target);
-
- JarFile jar = new JarFile(file);
- Enumeration<JarEntry> entries = jar.entries();
-
- while (entries.hasMoreElements())
- {
- JarEntry je = entries.nextElement();
- File copy = new File(target, je.getName());
-
- if (!je.isDirectory())
- {
- InputStream in = null;
- OutputStream out = null;
-
- // Make sure that the directory is _really_ there
- if (copy.getParentFile() != null && !copy.getParentFile().exists())
- {
- if (!copy.getParentFile().mkdirs())
- throw new IOException("Could not create " + copy.getParentFile());
- }
-
- try
- {
- in = new BufferedInputStream(jar.getInputStream(je));
- out = new BufferedOutputStream(new FileOutputStream(copy));
-
- byte[] buffer = new byte[4096];
- for (;;)
- {
- int nBytes = in.read(buffer);
- if (nBytes <= 0)
- break;
-
- out.write(buffer, 0, nBytes);
- }
- out.flush();
- }
- finally
- {
- try
- {
- if (out != null)
- out.close();
- }
- catch (IOException ignore)
- {
- // Ignore
- }
-
- try
- {
- if (in != null)
- in.close();
- }
- catch (IOException ignore)
- {
- // Ignore
- }
- }
- }
- else
- {
- if (!copy.exists())
- {
- if (!copy.mkdirs())
- throw new IOException("Could not create " + copy);
- }
- else
- {
- if (!copy.isDirectory())
- throw new IOException(copy + " isn't a directory");
- }
- }
- }
-
- return target;
- }
-
-
- /**
- * Recursive delete
- * @param f The file handler
- * @exception IOException Thrown if a file could not be deleted
- */
- private static void recursiveDelete(File f) throws IOException
- {
- if (f != null && f.exists())
- {
- File[] files = f.listFiles();
- if (files != null)
- {
- for (int i = 0; i < files.length; i++)
- {
- if (files[i].isDirectory())
- {
- recursiveDelete(files[i]);
- }
- else
- {
- if (!files[i].delete())
- throw new IOException("Could not delete " + files[i]);
- }
- }
- }
- if (!f.delete())
- throw new IOException("Could not delete " + f);
- }
- }
-
- /**
- * Get the URLs for the directory and all libraries located in the directory
- * @param directory The directory
- * @return The URLs
- * @exception MalformedURLException MalformedURLException
- * @exception IOException IOException
- */
- private static 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 FilenameFilter()
- {
- /**
- * Accept
- * @param dir The directory
- * @param name The name
- * @return True if accepts; otherwise false
- */
- public boolean accept(File dir, String name)
- {
- return name.endsWith(".jar");
- }
- });
-
- if (jars != null)
- {
- for (int j = 0; j < jars.length; j++)
- {
- list.add(jars[j].getCanonicalFile().toURI().toURL());
- }
- }
- }
- return list.toArray(new URL[list.size()]);
- }
-}
Copied: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Main.java (from rev 101448, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Main.java)
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Main.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Main.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,620 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008-2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jca.validator;
+
+import org.jboss.jca.common.Annotations;
+import org.jboss.jca.common.Metadata;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ResourceBundle;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+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.MessageListenerMetaData;
+
+/**
+ * A Main.
+ *
+ * @author Jeff Zhang</a>
+ * @version $Revision: $
+ */
+public class Main
+{
+ private static final int SUCCESS = 0;
+ private static final int FAIL = 1;
+ private static final int OTHER = 2;
+
+ /**
+ * validate
+ * @param url The url
+ * @param output directory of output
+ * @return The system exit code
+ */
+ private static int validate(URL url, String output)
+ {
+ if (url == null || !(url.toExternalForm().endsWith(".rar") || url.toExternalForm().endsWith(".rar/")))
+ return FAIL;
+
+ int exitCode = SUCCESS;
+ File destination = null;
+
+ try
+ {
+ File f = new File(url.toURI());
+
+ if (!f.exists())
+ throw new IOException("Archive " + url.toExternalForm() + " doesnt exists");
+
+ File root = null;
+
+ if (f.isFile())
+ {
+ destination = new File(SecurityActions.getSystemProperty("java.io.tmpdir"), "/tmp/");
+ root = extract(f, destination);
+ }
+ else
+ {
+ root = f;
+ }
+
+ // Create classloader
+ URL[] urls = getUrls(root);
+ URLClassLoader cl = SecurityActions.createURLCLassLoader(urls, SecurityActions.getThreadContextClassLoader());
+ SecurityActions.setThreadContextClassLoader(cl);
+
+ // Parse metadata
+ Metadata metadataHandler = new Metadata();
+ ConnectorMetaData cmd = metadataHandler.getStandardMetaData(root);
+
+
+ // Annotation scanning
+ Annotations annotator = new Annotations();
+ cmd = annotator.scan(cmd, cl.getURLs(), cl);
+
+
+ List<Validate> validateClasses = new ArrayList<Validate>();
+ List<Failure> failures = new ArrayList<Failure>();
+
+ Validator validator = new Validator();
+ validateClasses.addAll(createResourceAdapter(cmd, failures, validator.getResourceBundle(), cl));
+ validateClasses.addAll(createManagedConnectionFactory(cmd, failures, validator.getResourceBundle(), cl));
+ validateClasses.addAll(createActivationSpec(cmd, failures, validator.getResourceBundle(), cl));
+ validateClasses.addAll(createAdminObject(cmd, failures, validator.getResourceBundle(), cl));
+
+ List<Failure> classFailures = validator.validate(validateClasses.
+ toArray(new Validate[validateClasses.size()]));
+ if (classFailures != null && classFailures.size() > 0)
+ failures.addAll(classFailures);
+
+ if (failures != null && failures.size() > 0)
+ {
+ FailureHelper fh = new FailureHelper(failures);
+ File reportDirectory = new File(output);
+
+ if (!reportDirectory.mkdirs())
+ {
+ throw new IOException(output + " can't be created");
+ }
+
+ String reportName = url.getFile();
+ int lastIndex = reportName.lastIndexOf(File.separator);
+ if (lastIndex != -1)
+ reportName = reportName.substring(lastIndex + 1);
+ reportName += ".log";
+
+ File report = new File(reportDirectory, reportName);
+ FileWriter fw = null;
+ try
+ {
+ fw = new FileWriter(report);
+ BufferedWriter bw = new BufferedWriter(fw, 8192);
+ bw.write(fh.asText(validator.getResourceBundle()));
+ bw.flush();
+ }
+ catch (IOException ioe)
+ {
+ ioe.printStackTrace();
+ }
+ finally
+ {
+ if (fw != null)
+ {
+ try
+ {
+ fw.close();
+ }
+ catch (IOException ignore)
+ {
+ // Ignore
+ }
+ }
+ }
+
+ exitCode = FAIL;
+ }
+ exitCode = SUCCESS;
+ }
+ catch (Exception e)
+ {
+ exitCode = OTHER;
+ }
+
+ if (destination != null)
+ {
+ try
+ {
+ recursiveDelete(destination);
+ }
+ catch (IOException ioe)
+ {
+ // Ignore
+ }
+ }
+
+ return exitCode;
+ }
+
+ /**
+ * createResourceAdapter
+ * @param cmd connector metadata
+ * @param failures list of failures
+ * @param rb ResourceBundle
+ * @param cl classloador
+ * @return list of validate objects
+ */
+ private static List<Validate> createResourceAdapter(ConnectorMetaData cmd,
+ List<Failure> failures, ResourceBundle rb, ClassLoader cl)
+ {
+ List<Validate> result = new ArrayList<Validate>();
+
+ if (cmd.getRa() != null && cmd.getRa().getRaClass() != null)
+ {
+ try
+ {
+ Class<?> clazz = Class.forName(cmd.getRa().getRaClass(), true, cl);
+ List<ConfigPropertyMetaData> configProperties = cmd.getRa().getConfigProperty();
+
+ ValidateClass vc = new ValidateClass(Key.RESOURCE_ADAPTER, clazz, configProperties);
+ result.add(vc);
+ }
+ catch (ClassNotFoundException e)
+ {
+ Failure failure = new Failure(Severity.ERROR,
+ rb.getString("uncategorized"),
+ rb.getString("ra.cnfe"),
+ e.getMessage());
+ failures.add(failure);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * createManagedConnectionFactory
+ * @param cmd connector metadata
+ * @param failures list of failures
+ * @param rb ResourceBundle
+ * @param cl classloador
+ * @return list of validate objects
+ */
+ private static List<Validate> createManagedConnectionFactory(ConnectorMetaData cmd,
+ List<Failure> failures, ResourceBundle rb, ClassLoader cl)
+ {
+ List<Validate> result = new ArrayList<Validate>();
+
+ if (cmd.getRa() != null && cmd.getRa().getOutboundRa() != null
+ && cmd.getRa().getOutboundRa().getConDefs() != null)
+ {
+ List<ConnectionDefinitionMetaData> cdMetas = cmd.getRa().getOutboundRa().getConDefs();
+ if (cdMetas.size() > 0)
+ {
+ for (ConnectionDefinitionMetaData cdMeta : cdMetas)
+ {
+ if (cdMeta.getManagedConnectionFactoryClass() != null)
+ {
+ try
+ {
+ Class<?> clazz = Class.forName(cdMeta.getManagedConnectionFactoryClass(), true, cl);
+ List<ConfigPropertyMetaData> configProperties = cdMeta.getConfigProps();
+
+ ValidateClass vc = new ValidateClass(Key.MANAGED_CONNECTION_FACTORY, clazz, configProperties);
+ result.add(vc);
+ }
+ catch (ClassNotFoundException e)
+ {
+ Failure failure = new Failure(Severity.ERROR,
+ rb.getString("uncategorized"),
+ rb.getString("mcf.cnfe"),
+ e.getMessage());
+ failures.add(failure);
+ }
+ }
+
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * createActivationSpec
+ * @param cmd connector metadata
+ * @param failures list of failures
+ * @param rb ResourceBundle
+ * @param cl classloador
+ * @return list of validate objects
+ */
+ private static List<Validate> createActivationSpec(ConnectorMetaData cmd,
+ List<Failure> failures, ResourceBundle rb, ClassLoader cl)
+ {
+ List<Validate> result = new ArrayList<Validate>();
+
+ 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)
+ {
+
+ try
+ {
+ Class<?> clazz = Class.forName(mlMeta.getActivationSpecType().getAsClass(), true, cl);
+ List<ConfigPropertyMetaData> configProperties = mlMeta.getActivationSpecType().getConfigProps();
+
+ ValidateClass vc = new ValidateClass(Key.ACTIVATION_SPEC, clazz, configProperties);
+ result.add(vc);
+ }
+ catch (ClassNotFoundException e)
+ {
+ Failure failure = new Failure(Severity.ERROR,
+ rb.getString("uncategorized"),
+ rb.getString("as.cnfe"),
+ e.getMessage());
+ failures.add(failure);
+ }
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * createAdminObject
+ * @param cmd connector metadata
+ * @param failures list of failures
+ * @param rb ResourceBundle
+ * @param cl classloador
+ * @return list of validate objects
+ */
+ private static List<Validate> createAdminObject(ConnectorMetaData cmd,
+ List<Failure> failures, ResourceBundle rb, ClassLoader cl)
+ {
+ List<Validate> result = new ArrayList<Validate>();
+
+ 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)
+ {
+
+ try
+ {
+ Class<?> clazz = Class.forName(aoMeta.getAdminObjectImplementationClass(), true, cl);
+ List<ConfigPropertyMetaData> configProperties = aoMeta.getConfigProps();
+
+ ValidateClass vc = new ValidateClass(Key.ADMIN_OBJECT, clazz, configProperties);
+ result.add(vc);
+ }
+ catch (ClassNotFoundException e)
+ {
+ Failure failure = new Failure(Severity.ERROR,
+ rb.getString("uncategorized"),
+ rb.getString("ao.cnfe"),
+ e.getMessage());
+ failures.add(failure);
+ }
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Validator standalone tool
+ *
+ * @param args command line arguments
+ */
+ public static void main(String[] args)
+ {
+ boolean quite = false;
+ String outputDir = "."; //put report into current directory by default
+ int arg = 0;
+
+ if (args.length > 0)
+ {
+ while (args.length > arg + 1)
+ {
+ if (args[arg].startsWith("-"))
+ {
+ if (args[arg].endsWith("quite"))
+ {
+ quite = true;
+ }
+ else if (args[arg].endsWith("output"))
+ {
+ arg++;
+ if (arg + 1 >= args.length)
+ {
+ usage();
+ System.exit(OTHER);
+ }
+ outputDir = args[arg];
+ }
+ }
+ else
+ {
+ usage();
+ System.exit(OTHER);
+ }
+ arg++;
+ }
+
+ try
+ {
+ int systemExitCode = validate(new File(args[arg]).toURI().toURL(), outputDir);
+
+ if (!quite && systemExitCode == FAIL)
+ {
+ System.out.println("Validation errors");
+ }
+ System.exit(systemExitCode);
+ }
+ catch (MalformedURLException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ else
+ {
+ usage();
+ }
+
+
+ }
+
+ /**
+ * Tool usage
+ */
+ private static void usage()
+ {
+ System.out.println("Usage: validator [-quite] [-output directory] <file>");
+ }
+
+
+ /**
+ * Extract a JAR type file
+ * @param file The file
+ * @param directory The directory where the file should be extracted
+ * @return The root of the extracted JAR file
+ * @exception IOException Thrown if an error occurs
+ */
+ private static File extract(File file, File directory) throws IOException
+ {
+ if (file == null)
+ throw new IllegalArgumentException("File is null");
+
+ if (directory == null)
+ throw new IllegalArgumentException("Directory is null");
+
+ File target = new File(directory, file.getName());
+
+ if (target.exists())
+ recursiveDelete(target);
+
+ if (!target.mkdirs())
+ throw new IOException("Could not create " + target);
+
+ JarFile jar = new JarFile(file);
+ Enumeration<JarEntry> entries = jar.entries();
+
+ while (entries.hasMoreElements())
+ {
+ JarEntry je = entries.nextElement();
+ File copy = new File(target, je.getName());
+
+ if (!je.isDirectory())
+ {
+ InputStream in = null;
+ OutputStream out = null;
+
+ // Make sure that the directory is _really_ there
+ if (copy.getParentFile() != null && !copy.getParentFile().exists())
+ {
+ if (!copy.getParentFile().mkdirs())
+ throw new IOException("Could not create " + copy.getParentFile());
+ }
+
+ try
+ {
+ in = new BufferedInputStream(jar.getInputStream(je));
+ out = new BufferedOutputStream(new FileOutputStream(copy));
+
+ byte[] buffer = new byte[4096];
+ for (;;)
+ {
+ int nBytes = in.read(buffer);
+ if (nBytes <= 0)
+ break;
+
+ out.write(buffer, 0, nBytes);
+ }
+ out.flush();
+ }
+ finally
+ {
+ try
+ {
+ if (out != null)
+ out.close();
+ }
+ catch (IOException ignore)
+ {
+ // Ignore
+ }
+
+ try
+ {
+ if (in != null)
+ in.close();
+ }
+ catch (IOException ignore)
+ {
+ // Ignore
+ }
+ }
+ }
+ else
+ {
+ if (!copy.exists())
+ {
+ if (!copy.mkdirs())
+ throw new IOException("Could not create " + copy);
+ }
+ else
+ {
+ if (!copy.isDirectory())
+ throw new IOException(copy + " isn't a directory");
+ }
+ }
+ }
+
+ return target;
+ }
+
+
+ /**
+ * Recursive delete
+ * @param f The file handler
+ * @exception IOException Thrown if a file could not be deleted
+ */
+ private static void recursiveDelete(File f) throws IOException
+ {
+ if (f != null && f.exists())
+ {
+ File[] files = f.listFiles();
+ if (files != null)
+ {
+ for (int i = 0; i < files.length; i++)
+ {
+ if (files[i].isDirectory())
+ {
+ recursiveDelete(files[i]);
+ }
+ else
+ {
+ if (!files[i].delete())
+ throw new IOException("Could not delete " + files[i]);
+ }
+ }
+ }
+ if (!f.delete())
+ throw new IOException("Could not delete " + f);
+ }
+ }
+
+ /**
+ * Get the URLs for the directory and all libraries located in the directory
+ * @param directory The directory
+ * @return The URLs
+ * @exception MalformedURLException MalformedURLException
+ * @exception IOException IOException
+ */
+ private static 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 FilenameFilter()
+ {
+ /**
+ * Accept
+ * @param dir The directory
+ * @param name The name
+ * @return True if accepts; otherwise false
+ */
+ public boolean accept(File dir, String name)
+ {
+ return name.endsWith(".jar");
+ }
+ });
+
+ if (jars != null)
+ {
+ for (int j = 0; j < jars.length; j++)
+ {
+ list.add(jars[j].getCanonicalFile().toURI().toURL());
+ }
+ }
+ }
+ return list.toArray(new URL[list.size()]);
+ }
+}
Deleted: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Rule.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Rule.java 2010-02-25 04:49:55 UTC (rev 101443)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Rule.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,40 +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.deployers.common.validator;
-
-import java.util.List;
-import java.util.ResourceBundle;
-
-/**
- * Rule
- */
-public interface Rule
-{
- /**
- * Validate
- * @param v The object
- * @param rb The resource bundle
- * @return The list of failures found; <code>null</code> if none
- */
- public List<Failure> validate(Validate v, ResourceBundle rb);
-}
Copied: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Rule.java (from rev 101448, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Rule.java)
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Rule.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Rule.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,40 @@
+/*
+ * 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.validator;
+
+import java.util.List;
+import java.util.ResourceBundle;
+
+/**
+ * Rule
+ */
+public interface Rule
+{
+ /**
+ * Validate
+ * @param v The object
+ * @param rb The resource bundle
+ * @return The list of failures found; <code>null</code> if none
+ */
+ public List<Failure> validate(Validate v, ResourceBundle rb);
+}
Deleted: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/SecurityActions.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/SecurityActions.java 2010-02-25 04:49:55 UTC (rev 101443)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/SecurityActions.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,106 +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.deployers.common.validator;
-
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * 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 AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
- {
- public ClassLoader 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 a system property
- * @param name The property name
- * @return The property value
- */
- static String getSystemProperty(final String name)
- {
- return AccessController.doPrivileged(new PrivilegedAction<String>()
- {
- public String run()
- {
- return System.getProperty(name);
- }
- });
- }
-
- /**
- * 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 AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>()
- {
- public URLClassLoader run()
- {
- return new URLClassLoader(urls, parent);
- }
- });
- }
-}
Copied: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/SecurityActions.java (from rev 101448, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/SecurityActions.java)
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/SecurityActions.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/SecurityActions.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,106 @@
+/*
+ * 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.validator;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * 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 AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader 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 a system property
+ * @param name The property name
+ * @return The property value
+ */
+ static String getSystemProperty(final String name)
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<String>()
+ {
+ public String run()
+ {
+ return System.getProperty(name);
+ }
+ });
+ }
+
+ /**
+ * 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 AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>()
+ {
+ public URLClassLoader run()
+ {
+ return new URLClassLoader(urls, parent);
+ }
+ });
+ }
+}
Deleted: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Severity.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Severity.java 2010-02-25 04:49:55 UTC (rev 101443)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Severity.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,42 +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.deployers.common.validator;
-
-/**
- * Severity
- */
-public class Severity
-{
- /** WARNING */
- public static final int WARNING = 0;
-
- /** ERROR */
- public static final int ERROR = 1;
-
- /**
- * Constructor
- */
- private Severity()
- {
- }
-}
Copied: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Severity.java (from rev 101448, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Severity.java)
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Severity.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Severity.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,42 @@
+/*
+ * 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.validator;
+
+/**
+ * Severity
+ */
+public class Severity
+{
+ /** WARNING */
+ public static final int WARNING = 0;
+
+ /** ERROR */
+ public static final int ERROR = 1;
+
+ /**
+ * Constructor
+ */
+ private Severity()
+ {
+ }
+}
Deleted: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validate.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Validate.java 2010-02-25 04:49:55 UTC (rev 101443)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validate.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,41 +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.deployers.common.validator;
-
-/**
- * Validate. interface
- */
-public interface Validate
-{
- /**
- * Get the key
- * @return The key
- */
- public int getKey();
-
- /**
- * Get the class
- * @return The class
- */
- public Class<?> getClazz();
-}
Copied: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validate.java (from rev 101448, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Validate.java)
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validate.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validate.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,41 @@
+/*
+ * 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.validator;
+
+/**
+ * Validate. interface
+ */
+public interface Validate
+{
+ /**
+ * Get the key
+ * @return The key
+ */
+ public int getKey();
+
+ /**
+ * Get the class
+ * @return The class
+ */
+ public Class<?> getClazz();
+}
Deleted: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateClass.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/ValidateClass.java 2010-02-25 04:49:55 UTC (rev 101443)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateClass.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,94 +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.deployers.common.validator;
-
-import java.util.List;
-
-import org.jboss.metadata.rar.spec.ConfigPropertyMetaData;
-
-/**
- * ValidateClass for objects that should be validated
- */
-public class ValidateClass implements Validate
-{
- /** Key */
- private int key;
-
- /** config-property */
- private List<ConfigPropertyMetaData> configProperties;
-
- /** Clazz */
- private Class<?> clazz;
-
- /**
- * Constructor
- * @param key The key
- * @param clazz The class
- */
- public ValidateClass(int key,
- Class<?> clazz)
- {
- this(key, clazz, null);
- }
-
- /**
- * Constructor
- * @param key The key
- * @param clazz The class
- * @param configProperties The list of config property metadata
- */
- public ValidateClass(int key,
- Class<?> clazz,
- List<ConfigPropertyMetaData> configProperties)
- {
- this.key = key;
- this.clazz = clazz;
- this.configProperties = configProperties;
- }
-
- /**
- * Get the key
- * @return The key
- */
- public int getKey()
- {
- return key;
- }
-
- /**
- * Get the clazz
- * @return The clazz
- */
- public Class<?> getClazz()
- {
- return clazz;
- }
-
- /**
- * Get the list of config properties
- * @return The list
- */
- public List<ConfigPropertyMetaData> getConfigProperties()
- {
- return configProperties;
- }
-}
Copied: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateClass.java (from rev 101448, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/ValidateClass.java)
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateClass.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateClass.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,94 @@
+/*
+ * 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.validator;
+
+import java.util.List;
+
+import org.jboss.metadata.rar.spec.ConfigPropertyMetaData;
+
+/**
+ * ValidateClass for objects that should be validated
+ */
+public class ValidateClass implements Validate
+{
+ /** Key */
+ private int key;
+
+ /** config-property */
+ private List<ConfigPropertyMetaData> configProperties;
+
+ /** Clazz */
+ private Class<?> clazz;
+
+ /**
+ * Constructor
+ * @param key The key
+ * @param clazz The class
+ */
+ public ValidateClass(int key,
+ Class<?> clazz)
+ {
+ this(key, clazz, null);
+ }
+
+ /**
+ * Constructor
+ * @param key The key
+ * @param clazz The class
+ * @param configProperties The list of config property metadata
+ */
+ public ValidateClass(int key,
+ Class<?> clazz,
+ List<ConfigPropertyMetaData> configProperties)
+ {
+ this.key = key;
+ this.clazz = clazz;
+ this.configProperties = configProperties;
+ }
+
+ /**
+ * Get the key
+ * @return The key
+ */
+ public int getKey()
+ {
+ return key;
+ }
+
+ /**
+ * Get the clazz
+ * @return The clazz
+ */
+ public Class<?> getClazz()
+ {
+ return clazz;
+ }
+
+ /**
+ * Get the list of config properties
+ * @return The list
+ */
+ public List<ConfigPropertyMetaData> getConfigProperties()
+ {
+ return configProperties;
+ }
+}
Deleted: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateObject.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/ValidateObject.java 2010-02-25 04:49:55 UTC (rev 101443)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateObject.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,71 +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.deployers.common.validator;
-
-import java.util.List;
-
-import org.jboss.metadata.rar.spec.ConfigPropertyMetaData;
-
-/**
- * Object wrapper for objects that should be validated
- */
-public class ValidateObject extends ValidateClass
-{
- /** Onject */
- private Object object;
-
- /**
- * Constructor
- * @param key The key
- * @param object The key
- */
- public ValidateObject(int key,
- Object object)
- {
- this(key, object, null);
- }
-
- /**
- * Constructor
- * @param key The key
- * @param object The key
- * @param configProperties The list of config property metadata
- */
- public ValidateObject(int key,
- Object object,
- List<ConfigPropertyMetaData> configProperties)
- {
- super(key, object.getClass(), configProperties);
- this.object = object;
- }
-
- /**
- * Get the object
- * @return The object
- */
- public Object getObject()
- {
- return object;
- }
-
-}
Copied: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateObject.java (from rev 101448, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/ValidateObject.java)
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateObject.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/ValidateObject.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,71 @@
+/*
+ * 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.validator;
+
+import java.util.List;
+
+import org.jboss.metadata.rar.spec.ConfigPropertyMetaData;
+
+/**
+ * Object wrapper for objects that should be validated
+ */
+public class ValidateObject extends ValidateClass
+{
+ /** Onject */
+ private Object object;
+
+ /**
+ * Constructor
+ * @param key The key
+ * @param object The key
+ */
+ public ValidateObject(int key,
+ Object object)
+ {
+ this(key, object, null);
+ }
+
+ /**
+ * Constructor
+ * @param key The key
+ * @param object The key
+ * @param configProperties The list of config property metadata
+ */
+ public ValidateObject(int key,
+ Object object,
+ List<ConfigPropertyMetaData> configProperties)
+ {
+ super(key, object.getClass(), configProperties);
+ this.object = object;
+ }
+
+ /**
+ * Get the object
+ * @return The object
+ */
+ public Object getObject()
+ {
+ return object;
+ }
+
+}
Deleted: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validator.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Validator.java 2010-02-25 04:49:55 UTC (rev 101443)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validator.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,142 +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.deployers.common.validator;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-/**
- * Validator
- */
-public class Validator
-{
- /**
- * The fully qualified class name of the rules
- * as we may want to externalize them into a
- * properties file
- */
- private static final String[] CLASS_RULES = {
- "org.jboss.jca.deployers.common.validator.rules.mcf.MCF",
- "org.jboss.jca.deployers.common.validator.rules.mcf.MCFConstructor",
- "org.jboss.jca.deployers.common.validator.rules.mcf.MCFHashCode",
- "org.jboss.jca.deployers.common.validator.rules.mcf.MCFEquals",
- "org.jboss.jca.deployers.common.validator.rules.mcf.MCFConfigProperties",
- "org.jboss.jca.deployers.common.validator.rules.mc.MC",
- "org.jboss.jca.deployers.common.validator.rules.mc.MCGetMetaData",
- "org.jboss.jca.deployers.common.validator.rules.ra.RANull",
- "org.jboss.jca.deployers.common.validator.rules.ra.RA",
- "org.jboss.jca.deployers.common.validator.rules.ra.RAConstructor",
- "org.jboss.jca.deployers.common.validator.rules.ra.RAHashCode",
- "org.jboss.jca.deployers.common.validator.rules.ra.RAEquals",
- "org.jboss.jca.deployers.common.validator.rules.ra.RAConfigProperties",
- "org.jboss.jca.deployers.common.validator.rules.cf.CFNull",
- "org.jboss.jca.deployers.common.validator.rules.cf.CFSerializable",
- "org.jboss.jca.deployers.common.validator.rules.cf.CFReferenceable",
- "org.jboss.jca.deployers.common.validator.rules.as.ASConstructor",
- "org.jboss.jca.deployers.common.validator.rules.as.ASConfigProperties",
- "org.jboss.jca.deployers.common.validator.rules.ao.AOConstructor",
- "org.jboss.jca.deployers.common.validator.rules.ao.AOConfigProperties"
- };
-
- private static final String[] OBJECT_RULES = {
- "org.jboss.jca.deployers.common.validator.rules.mc.MCGetMetaData",
- };
-
- private static String[] allRules;
- static
- {
- List<String> arrayList = new ArrayList<String>();
- arrayList.addAll(Arrays.asList(CLASS_RULES));
- arrayList.addAll(Arrays.asList(OBJECT_RULES));
- allRules = arrayList.toArray(new String[CLASS_RULES.length + OBJECT_RULES.length]);
- };
-
- /**
- * Constructor
- */
- public Validator()
- {
- }
-
- /**
- * Get the resource bundle
- * @return The resource bundle
- */
- public ResourceBundle getResourceBundle()
- {
- return ResourceBundle.getBundle("validator", Locale.US, Validator.class.getClassLoader());
- }
-
- /**
- * Validate
- * @param objects Objects that should be validated
- * @return The list of failures; <code>null</code> if no errors
- */
- public List<Failure> validate(Validate[] objects)
- {
- if (objects == null || objects.length == 0)
- return null;
-
- List<Rule> rules = new ArrayList<Rule>(allRules.length);
-
- for (int i = 0; i < allRules.length; i++)
- {
- try
- {
- Class clz = Class.forName(allRules[i], true, Validator.class.getClassLoader());
- Rule rule = (Rule)clz.newInstance();
-
- rules.add(rule);
- }
- catch (Throwable t)
- {
- throw new IllegalArgumentException(allRules[i], t);
- }
- }
-
- ResourceBundle resourceBundle = getResourceBundle();
-
- List<Failure> result = null;
-
- for (Rule rule : rules)
- {
- for (Validate obj : objects)
- {
- List<Failure> failures = rule.validate(obj, resourceBundle);
-
- if (failures != null)
- {
- if (result == null)
- result = new ArrayList<Failure>();
-
- result.addAll(failures);
- }
- }
- }
-
- return result;
- }
-}
Copied: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validator.java (from rev 101448, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/Validator.java)
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validator.java (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/Validator.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,142 @@
+/*
+ * 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.validator;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * Validator
+ */
+public class Validator
+{
+ /**
+ * The fully qualified class name of the rules
+ * as we may want to externalize them into a
+ * properties file
+ */
+ private static final String[] CLASS_RULES = {
+ "org.jboss.jca.validator.rules.mcf.MCF",
+ "org.jboss.jca.validator.rules.mcf.MCFConstructor",
+ "org.jboss.jca.validator.rules.mcf.MCFHashCode",
+ "org.jboss.jca.validator.rules.mcf.MCFEquals",
+ "org.jboss.jca.validator.rules.mcf.MCFConfigProperties",
+ "org.jboss.jca.validator.rules.mc.MC",
+ "org.jboss.jca.validator.rules.mc.MCGetMetaData",
+ "org.jboss.jca.validator.rules.ra.RANull",
+ "org.jboss.jca.validator.rules.ra.RA",
+ "org.jboss.jca.validator.rules.ra.RAConstructor",
+ "org.jboss.jca.validator.rules.ra.RAHashCode",
+ "org.jboss.jca.validator.rules.ra.RAEquals",
+ "org.jboss.jca.validator.rules.ra.RAConfigProperties",
+ "org.jboss.jca.validator.rules.cf.CFNull",
+ "org.jboss.jca.validator.rules.cf.CFSerializable",
+ "org.jboss.jca.validator.rules.cf.CFReferenceable",
+ "org.jboss.jca.validator.rules.as.ASConstructor",
+ "org.jboss.jca.validator.rules.as.ASConfigProperties",
+ "org.jboss.jca.validator.rules.ao.AOConstructor",
+ "org.jboss.jca.validator.rules.ao.AOConfigProperties"
+ };
+
+ private static final String[] OBJECT_RULES = {
+ "org.jboss.jca.validator.rules.mc.MCGetMetaData",
+ };
+
+ private static String[] allRules;
+ static
+ {
+ List<String> arrayList = new ArrayList<String>();
+ arrayList.addAll(Arrays.asList(CLASS_RULES));
+ arrayList.addAll(Arrays.asList(OBJECT_RULES));
+ allRules = arrayList.toArray(new String[CLASS_RULES.length + OBJECT_RULES.length]);
+ };
+
+ /**
+ * Constructor
+ */
+ public Validator()
+ {
+ }
+
+ /**
+ * Get the resource bundle
+ * @return The resource bundle
+ */
+ public ResourceBundle getResourceBundle()
+ {
+ return ResourceBundle.getBundle("validator", Locale.US, Validator.class.getClassLoader());
+ }
+
+ /**
+ * Validate
+ * @param objects Objects that should be validated
+ * @return The list of failures; <code>null</code> if no errors
+ */
+ public List<Failure> validate(Validate[] objects)
+ {
+ if (objects == null || objects.length == 0)
+ return null;
+
+ List<Rule> rules = new ArrayList<Rule>(allRules.length);
+
+ for (int i = 0; i < allRules.length; i++)
+ {
+ try
+ {
+ Class clz = Class.forName(allRules[i], true, Validator.class.getClassLoader());
+ Rule rule = (Rule)clz.newInstance();
+
+ rules.add(rule);
+ }
+ catch (Throwable t)
+ {
+ throw new IllegalArgumentException(allRules[i], t);
+ }
+ }
+
+ ResourceBundle resourceBundle = getResourceBundle();
+
+ List<Failure> result = null;
+
+ for (Rule rule : rules)
+ {
+ for (Validate obj : objects)
+ {
+ List<Failure> failures = rule.validate(obj, resourceBundle);
+
+ if (failures != null)
+ {
+ if (result == null)
+ result = new ArrayList<Failure>();
+
+ result.addAll(failures);
+ }
+ }
+ }
+
+ return result;
+ }
+}
Deleted: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/package.html
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/package.html 2010-02-25 04:49:55 UTC (rev 101443)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/package.html 2010-02-25 07:18:02 UTC (rev 101449)
@@ -1,3 +0,0 @@
-<body>
-This package contains the specification validator module
-</body>
Copied: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/package.html (from rev 101448, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/package.html)
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/package.html (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/package.html 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,3 @@
+<body>
+This package contains the specification validator module
+</body>
Copied: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules (from rev 101448, projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules)
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ao/AOConfigProperties.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/ao/AOConfigProperties.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ao/AOConfigProperties.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,14 +20,14 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.ao;
+package org.jboss.jca.validator.rules.ao;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
-import org.jboss.jca.deployers.common.validator.ValidateClass;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
+import org.jboss.jca.validator.ValidateClass;
import java.lang.reflect.Method;
import java.util.ArrayList;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ao/AOConstructor.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/ao/AOConstructor.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ao/AOConstructor.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,13 +20,13 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.ao;
+package org.jboss.jca.validator.rules.ao;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
import java.util.ArrayList;
import java.util.List;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/as/ASConfigProperties.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/as/ASConfigProperties.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/as/ASConfigProperties.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,14 +20,14 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.as;
+package org.jboss.jca.validator.rules.as;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
-import org.jboss.jca.deployers.common.validator.ValidateClass;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
+import org.jboss.jca.validator.ValidateClass;
import java.lang.reflect.Method;
import java.util.ArrayList;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/as/ASConstructor.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/as/ASConstructor.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/as/ASConstructor.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,13 +20,13 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.as;
+package org.jboss.jca.validator.rules.as;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
import java.util.ArrayList;
import java.util.List;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/cf/CFNull.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/CFNull.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/cf/CFNull.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,13 +20,13 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.cf;
+package org.jboss.jca.validator.rules.cf;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
import java.util.ArrayList;
import java.util.List;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/cf/CFReferenceable.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/CFReferenceable.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/cf/CFReferenceable.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,13 +20,13 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.cf;
+package org.jboss.jca.validator.rules.cf;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
import java.util.ArrayList;
import java.util.List;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/cf/CFSerializable.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/cf/CFSerializable.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/cf/CFSerializable.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,13 +20,13 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.cf;
+package org.jboss.jca.validator.rules.cf;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
import java.io.Serializable;
import java.util.ArrayList;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mc/MC.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mc/MC.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mc/MC.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,13 +20,13 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.mc;
+package org.jboss.jca.validator.rules.mc;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
import java.util.ArrayList;
import java.util.List;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mc/MCGetMetaData.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mc/MCGetMetaData.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mc/MCGetMetaData.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,14 +20,14 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.mc;
+package org.jboss.jca.validator.rules.mc;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
-import org.jboss.jca.deployers.common.validator.ValidateObject;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
+import org.jboss.jca.validator.ValidateObject;
import java.lang.reflect.Method;
import java.util.ArrayList;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCF.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCF.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCF.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,13 +20,13 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.mcf;
+package org.jboss.jca.validator.rules.mcf;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
import java.util.ArrayList;
import java.util.List;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFConfigProperties.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCFConfigProperties.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFConfigProperties.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,14 +20,14 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.mcf;
+package org.jboss.jca.validator.rules.mcf;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
-import org.jboss.jca.deployers.common.validator.ValidateClass;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
+import org.jboss.jca.validator.ValidateClass;
import java.lang.reflect.Method;
import java.util.ArrayList;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFConstructor.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCFConstructor.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFConstructor.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,13 +20,13 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.mcf;
+package org.jboss.jca.validator.rules.mcf;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
import java.util.ArrayList;
import java.util.List;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFEquals.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCFEquals.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFEquals.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,13 +20,13 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.mcf;
+package org.jboss.jca.validator.rules.mcf;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
import java.lang.reflect.Method;
import java.util.ArrayList;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFHashCode.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/mcf/MCFHashCode.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/mcf/MCFHashCode.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,13 +20,13 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.mcf;
+package org.jboss.jca.validator.rules.mcf;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
import java.lang.reflect.Method;
import java.util.ArrayList;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RA.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/ra/RA.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RA.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,13 +20,13 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.ra;
+package org.jboss.jca.validator.rules.ra;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
import java.util.ArrayList;
import java.util.List;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RAConfigProperties.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/ra/RAConfigProperties.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RAConfigProperties.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,14 +20,14 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.ra;
+package org.jboss.jca.validator.rules.ra;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
-import org.jboss.jca.deployers.common.validator.ValidateClass;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
+import org.jboss.jca.validator.ValidateClass;
import java.lang.reflect.Method;
import java.util.ArrayList;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RAConstructor.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/ra/RAConstructor.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RAConstructor.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,13 +20,13 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.ra;
+package org.jboss.jca.validator.rules.ra;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
import java.util.ArrayList;
import java.util.List;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RAEquals.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/ra/RAEquals.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RAEquals.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,13 +20,13 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.ra;
+package org.jboss.jca.validator.rules.ra;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
import java.lang.reflect.Method;
import java.util.ArrayList;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RAHashCode.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/ra/RAHashCode.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RAHashCode.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,13 +20,13 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.ra;
+package org.jboss.jca.validator.rules.ra;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
import java.lang.reflect.Method;
import java.util.ArrayList;
Modified: projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RANull.java
===================================================================
--- projects/jboss-jca/trunk/deployers/src/main/java/org/jboss/jca/deployers/common/validator/rules/ra/RANull.java 2010-02-25 07:04:57 UTC (rev 101448)
+++ projects/jboss-jca/trunk/validator/src/main/java/org/jboss/jca/validator/rules/ra/RANull.java 2010-02-25 07:18:02 UTC (rev 101449)
@@ -20,13 +20,13 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.jca.deployers.common.validator.rules.ra;
+package org.jboss.jca.validator.rules.ra;
-import org.jboss.jca.deployers.common.validator.Failure;
-import org.jboss.jca.deployers.common.validator.Key;
-import org.jboss.jca.deployers.common.validator.Rule;
-import org.jboss.jca.deployers.common.validator.Severity;
-import org.jboss.jca.deployers.common.validator.Validate;
+import org.jboss.jca.validator.Failure;
+import org.jboss.jca.validator.Key;
+import org.jboss.jca.validator.Rule;
+import org.jboss.jca.validator.Severity;
+import org.jboss.jca.validator.Validate;
import java.util.ArrayList;
import java.util.List;
Added: projects/jboss-jca/trunk/validator/src/main/resources/validator-cli-manifest.mf
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/resources/validator-cli-manifest.mf (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/resources/validator-cli-manifest.mf 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,6 @@
+Implementation-Title: JBoss JCA Validator Command Line Tool
+Implementation-Vendor: Red Hat Middleware LLC
+Implementation-Vendor-Id: org.jboss
+Implementation-Version: 0.1
+Main-Class: org.jboss.jca.validator.Main
+Class-Path: jbossxb.jar jboss-logging-spi.jar jboss-common-core.jar jboss-metadata-rar.jar jboss-metadata-common.jar jboss-reflect.jar jboss-mdr.jar jboss-jca-spec-api.jar papaki-core.jar javassist.jar jboss-jca-common-impl.jar jboss-jca-validator.jar
Copied: projects/jboss-jca/trunk/validator/src/main/resources/validator-manifest.mf (from rev 101443, projects/jboss-jca/trunk/deployers/src/main/resources/validator-manifest.mf)
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/resources/validator-manifest.mf (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/resources/validator-manifest.mf 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,4 @@
+Implementation-Title: JBoss JCA Validator
+Implementation-Vendor: Red Hat Middleware LLC
+Implementation-Vendor-Id: org.jboss
+Implementation-Version: 0.1
Copied: projects/jboss-jca/trunk/validator/src/main/resources/validator.properties (from rev 101443, projects/jboss-jca/trunk/deployers/src/main/resources/validator.properties)
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/resources/validator.properties (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/resources/validator.properties 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,31 @@
+severity=Severity
+severity.warn=WARNING
+severity.error=ERROR
+section=Section
+description=Description
+code=Code
+uncategorized=Uncategorized
+mcf.cnfe=ClassNotFoundException during ManagedConnectionFactory creation
+mcf.MCF=The class must implement the javax.resource.spi.ManagedConnectionFactory interface.
+mcf.MCFConfigProperties=Invalid config-property-type for ManagedConnectionFactory.
+mcf.MCFConstructor=A ManagedConnectionFactory must have a default constructor
+mcf.MCFEquals=A ManagedConnectionFactory must implement a "public boolean equals(Object)" method.
+mcf.MCFHashCode=A ManagedConnectionFactory must implement a "public int hashCode()" method.
+mc.MC=The class must provide an implementation of the ManagedConnection interface.
+mc.MCGetMetaData=ManagedConnection.getMetaData() must return a javax.resource.spi.ManagedConnectionMetaData instance
+ra.cnfe=ClassNotFoundException during ResourceAdapter creation
+ra.RA=A ResourceAdapter must implement the javax.resource.spi.ResourceAdapter interface.
+ra.RAConfigProperties=Invalid config-property-type for ResourceAdapter.
+ra.RAConstructor=A ResourceAdapter must have a default constructor
+ra.RAEquals=A ResourceAdapter must implement a "public boolean equals(Object)" method.
+ra.RAHashCode=A ResourceAdapter must implement a "public int hashCode()" method.
+ra.RANull=A ResourceAdapter must be a non-null instance.
+cf.CFNull=ConnectionFactory must be a non-null value
+cf.CFSerializable=ConnectionFactory must implement java.io.Serializable
+cf.CFReferenceable=ConnectionFactory must implement javax.resource.Referenceable
+as.cnfe=ClassNotFoundException during ActivationSpec creation
+as.ASConstructor=An ActivationSpec must have a default constructor
+as.ASConfigProperties=Invalid config-property-type for ActivationSpec.
+ao.cnfe=ClassNotFoundException during AdminObject creation
+ao.AOConstructor=An AdminObject must have a default constructor
+ao.AOConfigProperties=Invalid config-property-type for AdminObject.
Copied: projects/jboss-jca/trunk/validator/src/main/resources/validator.sh (from rev 101443, projects/jboss-jca/trunk/deployers/src/main/resources/validator.sh)
===================================================================
--- projects/jboss-jca/trunk/validator/src/main/resources/validator.sh (rev 0)
+++ projects/jboss-jca/trunk/validator/src/main/resources/validator.sh 2010-02-25 07:18:02 UTC (rev 101449)
@@ -0,0 +1,3 @@
+#!/bin/sh
+java -jar jboss-jca-validator-cli.jar $*
+
More information about the jboss-cvs-commits
mailing list