[jboss-cvs] JBossAS SVN: r112617 - in projects/jboss-jca/branches/Branch_1_0: deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16outnora and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 6 09:51:16 EST 2012


Author: jesper.pedersen
Date: 2012-02-06 09:51:15 -0500 (Mon, 06 Feb 2012)
New Revision: 112617

Removed:
   projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16outnora/TestResourceAdapter.java
Modified:
   projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common/annotations/Annotations.java
   projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16outnora/TestManagedConnectionFactory.java
Log:
[JBJCA-742] Annotation based resource adapter without @Connector fails

Modified: projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common/annotations/Annotations.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common/annotations/Annotations.java	2012-02-06 14:48:26 UTC (rev 112616)
+++ projects/jboss-jca/branches/Branch_1_0/common/src/main/java/org/jboss/jca/common/annotations/Annotations.java	2012-02-06 14:51:15 UTC (rev 112617)
@@ -261,6 +261,10 @@
             }
          }
       }
+      else
+      {
+         connector = attachConnector(null, null, connectionDefinitions, null, inboundResourceadapter, adminObjs);
+      }
 
       return connector;
    }
@@ -282,11 +286,13 @@
       throws Exception
    {
       // Vendor name
-      XsdString vendorName = new XsdString(conAnnotation.vendorName(), null);
+      XsdString vendorName = null;
+      if (conAnnotation != null)
+         vendorName = new XsdString(conAnnotation.vendorName(), null);
 
       // Description
       ArrayList<LocalizedXsdString> descriptions = null;
-      if (conAnnotation.description() != null && conAnnotation.description().length != 0)
+      if (conAnnotation != null && conAnnotation.description() != null && conAnnotation.description().length != 0)
       {
          descriptions = new ArrayList<LocalizedXsdString>(conAnnotation.description().length);
          for (String descriptionAnnoptation : conAnnotation.description())
@@ -297,7 +303,7 @@
 
       // Display name
       ArrayList<LocalizedXsdString> displayNames = null;
-      if (conAnnotation.description() != null && conAnnotation.displayName().length != 0)
+      if (conAnnotation != null && conAnnotation.description() != null && conAnnotation.displayName().length != 0)
       {
          displayNames = new ArrayList<LocalizedXsdString>(conAnnotation.displayName().length);
          for (String displayNameAnnotation : conAnnotation.displayName())
@@ -307,13 +313,16 @@
       }
 
       // EIS type
-      XsdString eisType = new XsdString(conAnnotation.eisType(), null);
+      XsdString eisType = null;
+      if (conAnnotation != null)
+         eisType = new XsdString(conAnnotation.eisType(), null);
 
       // License description
       // License required
       ArrayList<LocalizedXsdString> licenseDescriptions = null;
 
-      if (conAnnotation.licenseDescription() != null && conAnnotation.licenseDescription().length != 0)
+      if (conAnnotation != null && conAnnotation.licenseDescription() != null &&
+          conAnnotation.licenseDescription().length != 0)
       {
          licenseDescriptions = new ArrayList<LocalizedXsdString>(conAnnotation.licenseDescription().length);
          for (String licenseDescriptionAnnotation : conAnnotation.licenseDescription())
@@ -321,11 +330,17 @@
             licenseDescriptions.add(new LocalizedXsdString(licenseDescriptionAnnotation, null));
          }
       }
-      LicenseType license = new LicenseType(licenseDescriptions, conAnnotation.licenseRequired(), null);
+      LicenseType license = null;
+      if (conAnnotation != null)
+         license = new LicenseType(licenseDescriptions, conAnnotation.licenseRequired(), null);
 
       // RequiredWorkContext
       ArrayList<String> requiredWorkContexts = null;
-      Class<? extends WorkContext>[] requiredWorkContextAnnotations = conAnnotation.requiredWorkContexts();
+      Class<? extends WorkContext>[] requiredWorkContextAnnotations = null;
+
+      if (conAnnotation != null)
+         requiredWorkContextAnnotations = conAnnotation.requiredWorkContexts();
+
       if (requiredWorkContextAnnotations != null)
       {
          requiredWorkContexts = new ArrayList<String>(requiredWorkContextAnnotations.length);
@@ -345,8 +360,8 @@
       // Large icon
       // Small icon
       ArrayList<Icon> icons = null;
-      if ((conAnnotation.smallIcon() != null && conAnnotation.smallIcon().length != 0) ||
-            (conAnnotation.largeIcon() != null && conAnnotation.largeIcon().length != 0))
+      if (conAnnotation != null && ((conAnnotation.smallIcon() != null && conAnnotation.smallIcon().length != 0) ||
+                                    (conAnnotation.largeIcon() != null && conAnnotation.largeIcon().length != 0)))
       {
          icons = new ArrayList<Icon>(
                                      (conAnnotation.smallIcon() == null ? 0 : conAnnotation.smallIcon().length) +
@@ -362,15 +377,25 @@
       }
 
       // Transaction support
-      TransactionSupport.TransactionSupportLevel transactionSupportAnnotation = conAnnotation.transactionSupport();
+      TransactionSupport.TransactionSupportLevel transactionSupportAnnotation = null;
+
+      if (conAnnotation != null)
+         transactionSupportAnnotation = conAnnotation.transactionSupport();
+
+      if (transactionSupportAnnotation == null)
+         transactionSupportAnnotation = TransactionSupport.TransactionSupportLevel.NoTransaction;
+
       TransactionSupportEnum transactionSupport = TransactionSupportEnum.valueOf(transactionSupportAnnotation.name());
 
       // Reauthentication support
-      boolean reauthenticationSupport = conAnnotation.reauthenticationSupport();
+      boolean reauthenticationSupport = false;
+      if (conAnnotation != null)
+         reauthenticationSupport = conAnnotation.reauthenticationSupport();
 
       // AuthenticationMechanism
-      ArrayList<AuthenticationMechanism> authenticationMechanisms = processAuthenticationMechanism(conAnnotation
-            .authMechanisms());
+      ArrayList<AuthenticationMechanism> authenticationMechanisms = null;
+      if (conAnnotation != null)
+         authenticationMechanisms = processAuthenticationMechanism(conAnnotation.authMechanisms());
 
       OutboundResourceAdapter outboundResourceadapter = new OutboundResourceAdapterImpl(connectionDefinitions,
                                                                                         transactionSupport,
@@ -378,8 +403,9 @@
                                                                                         reauthenticationSupport, null);
 
       // Security permission
-      ArrayList<SecurityPermission> securityPermissions = processSecurityPermissions(conAnnotation
-            .securityPermissions());
+      ArrayList<SecurityPermission> securityPermissions = null;
+      if (conAnnotation != null)
+         securityPermissions = processSecurityPermissions(conAnnotation.securityPermissions());
 
       ResourceAdapter1516Impl resourceAdapter = new ResourceAdapter1516Impl(raClass, configProperties,
                                                                             outboundResourceadapter,

Modified: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16outnora/TestManagedConnectionFactory.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16outnora/TestManagedConnectionFactory.java	2012-02-06 14:48:26 UTC (rev 112616)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16outnora/TestManagedConnectionFactory.java	2012-02-06 14:51:15 UTC (rev 112617)
@@ -21,13 +21,24 @@
  */
 package org.jboss.jca.test.deployers.spec.rars.ra16outnora;
 
-import org.jboss.jca.test.deployers.spec.rars.BaseManagedConnectionFactory;
+import org.jboss.jca.test.deployers.spec.rars.BaseCciConnectionFactory;
+import org.jboss.jca.test.deployers.spec.rars.BaseConnectionManager;
 import org.jboss.jca.test.deployers.spec.rars.TestConnection;
 import org.jboss.jca.test.deployers.spec.rars.TestConnectionInterface;
 
+import java.io.PrintWriter;
+import java.util.Set;
+
+import javax.resource.ResourceException;
 import javax.resource.spi.ConnectionDefinition;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
 import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.security.auth.Subject;
 
+import org.jboss.logging.Logger;
+
 /**
  * TestManagedConnectionFactory
  * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
@@ -37,7 +48,122 @@
       connectionFactoryImpl = TestManagedConnection.class,
       connection = TestConnectionInterface.class,
       connectionImpl = TestConnection.class)
-public class TestManagedConnectionFactory extends BaseManagedConnectionFactory
+public class TestManagedConnectionFactory implements ManagedConnectionFactory
 {
    private static final long serialVersionUID = 1L;
+   private static Logger log = Logger.getLogger(TestManagedConnectionFactory.class);
+   private PrintWriter logwriter;
+
+   /**
+    * Constructor
+    */
+   public TestManagedConnectionFactory()
+   {
+      logwriter = null;
+   }
+
+   /**
+    * Creates a Connection Factory instance. 
+    *
+    *  @param    cxManager    ConnectionManager to be associated with created EIS connection factory instance
+    *  @return   EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
+    *  @throws   ResourceException     Generic exception
+    */
+   public Object createConnectionFactory(ConnectionManager cxManager) throws ResourceException
+   {
+      log.debug("call createConnectionFactory");
+      return new BaseCciConnectionFactory();
+   }
+
+   /**
+    * Creates a Connection Factory instance. 
+    *
+    *  @return   EIS-specific Connection Factory instance or javax.resource.cci.ConnectionFactory instance
+    *  @throws   ResourceException     Generic exception
+    */
+   public Object createConnectionFactory() throws ResourceException
+   {
+      log.debug("call createConnectionFactory");
+      return createConnectionFactory(new BaseConnectionManager());
+   }
+
+   /** 
+    * Creates a new physical connection to the underlying EIS resource manager.
+    *
+    *  @param   subject        Caller's security information
+    *  @param   cxRequestInfo  Additional resource adapter specific connection request information
+    *  @throws  ResourceException     generic exception
+    *  @return  ManagedConnection instance
+    */
+   public ManagedConnection createManagedConnection(Subject subject,
+                                                    ConnectionRequestInfo cxRequestInfo) 
+      throws ResourceException
+   {
+      log.debug("call createManagedConnection");
+      return null;
+   }
+
+   /** 
+    * Returns a matched connection from the candidate set of connections. 
+    *  @param   connectionSet   candidate connection set
+    *  @param   subject         caller's security information
+    *  @param   cxRequestInfo   additional resource adapter specific connection request information  
+    *
+    *  @throws  ResourceException     generic exception
+    *  @return  ManagedConnection     if resource adapter finds an acceptable match otherwise null
+    **/
+   public ManagedConnection matchManagedConnections(Set connectionSet,
+                                                    Subject subject, 
+                                                    ConnectionRequestInfo cxRequestInfo)
+      throws ResourceException
+   {
+      log.debug("call matchManagedConnections");
+      return null;
+   }
+
+   /** 
+    * Get the log writer for this ManagedConnectionFactory instance.
+    *  @return  PrintWriter
+    *  @throws  ResourceException     generic exception
+    */
+   public PrintWriter getLogWriter() throws ResourceException
+   {
+      log.debug("call getLogWriter");
+      return logwriter;
+   }
+
+   /** 
+    * Set the log writer for this ManagedConnectionFactory instance.</p>
+    *
+    *  @param   out PrintWriter - an out stream for error logging and tracing
+    *  @throws  ResourceException     generic exception
+    */
+   public void setLogWriter(PrintWriter out) throws ResourceException
+   {
+      log.debug("call setLogWriter");
+      logwriter = out;
+   }
+
+   /**
+    * Hash code
+    * @return The hash
+    */
+   @Override
+   public int hashCode()
+   {
+      return 42;
+   }
+
+   /**
+    * Equals
+    * @param other The other object
+    * @return True if equal; otherwise false
+    */
+   public boolean equals(Object other)
+   {
+      if (other == null)
+         return false;
+
+      return getClass().equals(other.getClass());
+   }
 }

Deleted: projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16outnora/TestResourceAdapter.java
===================================================================
--- projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16outnora/TestResourceAdapter.java	2012-02-06 14:48:26 UTC (rev 112616)
+++ projects/jboss-jca/branches/Branch_1_0/deployers/src/test/java/org/jboss/jca/test/deployers/spec/rars/ra16outnora/TestResourceAdapter.java	2012-02-06 14:51:15 UTC (rev 112617)
@@ -1,43 +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.test.deployers.spec.rars.ra16outnora;
-
-import org.jboss.jca.test.deployers.spec.rars.BaseResourceAdapter;
-
-import javax.resource.spi.Connector;
-import javax.resource.spi.TransactionSupport;
-
-/**
- * TestResourceAdapter
- * @author <a href="mailto:jeff.zhang at jboss.org">Jeff Zhang</a>
- * @version $Revision: $
- */
- at Connector(
-      vendorName = "Red Hat Middleware LLC",
-      eisType = "Test RA",
-      version = "0.1",
-      transactionSupport = TransactionSupport.TransactionSupportLevel.LocalTransaction,
-      reauthenticationSupport = false)
-public class TestResourceAdapter extends BaseResourceAdapter
-{
-
-}



More information about the jboss-cvs-commits mailing list