Examples of AdminObjectResource


Examples of org.glassfish.connectors.config.AdminObjectResource

     Property ep = null;
        try {
            //ServerContext sc = ApplicationServer.getServerContext();
            //ConfigContext ctx = sc.getConfigContext();
            //Resources rbeans =                           ServerBeansFactory.getDomainBean(ctx).getResources();
            AdminObjectResource res = null;
            res = (AdminObjectResource)
                    ResourcesUtil.createInstance().getResource(logicalDest, appName, moduleName, AdminObjectResource.class);
            //AdminObjectResource res = (AdminObjectResource)   allResources.getAdminObjectResourceByJndiName(logicalDest);
        if (res == null) {
            String msg = sm.getString("ajra.err_getting_dest", logicalDest );
        throw new ConnectorRuntimeException(msg);
        }

        ep = res.getProperty(PHYSICAL_DESTINATION); //getElementPropertyByName(PHYSICAL_DESTINATION);
        } catch(Exception ce) {
        String msg = sm.getString("ajra.err_getting_dest", logicalDest);
        ConnectorRuntimeException cre = new ConnectorRuntimeException( msg );
        cre.initCause( ce );
            throw cre;
View Full Code Here

Examples of org.glassfish.connectors.config.AdminObjectResource

        if (resourceType == null){
          try {
            //list all JMS resources
            for (Object r :  adminObjectResources) {
                AdminObjectResource adminObject = (AdminObjectResource) r;
                if (JMSRA.equals(adminObject.getResAdapter())) {
                    Map<String,String> m = new HashMap<>();
                    m.put("name", adminObject.getJndiName());
                    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:
                case QUEUE:
                    for (Object r : adminObjectResources) {
                        AdminObjectResource res = (AdminObjectResource)r;
                        if(resourceType.equals(res.getResType()) && JMSRA.equals(res.getResAdapter())) {
                            Map<String,String> m = new HashMap<>();
                            m.put("name", res.getJndiName());
                            list.add(m);
                        }
                    }
                    break;
            }
View Full Code Here

Examples of org.glassfish.connectors.config.AdminObjectResource

                        _logger.log(Level.INFO, "endpoint.determine.destinationtype", new
                                Object[]{aor.getResType() , aor.getJndiName() , descriptor_.getName()});
                    }
                }
*/
                AdminObjectResource aor = (AdminObjectResource)
                        ResourcesUtil.createInstance().getResource(jndiName, appName, moduleName, AdminObjectResource.class);
                if(aor != null && ConnectorConstants.DEFAULT_JMS_ADAPTER.equals(aor.getResAdapter())){
                    descriptor_.putRuntimeActivationConfigProperty(
                            new EnvironmentProperty(DESTINATION_TYPE,
                                    aor.getResType(), null));
                    _logger.log(Level.INFO, "endpoint.determine.destinationtype", new
                            Object[]{aor.getResType() , aor.getJndiName() , descriptor_.getName()});
                }

            } catch (Exception e) {

            }
View Full Code Here

Examples of org.glassfish.connectors.config.AdminObjectResource

     Property ep = null;
        try {
            //ServerContext sc = ApplicationServer.getServerContext();
            //ConfigContext ctx = sc.getConfigContext();
            //Resources rbeans =                           ServerBeansFactory.getDomainBean(ctx).getResources();
            AdminObjectResource res = null;
            res = (AdminObjectResource)
                    ResourcesUtil.createInstance().getResource(logicalDest, appName, moduleName, AdminObjectResource.class);
            //AdminObjectResource res = (AdminObjectResource)   allResources.getAdminObjectResourceByJndiName(logicalDest);
        if (res == null) {
            String msg = sm.getString("ajra.err_getting_dest", logicalDest );
        throw new ConnectorRuntimeException(msg);
        }

        ep = res.getProperty(PHYSICAL_DESTINATION); //getElementPropertyByName(PHYSICAL_DESTINATION);
        } catch(Exception ce) {
        String msg = sm.getString("ajra.err_getting_dest", logicalDest);
        ConnectorRuntimeException cre = new ConnectorRuntimeException( msg );
        cre.initCause( ce );
            throw cre;
View Full Code Here

Examples of org.glassfish.connectors.config.AdminObjectResource

        if(resourceType == null){
          try{
            //list all JMS resources
            for (Object r :  adminObjectResources) {
               AdminObjectResource adminObject = (AdminObjectResource) r;
               if (JMSRA.equalsIgnoreCase(adminObject.getResAdapter()))
              //if(QUEUE.equals(r.getResType()) || TOPIC.equals(r.getResType()))
                list.add(adminObject.getJndiName());
            }

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

                if (cp  != null && JMSRA.equalsIgnoreCase(cp.getResourceAdapterName())){
                      list.add(cr.getJndiName());
                }
               //if(QUEUE_CF.equals(cp.getConnectionDefinitionName()) || TOPIC_CF.equals(cp.getConnectionDefinitionName())
                 //      || UNIFIED_CF.equals(cp.getConnectionDefinitionName()))

            }
            if (list.isEmpty()) {
                final ActionReport.MessagePart part = report.getTopMessagePart().addChild();
                part.setMessage(localStrings.getLocalString("nothingToList",
                    "Nothing to list."));
                extraProperties.put("jmsResources", list);
            } else {

               List <String> resourceList = null;

               if(CommandTarget.DOMAIN.isValid(habitat, target))
                     resourceList = list;
               else
                     resourceList =  filterListForTarget(list);
               //if(resourceList == null)
                 //   resourceList = list;


                for (String jndiName : resourceList) {
                    final ActionReport.MessagePart part = report.getTopMessagePart().addChild();
                    part.setMessage(jndiName);
                }
                extraProperties.put("jmsResources", resourceList);
            }
            report.setExtraProperties(extraProperties);
        } 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 {
          if(resourceType.equals(TOPIC_CF) || resourceType.equals(QUEUE_CF) || resourceType.equals(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.equalsIgnoreCase(cp.getResourceAdapterName()))
                    list.add(cp.getName());
            }
          }  else if (resourceType.equals(TOPIC) || resourceType.equals(QUEUE))
          {
                for (Object r : adminObjectResources) {
                    AdminObjectResource res = (AdminObjectResource)r;
                    if(resourceType.equals(res.getResType()))                            
                        list.add(res.getJndiName());
            }

          }

View Full Code Here

Examples of org.glassfish.connectors.config.AdminObjectResource

        return status;
    }

    private AdminObjectResource createResource(Resources param, Properties props) throws PropertyVetoException,
            TransactionFailure  {
        AdminObjectResource newResource = createConfigBean(param, props);
        param.getResources().add(newResource);
        return newResource;
    }
View Full Code Here

Examples of org.glassfish.connectors.config.AdminObjectResource

        return newResource;
    }

    private AdminObjectResource createConfigBean(Resources param, Properties props) throws PropertyVetoException,
            TransactionFailure {
        AdminObjectResource newResource = param.createChild(AdminObjectResource.class);
        newResource.setJndiName(jndiName);
        if (description != null) {
            newResource.setDescription(description);
        }
        newResource.setResAdapter(raName);
        newResource.setResType(resType);
        newResource.setClassName(className);
        newResource.setEnabled(enabled);
        if (props != null) {
            for ( Map.Entry e : props.entrySet()) {
                Property prop = newResource.createChild(Property.class);
                prop.setName((String)e.getKey());
                prop.setValue((String)e.getValue());
                newResource.getProperty().add(prop);
            }
        }
        return newResource;
    }
