Package org.appng.api.support
Class ApplicationConfigProviderImpl
- java.lang.Object
-
- org.appng.api.support.ApplicationConfigProviderImpl
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ApplicationConfigProvider
public class ApplicationConfigProviderImpl extends Object implements ApplicationConfigProvider
DefaultApplicationConfigProvider
-implementation.- Author:
- Matthias Müller
-
-
Field Summary
Fields Modifier and Type Field Description protected org.appng.api.support.ApplicationConfigProviderImpl.ActionMap
actionMap
protected org.appng.api.support.ApplicationConfigProviderImpl.DataSourceMap
datasourceMap
protected List<Object[]>
descendantDatasources
protected org.appng.api.support.ApplicationConfigProviderImpl.EventMap
eventMap
protected org.appng.api.support.ApplicationConfigProviderImpl.PageMap
pageMap
protected Map<String,String>
resourceMap
protected ApplicationRootConfig
rootConfig
protected ConfigValidator
validator
-
Constructor Summary
Constructors Constructor Description ApplicationConfigProviderImpl(MarshallService marshallService, String applicationName, Resources applicationResources, boolean devMode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
clear()
ApplicationConfigProvider
cloneConfig(MarshallService marshallService)
Clones thisApplicationConfigProvider
, which is necessary because thevoid
close()
Action
getAction(String eventId, String actionId)
Map<String,Action>
getActions(String eventId)
ApplicationInfo
getApplicationInfo()
ApplicationRootConfig
getApplicationRootConfig()
Returns theApplicationRootConfig
.Datasource
getDatasource(String id)
Returns theDatasource
with the given id, if present.Map<String,Datasource>
getDataSources()
Returns a map of allDatasource
s, using the id as the key.String
getDefaultPage()
Returns the id of the default-page, which is thePageDefinition
with the type 'index
'.Event
getEvent(String id)
Returns theEvent
with the given id, if present.Set<String>
getEventIds()
Returns all ids from all knownEvent
sPageDefinition
getPage(String id)
Returns thePageDefinition
with the given id, if present.Map<String,PageDefinition>
getPages()
Returns a map of allPageDefinition
s, using the id as the key.String
getResourceNameForApplicationRootConfig()
Returns the name of theResource
where theApplicationRootConfig
was defined.String
getResourceNameForDataSource(String datasourceId)
Returns the name of theResource
where theDatasource
with the given id was defined.String
getResourceNameForEvent(String eventId)
String
getResourceNameForPage(String pageId)
Returns the name of theResource
where thePageDefinition
with the given id was defined.Resources
getResources()
Set<String>
getSessionParams()
void
setDefaultPage(String defaultPage)
void
setSessionParams(Set<String> sessionParams)
-
-
-
Field Detail
-
actionMap
protected org.appng.api.support.ApplicationConfigProviderImpl.ActionMap actionMap
-
datasourceMap
protected org.appng.api.support.ApplicationConfigProviderImpl.DataSourceMap datasourceMap
-
pageMap
protected org.appng.api.support.ApplicationConfigProviderImpl.PageMap pageMap
-
eventMap
protected org.appng.api.support.ApplicationConfigProviderImpl.EventMap eventMap
-
validator
protected ConfigValidator validator
-
rootConfig
protected ApplicationRootConfig rootConfig
-
-
Constructor Detail
-
ApplicationConfigProviderImpl
public ApplicationConfigProviderImpl(MarshallService marshallService, String applicationName, Resources applicationResources, boolean devMode) throws InvalidConfigurationException
- Throws:
InvalidConfigurationException
-
-
Method Detail
-
getDataSources
public Map<String,Datasource> getDataSources()
Description copied from interface:ApplicationConfigProvider
Returns a map of allDatasource
s, using the id as the key.- Specified by:
getDataSources
in interfaceApplicationConfigProvider
- Returns:
- a map of all
Datasource
s
-
clear
protected void clear()
-
getAction
public Action getAction(String eventId, String actionId)
Description copied from interface:ApplicationConfigProvider
-
getActions
public Map<String,Action> getActions(String eventId)
Description copied from interface:ApplicationConfigProvider
- Specified by:
getActions
in interfaceApplicationConfigProvider
- Parameters:
eventId
- the id of theEvent
to get theAction
s for- Returns:
- a map of all
Action
s for the givenEvent
, ornull
if there is no such event
-
getDatasource
public Datasource getDatasource(String id)
Description copied from interface:ApplicationConfigProvider
Returns theDatasource
with the given id, if present.- Specified by:
getDatasource
in interfaceApplicationConfigProvider
- Parameters:
id
- the id of theDatasource
to get- Returns:
- the
Datasource
with the given id, ornull
if no suchDatasource
exists
-
getDefaultPage
public String getDefaultPage()
Description copied from interface:ApplicationConfigProvider
Returns the id of the default-page, which is thePageDefinition
with the type 'index
'.- Specified by:
getDefaultPage
in interfaceApplicationConfigProvider
- Returns:
- the id of the default-page
-
getEvent
public Event getEvent(String id)
Description copied from interface:ApplicationConfigProvider
Returns theEvent
with the given id, if present.- Specified by:
getEvent
in interfaceApplicationConfigProvider
- Parameters:
id
- the id of theEvent
to get- Returns:
- the
Event
with the given id, ornull
if no suchEvent
exists
-
getEventIds
public Set<String> getEventIds()
Description copied from interface:ApplicationConfigProvider
Returns all ids from all knownEvent
s- Specified by:
getEventIds
in interfaceApplicationConfigProvider
- Returns:
-
getPage
public PageDefinition getPage(String id)
Description copied from interface:ApplicationConfigProvider
Returns thePageDefinition
with the given id, if present.- Specified by:
getPage
in interfaceApplicationConfigProvider
- Parameters:
id
- the id of thePageDefinition
to get- Returns:
- the
PageDefinition
with the given id, ornull
if no suchPageDefinition
exists
-
getPages
public Map<String,PageDefinition> getPages()
Description copied from interface:ApplicationConfigProvider
Returns a map of allPageDefinition
s, using the id as the key.- Specified by:
getPages
in interfaceApplicationConfigProvider
- Returns:
- a map of all
PageDefinition
s
-
getApplicationRootConfig
public ApplicationRootConfig getApplicationRootConfig()
Description copied from interface:ApplicationConfigProvider
Returns theApplicationRootConfig
.- Specified by:
getApplicationRootConfig
in interfaceApplicationConfigProvider
- Returns:
- the
ApplicationRootConfig
-
setDefaultPage
public void setDefaultPage(String defaultPage)
-
getResourceNameForEvent
public String getResourceNameForEvent(String eventId)
Description copied from interface:ApplicationConfigProvider
- Specified by:
getResourceNameForEvent
in interfaceApplicationConfigProvider
- Parameters:
eventId
- the id of theEvent
- Returns:
- the name of the
Resource
where theEvent
with the given id was defined, ornull
if there is no suchEvent
-
getResourceNameForPage
public String getResourceNameForPage(String pageId)
Description copied from interface:ApplicationConfigProvider
Returns the name of theResource
where thePageDefinition
with the given id was defined.- Specified by:
getResourceNameForPage
in interfaceApplicationConfigProvider
- Parameters:
pageId
- the id of thePageDefinition
- Returns:
- the name of the
Resource
where thePageDefinition
with the given id was defined, ornull
if there is no suchPageDefinition
-
getResourceNameForDataSource
public String getResourceNameForDataSource(String datasourceId)
Description copied from interface:ApplicationConfigProvider
Returns the name of theResource
where theDatasource
with the given id was defined.- Specified by:
getResourceNameForDataSource
in interfaceApplicationConfigProvider
- Parameters:
datasourceId
- the id of theDatasource
- Returns:
- the name of the
Resource
where theDatasource
with the given id was defined, ornull
if there is no suchDatasource
-
getResourceNameForApplicationRootConfig
public String getResourceNameForApplicationRootConfig()
Description copied from interface:ApplicationConfigProvider
Returns the name of theResource
where theApplicationRootConfig
was defined.- Specified by:
getResourceNameForApplicationRootConfig
in interfaceApplicationConfigProvider
- Returns:
- the name of the
Resource
where theApplicationRootConfig
was defined.
-
cloneConfig
public ApplicationConfigProvider cloneConfig(MarshallService marshallService) throws InvalidConfigurationException
Description copied from interface:ApplicationConfigProvider
Clones thisApplicationConfigProvider
, which is necessary because the- Specified by:
cloneConfig
in interfaceApplicationConfigProvider
- Parameters:
marshallService
- aMarshallService
to read the configuration files, only needed if appNG is in development-mode- Returns:
- a new ApplicationConfigProvider
- Throws:
InvalidConfigurationException
- if there is some configuration error inside the application
-
getApplicationInfo
public ApplicationInfo getApplicationInfo()
Description copied from interface:ApplicationConfigProvider
- Specified by:
getApplicationInfo
in interfaceApplicationConfigProvider
- Returns:
- the
ApplicationInfo
-
getResources
public Resources getResources()
- Specified by:
getResources
in interfaceApplicationConfigProvider
-
close
public void close() throws IOException
- Specified by:
close
in interfaceApplicationConfigProvider
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
-