Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
acs-service-contract
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
project-open
acs-service-contract
Commits
c6dd1684
Commit
c6dd1684
authored
Dec 03, 2015
by
Frank Bergmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Comitting OpenACS 5.9
parent
084baa90
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
645 additions
and
382 deletions
+645
-382
acs-service-contract.info
acs-service-contract.info
+6
-7
acs-sc-msg-types-create.sql
sql/postgresql/acs-sc-msg-types-create.sql
+110
-63
acs-sc-packages-create.sql
sql/postgresql/acs-sc-packages-create.sql
+305
-167
upgrade-4.5.1-4.6.sql
sql/postgresql/upgrade/upgrade-4.5.1-4.6.sql
+21
-8
upgrade-4.7d2-4.7d3.sql
sql/postgresql/upgrade/upgrade-4.7d2-4.7d3.sql
+19
-10
upgrade-5.1.0d1-5.1.0d2.sql
sql/postgresql/upgrade/upgrade-5.1.0d1-5.1.0d2.sql
+79
-43
upgrade-5.3.1-5.4.0d1.sql
sql/postgresql/upgrade/upgrade-5.3.1-5.4.0d1.sql
+25
-5
acs-service-contract-init.tcl
tcl/acs-service-contract-init.tcl
+5
-7
acs-service-contract-procs.tcl
tcl/acs-service-contract-procs.tcl
+28
-30
contract-procs.tcl
tcl/contract-procs.tcl
+12
-11
implementation-procs.tcl
tcl/implementation-procs.tcl
+6
-6
msg-type-procs.tcl
tcl/msg-type-procs.tcl
+9
-5
binding-display.adp
www/binding-display.adp
+1
-1
binding-display.tcl
www/binding-display.tcl
+4
-4
binding-install.tcl
www/binding-install.tcl
+2
-2
binding-uninstall.tcl
www/binding-uninstall.tcl
+2
-2
contract-display.adp
www/contract-display.adp
+1
-1
index.html
www/doc/index.html
+1
-1
index.stx
www/doc/index.stx
+1
-1
index.xml
www/doc/index.xml
+1
-1
index.adp
www/index.adp
+7
-7
No files found.
acs-service-contract.info
View file @
c6dd1684
...
...
@@ -7,20 +7,19 @@
<initial-install-p>
t
</initial-install-p>
<singleton-p>
t
</singleton-p>
<version
name=
"5.
7.0"
url=
"http://openacs.org/repository/download/apm/acs-service-contract-5.7.0
.apm"
>
<version
name=
"5.
10.0d1"
url=
"http://openacs.org/repository/download/apm/acs-service-contract-5.10.0d1
.apm"
>
<owner
url=
"http://openacs.org"
>
OpenACS
</owner>
<summary>
API and UI for service contracts
</summary>
<release-date>
201
1-06-12
</release-date>
<release-date>
201
3-09-08
</release-date>
<maturity>
3
</maturity>
<vendor
url=
"http://openacs.org"
>
OpenACS
</vendor>
<description
format=
"text/html"
>
Service contracts defines an API for the creation of interfaces and discovery of interface implementations.
Examples are the contracts used for search which provide a means to get content on a given object and to translate an object_id to a
<description
format=
"text/html"
>
Service contracts defines an API for the creation of interfaces and discovery of interface implementations.
Examples are the contracts used for search which provide a means to get content on a given object and to translate an object_id to a
url or the contracts used by dotlrn and new-portals to allow packages to provide portalized panes.
</description>
<license>
GPL version 2
</license>
<maturity>
3
</maturity>
<provides
url=
"acs-service-contract"
version=
"5.
7.0
"
/>
<requires
url=
"acs-kernel"
version=
"5.
7.0
"
/>
<provides
url=
"acs-service-contract"
version=
"5.
10.0d1
"
/>
<requires
url=
"acs-kernel"
version=
"5.
10.0d1
"
/>
<callbacks>
</callbacks>
...
...
sql/postgresql/acs-sc-msg-types-create.sql
View file @
c6dd1684
...
...
@@ -42,22 +42,27 @@ create table acs_sc_msg_type_elements (
-- register function record
select
define_function_args
(
'acs_sc_msg_type__new'
,
'msg_type_name,msg_type_spec'
);
-- declare function
create
or
replace
function
acs_sc_msg_type__new
(
varchar
,
varchar
)
returns
integer
as
'
declare
p_msg_type_name alias for $1;
p_msg_type_spec alias for $2;
--
-- procedure acs_sc_msg_type__new/2
--
CREATE
OR
REPLACE
FUNCTION
acs_sc_msg_type__new
(
p_msg_type_name
varchar
,
p_msg_type_spec
varchar
)
RETURNS
integer
AS
$$
DECLARE
v_msg_type_id
integer
;
begin
BEGIN
v_msg_type_id
:
=
acs_object__new
(
null
,
'
'
acs_sc_msg_type
'
'
,
'
acs_sc_msg_type
'
,
now
(),
null
,
null
,
null
,
'
'
t
'
'
,
'
t
'
,
p_msg_type_name
,
null
);
...
...
@@ -74,17 +79,23 @@ begin
return
v_msg_type_id
;
end;'
language
'plpgsql'
;
END
;
$$
LANGUAGE
plpgsql
;
-- register function record
select
define_function_args
(
'acs_sc_msg_type__get_id'
,
'msg_type_name'
);
-- declare function
create
or
replace
function
acs_sc_msg_type__get_id
(
varchar
)
returns
integer
as
'
declare
p_msg_type_name alias for $1;
--
-- procedure acs_sc_msg_type__get_id/1
--
CREATE
OR
REPLACE
FUNCTION
acs_sc_msg_type__get_id
(
p_msg_type_name
varchar
)
RETURNS
integer
AS
$$
DECLARE
v_msg_type_id
integer
;
begin
BEGIN
select
msg_type_id
into
v_msg_type_id
from
acs_sc_msg_types
...
...
@@ -92,17 +103,23 @@ begin
return
v_msg_type_id
;
end;'
language
'plpgsql'
stable
strict
;
END
;
$$
LANGUAGE
plpgsql
stable
strict
;
-- register function record
select
define_function_args
(
'acs_sc_msg_type__get_name'
,
'msg_type_id'
);
-- declare function
create
or
replace
function
acs_sc_msg_type__get_name
(
integer
)
returns
varchar
as
'
declare
p_msg_type_id alias for $1;
--
-- procedure acs_sc_msg_type__get_name/1
--
CREATE
OR
REPLACE
FUNCTION
acs_sc_msg_type__get_name
(
p_msg_type_id
integer
)
RETURNS
varchar
AS
$$
DECLARE
v_msg_type_name
varchar
;
begin
BEGIN
select
msg_type_name
into
v_msg_type_name
from
acs_sc_msg_types
...
...
@@ -110,32 +127,48 @@ begin
return
v_msg_type_name
;
end;'
language
'plpgsql'
stable
strict
;
END
;
$$
LANGUAGE
plpgsql
stable
strict
;
create
or
replace
function
acs_sc_msg_type__delete
(
integer
)
returns
integer
as
'
declare
p_msg_type_id alias for $1;
begin
--
-- procedure acs_sc_msg_type__delete/1
--
CREATE
OR
REPLACE
FUNCTION
acs_sc_msg_type__delete
(
p_msg_type_id
integer
)
RETURNS
integer
AS
$$
DECLARE
BEGIN
delete
from
acs_sc_msg_types
where
msg_type_id
=
p_msg_type_id
;
return
0
;
end;'
language
'plpgsql'
;
END
;
$$
LANGUAGE
plpgsql
;
-- XXX: this might be a bug that it does not return 0 as the above does.
-- anyway now it is strict as being called with null is a noop and returns null
-- register function record
select
define_function_args
(
'acs_sc_msg_type__delete'
,
'msg_type_name'
);
-- old define_function_args('acs_sc_msg_type__delete','msg_type_name')
-- new
select
define_function_args
(
'acs_sc_msg_type__delete'
,
'msg_type_id'
);
-- declare function
create
or
replace
function
acs_sc_msg_type__delete
(
varchar
)
returns
integer
as
'
declare
p_msg_type_name alias for $1;
--
-- procedure acs_sc_msg_type__delete/1
--
CREATE
OR
REPLACE
FUNCTION
acs_sc_msg_type__delete
(
p_msg_type_name
varchar
)
RETURNS
integer
AS
$$
DECLARE
v_msg_type_id
integer
;
begin
BEGIN
v_msg_type_id
:
=
acs_sc_msg_type__get_id
(
p_msg_type_name
);
...
...
@@ -143,7 +176,8 @@ begin
return
v_msg_type_id
;
end;'
language
'plpgsql'
strict
;
END
;
$$
LANGUAGE
plpgsql
strict
;
...
...
@@ -152,28 +186,34 @@ end;' language 'plpgsql' strict;
-- register function record
select
define_function_args
(
'acs_sc_msg_type__new_element'
,
'msg_type_name,element_name,element_msg_type_name,element_msg_type_isset_p;f,element_pos'
);
-- declare function
create
or
replace
function
acs_sc_msg_type__new_element
(
varchar
,
varchar
,
varchar
,
boolean
,
integer
)
returns
integer
as
'
declare
p_msg_type_name alias for $1;
p_element_name alias for $2;
p_element_msg_type_name alias for $3;
p_element_msg_type_isset_p alias for $4;
p_element_pos alias for $5;
--
-- procedure acs_sc_msg_type__new_element/5
--
CREATE
OR
REPLACE
FUNCTION
acs_sc_msg_type__new_element
(
p_msg_type_name
varchar
,
p_element_name
varchar
,
p_element_msg_type_name
varchar
,
p_element_msg_type_isset_p
boolean
,
-- default 'f'
p_element_pos
integer
)
RETURNS
integer
AS
$$
DECLARE
v_msg_type_id
integer
;
v_element_msg_type_id
integer
;
begin
BEGIN
v_msg_type_id
:
=
acs_sc_msg_type__get_id
(
p_msg_type_name
);
if
v_msg_type_id
is
null
then
raise exception
'
'
Unknown Message Type: %
'
'
, p_msg_type_name;
raise
exception
'
Unknown Message Type: %
'
,
p_msg_type_name
;
end
if
;
v_element_msg_type_id
:
=
acs_sc_msg_type__get_id
(
p_element_msg_type_name
);
if
v_element_msg_type_id
is
null
then
raise exception
'
'
Unknown Message Type: %
'
'
, p_element_msg_type_name;
raise
exception
'
Unknown Message Type: %
'
,
p_element_msg_type_name
;
end
if
;
insert
into
acs_sc_msg_type_elements
(
...
...
@@ -192,18 +232,24 @@ begin
return
v_msg_type_id
;
end;'
language
'plpgsql'
;
END
;
$$
LANGUAGE
plpgsql
;
-- register function record
select
define_function_args
(
'acs_sc_msg_type__parse_spec'
,
'msg_type_name,msg_type_spec'
);
-- declare function
create
or
replace
function
acs_sc_msg_type__parse_spec
(
varchar
,
varchar
)
returns
integer
as
'
declare
p_msg_type_name alias for $1;
p_msg_type_spec alias for $2;
--
-- procedure acs_sc_msg_type__parse_spec/2
--
CREATE
OR
REPLACE
FUNCTION
acs_sc_msg_type__parse_spec
(
p_msg_type_name
varchar
,
p_msg_type_spec
varchar
)
RETURNS
integer
AS
$$
DECLARE
v_element
varchar
;
v_element_type
varchar
;
v_str_pos
integer
;
...
...
@@ -211,31 +257,31 @@ declare
v_element_msg_type_name
varchar
;
v_element_msg_type_isset_p
boolean
;
v_element_pos
integer
;
begin
BEGIN
v_element_pos
:
=
1
;
v_element := split(p_msg_type_spec,
'
'
,
'
'
, v_element_pos);
v_element
:
=
split
(
p_msg_type_spec
,
'
,
'
,
v_element_pos
);
while
v_element
is
not
null
loop
v_str_pos = instr(v_element,
'
'
:
'
'
, 1, 1);
v_str_pos
=
instr
(
v_element
,
'
:
'
,
1
,
1
);
if
v_str_pos
>
0
then
v_element_name
:
=
trim
(
substr
(
v_element
,
1
,
v_str_pos
-
1
));
v_element_type
:
=
trim
(
substr
(
v_element
,
v_str_pos
+
1
,
length
(
v_element
)
-
v_str_pos
));
if (instr(v_element_type,
'
'
[
'
'
,1,1) = length(v_element_type)-1) and
(instr(v_element_type,
'
'
]
'
'
,1,1) = length(v_element_type)) then
v_element_msg_type_isset_p :=
'
'
t
'
'
;
if
(
instr
(
v_element_type
,
'
[
'
,
1
,
1
)
=
length
(
v_element_type
)
-
1
)
and
(
instr
(
v_element_type
,
'
]
'
,
1
,
1
)
=
length
(
v_element_type
))
then
v_element_msg_type_isset_p
:
=
'
t
'
;
v_element_msg_type_name
:
=
trim
(
substr
(
v_element_type
,
1
,
length
(
v_element_type
)
-
2
));
if v_element_msg_type_name =
''
''
then
raise exception
'
'
Wrong Format: Message Type Specification
'
'
;
if
v_element_msg_type_name
=
''
then
raise
exception
'
Wrong Format: Message Type Specification
'
;
end
if
;
else
v_element_msg_type_isset_p :=
'
'
f
'
'
;
v_element_msg_type_isset_p
:
=
'
f
'
;
v_element_msg_type_name
:
=
v_element_type
;
end
if
;
else
raise exception
'
'
Wrong Format: Message Type Specification
'
'
;
raise
exception
'
Wrong Format: Message Type Specification
'
;
end
if
;
perform
acs_sc_msg_type__new_element
(
...
...
@@ -247,13 +293,14 @@ begin
);
v_element_pos
:
=
v_element_pos
+
1
;
v_element := split(p_msg_type_spec,
'
'
,
'
'
, v_element_pos);
v_element
:
=
split
(
p_msg_type_spec
,
'
,
'
,
v_element_pos
);
end
loop
;
return
v_element_pos
-
1
;
end;'
language
'plpgsql'
;
END
;
$$
LANGUAGE
plpgsql
;
...
...
sql/postgresql/acs-sc-packages-create.sql
View file @
c6dd1684
This diff is collapsed.
Click to expand it.
sql/postgresql/upgrade/upgrade-4.5.1-4.6.sql
View file @
c6dd1684
...
...
@@ -8,15 +8,27 @@
-- UPGRADE ISSUE #1
-- add more verbose error message
create
or
replace
function
acs_sc_binding__new
(
integer
,
integer
)
returns
integer
as
'
declare
p_contract_id alias for $1;
p_impl_id alias for $2;
-- added
-- old define_function_args('acs_sc_binding__new','contract_id,impl_id')
-- new
select
define_function_args
(
'acs_sc_binding__new'
,
'contract_id,impl_id'
);
--
-- procedure acs_sc_binding__new/2
--
CREATE
OR
REPLACE
FUNCTION
acs_sc_binding__new
(
p_contract_id
integer
,
p_impl_id
integer
)
RETURNS
integer
AS
$$
DECLARE
v_contract_name
varchar
;
v_impl_name
varchar
;
v_count
integer
;
begin
BEGIN
v_contract_name
:
=
acs_sc_contract__get_name
(
p_contract_id
);
v_impl_name
:
=
acs_sc_impl__get_name
(
p_impl_id
);
...
...
@@ -30,7 +42,7 @@ begin
and
impl_id
=
p_impl_id
);
if
v_count
>
0
then
raise exception
'
'
Binding of % to % failed since certain operations are not implemented.
'
'
, v_contract_name, v_impl_name;
raise
exception
'
Binding of % to % failed since certain operations are not implemented.
'
,
v_contract_name
,
v_impl_name
;
end
if
;
insert
into
acs_sc_bindings
(
...
...
@@ -43,5 +55,6 @@ begin
return
0
;
end;'
language
'plpgsql'
;
END
;
$$
LANGUAGE
plpgsql
;
sql/postgresql/upgrade/upgrade-4.7d2-4.7d3.sql
View file @
c6dd1684
...
...
@@ -9,19 +9,27 @@ alter table acs_sc_impls add column impl_pretty_name varchar(200);
update
acs_sc_impls
set
impl_pretty_name
=
impl_name
;
create
or
replace
function
acs_sc_impl__new
(
varchar
,
varchar
,
varchar
,
varchar
)
returns
integer
as
'
declare
p_impl_contract_name alias for $1;
p_impl_name alias for $2;
p_impl_pretty_name alias for $3;
p_impl_owner_name alias for $4;
-- added
select
define_function_args
(
'acs_sc_impl__new'
,
'impl_contract_name,impl_name,impl_pretty_name,impl_owner_name'
);
--
-- procedure acs_sc_impl__new/4
--
CREATE
OR
REPLACE
FUNCTION
acs_sc_impl__new
(
p_impl_contract_name
varchar
,
p_impl_name
varchar
,
p_impl_pretty_name
varchar
,
p_impl_owner_name
varchar
)
RETURNS
integer
AS
$$
DECLARE
v_impl_id
integer
;
begin
BEGIN
v_impl_id
:
=
acs_object__new
(
null
,
'
'
acs_sc_implementation
'
'
,
'
acs_sc_implementation
'
,
now
(),
null
,
null
,
...
...
@@ -44,7 +52,8 @@ begin
return
v_impl_id
;
end;'
language
'plpgsql'
;
END
;
$$
LANGUAGE
plpgsql
;
drop
view
valid_uninstalled_bindings
;
...
...
sql/postgresql/upgrade/upgrade-5.1.0d1-5.1.0d2.sql
View file @
c6dd1684
...
...
@@ -26,22 +26,30 @@ where object_type = 'acs_sc_implementation';
drop
function
acs_sc_msg_type__new
(
varchar
,
varchar
);
create
or
replace
function
acs_sc_msg_type__new
(
varchar
,
varchar
)
returns
integer
as
'
declare
p_msg_type_name alias for $1;
p_msg_type_spec alias for $2;
-- added
select
define_function_args
(
'acs_sc_msg_type__new'
,
'msg_type_name,msg_type_spec'
);
--
-- procedure acs_sc_msg_type__new/2
--
CREATE
OR
REPLACE
FUNCTION
acs_sc_msg_type__new
(
p_msg_type_name
varchar
,
p_msg_type_spec
varchar
)
RETURNS
integer
AS
$$
DECLARE
v_msg_type_id
integer
;
begin
BEGIN
v_msg_type_id
:
=
acs_object__new
(
null
,
'
'
acs_sc_msg_type
'
'
,
'
acs_sc_msg_type
'
,
now
(),
null
,
null
,
null
,
'
'
t
'
'
,
'
t
'
,
p_msg_type_name
,
null
);
...
...
@@ -58,28 +66,37 @@ begin
return
v_msg_type_id
;
end;'
language
'plpgsql'
;
END
;
$$
LANGUAGE
plpgsql
;
drop
function
acs_sc_contract__new
(
varchar
,
text
);
create
or
replace
function
acs_sc_contract__new
(
varchar
,
text
)
returns
integer
as
'
declare
p_contract_name alias for $1;
p_contract_desc alias for $2;
-- added
select
define_function_args
(
'acs_sc_contract__new'
,
'contract_name,contract_desc'
);
--
-- procedure acs_sc_contract__new/2
--
CREATE
OR
REPLACE
FUNCTION
acs_sc_contract__new
(
p_contract_name
varchar
,
p_contract_desc
text
)
RETURNS
integer
AS
$$
DECLARE
v_contract_id
integer
;
begin
BEGIN
v_contract_id
:
=
acs_object__new
(
null
,
'
'
acs_sc_contract
'
'
,
'
acs_sc_contract
'
,
now
(),
null
,
null
,
null
,
'
'
t
'
'
,
'
t
'
,
p_contract_name
,
null
);
...
...
@@ -96,38 +113,47 @@ begin
return
v_contract_id
;
end;'
language
'plpgsql'
;
END
;
$$
LANGUAGE
plpgsql
;
drop
function
acs_sc_operation__new
(
varchar
,
varchar
,
text
,
boolean
,
integer
,
varchar
,
varchar
);
create
or
replace
function
acs_sc_operation__new
(
varchar
,
varchar
,
text
,
boolean
,
integer
,
varchar
,
varchar
)
returns
integer
as
'
declare
p_contract_name alias for $1;
p_operation_name alias for $2;
p_operation_desc alias for $3;
p_operation_iscachable_p alias for $4;
p_operation_nargs alias for $5;
p_operation_inputtype alias for $6;
p_operation_outputtype alias for $7;
-- added
select
define_function_args
(
'acs_sc_operation__new'
,
'contract_name,operation_name,operation_desc,operation_iscachable_p,operation_nargs,operation_inputtype,operation_outputtype'
);
--
-- procedure acs_sc_operation__new/7
--
CREATE
OR
REPLACE
FUNCTION
acs_sc_operation__new
(
p_contract_name
varchar
,
p_operation_name
varchar
,
p_operation_desc
text
,
p_operation_iscachable_p
boolean
,
p_operation_nargs
integer
,
p_operation_inputtype
varchar
,
p_operation_outputtype
varchar
)
RETURNS
integer
AS
$$
DECLARE
v_contract_id
integer
;
v_operation_id
integer
;
v_operation_inputtype_id
integer
;
v_operation_outputtype_id
integer
;
begin
BEGIN
v_contract_id
:
=
acs_sc_contract__get_id
(
p_contract_name
);
v_operation_id
:
=
acs_object__new
(
null
,
'
'
acs_sc_operation
'
'
,
'
acs_sc_operation
'
,
now
(),
null
,
null
,
null
,
'
'
t
'
'
,
'
t
'
,
p_operation_name
,
null
);
...
...
@@ -160,30 +186,39 @@ begin
return
v_operation_id
;
end;'
language
'plpgsql'
;
END
;
$$
LANGUAGE
plpgsql
;
drop
function
acs_sc_impl__new
(
varchar
,
varchar
,
varchar
,
varchar
);
create
or
replace
function
acs_sc_impl__new
(
varchar
,
varchar
,
varchar
,
varchar
)
returns
integer
as
'
declare
p_impl_contract_name alias for $1;
p_impl_name alias for $2;
p_impl_pretty_name alias for $3;
p_impl_owner_name alias for $4;
-- added
select
define_function_args
(
'acs_sc_impl__new'
,
'impl_contract_name,impl_name,impl_pretty_name,impl_owner_name'
);
--
-- procedure acs_sc_impl__new/4
--
CREATE
OR
REPLACE
FUNCTION
acs_sc_impl__new
(
p_impl_contract_name
varchar
,
p_impl_name
varchar
,
p_impl_pretty_name
varchar
,
p_impl_owner_name
varchar
)
RETURNS
integer
AS
$$
DECLARE
v_impl_id
integer
;
begin
BEGIN
v_impl_id
:
=
acs_object__new
(
null
,
'
'
acs_sc_implementation
'
'
,
'
acs_sc_implementation
'
,
now
(),
null
,
null
,
null
,
'
'
t
'
'
,
'
t
'
,
p_impl_pretty_name
,
null
);
...
...
@@ -204,4 +239,5 @@ begin
return
v_impl_id
;
end;'
language
'plpgsql'
;
END
;
$$
LANGUAGE
plpgsql
;
sql/postgresql/upgrade/upgrade-5.3.1-5.4.0d1.sql
View file @
c6dd1684
...
...
@@ -15,7 +15,11 @@ select define_function_args('acs_sc_contract__get_id','contract_name');
select
define_function_args
(
'acs_sc_contract__get_name'
,
'contract_id'
);
-- acs_sc_contract__delete(varchar)
select
define_function_args
(
'acs_sc_contract__delete'
,
'contract_name'
);
-- old define_function_args('acs_sc_contract__delete','contract_name')
-- new
select
define_function_args
(
'acs_sc_contract__delete'
,
'contract_id'
);
-- acs_sc_operation__new(varchar,varchar,text,boolean,integer,varchar,varchar)
select
define_function_args
(
'acs_sc_operation__new'
,
'contract_name,operation_name,operation_desc,operation_iscachable_p;f,operation_nargs,operation_inputtype,operation_outputtype'
);
...
...
@@ -24,7 +28,11 @@ select define_function_args('acs_sc_operation__new','contract_name,operation_nam
select
define_function_args
(
'acs_sc_operation__get_id'
,
'contract_name,operation_name'
);
-- acs_sc_operation__delete(integer)
select
define_function_args
(
'acs_sc_operation__delete'
,
'operation_id'
);
-- old define_function_args('acs_sc_operation__delete','operation_id')
-- new
select
define_function_args
(
'acs_sc_operation__delete'
,
'contract_name,operation_name'
);
-- acs_sc_impl__new(varchar,varchar,varchar,varchar)
select
define_function_args
(
'acs_sc_impl__new'
,
'impl_contract_name,impl_name,impl_pretty_name,impl_owner_name'
);
...
...
@@ -45,10 +53,18 @@ select define_function_args('acs_sc_impl_alias__new','impl_contract_name,impl_na
select
define_function_args
(
'acs_sc_impl_alias__delete'
,
'impl_contract_name,impl_name,impl_operation_name'
);
-- acs_sc_binding__new(varchar,varchar)
select
define_function_args
(
'acs_sc_binding__new'
,
'contract_name,impl_name'
);
-- old define_function_args('acs_sc_binding__new','contract_name,impl_name')
-- new
select
define_function_args
(
'acs_sc_binding__new'
,
'contract_id,impl_id'
);
-- acs_sc_binding__delete(varchar,varchar)
select
define_function_args
(
'acs_sc_binding__delete'
,
'contract_name,impl_name'
);
-- old define_function_args('acs_sc_binding__delete','contract_name,impl_name')
-- new
select
define_function_args
(
'acs_sc_binding__delete'
,
'contract_id,impl_id'
);
-- acs_sc_binding__exists_p(varchar,varchar)
select
define_function_args
(
'acs_sc_binding__exists_p'
,
'contract_name,impl_name'
);
...
...
@@ -65,7 +81,11 @@ select define_function_args('acs_sc_msg_type__get_id','msg_type_name');
select
define_function_args
(
'acs_sc_msg_type__get_name'
,
'msg_type_id'
);
-- acs_sc_msg_type__delete(varchar)
select
define_function_args
(
'acs_sc_msg_type__delete'
,
'msg_type_name'
);
-- old define_function_args('acs_sc_msg_type__delete','msg_type_name')
-- new
select
define_function_args
(
'acs_sc_msg_type__delete'
,
'msg_type_id'
);
-- acs_sc_msg_type__new_element(varchar,varchar,varchar,boolean,integer)
select
define_function_args
(
'acs_sc_msg_type__new_element'
,
'msg_type_name,element_name,element_msg_type_name,element_msg_type_isset_p;f,element_pos'
);
...
...
tcl/acs-service-contract-init.tcl
View file @
c6dd1684
...
...
@@ -9,13 +9,11 @@ db_foreach impl_operation {
acs_sc_impl_aliases ia
where ia.impl_id = b.impl_id
}
{
# fraber 130717:
# Fixed broken LDAP issue, because a database error in one entry
# stopped the processing of all other entries
# This creates the AcsSc.Contract.Operation.Impl wrapper proc for this implementation
if
{[
catch
{
# This creates the AcsSc.Contract.Operation.Impl wrapper proc for this implementation
acs_sc_proc
$impl
_contract_name
$impl
_operation_name
$impl
_name
$impl
_alias
$impl
_pl
}
err_msg
]}
{
ns_log error
[
ad_log_stack_trace
]
acs_sc_proc
$impl
_contract_name
$impl
_operation_name
$impl
_name
$impl
_alias
$impl
_pl
}
errorMsg
]}
{
ns_log error
"Service contract initialization failed, call was:
\n\
acs_sc_proc
$impl
_contract_name
$impl
_operation_name
$impl
_name
$impl
_alias
$impl
_pl"
}
}
tcl/acs-service-contract-procs.tcl
View file @
c6dd1684
...
...
@@ -22,11 +22,12 @@ ad_proc -public acs_sc::invoke {
{
-call_args
{}}
{
-error:boolean
}
}
{
A wrapper for the acs_sc_call procedure, with explicitly named
parameters so it's easier to figure out how to use it.
You must supply either contract and impl, or just impl_id.
A replacement of the former acs_sc_call procedure.
One must supply either contract and impl, or just impl_id.
If you supply impl_id and contract, we throw an error if the impl_id's contract doesn't match
the contract you passed in. If you supply both impl_id and impl, we throw an error.
Additional documentation and commentary at http://openacs.org/forums/message-view?message_id=108614.
@param contract_name The name of the contract you wish to use.
@param operation_name The name of the operation in the contract you wish to call.
...
...
@@ -34,12 +35,13 @@ ad_proc -public acs_sc::invoke {
@param impl_id The ID of the implementation you wish to use.
@param args The arguments you want to pass to the proc.
@param error If specified, will throw an error if the operation isn't implemented.
@author Lars Pind
(
lars@collaboraid.biz
)
@see acs_sc_call
}
{
if
{
[
exists_and_not_null impl_id
]
}
{
if
{
[
exists_and_not_null impl
]
}
{
if
{
$impl
_id ne
""
}
{
if
{
$impl
ne
""
}
{
error
"Cannot supply both impl and impl_id"
}
acs_sc::impl::get -impl_id
$impl
_id -array impl_info
...
...
@@ -49,10 +51,22 @@ ad_proc -public acs_sc::invoke {
}
set contract
$impl
_info
(
impl_contract_name
)
}
if
{
!
[
exists_and_not_null impl
]
|| !
[
exists_and_not_null contract
]
}
{
if
{
$impl
eq
""
||
$contract
eq
""
}
{
error
"You must supply either impl_id, or contract and impl to acs_sc::invoke"
}
return
[
acs_sc_call -error=$error_p
$contract
$operation
$call
_args
$impl
]
set proc_name
[
acs_sc_generate_name
$contract
$impl
$operation
]
if
{
[
info
commands
$proc
_name
]
ne
""
}
{
return
[
ad_apply
$proc
_name
$call
_args
]
}
if
{
$error
_p
}
{
error
"Operation
$operation
is not implemented in '
$impl
' implementation of contract '
$contract
'"
}
else
{
ns_log warning
"ACS-SC: Function Not Found:
$proc
_name
[
info
commands
$proc
_name
]
"
}
return
}
...
...
@@ -108,7 +122,7 @@ ad_proc -private acs_sc_get_alias {
# LARS
set exists_p
[
acs_sc_binding_exists_p
$contract
$impl
]
#set exists_p
[
util_memoize
"acs_sc_binding_exists_p
$contract
$impl
"
]
#set exists_p
[
util_memoize
[
list
acs_sc_binding_exists_p
$contract
$impl
]
]
if
{
!
[
set
exists_p
]}
{
return
""
}
...
...
@@ -118,9 +132,6 @@ ad_proc -private acs_sc_get_alias {
}
ad_proc -private acs_sc_proc
{
contract
operation
...
...
@@ -128,7 +139,7 @@ ad_proc -private acs_sc_proc {
{
impl_alias
{}}
{
impl_pl
{}}
}
{
Builds the proc used by acs_sc
_call
, generally only called
Builds the proc used by acs_sc
::invoke
, generally only called
in acs-service-contract-init.tcl at startup.
@return 0 on failure, 1 on success.
...
...
@@ -142,7 +153,7 @@ ad_proc -private acs_sc_proc {
acs_sc_log SCDebug
"ACS_SC_PROC: proc_name =
$proc
_name"
if
{
$impl
_alias eq
""
}
{
foreach
{
impl_alias impl_pl
}
[
acs_sc_get_alias
$contract
$operation
$impl
]
break
lassign
[
acs_sc_get_alias
$contract
$operation
$impl
]
impl_alias impl_pl
}
if
{
$impl
_alias eq
""
}
{
...
...
@@ -154,7 +165,7 @@ ad_proc -private acs_sc_proc {
return 0
}
append docblock
"
\n
<b>acs-service-contract operation. Call via acs_sc
_call
.</b>
\n\n
$operation
_desc
\n\n
"
append docblock
"
\n
<b>acs-service-contract operation. Call via acs_sc
::invoke
.</b>
\n\n
$operation
_desc
\n\n
"
db_foreach operation_inputtype_element
{
*SQL*
}
{
lappend arguments
"
$element
_name"
...
...
@@ -171,7 +182,7 @@ ad_proc -private acs_sc_proc {
}
}
append docblock
"
\n
@see
$impl
_alias
\n
@see acs_sc
_call
"
append docblock
"
\n
@see
$impl
_alias
\n
@see acs_sc
::invoke
"
set full_statement
[
acs_sc_get_statement
$impl
_alias
$impl
_pl
$arguments
]
...
...
@@ -230,9 +241,6 @@ ad_proc -private acs_sc_get_statement {
return
$full
_statement
}
ad_proc -private -deprecated acs_sc_call
{
{
-error:boolean
}
contract
...
...
@@ -252,19 +260,9 @@ ad_proc -private -deprecated acs_sc_call {
@see acs_sc::invoke
}
{
set proc_name
[
acs_sc_generate_name
$contract
$impl
$operation
]
acs_sc::invoke -contract
$contract
-operation
$operation
-impl
$impl
-call_args
$arguments
-error=$error_p
}
if
{
[
llength
[
info
procs
$proc
_name
]]
== 1
}
{
return
[
ad_apply
$proc
_name
$arguments
]
}
else
{
if
{
$error
_p
}
{
error
"Operation
$operation
is not implemented in '
$impl
' implementation of contract '
$contract
'"
}
else
{
ns_log warning
"ACS-SC: Function Not Found:
$proc
_name
[
info
procs
$proc
_name
]
"
}
return
}
}
##
...
...
tcl/contract-procs.tcl
View file @
c6dd1684
...
...
@@ -134,8 +134,8 @@ ad_proc -public acs_sc::contract::new_from_spec {
}
ad_proc -public acs_sc::contract::delete
{
{
-contract_id
}
{
-name
}
{
-contract_id
""
}
{
-name
""
}
{
-no_cascade:boolean
}
}
{
Delete a service contract definition. Supply either contract_id or name.
...
...
@@ -143,15 +143,15 @@ ad_proc -public acs_sc::contract::delete {
@param contract_id The ID of the service contract to delete
@param name Name of the service contract to delete
}
{
if
{
!
[
exists_and_not_null contract_id
]
&& !
[
exists_and_not_null name
]
}
{
if
{
$contract
_id eq
""
&&
$name
eq
""
}
{
error
"You must supply either name or contract_id"
}
db_transaction
{
# Need both name and ID below
if
{
!
[
exists_and_not_null name
]
}
{
if
{
(
!
[
info
exists name
]
||
$name
eq
""
)
}
{
set name
[
db_string get_name_by_id
{}]
}
else
if
{
!
[
exists_and_not_null contract_id
]
}
{
}
else
if
{
(
!
[
info
exists contract_id
]
||
$contract
_id eq
""
)
}
{
set contract_id
[
db_string get_id_by_name
{}]
}
...
...
@@ -246,16 +246,17 @@ ad_proc -public acs_sc::contract::operation::new {
}
ad_proc -public acs_sc::contract::operation::delete
{
{
-operation_id
}
{
-contract_name
}
{
-operation_name
}
{
-operation_id
""
}
{
-contract_name
""
}
{
-operation_name
""
}
}
{
Delete a message type. Supply either ID or name.
@param msg_type_id The ID of the msg_type to delete.
@param name Name of the service contract to delete
}
{
if
{
!
[
exists_and_not_null operation_id
]
&&
(
!
[
exists_and_not_null contract_name
]
|| !
[
exists_and_not_null operation_name
]
)
}
{
if
{
$operation
_id eq
""
&&
(
$contract
_name eq
""
||
$operation
_name eq
""
)
}
{
error
"You must supply either contract_name and operation_name, or operation_id"
}
...
...
@@ -263,7 +264,7 @@ ad_proc -public acs_sc::contract::operation::delete {
# 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
if
{
!
[
exists_and_not_null contract_name
]
|| !
[
exists_and_not_null operation_name
]
}
{
if
{
$contract
_name eq
""
||
$operation
_name eq
""
}
{
# get contract_name and operation_name
db_1row select_names
{}
}
...
...
@@ -277,7 +278,7 @@ ad_proc -public acs_sc::contract::operation::parse_operations_spec {
}
{
Parse the operations defined in the operations specification
@param name Name of the contract
@spec spec Specification of all the operations
@
param
spec spec Specification of all the operations
}
{
foreach
{
operation subspec
}
$spec
{
acs_sc::contract::operation::parse_spec
\
...
...
tcl/implementation-procs.tcl
View file @
c6dd1684
...
...
@@ -45,7 +45,7 @@ ad_proc -public acs_sc::impl::delete {
Delete a service contract implementation
}
{
if
{
!
[
exists_and_not_null contract_name
]
|| !
[
exists_and_not_null impl_name
]
}
{
if
{
$contract
_name eq
""
||
$impl
_name eq
""
}
{
error
"You must supply contract_name and impl_name"
}
...
...
@@ -102,7 +102,7 @@ ad_proc -public acs_sc::impl::new_from_spec {
# Spec contains: contract_name, name, pretty_name, owner, aliases
array set impl
$spec
if
{
!
[
exists_and_not_null
impl
(
pretty_name
)]
}
{
if
{
!
[
info
exists
impl
(
pretty_name
)]
}
{
set impl
(
pretty_name
)
""
}
...
...
@@ -147,10 +147,10 @@ ad_proc -public acs_sc::impl::get_id {
a service contract,
if the contract is not specified.
}
{
if
{
[
exists_and_not_null contract
]
}
{
return
[
db_string select_impl_id_with_contract
{}
-default
""
]
if
{
([
info
exists contract
]
&&
$contract
ne
""
)
}
{
return
[
db_string select_impl_id_with_contract
{}]
}
else
{
return
[
db_string select_impl_id
{}
-default
""
]
return
[
db_string select_impl_id
{}]
}
}
...
...
@@ -204,7 +204,7 @@ ad_proc -public acs_sc::impl::get_options {
# There are exclude names
foreach element
$full
_list
{
set impl_name
[
lindex
$element
0
]
if
{
[
lsearch
-exact
$exclude
_names
$impl
_name
]
== -1
}
{
if
{
$impl
_name ni
$exclude
_names
}
{
# Name is not in exclude list so add option
lappend impl_list
$element
}
...
...
tcl/msg-type-procs.tcl
View file @
c6dd1684
...
...
@@ -20,15 +20,15 @@ ad_proc -public acs_sc::msg_type::new {
}
ad_proc -public acs_sc::msg_type::delete
{
{
-msg_type_id
}
{
-name
}
{
-msg_type_id
""
}
{
-name
""
}
}
{
Delete a message type. Supply either ID or name.
@param msg_type_id The ID of the msg_type to delete.
@param name Name of the service contract to delete
}
{
if
{
!
[
exists_and_not_null msg_type_id
]
&& !
[
exists_and_not_null name
]
}
{
if
{
$msg
_type_id eq
""
&&
$name
eq
""
}
{
error
"You must supply either name or msg_type_id"
}
...
...
@@ -36,9 +36,13 @@ ad_proc -public acs_sc::msg_type::delete {
# 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
if
{
!
[
exists_and_not_null name
]
}
{
if
{
$name
eq
""
)
}
{
# get msg_type name
db_1row select_name
{}
db_1row select_name
{
select msg_type_name as name
from acs_sc_msg_types
where msg_type_id = :msg_type_id
}
}
db_exec_plsql delete_by_name
{}
...
...
www/binding-display.adp
View file @
c6dd1684
<master>
<property name="
title
">Contract @contract_name;noquote@</property>
<property name="
doc(title)
">Contract @contract_name;noquote@</property>
<property name="context">{@contract_name;noquote@}</property>
<h2>Binding @contract_name@</h2>
...
...
www/binding-display.tcl
View file @
c6dd1684
...
...
@@ -50,10 +50,10 @@ db_multirow -extend {check} binding binding {
}
{
if
{
$impl
_pl eq
"TCL"
}
{
regsub
{
^::
}
$impl
_alias
{}
impl_alias
if
{[
info
proc
::$impl_alias
]
ne
""
}
{
if
{[
info
commands
::$impl_alias
]
ne
""
}
{
append impl_alias
"</b> {
[
info
args ::$impl_alias
]
}"
}
else
if
{[
llength
$impl
_alias
]
>
1
&&
[
info
command ::xotcl::Object
]
ne
""
}
else
if
{[
llength
$impl
_alias
]
>
1
&&
[
info
command
s
::xotcl::Object
]
ne
""
&&
[
::xotcl::Object isobject
[
lindex
$impl
_alias 0
]]
&&
[[
lindex
$impl
_alias 0
]
info methods
[
lindex
$impl
_alias 1
]]
ne
""
}
{
# - it looks like a method,
...
...
@@ -62,7 +62,7 @@ db_multirow -extend {check} binding binding {
# - the second word is a method for the object,
# ... so provide a link to the XOTcl api browser
set href
"/xotcl/show-object?object=
[
lindex
$impl
_alias 0
]
&show_methods=2"
append impl_alias
"<a href='
$href
'>"
\
append impl_alias
"<a href='
[
ns_quotehtml
$href
]
'>"
\
"<img border='0' src='/resources/acs-subsite/ZoomIn16.gif'></a>"
}
else
{
append impl_alias
{
</b> - <b style=
"color: red"
>NOT FOUND!</b>
}
...
...
www/binding-install.tcl
View file @
c6dd1684
...
...
@@ -3,8 +3,8 @@ ad_page_contract {
@author Neophytos Demetriou
}
{
contract_id:
integer
impl_id:
integer
contract_id:
naturalnum,notnull
impl_id:
naturalnum,notnull
}
...
...
www/binding-uninstall.tcl
View file @
c6dd1684
...
...
@@ -3,8 +3,8 @@ ad_page_contract {
@author Neophytos Demetriou
}
{
contract_id:
integer
impl_id:
integer
contract_id:
naturalnum,notnull
impl_id:
naturalnum,notnull
}
...
...
www/contract-display.adp
View file @
c6dd1684
<master>
<property name="
title
">Contract @contract_name;noquote@</property>
<property name="
doc(title)
">Contract @contract_name;noquote@</property>
<property name="context">{@contract_name;noquote@}</property>
<ul>
...
...
www/doc/index.html
View file @
c6dd1684
...
...
@@ -89,7 +89,7 @@
</ul>
<h3>
Dispatching
</h3>
<ul>
<li>
(tcl) acs_sc
_call
(contract, operation, [arguments, impl]):
<li>
(tcl) acs_sc
::invoke
(contract, operation, [arguments, impl]):
calls an operation
</li>
</ul>
<h2>
Examples
</h2>
...
...
www/doc/index.stx
View file @
c6dd1684
...
...
@@ -134,7 +134,7 @@ ACS Service Contract Documentation
Dispatching
- (tcl) acs_sc
_call
(contract, operation, [arguments, impl]):
- (tcl) acs_sc
::invoke
(contract, operation, [arguments, impl]):
calls an operation
Examples
...
...
www/doc/index.xml
View file @
c6dd1684
...
...
@@ -234,7 +234,7 @@ creates a new operation as part of a contract.</para>
<title>
Dispatching
</title>
<itemizedlist>
<listitem><para>
(tcl) acs_sc
_call
(contract, operation, [arguments, impl]):
(tcl) acs_sc
::invoke
(contract, operation, [arguments, impl]):
calls an operation
</para></listitem>
</itemizedlist>
...
...
www/index.adp
View file @
c6dd1684
<master>
<property name="
title
">ACS Service Contract</property>
<property name="context">@context;
noquote
@</property>
<property name="
doc(title)
">ACS Service Contract</property>
<property name="context">@context;
literal
@</property>
<h2>Defined Contracts</h2>
<p><listtemplate name="contracts"></listtemplate>
</p>
<p><listtemplate name="contracts"></listtemplate>
<h2>Installed Bindings</h2>
<p><listtemplate name="valid_installed_bindings"></listtemplate>
</p>
<p><listtemplate name="valid_installed_bindings"></listtemplate>
<h3>Valid Uninstalled Bindings</h3>
<p><listtemplate name="valid_uninstalled_bindings"></listtemplate>
</p>
<p><listtemplate name="valid_uninstalled_bindings"></listtemplate>
<h3>Invalid Uninstalled Bindings</h3>
<p><listtemplate name="invalid_uninstalled_bindings"></listtemplate>
</p>
<p><listtemplate name="invalid_uninstalled_bindings"></listtemplate>
<h3>Orphan Implementations</h3>
<p><listtemplate name="orphan_implementations"></listtemplate>
</p>
<p><listtemplate name="orphan_implementations"></listtemplate>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment