public class ServerFactory extends HibernateFactory
Modifier and Type | Method and Description |
---|---|
static void |
addServerToGroup(Server serverIn,
ServerGroup serverGroupIn)
Adds a Server to a group.
|
static void |
addTagToSnapshot(java.lang.Long snpId,
java.lang.Long orgId,
java.lang.String tagName)
Adds tag to the snapshot
|
static void |
bulkAddTagToSnapshot(java.lang.String tagName,
java.lang.String setLabel,
User user)
Adds tag to snapshot for systems in set
|
static java.util.List<java.util.Map<java.lang.String,java.lang.Object>> |
compatibleWithServer(User user,
Server server)
Returns a list of Servers which are compatible with the given server.
|
static Server |
createServer()
Create a new Server from scratch
|
static void |
delete(Server server)
Deletes a server
|
static void |
deleteSnapshot(ServerSnapshot snap)
Delete a snapshot
|
static void |
deleteSnapshots(Org org,
java.util.Date startDate,
java.util.Date endDate)
Delete snapshots across servers in the org.
|
static void |
deleteSnapshots(Org org,
Server server,
java.util.Date startDate,
java.util.Date endDate)
Delete snapshots associated with a server.
|
static void |
deproxify(Server server)
Remove proxy info object associated to the server.
|
protected static CustomDataValue |
getCustomDataValue(CustomDataKey key,
Server server)
Looks up the CustomDataValue given CustomDataKey and Server objects.
|
protected org.apache.log4j.Logger |
getLogger()
Get the Logger for the derived class so log messages show up on the
correct class
|
static java.util.List<HistoryEvent> |
getServerHistory(Server server)
gets a server's history sorted by creation time.
|
static java.util.List<SnapshotTag> |
getSnapshotTags(ServerSnapshot snap)
get tags for a given snapshot
|
static java.util.List<User> |
listAdministrators(Server server)
Returns the admins of a given server This includes
|
static java.util.List<Server> |
listConfigDiffEnabledSystems()
Returns a global multi org spanning list of
servers that are config-diff enabled.
|
static java.util.List<Server> |
listConfigEnabledSystems()
Returns a global multi org spanning list of
servers that are config enabled.
|
static java.util.List<java.lang.Long> |
listLinuxSystems(java.util.Collection<java.lang.Long> systemIds)
Filter out a list of systemIds with ones that are linux systems
(i.e.
|
static java.util.List<SoftwareCrashDto> |
listServerSoftwareCrashes(Server server)
Lists software crashes for a server
|
static java.util.List<ServerSnapshot> |
listSnapshots(Org org,
Server server,
java.util.Date startDate,
java.util.Date endDate)
List snapshots associated with a server.
|
static java.util.List<Server> |
listSystemsInSsm(User user)
Returns a list of Server objects currently selected in the System Set
Manager.
|
static Server |
lookupByCert(ClientCertificate clientcert)
Lookup a Server with the ClientCertificate.
|
static Server |
lookupById(java.lang.Long id)
Lookup a Server by their id
|
static Server |
lookupByIdAndOrg(java.lang.Long id,
Org orgIn)
Lookup a Server by their id
|
static java.util.List<Server> |
lookupByIds(java.util.List<java.lang.Long> ids)
Lookup Servers by their ids
|
static java.util.List<Server> |
lookupByIdsAndUser(java.util.List<java.lang.Long> serverIds,
User user)
Looks up server objects from the given list of server IDs.
|
static CPUArch |
lookupCPUArchByName(java.lang.String name)
Lookup a CPUArch by its name
|
static java.util.List<CustomDataValue> |
lookupCustomDataValues(CustomDataKey key)
Lookup all CustomDataValues associated with the CustomDataKey.
|
static ServerSnapshot |
lookupLatestForServer(Server server)
Looks up a latest snapshot for a sever
|
static java.util.List<Server> |
lookupProxiesByOrg(User user)
List all proxies for a given org
|
static ServerArch |
lookupServerArchByLabel(java.lang.String label)
Lookup a ServerArch by its label
|
static ServerGroupType |
lookupServerGroupTypeByLabel(java.lang.String label)
Lookup a ServerGroupType by its label
|
static java.util.List |
lookupServersWithCustomKey(java.lang.Long userId,
java.lang.Long cikid)
Lookup all the systems with the specified CustomDataKey.
|
static ServerSnapshot |
lookupSnapshotById(java.lang.Integer id)
Looks up a server snapshot by it's id
|
static SnapshotTag |
lookupSnapshotTagbyId(java.lang.Long tagId) |
static SnapshotTag |
lookupSnapshotTagbyName(java.lang.String tagName)
Looks up snapshot tag by tag name
|
static java.util.List<Device> |
lookupStorageDevicesByServer(Server s)
Lookup all storage Devices associated with the server.
|
static void |
removeCustomDataValue(Server server,
CustomDataKey key)
Remove the custom data value associated with the custom data key
provided for the given server.
|
static void |
removeCustomDataValues(Server server)
Remove the custom data values associated with a server.
|
static void |
removeCustomKey(CustomDataKey keyIn)
Remove a custom data key.
|
static void |
removeServerFromGroup(java.lang.Long sid,
java.lang.Long sgid)
Removes a Server from a group
|
static void |
removeTagFromSnapshot(java.lang.Long serverId,
SnapshotTag tag)
Removes tag from system snapshot
|
static void |
save(Server serverIn)
Insert or Update a Server.
|
static void |
saveCustomKey(CustomDataKey keyIn)
Save a custom data key
|
static void |
saveSnapshot(ServerSnapshot snapshotIn)
Save a server snapshot
|
static Server |
unsubscribeFromAllChannels(User user,
Server server)
Clear out all subscriptions for a particular server
|
addConfigurator, blobToByteArray, byteArrayToBlob, closeSession, closeSessionFactory, commitTransaction, createSessionFactory, createSessionFactory, executeCallableMode, executeSelectMode, getBlobContents, getByteArrayContents, getObject, getSession, initialize, inTransaction, isClosed, isInitialized, listObjectsByNamedQuery, listObjectsByNamedQuery, listObjectsByNamedQuery, lockObject, lookupObjectByNamedQuery, lookupObjectByNamedQuery, reload, removeObject, rollbackTransaction, saveObject, saveObject, stringToByteArray
protected static CustomDataValue getCustomDataValue(CustomDataKey key, Server server)
key
- The Key for the value you would like to lookupserver
- The Server in questionpublic static void removeCustomDataValues(Server server)
server
- The serverpublic static void removeCustomDataValue(Server server, CustomDataKey key)
server
- The serverkey
- The custom data keypublic static java.util.List<CustomDataValue> lookupCustomDataValues(CustomDataKey key)
key
- The Key for the values you would like to lookuppublic static java.util.List lookupServersWithCustomKey(java.lang.Long userId, java.lang.Long cikid)
userId
- The User ID of the user doing the querycikid
- The ID of the Key for the values you would like to lookuppublic static java.util.List<Device> lookupStorageDevicesByServer(Server s)
s
- The server for the values you would like to lookupprotected org.apache.log4j.Logger getLogger()
getLogger
in class HibernateFactory
public static Server createServer()
public static void addServerToGroup(Server serverIn, ServerGroup serverGroupIn)
serverIn
- The server to addserverGroupIn
- The group to add the server topublic static void removeServerFromGroup(java.lang.Long sid, java.lang.Long sgid)
sid
- The server id to removesgid
- The group id to remove the server frompublic static Server lookupByCert(ClientCertificate clientcert) throws InvalidCertificateException
clientcert
- ClientCertificate for the server wanted.InvalidCertificateException
- thrown if certificate is invalid.public static Server lookupByIdAndOrg(java.lang.Long id, Org orgIn)
id
- the id to search fororgIn
- Org who owns the serverpublic static java.util.List<Server> lookupByIdsAndUser(java.util.List<java.lang.Long> serverIds, User user)
serverIds
- List of server IDs.user
- who wants to lookup the Serverpublic static Server lookupById(java.lang.Long id)
id
- the id to search forpublic static java.util.List<Server> lookupByIds(java.util.List<java.lang.Long> ids)
ids
- the ids to search forpublic static ServerGroupType lookupServerGroupTypeByLabel(java.lang.String label)
label
- The label to search forpublic static void save(Server serverIn)
serverIn
- Server to be stored in database.public static void saveCustomKey(CustomDataKey keyIn)
keyIn
- the key to savepublic static void removeCustomKey(CustomDataKey keyIn)
keyIn
- the key to removepublic static void deproxify(Server server)
server
- the server to deProxifypublic static void delete(Server server)
server
- The server to deletepublic static ServerArch lookupServerArchByLabel(java.lang.String label)
label
- The label to search forpublic static CPUArch lookupCPUArchByName(java.lang.String name)
name
- The name to search forpublic static java.util.List<java.util.Map<java.lang.String,java.lang.Object>> compatibleWithServer(User user, Server server)
user
- User ownerserver
- Server whose profiles we want.public static java.util.List<User> listAdministrators(Server server)
server
- the server to find the admins ofpublic static java.util.List<HistoryEvent> getServerHistory(Server server)
server
- the server who's history you wantpublic static java.util.List<Server> lookupProxiesByOrg(User user)
user
- the user, who's accessible proxies will be returned.public static Server unsubscribeFromAllChannels(User user, Server server)
user
- User doing the un-subscriptionserver
- Server that is unsubscribingpublic static java.util.List<Server> listSystemsInSsm(User user)
user
- User requesting.public static java.util.List<Server> listConfigEnabledSystems()
public static java.util.List<Server> listConfigDiffEnabledSystems()
public static java.util.List<ServerSnapshot> listSnapshots(Org org, Server server, java.util.Date startDate, java.util.Date endDate)
org
- the org doing the request. Required.server
- the server to check for. Required.startDate
- the start date. Optional, unless endDate is provided.endDate
- the end date. Optional.public static ServerSnapshot lookupSnapshotById(java.lang.Integer id)
id
- the snap idpublic static ServerSnapshot lookupLatestForServer(Server server)
server
- serverpublic static void saveSnapshot(ServerSnapshot snapshotIn)
snapshotIn
- snapshot to savepublic static void deleteSnapshot(ServerSnapshot snap)
snap
- the snapshot to deletepublic static void deleteSnapshots(Org org, java.util.Date startDate, java.util.Date endDate)
org
- the org doing the request. Required.startDate
- the start date. Optional, unless endDate is provided.endDate
- the end date. Optional.public static void deleteSnapshots(Org org, Server server, java.util.Date startDate, java.util.Date endDate)
org
- the org doing the request. Required.server
- the server to check for. Required.startDate
- the start date. Optional, unless endDate is provided.endDate
- the end date. Optional.public static java.util.List<SnapshotTag> getSnapshotTags(ServerSnapshot snap)
snap
- the snapshot to get tags forpublic static java.util.List<java.lang.Long> listLinuxSystems(java.util.Collection<java.lang.Long> systemIds)
systemIds
- list of system idspublic static void addTagToSnapshot(java.lang.Long snpId, java.lang.Long orgId, java.lang.String tagName)
snpId
- snapshot idorgId
- org idtagName
- name of the tagpublic static void bulkAddTagToSnapshot(java.lang.String tagName, java.lang.String setLabel, User user)
tagName
- Name of the tagsetLabel
- set to find systems inuser
- User making the requestpublic static void removeTagFromSnapshot(java.lang.Long serverId, SnapshotTag tag)
serverId
- server idtag
- snapshot tagpublic static SnapshotTag lookupSnapshotTagbyName(java.lang.String tagName)
tagName
- name of the tagpublic static SnapshotTag lookupSnapshotTagbyId(java.lang.Long tagId)
tagId
- snapshot tag IDpublic static java.util.List<SoftwareCrashDto> listServerSoftwareCrashes(Server server)
server
- of interest