Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.altara.mars
Class Service  view Service download Service.java

java.lang.Object
  extended byorg.altara.mars.Service
All Implemented Interfaces:
java.io.Serializable, javax.swing.tree.TreeNode

public class Service
extends java.lang.Object
implements java.io.Serializable, javax.swing.tree.TreeNode

Represents a service on a host monitored by MARS. Each service has a probe factory (which the service can use to build a probe that knows how to monitor said service), a port on which the service is running, a set of arguments to give to that factory's create() method, and a representation of the current status of that service.


Field Summary
static int DEFAULT_NOTAC
           
static long DEFAULT_PERIOD
           
static long DEFAULT_TIMEOUT
           
private  ProbeFactory factory
           
private  Host host
           
static int MAX_NOTAC
           
private  java.lang.String name
           
private  int notac
           
static int NOTAC_IMMEDIATE
           
static int NOTAC_NEVER
           
private  java.util.HashMap params
           
private  long period
           
private  int port
           
private  Status status
           
private  long timeout
           
 
Constructor Summary
Service(Host host, java.lang.String name, java.lang.String svctype, int port)
           
Service(Host host, java.lang.String name, java.lang.String svctype, int port, long timeout, long period, int notac)
           
Service(Host host, java.lang.String name, java.lang.String svctype, int port, long timeout, long period, int notac, java.util.HashMap params)
           
 
Method Summary
 java.util.Enumeration children()
          children
 Service duplicate(Host newHost)
           
 void fireServiceChanged()
           
static Service fromJDOMElem(Host host, org.jdom.Element in)
           
 boolean getAllowsChildren()
          getAllowsChildren
 javax.swing.tree.TreeNode getChildAt(int childIndex)
          getChildAt
 int getChildCount()
          getChildCount
 Host getHost()
           
 int getIndex(javax.swing.tree.TreeNode node)
          getIndex
 java.lang.String getName()
           
 int getNotac()
           
 java.lang.String getParameter(java.lang.String name)
           
 java.util.Iterator getParameterNames()
           
 javax.swing.tree.TreeNode getParent()
          getParent
 long getPeriod()
           
 int getPort()
           
 org.altara.mars.engine.Probe getProbe()
           
 ProbeFactory getProbeFactory()
           
 Status getStatus()
           
 java.lang.String getSvcType()
           
 long getTimeout()
           
 javax.swing.tree.TreePath getTreePath()
           
 boolean isDue()
           
 boolean isLeaf()
          isLeaf
 void setName(java.lang.String name)
           
 void setNotac(int notac)
           
 void setParameter(java.lang.String name, java.lang.String value)
           
 void setPeriod(long period)
           
 void setPort(int port)
           
 void setStatus(Status status)
           
 void setSvcType(java.lang.String svctype)
           
 void setTimeout(long timeout)
           
 org.jdom.Element toJDOMElem(boolean includeStatus)
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NOTAC_NEVER

public static final int NOTAC_NEVER
See Also:
Constant Field Values

NOTAC_IMMEDIATE

public static final int NOTAC_IMMEDIATE
See Also:
Constant Field Values

DEFAULT_NOTAC

public static final int DEFAULT_NOTAC
See Also:
Constant Field Values

MAX_NOTAC

public static final int MAX_NOTAC
See Also:
Constant Field Values

DEFAULT_PERIOD

public static final long DEFAULT_PERIOD
See Also:
Constant Field Values

DEFAULT_TIMEOUT

public static final long DEFAULT_TIMEOUT
See Also:
Constant Field Values

host

private Host host

name

private java.lang.String name

factory

private ProbeFactory factory

port

private int port

params

private java.util.HashMap params

status

private Status status

timeout

private long timeout

period

private long period

notac

private int notac
Constructor Detail

Service

public Service(Host host,
               java.lang.String name,
               java.lang.String svctype,
               int port)
        throws InvalidServiceTypeException

Service

public Service(Host host,
               java.lang.String name,
               java.lang.String svctype,
               int port,
               long timeout,
               long period,
               int notac)
        throws InvalidServiceTypeException

Service

public Service(Host host,
               java.lang.String name,
               java.lang.String svctype,
               int port,
               long timeout,
               long period,
               int notac,
               java.util.HashMap params)
        throws InvalidServiceTypeException
Method Detail

setParameter

public void setParameter(java.lang.String name,
                         java.lang.String value)

setStatus

public void setStatus(Status status)

setName

public void setName(java.lang.String name)

setSvcType

public void setSvcType(java.lang.String svctype)
                throws InvalidServiceTypeException

setPort

public void setPort(int port)

setTimeout

public void setTimeout(long timeout)

setPeriod

public void setPeriod(long period)

setNotac

public void setNotac(int notac)

fireServiceChanged

public void fireServiceChanged()

getHost

public Host getHost()

getPort

public int getPort()

getName

public java.lang.String getName()

getProbe

public org.altara.mars.engine.Probe getProbe()

getSvcType

public java.lang.String getSvcType()

getProbeFactory

public ProbeFactory getProbeFactory()

getStatus

public Status getStatus()

getParameter

public java.lang.String getParameter(java.lang.String name)

getParameterNames

public java.util.Iterator getParameterNames()

getTimeout

public long getTimeout()

getPeriod

public long getPeriod()

getNotac

public int getNotac()

isDue

public boolean isDue()

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


getAllowsChildren

public boolean getAllowsChildren()
Description copied from interface: javax.swing.tree.TreeNode
getAllowsChildren

Specified by:
getAllowsChildren in interface javax.swing.tree.TreeNode

getChildCount

public int getChildCount()
Description copied from interface: javax.swing.tree.TreeNode
getChildCount

Specified by:
getChildCount in interface javax.swing.tree.TreeNode

isLeaf

public boolean isLeaf()
Description copied from interface: javax.swing.tree.TreeNode
isLeaf

Specified by:
isLeaf in interface javax.swing.tree.TreeNode

getParent

public javax.swing.tree.TreeNode getParent()
Description copied from interface: javax.swing.tree.TreeNode
getParent

Specified by:
getParent in interface javax.swing.tree.TreeNode

children

public java.util.Enumeration children()
Description copied from interface: javax.swing.tree.TreeNode
children

Specified by:
children in interface javax.swing.tree.TreeNode

getChildAt

public javax.swing.tree.TreeNode getChildAt(int childIndex)
Description copied from interface: javax.swing.tree.TreeNode
getChildAt

Specified by:
getChildAt in interface javax.swing.tree.TreeNode

getIndex

public int getIndex(javax.swing.tree.TreeNode node)
Description copied from interface: javax.swing.tree.TreeNode
getIndex

Specified by:
getIndex in interface javax.swing.tree.TreeNode

getTreePath

public javax.swing.tree.TreePath getTreePath()

duplicate

public Service duplicate(Host newHost)

toJDOMElem

public org.jdom.Element toJDOMElem(boolean includeStatus)

fromJDOMElem

public static Service fromJDOMElem(Host host,
                                   org.jdom.Element in)
                            throws InvalidDocumentException