Package org.mc4j.ems.connection.bean

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


    private EmsOperation deployOperation;
    private EmsOperation redeployOperation;
    private EmsOperation undeployOperation;

    public MainDeployer(EmsConnection connection) throws NoSuchMethodException {
        EmsBean mainDeployer = connection.getBean(JBossMBeans.MAIN_DEPLOYER);
        if (mainDeployer == null) {
            throw new IllegalStateException("MBean named [" + JBossMBeans.MAIN_DEPLOYER + "] does not exist.");
        }
        this.deployOperation = EmsUtility.getOperation(mainDeployer, "deploy", URL.class);
        this.redeployOperation = EmsUtility.getOperation(mainDeployer, "redeploy", URL.class);
View Full Code Here


        EmsConnection connection = this.serverComponent.getEmsConnection();
        if (connection == null) {
            throw new RuntimeException("Can not connect to the server");
        }
        EmsBean bean = connection.getBean(mbeanName);
        EmsOperation operation = bean.getOperation(operationName);
        /*
         *  Now see if we got the 'real' method (the one with no param) or the overloaded one.
         *  This is a workaround for a bug in EMS that prevents finding operations with same name
         *  and different signature.
         *  http://sourceforge.net/tracker/index.php?func=detail&aid=2007692&group_id=60228&atid=493495
View Full Code Here

      if (m.find()) {
        beanName = m.replaceFirst(m.group(2).equals(",") ? m.group(1)
            : "");

        if (!cacheNames.contains(beanName)) {
          EmsBean bean = connection.getBean(beanName);
          if (bean != null)
            cacheNames.add(beanName);
        }
      }
    }
View Full Code Here

      MeasurementFacet measurementFacet = ComponentUtil.getComponent(
          resource.getId(), MeasurementFacet.class,
          FacetLockType.READ, MEASUREMENT_FACET_METHOD_TIMEOUT, true,
          true, true);
      EmsBean relatedBean = connection.getBean(resource.getResourceKey());

      for (MeasurementDefinition metricDefinition : metricDefinitions) {

        String compValue = TestHelper.getMetricValue(metricDefinition,
            measurementFacet);
        EmsAttribute atr = relatedBean.getAttribute(metricDefinition
            .getName());
        log.info("            Validating Metric "
            + metricDefinition.getName() + ". (plugin value=" +compValue + ", bean value=" + atr.getValue() + ")");
        String beanValue = String.valueOf(atr.getValue());
View Full Code Here

      return false;
    }
  }

  protected Object getEmsOperationResult(String beanName, String operationName) {
    EmsBean bean = connection.getBean(beanName);
    EmsOperation operation = bean.getOperation(operationName);

    Object obj = operation.invoke(new Object[] {});
    return obj;
  }
View Full Code Here

    return obj;
  }

  protected String getOperationResultType(String beanName,
      String operationName) {
    EmsBean bean = connection.getBean(beanName);
    EmsOperation operation = bean.getOperation(operationName);
    return operation.getReturnType();
  }
View Full Code Here

    EmsOperation operation = bean.getOperation(operationName);
    return operation.getReturnType();
  }

  protected Object getEmsAttribute(String beanName, String attName) {
    EmsBean bean = connection.getBean(beanName);
    EmsAttribute att = bean.getAttribute(attName);

    Object obj = att.getValue();
    return obj;
  }
View Full Code Here

   @Override
   public AvailabilityType getAvailability() {
      boolean trace = log.isTraceEnabled();
      EmsConnection conn = getEmsConnection();
      try {
         EmsBean bean = queryCacheManagerBean(conn);
         if (bean != null) {
            if (trace) log.trace("Cache manager "+bean+" could be found, so it's up.");
            return AvailabilityType.UP;
         }
         if (trace) log.trace("Cache manager could not be found, so cache manager is down");
View Full Code Here

    */
   @Override
   public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) {
      boolean trace = log.isTraceEnabled();
      if (trace) log.trace("Get values for these metrics: " + metrics);
      EmsBean bean = getEmsBean();
      bean.refreshAttributes();
      if (trace) log.trace("Querying returned bean: " + bean);
      for (MeasurementScheduleRequest req : metrics) {
         DataType type = req.getDataType();
         if (type == DataType.MEASUREMENT) {
            EmsAttribute att = bean.getAttribute(req.getName());
            if (att != null) {
               MeasurementDataNumeric res = constructNumericMeasure(att.getTypeClass(), att.getValue(), req);
               report.addData(res);
            }
         } else if (type == DataType.TRAIT) {
            String value = (String) bean.getAttribute(req.getName()).getValue();
            if (trace) log.trace("Metric ("+req.getName()+") is trait with value "+ value);
            MeasurementDataTrait res = new MeasurementDataTrait(req, value);
            report.addData(res);
         }
      }
View Full Code Here

   }

   private EmsBean queryCacheManagerBean(EmsConnection conn) {
      String pattern = cacheManagerPattern;
      if (log.isTraceEnabled()) log.trace("Pattern to query is " + pattern);
      EmsBean bean = conn.getBean(pattern);
      if (bean != null) {
         return bean;
      }
      throw new IllegalStateException("MBeanServer unexpectedly did not return any CacheManager components");
   }
View Full Code Here

TOP

Related Classes of org.mc4j.ems.connection.bean.EmsBean

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.