Examples of OutboundResourceAdapter


Examples of org.apache.openejb.jee.OutboundResourceAdapter

          for (Class<? extends WorkContext> cls : annotationRequiredWorkContexts) {
            requiredWorkContext.add(cls.getName());
          }
        }

        OutboundResourceAdapter outboundResourceAdapter = connector.getResourceAdapter().getOutboundResourceAdapter();
        if (outboundResourceAdapter == null) {
          outboundResourceAdapter = new OutboundResourceAdapter();
          connector.getResourceAdapter().setOutboundResourceAdapter(outboundResourceAdapter);
        }

        List<AuthenticationMechanism> authenticationMechanisms = outboundResourceAdapter.getAuthenticationMechanism();
        javax.resource.spi.AuthenticationMechanism[] authMechanisms = connectorAnnotation.authMechanisms();
        if (authenticationMechanisms.size() == 0) {
          for (javax.resource.spi.AuthenticationMechanism am : authMechanisms) {
            AuthenticationMechanism authMechanism = new AuthenticationMechanism();
            authMechanism.setAuthenticationMechanismType(am.authMechanism());
            authMechanism.setCredentialInterface(am.credentialInterface().toString());
            authMechanism.setDescriptions(stringsToTexts(am.description()));

            authenticationMechanisms.add(authMechanism);
          }
        }

        if (outboundResourceAdapter.getTransactionSupport() == null) {
          outboundResourceAdapter.setTransactionSupport(TransactionSupportType.fromValue(connectorAnnotation.transactionSupport().toString()));
        }

        if (outboundResourceAdapter.isReauthenticationSupport() == null) {
          outboundResourceAdapter.setReauthenticationSupport(connectorAnnotation.reauthenticationSupport());
        }
          } else {
            // we couldn't process a connector class - probably a validation issue which we should warn about.
          }
View Full Code Here