View Full Code Here

Examples of org.glassfish.connectors.config.AdminObjectResource

                 * defined for default JMS RA. This is a best attempt guess and if there
                 * are no JMS destination resources/admin-objects defined, AS would pass
                 * the properties as defined by the MDB.
                 */
                try {
                    AdminObjectResource aor = (AdminObjectResource)
                            ResourcesUtil.createInstance().getResource(jndiName, appName, moduleName, AdminObjectResource.class);
                    if(aor != null && ConnectorConstants.DEFAULT_JMS_ADAPTER.equals(aor.getResAdapter())){
                        descriptor_.putRuntimeActivationConfigProperty(
                                new EnvironmentProperty(DESTINATION_TYPE,
                                        aor.getResType(), null));
                        _logger.log(Level.INFO, "endpoint.determine.destinationtype", new
                                Object[]{aor.getResType() , aor.getJndiName() , descriptor_.getName()});
                    }
   
                } catch (Exception e) {
   
                }
View Full Code Here

Examples of org.glassfish.connectors.config.AdminObjectResource

        Property ep = null;
        try {
            //ServerContext sc = ApplicationServer.getServerContext();
            //ConfigContext ctx = sc.getConfigContext();
            //Resources rbeans =                           ServerBeansFactory.getDomainBean(ctx).getResources();
            AdminObjectResource res = null;
            res = (AdminObjectResource)
                    ResourcesUtil.createInstance().getResource(logicalDest, appName, moduleName, AdminObjectResource.class);
            //AdminObjectResource res = (AdminObjectResource)   allResources.getAdminObjectResourceByJndiName(logicalDest);
        if (res == null) {
            String msg = sm.getString("ajra.err_getting_dest", logicalDest);
            throw new ConnectorRuntimeException(msg);
        }

        ep = res.getProperty(PHYSICAL_DESTINATION); //getElementPropertyByName(PHYSICAL_DESTINATION);
        } catch(Exception ce) {
        String msg = sm.getString("ajra.err_getting_dest", logicalDest);
        ConnectorRuntimeException cre = new ConnectorRuntimeException( msg );
        cre.initCause( ce );
            throw cre;
View Full Code Here

Examples of org.glassfish.connectors.config.AdminObjectResource

                 * defined for default JMS RA. This is a best attempt guess and if there
                 * are no JMS destination resources/admin-objects defined, AS would pass
                 * the properties as defined by the MDB.
                 */
                try {
                    AdminObjectResource aor = (AdminObjectResource)
                            ResourcesUtil.createInstance().getResource(jndiName, appName, moduleName, AdminObjectResource.class);
                    if(aor != null && ConnectorConstants.DEFAULT_JMS_ADAPTER.equals(aor.getResAdapter())){
                        descriptor_.putRuntimeActivationConfigProperty(
                                new EnvironmentProperty(DESTINATION_TYPE,
                                        aor.getResType(), null));
                        if (_logger.isLoggable(Level.INFO)) {
                            _logger.log(Level.INFO, "endpoint.determine.destinationtype", new
                                    Object[]{aor.getResType() , aor.getJndiName() , descriptor_.getName()});
                        }
                    }
   
                } catch (Exception e) {
   
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.