Package javax.resource.spi

Examples of javax.resource.spi.ManagedConnectionFactory


      }
     logger.log(Level.FINE, "No of addresses found " +
      tokenizer.countTokens());
      while (tokenizer.hasMoreTokens()) {
    String brokerurl = tokenizer.nextToken();
          ManagedConnectionFactory mcf = super.
                  createManagedConnectionFactory(cpr, loader);
              Iterator it = s.iterator();
              while (it.hasNext()) {
                  EnvironmentProperty prop = (EnvironmentProperty) it.next();
                  String propName = prop.getName();
     String propValue = prop.getValue();
                 if (propName.startsWith("imq") && propValue != "") {
                  try {
                   Method meth = mcf.getClass().getMethod
                         (SETTER, new  Class[] {java.lang.String.class,
                              java.lang.String.class});
                  if (propName.trim().equalsIgnoreCase("imqAddressList")){
                         meth.invoke(mcf, new Object[] {prop.getName(),brokerurl});
      } else
                         meth.invoke(mcf, new Object[] {prop.getName(),prop.getValueObject()});
      }
                   } catch (NoSuchMethodException ex) {
                     logger.log(Level.WARNING, "no.such.method",
                         new Object[] {SETTER, mcf.getClass().getName()});
                   } catch (Exception ex) {
                     logger.log(Level.SEVERE, "error.execute.method",
                         new Object[] {SETTER, mcf.getClass().getName()});
       }
    }
              }
              EnvironmentProperty addressProp3 = new EnvironmentProperty (                                    ADDRESSLIST, brokerurl,"Address List",
                            "java.lang.String");
