org.appng.core.domain

## Class SiteImpl

- java.lang.Object
- - org.appng.core.domain.SiteImpl

- All Implemented Interfaces:
    Serializable, Identifiable<Integer>, Nameable, Named<Integer>, Site, Versionable<Date>, Auditable<Integer>

      @Entity
      public class SiteImpl
      extends Object
      implements Site, Auditable<Integer>

  Default `Site`-implementation
  Author:
    Matthias Müller
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.appng.api.model.Site

      `Site.SiteState`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SiteImpl()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `addRequest()`
    `void` | `closeSiteContext()`
    `boolean` | `equals(Object o)`
    `Application` | `getApplication(String name)` Returns the `Application` with the given name, if such a `Application` is assigned to this `Site`.
    `Map<String,Application>` | `getApplicationMap()`
    `Set<Application>` | `getApplications()` Returns the `Application`s which are currently assigned to this `Site`.
    `@Size(max=8192,message="{validation.string.max}") String` | `getDescription()` Returns the description.
    `@NotNull(message="{validation.notNull}") @Pattern(regexp="(http(s?)(\\://))?((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9]))(\\:[0-9]+)?",message="{validation.domain}") String` | `getDomain()` Returns the domain for this `Site`.
    `Set<Named<Integer>>` | `getGroups()` Returns a set containing a `Named`-instance for each `Group` that exists within the platform.
    `@NotNull(message="{validation.notNull}") @Pattern(regexp="(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])",message="{validation.host}") String` | `getHost()` Returns the main hostname for this site
    `Set<String>` | `getHostAliases()` Returns alias hostnames for ths `Site`
    `Integer` | `getId()` Returns the id.
    `@NotNull(message="{validation.notNull}") @Pattern(regexp="[a-zA-Z0-9\\-]{3,}",message="{validation.nameStrict}") @Size(max=64,message="{validation.string.max}") String` | `getName()` Returns the name.
    `PasswordPolicy` | `getPasswordPolicy()` Returns the `PasswordPolicy` used when creating `Subject`s for this `Site`.
    `Properties` | `getProperties()` Returns the `Properties` for this `Site`.
    `int` | `getReloadCount()`
    `int` | `getRequests()`
    `SiteApplication` | `getSiteApplication(String name)`
    `Set<SiteApplication>` | `getSiteApplications()`
    `SiteClassLoader` | `getSiteClassLoader()` Returns the `URLClassLoader` for this `Site`, which contains all the jars provided by the `Application`s that are assigned to this `Site`.
    `Date` | `getStartupTime()` Returns the time at which the site has been loaded during platform-startup.
    `Site.SiteState` | `getState()`
    `Date` | `getVersion()` Returns the version.
    `boolean` | `hasApplication(String name)` Checks whether the `Application` with the given name is assigned to this `Site`.
    `int` | `hashCode()`
    `boolean` | `hasState(Site.SiteState... states)`
    `boolean` | `isActive()` Returns `true` if this `Site` is active, which means it is being loaded at platform startup.
    `boolean` | `isCreateRepository()` Returns `true` if a JSP-repository folder has been created for this `Site`.
    `boolean` | `isRunning()`
    `File` | `readFile(String relativePath)` Returns the `File` defined by the given path, which is located relative to the site's repository-folder.
    `int` | `removeRequest()`
    `boolean` | `sendEvent(Event event)` If clustering is enabled, sends an `Event` to other appNG nodes
    `void` | `sendRedirect(Environment env, String target)` sends a redirect with HTTP-Status 301 (moved permanently)
    `void` | `sendRedirect(Environment env, String target, Integer statusCode)` redirects the request to the given target.
    `void` | `sendRedirect(Environment env, String target, Integer statusCode, boolean keepOrigin)`
    `void` | `setActive(boolean active)`
    `void` | `setCreateRepository(boolean createRepository)`
    `void` | `setDescription(String description)`
    `void` | `setDomain(String domain)`
    `void` | `setGroups(Set<Named<Integer>> groups)`
    `void` | `setHost(String host)`
    `void` | `setHostAliases(Set<String> hostAliases)`
    `void` | `setId(Integer id)`
    `void` | `setName(String name)`
    `void` | `setPasswordPolicy(PasswordPolicy policy)`
    `void` | `setProperties(Properties properties)`
    `void` | `setReloadCount(int reloadCount)`
    `void` | `setRootDirectory(File siteRootDirectory)`
    `void` | `setRunning(boolean isRunning)`
    `void` | `setSender(Sender sender)`
    `void` | `setSiteApplications(Set<SiteApplication> applications)`
    `void` | `setSiteClassLoader(SiteClassLoader siteClassLoader)`
    `void` | `setStartupTime(Date startupTime)`
    `void` | `setState(Site.SiteState state)`
    `void` | `setState(Site.SiteState state, Environment env)`
    `void` | `setVersion(Date version)`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.appng.core.domain.Auditable

      `getAuditName`

