Package org.jboss.jca.common.api.metadata.spec

Examples of org.jboss.jca.common.api.metadata.spec.ResourceAdapter


        
         out.println("Archive:\t" + archiveFile);
        
         String version;
         String type = "";
         ResourceAdapter ra = connector.getResourceadapter();
         boolean reauth = false;
         if (connector.getVersion() == Version.V_10)
         {
            version = "1.0";
            type = "OutBound";
            reauth = ra.getOutboundResourceadapter().getReauthenticationSupport();
         }
         else
         {
            if (connector.getVersion() == Version.V_15)
               version = "1.5";
            else if (connector.getVersion() == Version.V_16)
               version = "1.6";
            else
               version = "1.7";
            if (ra.getOutboundResourceadapter() != null)
            {
               reauth = ra.getOutboundResourceadapter().getReauthenticationSupport();
               if (ra.getInboundResourceadapter() != null &&
                   ra.getInboundResourceadapter().getMessageadapter() != null &&
                   ra.getInboundResourceadapter().getMessageadapter().getMessagelisteners() != null &&
                   ra.getInboundResourceadapter().getMessageadapter().getMessagelisteners().size() > 0)
                  type = "Bidirectional";
               else
                  type = "OutBound";
            }
            else
            {
               if (ra.getInboundResourceadapter() != null)
                  type = "InBound";
               else
               {
                  out.println("Rar file has problem");
                  System.exit(ERROR);
               }
            }
         }
         out.println("JCA version:\t" + version);
         out.println("Type:\t\t" + type);
        
         out.print("Reauth:\t\t");
         if (reauth)
            out.println("Yes");
         else
            out.println("No");

         int systemExitCode = Validation.validate(new File(rarFile).toURI().toURL(), ".", cps);
        
         String compliant;
         if (systemExitCode == SUCCESS)
            compliant = "Yes";
         else
            compliant = "No";
         out.println("Compliant:\t" + compliant);

         out.print("Native:\t\t");
         if (exsitNativeFile)
            out.println("Yes");
         else
            out.println("No");
        
         Collections.sort(names);
        
         out.println();
         out.println("Structure:");
         out.println("----------");
         for (String name : names)
         {
            out.println(name);
         }
        
         String mcfClassName = "";
         Map<String, String> raConfigProperties = null;
         TransactionSupportEnum transSupport = TransactionSupportEnum.NoTransaction;
         List<AdminObject> adminObjects = null;
         List<ConnectionDefinition> connDefs = null;

         SecurityImpl secImpl = new SecurityImpl("", "", true);
         PoolImpl poolImpl = new PoolImpl(0, null, 10, Defaults.PREFILL, Defaults.USE_STRICT_MIN,
                                          Defaults.FLUSH_STRATEGY, null);
         XaPoolImpl xaPoolImpl = new XaPoolImpl(0, null, 10, Defaults.PREFILL, Defaults.USE_STRICT_MIN,
                                                Defaults.FLUSH_STRATEGY, null, Defaults.IS_SAME_RM_OVERRIDE,
                                                Defaults.INTERLEAVING,
                                                Defaults.PAD_XID, Defaults.WRAP_XA_RESOURCE,
                                                Defaults.NO_TX_SEPARATE_POOL);

         Map<String, String> introspected;
           
         if (ra.getResourceadapterClass() != null && !ra.getResourceadapterClass().equals(""))
         {
            out.println();
            out.println("Resource-adapter:");
            out.println("-----------------");
            out.println("Class: " + ra.getResourceadapterClass());
              
            introspected = getIntrospectedProperties(ra.getResourceadapterClass(), cl);

            if (ra.getConfigProperties() != null)
            {
               raConfigProperties = new HashMap<String, String>();
               for (ConfigProperty cp : ra.getConfigProperties())
               {
                  raConfigProperties.put(getValueString(cp.getConfigPropertyName()),
                                         getValueString(cp.getConfigPropertyValue()));
                 
                  removeIntrospectedValue(introspected, getValueString(cp.getConfigPropertyName()));
                 
                  out.println("  Config-property: " + getValueString(cp.getConfigPropertyName()) + " ("
                              + getValueString(cp.getConfigPropertyType()) + ")");
               }
            }

            if (introspected != null && !introspected.isEmpty())
            {
               for (Map.Entry<String, String> entry : introspected.entrySet())
               {
                  out.println("  Introspected Config-property: " + entry.getKey() + " (" + entry.getValue() + ")");
               }
            }

            if (introspected == null)
               out.println("  Unable to resolve introspected config-property's");
           
         }

         int line = 0;
         Set<String> sameClassnameSet = new HashSet<String>();
         boolean needPrint = true;

         if (ra.getOutboundResourceadapter() != null)
         {
            out.println();
            out.println("Managed-connection-factory:");
            out.println("---------------------------");
           
            if (ra.getOutboundResourceadapter().getConnectionDefinitions() != null)
               connDefs = new ArrayList<ConnectionDefinition>();
              
            transSupport = ra.getOutboundResourceadapter().getTransactionSupport();
            for (org.jboss.jca.common.api.metadata.spec.ConnectionDefinition mcf :
                    ra.getOutboundResourceadapter().getConnectionDefinitions())
            {
               mcfClassName = getValueString(mcf.getManagedConnectionFactoryClass());
               if (!sameClassnameSet.contains(mcfClassName))
               {
                  sameClassnameSet.add(mcfClassName);
                  if (line != 0)
                  {
                     out.println();
                  }
                  line++;
                  out.println("Class: " + mcfClassName);
                  needPrint = true;
               }
               else
               {
                  needPrint = false;
               }
                 
               if (needPrint)
               {
                  //ValidatingManagedConnectionFactory
                  hasValidatingMcfInterface(out, mcfClassName, cl);
                 
                  //DissociatableManagedConnection
                  hasDissociatableMcInterface(out, mcfClassName, cl, mcf.getConfigProperties());
                    
                  //LazyEnlistableManagedConnection
                  hasEnlistableMcInterface(out, mcfClassName, cl, mcf.getConfigProperties());

                  //CCI
                  String cfi = getValueString(mcf.getConnectionFactoryInterface());
                  try
                  {
                     out.print("  CCI: ");
                     Class<?> clazz = Class.forName(cfi, true, cl);

                     if (hasInterface(clazz, "javax.resource.cci.ConnectionFactory"))
                     {
                        out.println("Yes");
                     }
                     else
                     {
                        out.println("No");
                       
                        out.println("  ConnectionFactory (" + cfi + "):");
                        outputMethodInfo(out, clazz, cl);
                       
                        Class<?> ci = Class.forName(getValueString(mcf.getConnectionInterface()), true, cl);
                        out.println("  Connection (" + getValueString(mcf.getConnectionInterface()) + "):");
                        outputMethodInfo(out, ci, cl);
                     }
                  }
                  catch (Throwable t)
                  {
                     // Nothing we can do
                     t.printStackTrace(System.err);
                     out.println("Unknown");
                  }
               }
                 
               Map<String, String> configProperty = null;
               if (mcf.getConfigProperties() != null)
                  configProperty = new HashMap<String, String>();

               introspected = getIntrospectedProperties(mcfClassName, cl);

               for (ConfigProperty cp : mcf.getConfigProperties())
               {
                  configProperty.put(getValueString(cp.getConfigPropertyName()),
                                     getValueString(cp.getConfigPropertyValue()));

                  removeIntrospectedValue(introspected, getValueString(cp.getConfigPropertyName()));
                    
                  if (needPrint)
                     out.println("  Config-property: " + getValueString(cp.getConfigPropertyName()) + " (" +
                                 getValueString(cp.getConfigPropertyType()) + ")");
               }

               if (introspected != null && !introspected.isEmpty())
               {
                  for (Map.Entry<String, String> entry : introspected.entrySet())
                  {
                     if (needPrint)
                        out.println("  Introspected Config-property: " + entry.getKey() + " (" +
                                    entry.getValue() + ")");
                  }
               }

               if (introspected == null)
                  out.println("  Unable to resolve introspected config-property's");

               String poolName = getValueString(mcf.getConnectionInterface()).substring(
                  getValueString(mcf.getConnectionInterface()).lastIndexOf('.') + 1);
               Pool pool = null;
               ConnectionDefinitionImpl connImpl;
               if (transSupport.equals(TransactionSupportEnum.XATransaction))
               {
                  pool = xaPoolImpl;
                  Recovery recovery = new Recovery(new CredentialImpl("user", "password", null), null, false);
                  connImpl = new ConnectionDefinitionImpl(configProperty, mcfClassName, "java:jboss/eis/" + poolName,
                                                          poolName, Defaults.ENABLED, Defaults.USE_JAVA_CONTEXT,
                                                          Defaults.USE_CCM, Defaults.SHARABLE, Defaults.ENLISTMENT,
                                                          Defaults.CONNECTABLE, Defaults.TRACKING, pool, null, null,
                                                          secImpl, recovery, Boolean.TRUE);
               }
               else
               {
                  pool = poolImpl;
                  connImpl = new ConnectionDefinitionImpl(configProperty, mcfClassName, "java:jboss/eis/" + poolName,
                                                          poolName, Defaults.ENABLED, Defaults.USE_JAVA_CONTEXT,
                                                          Defaults.USE_CCM, Defaults.SHARABLE, Defaults.ENLISTMENT,
                                                          Defaults.CONNECTABLE, Defaults.TRACKING, pool, null, null,
                                                          secImpl, null, Boolean.FALSE);
               }
              
               connDefs.add(connImpl);
            }
           
         }

         line = 0;
         sameClassnameSet.clear();

         if (ra.getAdminObjects() != null && ra.getAdminObjects().size() > 0)
         {
            out.println();
            out.println("Admin-object:");
            out.println("-------------");
            adminObjects = new ArrayList<AdminObject>();

            for (org.jboss.jca.common.api.metadata.spec.AdminObject ao : ra.getAdminObjects())
            {
               String aoClassname = getValueString(ao.getAdminobjectClass());
               if (!sameClassnameSet.contains(aoClassname))
               {
                  sameClassnameSet.add(aoClassname);
                  if (line != 0)
                  {
                     out.println();
                  }
                  line++;
                  out.println("Class: " + aoClassname);
                  out.println("  Interface: " + getValueString(ao.getAdminobjectInterface()));
                  needPrint = true;
               }
               else
               {
                  needPrint = false;
               }

               String poolName = aoClassname.substring(aoClassname.lastIndexOf('.') + 1);
               Map<String, String> configProperty = null;
               if (ao.getConfigProperties() != null)
                  configProperty = new HashMap<String, String>();
              
               introspected = getIntrospectedProperties(aoClassname, cl);
              
               for (ConfigProperty cp : ao.getConfigProperties())
               {
                  configProperty.put(getValueString(cp.getConfigPropertyName()),
                                     getValueString(cp.getConfigPropertyValue()));
                 
                  removeIntrospectedValue(introspected, getValueString(cp.getConfigPropertyName()));
                 
                  if (needPrint)
                     out.println("  Config-property: " + getValueString(cp.getConfigPropertyName()) + " (" +
                                 getValueString(cp.getConfigPropertyType()) + ")");
               }

               if (introspected != null && !introspected.isEmpty())
               {
                  for (Map.Entry<String, String> entry : introspected.entrySet())
                  {
                     if (needPrint)
                        out.println("  Introspected Config-property: " + entry.getKey() + " (" +
                                    entry.getValue() + ")");
                  }
               }
                 
               if (introspected == null)
                  out.println("  Unable to resolve introspected config-property's");

               AdminObjectImpl aoImpl = new AdminObjectImpl(configProperty, aoClassname,
                  "java:jboss/eis/ao/" + poolName, poolName, Defaults.ENABLED, Defaults.USE_JAVA_CONTEXT);
               adminObjects.add(aoImpl);
            }
         }
           
         line = 0;
         sameClassnameSet.clear();

         if (ra.getInboundResourceadapter() != null &&
             ra.getInboundResourceadapter().getMessageadapter() != null &&
             ra.getInboundResourceadapter().getMessageadapter().getMessagelisteners() != null &&
             ra.getInboundResourceadapter().getMessageadapter().getMessagelisteners().size() > 0)
         {
            out.println();
            out.println("Activation-spec:");
            out.println("----------------");
            for (MessageListener ml :
                    ra.getInboundResourceadapter().getMessageadapter().getMessagelisteners())
            {
               String asClassname = getValueString(ml.getActivationspec().getActivationspecClass());
               if (!sameClassnameSet.contains(asClassname))
               {
                  sameClassnameSet.add(asClassname);
View Full Code Here


        protected boolean checkActivation(Connector cmd, Activation activation) {
            if (cmd != null) {
                Set<String> raMcfClasses = new HashSet<String>();
                Set<String> raAoClasses = new HashSet<String>();

                    ResourceAdapter ra = cmd.getResourceadapter();
                    if (ra != null && ra.getOutboundResourceadapter() != null &&
                        ra.getOutboundResourceadapter().getConnectionDefinitions() != null) {
                        List<ConnectionDefinition> cdMetas = ra.getOutboundResourceadapter().getConnectionDefinitions();
                        if (cdMetas.size() > 0) {
                            for (ConnectionDefinition cdMeta : cdMetas) {
                                raMcfClasses.add(cdMeta.getManagedConnectionFactoryClass().getValue());
                            }
                        }
                    }

                    if (ra != null && ra.getAdminObjects() != null) {
                        List<AdminObject> aoMetas = ra.getAdminObjects();
                        if (aoMetas.size() > 0) {
                            for (AdminObject aoMeta : aoMetas) {
                                raAoClasses.add(aoMeta.getAdminobjectClass().getValue());
                            }
                        }
View Full Code Here

            properties.add(simpleProperty15(TRANSACTION_MANAGER_LOCATOR_CLASS, STRING_TYPE, TransactionManagerLocator.class.getName()));
            properties.add(simpleProperty15(TRANSACTION_MANAGER_LOCATOR_METHOD, STRING_TYPE, "getTransactionManager"));

            OutboundResourceAdapter outbound = createOutbound();
            InboundResourceAdapter inbound = createInbound();
            ResourceAdapter ra = createResourceAdapter15(properties, outbound, inbound);
            Connector cmd = createConnector15(ra);

            TransactionSupportEnum transactionSupport = getTransactionSupport(txSupport);
            ConnectionDefinition common = createConnDef(transactionSupport, bindInfo.getBindName(), minPoolSize, maxPoolSize);
            Activation activation = createActivation(common, transactionSupport);
View Full Code Here

            Connector cmd = mdr.getValue().getResourceAdapter(raId);
            if (cmd.getVersion() == Connector.Version.V_10) {
                throw ConnectorLogger.ROOT_LOGGER.adminObjectForJCA10(resourceAdapter, jndiName);
            } else {
                ResourceAdapter ra1516 = (ResourceAdapter) cmd.getResourceadapter();
                if (ra1516.getAdminObjects() != null) {
                    for (AdminObject ao : ra1516.getAdminObjects()) {
                        if (ao.getAdminobjectClass().getValue().equals(className))
                            aoClass = ao.getAdminobjectClass().getValue();
                    }
                }
            }
View Full Code Here

            if (cmd != null) {
                Set<String> raMcfClasses = new HashSet<String>();
                Set<String> raAoClasses = new HashSet<String>();


                ResourceAdapter ra = (ResourceAdapter) cmd.getResourceadapter();
                if (ra != null && ra.getOutboundResourceadapter() != null
                        && ra.getOutboundResourceadapter().getConnectionDefinitions() != null) {
                    List<org.jboss.jca.common.api.metadata.spec.ConnectionDefinition> cdMetas = ra.getOutboundResourceadapter().getConnectionDefinitions();
                    if (cdMetas.size() > 0) {
                        for (org.jboss.jca.common.api.metadata.spec.ConnectionDefinition cdMeta : cdMetas) {
                            raMcfClasses.add(cdMeta.getManagedConnectionFactoryClass().getValue());
                        }
                    }
                }

                if (ra != null && ra.getAdminObjects() != null) {
                    List<org.jboss.jca.common.api.metadata.spec.AdminObject> aoMetas = ra.getAdminObjects();
                    if (aoMetas.size() > 0) {
                        for (org.jboss.jca.common.api.metadata.spec.AdminObject aoMeta : aoMetas) {
                            raAoClasses.add(aoMeta.getAdminobjectClass().getValue());
                        }
                    }
View Full Code Here

        try {

            Connector cmd = mdr.getValue().getResourceAdapter(raId);

            ResourceAdapter ra = cmd.getResourceadapter();
            if (ra.getOutboundResourceadapter() != null) {
                for (ConnectionDefinition cd : ra.getOutboundResourceadapter().getConnectionDefinitions()) {
                    if (cd.getConnectionFactoryInterface().getValue().equals(interfaceName))
                        cfInterface = cd.getConnectionFactoryInterface().getValue();
                }
            }


            if (cfInterface == null || !cfInterface.equals(interfaceName)) {
                throw ConnectorLogger.ROOT_LOGGER.invalidConnectionFactory(cfInterface, resourceAdapter, jndiName);
            }

            Map<String, String> raConfigProperties = new HashMap<String, String>();
            Map<String, String> mcfConfigProperties = new HashMap<String, String>();
            String securitySetting = null;
            String securitySettingDomain = null;

            if (properties != null) {
                for (Map.Entry<String,String> prop : properties.entrySet()) {
                    String key = prop.getKey();
                    String value = prop.getValue();
                    if (key.startsWith("ironjacamar.security")) {
                        securitySetting = value;
                    } else if (key.startsWith("ironjacamar.security.domain")) {
                        securitySettingDomain = value;
                    } else {
                        if (key.startsWith("ra.")) {
                            raConfigProperties.put(key.substring(3), value);
                        } else if (key.startsWith("mcf.")) {
                            mcfConfigProperties.put(key.substring(4), value);
                        } else {
                            mcfConfigProperties.put(key, value);
                        }
                    }
                }
            }

            String mcfClass = null;

            if (ra.getOutboundResourceadapter() != null) {
                for (ConnectionDefinition cd :
                        ra.getOutboundResourceadapter().getConnectionDefinitions()) {
                    if (cd.getConnectionFactoryInterface().getValue().equals(cfInterface))
                        mcfClass = cd.getManagedConnectionFactoryClass().getValue();
                }
            }
View Full Code Here

         boolean newMetadataComplete = this.metadataComplete || input.metadataComplete;
         LicenseType newLicense = this.license == null ? input.license : this.license.merge(input.license);
         List<LocalizedXsdString> newDescriptions = MergeUtil.mergeList(this.description, input.description);
         List<LocalizedXsdString> newDisplayNames = MergeUtil.mergeList(this.displayName, input.displayName);
         XsdString newVendorName = XsdString.isNull(this.vendorName) ? input.vendorName : this.vendorName;;
         ResourceAdapter newResourceadapter = this.resourceadapter == null
               ? (ResourceAdapter) input.resourceadapter
               : ((ResourceAdapter) this.resourceadapter).merge((ResourceAdapter) input.resourceadapter);
         return new ConnectorImpl(version, newModuleName, newVendorName, newEisType, newResourceadapterVersion,
                                  newLicense, newResourceadapter, newRequiredWorkContexts, newMetadataComplete,
                                  newDescriptions, newDisplayNames, newIcons, null);
View Full Code Here

      boolean newMetadataComplete = this.metadataComplete;
      LicenseType newLicense = CopyUtil.clone(this.license);
      List<LocalizedXsdString> newDescriptions = CopyUtil.cloneList(this.description);
      List<LocalizedXsdString> newDisplayNames = CopyUtil.cloneList(this.displayName);
      XsdString newVendorName = CopyUtil.clone(this.vendorName);
      ResourceAdapter newResourceadapter = CopyUtil.clone((ResourceAdapter) this.resourceadapter);
      return new ConnectorImpl(version, newModuleName, newVendorName, newEisType, newResourceadapterVersion,
                               newLicense, newResourceadapter, newRequiredWorkContexts, newMetadataComplete,
                               newDescriptions, newDisplayNames, newIcons, CopyUtil.cloneString(id));
   }
View Full Code Here

   /**
    * {@inheritDoc}
    */
   public void validate() throws ValidateException
   {
      ResourceAdapter ra = this.getResourceadapter();

      if (ra == null)
         throw new ValidateException(bundle.noMetadataForResourceAdapter());

      ra.validate();
   }
View Full Code Here

      if (conn.getVersion() != Version.V_10)
      {
         //merge adminObjects;

         ResourceAdapter ra = conn.getResourceadapter();
         if (ra != null && ra.getAdminObjects() != null)
         {
            List<AdminObject> newAdminObjects = new ArrayList<AdminObject>(ra.getAdminObjects().size());
            for (AdminObject adminObj : ra.getAdminObjects())
            {
               AdminObject newAdminObj = adminObj;
               newAdminObjects.add(newAdminObj);
            }
            ((ResourceAdapterImpl) ra).forceAdminObjects(newAdminObjects);
         }
         //merge connectionDefinitions;
         if (ra != null && ra.getOutboundResourceadapter() != null &&
             ra.getOutboundResourceadapter().getConnectionDefinitions() != null)
         {
            List<ConnectionDefinition> newConDefs = new ArrayList<ConnectionDefinition>(ra
               .getOutboundResourceadapter().getConnectionDefinitions().size());
            for (ConnectionDefinition conDef : ra.getOutboundResourceadapter().getConnectionDefinitions())
            {
               ConnectionDefinition newConDef = conDef;
               newConDefs.add(newConDef);
            }
            ((OutboundResourceAdapterImpl) ra.getOutboundResourceadapter())
               .forceConnectionDefinitions(newConDefs);
         }
      }

      return conn;
View Full Code Here

TOP

Related Classes of org.jboss.jca.common.api.metadata.spec.ResourceAdapter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.