org.apache.lokahi.httpd.api.entity
Class VirtualHost

java.lang.Object
  extended by org.apache.lokahi.core.common.interfaces.RestObject
      extended by org.apache.lokahi.core.common.interfaces.TMCDao<T>
          extended by org.apache.lokahi.core.common.interfaces.FunctionableEntity<VirtualHost>
              extended by org.apache.lokahi.httpd.api.entity.VirtualHost
All Implemented Interfaces:
Collectable, Dao<VirtualHost>, Entity, Restable

public class VirtualHost
extends FunctionableEntity<VirtualHost>

Version:
$Id: VirtualHost.java,v 1.4 2006/03/07 22:05:24 drtobes Exp $
Author:
Stephen Toback

Constructor Summary
VirtualHost()
           
VirtualHost(int pk, java.lang.String name, int envId, int stateId, int hpId, int catchAll, int nameBased, int exPid, ApachePool ap, java.sql.Blob entry)
           
VirtualHost(int pk, java.lang.String name, int envId, int stateId, int hpId, int catchAll, int nameBased, int exPid, java.sql.Blob entry)
           
VirtualHost(java.lang.String name, java.lang.String entry, Environment env, State state, HostingPool hp, boolean catchAll, boolean nameBased)
           
 
Method Summary
 void addContext(TomcatContext tc)
           
 void addContexts(java.util.Collection<TomcatContext> c)
           
 void addIp(Ip ip)
           
 void addIps(java.util.Collection<Ip> c)
           
 java.lang.StringBuilder buildShortXMLRepresentation()
          Builds a short xml representation of this object containing name, and primary key.
 java.lang.String buildVhostEntriesForWeb()
           
 java.lang.StringBuffer buildVhostEntry(Hardware h)
           
 java.lang.StringBuilder buildXMLRepresention()
          Builds a xml representation of this object
 java.util.Collection<HostingPool> changeHostingPool(HostingPool hp, java.util.Collection<Ip> newIps, boolean isNameBased, boolean isCatchAll)
           
static boolean delete(java.util.Collection<VirtualHost> c, User u, JobPool jp)
           
static boolean delete(VirtualHost vh)
           
 boolean equals(java.lang.Object o)
           
 VirtualHost fillObject(java.sql.ResultSet r)
          Creates the Dao from the passed resultset, internally calling the appriate constructor.
 VirtualHost get(int id)
           
 ApachePool getApachePool()
           
 int getCatchAll()
           
 java.util.Collection<TomcatContext> getContexts()
           
 java.util.Collection<TomcatContext> getContextsNoDB()
           
 java.lang.String getEntry()
           
 Environment getEnv()
           
 int getEnvId()
           
 int getExternalProjectId()
           
 HostingPool getHostingPool()
           
 int getHostingPoolId()
           
 Ip getIp(Hardware h)
           
 java.util.Collection<Ip> getIps()
           
 java.util.Collection<Ip> getIpsNoDB()
           
 java.lang.String getLogDirective(java.lang.String directive)
           
 java.lang.String getName()
          Gets the name.
 int getNameBased()
           
 FunctionableEntity getObject(int id)
           
 int getObjectId()
           
 FunctionableEntity getParent()
           
 int getPk()
          Gets the primary key
 java.util.Collection<HostingPool> getPotentialHostingPools()
           
 State getState()
           
 int getStateId()
           
static VirtualHost getVirtualHost(int id)
           
static java.util.Collection<VirtualHost> getVirtualHost(java.lang.String pattern)
           
static java.util.Collection<VirtualHost> getVirtualHosts()
           
static java.util.Collection<VirtualHost> getVirtualHosts(ApacheWorker aw)
           
static java.util.Collection<VirtualHost> getVirtualHosts(HostingPool hp)
           
static java.util.Collection<VirtualHost> getVirtualHosts(int pId)
           
