Index: openacs-4/packages/acs-service-contract/acs-service-contract.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/acs-service-contract.info,v
diff -u -r1.11 -r1.12
--- openacs-4/packages/acs-service-contract/acs-service-contract.info 3 Feb 2003 12:17:21 -0000 1.11
+++ openacs-4/packages/acs-service-contract/acs-service-contract.info 25 Feb 2003 15:15:00 -0000 1.12
@@ -7,18 +7,18 @@
t
t
-
+
oracle
postgresql
- Kapil Thangavelu
Neophytos Demetriou
+ Kapil Thangavelu
Allows different packages to communicate via defined contracts
- 2003-01-31
+ 2003-02-05
OpenACS
-
+
@@ -63,6 +63,7 @@
+
Index: openacs-4/packages/acs-service-contract/tcl/acs-service-contract-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/acs-service-contract-procs.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/acs-service-contract/tcl/acs-service-contract-procs.tcl 3 Feb 2003 12:17:36 -0000 1.10
+++ openacs-4/packages/acs-service-contract/tcl/acs-service-contract-procs.tcl 25 Feb 2003 15:15:33 -0000 1.11
@@ -84,17 +84,19 @@
@author Neophytos Demetriou
} {
-
- set exists_p [util_memoize "acs_sc_binding_exists_p $contract $impl"]
-
+ # LARS
+ set exists_p [acs_sc_binding_exists_p $contract $impl]
+
+ #set exists_p [util_memoize "acs_sc_binding_exists_p $contract $impl"]
+
if ![set exists_p] {return ""}
-
+
db_0or1row get_alias {
select impl_alias, impl_pl
- from acs_sc_impl_aliases
- where impl_contract_name = :contract
- and impl_operation_name = :operation
- and impl_name = :impl
+ from acs_sc_impl_aliases
+ where impl_contract_name = :contract
+ and impl_operation_name = :operation
+ and impl_name = :impl
}
return [list $impl_alias $impl_pl]
Index: openacs-4/packages/acs-service-contract/tcl/contract-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/contract-procs-oracle.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-service-contract/tcl/contract-procs-oracle.xql 3 Feb 2003 12:17:36 -0000 1.1
+++ openacs-4/packages/acs-service-contract/tcl/contract-procs-oracle.xql 25 Feb 2003 15:15:33 -0000 1.2
@@ -1,20 +1,22 @@
- oracle8.1.7
+ oracle8.1.6
- select acs_sc_contract.new(
- :name,
- :description
- ) from dual
+ begin
+ :1 := acs_sc_contract.new(
+ :name,
+ :description
+ );
+ end;
- select acs_sc_contract.get_name(
+ acs_sc_contract.get_name(
:contract_id
) from dual
@@ -40,23 +42,27 @@
- select acs_sc_contract.delete(
- :name
- ) from dual
+ begin
+ acs_sc_contract.delete(
+ contract_name => :name
+ );
+ end;
- select acs_sc_operation.new(
- :contract_name,
- :operation,
- :description,
- :is_cachable_p,
- :nargs,
- :input_type_name,
- :output_type_name
- ) from dual
+ begin
+ :1 := acs_sc_operation.new(
+ :contract_name,
+ :operation,
+ :description,
+ :is_cachable_p,
+ :nargs,
+ :input_type_name,
+ :output_type_name
+ );
+ end;
@@ -71,10 +77,12 @@
- select acs_sc_operation.delete(
- :contract_name,
- :operation_name
- ) from dual
+ begin
+ acs_sc_operation.delete(
+ contract_name => :contract_name,
+ operation_name => :operation_name
+ );
+ end;
Index: openacs-4/packages/acs-service-contract/tcl/contract-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/contract-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-service-contract/tcl/contract-procs.tcl 3 Feb 2003 12:17:36 -0000 1.1
+++ openacs-4/packages/acs-service-contract/tcl/contract-procs.tcl 25 Feb 2003 15:15:33 -0000 1.2
@@ -33,7 +33,7 @@
@return id of the contract
} {
- return [db_string insert_sc_contract {}]
+ return [db_exec_plsql insert_sc_contract {}]
}
ad_proc -public acs_sc::contract::new_from_spec {
@@ -111,7 +111,7 @@
# LARS:
# It seems like delete by ID doesn't work, because our PG bind thing turns all integers into strings
# by wrapping them in single quotes, causing PG to invoke the function for deleting by name
- db_string delete_by_name {}
+ db_exec_plsql delete_by_name {}
}
}
@@ -183,7 +183,7 @@
db_1row select_names {}
}
- db_string delete_by_name {}
+ db_exec_plsql delete_by_name {}
}
ad_proc -public acs_sc::contract::operation::parse_operations_spec {
Index: openacs-4/packages/acs-service-contract/tcl/implementation-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/implementation-procs-oracle.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-service-contract/tcl/implementation-procs-oracle.xql 3 Feb 2003 12:17:36 -0000 1.1
+++ openacs-4/packages/acs-service-contract/tcl/implementation-procs-oracle.xql 25 Feb 2003 15:15:33 -0000 1.2
@@ -5,41 +5,49 @@
- select acs_sc_impl.new(
- :contract_name,
+ begin
+ :1 := acs_sc_impl.new(
+ :contract_name,
:name,
:owner
- ) from dual
+ );
+ end;
- select acs_sc_impl_alias.new(
+ begin
+ :1 := acs_sc_impl_alias.new(
:contract_name,
:impl_name,
:operation,
:alias,
:language
- ) from dual
+ );
+ end;
- select acs_sc_binding.alias_new(
- :contract_name,
- :impl_name
- ) from dual
+ begin
+ acs_sc_binding.new(
+ contract_name => :contract_name,
+ impl_name => :impl_name
+ );
+ end;
- select acs_sc_impl.delete(
- :contract_name,
- :impl_name
- ) from dual
+ begin
+ acs_sc_impl.delete(
+ impl_contract_name => :contract_name,
+ impl_name => :impl_name
+ );
+ end;
Index: openacs-4/packages/acs-service-contract/tcl/implementation-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/implementation-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-service-contract/tcl/implementation-procs.tcl 3 Feb 2003 12:17:36 -0000 1.1
+++ openacs-4/packages/acs-service-contract/tcl/implementation-procs.tcl 25 Feb 2003 15:15:33 -0000 1.2
@@ -26,7 +26,7 @@
@return the ID of the new implementation
} {
- return [db_string impl_new {}]
+ return [db_exec_plsql impl_new {}]
}
ad_proc -public acs_sc::impl::delete {
@@ -40,7 +40,7 @@
error "You must supply contract_name and impl_name"
}
- db_string delete_impl {}
+ db_exec_plsql delete_impl {}
}
ad_proc -public acs_sc::impl::new_from_spec {
@@ -75,6 +75,12 @@
return $impl_id
}
+ad_proc -public acs_sc::impl::get_id {
+ {-owner:required}
+ {-name:required}
+} {
+ return [db_string select_impl_id {}]
+}
@@ -96,7 +102,7 @@
@return the ID of the implementation
} {
- set impl_id [db_string alias_new {}]
+ set impl_id [db_exec_plsql alias_new {}]
}
ad_proc -private acs_sc::impl::alias::parse_aliases_spec {
@@ -163,23 +169,50 @@
Bind implementation to the contract. Bombs if not all operations
have aliases.
} {
- db_string binding_new {}
+ db_exec_plsql binding_new {}
}
-ad_proc -public acs_sc::impl::binding::init_procs {
+ad_proc -private acs_sc::impl::binding::init_procs {
{-impl_id:required}
} {
Initialize the procs so we can call the service contract.
+
+ Note that this proc doesn't really work, because it doesn't
+ initialize the aliases in all interpreters, only in one.
} {
+ # LARS:
+ # This is a hack to get around the problem with multiple interpreters:
+ # We ask the APM to reload the acs-service-contract-init file, which will
+ # redefine the service contract wrapper procs
+
+ set file "/packages/acs-service-contract/tcl/acs-service-contract-init.tcl"
+ apm_mark_files_for_reload -force_reload [list $file]
+
+ return
+
+ # LARS:
+ # This is the left-over stuff, which we could one day resurrect if we
+ # decide to implement an apm_eval feature, which can eval chunks of code
+ # in each interpreter. Then we could just say
+ # apm_eval "acs_sc::impl::binding::init_procs_internal -impl_id $impl_id"
+
+ # Get the list of aliases
db_foreach impl_operation {
select impl_contract_name,
impl_operation_name,
impl_name
from acs_sc_impl_aliases
where impl_id = :impl_id
- } {
- acs_sc_proc $impl_contract_name $impl_operation_name $impl_name
+ } -column_array row {
+ lappend rows [array get row]
}
+
+ # Register them
+ # Hm. We need to do this in all interpreters
+ foreach row_list $rows {
+ array set row $row_list
+ acs_sc_proc $row(impl_contract_name) $row(impl_operation_name) $row(impl_name)
+ }
}
Index: openacs-4/packages/acs-service-contract/tcl/implementation-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/implementation-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-service-contract/tcl/implementation-procs.xql 25 Feb 2003 15:15:33 -0000 1.1
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ select impl_id
+ from acs_sc_impls
+ where impl_owner_name = :owner
+ and impl_name = :name
+
+
+
+
Index: openacs-4/packages/acs-service-contract/tcl/msg-type-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/msg-type-procs-oracle.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-service-contract/tcl/msg-type-procs-oracle.xql 3 Feb 2003 12:17:36 -0000 1.1
+++ openacs-4/packages/acs-service-contract/tcl/msg-type-procs-oracle.xql 25 Feb 2003 15:15:33 -0000 1.2
@@ -1,33 +1,54 @@
- oracle8.1.7
+ oracle8.1.6
- select acs_sc_msg_type.new(
- :name,
- :specification
- ) from dual
+ begin
+ :1 := acs_sc_msg_type.new(
+ :name,
+ :specification
+ );
+ end;
- select acs_sc_msg_type.delete(
- :msg_type_id
- ) from dual
+ begin
+ acs_sc_msg_type.delete(
+ msg_type_id => :msg_type_id
+ );
+ end;
- select acs_sc_msg_type.delete(
- :name
- ) from dual
+ begin
+ acs_sc_msg_type.delete(
+ msg_type_name => :name
+ );
+ end;
+
+
+ begin
+ :1 := acs_sc_msg_type.new_element(
+ :msg_type_name,
+ :element_name,
+ :element_msg_type_name,
+ :element_msg_type_isset_p,
+ :element_pos
+ );
+ end;
+
+
+
+
Index: openacs-4/packages/acs-service-contract/tcl/msg-type-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/msg-type-procs-postgresql.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-service-contract/tcl/msg-type-procs-postgresql.xql 3 Feb 2003 12:17:36 -0000 1.1
+++ openacs-4/packages/acs-service-contract/tcl/msg-type-procs-postgresql.xql 25 Feb 2003 15:15:33 -0000 1.2
@@ -11,14 +11,6 @@
-
-
- select msg_type_name as name
- from acs_sc_msg_types
- where msg_type_id = :msg_type_id
-
-
-
select acs_sc_msg_type__delete(:name);
@@ -39,6 +31,3 @@
-
-
-
Index: openacs-4/packages/acs-service-contract/tcl/msg-type-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/msg-type-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-service-contract/tcl/msg-type-procs.tcl 3 Feb 2003 12:17:36 -0000 1.1
+++ openacs-4/packages/acs-service-contract/tcl/msg-type-procs.tcl 25 Feb 2003 15:15:33 -0000 1.2
@@ -43,7 +43,7 @@
db_1row select_name {}
}
- db_string delete_by_name {}
+ db_exec_plsql delete_by_name {}
}
ad_proc -public acs_sc::msg_type::parse_spec {
@@ -86,10 +86,10 @@
# Remove the 'multiple' flag
set flagsv [lreplace $flagsv $idx $idx]
set element_type "[lindex $flagsv 0]"
- set isset_p 1
+ set isset_p "t"
} else {
set element_type [lindex $flagsv 0]
- set isset_p 0
+ set isset_p "f"
}
acs_sc::msg_type::element::new \
Index: openacs-4/packages/acs-service-contract/tcl/msg-type-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-service-contract/tcl/msg-type-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-service-contract/tcl/msg-type-procs.xql 25 Feb 2003 15:15:33 -0000 1.1
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+ select msg_type_name as name
+ from acs_sc_msg_types
+ where msg_type_id = :msg_type_id
+
+
+
+