diff options
Diffstat (limited to 'lib/cosProperty')
48 files changed, 4516 insertions, 0 deletions
diff --git a/lib/cosProperty/AUTHORS b/lib/cosProperty/AUTHORS new file mode 100644 index 0000000000..55d8059989 --- /dev/null +++ b/lib/cosProperty/AUTHORS @@ -0,0 +1,4 @@ +Original Authors: +Niclas Eklund + +Contributors: diff --git a/lib/cosProperty/Makefile b/lib/cosProperty/Makefile new file mode 100644 index 0000000000..e8ec803004 --- /dev/null +++ b/lib/cosProperty/Makefile @@ -0,0 +1,41 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2000-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include vsn.mk +VSN=$(COSPROPERTY_VSN) + +# ---------------------------------------------------- +# Common Macros +# ---------------------------------------------------- +# SUB_DIRECTORIES = src test examples doc/src +# At the moment we don't have any example programs. +SUB_DIRECTORIES = src doc/src + +SPECIAL_TARGETS = + +# ---------------------------------------------------- +# Default Subdir Targets +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_subdir.mk diff --git a/lib/cosProperty/doc/html/.gitignore b/lib/cosProperty/doc/html/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/cosProperty/doc/html/.gitignore diff --git a/lib/cosProperty/doc/man3/.gitignore b/lib/cosProperty/doc/man3/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/cosProperty/doc/man3/.gitignore diff --git a/lib/cosProperty/doc/man6/.gitignore b/lib/cosProperty/doc/man6/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/cosProperty/doc/man6/.gitignore diff --git a/lib/cosProperty/doc/pdf/.gitignore b/lib/cosProperty/doc/pdf/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/cosProperty/doc/pdf/.gitignore diff --git a/lib/cosProperty/doc/src/CosPropertyService_PropertiesIterator.xml b/lib/cosProperty/doc/src/CosPropertyService_PropertiesIterator.xml new file mode 100644 index 0000000000..75c7cb38cb --- /dev/null +++ b/lib/cosProperty/doc/src/CosPropertyService_PropertiesIterator.xml @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>2000</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>CosPropertyService_­PropertiesIterator</title> + <shorttitle>..._PropertiesIterator</shorttitle> + <prepared></prepared> + <docno></docno> + <checked></checked> + <date>2000-07-25</date> + <rev>1.0</rev> + </header> + <module>CosPropertyService_PropertiesIterator</module> + <modulesummary>This module implements the OMG CosPropertyService::PropertiesIterator interface.</modulesummary> + <description> + <p>To get access to the record definitions for the structures use: <br></br> +<c>-include_lib("cosProperty/include/CosPropertyService.hrl").</c></p> + </description> + <funcs> + <func> + <name>reset(Iterator) -> ok</name> + <fsummary>Reset the position to the first property</fsummary> + <type> + <v>Iterator = #objref</v> + </type> + <desc> + <p>This operation resets the position to the first property. </p> + </desc> + </func> + <func> + <name>next_one(Iterator) -> Reply</name> + <fsummary>Return true if a Property exists at the current position and the out parameter is a valid Property. Otherwise false and a non-valid property</fsummary> + <type> + <v>Iterator = #objref</v> + <v>Reply = {boolean(), #'CosPropertyService_Property'{property_name = Name, property_value = Value}}</v> + <v>Name = string()</v> + <v>Value = #any</v> + </type> + <desc> + <p>This operation returns true . If false is returned the out + parameter is a non-valid Property.</p> + </desc> + </func> + <func> + <name>next_n(Iterator, HowMany) -> Reply</name> + <fsummary>Return true if the requested number of properties can be delivered and there are additional properties. Otherwise false is returned and a sequence of max <c>HowMany</c>properties</fsummary> + <type> + <v>Iterator = #objref</v> + <v>HowMany = long()</v> + <v>Reply = {boolean(), Properties}</v> + <v>Properties = [#'CosPropertyService_Property'{property_name = Name, property_value = Value}]</v> + <v>Name = string()</v> + <v>Value = #any</v> + </type> + <desc> + <p>This operation returns true if the requested number of properties can be + delivered and there are additional properties. If false is returned and a + sequence of max <c>HowMany</c> properties will be returned and no more + properties can be delivered. </p> + </desc> + </func> + <func> + <name>destroy(Iterator) -> ok</name> + <fsummary>Terminate the target object</fsummary> + <type> + <v>Iterator = #objref</v> + </type> + <desc> + <p>This operation will terminate the Iterator and all subsequent calls + will fail. </p> + </desc> + </func> + </funcs> + +</erlref> + diff --git a/lib/cosProperty/doc/src/CosPropertyService_PropertyNamesIterator.xml b/lib/cosProperty/doc/src/CosPropertyService_PropertyNamesIterator.xml new file mode 100644 index 0000000000..54e29a5c01 --- /dev/null +++ b/lib/cosProperty/doc/src/CosPropertyService_PropertyNamesIterator.xml @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>2000</year> + <year>2007</year> + <holder>Ericsson AB, All Rights Reserved</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + </legalnotice> + + <title>CosPropertyService_­PropertyNamesIterator</title> + <shorttitle>..._PropertyNamesIterator</shorttitle> + <prepared>Niclas Eklund</prepared> + <responsible>Niclas Eklund</responsible> + <docno></docno> + <approved>Niclas Eklund</approved> + <checked></checked> + <date>2000-07-25</date> + <rev>1.0</rev> + </header> + <module>CosPropertyService_PropertyNamesIterator</module> + <modulesummary>This module implements the OMG CosPropertyService::PropertyNamesIterator interface.</modulesummary> + <description> + <p>To get access to the record definitions for the structures use: <br></br> +<c>-include_lib("cosProperty/include/CosPropertyService.hrl").</c></p> + </description> + <funcs> + <func> + <name>reset(Iterator) -> ok</name> + <fsummary>Reset the position to the first property name</fsummary> + <type> + <v>Iterator = #objref</v> + </type> + <desc> + <p>This operation resets the position to the first property name. </p> + </desc> + </func> + <func> + <name>next_one(Iterator) -> Reply</name> + <fsummary>Return true if a Property Name exists at the current position and the out parameter is a valid Property Name. Otherwise false and a non-valid Property Name</fsummary> + <type> + <v>Iterator = #objref</v> + <v>Reply = {boolean(), Name}</v> + <v>Name = string()</v> + </type> + <desc> + <p>This operation returns true if a Property Name exists at the current + position and the out parameter is a valid Property Name. + If false is returned the out parameter is a non-valid Property Name.</p> + </desc> + </func> + <func> + <name>next_n(Iterator, HowMany) -> Reply</name> + <fsummary>Return <c>HowMany</c>Property Names and a boolean which is true if additional Property Names exists</fsummary> + <type> + <v>Iterator = #objref</v> + <v>HowMany = long()</v> + <v>Reply = {boolean(), [Name]}</v> + <v>Name = string()</v> + </type> + <desc> + <p>This operation returns true if the requested number of Property Names can be + delivered and there are additional property names. If false is returned a + sequence of max <c>HowMany</c> property names will be returned and no + more Property Names can be delivered. </p> + </desc> + </func> + <func> + <name>destroy(Iterator) -> ok</name> + <fsummary>Terminate the target object</fsummary> + <type> + <v>Iterator = #objref</v> + </type> + <desc> + <p>This operation will terminate the Iterator and all subsequent calls + will fail. </p> + </desc> + </func> + </funcs> + +</erlref> + diff --git a/lib/cosProperty/doc/src/CosPropertyService_PropertySet.xml b/lib/cosProperty/doc/src/CosPropertyService_PropertySet.xml new file mode 100644 index 0000000000..4a2073d88d --- /dev/null +++ b/lib/cosProperty/doc/src/CosPropertyService_PropertySet.xml @@ -0,0 +1,201 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>2000</year> + <year>2007</year> + <holder>Ericsson AB, All Rights Reserved</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + </legalnotice> + + <title>CosPropertyService_­PropertySet</title> + <shorttitle>..._PropertySet</shorttitle> + <prepared>Niclas Eklund</prepared> + <responsible>Niclas Eklund</responsible> + <docno></docno> + <approved>Niclas Eklund</approved> + <checked></checked> + <date>2000-07-25</date> + <rev>1.0</rev> + </header> + <module>CosPropertyService_PropertySet</module> + <modulesummary>This module implements the OMG CosPropertyService::PropertySet interface.</modulesummary> + <description> + <p>To get access to the record definitions for the structures use: <br></br> +<c>-include_lib("cosProperty/include/CosPropertyService.hrl").</c></p> + </description> + <funcs> + <func> + <name>define_property(PropertySet, Name, Value) -> Reply</name> + <fsummary>Add a new property to the target object</fsummary> + <type> + <v>PropertySet = #objref</v> + <v>Name = non-empty string()</v> + <v>Value = #any</v> + <v>Reply = ok | {'EXCEPTION', #CosPropertyService_InvalidPropertyName{}} | {'EXCEPTION', #CosPropertyService_ConflictingProperty{}} | {'EXCEPTION', #CosPropertyService_UnsupportedTypeCode{}} | {'EXCEPTION', #CosPropertyService_UnsupportedProperty{}} | {'EXCEPTION', #CosPropertyService_ReadOnlyProperty{}}</v> + </type> + <desc> + <p>This operation adds a new property to the given object. Depending on + which initial arguments was supplied when starting the object several + exceptions may be raised.</p> + </desc> + </func> + <func> + <name>define_properties(PropertySet, Properties) -> Reply</name> + <fsummary>Add new properties to the target object</fsummary> + <type> + <v>PropertySet = #objref</v> + <v>Properties = [#'CosPropertyService_Property'{property_name = Name, property_value = Value}]</v> + <v>Name = string()</v> + <v>Value = #any</v> + <v>Reply = ok | {'EXCEPTION', #CosPropertyService_MultipleExceptions{exceptions = Excs}}</v> + <v>Excs = [#'CosPropertyService_PropertyException{reason = Reason, failing_property_name = Name}]</v> + <v>Reason = invalid_property_name | conflicting_property | property_not_found | unsupported_type_code | unsupported_property | unsupported_mode | fixed_property | read_only_property</v> + </type> + <desc> + <p>This operation adds several new properties to the given object. Depending on + which initial arguments was supplied when starting the object an + exceptions may be raised listing the properties failing.</p> + </desc> + </func> + <func> + <name>get_number_of_properties(PropertySet) -> ulong()</name> + <fsummary>Get the number of properties associated with the target object</fsummary> + <type> + <v>PropertySet = #objref</v> + </type> + <desc> + <p>This operation returns the number of properties associated with the target + object.</p> + </desc> + </func> + <func> + <name>get_all_property_names(PropertySet, Max) -> Reply</name> + <fsummary>Get <c>Max</c>property names. If the target object have additional associated properties they will be put in the returned Iterator</fsummary> + <type> + <v>PropertySet = NamesIterator = #objref</v> + <v>Max = ulong()</v> + <v>Reply = {ok, Names, NamesIterator}</v> + <v>Names = [string()]</v> + </type> + <desc> + <p>This operation returns up to <c>Max</c> property names. If the target + object have additional associated properties they will be put in the + returned Iterator, otherwise the Iterator will be a <c>NIL</c> object.</p> + </desc> + </func> + <func> + <name>get_property_value(PropertySet, Name) -> Reply</name> + <fsummary>Return the property value associated with given name</fsummary> + <type> + <v>PropertySet = #objref</v> + <v>Name = string()</v> + <v>Reply = #any | {'EXCEPTION', #CosPropertyService_PropertyNotFound{}} | {'EXCEPTION', #CosPropertyService_InvalidPropertyName{}}</v> + </type> + <desc> + <p>This operation returns the property value associated with given name. If no such property + exists or the given name is an empty string an exception will be raised.</p> + </desc> + </func> + <func> + <name>get_properties(PropertySet, Names) -> Reply</name> + <fsummary>Return all properties associated with given names</fsummary> + <type> + <v>PropertySet = #objref</v> + <v>Names = [string()]</v> + <v>Reply = {boolean(), Properties}</v> + <v>Properties = [#'CosPropertyService_Property'{property_name = Name, property_value = Value}]</v> + </type> + <desc> + <p>This operation returns all properties associated with given names. If the + boolean flag is true all properties where retrieved correctly, otherwise, + all properties with the type <c>tk_void</c> was not found.</p> + </desc> + </func> + <func> + <name>get_all_properties(PropertySet, Max) -> Reply</name> + <fsummary>Return a list <c>Max</c>properties or less. If more properties are associated with the target object they will be put in the<c>PropertiesIterator</c>.</fsummary> + <type> + <v>PropertySet = PropertiesIterator = #objref</v> + <v>Reply = {ok, Properties, PropertiesIterator}</v> + <v>Properties = [#'CosPropertyService_Property'{property_name = Name, property_value = Value}]</v> + </type> + <desc> + <p>This operation return a list <c>Max</c> properties or less. If more + properties are associated with the target object they will be put in the + <c>PropertiesIterator</c>. If the object had less than <c>Max</c> + associated properties the Iterator will be a <c>NIL</c> object.</p> + </desc> + </func> + <func> + <name>delete_property(PropertySet, Name) -> Reply</name> + <fsummary>Delete the property with given Name</fsummary> + <type> + <v>PropertySet = #objref</v> + <v>Name = string()</v> + <v>Reply = ok | {'EXCEPTION', #CosPropertyService_FixedProperty{}} | {'EXCEPTION', #CosPropertyService_PropertyNotFound{}} | {'EXCEPTION', #CosPropertyService_InvalidPropertyName{}}</v> + </type> + <desc> + <p>This operation tries to delete the property with given Name. An exception + which indicates why it failed is raised if so needed.</p> + </desc> + </func> + <func> + <name>delete_properties(PropertySet, Names) -> Reply</name> + <fsummary>Delete all properties with given Names</fsummary> + <type> + <v>PropertySet = #objref</v> + <v>Names = [string()]</v> + <v>Reply = ok | {'EXCEPTION', #CosPropertyService_MultipleExceptions{exceptions = Excs}}</v> + <v>Excs = [#'CosPropertyService_PropertyException{reason = Reason, failing_property_name = Name}]</v> + <v>Reason = invalid_property_name | conflicting_property | property_not_found | unsupported_type_code | unsupported_property | unsupported_mode | fixed_property | read_only_property</v> + </type> + <desc> + <p>This operation tries to delete all given Properties. If one or more removal + fails an exception is raised which describe why.</p> + </desc> + </func> + <func> + <name>delete_all_properties(PropertySet) -> boolean()</name> + <fsummary>Delete all properties</fsummary> + <type> + <v>PropertySet = #objref</v> + </type> + <desc> + <p>This operation deletes all properties. The boolean flag, if set to false, + indicates that it was not possible to remove one or more properties, e.g., + may be read only.</p> + </desc> + </func> + <func> + <name>is_property_defined(PropertySet, Name) -> Reply</name> + <fsummary>Return true if the target have an associated property with given name</fsummary> + <type> + <v>PropertySet = #objref</v> + <v>Name = non-empty string()</v> + <v>Reply = boolean() | {'EXCEPTION', #CosPropertyService_InvalidPropertyName{}}</v> + </type> + <desc> + <p>This operation returns true if the target have an associated property with + given name.</p> + </desc> + </func> + </funcs> + +</erlref> + diff --git a/lib/cosProperty/doc/src/CosPropertyService_PropertySetDef.xml b/lib/cosProperty/doc/src/CosPropertyService_PropertySetDef.xml new file mode 100644 index 0000000000..7684998428 --- /dev/null +++ b/lib/cosProperty/doc/src/CosPropertyService_PropertySetDef.xml @@ -0,0 +1,168 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>2000</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>CosPropertyService_­PropertySetDef</title> + <shorttitle>..._PropertySetDef</shorttitle> + <prepared></prepared> + <docno></docno> + <checked></checked> + <date>2000-07-25</date> + <rev>1.0</rev> + </header> + <module>CosPropertyService_PropertySetDef</module> + <modulesummary>This module implements the OMG CosPropertyService::PropertySetDef interface.</modulesummary> + <description> + <p>To get access to the record definitions for the structures use: <br></br> +<c>-include_lib("cosProperty/include/CosPropertyService.hrl").</c></p> + <p>This module also exports the functions described in</p> + <p><seealso marker="CosPropertyService_PropertySet">CosPropertyService_PropertySet</seealso></p> + </description> + <funcs> + <func> + <name>get_allowed_property_types(PropertySetDef) -> Reply</name> + <fsummary>Return allowed TypeCodes for the target object</fsummary> + <type> + <v>PropertySetDef = #objref</v> + <v>Reply = {ok, PropertyTypes}</v> + <v>PropertyTypes = [CORBA::TypeCode]</v> + </type> + <desc> + <p>This operation return the TypeCodes which we are allowed to use when adding + new properties.</p> + </desc> + </func> + <func> + <name>get_allowed_properties(PropertySetDef) -> Reply</name> + <fsummary>Return a sequence of the allowed properties</fsummary> + <type> + <v>PropertySetDef = #objref</v> + <v>Reply = {ok, PropertyDefs}</v> + <v>PropertyDefs = [#'CosPropertyService_PropertyDef'{property_name = Name, property_value = Value, property_mode = Mode}]</v> + <v>Name = string()</v> + <v>Value = #any</v> + <v>Mode = normal | read_only | fixed_normal | fixed_readonly | undefined</v> + </type> + <desc> + <p>This operation a sequence of the allowed properties we may alter; depends on + which mode associated with a certain property.</p> + </desc> + </func> + <func> + <name>define_property_with_mode(PropertySetDef, Name, Value, Mode) -> Reply</name> + <fsummary>Associate a new property with the target object</fsummary> + <type> + <v>PropertySetDef = #objref</v> + <v>Name = non-empty string()</v> + <v>Value = #any</v> + <v>Mode = normal | read_only | fixed_normal | fixed_readonly | undefined</v> + <v>Reply = ok | {'EXCEPTION', #CosPropertyService_InvalidPropertyName{}} | {'EXCEPTION', #CosPropertyService_ConflictingProperty{}} | {'EXCEPTION', #CosPropertyService_UnsupportedTypeCode{}} | {'EXCEPTION', #CosPropertyService_UnsupportedProperty{}} | {'EXCEPTION', #CosPropertyService_UnsupportedMode{}} | {'EXCEPTION', #CosPropertyService_ReadOnlyProperty{}}</v> + </type> + <desc> + <p>This operation attempts to associate a new property with the target object. + If we fail to do so the appropriate exception is raised.</p> + </desc> + </func> + <func> + <name>define_properties_with_modes(PropertySetDef, PropertyDefs) -> Reply</name> + <fsummary>Associate the given Property Definitions with the target object</fsummary> + <type> + <v>PropertySetDef = #objref</v> + <v>PropertyDefs = [#'CosPropertyService_PropertyDef'{property_name = Name, property_value = Value, property_mode = Mode}]</v> + <v>Name = string()</v> + <v>Value = #any</v> + <v>Mode = normal | read_only | fixed_normal | fixed_readonly | undefined</v> + <v>Reply = ok | {'EXCEPTION', #CosPropertyService_MultipleExceptions{exceptions = Excs}}</v> + <v>Excs = [#'CosPropertyService_PropertyException{reason = Reason, failing_property_name = Name}]</v> + <v>Reason = invalid_property_name | conflicting_property | property_not_found | unsupported_type_code | unsupported_property | unsupported_mode | fixed_property | read_only_property</v> + </type> + <desc> + <p>This operation attempts to associate the given Property Definitions with the + target object. If one or more attempts fail an exception is raised + describing which properties we where not able to create.</p> + </desc> + </func> + <func> + <name>get_property_mode(PropertySetDef, Name) -> Reply</name> + <fsummary>Return the mode of the given property</fsummary> + <type> + <v>PropertySetDef = #objref</v> + <v>Name = string()</v> + <v>Reply = Mode | {'EXCEPTION', #CosPropertyService_InvalidPropertyName{}} | {'EXCEPTION', #CosPropertyService_PropertyNotFound{}}</v> + <v>Mode = normal | read_only | fixed_normal | fixed_readonly | undefined</v> + </type> + <desc> + <p>This operation returns the type of the given property.</p> + </desc> + </func> + <func> + <name>get_property_modes(PropertySetDef, Names) -> Reply</name> + <fsummary>Return the modes of the given properties</fsummary> + <type> + <v>PropertySetDef = #objref</v> + <v>Names = [string()]</v> + <v>Reply = {boolean(), PropertyModes}</v> + <v>PropertyModes = [#'CosPropertyService_PropertyMode'{property_name = Name, property_mode = Mode}]</v> + <v>Name = string()</v> + <v>Mode = normal | read_only | fixed_normal | fixed_readonly | undefined</v> + </type> + <desc> + <p>This operation returns the modes of the listed properties. If the boolean + flag is false, all properties with mode <c>undefined</c> this operation + failed to comply.</p> + </desc> + </func> + <func> + <name>set_property_mode(PropertySetDef, Name, Mode) -> Reply</name> + <fsummary>Change the given property's mode</fsummary> + <type> + <v>PropertySetDef = #objref</v> + <v>Name = string()</v> + <v>Mode = normal | read_only | fixed_normal | fixed_readonly | undefined</v> + <v>Reply = ok | {'EXCEPTION', #CosPropertyService_InvalidPropertyName{}} | {'EXCEPTION', #CosPropertyService_UnsupportedMode{}} | {'EXCEPTION', #CosPropertyService_PropertyNotFound{}}</v> + </type> + <desc> + <p>This operation changes the given property's mode. Return the appropriate + exception if not able to fulfill the request.</p> + </desc> + </func> + <func> + <name>set_property_modes(PropertySetDef, PropertyModes) -> Reply</name> + <fsummary>Change the listed properties mode's</fsummary> + <type> + <v>PropertySetDef = #objref</v> + <v>PropertyModes = [#'CosPropertyService_PropertyMode'{property_name = Name, property_mode = Mode}]</v> + <v>Name = string()</v> + <v>Mode = normal | read_only | fixed_normal | fixed_readonly | undefined</v> + <v>Reply = ok | {'EXCEPTION', #CosPropertyService_MultipleExceptions{exceptions = Excs}}</v> + <v>Excs = [#'CosPropertyService_PropertyException{reason = Reason, failing_property_name = Name}]</v> + <v>Reason = invalid_property_name | conflicting_property | property_not_found | unsupported_type_code | unsupported_property | unsupported_mode | fixed_property | read_only_property</v> + </type> + <desc> + <p>This operation attempts to update the listed properties mode's. Raises an + exception which describe which and why an operation failed.</p> + </desc> + </func> + </funcs> + +</erlref> + diff --git a/lib/cosProperty/doc/src/CosPropertyService_PropertySetDefFactory.xml b/lib/cosProperty/doc/src/CosPropertyService_PropertySetDefFactory.xml new file mode 100644 index 0000000000..82c04e5573 --- /dev/null +++ b/lib/cosProperty/doc/src/CosPropertyService_PropertySetDefFactory.xml @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>2000</year> + <year>2007</year> + <holder>Ericsson AB, All Rights Reserved</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + </legalnotice> + + <title>CosPropertyService_­PropertySetDefFactory</title> + <shorttitle>..._PropertySetDefFactory</shorttitle> + <prepared>Niclas Eklund</prepared> + <responsible>Niclas Eklund</responsible> + <docno></docno> + <approved>Niclas Eklund</approved> + <checked></checked> + <date>2000-07-25</date> + <rev>1.0</rev> + </header> + <module>CosPropertyService_PropertySetDefFactory</module> + <modulesummary>This module implements the OMG CosPropertyService::PropertySetDefFactory interface.</modulesummary> + <description> + <p>To get access to the record definitions for the structures use: <br></br> +<c>-include_lib("cosProperty/include/CosPropertyService.hrl").</c></p> + </description> + <funcs> + <func> + <name>create_propertysetdef(Factory) -> </name> + <fsummary>Create a new <c>PropertySetDef</c>with no predefined settings</fsummary> + <type> + <v>Factory = PropertySetDef = #objref</v> + </type> + <desc> + <p>This operation creates a new <c>PropertySetDef</c> with no predefined + settings.</p> + </desc> + </func> + <func> + <name>create_constrained_propertysetdef(Factory, PropertyTypes, PropertyDefs) -> Reply</name> + <fsummary>Create a new <c>PropertySetDef</c>with specified constraints</fsummary> + <type> + <v>Factory = PropertySetDef = #objref</v> + <v>PropertyTypes = [CORBA::TypeCode]</v> + <v>PropertyDefs = [#'CosPropertyService_PropertyDef'{property_name = Name, property_value = Value, property_mode = Mode}]</v> + <v>Name = string()</v> + <v>Value = #any</v> + <v>Mode = normal | read_only | fixed_normal | fixed_readonly | undefined</v> + <v>Reply = {'EXCEPTION', #CosPropertyService_ConstraintNotSupported{}} | PropertySetDef</v> + <v>PropertySetDef = #objref</v> + </type> + <desc> + <p>This operation creates a new <c>PropertySetDef</c> with specific + constraints. PropertyTypes states allowed TypeCode's and PropertyDefs valid + <c>CosPropertyService::PropertyDef</c> data.</p> + </desc> + </func> + <func> + <name>create_initial_propertysetdef(Factory, PropertyDefs) -> Reply</name> + <fsummary>Create a new <c>PropertySetDef</c>with specified initial properties</fsummary> + <type> + <v>Factory = PropertySetDef = #objref</v> + <v>PropertyDefs = [#'CosPropertyService_PropertyDef'{property_name = Name, property_value = Value, property_mode = Mode}]</v> + <v>Name = string()</v> + <v>Value = #any</v> + <v>Mode = normal | read_only | fixed_normal | fixed_readonly | undefined</v> + <v>Reply = {'EXCEPTION', #CosPropertyService_MultipleExceptions{exceptions = Excs}} | PropertySetDef</v> + <v>Excs = [#'CosPropertyService_PropertyException{reason = Reason, failing_property_name = Name}]</v> + <v>Reason = invalid_property_name | conflicting_property | property_not_found | unsupported_type_code | unsupported_property | unsupported_mode | fixed_property | read_only_property</v> + <v>PropertySetDef = #objref</v> + </type> + <desc> + <p>This operation creates a new <c>PropertySetDef</c> with specific + initial properties.</p> + </desc> + </func> + </funcs> + +</erlref> + diff --git a/lib/cosProperty/doc/src/CosPropertyService_PropertySetFactory.xml b/lib/cosProperty/doc/src/CosPropertyService_PropertySetFactory.xml new file mode 100644 index 0000000000..06b3d2b26d --- /dev/null +++ b/lib/cosProperty/doc/src/CosPropertyService_PropertySetFactory.xml @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>2000</year> + <year>2007</year> + <holder>Ericsson AB, All Rights Reserved</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + The Initial Developer of the Original Code is Ericsson AB. + </legalnotice> + + <title>CosPropertyService_­PropertySetFactory</title> + <shorttitle>..._PropertySetFactory</shorttitle> + <prepared>Niclas Eklund</prepared> + <responsible>Niclas Eklund</responsible> + <docno></docno> + <approved>Niclas Eklund</approved> + <checked></checked> + <date>2000-07-25</date> + <rev>1.0</rev> + </header> + <module>CosPropertyService_PropertySetFactory</module> + <modulesummary>This module implements the OMG CosPropertyService::PropertySetFactory interface.</modulesummary> + <description> + <p>To get access to the record definitions for the structures use: <br></br> +<c>-include_lib("cosProperty/include/CosPropertyService.hrl").</c></p> + </description> + <funcs> + <func> + <name>create_propertyset(Factory) -> PropertySet</name> + <fsummary>Create a new <c>PropertySe</c>t with no predefined properties</fsummary> + <type> + <v>Factory = PropertySet = #objref</v> + </type> + <desc> + <p>This operation creates a new <c>PropertySe</c>t with no predefined + properties.</p> + </desc> + </func> + <func> + <name>create_constrained_propertyset(Factory, PropertyTypes, Properties) -> Reply</name> + <fsummary>Create a new <c>PropertySet</c>with specified constraints</fsummary> + <type> + <v>Factory = #objref</v> + <v>PropertyTypes = [CORBA::TypeCode]</v> + <v>Properties = [#'CosPropertyService_Property'{property_name = Name, property_value = Value}]</v> + <v>Name = string()</v> + <v>Value = #any</v> + <v>Reply = {'EXCEPTION', #CosPropertyService_ConstraintNotSupported{}} | PropertySet</v> + <v>PropertySet = #objref</v> + </type> + <desc> + <p>This operation creates a new <c>PropertySet</c> with specific constraints. + PropertyTypes states allowed TypeCode's and Properties valid + <c>CosPropertyService::Property</c> data.</p> + </desc> + </func> + <func> + <name>create_initial_propertyset(Factory, Properties) -> Reply</name> + <fsummary>Create a new <c>PropertySet</c>with specified initial properties</fsummary> + <type> + <v>Factory = #objref</v> + <v>Properties = [#'CosPropertyService_Property'{property_name = Name, property_value = Value}]</v> + <v>Name = string()</v> + <v>Value = #any</v> + <v>Reply = {'EXCEPTION', #CosPropertyService_MultipleExceptions{exceptions = Excs}} | PropertySet</v> + <v>Excs = [#'CosPropertyService_PropertyException{reason = Reason, failing_property_name = Name}]</v> + <v>Reason = invalid_property_name | conflicting_property | property_not_found | unsupported_type_code | unsupported_property | unsupported_mode | fixed_property | read_only_property</v> + <v>PropertySet = #objref</v> + </type> + <desc> + <p>This operation creates a new <c>PropertySet</c> with specific + initial properties.</p> + </desc> + </func> + </funcs> + +</erlref> + diff --git a/lib/cosProperty/doc/src/Makefile b/lib/cosProperty/doc/src/Makefile new file mode 100644 index 0000000000..126e05ef53 --- /dev/null +++ b/lib/cosProperty/doc/src/Makefile @@ -0,0 +1,243 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2000-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include ../../vsn.mk +VSN=$(COSPROPERTY_VSN) +APPLICATION=cosProperty + +# ---------------------------------------------------- +# Include dependency +# ---------------------------------------------------- + +ifndef DOCSUPPORT +include make.dep +endif + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/lib/$(APPLICATION)-$(VSN) + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- +XML_APPLICATION_FILES = ref_man.xml +XML_REF3_FILES = \ + cosProperty.xml \ + CosPropertyService_PropertySetFactory.xml \ + CosPropertyService_PropertySetDefFactory.xml \ + CosPropertyService_PropertySet.xml \ + CosPropertyService_PropertySetDef.xml \ + CosPropertyService_PropertiesIterator.xml \ + CosPropertyService_PropertyNamesIterator.xml + +XML_REF6_FILES = + +XML_PART_FILES = \ + part.xml \ + part_notes.xml +XML_CHAPTER_FILES = \ + ch_contents.xml \ + ch_introduction.xml \ + ch_install.xml \ + ch_example.xml \ + notes.xml + +BOOK_FILES = book.xml + +TECHNICAL_DESCR_FILES = + +GIF_FILES = \ + book.gif \ + notes.gif \ + ref_man.gif \ + user_guide.gif + +PS_FILES = + +# ---------------------------------------------------- + +INTERNAL_HTML_FILES = $(TECHNICAL_DESCR_FILES:%.xml=$(HTMLDIR)/%.html) + +HTML_FILES = $(XML_APPLICATION_FILES:%.xml=$(HTMLDIR)/%.html) \ + $(XML_PART_FILES:%.xml=$(HTMLDIR)/%.html) + +INFO_FILE = ../../info + +EXTRA_FILES = summary.html.src \ + $(DEFAULT_GIF_FILES) \ + $(DEFAULT_HTML_FILES) \ + $(XML_REF3_FILES:%.xml=$(HTMLDIR)/%.html) \ + $(XML_REF6_FILES:%.xml=$(HTMLDIR)/%.html) \ + $(XML_CHAPTER_FILES:%.xml=$(HTMLDIR)/%.html) + +MAN3_FILES = $(XML_REF3_FILES:%.xml=$(MAN3DIR)/%.3) +MAN6_FILES = $(XML_REF6_FILES:%.xml=$(MAN6DIR)/%.6) + + +ifdef DOCSUPPORT + +HTML_REF_MAN_FILE = $(HTMLDIR)/index.html + +TOP_PDF_FILE = $(PDFDIR)/$(APPLICATION)-$(VSN).pdf + +else + +TEX_FILES_BOOK = \ + $(BOOK_FILES:%.xml=%.tex) +TEX_FILES_REF_MAN = $(XML_REF3_FILES:%.xml=%.tex) \ + $(XML_REF6_FILES:%.xml=%.tex) \ + $(XML_APPLICATION_FILES:%.xml=%.tex) +TEX_FILES_USERS_GUIDE = \ + $(XML_CHAPTER_FILES:%.xml=%.tex) + +TOP_PDF_FILE = $(APPLICATION)-$(VSN).pdf + +TOP_PS_FILE = $(APPLICATION)-$(VSN).ps + +$(TOP_PDF_FILE): book.dvi ../../vsn.mk + $(DVI2PS) $(DVIPS_FLAGS) -f $< | $(DISTILL) $(DISTILL_FLAGS) > $@ + +$(TOP_PS_FILE): book.dvi ../../vsn.mk + $(DVI2PS) $(DVIPS_FLAGS) -f $< > $@ + +endif + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +XML_FLAGS += +DVIPS_FLAGS += + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +$(HTMLDIR)/%.gif: %.gif + $(INSTALL_DATA) $< $@ + +ifdef DOCSUPPORT + +docs: pdf html man + +$(TOP_PDF_FILE): $(XML_FILES) + +pdf: $(TOP_PDF_FILE) + +html: gifs $(HTML_REF_MAN_FILE) + +clean clean_docs: + rm -rf $(HTMLDIR)/* + rm -f $(MAN3DIR)/* + rm -f $(TOP_PDF_FILE) $(TOP_PDF_FILE:%.pdf=%.fo) + rm -f errs core *~ + +else + +ifeq ($(DOCTYPE),pdf) +docs: pdf +else +ifeq ($(DOCTYPE),ps) +docs: ps +else +docs: html gifs man +endif +endif + +pdf: $(TOP_PDF_FILE) + +ps: $(TOP_PS_FILE) + +html: $(HTML_FILES) $(INTERNAL_HTML_FILES) + +tex_users_guide: $(TEX_FILES_USERS_GUIDE) +tex_ref_man: $(TEX_FILES_REF_MAN) +tex: tex_users_guide tex_ref_man $(TEX_FILES_BOOK) + +$(DOCDIR)/latexlog: $(BOOK_FILES:%.xml=%.dvi) + -fgrep -i "latex warning" $(BOOK_FILES:%.xml=%.log) >$(DOCDIR)/latexlog + +clean_tex: + -rm -f $(TEX_FILES_USERS_GUIDE) $(TEX_FILES_REF_MAN) $(TEX_FILES_BOOK) + +clean: + rm -f ../html/* $(MAN3_FILES) $(MAN6_FILES) $(TEX_FILES_USERS_GUIDE) + rm -f *xmls_output *xmls_errs + rm -f $(TOP_PDF_FILE) $(TOP_PS_FILE) + rm -f errs core *~ $(LATEX_CLEAN) + +endif + +man: $(MAN3_FILES) $(MAN6_FILES) + +gifs: $(GIF_FILES:%=$(HTMLDIR)/%) + +$(INDEX_TARGET): $(INDEX_SRC) + sed -e 's;%VSN%;$(VSN);' $(INDEX_SRC) > $(INDEX_TARGET) + +debug opt: + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +ifdef DOCSUPPORT + +release_docs_spec: docs + $(INSTALL_DIR) $(RELSYSDIR)/doc/pdf + $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELSYSDIR)/doc/pdf + $(INSTALL_DIR) $(RELSYSDIR)/doc/html + $(INSTALL_DATA) $(HTMLDIR)/* \ + $(RELSYSDIR)/doc/html + $(INSTALL_DATA) $(INFO_FILE) $(RELSYSDIR) + $(INSTALL_DIR) $(RELEASE_PATH)/man/man3 + $(INSTALL_DATA) $(MAN3DIR)/* $(RELEASE_PATH)/man/man3 +else + +ifeq ($(DOCTYPE),pdf) +release_docs_spec: pdf + $(INSTALL_DIR) $(RELEASE_PATH)/pdf + $(INSTALL_DATA) $(TOP_PDF_FILE) $(RELEASE_PATH)/pdf +else +ifeq ($(DOCTYPE),ps) +release_docs_spec: ps + $(INSTALL_DIR) $(RELEASE_PATH)/ps + $(INSTALL_DATA) $(TOP_PS_FILE) $(RELEASE_PATH)/ps +else +release_docs_spec: docs + $(INSTALL_DIR) $(RELSYSDIR)/doc/html + $(INSTALL_DATA) $(GIF_FILES) $(EXTRA_FILES) $(HTML_FILES) \ + $(RELSYSDIR)/doc/html + $(INSTALL_DATA) $(INFO_FILE) $(RELSYSDIR) + $(INSTALL_DIR) $(RELEASE_PATH)/man/man3 + $(INSTALL_DATA) $(MAN3_FILES) $(RELEASE_PATH)/man/man3 + +endif +endif + +endif + +release_spec: + diff --git a/lib/cosProperty/doc/src/book.gif b/lib/cosProperty/doc/src/book.gif Binary files differnew file mode 100644 index 0000000000..94b3868792 --- /dev/null +++ b/lib/cosProperty/doc/src/book.gif diff --git a/lib/cosProperty/doc/src/book.xml b/lib/cosProperty/doc/src/book.xml new file mode 100644 index 0000000000..f3ba9a5bcd --- /dev/null +++ b/lib/cosProperty/doc/src/book.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE book SYSTEM "book.dtd"> + +<book xmlns:xi="http://www.w3.org/2001/XInclude"> + <header titlestyle="normal"> + <copyright> + <year>2000</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>cosProperty</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <date>2000-06-07</date> + <rev>1.0</rev> + </header> + <insidecover> + </insidecover> + <pagetext>cosProperty</pagetext> + <preamble> + <contents level="2"></contents> + </preamble> + <parts lift="no"> + <xi:include href="part.xml"/> + </parts> + <applications> + <xi:include href="ref_man.xml"/> + </applications> + <releasenotes> + <xi:include href="notes.xml"/> + </releasenotes> + <listofterms></listofterms> + <index></index> +</book> + diff --git a/lib/cosProperty/doc/src/ch_contents.xml b/lib/cosProperty/doc/src/ch_contents.xml new file mode 100644 index 0000000000..9b8a39cfb3 --- /dev/null +++ b/lib/cosProperty/doc/src/ch_contents.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>2000</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>The cosProperty Application</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <date>2000-06-07</date> + <rev>1.0</rev> + <file>ch_contents.xml</file> + </header> + + <section> + <title>Content Overview</title> + <p>The cosProperty documentation is divided into three sections: + </p> + <list type="bulleted"> + <item> + <p>PART ONE - The User's Guide + <br></br> +Description of the cosProperty Application including + services and a small tutorial demonstrating + the development of a simple service.</p> + </item> + <item> + <p>PART TWO - Release Notes + <br></br> +A concise history of cosProperty.</p> + </item> + <item> + <p>PART THREE - The Reference Manual + <br></br> + A quick reference guide, including a + brief description, to all the functions available in cosProperty.</p> + </item> + </list> + </section> + + <section> + <title>Brief description of the User's Guide</title> + <p>The User's Guide contains the following parts:</p> + <list type="bulleted"> + <item> + <p>cosProperty overview</p> + </item> + <item> + <p>cosProperty installation</p> + </item> + <item> + <p>A tutorial example</p> + </item> + </list> + </section> +</chapter> + diff --git a/lib/cosProperty/doc/src/ch_example.xml b/lib/cosProperty/doc/src/ch_example.xml new file mode 100644 index 0000000000..3b5c6160fb --- /dev/null +++ b/lib/cosProperty/doc/src/ch_example.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>2000</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>cosProperty Examples</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <date>2000-06-07</date> + <rev>A</rev> + <file>ch_example.xml</file> + </header> + + <section> + <title>A tutorial on how to create a simple service</title> + + <section> + <title>Initiate the application</title> + <p>To use the cosProperty application Orber must be running.</p> + </section> + + <section> + <title>How to run everything</title> + <p>Below is a short transcript on how to run cosProperty. </p> + <code type="none"> + +%% Start Mnesia and Orber +mnesia:delete_schema([node()]), +mnesia:create_schema([node()]), +orber:install([node()]), +mnesia:start(), +orber:start(), + +%% Install Property Service in the IFR. +cosProperty:install(), + +%% Install Property Service in mnesia. +cosProperty:install_db(), + +%% Now start the application. +cosProperty:start(), + +%% To be able to create Property objects we must first a Factory +%% of our preferred type. +Fac = cosProperty:start_SetDefFactory(), + +%% Now we can create a Property object. +'CosPropertyService_PropertySetDefFactory': + create_propertysetdef(Fac), + +%% Now we can create any allowed properties. There are many +%% options which are all described further in the documentation. + </code> + </section> + </section> +</chapter> + diff --git a/lib/cosProperty/doc/src/ch_install.xml b/lib/cosProperty/doc/src/ch_install.xml new file mode 100644 index 0000000000..33324a0ce6 --- /dev/null +++ b/lib/cosProperty/doc/src/ch_install.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>2000</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>Installing cosProperty</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <date>2000-06-07</date> + <rev></rev> + <file>ch-install.xml</file> + </header> + + <section> + <title>Installation Process</title> + <p>This chapter describes how to install + <seealso marker="cosProperty">cosProperty</seealso> in an Erlang Environment. + </p> + + <section> + <title>Preparation</title> + <p>Before starting the installation process for cosProperty, + the application Orber must be running.</p> + </section> + + <section> + <title>Configuration</title> + <p>First the cosProperty application must be installed by using + <c>cosProperty:install()</c> and, if requested, <c>cosProperty:install_db()</c>, + followed by <c>cosProperty:start()</c>. + Now we can start the desired Factory type by using either + <c>cosProperty:start_SetFactory()</c> or + <c>cosProperty:start_SetDefFactory()</c>.</p> + </section> + </section> +</chapter> + diff --git a/lib/cosProperty/doc/src/ch_introduction.xml b/lib/cosProperty/doc/src/ch_introduction.xml new file mode 100644 index 0000000000..1f8731113a --- /dev/null +++ b/lib/cosProperty/doc/src/ch_introduction.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>2000</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>Introduction to cosProperty</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <date>2000-06-07</date> + <rev></rev> + <file>ch_introduction.xml</file> + </header> + + <section> + <title>Overview</title> + <p>The cosProperty application is compliant with the <url href="http://www.omg.org">OMG</url> + Service CosProperty Service. + </p> + + <section> + <title>Purpose and Dependencies</title> + <p><em>cosProperty</em> is dependent on <em>Orber</em>, which provides CORBA functionality in an Erlang environment.</p> + </section> + + <section> + <title>Prerequisites</title> + <p>To fully understand the concepts presented in the + documentation, it is recommended that the user is familiar + with distributed programming, CORBA and the Orber application. + </p> + <p>Recommended reading includes <em>CORBA, Fundamentals and Programming - Jon Siegel</em> and <em>Open Telecom Platform Documentation Set</em>. It is also helpful to have read <em>Concurrent Programming in Erlang</em>.</p> + </section> + </section> +</chapter> + diff --git a/lib/cosProperty/doc/src/cosProperty.xml b/lib/cosProperty/doc/src/cosProperty.xml new file mode 100644 index 0000000000..4dbbbad794 --- /dev/null +++ b/lib/cosProperty/doc/src/cosProperty.xml @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE erlref SYSTEM "erlref.dtd"> + +<erlref> + <header> + <copyright> + <year>2000</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>cosProperty</title> + <prepared></prepared> + <docno></docno> + <checked></checked> + <date>2000-06-07</date> + <rev>PA1</rev> + </header> + <module>cosProperty</module> + <modulesummary>The main module of the cosProperty application</modulesummary> + <description> + <p>To get access to the record definitions for the structures use: <br></br> +<c>-include_lib("cosProperty/include/*.hrl").</c></p> + <p>This module contains the functions for starting and stopping the application.</p> + </description> + <funcs> + <func> + <name>install() -> Return</name> + <fsummary>Install the cosProperty application in the IFR</fsummary> + <type> + <v>Return = ok | {'EXIT', Reason}</v> + </type> + <desc> + <p>This operation installs the cosProperty application in the IFR.</p> + </desc> + </func> + <func> + <name>install_db() -> Return</name> + <fsummary>Install data in mnesia necessary for running the cosProperty application</fsummary> + <type> + <v>Return = ok | {'EXIT', Reason}</v> + </type> + <desc> + <p>This operation installs data in mnesia necessary for running the + cosProperty application.</p> + </desc> + </func> + <func> + <name>uninstall() -> Return</name> + <fsummary>Remove all data in the IFR related to the cosProperty application</fsummary> + <type> + <v>Return = ok | {'EXIT', Reason}</v> + </type> + <desc> + <p>This operation removes all data in the IFR related to the cosProperty + application.</p> + </desc> + </func> + <func> + <name>uninstall_db() -> Return</name> + <fsummary>Remove all data from mnesia related to the cosProperty application</fsummary> + <type> + <v>Return = ok | {'EXIT', Reason}</v> + </type> + <desc> + <p>This operation removes all data from mnesia related to the cosProperty + application.</p> + </desc> + </func> + <func> + <name>start() -> Return</name> + <fsummary>Start the cosProperty application</fsummary> + <type> + <v>Return = ok | {error, Reason}</v> + </type> + <desc> + <p>This operation starts the cosProperty application.</p> + </desc> + </func> + <func> + <name>start_SetDefFactory() -> Return</name> + <fsummary>Start a PropertySetDef Factory</fsummary> + <type> + <v>Return = Factory | {'EXCEPTION', E}</v> + <v>Factory = CosPropertyService::PropertySetDefFactory reference.</v> + </type> + <desc> + <p>This operation starts a PropertySetDef Factory.</p> + </desc> + </func> + <func> + <name>start_SetFactory() -> Return</name> + <fsummary>Start a PropertySet Factory</fsummary> + <type> + <v>Return = Factory | {'EXCEPTION', E}</v> + <v>Factory = CosPropertyService::PropertySetDefFactory reference.</v> + </type> + <desc> + <p>This operation starts a PropertySet Factory.</p> + </desc> + </func> + <func> + <name>stop_SetDefFactory(Factory) -> Return</name> + <fsummary>Stop the given PropertySetDef Factory</fsummary> + <type> + <v>Factory = CosPropertyService::PropertySetDefFactory reference.</v> + <v>Return = ok | {'EXCEPTION', E}</v> + </type> + <desc> + <p>This operation stops the supplied PropertySetDef Factory.</p> + </desc> + </func> + <func> + <name>stop_SetFactory(Factory) -> Return</name> + <fsummary>Stop the given PropertySet Factory</fsummary> + <type> + <v>Factory = CosPropertyService::PropertySetFactory reference.</v> + <v>Return = ok | {'EXCEPTION', E}</v> + </type> + <desc> + <p>This operation stops the supplied PropertySet Factory.</p> + </desc> + </func> + <func> + <name>stop() -> Return</name> + <fsummary>Stop the cosProperty application</fsummary> + <type> + <v>Return = ok | {error, Reason}</v> + </type> + <desc> + <p>This operation stops the cosProperty application.</p> + </desc> + </func> + </funcs> + +</erlref> + diff --git a/lib/cosProperty/doc/src/fascicules.xml b/lib/cosProperty/doc/src/fascicules.xml new file mode 100644 index 0000000000..0678195e07 --- /dev/null +++ b/lib/cosProperty/doc/src/fascicules.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE fascicules SYSTEM "fascicules.dtd"> + +<fascicules> + <fascicule file="part" href="part_frame.html" entry="no"> + User's Guide + </fascicule> + <fascicule file="ref_man" href="ref_man_frame.html" entry="yes"> + Reference Manual + </fascicule> + <fascicule file="part_notes" href="part_notes_frame.html" entry="no"> + Release Notes + </fascicule> + <fascicule file="" href="../../../../doc/print.html" entry="no"> + Off-Print + </fascicule> +</fascicules> + diff --git a/lib/cosProperty/doc/src/make.dep b/lib/cosProperty/doc/src/make.dep new file mode 100644 index 0000000000..383af54244 --- /dev/null +++ b/lib/cosProperty/doc/src/make.dep @@ -0,0 +1,26 @@ +# ---------------------------------------------------- +# >>>> Do not edit this file <<<< +# This file was automaticly generated by +# /home/otp/bin/docdepend +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# TeX files that the DVI file depend on +# ---------------------------------------------------- + +book.dvi: CosPropertyService_PropertiesIterator.tex \ + CosPropertyService_PropertyNamesIterator.tex \ + CosPropertyService_PropertySet.tex CosPropertyService_PropertySetDef.tex \ + CosPropertyService_PropertySetDefFactory.tex \ + CosPropertyService_PropertySetFactory.tex \ + book.tex ch_contents.tex ch_example.tex ch_install.tex \ + ch_introduction.tex cosProperty.tex part.tex \ + ref_man.tex + +# ---------------------------------------------------- +# Source inlined when transforming from source to LaTeX +# ---------------------------------------------------- + +book.tex: ref_man.xml + diff --git a/lib/cosProperty/doc/src/notes.gif b/lib/cosProperty/doc/src/notes.gif Binary files differnew file mode 100644 index 0000000000..e000cca26a --- /dev/null +++ b/lib/cosProperty/doc/src/notes.gif diff --git a/lib/cosProperty/doc/src/notes.xml b/lib/cosProperty/doc/src/notes.xml new file mode 100644 index 0000000000..be3a8d0f5e --- /dev/null +++ b/lib/cosProperty/doc/src/notes.xml @@ -0,0 +1,206 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE chapter SYSTEM "chapter.dtd"> + +<chapter> + <header> + <copyright> + <year>2000</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>cosProperty Release Notes</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <approved></approved> + <checked></checked> + <date>2000-06-07</date> + <rev>A</rev> + <file>notes.xml</file> + </header> + + <section> + <title>cosProperty 1.1.10</title> + + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p> + The documentation is now built with open source tools (xsltproc and fop) + that exists on most platforms. One visible change is that the frames are removed.</p> + <p> + Own Id: OTP-8201 Aux Id:</p> + </item> + </list> + </section> + </section> + + <section> + <title>cosProperty 1.1.9</title> + + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>Obsolete guards, e.g. record vs is_record, has been changed + to avoid compiler warnings.</p> + <p>Own id: OTP-7987</p> + </item> + </list> + </section> + </section> + + <section> + <title>cosProperty 1.1.8</title> + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>Updated file headers.</p> + <p>Own id: OTP-7837</p> + </item> + </list> + </section> + </section> + + <section> + <title>cosProperty 1.1.7</title> + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>Documentation source included in open source releases.</p> + <p>Own id: OTP-7595</p> + </item> + </list> + </section> + </section> + + <section> + <title>cosProperty 1.1.6</title> + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>Updated file headers.</p> + <p>Own id: OTP-7011</p> + </item> + </list> + </section> + </section> + + <section> + <title>cosProperty 1.1.5</title> + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>The documentation source has been converted from SGML to XML.</p> + <p>Own Id: OTP-6754 Aux Id: </p> + </item> + </list> + </section> + </section> + + <section> + <title>cosProperty 1.1.4</title> + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>Minor Makefile changes.</p> + <p>Own Id: OTP-6701 Aux Id: </p> + </item> + </list> + </section> + </section> + + <section> + <title>cosProperty 1.1.3</title> + + <section> + <title>Fixed Bugs and Malfunctions</title> + <list type="bulleted"> + <item> + <p>The appup source file was missing a trailing newline.</p> + <p>Own id: OTP-6626</p> + </item> + </list> + </section> + </section> + + <section> + <title>cosProperty 1.1.2</title> + + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>Removed some unused code.</p> + <p>Own Id: OTP-6527 Aux Id: </p> + </item> + </list> + </section> + </section> + + <section> + <title>cosProperty 1.1.1</title> + + <section> + <title>Fixed Bugs and Malfunctions</title> + <list type="bulleted"> + <item> + <p>The app-file contained duplicated modules.</p> + <p>Own id: OTP-4976</p> + </item> + </list> + </section> + </section> + + <section> + <title>cosProperty 1.1</title> + + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>The stub/skeleton-files generated by IC have been improved, + i.e., depending on the IDL-files, reduced the size of the + erl- and beam-files and decreased dependencies off Orber's + Interface Repository. It is necessary to re-compile all IDL-files + and use COS-applications, including Orber, compiled with + IC-4.2.</p> + <p>Own id: OTP-4576</p> + </item> + </list> + </section> + </section> + + <section> + <title>cosProperty 1.0.1</title> + + <section> + <title>Improvements and New Features</title> + <list type="bulleted"> + <item> + <p>First release of the cosProperty application.</p> + <p>Own Id: -</p> + </item> + </list> + </section> + </section> +</chapter> + diff --git a/lib/cosProperty/doc/src/part.xml b/lib/cosProperty/doc/src/part.xml new file mode 100644 index 0000000000..210dad6920 --- /dev/null +++ b/lib/cosProperty/doc/src/part.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE part SYSTEM "part.dtd"> + +<part xmlns:xi="http://www.w3.org/2001/XInclude"> + <header> + <copyright> + <year>2000</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>cosProperty User's Guide</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <date>2000-06-07</date> + <rev>1.0</rev> + </header> + <description> + <p>The cosProperty Application is an Erlang implementation of the OMG + CORBA Property Service.</p> + </description> + <xi:include href="ch_contents.xml"/> + <xi:include href="ch_introduction.xml"/> + <xi:include href="ch_install.xml"/> + <xi:include href="ch_example.xml"/> +</part> + diff --git a/lib/cosProperty/doc/src/part_notes.xml b/lib/cosProperty/doc/src/part_notes.xml new file mode 100644 index 0000000000..4e02ff4e55 --- /dev/null +++ b/lib/cosProperty/doc/src/part_notes.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE part SYSTEM "part.dtd"> + +<part xmlns:xi="http://www.w3.org/2001/XInclude"> + <header> + <copyright> + <year>2000</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>cosProperty Release Notes</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <date>2000-06-07</date> + <rev>1.0</rev> + </header> + <description> + <p>The cosProperty Application is an Erlang implementation of the OMG + CORBA Property Service.</p> + </description> + <xi:include href="notes.xml"/> +</part> + diff --git a/lib/cosProperty/doc/src/ref_man.gif b/lib/cosProperty/doc/src/ref_man.gif Binary files differnew file mode 100644 index 0000000000..b13c4efd53 --- /dev/null +++ b/lib/cosProperty/doc/src/ref_man.gif diff --git a/lib/cosProperty/doc/src/ref_man.xml b/lib/cosProperty/doc/src/ref_man.xml new file mode 100644 index 0000000000..f69904e42f --- /dev/null +++ b/lib/cosProperty/doc/src/ref_man.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="latin1" ?> +<!DOCTYPE application SYSTEM "application.dtd"> + +<application xmlns:xi="http://www.w3.org/2001/XInclude"> + <header> + <copyright> + <year>2000</year><year>2009</year> + <holder>Ericsson AB. All Rights Reserved.</holder> + </copyright> + <legalnotice> + The contents of this file are subject to the Erlang Public License, + Version 1.1, (the "License"); you may not use this file except in + compliance with the License. You should have received a copy of the + Erlang Public License along with this software. If not, it can be + retrieved online at http://www.erlang.org/. + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + the License for the specific language governing rights and limitations + under the License. + + </legalnotice> + + <title>cosProperty Reference Manual</title> + <prepared>Niclas Eklund</prepared> + <docno></docno> + <date>2000-06-07</date> + <rev>1.0</rev> + </header> + <description> + <p>The cosProperty Application is an Erlang implementation of the OMG + CORBA Property Service.</p> + </description> + <xi:include href="cosProperty.xml"/> + <xi:include href="CosPropertyService_PropertySetFactory.xml"/> + <xi:include href="CosPropertyService_PropertySetDefFactory.xml"/> + <xi:include href="CosPropertyService_PropertySet.xml"/> + <xi:include href="CosPropertyService_PropertySetDef.xml"/> + <xi:include href="CosPropertyService_PropertiesIterator.xml"/> + <xi:include href="CosPropertyService_PropertyNamesIterator.xml"/> +</application> + diff --git a/lib/cosProperty/doc/src/summary.html.src b/lib/cosProperty/doc/src/summary.html.src new file mode 100644 index 0000000000..87370c659c --- /dev/null +++ b/lib/cosProperty/doc/src/summary.html.src @@ -0,0 +1 @@ +Orber OMG Property Service.
\ No newline at end of file diff --git a/lib/cosProperty/doc/src/user_guide.gif b/lib/cosProperty/doc/src/user_guide.gif Binary files differnew file mode 100644 index 0000000000..e6275a803d --- /dev/null +++ b/lib/cosProperty/doc/src/user_guide.gif diff --git a/lib/cosProperty/ebin/.gitignore b/lib/cosProperty/ebin/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/cosProperty/ebin/.gitignore diff --git a/lib/cosProperty/examples/.gitignore b/lib/cosProperty/examples/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/cosProperty/examples/.gitignore diff --git a/lib/cosProperty/include/.gitignore b/lib/cosProperty/include/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/cosProperty/include/.gitignore diff --git a/lib/cosProperty/info b/lib/cosProperty/info new file mode 100644 index 0000000000..67c56e92ed --- /dev/null +++ b/lib/cosProperty/info @@ -0,0 +1,2 @@ +group: orb +short: Orber OMG Property Service diff --git a/lib/cosProperty/priv/.gitignore b/lib/cosProperty/priv/.gitignore new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/lib/cosProperty/priv/.gitignore diff --git a/lib/cosProperty/src/CosProperty.cfg b/lib/cosProperty/src/CosProperty.cfg new file mode 100644 index 0000000000..f10bf843d6 --- /dev/null +++ b/lib/cosProperty/src/CosProperty.cfg @@ -0,0 +1,5 @@ +{this, "CosPropertyService::PropertySet"}. +{this, "CosPropertyService::PropertySetDef"}. +{this, "CosPropertyService::PropertySetDefFactory"}. +{this, "CosPropertyService::PropertySetFactory"}. + diff --git a/lib/cosProperty/src/CosProperty.idl b/lib/cosProperty/src/CosProperty.idl new file mode 100644 index 0000000000..156fb37ccc --- /dev/null +++ b/lib/cosProperty/src/CosProperty.idl @@ -0,0 +1,192 @@ +#ifndef _COSPROPERTY_IDL +#define _COSPROPERTY_IDL + +#pragma prefix "omg.org" + +module CosPropertyService { + /*****************************************************/ + /* Data Types */ + /*****************************************************/ + typedef string PropertyName; + + struct Property { + PropertyName property_name; + any property_value; + }; + + enum PropertyModeType { + normal, read_only, fixed_normal, fixed_readonly, undefined }; + + struct PropertyDef { + PropertyName property_name; + any property_value; + PropertyModeType property_mode; + }; + + struct PropertyMode { + PropertyName property_name; + PropertyModeType property_mode; + }; + + typedef sequence<PropertyName> PropertyNames; + typedef sequence<Property> Properties; + typedef sequence<PropertyDef> PropertyDefs; + typedef sequence<PropertyMode> PropertyModes; + typedef sequence<CORBA::TypeCode> PropertyTypes; + + interface PropertyNamesIterator; + interface PropertiesIterator; + interface PropertySetFactory; + interface PropertySetDef; + interface PropertySet; + + /*****************************************************/ + /* Exceptions */ + /*****************************************************/ + exception ConstraintNotSupported{}; + exception InvalidPropertyName {}; + exception ConflictingProperty {}; + exception PropertyNotFound {}; + exception UnsupportedTypeCode {}; + exception UnsupportedProperty {}; + exception UnsupportedMode {}; + exception FixedProperty {}; + exception ReadOnlyProperty {}; + + enum ExceptionReason { invalid_property_name, conflicting_property, + property_not_found, unsupported_type_code, + unsupported_property, unsupported_mode, + fixed_property, read_only_property }; + + struct PropertyException { + ExceptionReason reason; + PropertyName failing_property_name; + }; + + typedef sequence<PropertyException> PropertyExceptions; + exception MultipleExceptions { PropertyExceptions exceptions; }; + + /*****************************************************/ + /* Interface Definitions */ + /*****************************************************/ + interface PropertySetFactory { + PropertySet create_propertyset(); + + PropertySet create_constrained_propertyset( in PropertyTypes allowed_property_types, + in Properties allowed_properties) + raises(ConstraintNotSupported); + + PropertySet create_initial_propertyset( in Properties initial_properties) + raises(MultipleExceptions); }; + + /*---------------------------------------------------*/ + interface PropertySetDefFactory { + PropertySetDef create_propertysetdef(); + + PropertySetDef create_constrained_propertysetdef( in PropertyTypes allowed_property_types, + in PropertyDefs allowed_property_defs) + raises(ConstraintNotSupported); + + PropertySetDef create_initial_propertysetdef( in PropertyDefs initial_property_defs) + raises(MultipleExceptions); + }; + + /*---------------------------------------------------*/ + interface PropertySet { + /* Support for defining and modifying properties */ + void define_property( in PropertyName property_name, in any property_value) + raises(InvalidPropertyName, ConflictingProperty, UnsupportedTypeCode, + UnsupportedProperty, ReadOnlyProperty); + + void define_properties( in Properties nproperties) + raises(MultipleExceptions); + + /* Support for Getting Properties and their Names */ + unsigned long get_number_of_properties(); + + void get_all_property_names( in unsigned long how_many, + out PropertyNames property_names, + out PropertyNamesIterator rest); + + any get_property_value( in PropertyName property_name) + raises(PropertyNotFound, InvalidPropertyName); + + boolean get_properties( in PropertyNames property_names, + out Properties nproperties); + + void get_all_properties( in unsigned long how_many, + out Properties nproperties, + out PropertiesIterator rest); + + /* Support for Deleting Properties */ + void delete_property( in PropertyName property_name) + raises(PropertyNotFound, InvalidPropertyName, FixedProperty); + + void delete_properties( in PropertyNames property_names) + raises(MultipleExceptions); + + boolean delete_all_properties(); + + /* Support for Existence Check */ + boolean is_property_defined( in PropertyName property_name) + raises(InvalidPropertyName); + }; + + /*---------------------------------------------------*/ + interface PropertySetDef:PropertySet { + /* Support for retrieval of PropertySet constraints*/ + void get_allowed_property_types( out PropertyTypes property_types); + + void get_allowed_properties( out PropertyDefs property_defs); + + /* Support for defining and modifying properties */ + void define_property_with_mode( in PropertyName property_name, + in any property_value, + in PropertyModeType property_mode) + raises(InvalidPropertyName, ConflictingProperty, UnsupportedTypeCode, + UnsupportedProperty, UnsupportedMode, ReadOnlyProperty); + + void define_properties_with_modes( in PropertyDefs property_defs) + raises(MultipleExceptions); + + /* Support for Getting and Setting Property Modes */ + PropertyModeType get_property_mode( in PropertyName property_name) + raises(PropertyNotFound, InvalidPropertyName); + + boolean get_property_modes( in PropertyNames property_names, + out PropertyModes property_modes); + + void set_property_mode( in PropertyName property_name, + in PropertyModeType property_mode) + raises(InvalidPropertyName, PropertyNotFound, UnsupportedMode); + + void set_property_modes( in PropertyModes property_modes) + raises(MultipleExceptions); + }; + + /*---------------------------------------------------*/ + interface PropertyNamesIterator{ + void reset(); + + boolean next_one( out PropertyName property_name); + + boolean next_n ( in unsigned long how_many, + out PropertyNames property_names); + + void destroy(); + }; + + /*---------------------------------------------------*/ + interface PropertiesIterator { + void reset(); + + boolean next_one( out Property aproperty); + + boolean next_n( in unsigned long how_many, + out Properties nproperties); + + void destroy(); + }; +}; + +#endif diff --git a/lib/cosProperty/src/CosPropertyService_PropertiesIterator_impl.erl b/lib/cosProperty/src/CosPropertyService_PropertiesIterator_impl.erl new file mode 100644 index 0000000000..a7769cea4d --- /dev/null +++ b/lib/cosProperty/src/CosPropertyService_PropertiesIterator_impl.erl @@ -0,0 +1,166 @@ +%%-------------------------------------------------------------------- +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +%% +%%---------------------------------------------------------------------- +%% File : CosPropertyService_PropertiesIterator_impl.erl +%% Description : +%% +%%---------------------------------------------------------------------- +-module('CosPropertyService_PropertiesIterator_impl'). + +%%---------------------------------------------------------------------- +%% Include files +%%---------------------------------------------------------------------- +-include_lib("orber/include/corba.hrl"). +-include_lib("orber/src/orber_iiop.hrl"). +-include("CosPropertyService.hrl"). +-include("cosProperty.hrl"). + + +%%---------------------------------------------------------------------- +%% External exports +%%---------------------------------------------------------------------- +%% Mandatory server functions +-export([init/1, + terminate/2, + code_change/3]). + +-export([reset/1, + next_one/1, + next_n/2, + destroy/1]). + +%%---------------------------------------------------------------------- +%% Internal exports +%%---------------------------------------------------------------------- +-export([ + ]). + +%%---------------------------------------------------------------------- +%% Records +%%---------------------------------------------------------------------- +-record(state, {properties, counter=1, length}). + +%%---------------------------------------------------------------------- +%% Macros +%%---------------------------------------------------------------------- +-define(CreateInitState(L), #state{properties = L, length = length(L)}). +-define(get_Properties(S), S#state.properties). +-define(get_Counter(S), S#state.counter). +-define(get_Length(S), S#state.length). + +-define(set_Properties(S, P), S#state{properties = P}). +-define(set_Counter(S, C), S#state{counter = C}). +-define(set_Length(S, L), S#state{length = L}). + +-define(increment_Counter(S), S#state{counter = S#state.counter+1}). +-define(decrement_Counter(S), S#state{counter = S#state.counter-1}). +-define(addto_Counter(S, N), S#state{counter = S#state.counter+N}). +-define(subfrom_Counter(S, N), S#state{counter = S#state.counter-N}). + + +%%====================================================================== +%% External functions +%%====================================================================== +%%---------------------------------------------------------------------- +%% Function : init/1 +%% Description: Initiates the server +%% Returns : {ok, State} | +%% {ok, State, Timeout} | +%% ignore | +%% {stop, Reason} +%%---------------------------------------------------------------------- +init(Properties) -> + {ok, ?CreateInitState(Properties)}. + +%%---------------------------------------------------------------------- +%% Function : terminate/2 +%% Description: Shutdown the server +%% Returns : any (ignored by gen_server) +%%---------------------------------------------------------------------- +terminate(_Reason, _State) -> + ok. + +%%---------------------------------------------------------------------- +%% Function : code_change/3 +%% Description: Convert process state when code is changed +%% Returns : {ok, NewState} +%%---------------------------------------------------------------------- +code_change(_OldVsn, State, _Extra) -> + {ok, State}. + +%%---------------------------------------------------------------------% +%% Function : reset +%% Arguments : - +%% Description: +%% Returns : {ok, NewState} +%%---------------------------------------------------------------------- +reset(State) -> + {reply, ok, ?set_Counter(State, 1)}. + +%%---------------------------------------------------------------------- +%% Function : next_one +%% Arguments : - +%% Description: +%% Returns : {ok, {bool(), PropertyList}, NewState} +%%---------------------------------------------------------------------- +next_one(State) when ?get_Counter(State) > ?get_Length(State) -> + {reply, {false, + #'CosPropertyService_Property' + {property_name = "", + property_value = any:create(orber_tc:null(), null)}}, + State}; +next_one(State) -> + {reply, {true, lists:nth(?get_Counter(State), ?get_Properties(State))}, + ?set_Counter(State, 1+?get_Counter(State))}. + +%%---------------------------------------------------------------------- +%% Function : next_n +%% Arguments : N - how many properties we should return. +%% Description: +%% Returns : {ok, {bool(), PropertyList}, NewState} +%%---------------------------------------------------------------------- +next_n(State, N) -> + case lists:sublist(?get_Properties(State), + ?get_Counter(State), + N) of + Properties when N+?get_Counter(State) < ?get_Length(State) -> + {reply, {true, Properties}, ?set_Counter(State, N+?get_Counter(State))}; + Properties -> + {reply, {false, Properties}, ?set_Counter(State, ?get_Length(State))} + end. + +%%---------------------------------------------------------------------% +%% Function : destroy +%% Arguments : - +%% Description: Terminate the object +%% Returns : {ok, NewState} +%%---------------------------------------------------------------------- +destroy(State) -> + {stop, normal, ok, State}. + +%%====================================================================== +%% Internal functions +%%===================================================================== + +%%====================================================================== +%% END OF MODULE +%%====================================================================== + diff --git a/lib/cosProperty/src/CosPropertyService_PropertyNamesIterator_impl.erl b/lib/cosProperty/src/CosPropertyService_PropertyNamesIterator_impl.erl new file mode 100644 index 0000000000..fc5cddd7c3 --- /dev/null +++ b/lib/cosProperty/src/CosPropertyService_PropertyNamesIterator_impl.erl @@ -0,0 +1,158 @@ +%%-------------------------------------------------------------------- +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +%% +%%---------------------------------------------------------------------- +%% File : CosPropertyService_PropertyNamesIterator_impl.erl +%% Description : +%% +%%---------------------------------------------------------------------- +-module('CosPropertyService_PropertyNamesIterator_impl'). + +%%---------------------------------------------------------------------- +%% Include files +%%---------------------------------------------------------------------- +-include_lib("orber/include/corba.hrl"). +-include_lib("orber/src/orber_iiop.hrl"). +-include("CosPropertyService.hrl"). +-include("cosProperty.hrl"). + +%%---------------------------------------------------------------------- +%% External exports +%%---------------------------------------------------------------------- +%% Mandatory server functions +-export([init/1, + terminate/2, + code_change/3]). + +-export([reset/1, + next_one/1, + next_n/2, + destroy/1]). + +%%---------------------------------------------------------------------- +%% Internal exports +%%---------------------------------------------------------------------- +-export([ + ]). + +%%---------------------------------------------------------------------- +%% Records +%%---------------------------------------------------------------------- +-record(state, {properties, counter=1, length}). + +%%---------------------------------------------------------------------- +%% Macros +%%---------------------------------------------------------------------- +-define(CreateInitState(L), #state{properties = L, length = length(L)}). +-define(get_Properties(S), S#state.properties). +-define(get_Counter(S), S#state.counter). +-define(get_Length(S), S#state.length). + +-define(set_Properties(S, P), S#state{properties = P}). +-define(set_Counter(S, C), S#state{counter = C}). +-define(set_Length(S, L), S#state{length = L}). + +-define(increment_Counter(S), S#state{counter = S#state.counter+1}). +-define(decrement_Counter(S), S#state{counter = S#state.counter-1}). +-define(addto_Counter(S, N), S#state{counter = S#state.counter+N}). +-define(subfrom_Counter(S, N), S#state{counter = S#state.counter-N}). + + +%%====================================================================== +%% External functions +%%====================================================================== +%%---------------------------------------------------------------------- +%% Function : init/1 +%% Description: Initiates the server +%% Returns : {ok, State} | +%% {ok, State, Timeout} | +%% ignore | +%% {stop, Reason} +%%---------------------------------------------------------------------- +init(Properties) -> + {ok, ?CreateInitState(Properties)}. + +%%---------------------------------------------------------------------- +%% Function : terminate/2 +%% Description: Shutdown the server +%% Returns : any (ignored by gen_server) +%%---------------------------------------------------------------------- +terminate(_Reason, _State) -> + ok. + +%%---------------------------------------------------------------------- +%% Function : code_change/3 +%% Description: Convert process state when code is changed +%% Returns : {ok, NewState} +%%---------------------------------------------------------------------- +code_change(_OldVsn, State, _Extra) -> + {ok, State}. + +%%---------------------------------------------------------------------% +%% Function : reset +%% Arguments : - +%% Description: +%% Returns : {ok, NewState} +%%---------------------------------------------------------------------- +reset(State) -> + {reply, ok, ?set_Counter(State, 1)}. + +%%---------------------------------------------------------------------% +%% Function : next_one +%% Arguments : - +%% Description: +%% Returns : {ok, {bool(), PropertyName}, NewState} +%%---------------------------------------------------------------------- +next_one(State) when ?get_Counter(State) > ?get_Length(State) -> + {reply, {false, ""}, State}; +next_one(State) -> + {reply, {true, lists:nth(?get_Counter(State), ?get_Properties(State))}, + ?set_Counter(State, 1+?get_Counter(State))}. + +%%---------------------------------------------------------------------% +%% Function : next_n +%% Arguments : N - how many properties we should return. +%% Description: +%% Returns : {ok, {bool(), PropertyNameList}, NewState} +%%---------------------------------------------------------------------- +next_n(State, N) -> + case lists:sublist(?get_Properties(State), ?get_Counter(State), N) of + Properties when N+?get_Counter(State) < ?get_Length(State) -> + {reply, {true, Properties}, ?set_Counter(State, N+?get_Counter(State))}; + Properties -> + {reply, {false, Properties}, ?set_Counter(State, ?get_Length(State))} + end. + +%%---------------------------------------------------------------------% +%% Function : destroy +%% Arguments : - +%% Description: Terminate the object +%% Returns : {ok, NewState} +%%---------------------------------------------------------------------- +destroy(State) -> + {stop, normal, ok, State}. + +%%====================================================================== +%% Internal functions +%%====================================================================== + +%%====================================================================== +%% END OF MODULE +%%====================================================================== diff --git a/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl b/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl new file mode 100644 index 0000000000..b099026b88 --- /dev/null +++ b/lib/cosProperty/src/CosPropertyService_PropertySetDefFactory_impl.erl @@ -0,0 +1,179 @@ +%%---------------------------------------------------------------------- +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +%% +%%---------------------------------------------------------------------- +%% File : CosPropertyService_PropertySetDefFactory_impl.erl +%% Description : +%% +%%---------------------------------------------------------------------- +-module('CosPropertyService_PropertySetDefFactory_impl'). + +%%---------------------------------------------------------------------- +%% Include files +%%---------------------------------------------------------------------- +-include_lib("orber/include/corba.hrl"). +-include_lib("orber/src/orber_iiop.hrl"). +-include("CosPropertyService.hrl"). +-include("cosProperty.hrl"). + +%%---------------------------------------------------------------------- +%% External exports +%%---------------------------------------------------------------------- +-export([init/1, + terminate/2, + code_change/3]). + +-export([create_propertysetdef/2, + create_constrained_propertysetdef/4, + create_initial_propertysetdef/3]). + +%%---------------------------------------------------------------------- +%% Internal exports +%%---------------------------------------------------------------------- +-export([]). + +%%---------------------------------------------------------------------- +%% Records +%%---------------------------------------------------------------------- +-record(state, {}). + +%%---------------------------------------------------------------------- +%% Macros +%%---------------------------------------------------------------------- +-define(checkTCfun, fun(TC) -> orber_tc:check_tc(TC) end). + +%%====================================================================== +%% External functions +%%====================================================================== +%%---------------------------------------------------------------------- +%% Function : init/1 +%% Returns : {ok, State} | +%% {ok, State, Timeout} | +%% ignore | +%% {stop, Reason} +%% Description: Initiates the server +%%---------------------------------------------------------------------- +init([]) -> + {ok, #state{}}. + +%%---------------------------------------------------------------------- +%% Function : terminate/2 +%% Returns : any (ignored by gen_server) +%% Description: Shutdown the server +%%---------------------------------------------------------------------- +terminate(_Reason, _State) -> + ok. + +%%---------------------------------------------------------------------- +%% Function : code_change/3 +%% Returns : {ok, NewState} +%% Description: Convert process state when code is changed +%%---------------------------------------------------------------------- +code_change(_OldVsn, State, _Extra) -> + {ok, State}. + +%%---------------------------------------------------------------------% +%% Function : create_propertysetdef +%% Arguments : +%% Returns : CosPropertyService::PropertySetDef reference. +%% Description: +%%---------------------------------------------------------------------- +create_propertysetdef(_OE_This, State) -> + {reply, + 'CosPropertyService_PropertySetDef': + oe_create({normal, [], [], [], ?PropertySetDef}, [{pseudo, true}]), + State}. + +%%---------------------------------------------------------------------% +%% Function : create_constrained_propertysetdef +%% Arguments : PropTypes - list of property types. +%% PropDefs - list of property defs. +%% Returns : CosPropertyService::PropertySetDef | +%% {'EXCEPTION', CosPropertyService::ConstraintNotSupported} +%% Description: +%%---------------------------------------------------------------------- +create_constrained_propertysetdef(_OE_This, State, PropTypes, PropDefs) -> + case lists:all(?checkTCfun, PropTypes) of + true -> + crosscheckTC(PropDefs, PropTypes), + {reply, + 'CosPropertyService_PropertySetDef': + oe_create({normal, PropTypes, PropDefs, [], ?PropertySetDef}, [{pseudo, true}]), + State}; + false -> + corba:raise(#'CosPropertyService_ConstraintNotSupported'{}) + end. + +crosscheckTC([], _) -> + ok; +crosscheckTC([#'CosPropertyService_PropertyDef' + {property_name = Name, + property_value = Value, + property_mode = _Mode}|T], TCs) -> + case lists:member(any:get_typecode(Value), TCs) of + true when Name =/= "" -> + crosscheckTC(T, TCs); + _ -> + corba:raise(#'CosPropertyService_ConstraintNotSupported'{}) + end. + +%%---------------------------------------------------------------------% +%% Function : create_initial_propertysetdef +%% Arguments : +%% Returns : CosPropertyService::PropertySetDef | +%% {'EXCEPTION', CosPropertyService::MultipleExceptions} +%% Description: +%%---------------------------------------------------------------------- +create_initial_propertysetdef(_OE_This, State, PropDefs) -> + InitProps = evaluate_propertysetdef(PropDefs), + {reply, + 'CosPropertyService_PropertySetDef': + oe_create({normal, [], [], InitProps, ?PropertySetDef}, [{pseudo, true}]), + State}. + +%%====================================================================== +%% Internal functions +%%====================================================================== +evaluate_propertysetdef(SetDefs) -> + evaluate_propertysetdef(SetDefs, [], []). +evaluate_propertysetdef([], NewProperties, []) -> + %% No exceptions found. + NewProperties; +evaluate_propertysetdef([], _, Exc) -> + corba:raise(#'CosPropertyService_MultipleExceptions'{exceptions = Exc}); +evaluate_propertysetdef([#'CosPropertyService_PropertyDef' + {property_name = Name, + property_value = Value, + property_mode = Mode}|T], X, Exc) -> + case orber_tc:check_tc(any:get_typecode(Value)) of + true -> + evaluate_propertysetdef(T, [{Name, Value, Mode}|X], Exc); + false -> + evaluate_propertysetdef(T, X, [#'CosPropertyService_PropertyException' + {reason = unsupported_type_code, + failing_property_name = Name}|Exc]) + end. + + + +%%====================================================================== +%% END OF MODULE +%%====================================================================== + diff --git a/lib/cosProperty/src/CosPropertyService_PropertySetDef_impl.erl b/lib/cosProperty/src/CosPropertyService_PropertySetDef_impl.erl new file mode 100644 index 0000000000..157b243c53 --- /dev/null +++ b/lib/cosProperty/src/CosPropertyService_PropertySetDef_impl.erl @@ -0,0 +1,1041 @@ +%%-------------------------------------------------------------------- +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +%% +%%----------------------------------------------------------------- +%% File: CosPropertyService_PropertySetDef_impl.erl +%% Modified: +%% +%%----------------------------------------------------------------- +%% README: +%% (1) The OMG specification states that a property name may not +%% be an empty string (""). We may restrict this further +%% but there is no reason for that. +%%----------------------------------------------------------------- +-module('CosPropertyService_PropertySetDef_impl'). + +%%---------------------------------------------------------------------- +%% Include files +%%---------------------------------------------------------------------- +-include_lib("orber/include/corba.hrl"). +-include_lib("orber/src/orber_iiop.hrl"). +-include_lib("cosProperty/include/CosPropertyService.hrl"). +-include("cosProperty.hrl"). + +%%---------------------------------------------------------------------- +%% External exports +%%---------------------------------------------------------------------- +%% Mandatory callbacks +-export([init/1, + terminate/2, + code_change/3]). + +%% Inherrit from CosPropertyService::PropertySet +-export([define_property/4, + define_properties/3, + get_number_of_properties/2, + get_all_property_names/3, + get_property_value/3, + get_properties/3, + get_all_properties/3, + delete_property/3, + delete_properties/3, + delete_all_properties/2, + is_property_defined/3]). + +%% CosPropertyService::PropertySetDef +-export([get_allowed_property_types/2, + get_allowed_properties/2, + define_property_with_mode/5, + define_properties_with_modes/3, + get_property_mode/3, + get_property_modes/3, + set_property_mode/4, + set_property_modes/3]). + +%%---------------------------------------------------------------------- +%% Internal exports +%%---------------------------------------------------------------------- +-export([dump/0]). + +%%---------------------------------------------------------------------- +%% Records +%%---------------------------------------------------------------------- +-record(state, {dbKey, defaultMode, okTypes, okProperties, myType}). + +%%---------------------------------------------------------------------- +%% Macros +%%---------------------------------------------------------------------- + +-define(create_InitState(K, D, AT, AP, MT), #state{dbKey = K, defaultMode = D, + okTypes = AT, okProperties = AP, + myType = MT}). +%% Selectors +-define(get_DBKey(S), S#state.dbKey). +-define(get_DefaultMode(S), S#state.defaultMode). +-define(get_okTypes(S), S#state.okTypes). +-define(get_okProperties(S), S#state.okProperties). +%% MISC +-define(is_NotSetDef(S), S#state.myType =/= ?PropertySetDef). +-define(no_PropertyLimits(S), S#state.okProperties == []). +-define(no_TypeLimits(S), S#state.okTypes == []). +-define(is_NotStatic(S), is_binary(S#state.dbKey)). + +%% Fun:s +-define(Local2Property, fun({N,V,_M}) -> + #'CosPropertyService_Property'{property_name = N, + property_value = V} + end). +-define(Local2Names, fun({N,_V,_M}) -> + N + end). +-define(MemberName(N), fun(R) -> + case R of + Property when is_record(R, 'CosPropertyService_Property') -> + Property#'CosPropertyService_Property'.property_name == N; + PropertyDef when is_record(R, 'CosPropertyService_PropertyDef') -> + PropertyDef#'CosPropertyService_PropertyDef'.property_name == N; + _-> + false + end + end). + +%%====================================================================== +%% External functions +%%====================================================================== +%%---------------------------------------------------------------------- +%% Function : init/1 +%% Description: Initiates the server +%% Returns : {ok, State} | +%% {ok, State, Timeout} | +%% ignore | +%% {stop, Reason} +%%---------------------------------------------------------------------- +init({DefMode, AllowedTypes, AllowedProperties, InitProperties, MyType}) -> + Key = term_to_binary({now(), node()}), + _F = ?write_function(#oe_CosPropertyService{key=Key, + properties=InitProperties}), + write_result(mnesia:transaction(_F)), + {ok, ?create_InitState(Key, DefMode, AllowedTypes, AllowedProperties, MyType)}; +init({static, DefMode, AllowedTypes, AllowedProperties, InitProperties, MyType}) -> + {ok, ?create_InitState(InitProperties, DefMode, AllowedTypes, + AllowedProperties, MyType)}. + +%%---------------------------------------------------------------------% +%% Function : terminate +%% Description: Shutdown the server +%% Returns : any (ignored by gen_server) +%%---------------------------------------------------------------------- +terminate(_Reason, State) when ?is_NotStatic(State) -> + _DF = ?delete_function({oe_CosPropertyService, ?get_DBKey(State)}), + catch write_result(mnesia:transaction(_DF)), + ok; +terminate(_Reason, _State) -> + ok. + +%%---------------------------------------------------------------------% +%% Function : code_change +%% Description: Convert process state when code is changed +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +code_change(_OldVsn, State, _Extra) -> + {ok, State}. + + +%%---------------------------------------------------------------------- +%% Interface CosPropertyService::PropertySet +%%---------------------------------------------------------------------- +%%---------------------------------------------------------------------% +%% Function : define_property +%% Arguments : +%% Description: +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +define_property(_, _, "", _) -> + corba:raise(#'CosPropertyService_InvalidPropertyName'{}); +define_property(_OE_This, State, Name, Value) when ?is_NotStatic(State) -> + evaluate_property_data(State, Value, Name), + _DF = + fun() -> + case mnesia_read(State) of + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + X -> + case catch update_property(X, Name, value, Value, + ?get_DefaultMode(State)) of + {'EXCEPTION', E} when + is_record(E, 'CosPropertyService_PropertyNotFound') -> + mnesia_write(State, [{Name, Value, ?get_DefaultMode(State)}|X]); + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + NewProperties -> + mnesia_write(State, NewProperties) + end + end + end, + {reply, mnesia_transaction(_DF), State}; +define_property(_OE_This, State, Name, Value) -> + evaluate_property_data(State, Value, Name), + X = ?get_DBKey(State), + case catch update_property(X, Name, value, Value, ?get_DefaultMode(State)) of + {'EXCEPTION', E} when is_record(E, 'CosPropertyService_PropertyNotFound') -> + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}); + {'EXCEPTION', E} -> + corba:raise(E); + _NewProperties -> + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) + end. + + +%%---------------------------------------------------------------------% +%% Function : get_property_value +%% Arguments : +%% Description: +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +get_property_value(_, _, "") -> + corba:raise(#'CosPropertyService_InvalidPropertyName'{}); +get_property_value(_OE_THIS, State, Name) -> + X = lookup_table(?get_DBKey(State)), + {reply, find_property(X, Name, value), State}. + +%%---------------------------------------------------------------------% +%% Function : delete_property +%% Arguments : +%% Description: +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +delete_property(_, _, "") -> + corba:raise(#'CosPropertyService_InvalidPropertyName'{}); +delete_property(_OE_THIS, State, Name) when ?is_NotStatic(State) -> + _DF = + fun() -> + case mnesia_read(State) of + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + X -> + case catch remove_property(X, Name) of + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + NewProperties -> + mnesia_write(State, NewProperties) + end + end + end, + {reply, mnesia_transaction(_DF), State}; +delete_property(_OE_THIS, State, Name) -> + X = lookup_table(?get_DBKey(State)), + %% Check the properties; must raise an exception. + remove_property(X, Name), + %% Something is not correct. + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). + + +%%---------------------------------------------------------------------% +%% Function : define_properties +%% Arguments : +%% Description: +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +define_properties(_OE_THIS, State, PropertySeq) when ?is_NotStatic(State) -> + {OKProperties, Exc} = evaluate_properties_data(State, PropertySeq), + _DF = + fun() -> + case mnesia_read(State) of + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + X -> + case catch define_properties_helper(State, + OKProperties, X, Exc) of + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + NewProperties -> + mnesia_write(State, NewProperties) + end + end + end, + {reply, mnesia_transaction(_DF), State}; +define_properties(_OE_THIS, State, PropertySeq) -> + {OKProperties, Exc} = evaluate_properties_data(State, PropertySeq), + X = lookup_table(?get_DBKey(State)), + case define_properties_helper(State, OKProperties, X, Exc) of + {'EXCEPTION', E} -> + corba:raise(E); + _ -> + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) + end. + +define_properties_helper(_State, [], NewProperties, []) -> + %% No exceptions, insert the properties. + NewProperties; +define_properties_helper(_State, [], _, MultipleExceptions) -> + {'EXCEPTION', #'CosPropertyService_MultipleExceptions'{exceptions = MultipleExceptions}}; +define_properties_helper(State, [#'CosPropertyService_Property' + {property_name = Name, + property_value = Value}|T], Properties, Exc) -> + case catch update_property(Properties, Name, value, Value, ?get_DefaultMode(State)) of + {'EXCEPTION', E} when is_record(E, 'CosPropertyService_PropertyNotFound') -> + define_properties_helper(State, T, [{Name, Value, ?get_DefaultMode(State)}|Properties], Exc); + {'EXCEPTION', E} -> + define_properties_helper(State, T, Properties, + [#'CosPropertyService_PropertyException' + {reason = remap_exception(E), + failing_property_name = Name}|Exc]); + NewProperties -> + define_properties_helper(State, T, NewProperties, Exc) + end. + +%%---------------------------------------------------------------------% +%% Function : get_number_of_properties +%% Arguments : - +%% Description: Returns the number of properties currently associated +%% with this object. +%% Returns : {ok, ulong(), State} +%%---------------------------------------------------------------------- +get_number_of_properties(_OE_THIS, State) -> + X = lookup_table(?get_DBKey(State)), + {reply, length(X), State}. + +%%---------------------------------------------------------------------% +%% Function : get_all_property_names +%% Arguments : +%% Description: +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +get_all_property_names(_OE_THIS, State, Max) -> + X = lookup_table(?get_DBKey(State)), + {reply, get_all_property_names_helper(X, [], Max), State}. + +get_all_property_names_helper([], Acc, _) -> + %% There are no more properties; return a nil-object refernce. + {ok, Acc, corba:create_nil_objref()}; +get_all_property_names_helper(Left, Acc, 0) -> + %% There are more properties; create Name Iterartor. + PropertyNames = lists:map(?Local2Names, Left), + {ok, Acc, cosProperty:start_PropertyNamesIterator(PropertyNames)}; +get_all_property_names_helper([{Name, _, _}|T], Acc, No) -> + get_all_property_names_helper(T, [Name|Acc], No-1). + + +%%---------------------------------------------------------------------% +%% Function : get_properties +%% Arguments : A list of property names, i.e., string() +%% Description: +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +get_properties(_OE_THIS, State, PropertyNames) -> + X = lookup_table(?get_DBKey(State)), + {reply, locate_names(PropertyNames, X, true, []), State}. + +locate_names([], _, AllOK, Acc) -> + {AllOK, Acc}; +locate_names([""|T], X, _AllOK, Acc) -> + locate_names(T, X, false, [#'CosPropertyService_Property' + {property_name = "", + property_value = + any:create(tk_void, ok)}|Acc]); +locate_names([H|T], X, AllOK, Acc) -> + case catch find_property(X, H, value) of + {'EXCEPTION', _} -> + locate_names(T, X, false, [#'CosPropertyService_Property' + {property_name = H, + property_value = + any:create(tk_void, ok)}|Acc]); + Val -> + locate_names(T, X, AllOK, [#'CosPropertyService_Property' + {property_name = H, + property_value = Val}|Acc]) + end. + +%%---------------------------------------------------------------------% +%% Function : get_all_properties +%% Arguments : +%% Description: +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +get_all_properties(_OE_THIS, State, Max) -> + X = lookup_table(?get_DBKey(State)), + {reply, get_all_properties_helper(X, [], Max), State}. + +get_all_properties_helper([], Acc, _) -> +%% There are no more properties; return a nil-object refernce. + {ok, Acc, corba:create_nil_objref()}; +get_all_properties_helper(Left, Acc, 0) -> + %% There are more properties; create Iterartor. + Properties = lists:map(?Local2Property, Left), + {ok, Acc, cosProperty:start_PropertiesIterator(Properties)}; +get_all_properties_helper([{Name, Val, _}|T], Acc, No) -> + get_all_properties_helper(T, [#'CosPropertyService_Property' + {property_name = Name, + property_value = Val}|Acc], No-1). + +%%---------------------------------------------------------------------% +%% Function : delete_properties +%% Arguments : +%% Description: +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +delete_properties(_OE_THIS, State, []) -> + {reply, ok, State}; +delete_properties(_OE_THIS, State, PropertyNames) when ?is_NotStatic(State) -> + _DF = + fun() -> + case mnesia_read(State) of + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + X -> + case catch delete_properties_helper(X, [], [], + PropertyNames, State, + length(X)) of + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + {{'EXCEPTION', E}, NotDeleted} -> + ok = mnesia_write(State, NotDeleted), + {'EXCEPTION', E}; + {ok, NotDeleted} -> + mnesia_write(State, NotDeleted) + end + end + end, + {reply, mnesia_transaction(_DF), State}; +delete_properties(_OE_THIS, State, PropertyNames) -> + X = lookup_table(?get_DBKey(State)), + case delete_properties_helper(X, [], [], PropertyNames, State, length(X)) of + {'EXCEPTION', E} -> + corba:raise(E); + _-> + %% Not acceptable if it was possible to delete one or more Properties. + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) + end. + +delete_properties_helper([], [], NotDeleted, [], _State, _Len) -> + %% Since there are no exceptions we have been able to delete all + %% properties. + {ok, NotDeleted}; +delete_properties_helper([], MultipleExc, NotDeleted, Names, _State, Len) -> + %% Write remaining events to DB. + case length(NotDeleted) of + Len -> + {'EXCEPTION', #'CosPropertyService_MultipleExceptions' + {exceptions = add_not_found(Names, MultipleExc)}}; + _-> + {{'EXCEPTION', #'CosPropertyService_MultipleExceptions' + {exceptions = add_not_found(Names, MultipleExc)}}, + NotDeleted} + end; +delete_properties_helper([{Name, Val, Mode}|T], MultipleExc, NotDeleted, + Names, State, Len) -> + case lists:member(Name, Names) of + true when Mode =/= fixed_normal, Mode =/= fixed_readonly -> + delete_properties_helper(T, MultipleExc, NotDeleted, + lists:delete(Name, Names), State, Len); + true -> + delete_properties_helper(T, [#'CosPropertyService_PropertyException' + {reason = fixed_property, + failing_property_name = Name}|MultipleExc], + [{Name, Val, Mode}|NotDeleted], + lists:delete(Name, Names), State, Len); + false -> + delete_properties_helper(T, MultipleExc, [{Name, Val, Mode}|NotDeleted], + Names, State, Len) + end. + +add_not_found([], MultipleExc) -> + MultipleExc; +add_not_found([Name|T], MultipleExc) -> + add_not_found(T, [#'CosPropertyService_PropertyException' + {reason = property_not_found, + failing_property_name = Name}|MultipleExc]). + + + +%%---------------------------------------------------------------------% +%% Function : delete_all_properties +%% Arguments : +%% Description: +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +delete_all_properties(_OE_THIS, State) when ?is_NotStatic(State) -> + _DF = + fun() -> + case mnesia_read(State) of + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + X -> + case catch delete_all_properties_helper(X, [], State, + length(X)) of + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + true -> + ok = mnesia_write(State, []), + true; + false -> + false; + {false, NotDeleted} -> + ok = mnesia_write(State, NotDeleted), + false + end + end + end, + {reply, mnesia_transaction(_DF), State}; +delete_all_properties(_OE_THIS, State) -> + X = lookup_table(?get_DBKey(State)), + case delete_all_properties_helper(X, [], State, length(X)) of + false -> + {reply, false, State}; + _-> + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) + end. + +delete_all_properties_helper([], [], _State, _) -> + %% Was able to delete all properties. + true; +delete_all_properties_helper([], NotDeleted, _State, Len) -> + %% Write remaining events to DB. + case length(NotDeleted) of + Len -> + false; + _-> + {false, NotDeleted} + end; +delete_all_properties_helper([{Name, Val, fixed_normal}|T], NotDeleted, State, Len) -> + delete_all_properties_helper(T, [{Name, Val, fixed_normal}|NotDeleted], State, Len); +delete_all_properties_helper([{Name, Val, fixed_readonly}|T], NotDeleted, State, Len) -> + delete_all_properties_helper(T, [{Name, Val, fixed_readonly}|NotDeleted], State, Len); +delete_all_properties_helper([_|T], NotDeleted, State, Len) -> + delete_all_properties_helper(T, NotDeleted, State, Len). + +%%---------------------------------------------------------------------% +%% Function : is_property_defined +%% Arguments : +%% Description: +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +is_property_defined(_, _, "") -> + corba:raise(#'CosPropertyService_InvalidPropertyName'{}); +is_property_defined(_OE_THIS, State, Name) -> + X = lookup_table(?get_DBKey(State)), + {reply, lists:keymember(Name, 1, X), State}. + +%%---------------------------------------------------------------------- +%% Interface CosPropertyService::PropertySetDef +%%---------------------------------------------------------------------- +%%---------------------------------------------------------------------% +%% Function : get_allowed_property_types +%% Arguments : - +%% Description: Returns the initially supplied restrictions. An empty +%% list means no restrictions. +%% Returns : {ok, TypeCodeList,State} +%%---------------------------------------------------------------------- +get_allowed_property_types(_OE_THIS, State) when ?is_NotSetDef(State) -> + corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}); +get_allowed_property_types(_OE_THIS, State) -> + {reply, {ok, ?get_okTypes(State)}, State}. + +%%---------------------------------------------------------------------% +%% Function : get_allowed_properties +%% Arguments : +%% Description: Returns the initially supplied restrictions. An empty +%% list means no restrictions. +%% Returns : {ok, PropertyDefList, State} +%%---------------------------------------------------------------------- +get_allowed_properties(_OE_THIS, State) when ?is_NotSetDef(State) -> + corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}); +get_allowed_properties(_OE_THIS, State) -> + {reply, {ok, ?get_okProperties(State)}, State}. + +%%---------------------------------------------------------------------% +%% Function : define_property_with_mode +%% Arguments : +%% Description: +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +define_property_with_mode(_OE_THIS, State, _, _, _) when ?is_NotSetDef(State) -> + corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}); +define_property_with_mode(_, _, "", _, _) -> + corba:raise(#'CosPropertyService_InvalidPropertyName'{}); +define_property_with_mode(_OE_THIS, State, Name, Value, Mode) + when ?is_NotStatic(State) -> + evaluate_property_data(State, Value, Name), + _DF = + fun() -> + case mnesia_read(State) of + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + X -> + case catch update_property(X, Name, both, Value, Mode) of + {'EXCEPTION', E} + when is_record(E, 'CosPropertyService_PropertyNotFound') -> + mnesia_write(State, [{Name, Value, Mode}|X]); + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + NewProperties -> + mnesia_write(State, NewProperties) + end + end + end, + {reply, mnesia_transaction(_DF), State}; +define_property_with_mode(_OE_THIS, State, Name, Value, Mode) -> + evaluate_property_data(State, Value, Name), + X = lookup_table(?get_DBKey(State)), + case catch update_property(X, Name, both, Value, Mode) of + {'EXCEPTION', E} when is_record(E, 'CosPropertyService_PropertyNotFound') -> + %% Should get not allowed exception. + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}); + {'EXCEPTION', E} -> + corba:raise(E); + _ -> + %% Should be impossible. + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) + end. + +%%---------------------------------------------------------------------% +%% Function : define_properties_with_modes +%% Arguments : +%% Description: +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +define_properties_with_modes(_OE_THIS, State, _) when ?is_NotSetDef(State) -> + corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}); +define_properties_with_modes(_OE_THIS, State, PropertyDefSeq) + when ?is_NotStatic(State)-> + {OKProperteDefs, Exc} = evaluate_properties_data(State, PropertyDefSeq), + _DF = + fun() -> + case mnesia_read(State) of + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + X -> + case catch define_properties_with_modes_helper(OKProperteDefs, + X, Exc, State) of + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + NewProperties -> + mnesia_write(State, NewProperties) + end + end + end, + {reply, mnesia_transaction(_DF), State}; +define_properties_with_modes(_OE_THIS, State, PropertyDefSeq) -> + {OKProperteDefs, Exc} = evaluate_properties_data(State, PropertyDefSeq), + X = lookup_table(?get_DBKey(State)), + case define_properties_with_modes_helper(OKProperteDefs, X, Exc, State) of + {'EXCEPTION', E} -> + corba:raise(E); + _ -> + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) + end. + + +define_properties_with_modes_helper([], NewPropertyDefs, [], _State) -> + %% No exceptions found. + NewPropertyDefs; +define_properties_with_modes_helper([], _, Exc, _) -> + {'EXCEPTION', #'CosPropertyService_MultipleExceptions'{exceptions = Exc}}; +define_properties_with_modes_helper([#'CosPropertyService_PropertyDef' + {property_name = Name, + property_value = Value, + property_mode = Mode}|T], X, Exc, State) -> + case catch update_property(X, Name, both, Value, Mode) of + {'EXCEPTION', E} when is_record(E, 'CosPropertyService_PropertyNotFound') -> + define_properties_with_modes_helper(T, [{Name, Value, Mode}|X], Exc, State); + {'EXCEPTION', E} -> + define_properties_with_modes_helper(T, X, + [#'CosPropertyService_PropertyException' + {reason = remap_exception(E), + failing_property_name = Name}|Exc], + State); + NewX -> + define_properties_with_modes_helper(T, NewX, Exc, State) + end. + +%%---------------------------------------------------------------------% +%% Function : get_property_mode +%% Arguments : +%% Description: +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +get_property_mode(_OE_THIS, State, _) when ?is_NotSetDef(State) -> + corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}); +get_property_mode(_, _, "") -> + corba:raise(#'CosPropertyService_InvalidPropertyName'{}); +get_property_mode(_OE_THIS, State, Name) -> + X = lookup_table(?get_DBKey(State)), + {reply, find_property(X, Name, mode), State}. + +%%---------------------------------------------------------------------% +%% Function : get_property_modes +%% Arguments : +%% Description: +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +get_property_modes(_OE_THIS, State, _) when ?is_NotSetDef(State) -> + corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}); +get_property_modes(_OE_THIS, State, PropertyNames) -> + X = lookup_table(?get_DBKey(State)), + {reply, get_property_modes_helper(PropertyNames, X, [], true), State}. + +get_property_modes_helper([], _, Acc, Bool) -> + {Bool, Acc}; +get_property_modes_helper([""|T], Properties, Acc, _) -> + get_property_modes_helper(T, Properties, + [#'CosPropertyService_PropertyMode' + {property_name = "", + property_mode = undefined}|Acc], false); +get_property_modes_helper([Name|T], Properties, Acc, Bool) -> + case lists:keysearch(Name, 1, Properties) of + {value, {Name, _, Mode}} -> + get_property_modes_helper(T, Properties, + [#'CosPropertyService_PropertyMode' + {property_name = Name, + property_mode = Mode}|Acc], Bool); + false -> + get_property_modes_helper(T, Properties, + [#'CosPropertyService_PropertyMode' + {property_name = Name, + property_mode = undefined}|Acc], false) + end. + +%%---------------------------------------------------------------------% +%% Function : set_property_mode +%% Arguments : +%% Description: +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +set_property_mode(_OE_THIS, State, _, _) when ?is_NotSetDef(State) -> + corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}); +set_property_mode(_, _, "", _) -> + corba:raise(#'CosPropertyService_InvalidPropertyName'{}); +set_property_mode(_OE_THIS, State, Name, Mode) when ?is_NotStatic(State) -> + _DF = + fun() -> + case mnesia_read(State) of + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + X -> + case catch update_property(X, Name, mode, undefined, Mode) of + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + NewProperties -> + mnesia_write(State, NewProperties) + end + end + end, + {reply, mnesia_transaction(_DF), State}; +set_property_mode(_OE_THIS, State, Name, Mode) -> + X = lookup_table(?get_DBKey(State)), + update_property(X, Name, mode, undefined, Mode), + %% Something is not correct, shouldn't be allowed to update a property when + %% static. + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). + +%%---------------------------------------------------------------------% +%% Function : set_property_modes +%% Arguments : +%% Description: +%% Returns : {ok, State} +%%---------------------------------------------------------------------- +set_property_modes(_OE_THIS, State, _) when ?is_NotSetDef(State) -> + corba:raise(#'NO_IMPLEMENT'{completion_status=?COMPLETED_NO}); +set_property_modes(_OE_THIS, State, PropertyModes) when ?is_NotStatic(State) -> + _DF = + fun() -> + case mnesia_read(State) of + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + X -> + case catch set_property_modes_helper(PropertyModes, X, [], + State) of + {'EXCEPTION', E} -> + {'EXCEPTION', E}; + NewProperties -> + mnesia_write(State, NewProperties) + end + end + end, + {reply, mnesia_transaction(_DF), State}; +set_property_modes(_OE_THIS, State, PropertyModes) -> + X = lookup_table(?get_DBKey(State)), + case set_property_modes_helper(PropertyModes, X, [], State) of + {'EXCEPTION', E} -> + corba:raise(E); + _ -> + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) + end. + +set_property_modes_helper([], NewProperties, [], _State) -> + %% No exceptions, write to DB. + NewProperties; +set_property_modes_helper([], _, Exc, _) -> + {'EXCEPTION', #'CosPropertyService_MultipleExceptions'{exceptions = Exc}}; +set_property_modes_helper([#'CosPropertyService_PropertyMode' + {property_name = Name, + property_mode = Mode}|T], X, Exc, State) -> + case catch update_property(X, Name, mode, undefined, Mode) of + {'EXCEPTION', E} -> + set_property_modes_helper(T, X, + [#'CosPropertyService_PropertyException' + {reason = remap_exception(E), + failing_property_name = Name}|Exc], + State); + NewX -> + set_property_modes_helper(T, NewX, Exc, State) + end. + + +%%====================================================================== +%% Internal functions +%%====================================================================== + +remap_exception(#'CosPropertyService_ConflictingProperty'{}) -> conflicting_property; +remap_exception(#'CosPropertyService_FixedProperty'{}) -> fixed_property; +remap_exception(#'CosPropertyService_InvalidPropertyName'{}) -> invalid_property_name; +remap_exception(#'CosPropertyService_PropertyNotFound'{}) -> property_not_found; +remap_exception(#'CosPropertyService_UnsupportedTypeCode'{}) -> unsupported_type_code; +remap_exception(#'CosPropertyService_UnsupportedProperty'{}) -> unsupported_property; +remap_exception(#'CosPropertyService_ReadOnlyProperty'{}) -> read_only_property; +remap_exception(#'CosPropertyService_UnsupportedMode'{}) -> unsupported_mode. + +find_property([], _, _) -> + corba:raise(#'CosPropertyService_PropertyNotFound'{}); +find_property([{Name, Value, _}|_], Name, value) -> + Value; +find_property([{Name, _, Mode}|_], Name, mode) -> + Mode; +% Left out for now to avoid dialyzer warning. +%find_property([{Name, Value, Mode}|_], Name, all) -> +% {Name, Value, Mode}; +find_property([_|T], Name, Which) -> + find_property(T, Name, Which). + +remove_property(PropertList, Name) -> + remove_property(PropertList, Name, []). +remove_property([], _, _) -> + corba:raise(#'CosPropertyService_PropertyNotFound'{}); +remove_property([{Name, _, fixed_normal}|_T], Name, _) -> + corba:raise(#'CosPropertyService_FixedProperty'{}); +remove_property([{Name, _, fixed_readonly}|_T], Name, _) -> + corba:raise(#'CosPropertyService_FixedProperty'{}); +remove_property([{Name, _, _}|T], Name, Acc) -> + T++Acc; +remove_property([H|T], Name, Acc) -> + remove_property(T, Name, [H|Acc]). + + +update_property(_, "", _, _, _) -> + corba:raise(#'CosPropertyService_InvalidPropertyName'{}); +update_property(PropertyList, Name, Which, Value, Mode) -> + update_property(PropertyList, Name, Which, Value, Mode, []). + +update_property([], _, _, _, _, _) -> + corba:raise(#'CosPropertyService_PropertyNotFound'{}); +update_property([{Name, _, fixed_readonly}|_], Name, value, _, _, _) -> + corba:raise(#'CosPropertyService_FixedProperty'{}); +update_property([{Name, _, fixed_normal}|_], Name, both, _, _, _) -> + corba:raise(#'CosPropertyService_FixedProperty'{}); +update_property([{Name, _, fixed_readonly}|_], Name, both, _, _, _) -> + corba:raise(#'CosPropertyService_FixedProperty'{}); +update_property([{Name, #any{typecode = TC}, Mode}|T], Name, + value, #any{typecode = TC, value = Value}, _Mod, Acc) -> + [{Name, #any{typecode = TC, value = Value}, Mode}|T]++Acc; +update_property([{Name, #any{typecode = TC}, _Mode}|T], Name, + both, #any{typecode = TC, value = Value}, Mod, Acc) -> + [{Name, #any{typecode = TC, value = Value}, Mod}|T]++Acc; +update_property([{Name, _, _}|_], Name, value, _, _, _) -> + corba:raise(#'CosPropertyService_ConflictingProperty'{}); +update_property([{Name, _, _}|_], Name, both, _, _, _) -> + corba:raise(#'CosPropertyService_ConflictingProperty'{}); +%% Normally we don't need to raise an exception for the two following cases but +%% to be able to manage static Properties we must raise an exception. Well, +%% on the other hand, why should a user try to change a mode to the same value?! +%% But we have no other option. +update_property([{Name, _Value, fixed_normal}|_T], Name, mode, _, fixed_normal, _Acc) -> + corba:raise(#'CosPropertyService_FixedProperty'{}); +update_property([{Name, _Value, fixed_readonly}|_T], Name, mode, _, fixed_readonly, _Acc) -> + corba:raise(#'CosPropertyService_FixedProperty'{}); +update_property([{Name, _Value, fixed_normal}|_T], Name, mode, _, _Mode, _Acc) -> + corba:raise(#'CosPropertyService_UnsupportedMode'{}); +update_property([{Name, _Value, fixed_readonly}|_T], Name, mode, _, _Mode, _Acc) -> + corba:raise(#'CosPropertyService_UnsupportedMode'{}); +update_property([{Name, Value, _}|T], Name, mode, _, Mode, Acc) -> + [{Name, Value, Mode}|T]++Acc; +update_property([H|T], Name, Which, Value, Mode, Acc) -> + update_property(T, Name, Which, Value, Mode, [H|Acc]). + + +lookup_table(Key) when is_binary(Key) -> + _RF = ?read_function({oe_CosPropertyService, Key}), + case mnesia:transaction(_RF) of + {atomic, [#oe_CosPropertyService{properties=Properties}]} -> + Properties; + {atomic, []} -> + corba:raise(#'OBJECT_NOT_EXIST'{completion_status=?COMPLETED_NO}); + _Other -> + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) + end; +lookup_table(Key) when is_list(Key) -> + Key; +lookup_table(_) -> + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). + +mnesia_transaction(Fun) -> + case mnesia:transaction(Fun) of + {atomic, {'EXCEPTION', E}} -> + corba:raise(E); + {atomic, ok} -> + ok; + {atomic, Reply} -> + Reply; + _Other -> + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) + end. + +mnesia_read(State) -> + case mnesia:wread({oe_CosPropertyService, ?get_DBKey(State)}) of + [#oe_CosPropertyService{properties = X}] -> + X; + {atomic, []} -> + {'EXCEPTION', #'OBJECT_NOT_EXIST'{completion_status=?COMPLETED_NO}}; + _Other -> + {'EXCEPTION', #'INTERNAL'{completion_status=?COMPLETED_NO}} + end. + +mnesia_write(State, X) -> + mnesia:write(#oe_CosPropertyService{key = ?get_DBKey(State), properties = X}). + +%% Check a write transaction +write_result({atomic,ok}) -> ok; +write_result(_Foo) -> + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}). + +evaluate_properties_data(State, PropertySeq) -> + evaluate_properties_data(State, PropertySeq, [], []). + +evaluate_properties_data(_State, [], OKProperties, Exc) -> + {OKProperties, Exc}; + +evaluate_properties_data(State, [#'CosPropertyService_Property' + {property_name = Name, + property_value = Value}|T], Acc, Exc) -> + case catch evaluate_property_data(State, Value, Name) of + ok -> + evaluate_properties_data(State, T, [#'CosPropertyService_Property' + {property_name = Name, + property_value = Value}|Acc], Exc); + {'EXCEPTION', E} when is_record(E, 'CosPropertyService_UnsupportedTypeCode') -> + evaluate_properties_data(State, T, Acc, + [#'CosPropertyService_PropertyException' + {reason = unsupported_type_code, + failing_property_name = Name}|Exc]); + {'EXCEPTION', E} when is_record(E, 'CosPropertyService_UnsupportedProperty') -> + evaluate_properties_data(State, T, Acc, + [#'CosPropertyService_PropertyException' + {reason = unsupported_property, + failing_property_name = Name}|Exc]) + end; +evaluate_properties_data(State, [#'CosPropertyService_PropertyDef' + {property_name = Name, + property_value = Value, + property_mode = Mode}|T], Acc, Exc) -> + case catch evaluate_property_data(State, Value, Name) of + ok -> + evaluate_properties_data(State, T, [#'CosPropertyService_PropertyDef' + {property_name = Name, + property_value = Value, + property_mode = Mode}|Acc], Exc); + {'EXCEPTION', E} when is_record(E, 'CosPropertyService_UnsupportedTypeCode') -> + evaluate_properties_data(State, T, Acc, + [#'CosPropertyService_PropertyException' + {reason = unsupported_type_code, + failing_property_name = Name}|Exc]); + {'EXCEPTION', E} when is_record(E, 'CosPropertyService_UnsupportedProperty') -> + evaluate_properties_data(State, T, Acc, + [#'CosPropertyService_PropertyException' + {reason = unsupported_property, + failing_property_name = Name}|Exc]) + end; +evaluate_properties_data(_, _, _, _) -> + corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}). + +evaluate_property_data(State, _, _) when ?no_PropertyLimits(State), + ?no_TypeLimits(State) -> + ok; +evaluate_property_data(State, Value, _Name) when ?no_PropertyLimits(State) -> + case lists:member(any:get_typecode(Value), ?get_okTypes(State)) of + true -> + ok; + _ -> + corba:raise(#'CosPropertyService_UnsupportedTypeCode'{}) + end; +evaluate_property_data(State, _Value, Name) when ?no_TypeLimits(State) -> + case lists:any(?MemberName(Name), ?get_okProperties(State)) of + true -> + ok; + _ -> + corba:raise(#'CosPropertyService_UnsupportedProperty'{}) + end; +evaluate_property_data(State, Value, Name) -> + case lists:any(?MemberName(Name), ?get_okProperties(State)) of + true -> + case lists:member(any:get_typecode(Value), ?get_okTypes(State)) of + true -> + ok; + _ -> + corba:raise(#'CosPropertyService_UnsupportedTypeCode'{}) + end; + _ -> + corba:raise(#'CosPropertyService_UnsupportedProperty'{}) + end. + + +%%---------------------------------------------------------------------- +%% Debugging functions +%%---------------------------------------------------------------------- +dump() -> + case catch mnesia:dirty_first('oe_CosPropertyService') of + {'EXIT', R} -> + io:format("Exited with ~p\n",[R]); + Key -> + dump_print(Key), + dump_loop(Key) + end. + +dump_loop(PreviousKey) -> + case catch mnesia:dirty_next('oe_CosPropertyService', PreviousKey) of + {'EXIT', R} -> + io:format("Exited with ~p\n",[R]); + '$end_of_table' -> + ok; + Key -> + dump_print(Key), + dump_loop(Key) + end. + +dump_print(Key) -> + case catch mnesia:dirty_read({'oe_CosPropertyService', Key}) of + {'EXIT', R} -> + io:format("Exited with ~p\n",[R]); + [{_,_,X}] -> + io:format("Property: ~p~n", [X]); + _ -> + ok + end. + + +%%-------------------------- END OF MODULE ----------------------------- diff --git a/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl b/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl new file mode 100644 index 0000000000..ad3cdb62d4 --- /dev/null +++ b/lib/cosProperty/src/CosPropertyService_PropertySetFactory_impl.erl @@ -0,0 +1,176 @@ +%%---------------------------------------------------------------------- +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +%% +%%---------------------------------------------------------------------- +%% File : CosPropertyService_PropertySetFactory_impl.erl +%% Description : +%% +%%---------------------------------------------------------------------- +-module('CosPropertyService_PropertySetFactory_impl'). + +%%---------------------------------------------------------------------- +%% Include files +%%---------------------------------------------------------------------- +-include_lib("orber/include/corba.hrl"). +-include_lib("orber/src/orber_iiop.hrl"). +-include("CosPropertyService.hrl"). +-include("cosProperty.hrl"). + +%%---------------------------------------------------------------------- +%% External exports +%%---------------------------------------------------------------------- +-export([init/1, + terminate/2, + code_change/3]). + +-export([create_propertyset/2, + create_constrained_propertyset/4, + create_initial_propertyset/3]). + + +%%---------------------------------------------------------------------- +%% Internal exports +%%---------------------------------------------------------------------- +-export([]). + +%%---------------------------------------------------------------------- +%% Records +%%---------------------------------------------------------------------- +-record(state, {}). + +%%---------------------------------------------------------------------- +%% Macros +%%---------------------------------------------------------------------- +-define(checkTCfun, fun(TC) -> orber_tc:check_tc(TC) end). + +%%====================================================================== +%% External functions +%%====================================================================== +%%---------------------------------------------------------------------- +%% Function : init/1 +%% Returns : {ok, State} | +%% {ok, State, Timeout} | +%% ignore | +%% {stop, Reason} +%% Description: Initiates the server +%%---------------------------------------------------------------------- +init([]) -> + {ok, #state{}}. + +%%---------------------------------------------------------------------- +%% Function : terminate/2 +%% Returns : any (ignored by gen_server) +%% Description: Shutdown the server +%%---------------------------------------------------------------------- +terminate(_Reason, _State) -> + ok. + +%%---------------------------------------------------------------------- +%% Function : code_change/3 +%% Returns : {ok, NewState} +%% Description: Convert process state when code is changed +%%---------------------------------------------------------------------- +code_change(_OldVsn, State, _Extra) -> + {ok, State}. + +%%---------------------------------------------------------------------- +%% Function : create_propertyset +%% Arguments : +%% Returns : CosPropertyService::PropertySet reference. +%% Description: +%%---------------------------------------------------------------------- +create_propertyset(_OE_This, State) -> + {reply, + 'CosPropertyService_PropertySetDef': + oe_create({normal, [], [], [], ?PropertySet}, [{pseudo, true}]), + State}. + +%%---------------------------------------------------------------------- +%% Function : create_constrained_propertyset +%% Arguments : PropTypes - list of property types. +%% Properties - list of properties. +%% Returns : CosPropertyService::PropertySet | +%% {'EXCEPTION', CosPropertyService::ConstraintNotSupported} +%% Description: +%%---------------------------------------------------------------------- +create_constrained_propertyset(_OE_This, State, PropTypes, Properties) -> + case lists:all(?checkTCfun, PropTypes) of + true -> + crosscheckTC(Properties, PropTypes), + {reply, + 'CosPropertyService_PropertySetDef': + oe_create({normal, PropTypes, Properties, [], ?PropertySet}, + [{pseudo, true}]), + State}; + false -> + corba:raise(#'CosPropertyService_ConstraintNotSupported'{}) + end. + +crosscheckTC([], _) -> + ok; +crosscheckTC([#'CosPropertyService_Property' + {property_name = Name, + property_value = Value}|T], TCs) -> + case lists:member(any:get_typecode(Value), TCs) of + true when Name =/= "" -> + crosscheckTC(T, TCs); + _ -> + corba:raise(#'CosPropertyService_ConstraintNotSupported'{}) + end. + +%%---------------------------------------------------------------------- +%% Function : create_initial_propertyset +%% Arguments : Properties - list of properties. +%% Returns : CosPropertyService::PropertySetDef | +%% {'EXCEPTION', CosPropertyService::MultipleExceptions} +%% Description: +%%---------------------------------------------------------------------- +create_initial_propertyset(_OE_This, State, Properties) -> + InitProps = evaluate_propertyset(Properties), + {reply, + 'CosPropertyService_PropertySetDef': + oe_create({normal, [], [], InitProps, ?PropertySet}, [{pseudo, true}]), + State}. + +%%====================================================================== +%% Internal functions +%%====================================================================== +evaluate_propertyset(Sets) -> + evaluate_propertyset(Sets, [], []). +evaluate_propertyset([], NewProperties, []) -> + %% No exceptions found. + NewProperties; +evaluate_propertyset([], _, Exc) -> + corba:raise(#'CosPropertyService_MultipleExceptions'{exceptions = Exc}); +evaluate_propertyset([#'CosPropertyService_Property' + {property_name = Name, + property_value = Value}|T], X, Exc) -> + case orber_tc:check_tc(any:get_typecode(Value)) of + true -> + evaluate_propertyset(T, [{Name, Value, normal}|X], Exc); + false -> + evaluate_propertyset(T, X, [#'CosPropertyService_PropertyException' + {reason = unsupported_type_code, + failing_property_name = Name}|Exc]) + end. + +%%====================================================================== +%% END OF MODULE +%%====================================================================== diff --git a/lib/cosProperty/src/Makefile b/lib/cosProperty/src/Makefile new file mode 100644 index 0000000000..1d2119dfb3 --- /dev/null +++ b/lib/cosProperty/src/Makefile @@ -0,0 +1,183 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 2000-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% +# +# +include $(ERL_TOP)/make/target.mk + +ifeq ($(TYPE),debug) +ERL_COMPILE_FLAGS += -Ddebug -W +endif + +include $(ERL_TOP)/make/$(TARGET)/otp.mk + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include ../vsn.mk +VSN=$(COSPROPERTY_VSN) + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH)/lib/cosProperty-$(VSN) + +EXTERNAL_INC_PATH = ../include + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- + +MODULES = \ + cosProperty \ + CosPropertyService_PropertySetDefFactory_impl \ + CosPropertyService_PropertySetDef_impl \ + CosPropertyService_PropertySetFactory_impl \ + CosPropertyService_PropertiesIterator_impl \ + CosPropertyService_PropertyNamesIterator_impl + + +ERL_FILES = $(MODULES:%=%.erl) +HRL_FILES = \ + cosProperty.hrl \ + +GEN_ERL_FILES = \ + oe_CosProperty.erl \ + CosPropertyService_ConflictingProperty.erl \ + CosPropertyService_ConstraintNotSupported.erl \ + CosPropertyService_FixedProperty.erl \ + CosPropertyService_InvalidPropertyName.erl \ + CosPropertyService_MultipleExceptions.erl \ + CosPropertyService_Properties.erl \ + CosPropertyService_PropertiesIterator.erl \ + CosPropertyService_Property.erl \ + CosPropertyService_PropertyDef.erl \ + CosPropertyService_PropertyDefs.erl \ + CosPropertyService_PropertyException.erl \ + CosPropertyService_PropertyExceptions.erl \ + CosPropertyService_PropertyMode.erl \ + CosPropertyService_PropertyModes.erl \ + CosPropertyService_PropertyNames.erl \ + CosPropertyService_PropertyNamesIterator.erl \ + CosPropertyService_PropertyNotFound.erl \ + CosPropertyService_PropertySet.erl \ + CosPropertyService_PropertySetDef.erl \ + CosPropertyService_PropertySetDefFactory.erl \ + CosPropertyService_PropertySetFactory.erl \ + CosPropertyService_PropertyTypes.erl \ + CosPropertyService_ReadOnlyProperty.erl \ + CosPropertyService_UnsupportedMode.erl \ + CosPropertyService_UnsupportedProperty.erl \ + CosPropertyService_UnsupportedTypeCode.erl + +LOCAL_HRL_FILES = \ + oe_CosProperty.hrl \ + CosPropertyService.hrl \ + CosPropertyService_PropertiesIterator.hrl \ + CosPropertyService_PropertyNamesIterator.hrl \ + CosPropertyService_PropertySet.hrl \ + CosPropertyService_PropertySetDef.hrl \ + CosPropertyService_PropertySetDefFactory.hrl \ + CosPropertyService_PropertySetFactory.hrl + +GEN_HRL_FILES = $(LOCAL_HRL_FILES:%=$(EXTERNAL_INC_PATH)/%) + +GEN_FILES = \ + $(GEN_HRL_FILES) \ + $(GEN_ERL_FILES) + +TARGET_FILES = \ + $(GEN_ERL_FILES:%.erl=$(EBIN)/%.$(EMULATOR)) \ + $(MODULES:%=$(EBIN)/%.$(EMULATOR)) + +IDL_FILES = \ + CosProperty.idl + +APPUP_FILE = cosProperty.appup +APPUP_SRC = $(APPUP_FILE).src +APPUP_TARGET = $(EBIN)/$(APPUP_FILE) + +APP_FILE = cosProperty.app +APP_SRC = $(APP_FILE).src +APP_TARGET = $(EBIN)/$(APP_FILE) + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- +ERL_IDL_FLAGS += -pa $(ERL_TOP)/lib/cosProperty/ebin \ + -pa $(ERL_TOP)/lib/ic/ebin\ + -pa $(ERL_TOP)/lib/orber/ebin + +# The -pa option is just used temporary until erlc can handle +# includes from other directories than ../include . +ERL_COMPILE_FLAGS += \ + $(ERL_IDL_FLAGS) \ + -pa $(ERL_TOP)/lib/orber/include \ + -pa $(ERL_TOP)/lib/cosProperty/include \ + -I$(ERL_TOP)/lib/cosProperty/include \ + -I$(ERL_TOP)/lib/orber/include \ + +'{parse_transform,sys_pre_attributes}' \ + +'{attribute,insert,app_vsn,"cosProperty_$(COSPROPERTY_VSN)"}' + + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- +opt: $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) + +debug: + @${MAKE} TYPE=debug opt + +cleanb: + rm -f $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) + rm -f errs core *~ + +clean: + rm -f $(TARGET_FILES) $(GEN_FILES) $(APP_TARGET) $(APPUP_TARGET) + rm -f errs core *~ + +$(APP_TARGET): $(APP_SRC) + sed -e 's;%VSN%;$(VSN);' $< > $@ + +$(APPUP_TARGET): $(APPUP_SRC) ../vsn.mk + sed -e 's;%VSN%;$(VSN);' $< > $@ + +docs: + +# ---------------------------------------------------- +# Special Build Targets +# ---------------------------------------------------- +$(GEN_ERL_FILES) $(GEN_HRL_FILES): CosProperty.idl + erlc $(ERL_IDL_FLAGS) +'{cfgfile,"CosProperty.cfg"}' CosProperty.idl + mv $(LOCAL_HRL_FILES) $(EXTERNAL_INC_PATH) + + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_spec: opt + $(INSTALL_DIR) $(RELSYSDIR)/ebin + $(INSTALL_DATA) $(TARGET_FILES) $(APP_TARGET) $(APPUP_TARGET) $(RELSYSDIR)/ebin + $(INSTALL_DIR) $(RELSYSDIR)/src + $(INSTALL_DATA) $(GEN_FILES) $(IDL_FILES) $(RELSYSDIR)/src + $(INSTALL_DATA) $(ERL_FILES) $(HRL_FILES) $(GEN_ERL_FILES) $(IDL_FILES) $(RELSYSDIR)/src + $(INSTALL_DIR) $(RELSYSDIR)/include + $(INSTALL_DATA) $(GEN_HRL_FILES) $(RELSYSDIR)/include + +release_docs_spec: diff --git a/lib/cosProperty/src/cosProperty.app.src b/lib/cosProperty/src/cosProperty.app.src new file mode 100644 index 0000000000..3099e904f7 --- /dev/null +++ b/lib/cosProperty/src/cosProperty.app.src @@ -0,0 +1,45 @@ +{application, cosProperty, + [{description, "The Erlang CosProperty application"}, + {vsn, "%VSN%"}, + {modules, + [ + 'cosProperty', + 'CosPropertyService_PropertySetDefFactory_impl', + 'CosPropertyService_PropertySetDef_impl', + 'CosPropertyService_PropertySetFactory_impl', + 'CosPropertyService_PropertiesIterator_impl', + 'CosPropertyService_PropertyNamesIterator_impl', + 'oe_CosProperty', + 'CosPropertyService_ConflictingProperty', + 'CosPropertyService_ConstraintNotSupported', + 'CosPropertyService_FixedProperty', + 'CosPropertyService_InvalidPropertyName', + 'CosPropertyService_MultipleExceptions', + 'CosPropertyService_Properties', + 'CosPropertyService_PropertiesIterator', + 'CosPropertyService_Property', + 'CosPropertyService_PropertyDef', + 'CosPropertyService_PropertyDefs', + 'CosPropertyService_PropertyException', + 'CosPropertyService_PropertyExceptions', + 'CosPropertyService_PropertyMode', + 'CosPropertyService_PropertyModes', + 'CosPropertyService_PropertyNames', + 'CosPropertyService_PropertyNamesIterator', + 'CosPropertyService_PropertyNotFound', + 'CosPropertyService_PropertySet', + 'CosPropertyService_PropertySetDef', + 'CosPropertyService_PropertySetDefFactory', + 'CosPropertyService_PropertySetFactory', + 'CosPropertyService_PropertyTypes', + 'CosPropertyService_ReadOnlyProperty', + 'CosPropertyService_UnsupportedMode', + 'CosPropertyService_UnsupportedProperty', + 'CosPropertyService_UnsupportedTypeCode' + ] + }, + {registered, [oe_cosPropertySup]}, + {applications, [orber, stdlib, kernel]}, + {env, []}, + {mod, {cosProperty, []}} +]}. diff --git a/lib/cosProperty/src/cosProperty.appup.src b/lib/cosProperty/src/cosProperty.appup.src new file mode 100644 index 0000000000..f3eead4a0c --- /dev/null +++ b/lib/cosProperty/src/cosProperty.appup.src @@ -0,0 +1,6 @@ +{"%VSN%", + [ + ], + [ + ] +}. diff --git a/lib/cosProperty/src/cosProperty.erl b/lib/cosProperty/src/cosProperty.erl new file mode 100644 index 0000000000..2368ee3db6 --- /dev/null +++ b/lib/cosProperty/src/cosProperty.erl @@ -0,0 +1,414 @@ +%%-------------------------------------------------------------------- +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +%% +%%---------------------------------------------------------------------- +%% File : cosProperty.erl +%% Purpose : +%%---------------------------------------------------------------------- + +-module(cosProperty). + +%%--------------- INCLUDES ----------------------------------- +-include("cosProperty.hrl"). +-include_lib("cosProperty/include/CosPropertyService.hrl"). + +%%--------------- EXPORTS------------------------------------- +%% cosProperty API external +-export([start/0, + start_SetDefFactory/0, + start_SetFactory/0, + stop_SetDefFactory/1, + stop_SetFactory/1, + stop/0, + install/0, + install/1, + install_db/0, + install_db/1, + install_db/2, + uninstall/0, + uninstall/1, + uninstall_db/0]). + +%% cosProperty API internal +-export([create_link/3, + get_option/3, + type_check/2, + query_result/1, + start_PropertiesIterator/1, + start_PropertyNamesIterator/1, + create_static_SetDef/2]). + +%% Application callbacks +-export([start/2, init/1, stop/1]). + +%%--------------- DEFINES ------------------------------------ + +-define(SUPERVISOR_NAME, oe_cosPropertySup). +-define(SUP_FLAG, {simple_one_for_one,50,10}). +-define(SUP_PROP_SPEC(T,I), + ['CosPropertyService_PropertiesIterator',I, + [{sup_child, true}, {regname, {global, T}}]]). +-define(SUP_NAMES_SPEC(T,I), + ['CosPropertyService_PropertyNamesIterator',I, + [{sup_child, true}, {regname, {global, T}}]]). +-define(SUP_CHILD, + {"oe_PropertyChild", + {cosProperty,create_link, []}, + transient,100000,worker, + []}). + +%%------------------------------------------------------------ +%% function : install +%% Arguments: - +%% Returns : ok | EXIT | EXCEPTION +%% Effect : Install necessary data in the IFR DB +%%------------------------------------------------------------ +install() -> + install([]). +install(_Options) -> + case catch oe_CosProperty:'oe_register'() of + ok -> + ok; + {'EXIT',{unregistered,App}} -> + ?write_ErrorMsg("Unable to register cosProperty; application ~p not registered.~n", + [App]), + exit({unregistered,App}); + {'EXCEPTION',_} -> + ?write_ErrorMsg("Unable to register cosProperty; propably already registered. +You are adviced to confirm this.~n", []), + exit({error, "Register in the IFR failed."}); + Reason -> + ?write_ErrorMsg("Unable to register cosProperty; reason ~p", [Reason]), + exit({error, "Register in the IFR failed."}) + end. + +%%------------------------------------------------------------ +%% function : install_db +%% Arguments: - +%% Returns : ok | EXIT | EXCEPTION +%% Effect : Install necessary data in the IFR DB +%%------------------------------------------------------------ +install_db() -> + install_db(infinity, []). +install_db(Timeout) -> + install_db(Timeout, []). +install_db(Timeout, Options) -> + case install_table(Timeout, Options) of + ok -> + ok; + {error, [DB_tables_created, Wait]} -> + ?write_ErrorMsg("Able to register cosProperty but failed adding table in mnesia (~p, ~p)", + [DB_tables_created, Wait]), + exit({error, "Adding data in mnesia failed."}); + Why -> + ?write_ErrorMsg("Able to register cosProperty but failed adding table in mnesia with reason ~p", + [Why]), + exit({error, "Adding data in mnesia failed."}) + end. + +%%------------------------------------------------------------ +%% function : install_table +%% Arguments: - +%% Returns : ok | {error, Data} +%% Effect : Install necessary data in mnesia +%%------------------------------------------------------------ +install_table(Timeout, Options) -> + %% Fetch a list of the defined tables to see if 'oe_CosPropertyService' + %% is defined. + AllTabs = mnesia:system_info(tables), + DB_tables_created = + case lists:member('oe_CosPropertyService', AllTabs) of + true -> + case lists:member({local_content, true}, + Options) of + true-> + mnesia:add_table_copy('oe_CosPropertyService', + node(), + ram_copies); + _-> + mnesia:create_table('oe_CosPropertyService',[{attributes, + record_info(fields, + 'oe_CosPropertyService')} + |Options]) + end; + _ -> + mnesia:create_table('oe_CosPropertyService',[{attributes, + record_info(fields, + 'oe_CosPropertyService')} + |Options]) + end, + Wait = mnesia:wait_for_tables(['oe_CosPropertyService'], Timeout), + %% Check if any error has occured yet. If there are errors, return them. + if + DB_tables_created == {atomic, ok}, + Wait == ok -> + ok; + true -> + {error, [DB_tables_created, Wait]} + end. + + +%%------------------------------------------------------------ +%% function : query_result +%% Arguments: - +%% Returns : error | Data +%% Effect : Check a read transaction +%%------------------------------------------------------------ +query_result(Qres) -> + case Qres of + {atomic, [Hres]} -> + Hres#oe_CosPropertyService.properties; + {atomic, [_Hres | _Tres]} -> + error; + {atomic, []} -> + error; + _Other -> + error + end. + +%%------------------------------------------------------------ +%% function : uninstall +%% Arguments: - +%% Returns : ok | EXIT | EXCEPTION +%% Effect : Remove data related to cosProperty from the IFR DB +%%------------------------------------------------------------ +uninstall() -> + uninstall([]). +uninstall(_Options) -> + application:stop(cosProperty), + oe_CosProperty:oe_unregister(). + +%%------------------------------------------------------------ +%% function : uninstall +%% Arguments: - +%% Returns : ok | EXIT | EXCEPTION +%% Effect : Remove data related to cosProperty from the IFR DB +%%------------------------------------------------------------ +uninstall_db() -> + application:stop(cosProperty), + case mnesia:delete_table('oe_CosPropertyService') of + {atomic, ok} -> + ok; + {aborted, _Reason} -> + exit({error, "Removing data from mnesia failed."}) + end. + +%%------------------------------------------------------------ +%% function : create_static_SetDef +%% Arguments: +%% Returns : +%% Effect : Starts or stops the cosProperty application. +%%------------------------------------------------------------ +create_static_SetDef(PropTypes, PropDefs) -> + InitProps = propertyDef2local(PropDefs, []), + 'CosPropertyService_PropertySetDef':oe_create({static, fixed_readonly, PropTypes, + PropDefs, InitProps, + ?PropertySetDef}, + [{pseudo, true}]). +propertyDef2local([#'CosPropertyService_PropertyDef' + {property_name = Name, + property_value = Value, + property_mode = fixed_readonly}|T], Acc) -> + propertyDef2local(T, [{Name, Value, fixed_readonly}|Acc]); +propertyDef2local([], Acc) -> + Acc; +propertyDef2local(_, _) -> + exit({error, "Bad Mode type supplied. Must be fixed_readonly"}). + +%%------------------------------------------------------------ +%% function : start/stop +%% Arguments: +%% Returns : +%% Effect : Starts or stops the cosProperty application. +%%------------------------------------------------------------ +start() -> + application:start(cosProperty). +stop() -> + application:stop(cosProperty). + + + +%%-----------------------------------------------------------% +%% function : start_SetDefFactory +%% Arguments: - +%% Returns : A PropertySetDefFactory reference. +%% Effect : +%%------------------------------------------------------------ +start_SetDefFactory() -> + 'CosPropertyService_PropertySetDefFactory':oe_create([], [{pseudo, true}]). + +%%-----------------------------------------------------------% +%% function : start_SetFactory +%% Arguments: - +%% Returns : A PropertySetFactory reference. +%% Effect : +%%------------------------------------------------------------ +start_SetFactory() -> + 'CosPropertyService_PropertySetFactory':oe_create([], [{pseudo, true}]). + +%%-----------------------------------------------------------% +%% function : stop_SetDefFactory +%% Arguments: Factory - A PropertySetDefFactory reference. +%% Returns : +%% Effect : +%%------------------------------------------------------------ +stop_SetDefFactory(Factory) -> + corba:dispose(Factory). + +%%-----------------------------------------------------------% +%% function : stop_SetFactory +%% Arguments: Factory - A PropertySetFactory reference. +%% Returns : +%% Effect : +%%------------------------------------------------------------ +stop_SetFactory(Factory) -> + corba:dispose(Factory). + +%%------------------------------------------------------------ +%% function : start +%% Arguments: Type - see module application +%% Arg - see module application +%% Returns : +%% Effect : Module callback for application +%%------------------------------------------------------------ +start(_, _) -> + supervisor:start_link({local, ?SUPERVISOR_NAME}, cosProperty, app_init). + + +%%------------------------------------------------------------ +%% function : stop +%% Arguments: Arg - see module application +%% Returns : +%% Effect : Module callback for application +%%------------------------------------------------------------ +stop(_) -> + ok. + +%%-----------------------------------------------------------% +%% function : init +%% Arguments: +%% Returns : +%% Effect : +%%------------------------------------------------------------ +%% Starting using create_factory/X +init(own_init) -> + {ok,{?SUP_FLAG, [?SUP_CHILD]}}; +%% When starting as an application. +init(app_init) -> + {ok,{?SUP_FLAG, [?SUP_CHILD]}}. + +%%-----------------------------------------------------------% +%% function : create_link +%% Arguments: Module - which Module to call +%% Env/ArgList - ordinary oe_create arguments. +%% Returns : +%% Exception: +%% Effect : Necessary since we want the supervisor to be a +%% 'simple_one_for_one'. Otherwise, using for example, +%% 'one_for_one', we have to call supervisor:delete_child +%% to remove the childs startspecification from the +%% supervisors internal state. +%%------------------------------------------------------------ +create_link(Module, Env, ArgList) -> + Module:oe_create_link(Env, ArgList). + +%%-----------------------------------------------------------% +%% function : start_PropertiesIterator +%% Arguments: +%% Returns : +%% Exception: +%% Effect : +%%------------------------------------------------------------ +start_PropertiesIterator(Args) -> + Name = create_name(propertiesIterator), + case supervisor:start_child(?SUPERVISOR_NAME, ?SUP_PROP_SPEC(Name, Args)) of + {ok, Pid, Obj} when is_pid(Pid) -> + Obj; + _Other-> + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) + end. + +%%-----------------------------------------------------------% +%% function : start_PropertyNamesIterator +%% Arguments: +%% Returns : +%% Exception: +%% Effect : +%%------------------------------------------------------------ +start_PropertyNamesIterator(Args) -> + Name = create_name(propertiesIterator), + case supervisor:start_child(?SUPERVISOR_NAME, ?SUP_NAMES_SPEC(Name, Args)) of + {ok, Pid, Obj} when is_pid(Pid) -> + Obj; + _Other-> + corba:raise(#'INTERNAL'{completion_status=?COMPLETED_NO}) + end. + + +%%-----------------------------------------------------------% +%% function : get_option +%% Arguments: +%% Returns : +%% Exception: +%% Effect : +%%------------------------------------------------------------ +get_option(Key, OptionList, DefaultList) -> + case lists:keysearch(Key, 1, OptionList) of + {value,{Key,Value}} -> + Value; + _ -> + case lists:keysearch(Key, 1, DefaultList) of + {value,{Key,Value}} -> + Value; + _-> + {error, "Invalid option"} + end + end. + +%%-----------------------------------------------------------% +%% function : type_check +%% Arguments: Obj - objectrefernce to test. +%% Mod - Module which contains typeID/0. +%% Returns : 'ok' or raises exception. +%% Effect : +%%------------------------------------------------------------ +type_check(Obj, Mod) -> + case catch corba_object:is_a(Obj,Mod:typeID()) of + true -> + ok; + _ -> + corba:raise(#'BAD_PARAM'{completion_status=?COMPLETED_NO}) + end. + + +%%-----------------------------------------------------------% +%% function : create_name/1 +%% Arguments: +%% Returns : +%% Exception: +%% Effect : +%%------------------------------------------------------------ +create_name(Type) -> + {MSec, Sec, USec} = erlang:now(), + lists:concat(['oe_',node(),'_',Type,'_',MSec, '_', Sec, '_', USec]). + +%%--------------- END OF MODULE ------------------------------ + + diff --git a/lib/cosProperty/src/cosProperty.hrl b/lib/cosProperty/src/cosProperty.hrl new file mode 100644 index 0000000000..2755b890c8 --- /dev/null +++ b/lib/cosProperty/src/cosProperty.hrl @@ -0,0 +1,81 @@ +%%---------------------------------------------------------------------- +%% +%% %CopyrightBegin% +%% +%% Copyright Ericsson AB 2000-2009. All Rights Reserved. +%% +%% The contents of this file are subject to the Erlang Public License, +%% Version 1.1, (the "License"); you may not use this file except in +%% compliance with the License. You should have received a copy of the +%% Erlang Public License along with this software. If not, it can be +%% retrieved online at http://www.erlang.org/. +%% +%% Software distributed under the License is distributed on an "AS IS" +%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%% the License for the specific language governing rights and limitations +%% under the License. +%% +%% %CopyrightEnd% +%% +%% +%%---------------------------------------------------------------------- +%% File : cosProperty.hrl +%% Purpose : +%%---------------------------------------------------------------------- + + +%%--------------- INCLUDES ----------------------------------- +%% External +-include_lib("orber/include/corba.hrl"). +-include_lib("orber/include/ifr_types.hrl"). + +%%----------------------------------------------------------------- +%% Mnesia Table definition record +%%----------------------------------------------------------------- +-record('oe_CosPropertyService', {key, properties}). + +%%----------------------------------------------------------------- +%% Macros +%%----------------------------------------------------------------- +-define(PropertySet, 0). +-define(PropertySetDef, 1). + +%% This macro returns a read fun suitable for evaluation in a transaction +-define(read_function(Objkey), + fun() -> + mnesia:read(Objkey) + end). + +%% This macro returns a write fun suitable for evaluation in a transaction +-define(write_function(R), + fun() -> + mnesia:write(R) + end). + +%% This macro returns a delete fun suitable for evaluation in a transaction +-define(delete_function(R), + fun() -> + mnesia:delete(R) + end). + +-define(query_check(Q_res), {atomic, Q_res}). + + +-define(write_ErrorMsg(Txt, Arg), +error_logger:error_msg("================ CosProperty ==============~n" + Txt + "===========================================~n", + Arg)). + + + +-ifdef(debug). +-define(debug_print(F,A), + io:format("[LINE: ~p MODULE: ~p] "++F,[?LINE, ?MODULE]++A)). +-define(property_TypeCheck(O,M), 'cosProperty':type_check(O,M)). +-else. +-define(debug_print(F,A), ok). +-define(property_TypeCheck(O,I), ok). +-endif. + +%%--------------- END OF MODULE ------------------------------ diff --git a/lib/cosProperty/vsn.mk b/lib/cosProperty/vsn.mk new file mode 100644 index 0000000000..0e55352e42 --- /dev/null +++ b/lib/cosProperty/vsn.mk @@ -0,0 +1,9 @@ +COSPROPERTY_VSN = 1.1.10 + +TICKETS = OTP-8201 + +TICKETS_1.1.9 = OTP-7987 + +TICKETS_1.1.8 = OTP-7837 + +TICKETS_1.1.7 = OTP-7595 |