Created
June 13, 2012 01:36
-
-
Save jsanda/2921241 to your computer and use it in GitHub Desktop.
RHQ metrics domain model classes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MeasurementDataTrait extends MeasurementData { | |
@Column(length = 255) | |
private String value; | |
// rest omitted for brevity | |
} | |
@Entity | |
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) | |
public abstract class MeasurementData implements Serializable { | |
// The PK is a combo of timestamp and schedule id | |
@EmbeddedId | |
MeasurementDataPK id; | |
@JoinColumn(name = "SCHEDULE_ID", insertable = false, updatable = false, nullable = false) | |
@ManyToOne(fetch = FetchType.LAZY, optional = false) | |
MeasurementSchedule schedule; | |
// rest omitted for brevity | |
} | |
@Table(name = "RHQ_MEASUREMENT_SCHED", uniqueConstraints = { | |
@UniqueConstraint(columnNames = { "DEFINITION", "RESOURCE_ID" }) }) | |
public class MeasurementSchedule implements Serializable { | |
@Id | |
private int id; | |
@JoinColumn(name = "DEFINITION") | |
@ManyToOne(fetch = FetchType.EAGER) | |
private MeasurementDefinition definition; | |
@JoinColumn(name = "RESOURCE_ID", referencedColumnName = "ID", nullable = false) | |
@ManyToOne(fetch = FetchType.LAZY) | |
private Resource resource; | |
@Column(name = "COLL_INTERVAL") | |
private long interval; | |
@Column(name = "ENABLED") | |
private boolean enabled; | |
// rest omitted for brevity | |
} | |
@Table(name = "RHQ_MEASUREMENT_DEF") | |
public class MeasurementDefinition implements Serializable { | |
@Column(name = "ID", nullable = false) | |
@Id | |
private int id; | |
@JoinColumn(name = "RESOURCE_TYPE_ID", referencedColumnName = "ID", nullable = false) | |
@ManyToOne(fetch = FetchType.LAZY) | |
private ResourceType resourceType; | |
@Column(length = 100, nullable = false) | |
private String name; | |
@Column(name = "DISPLAY_NAME") | |
private String displayName; | |
/** | |
* Type of this Metric (Availability, Throughput, ...) | |
*/ | |
@Enumerated(EnumType.ORDINAL) | |
private MeasurementCategory category; | |
/** | |
* Concrete schedules for this metric | |
*/ | |
@OneToMany(mappedBy = "definition") | |
List<measurementschedule> schedules = new ArrayList<measurementschedule>(); | |
/** | |
* Measurement unit in which this metric is taken | |
*/ | |
@Enumerated(EnumType.ORDINAL) | |
private MeasurementUnits units; | |
/** | |
* How are measurement values going to trend (monotonically increasing, ... ) | |
*/ | |
@Column(name = "NUMERIC_TYPE") | |
@Enumerated(EnumType.ORDINAL) | |
private NumericType numericType; | |
/** | |
* The kind of measurement data being collected | |
*/ | |
@Column(name = "DATA_TYPE") | |
@Enumerated(EnumType.ORDINAL) | |
private DataType dataType; | |
/** | |
* How are values going to be displayed | |
*/ | |
@Column(name = "DISPLAY_TYPE") | |
@Enumerated(EnumType.ORDINAL) | |
private DisplayType displayType; | |
/** | |
* Is this metric schedule enabled by default | |
*/ | |
@Column(name = "DEFAULT_ON") | |
private boolean defaultOn; | |
/** | |
* What is the default gathering interval | |
*/ | |
@Column(name = "DEFAULT_INTERVAL") | |
private long defaultInterval; | |
@Column(name = "DESCRIPTION") | |
private String description; | |
// rest omitted for brevity | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment