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 (via loadEDEFProperties(InputStream) or loadEDEFProperties(Reader)) or via store to .properties file (via storeEDEFProperties(BufferedWriter, String) or storeEDEFProperties(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:
  • Constructor Details

    • EDEFProperties

      public EDEFProperties()
      Create empty EDEFProperties instance.
    • EDEFProperties

      public EDEFProperties(Map<String,Object> properties)
      Create EDEFProperties instance initialized with all the given properties
      Parameters:
      properties - must not be null
  • Method Details

    • put

      public Object put(Object key, Object value)
      Specified by:
      put in interface Map<Object,Object>
      Overrides:
      put in class Properties
    • 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 be null.
      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 be null. 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 be null.
      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<String,Object> 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 be null
      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 be null
      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 be null.
      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 be null
      comments - Comment line prepended to properties file output. May be null.
      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 via storeEDEFProperties(Writer, String)
      Parameters:
      properties - the properties to put. May not be null