- - ### Constructor Detail

    - #### SiteImpl

          public SiteImpl()

  - ### Method Detail

    - #### getId

          public Integer getId()

      Description copied from interface: `Identifiable`
      Returns the id.
      Specified by:
        `getId` in interface `Identifiable<Integer>`
      Returns:
        the id

    - #### setId

          public void setId(Integer id)

    - #### getName

          @NotNull(message="{validation.notNull}")
           @Pattern(regexp="[a-zA-Z0-9\\-]{3,}",
                   message="{validation.nameStrict}")
           @Size(max=64,
                message="{validation.string.max}")
          public @NotNull(message="{validation.notNull}") @Pattern(regexp="[a-zA-Z0-9\\-]{3,}",message="{validation.nameStrict}") @Size(max=64,message="{validation.string.max}") String getName()

      Description copied from interface: `Nameable`
      Returns the name.
      Specified by:
        `getName` in interface `Nameable`
      Returns:
        the name

    - #### setName

          public void setName(String name)

    - #### getDescription

          @Size(max=8192,
                message="{validation.string.max}")
          public @Size(max=8192,message="{validation.string.max}") String getDescription()

      Description copied from interface: `Nameable`
      Returns the description.
      Specified by:
        `getDescription` in interface `Nameable`
      Returns:
        the description

    - #### setDescription

          public void setDescription(String description)

    - #### getVersion

          public Date getVersion()

      Description copied from interface: `Versionable`
      Returns the version.
      Specified by:
        `getVersion` in interface `Versionable<Date>`
      Returns:
        the version

    - #### setVersion

          public void setVersion(Date version)

    - #### getSiteApplications

          public Set<SiteApplication> getSiteApplications()

    - #### setSiteApplications

          public void setSiteApplications(Set<SiteApplication> applications)

    - #### getApplications

          public Set<Application> getApplications()

      Description copied from interface: `Site`
      Returns the `Application`s which are currently assigned to this `Site`.
      Specified by:
        `getApplications` in interface `Site`
      Returns:
        the `Application`s currently assigned to this `Site`

    - #### getHost

          @NotNull(message="{validation.notNull}")
           @Pattern(regexp="(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])",
                   message="{validation.host}")
          public @NotNull(message="{validation.notNull}") @Pattern(regexp="(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])",message="{validation.host}") String getHost()

      Description copied from interface: `Site`
      Returns the main hostname for this site
      Specified by:
        `getHost` in interface `Site`
      Returns:
        the host

    - #### setHost

          public void setHost(String host)

    - #### getHostAliases

          public Set<String> getHostAliases()

      Description copied from interface: `Site`
      Returns alias hostnames for ths `Site`
      Specified by:
        `getHostAliases` in interface `Site`
      Returns:
        the alias names

    - #### setHostAliases

          public void setHostAliases(Set<String> hostAliases)

    - #### getDomain

          @NotNull(message="{validation.notNull}")
           @Pattern(regexp="(http(s?)(\\://))?((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9]))(\\:[0-9]+)?",
                   message="{validation.domain}")
          public @NotNull(message="{validation.notNull}") @Pattern(regexp="(http(s?)(\\://))?((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9]))(\\:[0-9]+)?",message="{validation.domain}") String getDomain()

      Description copied from interface: `Site`
      Returns the domain for this `Site`.
      Specified by:
        `getDomain` in interface `Site`
      Returns:
        the domain

    - #### setDomain

          public void setDomain(String domain)

    - #### isActive

          public boolean isActive()

      Description copied from interface: `Site`
      Returns `true` if this `Site` is active, which means it is being loaded at platform startup.
      Specified by:
        `isActive` in interface `Site`
      Returns:
        `true` if this `Site` is active, `false` otherwise

    - #### setActive

          public void setActive(boolean active)

    - #### isCreateRepository

          public boolean isCreateRepository()

      Description copied from interface: `Site`
      Returns `true` if a JSP-repository folder has been created for this `Site`.
      Specified by:
        `isCreateRepository` in interface `Site`
      Returns:
        `true` if a JSP-repository folder has been created

    - #### setCreateRepository

          public void setCreateRepository(boolean createRepository)

    - #### getReloadCount

          public int getReloadCount()

    - #### setReloadCount

          public void setReloadCount(int reloadCount)

    - #### getApplicationMap

          public Map<String,Application> getApplicationMap()

    - #### getApplication

          public Application getApplication(String name)

      Description copied from interface: `Site`
      Returns the `Application` with the given name, if such a `Application` is assigned to this `Site`.
      Specified by:
        `getApplication` in interface `Site`
      Parameters:
        `name` - the name of the `Application`
      Returns:
        the `Application`, if such a `Application` is assigned to this `Site`, `null` otherwise

    - #### hasApplication

          public boolean hasApplication(String name)

      Description copied from interface: `Site`
      Checks whether the `Application` with the given name is assigned to this `Site`.
      Specified by:
        `hasApplication` in interface `Site`
      Parameters:
        `name` - the name of the `Application`
      Returns:
        `true` if the `Application` with the given name is assigned to this `Site`, `false` otherwise

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### getProperties

          public Properties getProperties()

      Description copied from interface: `Site`
      Returns the `Properties` for this `Site`.
      Specified by:
        `getProperties` in interface `Site`
      Returns:
        the `Properties` for this `Site`
      See Also:
        `SiteProperties`

    - #### setProperties

          public void setProperties(Properties properties)

    - #### getSiteClassLoader

          public SiteClassLoader getSiteClassLoader()

      Description copied from interface: `Site`
      Returns the `URLClassLoader` for this `Site`, which contains all the jars provided by the `Application`s that are assigned to this `Site`.
      Specified by:
        `getSiteClassLoader` in interface `Site`
      Returns:
        the `URLClassLoader`

    - #### setSiteClassLoader

          public void setSiteClassLoader(SiteClassLoader siteClassLoader)

    - #### setSender

          public void setSender(Sender sender)

    - #### sendEvent

          public boolean sendEvent(Event event)

      Description copied from interface: `Site`
      If clustering is enabled, sends an `Event` to other appNG nodes
      Specified by:
        `sendEvent` in interface `Site`
      Parameters:
        `event` - the event to send
      Returns:
        `true` if the event was sent successfully

    - #### sendRedirect

          public void sendRedirect(Environment env,
                                   String target)

      Description copied from interface: `Site`
      sends a redirect with HTTP-Status 301 (moved permanently)
      Specified by:
        `sendRedirect` in interface `Site`
      See Also:
        `sendRedirect(Environment, String)`

    - #### sendRedirect

          public void sendRedirect(Environment env,
                                   String target,
                                   Integer statusCode)

      Description copied from interface: `Site`
      redirects the request to the given target. If the target not starts with a slash ("/"), the target has to be a relative path to a certain `Application` of this site (like "application/page"). If the target does start with a slash, it is expected to be a target relative to the domain of this site.
      Specified by:
        `sendRedirect` in interface `Site`
      Parameters:
        `env` - the actual `Environment`
        `target` - the redirect target
        `statusCode` - -the HTTP status code to send. Use constants from `HttpServletRequest`

    - #### sendRedirect

          public void sendRedirect(Environment env,
                                   String target,
                                   Integer statusCode,
                                   boolean keepOrigin)

      See Also:
        `sendRedirect(Environment, String, Integer)`

    - #### readFile

          public File readFile(String relativePath)

      Description copied from interface: `Site`
      Returns the `File` defined by the given path, which is located relative to the site's repository-folder.
      Specified by:
        `readFile` in interface `Site`
      Parameters:
        `relativePath` - the relative path of the file
      Returns:
        the `File`, if such a path exists

    - #### getStartupTime

          public Date getStartupTime()

      Description copied from interface: `Site`
      Returns the time at which the site has been loaded during platform-startup.
      Specified by:
        `getStartupTime` in interface `Site`
      Returns:
        the time, or `null` if the site has (yet) not been loaded.

    - #### setStartupTime

          public void setStartupTime(Date startupTime)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### closeSiteContext

          public void closeSiteContext()

    - #### getGroups

          public Set<Named<Integer>> getGroups()

      Description copied from interface: `Site`
      Returns a set containing a `Named`-instance for each `Group` that exists within the platform.
      Specified by:
        `getGroups` in interface `Site`
      Returns:
        the `Named` groups

    - #### setGroups

          public void setGroups(Set<Named<Integer>> groups)

    - #### setRootDirectory

          public void setRootDirectory(File siteRootDirectory)

    - #### getSiteApplication

          public SiteApplication getSiteApplication(String name)

    - #### getPasswordPolicy

          public PasswordPolicy getPasswordPolicy()

      Description copied from interface: `Site`
      Returns the `PasswordPolicy` used when creating `Subject`s for this `Site`.
      Specified by:
        `getPasswordPolicy` in interface `Site`
      Returns:
        the `PasswordPolicy`

    - #### setPasswordPolicy

          public void setPasswordPolicy(PasswordPolicy policy)

    - #### isRunning

          public boolean isRunning()

    - #### setRunning

          public void setRunning(boolean isRunning)

    - #### getState

          public Site.SiteState getState()

      Specified by:
        `getState` in interface `Site`

    - #### setState

          public void setState(Site.SiteState state)

    - #### setState

          public void setState(Site.SiteState state,
                               Environment env)

    - #### hasState

          public boolean hasState(Site.SiteState... states)

      Specified by:
        `hasState` in interface `Site`

    - #### addRequest

          public int addRequest()

    - #### removeRequest

          public int removeRequest()

    - #### getRequests

          public int getRequests()

Copyright © 2011–2023 aiticon GmbH. All rights reserved.