All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bigdata.ganglia.RichMetricMessage Maven / Gradle / Ivy

/*
   Copyright (C) SYSTAP, LLC 2006-2012.  All rights reserved.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
package com.bigdata.ganglia;

/**
 * Class bundles together an {@link IGangliaMetricMessage} with the
 * {@link IGangliaMetadataMessage} which provides its declaration.
 */
public class RichMetricMessage extends GangliaMetricMessage {

	/** The declaration. */
	private final IGangliaMetadataMessage decl;

	/**
	 * The declaration and never null.
	 */
	public IGangliaMetadataMessage getMetadata() {
		
		return decl;
		
	}
	
	/**
	 * Constructor produces an {@link IGangliaMetricMessage} which is consistent
	 * with the {@link IGangliaMetadataMessage}.
	 * 
	 * @param hostName
	 *            The host reporting this metric value (should be ip:host if
	 *            this is a spoof record).
	 * @param decl
	 *            The metric declaration.
	 * @param spoof
	 *            if this is a spoof record.
	 * @param format
	 *            The printf format to be used.
	 * @param value
	 *            The value.
	 * 
	 * @throws IllegalArgumentException
	 *             if the hostName is null.
	 * @throws NullPointerException
	 *             if the declaration is null.
	 * @throws IllegalArgumentException
	 *             if the format is null.
	 * @throws IllegalArgumentException
	 *             if the value is null.
	 */
	public RichMetricMessage(final String hostName,
			final IGangliaMetadataMessage decl, final boolean spoof,
			final String format, final Object value) {

		super(decl.getMetricType(), hostName, decl.getMetricName(), spoof,
				format, value);

		this.decl = decl;

	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy