dk.vajhoej.model.core
Class Component

java.lang.Object
  extended by dk.vajhoej.model.Versioned
      extended by dk.vajhoej.model.core.Component
All Implemented Interfaces:
Persistable, java.io.Serializable, java.lang.Cloneable

public class Component
extends Versioned
implements Persistable, java.lang.Cloneable, java.io.Serializable

Class Component represents a software component.

See Also:
Serialized Form

Constructor Summary
Component()
          Create instance of Component.
Component(java.lang.String vendor, java.lang.String name, Version version, ComponentStatus status)
          Create instance of Component.
Component(java.lang.String vendor, java.lang.String name, Version version, ComponentStatus status, ComponentType comptype, int cpu, int mem, int disk)
          Create instance of Component.
 
Method Summary
 void addComponent(Component c)
          Add component.
 Component clone()
           
 boolean equals(java.lang.Object o)
           
 NameValuePairList getAttributes()
          Get all single value fields.
 java.util.List<java.util.List<Persistable>> getChildren()
          Get all multi value fields.
 java.util.List<Component> getComponents()
          Get components.
 ComponentType getComptype()
          Get component type.
 int getCpu()
          Get CPU.
 int getDisk()
          Get disk space.
 java.lang.String getId()
          Get id identifying object.
 int getMem()
          Get memory.
 java.lang.String getName()
          Get name.
 ComponentStatus getStatus()
          Get component status.
 java.lang.String getType()
          Get type (XML element name / database table name not Java class name).
 java.lang.String getVendor()
          Get vendor.
 int hashCode()
           
 void removeComponent(Component c)
          Remove component.
 void setAttributes(NameValuePairList attr)
          Set all single value fields.
 void setChildren(java.util.List<java.util.List<Persistable>> childs)
          Set all multi value fields.
 void setCpu(int cpu)
          Set CPU.
 void setDisk(int disk)
          Set disk space.
 void setId(java.lang.String id)
          Set ID.
 void setMem(int mem)
          Set memory.
 void setName(java.lang.String name)
          Set name.
 void setVendor(java.lang.String vendor)
          Set vendor.
 java.lang.String toString()
           
 
Methods inherited from class dk.vajhoej.model.Versioned
getVersion, setVersion
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Component

public Component()
Create instance of Component.


Component

public Component(java.lang.String vendor,
                 java.lang.String name,
                 Version version,
                 ComponentStatus status)
Create instance of Component.

Parameters:
vendor - vendor
name - name
version - version
status - status

Component

public Component(java.lang.String vendor,
                 java.lang.String name,
                 Version version,
                 ComponentStatus status,
                 ComponentType comptype,
                 int cpu,
                 int mem,
                 int disk)
Create instance of Component.

Parameters:
vendor - vendor
name - name
version - version
status - status
comptype - component type
cpu - CPU cores (for virtual machine instances)
mem - GB memory (for virtual machine instances)
disk - TB disk (for virtual machine instances)
Method Detail

getVendor

public java.lang.String getVendor()
Get vendor.

Returns:
vendor

setVendor

public void setVendor(java.lang.String vendor)
Set vendor.

Parameters:
vendor - vendor

getName

public java.lang.String getName()
Get name.

Returns:
name

setName

public void setName(java.lang.String name)
Set name.

Parameters:
name - name

getStatus

public ComponentStatus getStatus()
Get component status.

Returns:
component status

getComponents

public java.util.List<Component> getComponents()
Get components.

Returns:
unmodifiable list of components

addComponent

public void addComponent(Component c)
Add component.

Parameters:
c - component.

removeComponent

public void removeComponent(Component c)
Remove component.

Parameters:
c - component

getComptype

public ComponentType getComptype()
Get component type.

Returns:
component type

getCpu

public int getCpu()
Get CPU.

Returns:
CPU cores

setCpu

public void setCpu(int cpu)
Set CPU.

Parameters:
cpu - CPU cores

getMem

public int getMem()
Get memory.

Returns:
GB memory

setMem

public void setMem(int mem)
Set memory.

Parameters:
mem - GB memory

getDisk

public int getDisk()
Get disk space.

Returns:
TB disk

setDisk

public void setDisk(int disk)
Set disk space.

Parameters:
disk - TB disk

setId

public void setId(java.lang.String id)
Set ID.

Parameters:
id - id

clone

public Component clone()
Overrides:
clone in class Versioned

getId

public java.lang.String getId()
Description copied from interface: Persistable
Get id identifying object.

Specified by:
getId in interface Persistable
Returns:
id

getType

public java.lang.String getType()
Description copied from interface: Persistable
Get type (XML element name / database table name not Java class name).

Specified by:
getType in interface Persistable
Returns:
type

getAttributes

public NameValuePairList getAttributes()
Description copied from interface: Persistable
Get all single value fields.

Specified by:
getAttributes in interface Persistable
Returns:
name value pair list

getChildren

public java.util.List<java.util.List<Persistable>> getChildren()
Description copied from interface: Persistable
Get all multi value fields.

Specified by:
getChildren in interface Persistable
Returns:
list of list of persistable objects

setAttributes

public void setAttributes(NameValuePairList attr)
                   throws ModelException
Description copied from interface: Persistable
Set all single value fields.

Specified by:
setAttributes in interface Persistable
Parameters:
attr - value pair list
Throws:
ModelException - if problems

setChildren

public void setChildren(java.util.List<java.util.List<Persistable>> childs)
Description copied from interface: Persistable
Set all multi value fields.

Specified by:
setChildren in interface Persistable
Parameters:
childs - list of list of persistable objects

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object