Examples of EmsBean


Examples of org.mc4j.ems.connection.bean.EmsBean

  protected ResourceContext<T> resourceContext;
   
    public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<MBeanResourceComponent> context) {
      Set<DiscoveredResourceDetails> entities = new HashSet<DiscoveredResourceDetails>();

        EmsBean serviceBean = context.getParentResourceComponent().getEmsBean();
        Set<EmsAttribute> attributeSet = serviceBean.getAttributes();
        for (Iterator i = attributeSet.iterator(); i.hasNext();) {
          EmsAttribute attr = (EmsAttribute) i.next();
          System.out.println(attr.getName());
            //entities.add(detail);
        }
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

 
  public Hashtable getVersionAttribute(ResourceDiscoveryContext<MBeanResourceComponent> context) {
      Hashtable ht = new Hashtable();

    try {
      EmsBean bean = context.getParentResourceComponent().getEmsConnection().getBean(SYSTEM_BEAN);
        EmsAttribute versionAttribute = bean.getAttribute(VERSION_NUMBER);   
        String version = (String) versionAttribute.refresh();
       
        EmsAttribute buildDateAttribute = bean.getAttribute(BUILD_DATE);
        String buildDate = (String) buildDateAttribute.refresh();
 
        EmsAttribute buildIDAttribute = bean.getAttribute(BUILD_ID);
        String buildID = (String) buildIDAttribute.refresh();
 
        ht.put(VERSION_NUMBER, version);
        ht.put(BUILD_DATE, buildDate);
        ht.put(BUILD_ID, buildID);
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

  @Override
  public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<JMXComponent> context) {
        Set<DiscoveredResourceDetails> jmxResources = super.discoverResources(context);

        String versionNumber;
    EmsBean bean = context.getParentResourceComponent().getEmsConnection().getBean(SOADiscoveryComponent.SYSTEM_BEAN);
    String resourceKey = null;

    try {
        EmsAttribute versionAttribute = bean.getAttribute(SOADiscoveryComponent.VERSION_NUMBER);   
        versionNumber = (String) versionAttribute.refresh();
        } catch (Exception e) {
          versionNumber = "";
        }

    for (Iterator i = jmxResources.iterator(); i.hasNext();) {
          String description = null;
          DiscoveredResourceDetails drd = (DiscoveredResourceDetails) i.next();
          resourceKey = drd.getResourceKey();
          try {
                EmsBean discoverBean = context.getParentResourceComponent().getEmsConnection().getBean(resourceKey);
                Set<EmsAttribute> attributeSet = discoverBean.getAttributes();
                for (Iterator ai = attributeSet.iterator(); ai.hasNext();) {
                    EmsAttribute attr = (EmsAttribute) ai.next();

                    if (attr.getName().endsWith(SERVICE_DESCRIPTION)) {
                        description = (String) attr.getValue();
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

  }
 
    public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<MBeanResourceComponent> context) {
        Set<DiscoveredResourceDetails> entities = new HashSet<DiscoveredResourceDetails>();

        EmsBean actionBean = context.getParentResourceComponent().getEmsBean();
        String serviceName = actionBean.getBeanName().getKeyProperty(SERVICE_NAME);       
       
        String versionNumber;
        try {
          Hashtable ht = getVersionAttribute(context);
          versionNumber = (String) ht.get(VERSION_NUMBER);
        } catch (Exception e) {
          versionNumber = "";
        }
       
        // Do two passes - one to grab the entity names (ex. "data fileraction"
        // and then a second to build up the metrics for the entity
        Set<EmsAttribute> attributeSet = actionBean.getAttributes();
        for (Iterator i = attributeSet.iterator(); i.hasNext();) {
          EmsAttribute attr = (EmsAttribute) i.next();
          if (attr.getName().endsWith(MESSAGES_SUCCESSFULLY_PROCESSED)) {
            String actionName = attr.getName().replaceAll(MESSAGES_SUCCESSFULLY_PROCESSED, "");
                DiscoveredResourceDetails detail = new DiscoveredResourceDetails(context.getResourceType(), actionName,
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

     * @return true if the service is running
     */
    @Override
  public AvailabilityType getAvailability() {
        try {
          EmsBean emsbean = getEmsBean();
          if (emsbean.isRegistered()) {
              String actionName = this.context.getResourceKey();
              actionName = actionName.trim();
            EmsAttribute attribute = this.bean.getAttribute(actionName + " " + SUCCESS_PROCESSED);
            if (attribute != null) {
              return AvailabilityType.UP;
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

     */
    @SuppressWarnings("unchecked")
    private List<Object> getKeyspaces(EmsConnection emsConnection) {
        List<Object> value = null;

        EmsBean emsBean = loadBean(STORAGE_SERVICE_BEAN, emsConnection);
        if (emsBean != null) {
            EmsAttribute attribute = emsBean.getAttribute("Keyspaces");
            if (attribute != null) {
                value = (List<Object>) attribute.refresh();
            }
        }

View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

     * @param objectName the name of the bean to load
     * @return the bean that is loaded
     */
    private EmsBean loadBean(String objectName, EmsConnection emsConnection) {
        if (emsConnection != null) {
            EmsBean bean = emsConnection.getBean(objectName);
            if (bean == null) {
                // In some cases, this resource component may have been discovered by some means other than querying its
                // parent's EMSConnection (e.g. ApplicationDiscoveryComponent uses a filesystem to discover EARs and
                // WARs that are not yet deployed). In such cases, getBean() will return null, since EMS won't have the
                // bean in its cache. To cover such cases, make an attempt to query the underlying MBeanServer for the
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

        if (log.isInfoEnabled()) {
            log.info("Starting shutdown operation on " + CassandraNodeComponent.class.getName() +
                " with resource key " + context.getResourceKey());
        }
        EmsConnection emsConnection = getEmsConnection();
        EmsBean storageService = emsConnection.getBean("org.apache.cassandra.db:type=StorageService");
        Class[] emptyParams = new Class[0];

        if (log.isDebugEnabled()) {
            log.debug("Disabling thrift...");
        }
        EmsOperation operation = storageService.getOperation("stopRPCServer", emptyParams);
        operation.invoke((Object[]) emptyParams);

        if (log.isDebugEnabled()) {
            log.debug("Disabling gossip...");
        }
        operation = storageService.getOperation("stopGossiping", emptyParams);
        operation.invoke((Object[]) emptyParams);

        if (log.isDebugEnabled()) {
            log.debug("Initiating drain...");
        }
        operation = storageService.getOperation("drain", emptyParams);
        operation.invoke((Object[]) emptyParams);

        return stopNode();
    }
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

    }

    public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
        EmsConnection connection = getEmsConnection();

        EmsBean detailComponent = connection.getBean(beanName);

        for (MeasurementScheduleRequest request : metrics) {

            String metricName = request.getName();
            try {
                EmsAttribute atribute = detailComponent.getAttribute(metricName);

                Object value = atribute.refresh();

                if (value != null)
                    if (request.getDataType() == DataType.MEASUREMENT) {
                        Double number = ((Number) value).doubleValue();
                        report.addData(new MeasurementDataNumeric(request, number));
                    } else if (request.getDataType() == DataType.TRAIT) {
                        report.addData(new MeasurementDataTrait(request, value.toString()));
                    }
            } catch (Exception e) {
                log.error("Failure to collect measurement data for metric " + metricName + " from bean "
                    + detailComponent.getBeanName(), e);
            }

        }

    }
View Full Code Here

Examples of org.mc4j.ems.connection.bean.EmsBean

    public OperationResult invokeOperation(String name, Configuration parameters) throws InterruptedException,
        Exception {
        OperationResult result = null;

        try {
            EmsBean detailComponent = getEmsConnection().getBean(beanName);

            EmsOperation operation = detailComponent.getOperation(name);

            Object obj = operation.invoke(new Object[] {});

            if (obj != null) {
                result = new OperationResult();
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.