PageRenderTime 35ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/org.xerela.provider.devices/src/org/xerela/provider/devices/ZDeviceLite.java

http://xerela.googlecode.com/
Java | 416 lines | 209 code | 62 blank | 145 comment | 0 complexity | 4073a132d7c48e91b017c49504d2eb63 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, JSON, Apache-2.0, IPL-1.0
  1. /*
  2. * The contents of this file are subject to the Mozilla Public License
  3. * Version 1.1 (the "License"); you may not use this file except in
  4. * compliance with the License. You may obtain a copy of the License at
  5. * http://www.mozilla.org/MPL/
  6. *
  7. * Software distributed under the License is distributed on an "AS IS"
  8. * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  9. * License for the specific language governing rights and limitations
  10. * under the License.
  11. *
  12. * The Original Code is Ziptie Client Framework.
  13. *
  14. * The Initial Developer of the Original Code is AlterPoint.
  15. * Portions created by AlterPoint are Copyright (C) 2006,
  16. * AlterPoint, Inc. All Rights Reserved.
  17. *
  18. * Contributor(s):
  19. */
  20. package org.xerela.provider.devices;
  21. import java.util.Date;
  22. import javax.persistence.Column;
  23. import javax.persistence.Entity;
  24. import javax.persistence.Id;
  25. import javax.persistence.Table;
  26. import javax.xml.bind.annotation.XmlTransient;
  27. import org.xerela.addressing.NetworkAddressElf;
  28. /**
  29. * ZDeviceLite
  30. *
  31. */
  32. @Entity(name = "ZDeviceLite")
  33. @Table(name = "device")
  34. public class ZDeviceLite
  35. {
  36. @Id
  37. @Column(name = "device_id", updatable = false)
  38. private int deviceId;
  39. @Column(name = "inode", updatable = false)
  40. @XmlTransient
  41. private int inode;
  42. @Column(name = "ip_address", updatable = false)
  43. private String ipAddress;
  44. @Column(name = "ip_high", updatable = false)
  45. private long ipHigh;
  46. @Column(name = "ip_low", updatable = false)
  47. private long ipLow;
  48. @Column(name = "hostname", updatable = false)
  49. private String hostname;
  50. @Column(name = "network", updatable = false)
  51. private String managedNetwork;
  52. @Column(name = "adapter_id", updatable = false)
  53. private String adapterId;
  54. @Column(name = "device_type", updatable = false)
  55. private String deviceType;
  56. @Column(name = "vendor_hw", updatable = false)
  57. private String hardwareVendor;
  58. @Column(name = "canonical_hw_version", updatable = false)
  59. private String canonicalHwVersion;
  60. @Column(name = "model", updatable = false)
  61. private String model;
  62. @Column(name = "vendor_sw", updatable = false)
  63. private String softwareVendor;
  64. @Column(name = "canonical_os_version", updatable = false)
  65. private String canonicalOsVersion;
  66. @Column(name = "os_version", updatable = false)
  67. private String osVersion;
  68. @Column(name = "asset_identity", updatable = false)
  69. private String assetIdentity;
  70. @Column(name = "backup_status", updatable = false)
  71. private String backupStatus;
  72. @Column(name = "last_telemetry", updatable = false)
  73. private Date lastTelemetry;
  74. /**
  75. * Get the persistent ID of the device.
  76. *
  77. * @return the deviceId the persistent ID of the device
  78. */
  79. @XmlTransient
  80. public int getDeviceId()
  81. {
  82. return deviceId;
  83. }
  84. /**
  85. * Set the persistent ID of the device.
  86. *
  87. * @param id the internal ID of the device
  88. */
  89. public void setDeviceId(int id)
  90. {
  91. deviceId = id;
  92. }
  93. /**
  94. * Get the inode of the device in the Directory.
  95. *
  96. * @return the inode of the device
  97. */
  98. @XmlTransient
  99. public int getInode()
  100. {
  101. return inode;
  102. }
  103. /**
  104. * Set the inode of the device in the Directory.
  105. *
  106. * @param inode the of the device
  107. */
  108. public void setInode(int inode)
  109. {
  110. this.inode = inode;
  111. }
  112. /**
  113. * @return the ipHigh
  114. */
  115. @XmlTransient
  116. public long getIpHigh()
  117. {
  118. return ipHigh;
  119. }
  120. /**
  121. * @param ipHigh the ipHigh to set
  122. */
  123. public void setIpHigh(long ipHigh)
  124. {
  125. this.ipHigh = ipHigh;
  126. }
  127. /**
  128. * @return the ipLow
  129. */
  130. @XmlTransient
  131. public long getIpLow()
  132. {
  133. return ipLow;
  134. }
  135. /**
  136. * @param ipLow the ipLow to set
  137. */
  138. public void setIpLow(long ipLow)
  139. {
  140. this.ipLow = ipLow;
  141. }
  142. /**
  143. * @return the cannonicalHwVersion
  144. */
  145. @XmlTransient
  146. public String getCanonicalHwVersion()
  147. {
  148. return canonicalHwVersion;
  149. }
  150. /**
  151. * @param canonicalHwVersion the cannonicalHwVersion to set
  152. */
  153. public void setCanonicalHwVersion(String canonicalHwVersion)
  154. {
  155. this.canonicalHwVersion = canonicalHwVersion;
  156. }
  157. /**
  158. * @return the cannonicalOsVersion
  159. */
  160. @XmlTransient
  161. public String getCanonicalOsVersion()
  162. {
  163. return canonicalOsVersion;
  164. }
  165. /**
  166. * @param canonicalOsVersion the cannonicalOsVersion to set
  167. */
  168. public void setCanonicalOsVersion(String canonicalOsVersion)
  169. {
  170. this.canonicalOsVersion = canonicalOsVersion;
  171. }
  172. // ----------------------------------------------------------------------
  173. // External (SOAP) Attributes
  174. // ----------------------------------------------------------------------
  175. /**
  176. * @return the adapterId
  177. */
  178. public String getAdapterId()
  179. {
  180. return adapterId;
  181. }
  182. /**
  183. * @param adapterId the adapterId to set
  184. */
  185. public void setAdapterId(String adapterId)
  186. {
  187. this.adapterId = adapterId;
  188. }
  189. /**
  190. * @return the assetIdentity
  191. */
  192. public String getAssetIdentity()
  193. {
  194. return assetIdentity;
  195. }
  196. /**
  197. * @param assetIdentity the assetIdentity to set
  198. */
  199. public void setAssetIdentity(String assetIdentity)
  200. {
  201. this.assetIdentity = assetIdentity;
  202. }
  203. /**
  204. * @return the backupStatus
  205. */
  206. public String getBackupStatus()
  207. {
  208. return backupStatus;
  209. }
  210. /**
  211. * @param backupStatus the backupStatus to set
  212. */
  213. public void setBackupStatus(String backupStatus)
  214. {
  215. this.backupStatus = backupStatus;
  216. }
  217. /**
  218. * @return the hardwareVendor
  219. */
  220. public String getHardwareVendor()
  221. {
  222. return hardwareVendor;
  223. }
  224. /**
  225. * @param hardwareVendor the hardwareVendor to set
  226. */
  227. public void setHardwareVendor(String hardwareVendor)
  228. {
  229. this.hardwareVendor = hardwareVendor;
  230. }
  231. /**
  232. * @return the hostname
  233. */
  234. public String getHostname()
  235. {
  236. return hostname;
  237. }
  238. /**
  239. * @param hostname the hostname to set
  240. */
  241. public void setHostname(String hostname)
  242. {
  243. this.hostname = hostname;
  244. }
  245. /**
  246. * Get the IPv4 or IPv6 IP address of the device.
  247. *
  248. * @return the IP address of the device
  249. */
  250. public String getIpAddress()
  251. {
  252. return NetworkAddressElf.fromDatabaseString(ipAddress);
  253. }
  254. /**
  255. * @param ipAddress the ipAddress to set
  256. */
  257. public void setIpAddress(String ipAddress)
  258. {
  259. this.ipAddress = NetworkAddressElf.toDatabaseString(ipAddress);
  260. long[] hilo = NetworkAddressElf.getHiLo(ipAddress);
  261. setIpHigh(hilo[0]);
  262. setIpLow(hilo[1]);
  263. }
  264. /**
  265. * @return the managedNetwork
  266. */
  267. public String getManagedNetwork()
  268. {
  269. return managedNetwork;
  270. }
  271. /**
  272. * @param managedNetwork the managedNetwork to set
  273. */
  274. public void setManagedNetwork(String managedNetwork)
  275. {
  276. this.managedNetwork = managedNetwork;
  277. }
  278. /**
  279. * @return the model
  280. */
  281. public String getModel()
  282. {
  283. return model;
  284. }
  285. /**
  286. * @param model the model to set
  287. */
  288. public void setModel(String model)
  289. {
  290. this.model = model;
  291. }
  292. /**
  293. * @return the osVersion
  294. */
  295. public String getOsVersion()
  296. {
  297. return osVersion;
  298. }
  299. /**
  300. * @param osVersion the osVersion to set
  301. */
  302. public void setOsVersion(String osVersion)
  303. {
  304. this.osVersion = osVersion;
  305. }
  306. /**
  307. * @return the softwareVendor
  308. */
  309. public String getSoftwareVendor()
  310. {
  311. return softwareVendor;
  312. }
  313. /**
  314. * @param softwareVendor the softwareVendor to set
  315. */
  316. public void setSoftwareVendor(String softwareVendor)
  317. {
  318. this.softwareVendor = softwareVendor;
  319. }
  320. /** {@inheritDoc} */
  321. @Override
  322. public String toString()
  323. {
  324. return getIpAddress() + "@" + getManagedNetwork(); //$NON-NLS-1$
  325. }
  326. /**
  327. * @return the deviceType
  328. */
  329. public String getDeviceType()
  330. {
  331. return deviceType;
  332. }
  333. /**
  334. * @param deviceType the deviceType to set
  335. */
  336. public void setDeviceType(String deviceType)
  337. {
  338. this.deviceType = deviceType;
  339. }
  340. /**
  341. * @return the lastTelemetry
  342. */
  343. public Date getLastTelemetry()
  344. {
  345. return lastTelemetry;
  346. }
  347. /**
  348. * @param lastTelemetry the lastTelemetry to set
  349. */
  350. public void setLastTelemetry(Date lastTelemetry)
  351. {
  352. this.lastTelemetry = lastTelemetry;
  353. }
  354. }