stunnel-4.15/tools/stunnel.init
zurich/java/com/xensource/autogen/*.java
js/api.js
+java
ocaml/cdrommon/cdrommon
ocaml/console/console
ocaml/database/db_filter_lex.ml
ocaml/db_process/xapi-db-process
ocaml/db_process/xapi-db-upgrade-4.2
ocaml/doc/content
+ocaml/doc/api
+ocaml/doc/jsapi
+ocaml/doc/components.js
ocaml/events/event_listen
ocaml/fdhelper/closeandexec
ocaml/fdhelper/closeandexec_static
OCamlDocLibrary(name, modules) =
OCamlDoc($(name), $(modules), "library")
+#
+# Use Camlp4
+#
+UseCamlp4(packs, files) =
+ OCAMLPACKS += $(packs)
+ OCAMLFINDFLAGS += -syntax camlp4o
+ $(addsuffix .cmx, $(files)):
+ $(addsuffix .o, $(files)):
+ $(addsuffix .cmi, $(files)):
+ $(addsuffix .cmo, $(files)):
+
#
# Include the OMakefile in this directory.
#
BYTE_ENABLED = TRUE
OCamlLibrary(odoc_json, odoc_json)
+OCAML_LIBS += ../idl/datamodel
+OCAMLINCLUDES += ../idl
+OCamlProgram(jsapi, jsapi)
+
+.PHONY: doc
+doc: jsapi
+ mkdir -p api
+ ./jsapi
+
.PHONY: clean
clean:
rm -f *~ *.cmi *.cmx *.cmo *.a *.cma *.cmxa *.run *.opt *.annot *.o
- rm -rf components.js content
+ rm -rf components.js content jsapi
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*)
-
-open Datamodel_types
-open Stringext
-
-type change_t = lifecycle_change * string * string
-and changes_t = change_t list
-with rpc
let _ =
- let api = (Datamodel.all_api) in
+ let api = (* Datamodel_utils.add_implicit_messages *) (Datamodel.all_api) in
let objs = Dm_api.objects_of_api api in
let create_json obj =
- let name = obj.name in
- let s = Jsonrpc.to_string (rpc_of_obj obj) in
- Unixext.write_string_to_file ("api/" ^ name ^ ".json") ("clsdoc = " ^ s);
+ let name = obj.Datamodel_types.name in
+ let s = Jsonrpc.to_string (Datamodel_types.rpc_of_obj obj) in
+ Unixext.write_string_to_file ("api/" ^ name ^ ".json") s;
name
in
let names = List.map create_json objs in
let class_list = String.concat ", " (List.map (fun s -> "'" ^ s ^ "'") names) in
- Unixext.write_string_to_file "api/index.json" ("classes = [" ^ class_list ^ "]");
+ Unixext.write_string_to_file "api/index.json" ("classes = [" ^ class_list ^ "]")
- let changes_in_release rel =
- let search_obj obj =
- let changes = List.filter (fun (transition, release, doc) -> release = rel) obj.obj_lifecycle in
- let obj_changes : changes_t =
- List.map (fun (transition, release, doc) -> (transition, obj.name, doc)) changes in
-
- let changes_for_msg m =
- let changes = List.filter (fun (transition, release, doc) -> release = rel) m.msg_lifecycle in
- List.map (fun (transition, release, doc) -> (transition, m.msg_name, doc)) changes
- in
- let msgs = List.filter (fun m -> not m.msg_hide_from_docs) obj.messages in
- let msg_changes : changes_t = List.fold_left (fun l m -> l @ (changes_for_msg m)) [] msgs in
-
- let changes_for_field f =
- let changes = List.filter (fun (transition, release, doc) -> release = rel) f.lifecycle in
- let field_name = String.concat "_" f.full_name in
- List.map (fun (transition, release, doc) -> (transition, field_name, doc)) changes
- in
- let rec flatten_contents contents =
- List.fold_left (fun l -> function
- | Field f -> f :: l
- | Namespace (name, contents) -> flatten_contents contents @ l
- ) [] contents
- in
- let fields = flatten_contents obj.contents in
- let field_changes : changes_t = List.fold_left (fun l f -> l @ (changes_for_field f)) [] fields in
-
- "{'cls': '" ^ obj.name ^ "', 'obj_changes': " ^ Jsonrpc.to_string (rpc_of_changes_t obj_changes) ^ ", 'field_changes': " ^ Jsonrpc.to_string (rpc_of_changes_t field_changes) ^ ", 'msg_changes': " ^ Jsonrpc.to_string (rpc_of_changes_t msg_changes) ^ "}"
- in
- let release_info = String.concat ", " (List.map search_obj objs) in
- Unixext.write_string_to_file ("api/" ^ rel ^ ".json") ("release_info = [" ^ release_info ^ "]")
- in
- List.iter changes_in_release release_order;
- let release_list = String.concat ", " (List.map (fun s -> "'" ^ s ^ "'") release_order) in
- Unixext.write_string_to_file "api/releases.json" ("releases = [" ^ release_list ^ "]");
OCAMLINCLUDES = ocaml_backend ../database
OCAMLPACKS = xml-light2 sexpr log
+CAMLP4_FILES = datamodel_types
+
+UseCamlp4(rpc-light.syntax, $(CAMLP4_FILES))
+
# -----------------------------------------------------------------------
# Build datamodel library
# -----------------------------------------------------------------------
*)
+module Date = struct
+ include Date
+ let iso8601_of_rpc rpc = Date.of_string (Rpc.string_of_rpc rpc)
+ let rpc_of_iso8601 date = Rpc.rpc_of_string (Date.to_string date)
+end
+
(* useful constants for product vsn tracking *)
let oss_since_303 = Some "3.0.3"
let rel_george = "george"
| Map of ty * ty
| Ref of string
| Record of string
+ with rpc
type api_value =
VString of string
| VMap of (api_value*api_value) list
| VSet of api_value list
| VRef of string
-
+ with rpc
+
(** Each database field has a qualifier associated with it: *)
type qualifier =
| RW
| DynamicRO
(** Read-only database field whose value is computed dynamically and
not specified at the time of object construction. *)
-
+ with rpc
+
(** Release keeps track of which versions of opensource/internal products fields and messages are included in *)
type release = {
opensource: string list;
internal: string list;
internal_deprecated_since: string option; (* first release we said it was deprecated *)
-}
+} with rpc
(** Messages are tagged with one of these indicating whether the message was
specified explicitly in the datamodel, or is one of the automatically
msg_hide_from_docs: bool;
msg_allowed_roles: string list option;
msg_map_keys_roles: (string * (string list option)) list
-}
+}
and field = {
release: release;
field_setter_roles: string list option;
field_getter_roles: string list option;
field_map_keys_roles: (string * (string list option)) list
-}
+}
and error = {
err_name: string;
and mess = {
mess_name: string;
mess_doc: string;
-}
+} with rpc
(** Getters and Setters will be generated for each field, depending on the qualifier.
Namespaces allow fields to be grouped together (and this can get reflected in the XML
type content =
| Field of field (** An individual field *)
| Namespace of string * content list (** A nice namespace for a group of fields *)
-
+ with rpc
+
(* Note: there used be more than 2 persist_options -- that's why it isn't a bool.
I figured even though there's only 2 now I may as well leave it as an enumeration type.. *)
-type persist_option = PersistNothing | PersistEverything
+type persist_option = PersistNothing | PersistEverything with rpc
(* PersistEverything - all creates/writes persisted;
PersistNothing - no creates/writes to this table persisted *)
persist: persist_option;
obj_release: release;
in_database: bool (* If the object is in the database *)
- }
+ } with rpc
+
+(* val rpc_of_obj : obj -> Rpc.t *)
+(* let s = Jsonrpc.to_string (rpc_of_obj o) *)
(** A relation binds two fields together *)
type relation = (string * string) * (string * string)