Examples of org.apache.openejb.jee.OutboundResourceAdapter

    }

    private void processConnectionDescription(ResourceAdapter resourceAdapter, ConnectionDefinition connectionDefinitionAnnotation, Class<?> cls) {
      // try and find the managed connection factory

      OutboundResourceAdapter outboundResourceAdapter = resourceAdapter.getOutboundResourceAdapter();
      if (outboundResourceAdapter == null) {
        outboundResourceAdapter = new OutboundResourceAdapter();
        resourceAdapter.setOutboundResourceAdapter(outboundResourceAdapter);
      }

      List<org.apache.openejb.jee.ConnectionDefinition> connectionDefinition = outboundResourceAdapter.getConnectionDefinition();

      org.apache.openejb.jee.ConnectionDefinition definition = null;
      for (org.apache.openejb.jee.ConnectionDefinition cd : connectionDefinition) {
        if (cd.getManagedConnectionFactoryClass().equals(cls.getName())) {
          definition = cd;
          break;
        }
      }

      if (definition == null) {
        definition = new org.apache.openejb.jee.ConnectionDefinition();
        outboundResourceAdapter.getConnectionDefinition().add(definition);
      }

      if (definition.getManagedConnectionFactoryClass() == null) {
        definition.setManagedConnectionFactoryClass(cls.getName());
      }
View Full Code Here

Examples of org.apache.openejb.jee.OutboundResourceAdapter

                    }
                }
                connectorInfo.resourceAdapter = configFactory.configureService(resource, ResourceInfo.class);
            }

            OutboundResourceAdapter outbound = resourceAdapter.getOutboundResourceAdapter();
            if (outbound != null) {
                String transactionSupport = "none";
                switch (outbound.getTransactionSupport()) {
                    case LOCAL_TRANSACTION:
                        transactionSupport = "local";
                        break;
                    case NO_TRANSACTION:
                        transactionSupport = "none";
                        break;
                    case XA_TRANSACTION:
                        transactionSupport = "xa";
                        break;
                }
                for (ConnectionDefinition connection : outbound.getConnectionDefinition()) {

                    String id = getId(connection, outbound, connectorModule);
                    String className = connection.getManagedConnectionFactoryClass();
                    String type = connection.getConnectionFactoryInterface();
View Full Code Here

Examples of org.apache.openejb.jee.OutboundResourceAdapter

                        resourceAdapterId = connectorModule.getModuleId() + "RA";
                    }
                    resourceAdapterIds.add(resourceAdapterId);
                }

                OutboundResourceAdapter outbound = resourceAdapter.getOutboundResourceAdapter();
                if (outbound != null) {
                    for (ConnectionDefinition connection : outbound.getConnectionDefinition()) {
                        String type = connection.getConnectionFactoryInterface();

                        String resourceId;
                        if (connection.getId() != null) {
                            resourceId = connection.getId();
                        } else if (outbound.getConnectionDefinition().size() == 1) {
                            resourceId = connectorModule.getModuleId();
                        } else {
                            resourceId = connectorModule.getModuleId() + "-" + type;
                        }
View Full Code Here

Examples of org.apache.openejb.jee.OutboundResourceAdapter

                        resourceAdapterId = connectorModule.getModuleId() + "RA";
                    }
                    resourceAdapterIds.add(resourceAdapterId);
                }

                OutboundResourceAdapter outbound = resourceAdapter.getOutboundResourceAdapter();
                if (outbound != null) {
                    for (ConnectionDefinition connection : outbound.getConnectionDefinition()) {
                        String type = connection.getConnectionFactoryInterface();

                        String resourceId;
                        if (connection.getId() != null) {
                            resourceId = connection.getId();
                        } else if (outbound.getConnectionDefinition().size() == 1) {
                            resourceId = connectorModule.getModuleId();
                        } else {
                            resourceId = connectorModule.getModuleId() + "-" + type;
                        }
View Full Code Here

Examples of org.apache.openejb.jee.OutboundResourceAdapter

            log.info("Reading connector annotations");
            if (raClass != null/*and not metadata complete */) {
                javax.resource.spi.Connector ra = raClass.getAnnotation(javax.resource.spi.Connector.class);
                if (ra != null) {

                    OutboundResourceAdapter outboundResourceAdapter = resourceAdapter.getOutboundResourceAdapter();
                    if (outboundResourceAdapter == null) {
                        outboundResourceAdapter = new OutboundResourceAdapter();
                        resourceAdapter.setOutboundResourceAdapter(outboundResourceAdapter);
                    }
                    if (outboundResourceAdapter.isReauthenticationSupport() == null) {
                        outboundResourceAdapter.setReauthenticationSupport(ra.reauthenticationSupport());
                    }
                    if (outboundResourceAdapter.getTransactionSupport() == null) {
                        outboundResourceAdapter.setTransactionSupport(TransactionSupportType.fromValue(ra.transactionSupport().toString()));
                    }
                    connector.getRequiredWorkContext().addAll(toString(ra.requiredWorkContexts()));
                    setConfigProperties(resourceAdapter.getConfigProperty(), raClass);
                }
            }

            //inbound
            log.info("connector of type: " + connector);
            InboundResourceadapter inboundResource = resourceAdapter.getInboundResourceAdapter();
            if (inboundResource == null) {
                inboundResource = new InboundResourceadapter();
                inboundResource.setMessageAdapter(new MessageAdapter());
            }
            MessageAdapter messageAdapter = inboundResource.getMessageAdapter();
            List<Class<?>> activationSpecClasses = classFinder.findAnnotatedClasses(Activation.class);

            for (Class<?> asClass : activationSpecClasses) {
                Activation activation = asClass.getAnnotation(Activation.class);
                for (Class messageListenerClass : activation.messageListeners()) {
                    ActivationSpec activationSpec = getActivationSpec(messageAdapter, messageListenerClass);

                    if (activationSpec.getActivationSpecClass() == null) {
                        activationSpec.setActivationSpecClass(asClass.getName());
                    }
                    if (asClass.getName().equals(activationSpec.getActivationSpecClass())) {
                        setConfigProperties(activationSpec.getConfigProperty(), asClass);
                    }
                    //TODO set required config properties from @NotNull annotations
                }
            }
            if (resourceAdapter.getInboundResourceAdapter() == null && inboundResource.getMessageAdapter().getMessageListener().size() > 0) {
                resourceAdapter.setInboundResourceAdapter(inboundResource);
            }

            //admin objects
            for (Class adminObjectClass : classFinder.findAnnotatedClasses(AdministeredObject.class)) {
                AdministeredObject administeredObject = (AdministeredObject) adminObjectClass.getAnnotation(AdministeredObject.class);
                Class[] interfaces = administeredObject.adminObjectInterfaces();
                if (interfaces == null || interfaces.length == 0) {
                    List<Class> allInterfaces = new ArrayList<Class>(Arrays.asList(adminObjectClass.getInterfaces()));
                    allInterfaces.remove(Serializable.class);
                    allInterfaces.remove(Externalizable.class);
                    //TODO check if specified in ra.xml
                    if (allInterfaces.size() != 1) {
                        throw new DeploymentException("Interface for admin object not specified properly: " + allInterfaces);
                    }
                    interfaces = allInterfaces.toArray(new Class[1]);
                }
                for (Class aoInterface : interfaces) {
                    AdminObject adminObject = getAdminObject(resourceAdapter, aoInterface);
                    if (adminObject.getAdminObjectClass() == null) {
                        adminObject.setAdminObjectClass(adminObjectClass.getName());
                    }
                    if (adminObjectClass.getName().equals(adminObject.getAdminObjectClass())) {
                        setConfigProperties(adminObject.getConfigProperty(), adminObjectClass);
                    }
                }
            }

            OutboundResourceAdapter outboundResourceAdapter = resourceAdapter.getOutboundResourceAdapter();
            if (outboundResourceAdapter == null) {
                outboundResourceAdapter = new OutboundResourceAdapter();
            }

            //outbound
            for (Class<?> mcfClass : classFinder.findAnnotatedClasses(javax.resource.spi.ConnectionDefinition.class)) {
                javax.resource.spi.ConnectionDefinition connectionDefinitionAnnotation = mcfClass.getAnnotation(javax.resource.spi.ConnectionDefinition.class);
                buildConnectionDefinition(mcfClass.asSubclass(ManagedConnectionFactory.class), connectionDefinitionAnnotation, outboundResourceAdapter);
            }
            for (Class<?> mcfClass : classFinder.findAnnotatedClasses(ConnectionDefinitions.class)) {
                ConnectionDefinitions connectionDefinitionAnnotations = mcfClass.getAnnotation(ConnectionDefinitions.class);
                for (javax.resource.spi.ConnectionDefinition connectionDefinitionAnnotation : connectionDefinitionAnnotations.value()) {
                    buildConnectionDefinition(mcfClass.asSubclass(ManagedConnectionFactory.class), connectionDefinitionAnnotation, outboundResourceAdapter);
                }
            }
            if (outboundResourceAdapter.getConnectionDefinition().size() > 0) {
                resourceAdapter.setOutboundResourceAdapter(outboundResourceAdapter);
            }
        }
        return connector;
    }
View Full Code Here

Examples of org.apache.openejb.jee.OutboundResourceAdapter

                    for (final Class<? extends WorkContext> cls : annotationRequiredWorkContexts) {
                        requiredWorkContext.add(cls.getName());
                    }
                }

                OutboundResourceAdapter outboundResourceAdapter = connector.getResourceAdapter().getOutboundResourceAdapter();
                if (outboundResourceAdapter == null) {
                    outboundResourceAdapter = new OutboundResourceAdapter();
                    connector.getResourceAdapter().setOutboundResourceAdapter(outboundResourceAdapter);
                }

                final List<AuthenticationMechanism> authenticationMechanisms = outboundResourceAdapter.getAuthenticationMechanism();
                final javax.resource.spi.AuthenticationMechanism[] authMechanisms = connectorAnnotation.authMechanisms();
                if (authenticationMechanisms.size() == 0) {
                    for (final javax.resource.spi.AuthenticationMechanism am : authMechanisms) {
                        final AuthenticationMechanism authMechanism = new AuthenticationMechanism();
                        authMechanism.setAuthenticationMechanismType(am.authMechanism());
                        authMechanism.setCredentialInterface(am.credentialInterface().toString());
                        authMechanism.setDescriptions(stringsToTexts(am.description()));

                        authenticationMechanisms.add(authMechanism);
                    }
                }

                if (outboundResourceAdapter.getTransactionSupport() == null) {
                    outboundResourceAdapter.setTransactionSupport(TransactionSupportType.fromValue(connectorAnnotation.transactionSupport().toString()));
                }

                if (outboundResourceAdapter.isReauthenticationSupport() == null) {
                    outboundResourceAdapter.setReauthenticationSupport(connectorAnnotation.reauthenticationSupport());
                }
            }

            // process @ConnectionDescription(s)
            List<Class<?>> classes = finder.findAnnotatedClasses(ConnectionDefinitions.class);
View Full Code Here

Examples of org.apache.openejb.jee.OutboundResourceAdapter

        }

        private void processConnectionDescription(final ResourceAdapter resourceAdapter, final ConnectionDefinition connectionDefinitionAnnotation, final Class<?> cls) {
            // try and find the managed connection factory

            OutboundResourceAdapter outboundResourceAdapter = resourceAdapter.getOutboundResourceAdapter();
            if (outboundResourceAdapter == null) {
                outboundResourceAdapter = new OutboundResourceAdapter();
                resourceAdapter.setOutboundResourceAdapter(outboundResourceAdapter);
            }

            final List<org.apache.openejb.jee.ConnectionDefinition> connectionDefinition = outboundResourceAdapter.getConnectionDefinition();

            org.apache.openejb.jee.ConnectionDefinition definition = null;
            for (final org.apache.openejb.jee.ConnectionDefinition cd : connectionDefinition) {
                if (cd.getManagedConnectionFactoryClass().equals(cls.getName())) {
                    definition = cd;
                    break;
                }
            }

            if (definition == null) {
                definition = new org.apache.openejb.jee.ConnectionDefinition();
                outboundResourceAdapter.getConnectionDefinition().add(definition);
            }

            if (definition.getManagedConnectionFactoryClass() == null) {
                definition.setManagedConnectionFactoryClass(cls.getName());
            }
View Full Code Here

Examples of org.apache.openejb.jee.OutboundResourceAdapter

                    }
                }
                connectorInfo.resourceAdapter = configFactory.configureService(resource, ResourceInfo.class);
            }

            OutboundResourceAdapter outbound = resourceAdapter.getOutboundResourceAdapter();
            if (outbound != null) {
                String transactionSupport = "none";
                switch (outbound.getTransactionSupport()) {
                    case LOCAL_TRANSACTION:
                        transactionSupport = "local";
                        break;
                    case NO_TRANSACTION:
                        transactionSupport = "none";
                        break;
                    case XA_TRANSACTION:
                        transactionSupport = "xa";
                        break;
                }
                for (ConnectionDefinition connection : outbound.getConnectionDefinition()) {

                    String id = getId(connection, outbound, connectorModule);
                    String className = connection.getManagedConnectionFactoryClass();
                    String type = connection.getConnectionFactoryInterface();
View Full Code Here

Examples of org.apache.openejb.jee.OutboundResourceAdapter

          for (Class<? extends WorkContext> cls : annotationRequiredWorkContexts) {
            requiredWorkContext.add(cls.getName());
          }
        }

        OutboundResourceAdapter outboundResourceAdapter = connector.getResourceAdapter().getOutboundResourceAdapter();
        if (outboundResourceAdapter == null) {
          outboundResourceAdapter = new OutboundResourceAdapter();
          connector.getResourceAdapter().setOutboundResourceAdapter(outboundResourceAdapter);
        }

        List<AuthenticationMechanism> authenticationMechanisms = outboundResourceAdapter.getAuthenticationMechanism();
        javax.resource.spi.AuthenticationMechanism[] authMechanisms = connectorAnnotation.authMechanisms();
        if (authenticationMechanisms.size() == 0) {
          for (javax.resource.spi.AuthenticationMechanism am : authMechanisms) {
            AuthenticationMechanism authMechanism = new AuthenticationMechanism();
            authMechanism.setAuthenticationMechanismType(am.authMechanism());
            authMechanism.setCredentialInterface(am.credentialInterface().toString());
            authMechanism.setDescriptions(stringsToTexts(am.description()));

            authenticationMechanisms.add(authMechanism);
          }
        }

        if (outboundResourceAdapter.getTransactionSupport() == null) {
          outboundResourceAdapter.setTransactionSupport(TransactionSupportType.fromValue(connectorAnnotation.transactionSupport().toString()));
        }

        if (outboundResourceAdapter.isReauthenticationSupport() == null) {
          outboundResourceAdapter.setReauthenticationSupport(connectorAnnotation.reauthenticationSupport());
        }
          } else {
            // we couldn't process a connector class - probably a validation issue which we should warn about.
          }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.