Class EDEFProperties
- java.lang.Object
-
- java.util.Dictionary<K,V>
-
- java.util.Hashtable<Object,Object>
-
- java.util.Properties
-
- org.eclipse.ecf.osgi.services.remoteserviceadmin.EDEFProperties
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<Object,Object>
public class EDEFProperties extends Properties
Class to represent EDEF properties for load from .properties file (vialoadEDEFProperties(InputStream)
orloadEDEFProperties(Reader)
) or via store to .properties file (viastoreEDEFProperties(BufferedWriter, String)
orstoreEDEFProperties(Writer, String)
. This class is used by the EndpointDescriptionLocator class to load from default.properties files as well as properties edeffile.properties to override the values from the edeffile.xml files specified by the Remote-Service header in manifest as per the RSA specification (chap 122 in compendium spec).- Since:
- 4.8
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
EDEFProperties.Value
-
Field Summary
-
Fields inherited from class java.util.Properties
defaults
-
-
Constructor Summary
Constructors Constructor Description EDEFProperties()
Create empty EDEFProperties instance.EDEFProperties(Map<String,Object> properties)
Create EDEFProperties instance initialized with all the given properties
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>
getEDEFPropertiesAsMap()
Get EDEF properties as String -> Object mapEDEFProperties.Value
getValue(String name)
Get EDEF Property Value given namevoid
loadEDEFProperties(InputStream ins)
Load EDEF properties from the given input streamvoid
loadEDEFProperties(Reader reader)
Load EDEF properties from the given readerObject
put(Object key, Object value)
void
putEDEFProperties(Map<String,Object> properties)
Put all the given properties into this map as EDEF properties, suitable for storing viastoreEDEFProperties(Writer, String)
Object
putEDEFProperty(String name, Object value)
Put String->Object relation in as an EDEF property.void
storeEDEFProperties(BufferedWriter bufferedWriter, String comments)
Store EDEF properties to the given buffered writer.void
storeEDEFProperties(Writer writer, String comments)
Store EDEF properties to given Writer-
Methods inherited from class java.util.Properties
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, getProperty, getProperty, hashCode, isEmpty, keys, keySet, list, list, load, load, loadFromXML, merge, propertyNames, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, save, setProperty, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString, values
-
-
-
-
Method Detail
-
getValue
public EDEFProperties.Value getValue(String name)
Get EDEF Property Value given name- Parameters:
name
- the name/key of the EDEFProperty previously loaded or added. Must not benull
.- Returns:
- Value the value found for given name/key.
Null
if not found.
-
putEDEFProperty
public Object putEDEFProperty(String name, Object value)
Put String->Object relation in as an EDEF property. Both the key and value must not benull
. The value must be either a Set, List, Array type or a primitive type: Long/long, Byte/byte, Short/short, Int/Integer, char/Character, double/Double, float/Float. If array,set, or list, the elements must be one of the primitive types.- Parameters:
key
- unique name/key for given value. Must not benull
.value
- array,list,set of primitive type or instance of primitive type.- Returns:
- existing Object with name/key. Null if no existing object exists.
-
getEDEFPropertiesAsMap
public Map<String,Object> getEDEFPropertiesAsMap()
Get EDEF properties as String -> Object map- Returns:
- Map
containing all name->EDEFPropertiesValue contents of this EDEFProperties
-
loadEDEFProperties
public void loadEDEFProperties(InputStream ins) throws IOException
Load EDEF properties from the given input stream- Parameters:
ins
- InputStream to read the edef properties from. Must not benull
- Throws:
IOException
- if properties cannot be read from given InputStream
-
loadEDEFProperties
public void loadEDEFProperties(Reader reader) throws IOException
Load EDEF properties from the given reader- Parameters:
reader
- Reader to read the edef properties from. Must not benull
- Throws:
IOException
- if properties cannot be read from given Reader
-
storeEDEFProperties
public void storeEDEFProperties(Writer writer, String comments) throws IOException
Store EDEF properties to given Writer- Parameters:
writer
- the Writer to write output to. Must not benull
.comments
-- Throws:
IOException
-
storeEDEFProperties
public void storeEDEFProperties(BufferedWriter bufferedWriter, String comments) throws IOException
Store EDEF properties to the given buffered writer.- Parameters:
bufferedWriter
- the BufferedWriter to write to. Must not benull
comments
- Comment line prepended to properties file output. May benull
.- Throws:
IOException
- if properties cannot be written to bufferedWriter
-
putEDEFProperties
public void putEDEFProperties(Map<String,Object> properties)
Put all the given properties into this map as EDEF properties, suitable for storing viastoreEDEFProperties(Writer, String)
- Parameters:
properties
- the properties to put. May not benull
-
-