View Full Code Here


     * @throw ConnectorRuntimeException in case of an exception.
     */
    public ManagedConnectionFactory createManagedConnectionFactory
                (com.sun.enterprise.connectors.ConnectorConnectionPool cpr,
                                                       ClassLoader loader) {
        ManagedConnectionFactory mcf =
            super.createManagedConnectionFactory(cpr, loader);
        if ( mcf != null ) {
            Set s = cpr.getConnectorDescriptorInfo().getMCFConfigProperties();
            Iterator it = s.iterator();
            while (it.hasNext()) {
                EnvironmentProperty prop = (EnvironmentProperty) it.next();
                String propName = prop.getName();
          
                // If the property has started with imq, then it should go to
                // setProperty(String,String) method.
                if (propName.startsWith("imq") && prop.getValue() != "") {
                    try {
                        Method meth = mcf.getClass().getMethod
                        (SETTER, new  Class[] {java.lang.String.class,
                                               java.lang.String.class});
                        meth.invoke(mcf, new Object[] {prop.getName(),
                                                        prop.getValueObject()});
                    } catch (NoSuchMethodException ex) {
                        logger.log(Level.WARNING, "no.such.method",
                        new Object[] {SETTER, mcf.getClass().getName()});
                    } catch (Exception ex) {
                        logger.log(Level.SEVERE, "error.execute.method",
                        new Object[] {SETTER, mcf.getClass().getName()});
                    }
          }
            }

        //CR 6591307- Fix for properties getting overridden when setRA is called. Resetting the  properties if the RA is the JMS RA
View Full Code Here

     * @param pool <code>ConnectorConnectionPool</code> properties.
     * @param jcl <code>ClassLoader</code>
     */
    public ManagedConnectionFactory createManagedConnectionFactory (
                    ConnectorConnectionPool pool, ClassLoader jcl) {
        ManagedConnectionFactory mcf = null;
        mcf = super.createManagedConnectionFactory(pool,jcl);

        if (mcf instanceof ResourceAdapterAssociation) {
           try{
               ((ResourceAdapterAssociation) mcf).setResourceAdapter(
View Full Code Here

        }
       _logger.log(Level.FINE, "No of addresses found " +
            tokenizer.countTokens());
        while (tokenizer.hasMoreTokens()) {
        String brokerurl = tokenizer.nextToken();
            ManagedConnectionFactory mcf = super.
                    createManagedConnectionFactory(cpr, loader);
                Iterator it = s.iterator();
                while (it.hasNext()) {
                    ConnectorConfigProperty  prop = (ConnectorConfigProperty ) it.next();
                    String propName = prop.getName();
         String propValue = prop.getValue();
                 if (propName.startsWith("imq") && propValue != "") {
                  try {
                     Method meth = mcf.getClass().getMethod
                           (SETTER, new  Class[] {java.lang.String.class,
                              java.lang.String.class});
                    if (propName.trim().equalsIgnoreCase("imqAddressList")){
                             meth.invoke(mcf, new Object[] {prop.getName(),brokerurl});
            } else {
                             meth.invoke(mcf, new Object[] {prop.getName(),prop.getValueObject()});
            }
                   } catch (NoSuchMethodException ex) {
                       _logger.log(Level.WARNING, "no.such.method",
                           new Object[] {SETTER, mcf.getClass().getName()});
                   } catch (Exception ex) {
                       _logger.log(Level.SEVERE, "error.execute.method",
                           new Object[] {SETTER, mcf.getClass().getName()});
           }
        }
              }
              ConnectorConfigProperty  addressProp3 = new ConnectorConfigProperty  (ADDRESSLIST, brokerurl,"Address List",
                            "java.lang.String");
View Full Code Here

    return (ManagedConnectionFactory [])mcfs.toArray(new ManagedConnectionFactory[0]);
    }

     protected ManagedConnectionFactory instantiateMCF(final String mcfClass, final ClassLoader loader)
            throws Exception {
            ManagedConnectionFactory mcf = null;
            if (moduleName_.equals(ConnectorRuntime.DEFAULT_JMS_ADAPTER)) {
                Object tmp = AccessController.doPrivileged(
                        new PrivilegedExceptionAction() {
                            public Object run() throws Exception{
                                return instantiateManagedConnectionFactory(mcfClass, loader);
View Full Code Here

     * @param loader Class Loader.
     */
    public ManagedConnectionFactory createManagedConnectionFactory
                  (com.sun.enterprise.connectors.ConnectorConnectionPool cpr,
                   ClassLoader loader) {
        ManagedConnectionFactory mcf =
            super.createManagedConnectionFactory(cpr, loader);
        if ( mcf != null ) {
            Set s = cpr.getConnectorDescriptorInfo().getMCFConfigProperties();
            Iterator it = s.iterator();
            while (it.hasNext()) {
                ConnectorConfigProperty  prop = (ConnectorConfigProperty ) it.next();
                String propName = prop.getName();

                // If the property has started with imq, then it should go to
                // setProperty(String,String) method.
                if (propName.startsWith("imq") && prop.getValue() != "") {
                    try {
                        Method meth = mcf.getClass().getMethod
                        (SETTER, new  Class[] {java.lang.String.class,
                                               java.lang.String.class});
                        meth.invoke(mcf, new Object[] {prop.getName(),
                                                        prop.getValueObject()});
                    } catch (NoSuchMethodException ex) {
                        _logger.log(Level.WARNING, "no.such.method",
                        new Object[] {SETTER, mcf.getClass().getName()});
                    } catch (Exception ex) {
                        _logger.log(Level.SEVERE, "error.execute.method",
                        new Object[] {SETTER, mcf.getClass().getName()});
                    }
            }
            }

        //CR 6591307- Fix for properties getting overridden when setRA is called. Resetting the  properties if the RA is the JMS RA
View Full Code Here

      for (final Object obj : connectionSet)
      {
         if (obj instanceof QpidRAManagedConnection)
         {
            QpidRAManagedConnection mc = (QpidRAManagedConnection)obj;
            ManagedConnectionFactory mcf = mc.getManagedConnectionFactory();

            if ((mc.getUserName() == null || mc.getUserName() != null && mc.getUserName()
                                                                           .equals(credential.getUserName())) && mcf.equals(this))
            {
               if (cri.equals(mc.getCRI()))
               {
                  if (_log.isTraceEnabled())
                  {
View Full Code Here

            Map<String, Object> unset = serviceRecipe.getUnsetProperties();
            unset.remove("threadPoolSize");
            logUnusedProperties(unset, serviceInfo)
                    ;
        } else if (service instanceof ManagedConnectionFactory) {
            ManagedConnectionFactory managedConnectionFactory = (ManagedConnectionFactory) service;

            // connection manager is constructed via a recipe so we automatically expose all cmf properties
            ObjectRecipe connectionManagerRecipe = new ObjectRecipe(GeronimoConnectionManagerFactory.class, "create");
            connectionManagerRecipe.allow(Option.CASE_INSENSITIVE_PROPERTIES);
            connectionManagerRecipe.allow(Option.IGNORE_MISSING_PROPERTIES);
View Full Code Here

            final Map<String, Object> unset = serviceRecipe.getUnsetProperties();
            unset.remove("threadPoolSize");
            logUnusedProperties(unset, serviceInfo);
        } else if (service instanceof ManagedConnectionFactory) {
            final ManagedConnectionFactory managedConnectionFactory = (ManagedConnectionFactory) service;

            // connection manager is constructed via a recipe so we automatically expose all cmf properties
            final ObjectRecipe connectionManagerRecipe = new ObjectRecipe(GeronimoConnectionManagerFactory.class, "create");
            connectionManagerRecipe.allow(Option.CASE_INSENSITIVE_PROPERTIES);
            connectionManagerRecipe.allow(Option.IGNORE_MISSING_PROPERTIES);
            connectionManagerRecipe.setAllProperties(serviceInfo.properties);
            connectionManagerRecipe.setProperty("name", serviceInfo.id);
            connectionManagerRecipe.setProperty("mcf", managedConnectionFactory);

            // standard properties
            connectionManagerRecipe.setProperty("transactionManager", transactionManager);
            ClassLoader classLoader = loader;
            if (classLoader == null) {
                classLoader = getClass().getClassLoader();
            }
            if (classLoader == null) {
                classLoader = ClassLoader.getSystemClassLoader();
            }
            connectionManagerRecipe.setProperty("classLoader", classLoader);

            logger.getChildLogger("service").info("createResource.createConnectionManager", serviceInfo.id, service.getClass().getName());

            // create the connection manager
            final ConnectionManager connectionManager = (ConnectionManager) connectionManagerRecipe.create();
            if (connectionManager == null) {
                throw new OpenEJBRuntimeException(messages.format("assembler.invalidConnectionManager", serviceInfo.id));
            }

            final Map<String, Object> unsetA = serviceRecipe.getUnsetProperties();
            final Map<String, Object> unsetB = connectionManagerRecipe.getUnsetProperties();
            final Map<String, Object> unset = new HashMap<String, Object>();
            for (final Map.Entry<String, Object> entry : unsetA.entrySet()) {
                if (unsetB.containsKey(entry.getKey())) {
                    unset.put(entry.getKey(), entry.getValue());
                }
            }

            // service becomes a ConnectorReference which merges connection manager and mcf
            service = new ConnectorReference(connectionManager, managedConnectionFactory);

            // init cm if needed
            final Object eagerInit = unset.remove("eagerInit");
            if (eagerInit != null && eagerInit instanceof String && "true".equalsIgnoreCase((String) eagerInit)
                && connectionManager instanceof AbstractConnectionManager) {
                try {
                    ((AbstractConnectionManager) connectionManager).doStart();
                    try {
                        final Object cf = managedConnectionFactory.createConnectionFactory(connectionManager);
                        if (cf instanceof ConnectionFactory) {
                            final Connection connection = ((ConnectionFactory) cf).getConnection();
                            connection.getMetaData();
                            connection.close();
                        }
View Full Code Here

        }
       _logger.log(Level.FINE, "No of addresses found " +
            tokenizer.countTokens());
        while (tokenizer.hasMoreTokens()) {
        String brokerurl = tokenizer.nextToken();
            ManagedConnectionFactory mcf = super.
                    createManagedConnectionFactory(cpr, loader);
                Iterator it = s.iterator();
                while (it.hasNext()) {
                    ConnectorConfigProperty  prop = (ConnectorConfigProperty ) it.next();
                    String propName = prop.getName();
         String propValue = prop.getValue();
                 if (propName.startsWith("imq") && propValue != "") {
                  try {
                     Method meth = mcf.getClass().getMethod
                           (SETTER, new  Class[] {java.lang.String.class,
                              java.lang.String.class});
                    if (propName.trim().equalsIgnoreCase("imqAddressList")){
                             meth.invoke(mcf, new Object[] {prop.getName(),brokerurl});
            } else {
                             meth.invoke(mcf, new Object[] {prop.getName(),prop.getValueObject()});
            }
                   } catch (NoSuchMethodException ex) {
                       _logger.log(Level.WARNING, "no.such.method",
                           new Object[] {SETTER, mcf.getClass().getName()});
                   } catch (Exception ex) {
                       _logger.log(Level.SEVERE, "error.execute.method",
                           new Object[] {SETTER, mcf.getClass().getName()});
           }
        }
              }
              ConnectorConfigProperty  addressProp3 = new ConnectorConfigProperty  (ADDRESSLIST, brokerurl,"Address List",
                            "java.lang.String");
View Full Code Here

TOP

Related Classes of javax.resource.spi.ManagedConnectionFactory

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.