1 /*
2 (C) Copyright IBM Corp. 2006, 2012
3
4 THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
5 ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
6 CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
7
8 You can obtain a current copy of the Eclipse Public License from
9 http://www.opensource.org/licenses/eclipse-1.0.php
10
11 @author : Endre Bak, ebak@de.ibm.com
12 *
13 * Flag Date Prog Description
14 * -------------------------------------------------------------------------------
15 * 1565892 2006-10-06 ebak Make SBLIM client JSR48 compliant
16 * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL
17 * 2204488 2008-10-28 raman_arora Fix code to remove compiler warnings
18 * 2227442 2008-11-05 blaschke-oss Add missing serialVersionUID
19 * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1)
20 * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2)
21 * 2795671 2009-05-22 raman_arora Add Type to Comparable <T>
22 * 2935258 2010-01-22 blaschke-oss Sync up javax.cim.* javadoc with JSR48 1.0.0
23 * 3496301 2012-03-02 blaschke-oss Sync up javax.* javadoc with JSR48 1.0.0 Final
24 */
25
26 package org.metricshub.wbem.javax.cim;
27
28 /*-
29 * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
30 * WBEM Java Client
31 * ჻჻჻჻჻჻
32 * Copyright 2023 - 2025 MetricsHub
33 * ჻჻჻჻჻჻
34 * Licensed under the Apache License, Version 2.0 (the "License");
35 * you may not use this file except in compliance with the License.
36 * You may obtain a copy of the License at
37 *
38 * http://www.apache.org/licenses/LICENSE-2.0
39 *
40 * Unless required by applicable law or agreed to in writing, software
41 * distributed under the License is distributed on an "AS IS" BASIS,
42 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
43 * See the License for the specific language governing permissions and
44 * limitations under the License.
45 * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
46 */
47
48 import java.io.Serializable;
49
50 //Sync'd against JSR48 1.0.0 javadoc (build 1.6.0_18) on Thu Mar 01 12:21:26 EST 2012
51 /**
52 * This abstract class represents a CIM Datetime data type as defined by the
53 * Distributed Management Task Force (<a href=http://www.dmtf.org>DMTF</a>) CIM
54 * Infrastructure Specification (<a
55 * href=http://www.dmtf.org/standards/published_documents/DSP0004V2.3_final.pdf
56 * >DSP004</a>). It is in the format yyyyMMddHHmmss.SSSSSSsutc where:
57 * <ul>
58 * <li>yyyy - is a 4 digit year</li>
59 * <li>MM - is the month</li>
60 * <li>dd - is the day of the month</li>
61 * <li>HH - is the hour (24 hour clock)</li>
62 * <li>mm - is the minute</li>
63 * <li>ss - is the second</li>
64 * <li>SSSSSS - is the number of microseconds</li>
65 * <li>s - is "+" or "-", indicating the sign of the UTC (Universal Coordinated
66 * Time; for all intents and purposes the same as Greenwich Mean Time)
67 * correction field, or a ":". In the case of a ":" the value is interpreted as
68 * a time interval, and yyyyMM are interpreted as days.</li>
69 * <li>utc - is the offset from UTC in minutes (using the sign indicated by s).
70 * It is ignored for a time interval.</li>
71 * </ul>
72 *
73 * For example, the absolute datetime for Monday, May 25, 1998, at 1:30 PM EST
74 * would be represented as: 19980525133015.000000-300. Values must be
75 * zero-padded so that the entire string is always the same 25-character length.
76 * Fields which are not significant must be replaced with asterisk characters.
77 * Similarly, intervals use the same format, except that the interpretation of
78 * the fields is based on elapsed time. <br>
79 * For example, the interval datetime for an elapsed time of 1 day, 13 hours, 23
80 * minutes, 12 seconds would be: 00000001132312.000000:000. A UTC offset of zero
81 * is always used for interval properties.
82 */
83 public abstract class CIMDateTime implements Serializable, Comparable<CIMDateTime> {
84 private static final long serialVersionUID = 3424668043014662166L;
85
86 /**
87 * Creates a <code>CIMDateTime</code> object using a string.
88 *
89 * @param pDateString
90 * A string in the format of yyyyMMddHHmmss.SSSSSSsutc.
91 * @throws IllegalArgumentException
92 * If string is not in the correct format.
93 */
94 public CIMDateTime(String pDateString) throws IllegalArgumentException {
95 // FIXME: what to do here?
96 }
97
98 protected CIMDateTime() {
99 // FIXME: what to do here?
100 }
101
102 /**
103 * Determines whether the <code>CIMDateTime</code> that is passed in is
104 * equal to the current <code>CIMDateTime</code> object.
105 *
106 * @param pObj
107 * The CIMDateTime object to compare to.
108 * @return <code>true</code> if this CIMDateTime object is equal to the one
109 * that was passed in, otherwise <code>false</code>.
110 */
111 @Override
112 public boolean equals(Object pObj) {
113 if (!(pObj instanceof CIMDateTime)) return false;
114 CIMDateTime that = (CIMDateTime) pObj;
115 return getDateTimeString().equals(that.getDateTimeString());
116 }
117
118 /**
119 * Gets the internal string representation of this object.
120 *
121 * @return The internal representation of the <code>CIMDateTime</code>
122 * object.
123 */
124 public abstract String getDateTimeString();
125
126 /**
127 * Returns the hash code for this object.
128 *
129 * @return A hash code value for this object.
130 * @see java.lang.Object#hashCode()
131 */
132 @Override
133 public abstract int hashCode();
134 }