Class FileBasedKieServerTemplateStorage
- java.lang.Object
-
- org.kie.server.controller.impl.storage.FileBasedKieServerTemplateStorage
-
- All Implemented Interfaces:
org.kie.server.controller.api.storage.KieServerTemplateStorage
public class FileBasedKieServerTemplateStorage extends Object implements org.kie.server.controller.api.storage.KieServerTemplateStorage
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_SERVER_TEMPLATE_FILENAMEstatic StringSERVER_TEMPLATE_FILE_NAME_PROPstatic StringSTORAGE_FILE_WATCHER_ENABLED
-
Constructor Summary
Constructors Modifier Constructor Description protectedFileBasedKieServerTemplateStorage()Default constructorprotectedFileBasedKieServerTemplateStorage(String templatesLocation)Constructor that takes a template location argument
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearTemplateMaps()voidclose()org.kie.server.controller.api.model.spec.ServerTemplatedelete(String identifier)booleanexists(String identifier)static FileBasedKieServerTemplateStoragegetInstance()static FileBasedKieServerTemplateStoragegetInstance(String templatesLocation)org.kie.server.controller.api.model.spec.ServerTemplateKeygetTemplateKey(String id)Returns the ServerTemplateKey object associated with a server template's idStringgetTemplatesLocation()protected voidinit(String templatesLocation)Initializes the class instanceList<org.kie.server.controller.api.model.spec.ServerTemplate>load()org.kie.server.controller.api.model.spec.ServerTemplateload(String identifier)List<org.kie.server.controller.api.model.spec.ServerTemplateKey>loadKeys()voidloadTemplateMapsFromFile()Loads the map of server templates from the file pointed at by the templatesLocationvoidsetTemplatesLocation(String templatesLocation)org.kie.server.controller.api.model.spec.ServerTemplatestore(org.kie.server.controller.api.model.spec.ServerTemplate serverTemplate)StringtoString()org.kie.server.controller.api.model.spec.ServerTemplateupdate(org.kie.server.controller.api.model.spec.ServerTemplate serverTemplate)
-
-
-
Field Detail
-
STORAGE_FILE_WATCHER_ENABLED
public static final String STORAGE_FILE_WATCHER_ENABLED
- See Also:
- Constant Field Values
-
SERVER_TEMPLATE_FILE_NAME_PROP
public static final String SERVER_TEMPLATE_FILE_NAME_PROP
- See Also:
- Constant Field Values
-
DEFAULT_SERVER_TEMPLATE_FILENAME
public static final String DEFAULT_SERVER_TEMPLATE_FILENAME
-
-
Constructor Detail
-
FileBasedKieServerTemplateStorage
protected FileBasedKieServerTemplateStorage()
Default constructor
-
FileBasedKieServerTemplateStorage
protected FileBasedKieServerTemplateStorage(String templatesLocation)
Constructor that takes a template location argument- Parameters:
templatesLocation- A string value that indicates where the server templates should be stored. A null value indicates that the value should be retrieved from the system properties.
-
-
Method Detail
-
getInstance
public static FileBasedKieServerTemplateStorage getInstance()
-
getInstance
public static FileBasedKieServerTemplateStorage getInstance(String templatesLocation)
-
init
protected void init(String templatesLocation)
Initializes the class instance- Parameters:
templatesLocation- A string value that indicates where the server templates should be stored. A null value indicates that the value should be retrieved from the system properties.
-
loadTemplateMapsFromFile
public void loadTemplateMapsFromFile()
Loads the map of server templates from the file pointed at by the templatesLocation
-
store
public org.kie.server.controller.api.model.spec.ServerTemplate store(org.kie.server.controller.api.model.spec.ServerTemplate serverTemplate)
- Specified by:
storein interfaceorg.kie.server.controller.api.storage.KieServerTemplateStorage
-
loadKeys
public List<org.kie.server.controller.api.model.spec.ServerTemplateKey> loadKeys()
- Specified by:
loadKeysin interfaceorg.kie.server.controller.api.storage.KieServerTemplateStorage
-
getTemplateKey
public org.kie.server.controller.api.model.spec.ServerTemplateKey getTemplateKey(String id)
Returns the ServerTemplateKey object associated with a server template's id- Parameters:
id- The server template id that points to the ServerTemplateKey- Returns:
- The ServerTemplateKey that is associated with the id, or null if the id does exist in the templateKeyMap
-
load
public List<org.kie.server.controller.api.model.spec.ServerTemplate> load()
- Specified by:
loadin interfaceorg.kie.server.controller.api.storage.KieServerTemplateStorage
-
load
public org.kie.server.controller.api.model.spec.ServerTemplate load(String identifier)
- Specified by:
loadin interfaceorg.kie.server.controller.api.storage.KieServerTemplateStorage
-
exists
public boolean exists(String identifier)
- Specified by:
existsin interfaceorg.kie.server.controller.api.storage.KieServerTemplateStorage
-
update
public org.kie.server.controller.api.model.spec.ServerTemplate update(org.kie.server.controller.api.model.spec.ServerTemplate serverTemplate)
- Specified by:
updatein interfaceorg.kie.server.controller.api.storage.KieServerTemplateStorage
-
delete
public org.kie.server.controller.api.model.spec.ServerTemplate delete(String identifier)
- Specified by:
deletein interfaceorg.kie.server.controller.api.storage.KieServerTemplateStorage
-
clearTemplateMaps
public void clearTemplateMaps()
-
setTemplatesLocation
public void setTemplatesLocation(String templatesLocation)
-
getTemplatesLocation
public String getTemplatesLocation()
-
close
public void close()
- Specified by:
closein interfaceorg.kie.server.controller.api.storage.KieServerTemplateStorage
-
-