Package org.glassfish.connectors.config

Examples of org.glassfish.connectors.config.ConnectorResource


       
        jndiNameForConnectionPool = jndiName + JNDINAME_APPENDER;

        ActionReport subReport = report.addSubActionsReport();

        ConnectorResource cresource = null;
        Resource res = ConnectorsUtil.getResourceByName(domain.getResources(), ConnectorResource.class, jndiName);
        if (res instanceof ConnectorResource) {
            cresource = (ConnectorResource) res;
        }
        /* for (ConnectorResource cr : connResources) {
         if (cr.getJndiName().equals(jndiName))
         cresource = cr;
         } */
        if (cresource == null) {
            ParameterMap params = new ParameterMap();
            params.set("jndi_name", jndiName);
            params.set("DEFAULT", jndiName);
            params.set("target", target);
            commandRunner.getCommandInvocation("delete-admin-object", subReport, context.getSubject()).parameters(params).execute();

            if (ActionReport.ExitCode.FAILURE.equals(subReport.getActionExitCode())) {
                report.setMessage(localStrings.getLocalString("delete.jms.resource.cannotDeleteJMSAdminObject",
                        "Unable to Delete Admin Object."));
                report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                return;
            }
        } else {
            // Delete the connector resource and connector connection pool
            String defPoolName = jndiNameForConnectionPool;
            String poolName = cresource.getPoolName();
            if (poolName != null && poolName.equals(defPoolName)) {
                ParameterMap params = new ParameterMap();
                params.set("DEFAULT", jndiName);
                params.set("connector_resource_name", jndiName);
                params.set("target", target);
View Full Code Here


                    list.add(m);
                }
            }

            for (Object c: connectorResources) {
                ConnectorResource cr = (ConnectorResource) c;
                ConnectorConnectionPool cp = (ConnectorConnectionPool) ConnectorsUtil.getResourceByName(
                        domain.getResources(), ConnectorConnectionPool.class, cr.getPoolName());

                if (cp  != null && JMSRA.equals(cp.getResourceAdapterName())){
                    Map<String,String> m = new HashMap<>();
                    m.put("name", cr.getJndiName());
                    list.add(m);
                }
            }
        } catch (Exception e) {
            report.setMessage(localStrings.getLocalString("list.jms.resources.fail",
                    "Unable to list JMS Resources") + " " + e.getLocalizedMessage());
            report.setActionExitCode(ActionReport.ExitCode.FAILURE);
            report.setFailureCause(e);
            return;
        }
      } else {
            switch (resourceType) {
                case TOPIC_CF:
                case QUEUE_CF:
                case UNIFIED_CF:
                    for (Object c : connectorResources) {
                       ConnectorResource cr = (ConnectorResource)c;
                       ConnectorConnectionPool cp = (ConnectorConnectionPool)
                               ConnectorsUtil.getResourceByName(domain.getResources(), ConnectorConnectionPool.class, cr.getPoolName());
                       if(cp != null && resourceType.equals(cp.getConnectionDefinitionName()) && JMSRA.equals(cp.getResourceAdapterName())) {
                            Map<String,String> m = new HashMap<>();
                            m.put("name", cr.getJndiName());
                            list.add(m);
                        }
                    }
                    break;
                case TOPIC:
View Full Code Here

            /*Resources rbeans = getAllResources();//ServerBeansFactory.getDomainBean(ctx).getResources();
            ConnectorResource res = (ConnectorResource)
                             rbeans.getResourceByName(ConnectorResource.class, cfName);*/
            String appName = descriptor_.getApplication().getAppName();
            String moduleName = ConnectorsUtil.getModuleName(descriptor_);
            ConnectorResource res = (ConnectorResource)
                    ResourcesUtil.createInstance().getResource(cfName, appName, moduleName, ConnectorResource.class);
        if (res == null) {
            String msg = sm.getString("ajra.mdb_cf_not_created", cfName);
        throw new ConnectorRuntimeException(msg);
        }

        ConnectorConnectionPool ccp = (ConnectorConnectionPool)
             ResourcesUtil.createInstance().getResource(res.getPoolName(), appName, moduleName, ConnectorConnectionPool.class);
            //rbeans.getResourceByName(ConnectorConnectionPool.class, res.getPoolName());

        ep = ccp.getProperty();
        } catch(Exception ce) {
        String msg = sm.getString("ajra.mdb_cf_not_created", cfName);
View Full Code Here

       
        jndiNameForConnectionPool = jndiName + JNDINAME_APPENDER;

        ActionReport subReport = report.addSubActionsReport();

        ConnectorResource cresource = null;
        Resource res = ConnectorsUtil.getResourceByName(domain.getResources(), ConnectorResource.class, jndiName);
        if (res instanceof ConnectorResource) {
            cresource = (ConnectorResource) res;
        }
        /* for (ConnectorResource cr : connResources) {
         if (cr.getJndiName().equals(jndiName))
         cresource = cr;
         } */
        if (cresource == null) {
            ParameterMap params = new ParameterMap();
            params.set("jndi_name", jndiName);
            params.set("DEFAULT", jndiName);
            params.set("target", target);
            commandRunner.getCommandInvocation("delete-admin-object", subReport, context.getSubject()).parameters(params).execute();

            if (ActionReport.ExitCode.FAILURE.equals(subReport.getActionExitCode())) {
                report.setMessage(localStrings.getLocalString("delete.jms.resource.cannotDeleteJMSAdminObject",
                        "Unable to Delete Admin Object."));
                report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                return;
            }
        } else {
            if (!cascade) {
                Collection<ConnectorResource> connectorResources = domain.getResources().getResources(ConnectorResource.class);
                String connPoolName = jndiName + JNDINAME_APPENDER;
                int count = 0;
                for (ConnectorResource resource : connectorResources) {
                    if (connPoolName.equals(resource.getPoolName())) {
                        count ++;
                        if (count > 1)
                            break;
                    }
                }
                if (count > 1) {
                    report.setMessage(localStrings.getLocalString("found.more.connector.resources",
                            "Some connector resources are referencing connection pool {0}. Use 'cascade' option to delete them", connPoolName));
                    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                    return;
                }
            }

            ActionReport listReport = habitat.getService(ActionReport.class);
            ParameterMap listParams = new ParameterMap();
            listParams.set("target", target);
            commandRunner.getCommandInvocation("list-jms-resources", listReport, context.getSubject()).parameters(listParams).execute();
            if (ActionReport.ExitCode.FAILURE.equals(listReport.getActionExitCode())) {
                report.setMessage(localStrings.getLocalString("list.jms.resources.fail",
                        "Unable to list JMS Resources"));
                report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                return;
            }
            Properties extraProps = listReport.getExtraProperties();
            if (extraProps != null && extraProps.size() > 0) {
                boolean resourceExist = false;
                for (int i=0; i<extraProps.size(); i++) {
                    List<Map<String, String>> nameList = (List) extraProps.get("jmsResources");
                    for (Map<String,String> m : nameList) {
                        String jndi = (String) m.get("name");
                        if (jndiName.equals(jndi)) {
                            resourceExist = true;
                            break;
                        }
                    }
                    if (resourceExist)
                        break;
                }
                if (!resourceExist) {
                    report.setMessage(localStrings.getLocalString("jms.resources.not.found",
                        "JMS Resource {0} not found", jndiName));
                    report.setActionExitCode(ActionReport.ExitCode.FAILURE);
                    return;
                }
            }

            // Delete the connector resource and connector connection pool
            String defPoolName = jndiNameForConnectionPool;
            String poolName = cresource.getPoolName();
            if (poolName != null && poolName.equals(defPoolName)) {
                ParameterMap params = new ParameterMap();
                params.set("DEFAULT", jndiName);
                params.set("connector_resource_name", jndiName);
                params.set("target", target);
View Full Code Here

            resourceUtil.deleteResourceRef(jndiName, target);

            // delete connector-resource
            if (ConfigSupport.apply(new SingleConfigCode<Resources>() {
                public Object run(Resources param) throws PropertyVetoException, TransactionFailure {
                    ConnectorResource resource = (ConnectorResource)
                            ConnectorsUtil.getResourceByName(domain.getResources(), ConnectorResource.class, jndiName );
                    return param.getResources().remove(resource);
                }
            }, domain.getResources()) == null) {
                report.setMessage(localStrings.getLocalString("delete.connector.resource.fail",
View Full Code Here

            /*Resources rbeans = getAllResources();//ServerBeansFactory.getDomainBean(ctx).getResources();
            ConnectorResource res = (ConnectorResource)
                             rbeans.getResourceByName(ConnectorResource.class, cfName);*/
            String appName = descriptor_.getApplication().getAppName();
            String moduleName = ConnectorsUtil.getModuleName(descriptor_);
            ConnectorResource res = (ConnectorResource)
                    ResourcesUtil.createInstance().getResource(cfName, appName, moduleName, ConnectorResource.class);
        if (res == null) {
            String msg = sm.getString("ajra.mdb_cf_not_created", cfName);
        throw new ConnectorRuntimeException(msg);
        }

        ConnectorConnectionPool ccp = (ConnectorConnectionPool)
             ResourcesUtil.createInstance().getResource(res.getPoolName(), appName, moduleName, ConnectorConnectionPool.class);
            //rbeans.getResourceByName(ConnectorConnectionPool.class, res.getPoolName());

        ep = ccp.getProperty();
        } catch(Exception ce) {
        String msg = sm.getString("ajra.mdb_cf_not_created", cfName);
View Full Code Here

            /*Resources rbeans = getAllResources();//ServerBeansFactory.getDomainBean(ctx).getResources();
            ConnectorResource res = (ConnectorResource)
                             rbeans.getResourceByName(ConnectorResource.class, cfName);*/
            String appName = descriptor_.getApplication().getAppName();
            String moduleName = ConnectorsUtil.getModuleName(descriptor_);
            ConnectorResource res = (ConnectorResource)
                    ResourcesUtil.createInstance().getResource(cfName, appName, moduleName, ConnectorResource.class);
        if (res == null) {
            String msg = sm.getString("ajra.mdb_cf_not_created", cfName);
        throw new ConnectorRuntimeException(msg);
        }

        ConnectorConnectionPool ccp = (ConnectorConnectionPool)
             ResourcesUtil.createInstance().getResource(res.getPoolName(), appName, moduleName, ConnectorConnectionPool.class);
            //rbeans.getResourceByName(ConnectorConnectionPool.class, res.getPoolName());

        ep = ccp.getProperty();
        } catch(Exception ce) {
        String msg = sm.getString("ajra.mdb_cf_not_created", cfName);
View Full Code Here

        //deploy pool
        getDeployer(connectorCp).deployResource(connectorCp);

        //deploy resource
        ConnectorResource connectorResource = new MyConnectorResource(poolName, resourceName);
        getDeployer(connectorResource).deployResource(connectorResource);
       
    }
View Full Code Here

            _logger.log(Level.FINE, "ConnectionFactoryDefinitionDeployer.undeployResource() : pool-name ["+poolName+"], " +
                    " resource-name ["+resourceName+"]");
        }

        //undeploy resource
        ConnectorResource connectorResource = new MyConnectorResource(poolName, resourceName);
        getDeployer(connectorResource).undeployResource(connectorResource);

        //undeploy pool
        ConnectorConnectionPool connectorCp = new MyConnectorConnectionPool(desc, poolName);
        getDeployer(connectorCp).undeployResource(connectorCp);
View Full Code Here

            return;
        }

        List<ConnectorConnectionPool> connPools = new ArrayList<ConnectorConnectionPool>();
        for (Resource resource : connectorResources) {
            ConnectorResource connResource = (ConnectorResource) resource;
            if(getResourcesUtil().isEnabled(connResource)) {
                ResourceInfo resourceInfo = ConnectorsUtil.getResourceInfo(connResource);
                ConnectorConnectionPool pool = ResourcesUtil.createInstance().getConnectorConnectionPoolOfResource(resourceInfo);
                if (pool != null &&
                        ConnectorConstants.XA_TRANSACTION_TX_SUPPORT_STRING.equals(
                                getTransactionSupport(pool))) {
                    connPools.add(pool);
                    if (_logger.isLoggable(Level.FINE)) {
                        _logger.fine("ConnectorsRecoveryResourceHandler loadXAResourcesAndItsConnections :: "
                                + "adding : " + connResource.getPoolName());
                    }
                }
            }
        }
        loadAllConnectorResources();
View Full Code Here

TOP

Related Classes of org.glassfish.connectors.config.ConnectorResource

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.