static java.util.Collection<VirtualHost> getVirtualHosts(java.lang.String name)
           
 int hashCode()
           
 boolean isCatchAll()
           
 boolean isDefault()
           
 boolean isNameBased()
           
 void removeContext(TomcatContext tc)
           
 void removeContexts(java.util.Collection<TomcatContext> c)
           
 void removeIp(Ip ip)
           
 void removeIps(java.util.Collection<Ip> c)
           
 void setCatchAll(boolean catchAll)
           
 void setCatchAll(int catchAll)
           
 void setContexts(java.util.Collection<TomcatContext> contexts)
           
 void setEntry(byte[] content)
           
 void setEntry(java.lang.String entry)
           
 void setEnv(Environment env)
           
 void setEnvId(int envId)
           
 void setExternalProjectId(int externalProjectId)
           
 void setHostingPool(HostingPool hostingPool)
           
 void setHostingPoolId(int hostingPoolId)
           
 void setIps(java.util.Collection<Ip> ips)
           
 void setName(java.lang.String name)
           
 void setNameBased(boolean nameBased)
           
 void setNameBased(int nameBased)
           
 void setPk(int pk)
           
 void setState(State state)
           
 void setStateId(int stateId)
           
static VirtualHost store(VirtualHost vh)
           
 java.lang.String toString()
           
static void update(VirtualHost vh)
           
 
Methods inherited from class org.apache.lokahi.core.common.interfaces.RestObject
elementBuilder, elementBuilder
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VirtualHost

public VirtualHost()

VirtualHost

public VirtualHost(java.lang.String name,
                   java.lang.String entry,
                   Environment env,
                   State state,
                   HostingPool hp,
                   boolean catchAll,
                   boolean nameBased)

VirtualHost

public VirtualHost(int pk,
                   java.lang.String name,
                   int envId,
                   int stateId,
                   int hpId,
                   int catchAll,
                   int nameBased,
                   int exPid,
                   java.sql.Blob entry)
            throws java.sql.SQLException
Throws:
java.sql.SQLException

VirtualHost

public VirtualHost(int pk,
                   java.lang.String name,
                   int envId,
                   int stateId,
                   int hpId,
                   int catchAll,
                   int nameBased,
                   int exPid,
                   ApachePool ap,
                   java.sql.Blob entry)
            throws java.sql.SQLException
Throws:
java.sql.SQLException
Method Detail

getObjectId

public int getObjectId()
Specified by:
getObjectId in class FunctionableEntity<VirtualHost>

getPk

public int getPk()
Description copied from interface: Collectable
Gets the primary key

Returns:
the int primary key

setPk

public void setPk(int pk)

getName

public java.lang.String getName()
Description copied from interface: Collectable
Gets the name.

Returns:
the String name.

setName

public void setName(java.lang.String name)

getEnvId

public int getEnvId()

setEnvId

public void setEnvId(int envId)

getStateId

public int getStateId()

setStateId

public void setStateId(int stateId)

isCatchAll

public boolean isCatchAll()

setCatchAll

public void setCatchAll(boolean catchAll)

getCatchAll

public int getCatchAll()

setCatchAll

public void setCatchAll(int catchAll)

getNameBased

public int getNameBased()

setNameBased

public void setNameBased(int nameBased)

isNameBased

public boolean isNameBased()

setNameBased

public void setNameBased(boolean nameBased)

getExternalProjectId

public int getExternalProjectId()

setExternalProjectId

public void setExternalProjectId(int externalProjectId)

setEntry

public void setEntry(byte[] content)
              throws java.sql.SQLException
Throws:
java.sql.SQLException

getContexts

public java.util.Collection<TomcatContext> getContexts()

getContextsNoDB

public java.util.Collection<TomcatContext> getContextsNoDB()

setContexts

public void setContexts(java.util.Collection<TomcatContext> contexts)

setIps

public void setIps(java.util.Collection<Ip> ips)

setHostingPool

public void setHostingPool(HostingPool hostingPool)

getHostingPoolId

public int getHostingPoolId()

setHostingPoolId

public void setHostingPoolId(int hostingPoolId)

getEntry

public java.lang.String getEntry()

setEntry

public void setEntry(java.lang.String entry)

getState

public State getState()

setState

public void setState(State state)

getEnv

public Environment getEnv()

setEnv

public void setEnv(Environment env)

getObject

public FunctionableEntity getObject(int id)
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

getParent

public FunctionableEntity getParent()
Specified by:
getParent in class FunctionableEntity<VirtualHost>

getIps

public java.util.Collection<Ip> getIps()

getIpsNoDB

public java.util.Collection<Ip> getIpsNoDB()

fillObject

public VirtualHost fillObject(java.sql.ResultSet r)
                       throws java.sql.SQLException
Description copied from interface: Dao
Creates the Dao from the passed resultset, internally calling the appriate constructor.

