Package org.mc4j.ems.connection

Examples of org.mc4j.ems.connection.EmsConnection


    *
    * @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
    */
   public AvailabilityType getAvailability() {
      boolean trace = log.isTraceEnabled();
      EmsConnection conn = getEmsConnection();
      try {
         conn.refresh();
         EmsBean bean = queryCacheManagerBean(conn);
         if (bean != null) {
            bean.refreshAttributes();
            if (trace) log.tracef("Cache manager %s could be found and attributes where refreshed, so it's up.", bean);
            return AvailabilityType.UP;
View Full Code Here


    *      java.util.Set)
    */
   public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) {
      boolean trace = log.isTraceEnabled();
      if (trace) log.tracef("Get values for these metrics: %s", metrics);
      EmsConnection conn = getEmsConnection();
      if (trace) log.tracef("Connection to ems server established: %s", conn);
      EmsBean bean = queryCacheManagerBean(conn);
      bean.refreshAttributes();
      if (trace) log.tracef("Querying returned bean: %s", bean);
      for (MeasurementScheduleRequest req : metrics) {
View Full Code Here

    * some "run state" we could check for that too.
    *
    * @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
    */
   public AvailabilityType getAvailability() {
      EmsConnection conn = getConnection();
      try {
         conn.refresh();
         EmsBean bean = conn.getBean(context.getResourceKey());
         if (bean != null)
            bean.refreshAttributes();
         return AvailabilityType.UP;
      } catch (Exception e) {
         return AvailabilityType.DOWN;
View Full Code Here

    * @see org.rhq.core.pluginapi.measurement.MeasurementFacet#getValues(org.rhq.core.domain.measurement.MeasurementReport,
    *      java.util.Set)
    */
   public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {

      EmsConnection conn = getConnection();
      EmsBean bean = conn.getBean(context.getPluginConfiguration().getSimpleValue("objectName", null));
      bean.refreshAttributes();

      for (MeasurementScheduleRequest req : metrics) {
         // TODO check with Traits in the future - also why are the values Strings?
         String tmp = (String) bean.getAttribute(req.getName()).getValue();
View Full Code Here

    * Helper to obtain a connection
    *
    * @return EmsConnection object
    */
   protected EmsConnection getConnection() {
      EmsConnection conn = helper.getEmsConnection(context.getPluginConfiguration());
      return conn;
   }
View Full Code Here

    */
   private int consecutiveConnectionErrors;


   public EmsConnection getEmsConnection(Configuration config) {
      EmsConnection emsConnection = null;

      try {
         emsConnection = loadConnection(config);
      } catch (Exception e) {
         log.error("Component attempting to access a connection that could not be loaded");
View Full Code Here

    * @see org.rhq.core.pluginapi.measurement.MeasurementFacet#getValues(org.rhq.core.domain.measurement.MeasurementReport,
    *      java.util.Set)
    */
   public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {

      EmsConnection conn = getConnection();
      for (MeasurementScheduleRequest req : metrics) {
         String metric = req.getName();
         try {
            String abbrev = metric.substring(0, metric.indexOf("."));
            String mbean = abbrevToMBean.get(abbrev);
            mbean = myNamePattern + mbean;
            EmsBean bean = conn.getBean(mbean);
            bean.refreshAttributes();
            String attName = metric.substring(metric.indexOf(".") + 1);
            EmsAttribute att = bean.getAttribute(attName);

            // Attribute values are of various data types ...
View Full Code Here

    * @return OperationResult object if successful
    * @throws Exception If operation was not successful
    */
   public OperationResult invokeOperation(String name,
                                          Configuration parameters) throws Exception {
      EmsConnection conn = getConnection();
      String abbrev = name.substring(0, name.indexOf("."));
      String mbean = abbrevToMBean.get(abbrev);
      mbean = myNamePattern + mbean;
      EmsBean bean = conn.getBean(mbean);
      String opName = name.substring(name.indexOf(".") + 1);
      EmsOperation ops = bean.getOperation(opName);
      if (ops != null)
         ops.invoke(new Object[]{});
      else
View Full Code Here

      c.put(new PropertySimple(JMXDiscoveryComponent.CONNECTOR_ADDRESS_CONFIG_PROPERTY, REMOTE));
      c.put(new PropertySimple(JMXDiscoveryComponent.CONNECTION_TYPE, connector));
      c.put(new PropertySimple("objectName", MANAGER_OBJECT));

      ConnectionHelper helper = new ConnectionHelper();
      EmsConnection conn = helper.getEmsConnection(c);

      // Run query for manager_object
      ObjectNameQueryUtility queryUtility = new ObjectNameQueryUtility(MANAGER_OBJECT);
      List<EmsBean> beans = conn.queryBeans(queryUtility.getTranslatedQuery());

      for (EmsBean bean : beans) {

         String managerName = bean.getBeanName().getCanonicalName();
         c.put(new PropertySimple("objectName", managerName));
View Full Code Here

    */
   public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<InfinispanComponent> discoveryContext) throws Exception {

      Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();

      EmsConnection conn = discoveryContext.getParentResourceComponent().getConnection();
      ObjectNameQueryUtility queryUtility = new ObjectNameQueryUtility(CACHE_QUERY);
      List<EmsBean> beans = conn.queryBeans(queryUtility.getTranslatedQuery());

      for (EmsBean bean : beans) {

         /**
          * A discovered resource must have a unique key, that must
View Full Code Here

TOP

Related Classes of org.mc4j.ems.connection.EmsConnection

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.