Package com.sun.appserv.connectors.internal.api

Examples of com.sun.appserv.connectors.internal.api.ConnectorRuntime


    public boolean initializeService(){
         try {
             String module = ConnectorConstants.DEFAULT_JMS_ADAPTER;
             String loc = ConnectorsUtil.getSystemModuleLocation(module);
             ConnectorRuntime connectorRuntime = connectorRuntimeProvider.get();
             connectorRuntime.createActiveResourceAdapter(loc, module, null);
             return true;
               } catch (ConnectorRuntimeException e) {
                   e.printStackTrace();
                   //_logger.log(Level.WARNING, "Failed to start JMS RA");
                   e.printStackTrace();
View Full Code Here


            InitialContext ic = new InitialContext();
             final DataSource dataSource =
                //V3 Commented (DataSource)ConnectorRuntime.getRuntime().lookupNonTxResource(dsJndi,false);
                //replacement code suggested by jagadish
               (DataSource)ic.lookup(nonTxJndiName);*/
            ConnectorRuntime connectorRuntime = Util.getDefaultHabitat().getServiceHandle(cr).getService();
            final DataSource dataSource =
                (DataSource) connectorRuntime.lookupNonTxResource(dsJndi,false);
         //(DataSource)ConnectorRuntime.getRuntime().lookupNonTxResource(dsJndi,false);
            Connection connection = null;
            if (dbUser != null && dbPassword != null) {
                connection = dataSource.getConnection(dbUser, dbPassword);
            } else {
View Full Code Here

    }
    public void initializeBroker () throws ConnectorRuntimeException
    {
            String module = ConnectorConstants.DEFAULT_JMS_ADAPTER;
            String loc = ConnectorsUtil.getSystemModuleLocation(module);
            ConnectorRuntime connectorRuntime = habitat.getComponent(ConnectorRuntime.class);
            connectorRuntime.createActiveResourceAdapter(loc, module, null);
    }
View Full Code Here

    public boolean initializeService(){
         try {
             String module = ConnectorConstants.DEFAULT_JMS_ADAPTER;
             String loc = ConnectorsUtil.getSystemModuleLocation(module);
             ConnectorRuntime connectorRuntime = habitat.getComponent(ConnectorRuntime.class);
             connectorRuntime.createActiveResourceAdapter(loc, module, null);
             return true;
               } catch (ConnectorRuntimeException e) {
                   e.printStackTrace();
                   //_logger.log(Level.WARNING, "Failed to start JMS RA");
                   e.printStackTrace();
View Full Code Here

        ASyncClientShutdownTask task = new ASyncClientShutdownTask(appEJBName_,
                messageBeanClient_, loader, messageBeanPool_);
        long timeout = 0;
        try {
                    ConnectorRuntime cr = ejbContainerUtilImpl.getServices()
                            .getService(ConnectorRuntime.class);
                    timeout = cr.getShutdownTimeout();
                } catch (Throwable th) {
                    _logger.log(Level.WARNING, "[MDBContainer] Got exception while trying " +
                     " to get shutdown timeout", th);
                }
        try {
View Full Code Here

            InitialContext ic = new InitialContext();
             final DataSource dataSource =
                //V3 Commented (DataSource)ConnectorRuntime.getRuntime().lookupNonTxResource(dsJndi,false);
                //replacement code suggested by jagadish
               (DataSource)ic.lookup(nonTxJndiName);*/
            ConnectorRuntime connectorRuntime = Util.getDefaultHabitat().getServiceHandle(cr).getService();
            final DataSource dataSource =
                (DataSource) connectorRuntime.lookupNonTxResource(dsJndi,false);
         //(DataSource)ConnectorRuntime.getRuntime().lookupNonTxResource(dsJndi,false);
            Connection connection = null;
            if (dbUser != null && dbPassword != null) {
                connection = dataSource.getConnection(dbUser, dbPassword);
            } else {
View Full Code Here

        ASyncClientShutdownTask task = new ASyncClientShutdownTask(appEJBName_,
                messageBeanClient_, loader, messageBeanPool_);
        long timeout = 0;
        try {
                    ConnectorRuntime cr = ejbContainerUtilImpl.getServices()
                            .getService(ConnectorRuntime.class);
                    timeout = cr.getShutdownTimeout();
                } catch (Throwable th) {
                    _logger.log(Level.WARNING, "[MDBContainer] Got exception while trying " +
                     " to get shutdown timeout", th);
                }
        try {
View Full Code Here

                _logger.log(Level.FINE, "Found no CMT MDBs in all applications");
                return;
            }

            //TODO V3 done so as to initialize connectors-runtime before loading inbound active RA. need a better way ?
            ConnectorRuntime cr = connectorRuntimeHabitat.getComponent(ConnectorRuntime.class);
            ConnectorRegistry creg = ConnectorRegistry.getInstance();

            // for each RA (key in the map) get the list (value) of MDB Descriptors
            Map<String, List<EjbDescriptor>> mappings = createRAEjbMapping(xaEnabledMDBList);

            //For each RA
            for (Map.Entry entry : mappings.entrySet()) {

                String raMid = (String) entry.getKey();
                List<EjbDescriptor> respectiveDesc = mappings.get(raMid);

                try {
                    createActiveResourceAdapter(raMid);
                } catch (Exception ex) {
                    _logger.log(Level.SEVERE, "error.loading.connector.resources.during.recovery", raMid);
                    if (_logger.isLoggable(Level.FINE)) {
                        _logger.log(Level.FINE, ex.toString(), ex);
                    }
                }

                ActiveInboundResourceAdapter activeInboundRA = (ActiveInboundResourceAdapter) creg
                        .getActiveResourceAdapter(raMid);

                //assert activeInboundRA instanceof ActiveInboundResourceAdapter;

                boolean isSystemJmsRA = false;
                if (ConnectorsUtil.isJMSRA(activeInboundRA.getModuleName())) {
                    isSystemJmsRA = true;
                }

                javax.resource.spi.ResourceAdapter resourceAdapter = activeInboundRA
                        .getResourceAdapter();
                // activationSpecList represents the ActivationSpec[] that would be
                // sent to the getXAResources() method.
                ArrayList<ActivationSpec> activationSpecList = new ArrayList<ActivationSpec>();

                try {
                    for (int i = 0; i < respectiveDesc.size(); i++) {
                        try {
                            // Get a MessageBeanDescriptor from respectiveDesc ArrayList
                            EjbMessageBeanDescriptor descriptor =
                                    (EjbMessageBeanDescriptor) respectiveDesc.get(i);
                            // A descriptor using 1.3 System JMS RA style properties needs
                            // to be updated J2EE 1.4 style props.
                            if (isSystemJmsRA) {
                                //XXX: Find out the pool descriptor corres to MDB and update
                                //MDBRuntimeInfo with that.
                                activeInboundRA.updateMDBRuntimeInfo(descriptor, null);
                            }

                            // Get the ActivationConfig Properties from the MDB Descriptor
                            Set activationConfigProps =
                                    RARUtils.getMergedActivationConfigProperties(descriptor);
                            // get message listener type
                            String msgListenerType = descriptor.getMessageListenerType();

                            // start resource adapter and get ActivationSpec class for
                            // the given message listener type from the ConnectorRuntime

                            ActivationSpec aspec = (ActivationSpec) (Class.forName(
                                    cr.getActivationSpecClass(raMid,
                                            msgListenerType), false,
                                    resourceAdapter.getClass().getClassLoader()).newInstance());
                            aspec.setResourceAdapter(resourceAdapter);

                            // Populate ActivationSpec class with ActivationConfig properties
View Full Code Here

        return map;
    }

    private void createActiveResourceAdapter(String rarModuleName) throws ConnectorRuntimeException {

        ConnectorRuntime cr = connectorRuntimeHabitat.getComponent(ConnectorRuntime.class);
        ConnectorRegistry creg = ConnectorRegistry.getInstance();

        if (creg.isRegistered(rarModuleName))
            return;

        if (ConnectorAdminServiceUtils.isEmbeddedConnectorModule(rarModuleName)) {
            cr.createActiveResourceAdapterForEmbeddedRar(rarModuleName);
        } else {
            String moduleDir ;
            if (ConnectorsUtil.belongsToSystemRA(rarModuleName)) {
                moduleDir = ConnectorsUtil.getSystemModuleLocation(rarModuleName);
            }else{
                moduleDir = ConfigBeansUtilities.getLocation(rarModuleName);
            }
            ClassLoader loader = cr.createConnectorClassLoader(moduleDir, null, rarModuleName);
            cr.createActiveResourceAdapter(moduleDir, rarModuleName, loader);
        }
    }
View Full Code Here

    private Connection getConnection(String jndiName) throws Exception {
        // TODO - pass Habitat or ConnectorRuntime as an argument.
        // TODO - remove duplication with DeploymentHelper

        Habitat habitat = Globals.getDefaultHabitat();
        ConnectorRuntime connectorRuntime = habitat.getByContract(ConnectorRuntime.class);
        DataSource ds = PersistenceHelper.lookupNonTxResource(connectorRuntime, ctx, jndiName);
        return ds.getConnection();
    }
View Full Code Here

TOP

Related Classes of com.sun.appserv.connectors.internal.api.ConnectorRuntime

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.