Parameters:
r - the resultset from a database call, should include the entire object
Returns:
Object populated from the resultset
Throws:
java.sql.SQLException

changeHostingPool

public java.util.Collection<HostingPool> changeHostingPool(HostingPool hp,
                                                           java.util.Collection<Ip> newIps,
                                                           boolean isNameBased,
                                                           boolean isCatchAll)
                                                    throws java.sql.SQLException
Parameters:
hp -
newIps -
isNameBased -
isCatchAll -
Returns:
Throws:
java.sql.SQLException

addIps

public void addIps(java.util.Collection<Ip> c)
            throws java.sql.SQLException
Throws:
java.sql.SQLException

addContexts

public void addContexts(java.util.Collection<TomcatContext> c)
                 throws java.sql.SQLException
Throws:
java.sql.SQLException

addIp

public void addIp(Ip ip)
           throws java.sql.SQLException
Throws:
java.sql.SQLException

addContext

public void addContext(TomcatContext tc)
                throws java.sql.SQLException
Throws:
java.sql.SQLException

removeIps

public void removeIps(java.util.Collection<Ip> c)
               throws java.sql.SQLException
Throws:
java.sql.SQLException

removeContexts

public void removeContexts(java.util.Collection<TomcatContext> c)
                    throws java.sql.SQLException
Throws:
java.sql.SQLException

removeIp

public void removeIp(Ip ip)
              throws java.sql.SQLException
Throws:
java.sql.SQLException

removeContext

public void removeContext(TomcatContext tc)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException

update

public static void update(VirtualHost vh)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException

delete

public static boolean delete(java.util.Collection<VirtualHost> c,
                             User u,
                             JobPool jp)
                      throws java.sql.SQLException,
                             TMCIllegalArgumentException,
                             AuthorizationException
Throws:
java.sql.SQLException
TMCIllegalArgumentException
AuthorizationException

delete

public static boolean delete(VirtualHost vh)
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

store

public static VirtualHost store(VirtualHost vh)
                         throws java.sql.SQLException
Throws:
java.sql.SQLException

getVirtualHosts

public static java.util.Collection<VirtualHost> getVirtualHosts()
                                                         throws java.sql.SQLException
Throws:
java.sql.SQLException

getVirtualHosts

public static java.util.Collection<VirtualHost> getVirtualHosts(java.lang.String name)
                                                         throws java.sql.SQLException
Throws:
java.sql.SQLException

getApachePool

public ApachePool getApachePool()

isDefault

public boolean isDefault()

getPotentialHostingPools

public java.util.Collection<HostingPool> getPotentialHostingPools()

getHostingPool

public HostingPool getHostingPool()

getVirtualHosts

public static java.util.Collection<VirtualHost> getVirtualHosts(int pId)
                                                         throws java.sql.SQLException
Throws:
java.sql.SQLException

getVirtualHosts

public static java.util.Collection<VirtualHost> getVirtualHosts(HostingPool hp)
                                                         throws java.sql.SQLException
Throws:
java.sql.SQLException

getVirtualHosts

public static java.util.Collection<VirtualHost> getVirtualHosts(ApacheWorker aw)
                                                         throws java.sql.SQLException
Throws:
java.sql.SQLException

getVirtualHost

public static VirtualHost getVirtualHost(int id)
                                  throws java.sql.SQLException
Throws:
java.sql.SQLException

getIp

public Ip getIp(Hardware h)

buildVhostEntry

public java.lang.StringBuffer buildVhostEntry(Hardware h)

buildVhostEntriesForWeb

public java.lang.String buildVhostEntriesForWeb()

getLogDirective

public java.lang.String getLogDirective(java.lang.String directive)

getVirtualHost

public static java.util.Collection<VirtualHost> getVirtualHost(java.lang.String pattern)

buildShortXMLRepresentation

public java.lang.StringBuilder buildShortXMLRepresentation()
Description copied from interface: Restable
Builds a short xml representation of this object containing name, and primary key.

Returns:
the xml representation

buildXMLRepresention

public java.lang.StringBuilder buildXMLRepresention()
Description copied from interface: Restable
Builds a xml representation of this object

Returns:
the xml representation

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

get

public VirtualHost get(int id)
                throws java.sql.SQLException
Specified by:
get in class TMCDao<VirtualHost>
Throws:
java.sql.SQLException