org.openwms.core.service.spring
Class ConfigurationServiceImpl

java.lang.Object
  extended by org.openwms.core.service.spring.ConfigurationServiceImpl
All Implemented Interfaces:
EventListener, ConfigurationService, org.springframework.context.ApplicationListener<MergePropertiesEvent>

@Transactional
@Service(value="configurationService")
public class ConfigurationServiceImpl
extends Object
implements ConfigurationService, org.springframework.context.ApplicationListener<MergePropertiesEvent>

A ConfigurationServiceImpl is a transactional Spring powered service implementation to manage preferences. This implementation can be autowired with the name "configurationService".

Since:
0.1
Version:
$Revision: 1543 $
Author:
Heiko Scherrer

Field Summary
static String COMPONENT_NAME
          Springs service name.
 
Constructor Summary
ConfigurationServiceImpl()
           
 
Method Summary
 List<AbstractPreference> findAll()
          Find and return all preferences.
<T extends AbstractPreference>
List<T>
findByType(Class<T> clazz)
          Find and return all preferences in the scope of the application.
 void onApplicationEvent(MergePropertiesEvent event)
           When an event arrives all new preferences received from the file provider are persisted.
 void remove(AbstractPreference preference)
          Remove a AbstractPreference.
 AbstractPreference save(AbstractPreference preference)
          Save the given AbstractPreference or persist it when it is a transient instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPONENT_NAME

public static final String COMPONENT_NAME
Springs service name.

See Also:
Constant Field Values
Constructor Detail

ConfigurationServiceImpl

public ConfigurationServiceImpl()
Method Detail

onApplicationEvent

public void onApplicationEvent(MergePropertiesEvent event)
When an event arrives all new preferences received from the file provider are persisted. Already persisted preferences are ignored.

Specified by:
onApplicationEvent in interface org.springframework.context.ApplicationListener<MergePropertiesEvent>
See Also:
ApplicationListener.onApplicationEvent(org.springframework.context.ApplicationEvent)

findAll

public List<AbstractPreference> findAll()
Find and return all preferences. The order of elements is not guaranteed and is specific to the implementation.

Specified by:
findAll in interface ConfigurationService
Returns:
a list of all preferences
See Also:
EntityServiceImpl.findAll()

findByType

public <T extends AbstractPreference> List<T> findByType(Class<T> clazz)
Find and return all preferences in the scope of the application.

Specified by:
findByType in interface ConfigurationService
Type Parameters:
T - Any subtype of AbstractPreference
Parameters:
clazz - The class of preference to search for
Returns:
a list of preferences of type T
See Also:
ConfigurationService.findByType(java.lang.Class)

save

public AbstractPreference save(AbstractPreference preference)
Save the given AbstractPreference or persist it when it is a transient instance. It is not allowed to call the implementation with a null argument.

Specified by:
save in interface ConfigurationService
Parameters:
preference - AbstractPreference entity to save
Returns:
Saved AbstractPreference entity instance
Throws:
IllegalArgumentException - when preference is null
See Also:
EntityServiceImpl.save(org.openwms.core.domain.AbstractEntity)

remove

public void remove(AbstractPreference preference)
Remove a AbstractPreference.

Specified by:
remove in interface ConfigurationService
Parameters:
preference - The AbstractPreference to remove
Throws:
IllegalArgumentException - when preference is null
See Also:
ConfigurationService.remove(org.openwms.core.domain.system.AbstractPreference)


Copyright © 2005-2011 openwms.org. All Rights Reserved.