Package 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>
DefaultSite
-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 Description SiteImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
addRequest()
void
closeSiteContext()
boolean
equals(Object o)
Application
getApplication(String name)
Map<String,Application>
getApplicationMap()
Set<Application>
getApplications()
Returns theApplication
s which are currently assigned to thisSite
.@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 thisSite
.Set<Named<Integer>>
getGroups()
@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 host for this siteInteger
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()
Properties
getProperties()
Returns theProperties
for thisSite
.int
getReloadCount()
int
getRequests()
SiteApplication
getSiteApplication(String name)
Set<SiteApplication>
getSiteApplications()
SiteClassLoader
getSiteClassLoader()
Returns theURLClassLoader
for thisSite
, which contains all the jars provided by theApplication
s that are assigned to thisSite
.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 theApplication
with the given name is assigned to thisSite
.int
hashCode()
boolean
hasState(Site.SiteState... states)
boolean
isActive()
Returnstrue
if thisSite
is active, which means it is being loaded at platform startup.boolean
isCreateRepository()
Returnstrue
if a JSP-repository folder has been created for thisSite
.boolean
isRunning()
File
readFile(String relativePath)
Returns theFile
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 anEvent
to other appNG nodesvoid
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
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
-
-
-
-
Method Detail
-
getId
public Integer getId()
Description copied from interface:Identifiable
Returns the id.- Specified by:
getId
in interfaceIdentifiable<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.
-
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 interfaceNameable
- 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 interfaceVersionable<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 theApplication
s which are currently assigned to thisSite
.- Specified by:
getApplications
in interfaceSite
- Returns:
- the
Application
s currently assigned to thisSite
-
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 host for this site
-
setHost
public void setHost(String host)
-
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 thisSite
.
-
setDomain
public void setDomain(String domain)
-
isActive
public boolean isActive()
Description copied from interface:Site
Returnstrue
if thisSite
is active, which means it is being loaded at platform startup.
-
setActive
public void setActive(boolean active)
-
isCreateRepository
public boolean isCreateRepository()
Description copied from interface:Site
Returnstrue
if a JSP-repository folder has been created for thisSite
.- Specified by:
isCreateRepository
in interfaceSite
- 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
- Specified by:
getApplication
in interfaceSite
- Parameters:
name
- the name of theApplication
- Returns:
- the
Application
, if such aApplication
is assigned to thisSite
,null
otherwise
-
hasApplication
public boolean hasApplication(String name)
Description copied from interface:Site
Checks whether theApplication
with the given name is assigned to thisSite
.- Specified by:
hasApplication
in interfaceSite
- Parameters:
name
- the name of theApplication
- Returns:
true
if theApplication
with the given name is assigned to thisSite
,false
otherwise
-
getProperties
public Properties getProperties()
Description copied from interface:Site
Returns theProperties
for thisSite
.- Specified by:
getProperties
in interfaceSite
- Returns:
- the
Properties
for thisSite
- See Also:
SiteProperties
-
setProperties
public void setProperties(Properties properties)
-
getSiteClassLoader
public SiteClassLoader getSiteClassLoader()
Description copied from interface:Site
Returns theURLClassLoader
for thisSite
, which contains all the jars provided by theApplication
s that are assigned to thisSite
.- Specified by:
getSiteClassLoader
in interfaceSite
- 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 anEvent
to other appNG nodes
-
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 interfaceSite
- 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 certainApplication
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 interfaceSite
- Parameters:
env
- the actualEnvironment
target
- the redirect targetstatusCode
- -the HTTP status code to send. Use constants fromHttpServletRequest
-
sendRedirect
public void sendRedirect(Environment env, String target, Integer statusCode, boolean keepOrigin)
-
readFile
public File readFile(String relativePath)
Description copied from interface:Site
Returns theFile
defined by the given path, which is located relative to the site's repository-folder.
-
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 interfaceSite
- Returns:
- the time, or
null
if the site has (yet) not been loaded.
-
setStartupTime
public void setStartupTime(Date startupTime)
-
closeSiteContext
public void closeSiteContext()
-
setRootDirectory
public void setRootDirectory(File siteRootDirectory)
-
getSiteApplication
public SiteApplication getSiteApplication(String name)
-
getPasswordPolicy
public PasswordPolicy getPasswordPolicy()
Description copied from interface:Site
- Specified by:
getPasswordPolicy
in interfaceSite
- Returns:
- the
PasswordPolicy
-
setPasswordPolicy
public void setPasswordPolicy(PasswordPolicy policy)
-
isRunning
public boolean isRunning()
-
setRunning
public void setRunning(boolean isRunning)
-
getState
public Site.SiteState getState()
-
setState
public void setState(Site.SiteState state)
-
setState
public void setState(Site.SiteState state, Environment env)
-
hasState
public boolean hasState(Site.SiteState... states)
-
addRequest
public int addRequest()
-
removeRequest
public int removeRequest()
-
getRequests
public int getRequests()
-
-