pax_global_header 0000666 0000000 0000000 00000000064 10747621074 0014522 g ustar 00root root 0000000 0000000 52 comment=9e3a9ccdc13bb1e9897ed4e18c50a7e17c6ef5c9
acs-service-contract-b3-5-0-patches/ 0000775 0000000 0000000 00000000000 10747621074 0017333 5 ustar 00root root 0000000 0000000 acs-service-contract-b3-5-0-patches/acs-service-contract.info 0000664 0000000 0000000 00000002661 10747621074 0024234 0 ustar 00root root 0000000 0000000
GPL V2.0 or any later version
Service Contracts
Service Contract Packages
t
t
OpenACS
API and UI for service contracts
2005-02-28
OpenACS
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.
acs-service-contract-b3-5-0-patches/sql/ 0000775 0000000 0000000 00000000000 10747621074 0020132 5 ustar 00root root 0000000 0000000 acs-service-contract-b3-5-0-patches/sql/oracle/ 0000775 0000000 0000000 00000000000 10747621074 0021377 5 ustar 00root root 0000000 0000000 acs-service-contract-b3-5-0-patches/sql/oracle/acs-sc-msg-types-create.sql 0000664 0000000 0000000 00000021720 10747621074 0026462 0 ustar 00root root 0000000 0000000 -- $Id$
begin
acs_object_type.create_type (
supertype => 'acs_object',
object_type => 'acs_sc_msg_type',
pretty_name => 'ACS SC Message Type',
pretty_plural => 'ACS SC Message Types',
table_name => 'acs_sc_msg_types',
id_column => 'msg_type_id'
);
end;
/
show errors
create table acs_sc_msg_types (
msg_type_id integer
constraint acs_sc_msg_type_id_fk
references acs_objects(object_id)
on delete cascade
constraint acs_sc_msg_type_pk
primary key,
msg_type_name varchar2(100)
constraint acs_sc_msg_type_name_un
unique
);
create table acs_sc_msg_type_elements (
msg_type_id integer
constraint acs_sc_msg_type_el_mtype_id_fk
references acs_sc_msg_types(msg_type_id)
on delete cascade,
element_name varchar2(100),
element_msg_type_id integer
constraint acs_sc_msg_type_el_emti_id_fk
references acs_sc_msg_types(msg_type_id),
element_msg_type_isset_p char(1) constraint acs_msg_type_el_set_p_ck
check (element_msg_type_isset_p in ('t', 'f')),
element_pos integer
);
create or replace package acs_sc_msg_type
as
function new (
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE,
msg_type_spec in varchar2
) return acs_sc_msg_types.msg_type_id%TYPE;
procedure del (
msg_type_id in acs_sc_msg_types.msg_type_id%TYPE default null,
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE default null
);
function get_id (
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE
) return acs_sc_msg_types.msg_type_id%TYPE;
function get_name (
msg_type_id in acs_sc_msg_types.msg_type_id%TYPE
) return acs_sc_msg_types.msg_type_name%TYPE;
-- ask nd about name
function parse_spec (
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE,
msg_type_spec in varchar2
) return integer;
function new_element (
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE,
element_name in acs_sc_msg_type_elements.element_name%TYPE,
element_msg_type_name in acs_sc_msg_types.msg_type_name%TYPE,
element_msg_type_isset_p in acs_sc_msg_type_elements.element_msg_type_isset_p%TYPE,
element_pos in acs_sc_msg_type_elements.element_pos%TYPE
) return acs_sc_msg_types.msg_type_id%TYPE;
end acs_sc_msg_type;
/
show errors
create or replace package body acs_sc_msg_type
as
function new (
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE,
msg_type_spec in varchar2
) return acs_sc_msg_types.msg_type_id%TYPE
is
v_msg_type_id integer;
v_spec_parse_level integer;
begin
v_msg_type_id := acs_object.new(
object_type => 'acs_sc_msg_type'
);
insert into acs_sc_msg_types (
msg_type_id,
msg_type_name
) values (
v_msg_type_id,
msg_type_name
);
v_spec_parse_level := acs_sc_msg_type.parse_spec(
msg_type_name,
msg_type_spec);
return v_msg_type_id;
end new;
procedure del (
msg_type_id in acs_sc_msg_types.msg_type_id%TYPE default null,
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE default null
)
is
v_msg_type_id acs_sc_msg_types.msg_type_id%TYPE;
begin
if msg_type_name is not NULL
then
v_msg_type_id := acs_sc_msg_type.get_id(msg_type_name);
elsif msg_type_id is not NULL
then
v_msg_type_id := msg_type_id;
else
raise_application_error(-20000, 'no args supplied to sc_msg_type.delete');
end if;
delete from acs_sc_msg_types
where msg_type_id = v_msg_type_id;
end del;
function get_id (
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE
) return acs_sc_msg_types.msg_type_id%TYPE
is
v_msg_type_id acs_sc_msg_types.msg_type_id%TYPE;
begin
select msg_type_id into v_msg_type_id
from acs_sc_msg_types
where msg_type_name = get_id.msg_type_name;
return v_msg_type_id;
end get_id;
function get_name (
msg_type_id in acs_sc_msg_types.msg_type_id%TYPE
) return acs_sc_msg_types.msg_type_name%TYPE
is
v_msg_type_name acs_sc_msg_types.msg_type_name%TYPE;
begin
select msg_type_name into v_msg_type_name
from acs_sc_msg_types
where msg_type_id = get_name.msg_type_id;
return v_msg_type_name;
end get_name;
-- string processing in pl/sql is so much fun
-- i'm sure there is a better way to go about this
function parse_spec (
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE,
msg_type_spec in varchar2
) return integer
is
v_element_pos integer;
v_str_s_idx integer; -- spec str pointers
v_str_e_idx integer;
v_elem_idx integer; -- element str pointer
v_str_len integer;
v_element varchar(200);
v_element_type varchar(200);
v_element_name varchar(200);
v_element_msg_type_name varchar(200);
v_element_msg_type_isset_p char(1);
v_junk_msg_type_id integer;
begin
-- oracle treats empty strings as nulls
if msg_type_spec is null
then
return 0;
end if;
v_element_pos := 1;
v_str_e_idx := 1;
while TRUE
loop
-- string start check
if v_element_pos = 1
then
v_str_s_idx := 1;
else
v_str_s_idx := instr(msg_type_spec, ',', v_str_e_idx);
if v_str_s_idx > 0 then
v_str_s_idx := v_str_s_idx + 1;
end if;
end if;
v_str_e_idx := instr(msg_type_spec, ',', v_str_s_idx+1)-1;
-- end of string check
if v_str_s_idx > 0 and v_str_e_idx <= 0
then
v_str_e_idx := length(msg_type_spec);
end if;
-- dbms_output.put_line(v_str_s_idx || ' '|| v_str_e_idx || ' ' || v_element_pos);
-- dbms_output.new_line();
if v_str_s_idx > 0
then
v_element := substr(msg_type_spec,
v_str_s_idx,
v_str_e_idx+1 - v_str_s_idx);
v_elem_idx := instr(v_element, ':');
if v_elem_idx > 0
then
v_element_name := trim( substr(v_element, 1, v_elem_idx-1));
v_element_type := trim( substr(v_element, v_elem_idx+1));
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_application_error (-20001,
'Wrong Format: Message Type Specification');
end if;
else
v_element_msg_type_isset_p := 'f';
v_element_msg_type_name := v_element_type;
end if;
v_junk_msg_type_id := acs_sc_msg_type.new_element (
msg_type_name =>parse_spec.msg_type_name,
element_name => v_element_name,
element_msg_type_name => v_element_msg_type_name,
element_msg_type_isset_p => v_element_msg_type_isset_p,
element_pos => v_element_pos
);
else
raise_application_error(-20001,'Wrong Format: Message Type Specification');
end if;
else
-- yippee we're done
exit;
end if;
v_element_pos := v_element_pos + 1;
end loop;
return v_element_pos - 1;
end parse_spec;
function new_element (
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE,
element_name in acs_sc_msg_type_elements.element_name%TYPE,
element_msg_type_name in acs_sc_msg_types.msg_type_name%TYPE,
element_msg_type_isset_p in acs_sc_msg_type_elements.element_msg_type_isset_p%TYPE,
element_pos in acs_sc_msg_type_elements.element_pos%TYPE
) return acs_sc_msg_types.msg_type_id%TYPE
is
v_msg_type_id integer;
v_element_msg_type_id integer;
begin
v_msg_type_id := acs_sc_msg_type.get_id(msg_type_name);
if v_msg_type_id is null
then
raise_application_error (-20001, 'Unknown Message Type: ' || msg_type_name);
end if;
v_element_msg_type_id := acs_sc_msg_type.get_id(element_msg_type_name);
if v_element_msg_type_id is null
then
raise_application_error (-20001, 'Unknown Message Type: ' || element_msg_type_name);
end if;
insert into acs_sc_msg_type_elements (
msg_type_id,
element_name,
element_msg_type_id,
element_msg_type_isset_p,
element_pos
) values (
v_msg_type_id,
element_name,
v_element_msg_type_id,
element_msg_type_isset_p,
element_pos
);
return v_msg_type_id;
end new_element;
end acs_sc_msg_type;
/
show errors
--
-- Primitive Message Types
--
declare
v_msg_type_id acs_sc_msg_types.msg_type_id%TYPE;
begin
v_msg_type_id := acs_sc_msg_type.new('integer','');
v_msg_type_id := acs_sc_msg_type.new('string','');
v_msg_type_id := acs_sc_msg_type.new('boolean','');
v_msg_type_id := acs_sc_msg_type.new('timestamp','');
v_msg_type_id := acs_sc_msg_type.new('uri','');
v_msg_type_id := acs_sc_msg_type.new('version','');
v_msg_type_id := acs_sc_msg_type.new('float','');
v_msg_type_id := acs_sc_msg_type.new('bytearray','');
end;
/
show errors
acs-service-contract-b3-5-0-patches/sql/oracle/acs-sc-msg-types-drop.sql 0000664 0000000 0000000 00000000370 10747621074 0026161 0 ustar 00root root 0000000 0000000 -- $Id$
drop package acs_sc_msg_type;
drop table acs_sc_msg_type_elements;
drop table acs_sc_msg_types;
delete from acs_objects where object_type = 'acs_sc_msg_type';
begin
acs_object_type.drop_type('acs_sc_msg_type');
end;
/
show errors
acs-service-contract-b3-5-0-patches/sql/oracle/acs-sc-object-types-create.sql 0000664 0000000 0000000 00000001377 10747621074 0027150 0 ustar 00root root 0000000 0000000 -- $Id$
begin
acs_object_type.create_type(
object_type => 'acs_sc_contract',
pretty_name => 'ACS SC Contract',
pretty_plural => 'ACS SC Contracts',
supertype => 'acs_object',
table_name => 'ACS_SC_CONTRACTS',
id_column => 'CONTRACT_ID'
);
acs_object_type.create_type(
object_type => 'acs_sc_operation',
pretty_name => 'ACS SC Operation',
pretty_plural => 'ACS SC Operations',
supertype => 'acs_object',
table_name => 'ACS_SC_OPERATIONS',
id_column => 'OPERATION_ID'
);
acs_object_type.create_type(
object_type => 'acs_sc_implementation',
pretty_name => 'ACS SC Implementation',
pretty_plural => 'ACS SC Implementations',
supertype => 'acs_object',
table_name => 'ACS_SC_IMPLS',
id_column => 'IMPL_ID'
);
end;
/
show errors
acs-service-contract-b3-5-0-patches/sql/oracle/acs-sc-object-types-drop.sql 0000664 0000000 0000000 00000000614 10747621074 0026642 0 ustar 00root root 0000000 0000000 -- $Id$
begin
delete from acs_objects where object_type ='acs_sc_implementation';
acs_object_type.drop_type('acs_sc_implementation');
delete from acs_objects where object_type ='acs_sc_operation';
acs_object_type.drop_type('acs_sc_operation');
delete from acs_objects where object_type ='acs_sc_contract';
acs_object_type.drop_type('acs_sc_contract');
end;
/
show errors
acs-service-contract-b3-5-0-patches/sql/oracle/acs-sc-packages-create.sql 0000664 0000000 0000000 00000043263 10747621074 0026316 0 ustar 00root root 0000000 0000000 -- $Id$
create or replace package acs_sc_contract
as
function new (
contract_name in acs_sc_contracts.contract_name%TYPE,
contract_desc in acs_sc_contracts.contract_desc%TYPE
) return acs_sc_contracts.contract_id%TYPE;
function get_id (
contract_name in acs_sc_contracts.contract_name%TYPE
) return acs_sc_contracts.contract_id%TYPE;
function get_name (
contract_id in acs_sc_contracts.contract_id%TYPE
) return acs_sc_contracts.contract_name%TYPE;
procedure del (
contract_name in acs_sc_contracts.contract_name%TYPE default null,
contract_id in acs_sc_contracts.contract_id%TYPE default null
);
end acs_sc_contract;
/
show errors
create or replace package acs_sc_operation
as
function new (
contract_name in acs_sc_contracts.contract_name%TYPE,
operation_name in acs_sc_operations.operation_name%TYPE,
operation_desc in acs_sc_operations.operation_desc%TYPE,
operation_iscachable_p in acs_sc_operations.operation_iscachable_p%TYPE,
operation_nargs in acs_sc_operations.operation_nargs%TYPE,
operation_inputtype in acs_sc_msg_types.msg_type_name%TYPE,
operation_outputtype in acs_sc_msg_types.msg_type_name%TYPE
) return acs_sc_operations.operation_id%TYPE;
function get_id (
contract_name acs_sc_contracts.contract_name%TYPE,
operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_operations.operation_id%TYPE;
procedure del (
operation_id acs_sc_operations.operation_id%TYPE default null,
operation_name acs_sc_operations.operation_name%TYPE default null,
contract_name acs_sc_contracts.contract_name%TYPE default null
);
end acs_sc_operation;
/
show errors
create or replace package acs_sc_impl
as
function new (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_pretty_name acs_sc_impls.impl_pretty_name%TYPE default null,
impl_owner_name acs_sc_impls.impl_owner_name%TYPE
) return acs_sc_impls.impl_id%TYPE;
function get_id (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
) return acs_sc_impls.impl_id%TYPE;
function get_name (
impl_id acs_sc_impls.impl_id%TYPE
) return acs_sc_impls.impl_name%TYPE;
procedure del (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
);
/* Next 2 functions are deprecated but left here for backwards compatability */
function new_alias (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE,
impl_alias acs_sc_impl_aliases.impl_alias%TYPE,
impl_pl acs_sc_impl_aliases.impl_pl%TYPE
) return acs_sc_impl_aliases.impl_id%TYPE;
-- fix by Ben from delete_aliases to delete_alias
function delete_alias (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_impls.impl_id%TYPE;
end acs_sc_impl;
/
show error
create or replace package acs_sc_impl_alias
as
function new (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE,
impl_alias acs_sc_impl_aliases.impl_alias%TYPE,
impl_pl acs_sc_impl_aliases.impl_pl%TYPE
) return acs_sc_impl_aliases.impl_id%TYPE;
function del (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_impls.impl_id%TYPE;
end acs_sc_impl_alias;
/
show error
create or replace package acs_sc_binding
as
procedure new (
contract_id acs_sc_operations.contract_id%TYPE default null,
impl_id acs_sc_bindings.impl_id%TYPE default null,
contract_name acs_sc_contracts.contract_name%TYPE default null,
impl_name acs_sc_impls.impl_name%TYPE default null
);
procedure del (
contract_id acs_sc_contracts.contract_id%TYPE default null,
contract_name acs_sc_contracts.contract_name%TYPE default null,
impl_id acs_sc_impls.impl_id%TYPE default null,
impl_name acs_sc_impls.impl_name%TYPE default null
);
function exists_p (
contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
) return integer;
end acs_sc_binding;
/
show errors
create or replace package body acs_sc_contract
as
function new (
contract_name in acs_sc_contracts.contract_name%TYPE,
contract_desc in acs_sc_contracts.contract_desc%TYPE
) return acs_sc_contracts.contract_id%TYPE
is
v_contract_id acs_sc_contracts.contract_id%TYPE;
begin
v_contract_id := acs_object.new( object_type=>'acs_sc_contract');
insert into acs_sc_contracts (
contract_id,
contract_name,
contract_desc
) values (
v_contract_id,
contract_name,
contract_desc
);
return v_contract_id;
end new;
function get_id (
contract_name in acs_sc_contracts.contract_name%TYPE
) return acs_sc_contracts.contract_id%TYPE
is
v_contract_id acs_sc_contracts.contract_id%TYPE;
begin
select contract_id into v_contract_id
from acs_sc_contracts
where contract_name = get_id.contract_name;
return v_contract_id;
end get_id;
function get_name (
contract_id in acs_sc_contracts.contract_id%TYPE
) return acs_sc_contracts.contract_name%TYPE
is
v_contract_name acs_sc_contracts.contract_name%TYPE;
begin
select contract_name into v_contract_name
from acs_sc_contracts
where contract_id = get_name.contract_id;
return v_contract_name;
end get_name;
procedure del (
contract_name in acs_sc_contracts.contract_name%TYPE default null,
contract_id in acs_sc_contracts.contract_id%TYPE default null
)
is
v_contract_id acs_sc_contracts.contract_id%TYPE;
begin
if contract_name is not NULL
then
v_contract_id := acs_sc_contract.get_id(contract_name);
elsif contract_id is not NULL
then
v_contract_id := contract_id;
else
raise_application_error(-20001, 'Service Contracts: no valid args supplied to delete');
end if;
delete from acs_sc_contracts
where contract_id = v_contract_id;
acs_object.del(v_contract_id);
end del;
end acs_sc_contract;
/
show errors
create or replace package body acs_sc_operation
as
function new (
contract_name in acs_sc_contracts.contract_name%TYPE,
operation_name in acs_sc_operations.operation_name%TYPE,
operation_desc in acs_sc_operations.operation_desc%TYPE,
operation_iscachable_p in acs_sc_operations.operation_iscachable_p%TYPE,
operation_nargs in acs_sc_operations.operation_nargs%TYPE,
operation_inputtype in acs_sc_msg_types.msg_type_name%TYPE,
operation_outputtype in acs_sc_msg_types.msg_type_name%TYPE
) return acs_sc_operations.operation_id%TYPE
is
v_contract_id acs_sc_contracts.contract_id%TYPE;
v_operation_id acs_sc_operations.operation_id%TYPE;
v_operation_inputtype_id acs_sc_operations.operation_inputtype_id%TYPE;
v_operation_outputtype_id acs_sc_operations.operation_outputtype_id%TYPE;
begin
v_contract_id := acs_sc_contract.get_id(contract_name);
v_operation_id := acs_object.new (object_type=>'acs_sc_operation');
v_operation_inputtype_id := acs_sc_msg_type.get_id(operation_inputtype);
v_operation_outputtype_id := acs_sc_msg_type.get_id(operation_outputtype);
insert into acs_sc_operations (
contract_id,
operation_id,
contract_name,
operation_name,
operation_desc,
operation_iscachable_p,
operation_nargs,
operation_inputtype_id,
operation_outputtype_id
) values (
v_contract_id,
v_operation_id,
contract_name,
operation_name,
operation_desc,
operation_iscachable_p,
operation_nargs,
v_operation_inputtype_id,
v_operation_outputtype_id
);
return v_operation_id;
end new;
function get_id (
contract_name acs_sc_contracts.contract_name%TYPE,
operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_operations.operation_id%TYPE
as
v_operation_id acs_sc_operations.operation_id%TYPE;
begin
select operation_id into v_operation_id
from acs_sc_operations
where contract_name = get_id.contract_name
and operation_name = get_id.operation_name;
return v_operation_id;
end get_id;
procedure del (
operation_id acs_sc_operations.operation_id%TYPE default null,
operation_name acs_sc_operations.operation_name%TYPE default null,
contract_name acs_sc_contracts.contract_name%TYPE default null
)
is
v_operation_id acs_sc_operations.operation_id%TYPE;
begin
if (operation_id is NULL and operation_name is not NULL and contract_name is not NULL)
then
v_operation_id := get_id(contract_name, operation_name);
elsif operation_id is not NULL
then
v_operation_id := operation_id;
else
raise_application_error(-20001, 'ACS Contracts: Invalid args to operation delete');
end if;
delete from acs_sc_operations
where operation_id = v_operation_id;
end del;
end acs_sc_operation;
/
show errors
create or replace package body acs_sc_impl
as
function new (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_pretty_name acs_sc_impls.impl_pretty_name%TYPE default null,
impl_owner_name acs_sc_impls.impl_owner_name%TYPE
) return acs_sc_impls.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
v_impl_id := acs_object.new (object_type => 'acs_sc_implementation');
insert into acs_sc_impls (
impl_id,
impl_name,
impl_pretty_name,
impl_owner_name,
impl_contract_name
) values (
v_impl_id,
impl_name,
impl_pretty_name,
impl_owner_name,
impl_contract_name
);
return v_impl_id;
end new;
function get_id (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
) return acs_sc_impls.impl_id%TYPE
as
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
select impl_id into v_impl_id
from acs_sc_impls
where impl_name = get_id.impl_name
and impl_contract_name = get_id.impl_contract_name;
return v_impl_id;
end get_id;
function get_name (
impl_id acs_sc_impls.impl_id%TYPE
) return acs_sc_impls.impl_name%TYPE
as
v_impl_name acs_sc_impls.impl_name%TYPE;
begin
select impl_name into v_impl_name
from acs_sc_impls
where impl_id = get_name.impl_id;
return v_impl_name;
end get_name;
procedure del (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
)
as
begin
delete from acs_sc_impls
where impl_contract_name = acs_sc_impl.del.impl_contract_name
and impl_name = acs_sc_impl.del.impl_name;
end del;
/* next 2 functions are deprecated. */
function new_alias (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE,
impl_alias acs_sc_impl_aliases.impl_alias%TYPE,
impl_pl acs_sc_impl_aliases.impl_pl%TYPE
) return acs_sc_impl_aliases.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
-- FUNCTION DEPRECATED. USE acs_sc_impl_alias.new
dbms_output.put_line('acs_sc_impl.new_alias DEPRECATED. Use acs_sc_impl_alias.new');
v_impl_id := acs_sc_impl_alias.new(
impl_contract_name,
impl_name,
impl_operation_name,
impl_alias,
impl_pl
);
return v_impl_id;
end new_alias;
function delete_alias (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_impls.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
-- FUNCTION DEPRECATED. USE acs_sc_impl_alias.delete
dbms_output.put_line('acs_sc_impl.delete_alias DEPRECATED. Use acs_sc_impl_alias.delete');
v_impl_id := acs_sc_impl_alias.del(
impl_contract_name,
impl_name,
impl_operation_name
);
return v_impl_id;
end delete_alias;
end acs_sc_impl;
/
show errors
create or replace package body acs_sc_impl_alias
as
function new (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE,
impl_alias acs_sc_impl_aliases.impl_alias%TYPE,
impl_pl acs_sc_impl_aliases.impl_pl%TYPE
) return acs_sc_impl_aliases.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
v_impl_id := acs_sc_impl.get_id(impl_contract_name,impl_name);
insert into acs_sc_impl_aliases (
impl_id,
impl_name,
impl_contract_name,
impl_operation_name,
impl_alias,
impl_pl
) values (
v_impl_id,
impl_name,
impl_contract_name,
impl_operation_name,
impl_alias,
impl_pl
);
return v_impl_id;
end new;
function del (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_impls.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
v_impl_id := acs_sc_impl.get_id(impl_contract_name,impl_name);
delete from acs_sc_impl_aliases
where impl_contract_name = acs_sc_impl_alias.del.impl_contract_name
and impl_name = acs_sc_impl_alias.del.impl_name
and impl_operation_name = acs_sc_impl_alias.del.impl_operation_name;
return v_impl_id;
end del;
end acs_sc_impl_alias;
/
show errors
create or replace package body acs_sc_binding
as
-- you can pick a pair of args, either ids or names to pass in.
procedure new (
contract_id acs_sc_operations.contract_id%TYPE default null,
impl_id acs_sc_bindings.impl_id%TYPE default null,
contract_name acs_sc_contracts.contract_name%TYPE default null,
impl_name acs_sc_impls.impl_name%TYPE default null
)
is
v_contract_name acs_sc_contracts.contract_name%TYPE;
v_contract_id acs_sc_contracts.contract_id%TYPE;
v_impl_name acs_sc_impls.impl_name%TYPE;
v_impl_id acs_sc_impls.impl_id%TYPE;
v_count integer;
begin
if impl_id is not null and contract_id is not null
then
v_contract_name := acs_sc_contract.get_name(contract_id);
v_impl_name := acs_sc_impl.get_name(impl_id);
v_contract_id := contract_id;
v_impl_id := impl_id;
elsif contract_name is not null and impl_name is not null
then
v_contract_id := acs_sc_contract.get_id(contract_name);
v_impl_id := acs_sc_impl.get_id(contract_name,impl_name);
v_impl_name := impl_name;
v_contract_name := contract_name;
else
raise_application_error(-20001, 'Service Contracts:Invalid args to binding new');
end if;
select count(*) into v_count
from acs_sc_operations
where contract_id = new.contract_id
and operation_name not in (select impl_operation_name
from acs_sc_impl_aliases
where impl_contract_name = v_contract_name
and impl_id = v_impl_id);
if v_count > 0
then
raise_application_error(-20001, 'Binding of ' ||
v_contract_name ||
' to ' ||
v_impl_name ||
' failed since certain operations are not implemented.');
end if;
insert into acs_sc_bindings (
contract_id,
impl_id
) values (
v_contract_id,
v_impl_id
);
end new;
procedure del (
contract_id acs_sc_contracts.contract_id%TYPE default null,
contract_name acs_sc_contracts.contract_name%TYPE default null,
impl_id acs_sc_impls.impl_id%TYPE default null,
impl_name acs_sc_impls.impl_name%TYPE default null
)
is
v_contract_id acs_sc_contracts.contract_id%TYPE;
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
if impl_id is not null and contract_id is not null
then
v_impl_id := impl_id;
v_contract_id := contract_id;
elsif impl_name is not null and contract_name is not null
then
v_impl_id := acs_sc_impl.get_id(contract_name,impl_name);
v_contract_id := acs_sc_contract.get_id(contract_name);
else
raise_application_error(-20001, 'Service contract binding delete invalid args');
end if;
delete from acs_sc_bindings
where contract_id = v_contract_id
and impl_id = v_impl_id;
end del;
function exists_p (
contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
) return integer
is
v_exists_p integer;
begin
select decode(count(*),0, 0, 1) into v_exists_p
from acs_sc_bindings
where contract_id = acs_sc_contract.get_id(contract_name)
and impl_id = acs_sc_impl.get_id(contract_name,impl_name);
return v_exists_p;
end exists_p;
end acs_sc_binding;
/
show errors
acs-service-contract-b3-5-0-patches/sql/oracle/acs-sc-packages-drop.sql 0000664 0000000 0000000 00000000175 10747621074 0026012 0 ustar 00root root 0000000 0000000 -- $Id$
drop package acs_sc_contract;
drop package acs_sc_operation;
drop package acs_sc_impl;
drop package acs_sc_binding;
acs-service-contract-b3-5-0-patches/sql/oracle/acs-sc-tables-create.sql 0000664 0000000 0000000 00000005241 10747621074 0026004 0 ustar 00root root 0000000 0000000 -- $Id$
create table acs_sc_contracts (
contract_id integer
constraint acs_sc_contract_id_fk
references acs_objects(object_id)
on delete cascade
constraint acs_sc_contract_pk
primary key,
contract_name varchar2(1000)
constraint acs_sc_contract_name_nn
not null
constraint acs_sc_contract_name_un
unique,
contract_desc varchar2(4000)
constraint acs_sc_contract_desc_nn
not null
);
create table acs_sc_operations (
contract_id integer
constraint acs_sc_operation_cid_fk
references acs_sc_contracts(contract_id)
on delete cascade,
operation_id integer
constraint acs_sc_operation_opid_fk
references acs_objects(object_id)
on delete cascade
constraint acs_sc_operation_pk
primary key,
contract_name varchar2(1000),
operation_name varchar2(100),
operation_desc varchar2(4000)
constraint acs_sc_operation_desc_nn
not null,
operation_iscachable_p char(1) constraint acs_sc_operation_cache_p_ck
check (operation_iscachable_p in ('t', 'f')),
operation_nargs integer,
operation_inputtype_id integer
constraint acs_sc_operation_intype_fk
references acs_sc_msg_types(msg_type_id),
operation_outputtype_id integer
constraint acs_sc_operation_outtype_fk
references acs_sc_msg_types(msg_type_id)
);
create table acs_sc_impls (
impl_id integer
constraint acs_sc_impl_impl_id_fk
references acs_objects(object_id)
on delete cascade
constraint acs_sc_impl_pk
primary key,
impl_name varchar2(100),
impl_pretty_name varchar2(200),
impl_owner_name varchar2(1000),
impl_contract_name varchar2(1000)
);
create table acs_sc_impl_aliases (
impl_id integer
constraint acs_sc_impl_aliases_impl_id_fk
references acs_sc_impls(impl_id)
on delete cascade,
impl_name varchar2(100),
impl_contract_name varchar2(1000),
impl_operation_name varchar2(100),
impl_alias varchar2(100),
impl_pl varchar2(100),
constraint acs_sc_impl_aliases_un unique(impl_name,impl_contract_name,impl_operation_name)
);
create table acs_sc_bindings (
contract_id integer
constraint acs_sc_binding_cid_fk
references acs_sc_contracts(contract_id)
on delete cascade,
impl_id integer
constraint acs_sc_binding_impl_id_fk
references acs_sc_impls(impl_id)
on delete cascade
);
acs-service-contract-b3-5-0-patches/sql/oracle/acs-sc-tables-drop.sql 0000664 0000000 0000000 00000000220 10747621074 0025475 0 ustar 00root root 0000000 0000000 drop table acs_sc_bindings;
drop table acs_sc_impl_aliases;
drop table acs_sc_impls;
drop table acs_sc_operations;
drop table acs_sc_contracts;
acs-service-contract-b3-5-0-patches/sql/oracle/acs-sc-views-create.sql 0000664 0000000 0000000 00000003347 10747621074 0025674 0 ustar 00root root 0000000 0000000 -- $Id$
create or replace view valid_uninstalled_bindings as
select c.contract_id, c.contract_name, i.impl_id, i.impl_name, i.impl_owner_name, i.impl_pretty_name
from acs_sc_contracts c, acs_sc_impls i
where c.contract_name = i.impl_contract_name
and not exists (select 1
from acs_sc_bindings b
where b.contract_id = c.contract_id
and b.impl_id = i.impl_id)
and not exists (select 1
from acs_sc_operations o
where o.contract_id = c.contract_id
and not exists (select 1
from acs_sc_impl_aliases a
where a.impl_contract_name = c.contract_name
and a.impl_id = i.impl_id
and a.impl_operation_name = o.operation_name));
create or replace view invalid_uninstalled_bindings as
select c.contract_id, c.contract_name, i.impl_id, i.impl_name, i.impl_owner_name, i.impl_pretty_name
from acs_sc_contracts c, acs_sc_impls i
where c.contract_name = i.impl_contract_name
and not exists (select 1
from acs_sc_bindings b
where b.contract_id = c.contract_id
and b.impl_id = i.impl_id)
and exists (select 1
from acs_sc_operations o
where o.contract_id = c.contract_id
and not exists (select 1
from acs_sc_impl_aliases a
where a.impl_contract_name = c.contract_name
and a.impl_id = i.impl_id
and a.impl_operation_name = o.operation_name));
create or replace view orphan_implementations as
select i.impl_id, i.impl_name, i.impl_contract_name, i.impl_owner_name, i.impl_pretty_name
from acs_sc_impls i
where not exists (select 1
from acs_sc_bindings b
where b.impl_id = i.impl_id)
and not exists (select 1
from acs_sc_contracts c
where c.contract_name = i.impl_contract_name);
acs-service-contract-b3-5-0-patches/sql/oracle/acs-sc-views-drop.sql 0000664 0000000 0000000 00000000164 10747621074 0025367 0 ustar 00root root 0000000 0000000 -- $Id$
drop view orphan_implementation;
drop view invalid_uninstalled_binding;
drop view valid_uninstalled_binding; acs-service-contract-b3-5-0-patches/sql/oracle/acs-service-contract-create.sql 0000664 0000000 0000000 00000000225 10747621074 0027377 0 ustar 00root root 0000000 0000000 @@ acs-sc-msg-types-create.sql
@@ acs-sc-object-types-create.sql
@@ acs-sc-tables-create.sql
@@ acs-sc-packages-create.sql
@@ acs-sc-views-create.sql acs-service-contract-b3-5-0-patches/sql/oracle/acs-service-contract-drop.sql 0000664 0000000 0000000 00000000224 10747621074 0027077 0 ustar 00root root 0000000 0000000 -- $Id$
@@ acs-sc-views-drop.sql
@@ acs-sc-packages-drop.sql
@@ acs-sc-tables-drop.sql
@@ acs-sc-object-types-drop.sql
@@ acs-sc-msg-types-drop.sql acs-service-contract-b3-5-0-patches/sql/oracle/sc-sample-create.sql 0000664 0000000 0000000 00000006001 10747621074 0025242 0 ustar 00root root 0000000 0000000 -- CREATE CONTRACT
declare
sc_sample_test integer;
begin
sc_sample_test := acs_sc_contract.new(
contract_name => 'ObjectDisplay',
contract_desc => 'Object display'
);
sc_sample_test := acs_sc_msg_type.new(
msg_type_name => 'ObjectDisplay.Name.InputType',
msg_type_spec => 'object_id:integer'
);
sc_sample_test := acs_sc_msg_type.new(
msg_type_name => 'ObjectDisplay.Name.OutputType',
msg_type_spec => 'object_name:string'
);
sc_sample_test := acs_sc_operation.new(
contract_name => 'ObjectDisplay',
operation_name => 'name',
operation_desc => 'Returns objects name',
operation_iscachable_p => 'f',
operation_nargs => 1,
operation_inputttype => 'ObjectDisplay.Name.InputType',
operation_ouputtype => 'ObjectDisplay.Name.OutputType'
);
sc_sample_test := acs_sc_msg_type.new('ObjectDisplay.Url.InputType','object_id:integer');
sc_sample_test := acs_sc_msg_type.new('ObjectDisplay.Url.OutputType','object_url:uri');
sc_sample_test := acs_sc_operation.new(
'ObjectDisplay', -- contract_name
'url', -- operation_name
'Returns object''s url', -- operation_desc
'f', -- operation_iscachable_p
1, -- operation_nargs
'ObjectDisplay.Url.InputType', -- operation_inputtype
'ObjectDisplay.Url.OutputType' -- operation_outputtype
);
sc_sample_test := acs_sc_msg_type.new ('ObjectDisplay.SampleHello.InputType',
'object_id:integer,object_txt:string');
sc_sample_test := acs_sc_msg_type.new ('ObjectDisplay.SampleHello.OutputType',
'object_sample:string[],xxx_p:boolean');
sc_sample_test := acs_sc_operation.new (
'ObjectDisplay', -- contract_name
'sample_hello', -- operation_name
'Returns object''s url', -- operation_desc
't', -- operation_iscachable_p
1, -- operation_nargs
'ObjectDisplay.SampleHello.InputType', -- operation_inputtype
'ObjectDisplay.SampleHello.OutputType' -- operation_outputtype
);
-- CREATE IMPLEMENTATION
sc_sample_test := acs_sc_impl.new(
'ObjectDisplay', -- impl_contract_name
'bboard_message', -- impl_name
'bboard' -- impl_owner_name
);
sc_sample_test := acs_sc_impl.new_alias(
'ObjectDisplay', -- impl_contract_name
'bboard_message', -- impl_name
'name', -- impl_operation_name
'bboard_message__name', -- impl_alias
'PLPGSQL' -- impl_pl
);
sc_sample_test := acs_sc_impl.new_alias(
'ObjectDisplay', -- impl_contract_name
'bboard_message', -- impl_name
'url', -- impl_operation_name
'bboard_message__url', -- impl_alias
'PLPGSQL' -- impl_pl
);
sc_sample_test := acs_sc_impl.new_alias(
'ObjectDisplay', -- impl_contract_name
'bboard_message', -- impl_name
'sample_hello', -- impl_operation_name
'bboard_message__sample_hello', -- impl_alias
'TCL' -- impl_pl
);
end;
/
show errors
acs-service-contract-b3-5-0-patches/sql/oracle/sc-sample-drop.sql 0000664 0000000 0000000 00000001115 10747621074 0024744 0 ustar 00root root 0000000 0000000 begin
acs_sc_impl.del(
'ObjectDisplay', -- impl_contract_name
'bboard_message' -- impl_name
);
acs_sc_contract.del(contract_name=>'ObjectDisplay',
operation_name=>'name');
acs_sc_msg_type.del ('ObjectDisplay.Name.InputType');
acs_sc_msg_type.del ('ObjectDisplay.Name.OutputType');
acs_sc_msg_type.del ('ObjectDisplay.Url.InputType');
acs_sc_msg_type.del ('ObjectDisplay.Url.OutputType');
acs_sc_msg_type.del ('ObjectDisplay.SampleHello.InputType');
acs_sc_msg_type.del ('ObjectDisplay.SampleHello.OutputType');
end;
/
show errors
acs-service-contract-b3-5-0-patches/sql/oracle/upgrade/ 0000775 0000000 0000000 00000000000 10747621074 0023026 5 ustar 00root root 0000000 0000000 acs-service-contract-b3-5-0-patches/sql/oracle/upgrade/upgrade-4.5-4.5.1.sql 0000664 0000000 0000000 00000022372 10747621074 0026153 0 ustar 00root root 0000000 0000000 -- packages/acs-service-contract/sql/oracle/upgrade/upgrade-4.5-4.5.1.sql
--
-- @author Vinod Kurup (vinod@kurup.com)
-- @creation_date 2002-08-14
--
-- $Id$
-- UPGRADE ISSUE 1
-- PG version has 2 packages acs_sc_impl and acs_sc_impl_alias
-- For consistency, we're making it the same in Oracle
-- Oracle function acs_sc_impl.new_alias -> acs_sc_impl_alias.new
-- acs_sc_impl.delete_alias -> acs_sc_impl_alias.delete
-- Old functions deprecated, but still work.
create or replace package acs_sc_impl_alias
as
function new (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE,
impl_alias acs_sc_impl_aliases.impl_alias%TYPE,
impl_pl acs_sc_impl_aliases.impl_pl%TYPE
) return acs_sc_impl_aliases.impl_id%TYPE;
function delete (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_impls.impl_id%TYPE;
end acs_sc_impl_alias;
/
show error
-- now the new package bodies
create or replace package body acs_sc_impl
as
function new (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_owner_name acs_sc_impls.impl_owner_name%TYPE
) return acs_sc_impls.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
v_impl_id := acs_object.new (object_type => 'acs_sc_implementation');
insert into acs_sc_impls (
impl_id,
impl_name,
impl_owner_name,
impl_contract_name
) values (
v_impl_id,
impl_name,
impl_owner_name,
impl_contract_name
);
return v_impl_id;
end new;
function get_id (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
) return acs_sc_impls.impl_id%TYPE
as
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
select impl_id into v_impl_id
from acs_sc_impls
where impl_name = get_id.impl_name
and impl_contract_name = get_id.impl_contract_name;
return v_impl_id;
end get_id;
function get_name (
impl_id acs_sc_impls.impl_id%TYPE
) return acs_sc_impls.impl_name%TYPE
as
v_impl_name acs_sc_impls.impl_name%TYPE;
begin
select impl_name into v_impl_name
from acs_sc_impls
where impl_id = get_name.impl_id;
return v_impl_name;
end get_name;
procedure delete (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
)
as
begin
delete from acs_sc_impls
where impl_contract_name = acs_sc_impl.delete.impl_contract_name
and impl_name = acs_sc_impl.delete.impl_name;
end delete;
/* next 2 functions are deprecated. */
function new_alias (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE,
impl_alias acs_sc_impl_aliases.impl_alias%TYPE,
impl_pl acs_sc_impl_aliases.impl_pl%TYPE
) return acs_sc_impl_aliases.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
-- FUNCTION DEPRECATED. USE acs_sc_impl_alias.new
dbms_output.put_line('acs_sc_impl.new_alias DEPRECATED. Use acs_sc_impl_alias.new');
v_impl_id := acs_sc_impl_alias.new(
impl_contract_name,
impl_name,
impl_operation_name,
impl_alias,
impl_pl
);
return v_impl_id;
end new_alias;
function delete_alias (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_impls.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
-- FUNCTION DEPRECATED. USE acs_sc_impl_alias.delete
dbms_output.put_line('acs_sc_impl.delete_alias DEPRECATED. Use acs_sc_impl_alias.delete');
v_impl_id := acs_sc_impl_alias.delete(
impl_contract_name,
impl_name,
impl_operation_name
);
return v_impl_id;
end delete_alias;
end acs_sc_impl;
/
show errors
create or replace package body acs_sc_impl_alias
as
function new (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE,
impl_alias acs_sc_impl_aliases.impl_alias%TYPE,
impl_pl acs_sc_impl_aliases.impl_pl%TYPE
) return acs_sc_impl_aliases.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
v_impl_id := acs_sc_impl.get_id(impl_contract_name,impl_name);
insert into acs_sc_impl_aliases (
impl_id,
impl_name,
impl_contract_name,
impl_operation_name,
impl_alias,
impl_pl
) values (
v_impl_id,
impl_name,
impl_contract_name,
impl_operation_name,
impl_alias,
impl_pl
);
return v_impl_id;
end new;
function delete (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_impls.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
v_impl_id := acs_sc_impl.get_id(impl_contract_name,impl_name);
delete from acs_sc_impl_aliases
where impl_contract_name = acs_sc_impl_alias.delete.impl_contract_name
and impl_name = acs_sc_impl_alias.delete.impl_name
and impl_operation_name = acs_sc_impl_alias.delete.impl_operation_name;
return v_impl_id;
end delete;
end acs_sc_impl_alias;
/
show errors
-- UPGRADE ISSUE 2
-- acs_sc_binding.exists_p was broken on Oracle if you
-- tested a binding for which the implementation was installed, but the
-- contract wasn't.
create or replace package body acs_sc_binding
as
-- you can pick a pair of args, either ids or names to pass in.
procedure new (
contract_id acs_sc_operations.contract_id%TYPE default null,
impl_id acs_sc_bindings.impl_id%TYPE default null,
contract_name acs_sc_contracts.contract_name%TYPE default null,
impl_name acs_sc_impls.impl_name%TYPE default null
)
is
v_contract_name acs_sc_contracts.contract_name%TYPE;
v_contract_id acs_sc_contracts.contract_id%TYPE;
v_impl_name acs_sc_impls.impl_name%TYPE;
v_impl_id acs_sc_impls.impl_id%TYPE;
v_count integer;
begin
if impl_id is not null and contract_id is not null
then
v_contract_name := acs_sc_contract.get_name(contract_id);
v_impl_name := acs_sc_impl.get_name(impl_id);
v_contract_id := contract_id;
v_impl_id := impl_id;
elsif contract_name is not null and impl_name is not null
then
v_contract_id := acs_sc_contract.get_id(contract_name);
v_impl_id := acs_sc_impl.get_id(contract_name,impl_name);
v_impl_name := impl_name;
v_contract_name := contract_name;
else
raise_application_error(-20001, 'Service Contracts:Invalid args to binding new');
end if;
select count(*) into v_count
from acs_sc_operations
where contract_id = new.contract_id
and operation_name not in (select impl_operation_name
from acs_sc_impl_aliases
where impl_contract_name = v_contract_name
and impl_id = v_impl_id);
if v_count > 0
then
raise_application_error(-20001, 'Binding of ' ||
v_contract_name ||
' to ' ||
v_impl_name ||
' failed.');
end if;
insert into acs_sc_bindings (
contract_id,
impl_id
) values (
v_contract_id,
v_impl_id
);
end new;
procedure delete(
contract_id acs_sc_contracts.contract_id%TYPE default null,
contract_name acs_sc_contracts.contract_name%TYPE default null,
impl_id acs_sc_impls.impl_id%TYPE default null,
impl_name acs_sc_impls.impl_name%TYPE default null
)
is
v_contract_id acs_sc_contracts.contract_id%TYPE;
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
if impl_id is not null and contract_id is not null
then
v_impl_id := impl_id;
v_contract_id := contract_id;
elsif impl_name is not null and contract_name is not null
then
v_impl_id := acs_sc_impl.get_id(contract_name,impl_name);
v_contract_id := acs_sc_contract.get_id(contract_name);
else
raise_application_error(-20001, 'Service contract binding delete invalid args');
end if;
delete from acs_sc_bindings
where contract_id = v_contract_id
and impl_id = v_impl_id;
end delete;
function exists_p (
contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
) return integer
is
v_exists_p integer;
begin
select decode(count(*),0, 0, 1) into v_exists_p
from acs_sc_bindings
where contract_id = acs_sc_contract.get_id(contract_name)
and impl_id = acs_sc_impl.get_id(contract_name,impl_name);
return v_exists_p;
end exists_p;
end acs_sc_binding;
/
show errors
acs-service-contract-b3-5-0-patches/sql/oracle/upgrade/upgrade-4.5.1-4.6.sql 0000664 0000000 0000000 00000001024 10747621074 0026143 0 ustar 00root root 0000000 0000000 -- packages/acs-service-contract/sql/oracle/upgrade/upgrade-4.5.1-4.6.sql
--
-- @author Vinod Kurup (vinod@kurup.com)
-- @creation_date 2002-10-08
--
-- $Id$
-- UPGRADE ISSUE #1
-- add timestamp datatype
declare
v_count integer;
v_msg_type_id acs_sc_msg_types.msg_type_id%TYPE;
begin
select count(*) into v_count from acs_sc_msg_types
where msg_type_name = 'timestamp';
if v_count = 0 then
v_msg_type_id := acs_sc_msg_type.new('timestamp','');
end if;
end;
/
show errors
acs-service-contract-b3-5-0-patches/sql/oracle/upgrade/upgrade-4.7d2-4.7d3.sql 0000664 0000000 0000000 00000015575 10747621074 0026504 0 ustar 00root root 0000000 0000000 --
-- @author Simon Carstensen (simon@collaboraid.biz)
-- @creation_date 2003-09-10
--
-- $Id$
-- add column impl_pretty_name
alter table acs_sc_impls add impl_pretty_name varchar2(200);
update acs_sc_impls set impl_pretty_name = impl_name;
create or replace package acs_sc_impl
as
function new (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_pretty_name acs_sc_impls.impl_pretty_name%TYPE default null,
impl_owner_name acs_sc_impls.impl_owner_name%TYPE
) return acs_sc_impls.impl_id%TYPE;
function get_id (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
) return acs_sc_impls.impl_id%TYPE;
function get_name (
impl_id acs_sc_impls.impl_id%TYPE
) return acs_sc_impls.impl_name%TYPE;
procedure delete (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
);
/* Next 2 functions are deprecated but left here for backwards compatability */
function new_alias (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE,
impl_alias acs_sc_impl_aliases.impl_alias%TYPE,
impl_pl acs_sc_impl_aliases.impl_pl%TYPE
) return acs_sc_impl_aliases.impl_id%TYPE;
-- fix by Ben from delete_aliases to delete_alias
function delete_alias (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_impls.impl_id%TYPE;
end acs_sc_impl;
/
show error
create or replace package body acs_sc_impl
as
function new (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_pretty_name acs_sc_impls.impl_pretty_name%TYPE default null,
impl_owner_name acs_sc_impls.impl_owner_name%TYPE
) return acs_sc_impls.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
v_impl_pretty_name varchar(4000);
begin
v_impl_id := acs_object.new (object_type => 'acs_sc_implementation');
if impl_pretty_name is null then
v_impl_pretty_name := impl_name;
else
v_impl_pretty_name := impl_pretty_name;
end if;
insert into acs_sc_impls (
impl_id,
impl_name,
impl_pretty_name,
impl_owner_name,
impl_contract_name
) values (
v_impl_id,
impl_name,
v_impl_pretty_name,
impl_owner_name,
impl_contract_name
);
return v_impl_id;
end new;
function get_id (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
) return acs_sc_impls.impl_id%TYPE
as
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
select impl_id into v_impl_id
from acs_sc_impls
where impl_name = get_id.impl_name
and impl_contract_name = get_id.impl_contract_name;
return v_impl_id;
end get_id;
function get_name (
impl_id acs_sc_impls.impl_id%TYPE
) return acs_sc_impls.impl_name%TYPE
as
v_impl_name acs_sc_impls.impl_name%TYPE;
begin
select impl_name into v_impl_name
from acs_sc_impls
where impl_id = get_name.impl_id;
return v_impl_name;
end get_name;
procedure delete (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
)
as
begin
delete from acs_sc_impls
where impl_contract_name = acs_sc_impl.delete.impl_contract_name
and impl_name = acs_sc_impl.delete.impl_name;
end delete;
/* next 2 functions are deprecated. */
function new_alias (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE,
impl_alias acs_sc_impl_aliases.impl_alias%TYPE,
impl_pl acs_sc_impl_aliases.impl_pl%TYPE
) return acs_sc_impl_aliases.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
-- FUNCTION DEPRECATED. USE acs_sc_impl_alias.new
dbms_output.put_line('acs_sc_impl.new_alias DEPRECATED. Use acs_sc_impl_alias.new');
v_impl_id := acs_sc_impl_alias.new(
impl_contract_name,
impl_name,
impl_operation_name,
impl_alias,
impl_pl
);
return v_impl_id;
end new_alias;
function delete_alias (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_impls.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
-- FUNCTION DEPRECATED. USE acs_sc_impl_alias.delete
dbms_output.put_line('acs_sc_impl.delete_alias DEPRECATED. Use acs_sc_impl_alias.delete');
v_impl_id := acs_sc_impl_alias.delete(
impl_contract_name,
impl_name,
impl_operation_name
);
return v_impl_id;
end delete_alias;
end acs_sc_impl;
/
show errors
create or replace view valid_uninstalled_bindings as
select c.contract_id, c.contract_name, i.impl_id, i.impl_name, i.impl_owner_name, i.impl_pretty_name
from acs_sc_contracts c, acs_sc_impls i
where c.contract_name = i.impl_contract_name
and not exists (select 1
from acs_sc_bindings b
where b.contract_id = c.contract_id
and b.impl_id = i.impl_id)
and not exists (select 1
from acs_sc_operations o
where o.contract_id = c.contract_id
and not exists (select 1
from acs_sc_impl_aliases a
where a.impl_contract_name = c.contract_name
and a.impl_id = i.impl_id
and a.impl_operation_name = o.operation_name));
create or replace view invalid_uninstalled_bindings as
select c.contract_id, c.contract_name, i.impl_id, i.impl_name, i.impl_owner_name, i.impl_pretty_name
from acs_sc_contracts c, acs_sc_impls i
where c.contract_name = i.impl_contract_name
and not exists (select 1
from acs_sc_bindings b
where b.contract_id = c.contract_id
and b.impl_id = i.impl_id)
and exists (select 1
from acs_sc_operations o
where o.contract_id = c.contract_id
and not exists (select 1
from acs_sc_impl_aliases a
where a.impl_contract_name = c.contract_name
and a.impl_id = i.impl_id
and a.impl_operation_name = o.operation_name));
create or replace view orphan_implementations as
select i.impl_id, i.impl_name, i.impl_contract_name, i.impl_owner_name, i.impl_pretty_name
from acs_sc_impls i
where not exists (select 1
from acs_sc_bindings b
where b.impl_id = i.impl_id)
and not exists (select 1
from acs_sc_contracts c
where c.contract_name = i.impl_contract_name);
acs-service-contract-b3-5-0-patches/sql/oracle/upgrade/upgrade-4.7d3-5.0d1.sql 0000664 0000000 0000000 00000061663 10747621074 0026474 0 ustar 00root root 0000000 0000000 -- $Id$
create or replace package acs_sc_msg_type
as
function new (
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE,
msg_type_spec in varchar2
) return acs_sc_msg_types.msg_type_id%TYPE;
procedure del (
msg_type_id in acs_sc_msg_types.msg_type_id%TYPE default null,
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE default null
);
function get_id (
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE
) return acs_sc_msg_types.msg_type_id%TYPE;
function get_name (
msg_type_id in acs_sc_msg_types.msg_type_id%TYPE
) return acs_sc_msg_types.msg_type_name%TYPE;
-- ask nd about name
function parse_spec (
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE,
msg_type_spec in varchar2
) return integer;
function new_element (
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE,
element_name in acs_sc_msg_type_elements.element_name%TYPE,
element_msg_type_name in acs_sc_msg_types.msg_type_name%TYPE,
element_msg_type_isset_p in acs_sc_msg_type_elements.element_msg_type_isset_p%TYPE,
element_pos in acs_sc_msg_type_elements.element_pos%TYPE
) return acs_sc_msg_types.msg_type_id%TYPE;
end acs_sc_msg_type;
/
show errors
create or replace package body acs_sc_msg_type
as
function new (
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE,
msg_type_spec in varchar2
) return acs_sc_msg_types.msg_type_id%TYPE
is
v_msg_type_id integer;
v_spec_parse_level integer;
begin
v_msg_type_id := acs_object.new(
object_type => 'acs_sc_msg_type'
);
insert into acs_sc_msg_types (
msg_type_id,
msg_type_name
) values (
v_msg_type_id,
msg_type_name
);
v_spec_parse_level := acs_sc_msg_type.parse_spec(
msg_type_name,
msg_type_spec);
return v_msg_type_id;
end new;
procedure del (
msg_type_id in acs_sc_msg_types.msg_type_id%TYPE default null,
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE default null
)
is
v_msg_type_id acs_sc_msg_types.msg_type_id%TYPE;
begin
if msg_type_name is not NULL
then
v_msg_type_id := acs_sc_msg_type.get_id(msg_type_name);
elsif msg_type_id is not NULL
then
v_msg_type_id := msg_type_id;
else
raise_application_error(-20000, 'no args supplied to sc_msg_type.delete');
end if;
delete from acs_sc_msg_types
where msg_type_id = v_msg_type_id;
end del;
function get_id (
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE
) return acs_sc_msg_types.msg_type_id%TYPE
is
v_msg_type_id acs_sc_msg_types.msg_type_id%TYPE;
begin
select msg_type_id into v_msg_type_id
from acs_sc_msg_types
where msg_type_name = get_id.msg_type_name;
return v_msg_type_id;
end get_id;
function get_name (
msg_type_id in acs_sc_msg_types.msg_type_id%TYPE
) return acs_sc_msg_types.msg_type_name%TYPE
is
v_msg_type_name acs_sc_msg_types.msg_type_name%TYPE;
begin
select msg_type_name into v_msg_type_name
from acs_sc_msg_types
where msg_type_id = get_name.msg_type_id;
return v_msg_type_name;
end get_name;
-- string processing in pl/sql is so much fun
-- i'm sure there is a better way to go about this
function parse_spec (
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE,
msg_type_spec in varchar2
) return integer
is
v_element_pos integer;
v_str_s_idx integer; -- spec str pointers
v_str_e_idx integer;
v_elem_idx integer; -- element str pointer
v_str_len integer;
v_element varchar(200);
v_element_type varchar(200);
v_element_name varchar(200);
v_element_msg_type_name varchar(200);
v_element_msg_type_isset_p char(1);
v_junk_msg_type_id integer;
begin
-- oracle treats empty strings as nulls
if msg_type_spec is null
then
return 0;
end if;
v_element_pos := 1;
v_str_e_idx := 1;
while TRUE
loop
-- string start check
if v_element_pos = 1
then
v_str_s_idx := 1;
else
v_str_s_idx := instr(msg_type_spec, ',', v_str_e_idx);
if v_str_s_idx > 0 then
v_str_s_idx := v_str_s_idx + 1;
end if;
end if;
v_str_e_idx := instr(msg_type_spec, ',', v_str_s_idx+1)-1;
-- end of string check
if v_str_s_idx > 0 and v_str_e_idx <= 0
then
v_str_e_idx := length(msg_type_spec);
end if;
-- dbms_output.put_line(v_str_s_idx || ' '|| v_str_e_idx || ' ' || v_element_pos);
-- dbms_output.new_line();
if v_str_s_idx > 0
then
v_element := substr(msg_type_spec,
v_str_s_idx,
v_str_e_idx+1 - v_str_s_idx);
v_elem_idx := instr(v_element, ':');
if v_elem_idx > 0
then
v_element_name := trim( substr(v_element, 1, v_elem_idx-1));
v_element_type := trim( substr(v_element, v_elem_idx+1));
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_application_error (-20001,
'Wrong Format: Message Type Specification');
end if;
else
v_element_msg_type_isset_p := 'f';
v_element_msg_type_name := v_element_type;
end if;
v_junk_msg_type_id := acs_sc_msg_type.new_element (
msg_type_name =>parse_spec.msg_type_name,
element_name => v_element_name,
element_msg_type_name => v_element_msg_type_name,
element_msg_type_isset_p => v_element_msg_type_isset_p,
element_pos => v_element_pos
);
else
raise_application_error(-20001,'Wrong Format: Message Type Specification');
end if;
else
-- yippee we're done
exit;
end if;
v_element_pos := v_element_pos + 1;
end loop;
return v_element_pos - 1;
end parse_spec;
function new_element (
msg_type_name in acs_sc_msg_types.msg_type_name%TYPE,
element_name in acs_sc_msg_type_elements.element_name%TYPE,
element_msg_type_name in acs_sc_msg_types.msg_type_name%TYPE,
element_msg_type_isset_p in acs_sc_msg_type_elements.element_msg_type_isset_p%TYPE,
element_pos in acs_sc_msg_type_elements.element_pos%TYPE
) return acs_sc_msg_types.msg_type_id%TYPE
is
v_msg_type_id integer;
v_element_msg_type_id integer;
begin
v_msg_type_id := acs_sc_msg_type.get_id(msg_type_name);
if v_msg_type_id is null
then
raise_application_error (-20001, 'Unknown Message Type: ' || msg_type_name);
end if;
v_element_msg_type_id := acs_sc_msg_type.get_id(element_msg_type_name);
if v_element_msg_type_id is null
then
raise_application_error (-20001, 'Unknown Message Type: ' || element_msg_type_name);
end if;
insert into acs_sc_msg_type_elements (
msg_type_id,
element_name,
element_msg_type_id,
element_msg_type_isset_p,
element_pos
) values (
v_msg_type_id,
element_name,
v_element_msg_type_id,
element_msg_type_isset_p,
element_pos
);
return v_msg_type_id;
end new_element;
end acs_sc_msg_type;
/
show errors
create or replace package acs_sc_contract
as
function new (
contract_name in acs_sc_contracts.contract_name%TYPE,
contract_desc in acs_sc_contracts.contract_desc%TYPE
) return acs_sc_contracts.contract_id%TYPE;
function get_id (
contract_name in acs_sc_contracts.contract_name%TYPE
) return acs_sc_contracts.contract_id%TYPE;
function get_name (
contract_id in acs_sc_contracts.contract_id%TYPE
) return acs_sc_contracts.contract_name%TYPE;
procedure del (
contract_name in acs_sc_contracts.contract_name%TYPE default null,
contract_id in acs_sc_contracts.contract_id%TYPE default null
);
end acs_sc_contract;
/
show errors
create or replace package acs_sc_operation
as
function new (
contract_name in acs_sc_contracts.contract_name%TYPE,
operation_name in acs_sc_operations.operation_name%TYPE,
operation_desc in acs_sc_operations.operation_desc%TYPE,
operation_iscachable_p in acs_sc_operations.operation_iscachable_p%TYPE,
operation_nargs in acs_sc_operations.operation_nargs%TYPE,
operation_inputtype in acs_sc_msg_types.msg_type_name%TYPE,
operation_outputtype in acs_sc_msg_types.msg_type_name%TYPE
) return acs_sc_operations.operation_id%TYPE;
function get_id (
contract_name acs_sc_contracts.contract_name%TYPE,
operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_operations.operation_id%TYPE;
procedure del (
operation_id acs_sc_operations.operation_id%TYPE default null,
operation_name acs_sc_operations.operation_name%TYPE default null,
contract_name acs_sc_contracts.contract_name%TYPE default null
);
end acs_sc_operation;
/
show errors
create or replace package acs_sc_impl
as
function new (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_pretty_name acs_sc_impls.impl_pretty_name%TYPE default null,
impl_owner_name acs_sc_impls.impl_owner_name%TYPE
) return acs_sc_impls.impl_id%TYPE;
function get_id (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
) return acs_sc_impls.impl_id%TYPE;
function get_name (
impl_id acs_sc_impls.impl_id%TYPE
) return acs_sc_impls.impl_name%TYPE;
procedure del (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
);
/* Next 2 functions are deprecated but left here for backwards compatability */
function new_alias (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE,
impl_alias acs_sc_impl_aliases.impl_alias%TYPE,
impl_pl acs_sc_impl_aliases.impl_pl%TYPE
) return acs_sc_impl_aliases.impl_id%TYPE;
-- fix by Ben from delete_aliases to delete_alias
function delete_alias (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_impls.impl_id%TYPE;
end acs_sc_impl;
/
show error
create or replace package acs_sc_impl_alias
as
function new (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE,
impl_alias acs_sc_impl_aliases.impl_alias%TYPE,
impl_pl acs_sc_impl_aliases.impl_pl%TYPE
) return acs_sc_impl_aliases.impl_id%TYPE;
function del (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_impls.impl_id%TYPE;
end acs_sc_impl_alias;
/
show error
create or replace package acs_sc_binding
as
procedure new (
contract_id acs_sc_operations.contract_id%TYPE default null,
impl_id acs_sc_bindings.impl_id%TYPE default null,
contract_name acs_sc_contracts.contract_name%TYPE default null,
impl_name acs_sc_impls.impl_name%TYPE default null
);
procedure del (
contract_id acs_sc_contracts.contract_id%TYPE default null,
contract_name acs_sc_contracts.contract_name%TYPE default null,
impl_id acs_sc_impls.impl_id%TYPE default null,
impl_name acs_sc_impls.impl_name%TYPE default null
);
function exists_p (
contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
) return integer;
end acs_sc_binding;
/
show errors
create or replace package body acs_sc_contract
as
function new (
contract_name in acs_sc_contracts.contract_name%TYPE,
contract_desc in acs_sc_contracts.contract_desc%TYPE
) return acs_sc_contracts.contract_id%TYPE
is
v_contract_id acs_sc_contracts.contract_id%TYPE;
begin
v_contract_id := acs_object.new( object_type=>'acs_sc_contract');
insert into acs_sc_contracts (
contract_id,
contract_name,
contract_desc
) values (
v_contract_id,
contract_name,
contract_desc
);
return v_contract_id;
end new;
function get_id (
contract_name in acs_sc_contracts.contract_name%TYPE
) return acs_sc_contracts.contract_id%TYPE
is
v_contract_id acs_sc_contracts.contract_id%TYPE;
begin
select contract_id into v_contract_id
from acs_sc_contracts
where contract_name = get_id.contract_name;
return v_contract_id;
end get_id;
function get_name (
contract_id in acs_sc_contracts.contract_id%TYPE
) return acs_sc_contracts.contract_name%TYPE
is
v_contract_name acs_sc_contracts.contract_name%TYPE;
begin
select contract_name into v_contract_name
from acs_sc_contracts
where contract_id = get_name.contract_id;
return v_contract_name;
end get_name;
procedure del (
contract_name in acs_sc_contracts.contract_name%TYPE default null,
contract_id in acs_sc_contracts.contract_id%TYPE default null
)
is
v_contract_id acs_sc_contracts.contract_id%TYPE;
begin
if contract_name is not NULL
then
v_contract_id := acs_sc_contract.get_id(contract_name);
elsif contract_id is not NULL
then
v_contract_id := contract_id;
else
raise_application_error(-20001, 'Service Contracts: no valid args supplied to delete');
end if;
delete from acs_sc_contracts
where contract_id = v_contract_id;
acs_object.del(v_contract_id);
end del;
end acs_sc_contract;
/
show errors
create or replace package body acs_sc_operation
as
function new (
contract_name in acs_sc_contracts.contract_name%TYPE,
operation_name in acs_sc_operations.operation_name%TYPE,
operation_desc in acs_sc_operations.operation_desc%TYPE,
operation_iscachable_p in acs_sc_operations.operation_iscachable_p%TYPE,
operation_nargs in acs_sc_operations.operation_nargs%TYPE,
operation_inputtype in acs_sc_msg_types.msg_type_name%TYPE,
operation_outputtype in acs_sc_msg_types.msg_type_name%TYPE
) return acs_sc_operations.operation_id%TYPE
is
v_contract_id acs_sc_contracts.contract_id%TYPE;
v_operation_id acs_sc_operations.operation_id%TYPE;
v_operation_inputtype_id acs_sc_operations.operation_inputtype_id%TYPE;
v_operation_outputtype_id acs_sc_operations.operation_outputtype_id%TYPE;
begin
v_contract_id := acs_sc_contract.get_id(contract_name);
v_operation_id := acs_object.new (object_type=>'acs_sc_operation');
v_operation_inputtype_id := acs_sc_msg_type.get_id(operation_inputtype);
v_operation_outputtype_id := acs_sc_msg_type.get_id(operation_outputtype);
insert into acs_sc_operations (
contract_id,
operation_id,
contract_name,
operation_name,
operation_desc,
operation_iscachable_p,
operation_nargs,
operation_inputtype_id,
operation_outputtype_id
) values (
v_contract_id,
v_operation_id,
contract_name,
operation_name,
operation_desc,
operation_iscachable_p,
operation_nargs,
v_operation_inputtype_id,
v_operation_outputtype_id
);
return v_operation_id;
end new;
function get_id (
contract_name acs_sc_contracts.contract_name%TYPE,
operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_operations.operation_id%TYPE
as
v_operation_id acs_sc_operations.operation_id%TYPE;
begin
select operation_id into v_operation_id
from acs_sc_operations
where contract_name = get_id.contract_name
and operation_name = get_id.operation_name;
return v_operation_id;
end get_id;
procedure del (
operation_id acs_sc_operations.operation_id%TYPE default null,
operation_name acs_sc_operations.operation_name%TYPE default null,
contract_name acs_sc_contracts.contract_name%TYPE default null
)
is
v_operation_id acs_sc_operations.operation_id%TYPE;
begin
if (operation_id is NULL and operation_name is not NULL and contract_name is not NULL)
then
v_operation_id := get_id(contract_name, operation_name);
elsif operation_id is not NULL
then
v_operation_id := operation_id;
else
raise_application_error(-20001, 'ACS Contracts: Invalid args to operation delete');
end if;
delete from acs_sc_operations
where operation_id = v_operation_id;
end del;
end acs_sc_operation;
/
show errors
create or replace package body acs_sc_impl
as
function new (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_pretty_name acs_sc_impls.impl_pretty_name%TYPE default null,
impl_owner_name acs_sc_impls.impl_owner_name%TYPE
) return acs_sc_impls.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
v_impl_id := acs_object.new (object_type => 'acs_sc_implementation');
insert into acs_sc_impls (
impl_id,
impl_name,
impl_pretty_name,
impl_owner_name,
impl_contract_name
) values (
v_impl_id,
impl_name,
impl_pretty_name,
impl_owner_name,
impl_contract_name
);
return v_impl_id;
end new;
function get_id (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
) return acs_sc_impls.impl_id%TYPE
as
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
select impl_id into v_impl_id
from acs_sc_impls
where impl_name = get_id.impl_name
and impl_contract_name = get_id.impl_contract_name;
return v_impl_id;
end get_id;
function get_name (
impl_id acs_sc_impls.impl_id%TYPE
) return acs_sc_impls.impl_name%TYPE
as
v_impl_name acs_sc_impls.impl_name%TYPE;
begin
select impl_name into v_impl_name
from acs_sc_impls
where impl_id = get_name.impl_id;
return v_impl_name;
end get_name;
procedure del (
impl_contract_name acs_sc_impls.impl_contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
)
as
begin
delete from acs_sc_impls
where impl_contract_name = acs_sc_impl.del.impl_contract_name
and impl_name = acs_sc_impl.del.impl_name;
end del;
/* next 2 functions are deprecated. */
function new_alias (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE,
impl_alias acs_sc_impl_aliases.impl_alias%TYPE,
impl_pl acs_sc_impl_aliases.impl_pl%TYPE
) return acs_sc_impl_aliases.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
-- FUNCTION DEPRECATED. USE acs_sc_impl_alias.new
dbms_output.put_line('acs_sc_impl.new_alias DEPRECATED. Use acs_sc_impl_alias.new');
v_impl_id := acs_sc_impl_alias.new(
impl_contract_name,
impl_name,
impl_operation_name,
impl_alias,
impl_pl
);
return v_impl_id;
end new_alias;
function delete_alias (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_impls.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
-- FUNCTION DEPRECATED. USE acs_sc_impl_alias.delete
dbms_output.put_line('acs_sc_impl.delete_alias DEPRECATED. Use acs_sc_impl_alias.delete');
v_impl_id := acs_sc_impl_alias.del(
impl_contract_name,
impl_name,
impl_operation_name
);
return v_impl_id;
end delete_alias;
end acs_sc_impl;
/
show errors
create or replace package body acs_sc_impl_alias
as
function new (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE,
impl_alias acs_sc_impl_aliases.impl_alias%TYPE,
impl_pl acs_sc_impl_aliases.impl_pl%TYPE
) return acs_sc_impl_aliases.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
v_impl_id := acs_sc_impl.get_id(impl_contract_name,impl_name);
insert into acs_sc_impl_aliases (
impl_id,
impl_name,
impl_contract_name,
impl_operation_name,
impl_alias,
impl_pl
) values (
v_impl_id,
impl_name,
impl_contract_name,
impl_operation_name,
impl_alias,
impl_pl
);
return v_impl_id;
end new;
function del (
impl_contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE,
impl_operation_name acs_sc_operations.operation_name%TYPE
) return acs_sc_impls.impl_id%TYPE
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
v_impl_id := acs_sc_impl.get_id(impl_contract_name,impl_name);
delete from acs_sc_impl_aliases
where impl_contract_name = acs_sc_impl_alias.del.impl_contract_name
and impl_name = acs_sc_impl_alias.del.impl_name
and impl_operation_name = acs_sc_impl_alias.del.impl_operation_name;
return v_impl_id;
end del;
end acs_sc_impl_alias;
/
show errors
create or replace package body acs_sc_binding
as
-- you can pick a pair of args, either ids or names to pass in.
procedure new (
contract_id acs_sc_operations.contract_id%TYPE default null,
impl_id acs_sc_bindings.impl_id%TYPE default null,
contract_name acs_sc_contracts.contract_name%TYPE default null,
impl_name acs_sc_impls.impl_name%TYPE default null
)
is
v_contract_name acs_sc_contracts.contract_name%TYPE;
v_contract_id acs_sc_contracts.contract_id%TYPE;
v_impl_name acs_sc_impls.impl_name%TYPE;
v_impl_id acs_sc_impls.impl_id%TYPE;
v_count integer;
begin
if impl_id is not null and contract_id is not null
then
v_contract_name := acs_sc_contract.get_name(contract_id);
v_impl_name := acs_sc_impl.get_name(impl_id);
v_contract_id := contract_id;
v_impl_id := impl_id;
elsif contract_name is not null and impl_name is not null
then
v_contract_id := acs_sc_contract.get_id(contract_name);
v_impl_id := acs_sc_impl.get_id(contract_name,impl_name);
v_impl_name := impl_name;
v_contract_name := contract_name;
else
raise_application_error(-20001, 'Service Contracts:Invalid args to binding new');
end if;
select count(*) into v_count
from acs_sc_operations
where contract_id = new.contract_id
and operation_name not in (select impl_operation_name
from acs_sc_impl_aliases
where impl_contract_name = v_contract_name
and impl_id = v_impl_id);
if v_count > 0
then
raise_application_error(-20001, 'Binding of ' ||
v_contract_name ||
' to ' ||
v_impl_name ||
' failed since certain operations are not implemented.');
end if;
insert into acs_sc_bindings (
contract_id,
impl_id
) values (
v_contract_id,
v_impl_id
);
end new;
procedure del (
contract_id acs_sc_contracts.contract_id%TYPE default null,
contract_name acs_sc_contracts.contract_name%TYPE default null,
impl_id acs_sc_impls.impl_id%TYPE default null,
impl_name acs_sc_impls.impl_name%TYPE default null
)
is
v_contract_id acs_sc_contracts.contract_id%TYPE;
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
if impl_id is not null and contract_id is not null
then
v_impl_id := impl_id;
v_contract_id := contract_id;
elsif impl_name is not null and contract_name is not null
then
v_impl_id := acs_sc_impl.get_id(contract_name,impl_name);
v_contract_id := acs_sc_contract.get_id(contract_name);
else
raise_application_error(-20001, 'Service contract binding delete invalid args');
end if;
delete from acs_sc_bindings
where contract_id = v_contract_id
and impl_id = v_impl_id;
end del;
function exists_p (
contract_name acs_sc_contracts.contract_name%TYPE,
impl_name acs_sc_impls.impl_name%TYPE
) return integer
is
v_exists_p integer;
begin
select decode(count(*),0, 0, 1) into v_exists_p
from acs_sc_bindings
where contract_id = acs_sc_contract.get_id(contract_name)
and impl_id = acs_sc_impl.get_id(contract_name,impl_name);
return v_exists_p;
end exists_p;
end acs_sc_binding;
/
show errors
acs-service-contract-b3-5-0-patches/sql/postgresql/ 0000775 0000000 0000000 00000000000 10747621074 0022335 5 ustar 00root root 0000000 0000000 acs-service-contract-b3-5-0-patches/sql/postgresql/acs-sc-msg-types-create.sql 0000664 0000000 0000000 00000015274 10747621074 0027427 0 ustar 00root root 0000000 0000000 select acs_object_type__create_type (
'acs_sc_msg_type', -- object_type
'ACS SC Message Type', -- pretty_name
'ACS SC Message Types', -- pretty_plural
'acs_object', -- supertype
'acs_sc_msg_types', -- table_name
'msg_type_id', -- id_column
null, -- package_name
'f', -- abstract_p
null, -- type_extension_table
null -- name_method
);
create table acs_sc_msg_types (
msg_type_id integer
constraint acs_sc_msg_types_id_fk
references acs_objects(object_id)
on delete cascade
constraint acs_sc_msg_types_pk
primary key,
msg_type_name varchar(100)
constraint acs_sc_msg_types_name_un
unique
);
create table acs_sc_msg_type_elements (
msg_type_id integer
constraint acs_sc_msg_type_el_mtype_id_fk
references acs_sc_msg_types(msg_type_id)
on delete cascade,
element_name varchar(100),
element_msg_type_id integer
constraint acs_sc_msg_type_el_emti_id_fk
references acs_sc_msg_types(msg_type_id),
element_msg_type_isset_p boolean,
element_pos integer
);
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;
v_msg_type_id integer;
begin
v_msg_type_id := acs_object__new(
null,
''acs_sc_msg_type'',
now(),
null,
null,
null
);
insert into acs_sc_msg_types (
msg_type_id,
msg_type_name
) values (
v_msg_type_id,
p_msg_type_name
);
perform acs_sc_msg_type__parse_spec(p_msg_type_name,p_msg_type_spec);
return v_msg_type_id;
end;' language 'plpgsql';
create or replace function acs_sc_msg_type__get_id(varchar)
returns integer as '
declare
p_msg_type_name alias for $1;
v_msg_type_id integer;
begin
select msg_type_id into v_msg_type_id
from acs_sc_msg_types
where msg_type_name = p_msg_type_name;
return v_msg_type_id;
end;' language 'plpgsql' stable strict;
create or replace function acs_sc_msg_type__get_name(integer)
returns varchar as '
declare
p_msg_type_id alias for $1;
v_msg_type_name varchar;
begin
select msg_type_name into v_msg_type_name
from acs_sc_msg_types
where msg_type_id = p_msg_type_id;
return v_msg_type_name;
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
delete from acs_sc_msg_types
where msg_type_id = p_msg_type_id;
return 0;
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
create or replace function acs_sc_msg_type__delete(varchar)
returns integer as '
declare
p_msg_type_name alias for $1;
v_msg_type_id integer;
begin
v_msg_type_id := acs_sc_msg_type__get_id(p_msg_type_name);
perform acs_sc_msg_type__delete(v_msg_type_id);
return v_msg_type_id;
end;' language 'plpgsql' strict;
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;
v_msg_type_id integer;
v_element_msg_type_id integer;
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;
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;
end if;
insert into acs_sc_msg_type_elements (
msg_type_id,
element_name,
element_msg_type_id,
element_msg_type_isset_p,
element_pos
) values (
v_msg_type_id,
p_element_name,
v_element_msg_type_id,
p_element_msg_type_isset_p,
p_element_pos
);
return v_msg_type_id;
end;' language 'plpgsql';
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;
v_element varchar;
v_element_type varchar;
v_str_pos integer;
v_element_name varchar;
v_element_msg_type_name varchar;
v_element_msg_type_isset_p boolean;
v_element_pos integer;
begin
v_element_pos := 1;
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);
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'';
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'';
end if;
else
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'';
end if;
perform acs_sc_msg_type__new_element(
p_msg_type_name, -- msg_type_id
v_element_name, -- element_name
v_element_msg_type_name, -- element_msg_type_id
v_element_msg_type_isset_p, -- element_msg_type_isset_p
v_element_pos -- element_pos
);
v_element_pos := v_element_pos + 1;
v_element := split(p_msg_type_spec, '','', v_element_pos);
end loop;
return v_element_pos-1;
end;' language 'plpgsql';
--
-- Primitive Message Types
--
select acs_sc_msg_type__new('integer','');
select acs_sc_msg_type__new('string','');
select acs_sc_msg_type__new('boolean','');
select acs_sc_msg_type__new('timestamp','');
select acs_sc_msg_type__new('uri','');
select acs_sc_msg_type__new('version','');
select acs_sc_msg_type__new('float','');
select acs_sc_msg_type__new('bytearray','');
acs-service-contract-b3-5-0-patches/sql/postgresql/acs-sc-msg-types-drop.sql 0000664 0000000 0000000 00000001106 10747621074 0027115 0 ustar 00root root 0000000 0000000 drop function acs_sc_msg_type__parse_spec(varchar,varchar);
drop function acs_sc_msg_type__new_element(varchar,varchar,varchar,boolean,integer);
drop table acs_sc_msg_type_elements;
drop function acs_sc_msg_type__delete(varchar);
drop function acs_sc_msg_type__delete(integer);
drop function acs_sc_msg_type__get_name(integer);
drop function acs_sc_msg_type__get_id(varchar);
drop function acs_sc_msg_type__new(varchar,varchar);
drop table acs_sc_msg_types;
delete from acs_objects where object_type = 'acs_sc_msg_type';
select acs_object_type__drop_type ('acs_sc_msg_type', 'f');
acs-service-contract-b3-5-0-patches/sql/postgresql/acs-sc-object-types-create.sql 0000664 0000000 0000000 00000002342 10747621074 0030077 0 ustar 00root root 0000000 0000000 select acs_object_type__create_type (
'acs_sc_contract', -- object_type
'ACS SC Contract', -- pretty_name
'ACS SC Contracts', -- pretty_plural
'acs_object', -- supertype
'acs_sc_contracts', -- table_name
'contract_id', -- id_column
null, -- package_name
'f', -- abstract_p
null, -- type_extension_table
null -- name_method
);
select acs_object_type__create_type (
'acs_sc_operation', -- object_type
'ACS SC Operation', -- pretty_name
'ACS SC Operations', -- pretty_plural
'acs_object', -- supertype
'acs_sc_operations', -- table_name
'operation_id', -- id_column
null, -- package_name
'f', -- abstract_p
null, -- type_extension_table
null -- name_method
);
select acs_object_type__create_type (
'acs_sc_implementation', -- object_type
'ACS SC Implementation', -- pretty_name
'ACS SC Implementations', -- pretty_plural
'acs_object', -- supertype
'acs_sc_impls', -- table_name
'impl_id', -- id_column
null, -- package_name
'f', -- abstract_p
null, -- type_extension_table
null -- name_method
);
acs-service-contract-b3-5-0-patches/sql/postgresql/acs-sc-object-types-drop.sql 0000664 0000000 0000000 00000000602 10747621074 0027575 0 ustar 00root root 0000000 0000000 delete from acs_objects where object_type = 'acs_sc_implementation';
select acs_object_type__drop_type ('acs_sc_implementation', 'f');
delete from acs_objects where object_type = 'acs_sc_operation';
select acs_object_type__drop_type ('acs_sc_operation', 'f');
delete from acs_objects where object_type = 'acs_sc_contract';
select acs_object_type__drop_type ('acs_sc_contract', 'f');
acs-service-contract-b3-5-0-patches/sql/postgresql/acs-sc-packages-create.sql 0000664 0000000 0000000 00000030213 10747621074 0027243 0 ustar 00root root 0000000 0000000 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;
v_contract_id integer;
begin
v_contract_id := acs_object__new(
null,
''acs_sc_contract'',
now(),
null,
null,
null
);
insert into acs_sc_contracts (
contract_id,
contract_name,
contract_desc
) values (
v_contract_id,
p_contract_name,
p_contract_desc
);
return v_contract_id;
end;' language 'plpgsql';
create or replace function acs_sc_contract__get_id(varchar)
returns integer as '
declare
p_contract_name alias for $1;
v_contract_id integer;
begin
select contract_id into v_contract_id
from acs_sc_contracts
where contract_name = p_contract_name;
return v_contract_id;
end;' language 'plpgsql' stable strict;
create or replace function acs_sc_contract__get_name(integer)
returns varchar as '
declare
p_contract_id alias for $1;
v_contract_name varchar;
begin
select contract_name into v_contract_name
from acs_sc_contracts
where contract_id = p_contract_id;
return v_contract_name;
end;' language 'plpgsql' stable strict;
create or replace function acs_sc_contract__delete(integer)
returns integer as '
declare
p_contract_id alias for $1;
begin
delete from acs_sc_contracts
where contract_id = p_contract_id;
return 0;
end;' language 'plpgsql';
create or replace function acs_sc_contract__delete(varchar)
returns integer as '
declare
p_contract_name alias for $1;
v_contract_id integer;
begin
v_contract_id := acs_sc_contract__get_id(p_contract_name);
perform acs_sc_contract__delete(v_contract_id);
return 0;
end;' language 'plpgsql';
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;
v_contract_id integer;
v_operation_id integer;
v_operation_inputtype_id integer;
v_operation_outputtype_id integer;
begin
v_contract_id := acs_sc_contract__get_id(p_contract_name);
v_operation_id := acs_object__new(
null,
''acs_sc_operation'',
now(),
null,
null,
null
);
v_operation_inputtype_id := acs_sc_msg_type__get_id(p_operation_inputtype);
v_operation_outputtype_id := acs_sc_msg_type__get_id(p_operation_outputtype);
insert into acs_sc_operations (
contract_id,
operation_id,
contract_name,
operation_name,
operation_desc,
operation_iscachable_p,
operation_nargs,
operation_inputtype_id,
operation_outputtype_id
) values (
v_contract_id,
v_operation_id,
p_contract_name,
p_operation_name,
p_operation_desc,
p_operation_iscachable_p,
p_operation_nargs,
v_operation_inputtype_id,
v_operation_outputtype_id
);
return v_operation_id;
end;' language 'plpgsql';
create or replace function acs_sc_operation__get_id(varchar,varchar)
returns integer as '
declare
p_contract_name alias for $1;
p_operation_name alias for $2;
v_operation_id integer;
begin
select operation_id into v_operation_id
from acs_sc_operations
where contract_name = p_contract_name
and operation_name = p_operation_name;
return v_operation_id;
end;' language 'plpgsql' stable strict;
create or replace function acs_sc_operation__delete(integer)
returns integer as '
declare
p_operation_id alias for $1;
begin
delete from acs_sc_operations
where operation_id = p_operation_id;
return 0;
end;' language 'plpgsql';
-- XXX: should it exception on null?
create or replace function acs_sc_operation__delete(varchar,varchar)
returns integer as '
declare
p_contract_name alias for $1;
p_operation_name alias for $2;
v_operation_id integer;
begin
v_operation_id := acs_sc_operation__get_id(
p_contract_name,
p_operation_name
);
perform acs_sc_operation__delete(v_operation_id);
return v_operation_id;
end;' language 'plpgsql' strict;
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;
v_impl_id integer;
begin
v_impl_id := acs_object__new(
null,
''acs_sc_implementation'',
now(),
null,
null,
null
);
insert into acs_sc_impls (
impl_id,
impl_name,
impl_pretty_name,
impl_owner_name,
impl_contract_name
) values (
v_impl_id,
p_impl_name,
p_impl_pretty_name,
p_impl_owner_name,
p_impl_contract_name
);
return v_impl_id;
end;' language 'plpgsql';
-- Only three arguments, defaults pretty name to empty string
create or replace function acs_sc_impl__new(varchar,varchar,varchar)
returns integer as '
declare
p_impl_contract_name alias for $1;
p_impl_name alias for $2;
p_impl_owner_name alias for $3;
v_impl_id integer;
begin
-- Using an empty pretty name
v_impl_id := acs_sc_impl__new(
p_impl_contract_name,
p_impl_name,
p_impl_name,
p_impl_owner_name
);
return v_impl_id;
end;' language 'plpgsql';
create or replace function acs_sc_impl__get_id(varchar,varchar)
returns integer as '
declare
p_impl_contract_name alias for $1;
p_impl_name alias for $2;
v_impl_id integer;
begin
select impl_id into v_impl_id
from acs_sc_impls
where impl_name = p_impl_name
and impl_contract_name = p_impl_contract_name;
return v_impl_id;
end;' language 'plpgsql' stable strict;
create or replace function acs_sc_impl__get_name(integer)
returns varchar as '
declare
p_impl_id alias for $1;
v_impl_name varchar;
begin
select impl_name into v_impl_name
from acs_sc_impls
where impl_id = p_impl_id;
return v_impl_name;
end;' language 'plpgsql' stable strict;
create or replace function acs_sc_impl__delete(varchar,varchar)
returns integer as '
declare
p_impl_contract_name alias for $1;
p_impl_name alias for $2;
begin
delete from acs_sc_impls
where impl_contract_name = p_impl_contract_name
and impl_name = p_impl_name;
return 0;
end;' language 'plpgsql';
create or replace function acs_sc_impl_alias__new(varchar,varchar,varchar,varchar,varchar)
returns integer as '
declare
p_impl_contract_name alias for $1;
p_impl_name alias for $2;
p_impl_operation_name alias for $3;
p_impl_alias alias for $4;
p_impl_pl alias for $5;
v_impl_id integer;
begin
v_impl_id := acs_sc_impl__get_id(p_impl_contract_name,p_impl_name);
insert into acs_sc_impl_aliases (
impl_id,
impl_name,
impl_contract_name,
impl_operation_name,
impl_alias,
impl_pl
) values (
v_impl_id,
p_impl_name,
p_impl_contract_name,
p_impl_operation_name,
p_impl_alias,
p_impl_pl
);
return v_impl_id;
end;' language 'plpgsql';
create or replace function acs_sc_impl_alias__delete(varchar,varchar,varchar)
returns integer as '
declare
p_impl_contract_name alias for $1;
p_impl_name alias for $2;
p_impl_operation_name alias for $3;
v_impl_id integer;
begin
v_impl_id := acs_sc_impl__get_id(p_impl_contract_name, p_impl_name);
delete from acs_sc_impl_aliases
where impl_contract_name = p_impl_contract_name
and impl_name = p_impl_name
and impl_operation_name = p_impl_operation_name;
return v_impl_id;
end;' language 'plpgsql';
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;
v_contract_name varchar;
v_impl_name varchar;
v_count integer;
begin
v_contract_name := acs_sc_contract__get_name(p_contract_id);
v_impl_name := acs_sc_impl__get_name(p_impl_id);
select count(*) into v_count
from acs_sc_operations
where contract_id = p_contract_id
and operation_name not in (select impl_operation_name
from acs_sc_impl_aliases
where impl_contract_name = v_contract_name
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;
end if;
insert into acs_sc_bindings (
contract_id,
impl_id
) values (
p_contract_id,
p_impl_id
);
return 0;
end;' language 'plpgsql';
create or replace function acs_sc_binding__new(varchar,varchar)
returns integer as '
declare
p_contract_name alias for $1;
p_impl_name alias for $2;
v_contract_id integer;
v_impl_id integer;
v_count integer;
begin
v_contract_id := acs_sc_contract__get_id(p_contract_name);
v_impl_id := acs_sc_impl__get_id(p_contract_name,p_impl_name);
if v_contract_id is null or v_impl_id is null then
raise exception ''Binding of % to % failed.'', p_contract_name, p_impl_name;
else
perform acs_sc_binding__new(v_contract_id,v_impl_id);
end if;
return 0;
end;' language 'plpgsql';
create or replace function acs_sc_binding__delete(integer,integer)
returns integer as '
declare
p_contract_id alias for $1;
p_impl_id alias for $2;
begin
delete from acs_sc_bindings
where contract_id = p_contract_id
and impl_id = p_impl_id;
return 0;
end;' language 'plpgsql';
create or replace function acs_sc_binding__delete(varchar,varchar)
returns integer as '
declare
p_contract_name alias for $1;
p_impl_name alias for $2;
v_contract_id integer;
v_impl_id integer;
begin
v_contract_id := acs_sc_contract__get_id(p_contract_name);
v_impl_id := acs_sc_impl__get_id(p_contract_name,p_impl_name);
perform acs_sc_binding__delete(v_contract_id,v_impl_id);
return 0;
end;' language 'plpgsql';
create or replace function acs_sc_binding__exists_p(varchar,varchar)
returns integer as '
declare
p_contract_name alias for $1;
p_impl_name alias for $2;
v_contract_id integer;
v_impl_id integer;
v_exists_p integer;
begin
v_contract_id := acs_sc_contract__get_id(p_contract_name);
v_impl_id := acs_sc_impl__get_id(p_contract_name,p_impl_name);
select case when count(*)=0 then 0 else 1 end into v_exists_p
from acs_sc_bindings
where contract_id = v_contract_id
and impl_id = v_impl_id;
return v_exists_p;
end;' language 'plpgsql' stable;
acs-service-contract-b3-5-0-patches/sql/postgresql/acs-sc-packages-drop.sql 0000664 0000000 0000000 00000002142 10747621074 0026744 0 ustar 00root root 0000000 0000000 drop function acs_sc_binding__exists_p(varchar,varchar);
drop function acs_sc_binding__delete(varchar,varchar);
drop function acs_sc_binding__delete(integer,integer);
drop function acs_sc_binding__new(integer,integer);
drop function acs_sc_binding__new(varchar,varchar);
drop function acs_sc_impl_alias__delete(varchar,varchar,varchar);
drop function acs_sc_impl_alias__new(varchar,varchar,varchar,varchar,varchar);
drop function acs_sc_impl__delete(varchar,varchar);
drop function acs_sc_impl__get_name(integer);
drop function acs_sc_impl__get_id(varchar,varchar);
drop function acs_sc_impl__new(varchar,varchar,varchar);
drop function acs_sc_operation__delete(varchar,varchar);
drop function acs_sc_operation__delete(integer);
drop function acs_sc_operation__get_id(varchar,varchar);
drop function acs_sc_operation__new(varchar,varchar,text,boolean,integer,varchar,varchar);
drop function acs_sc_contract__delete(varchar);
drop function acs_sc_contract__delete(integer);
drop function acs_sc_contract__get_name(integer);
drop function acs_sc_contract__get_id(varchar);
drop function acs_sc_contract__new(varchar,text);
acs-service-contract-b3-5-0-patches/sql/postgresql/acs-sc-tables-create.sql 0000664 0000000 0000000 00000005067 10747621074 0026750 0 ustar 00root root 0000000 0000000 create table acs_sc_contracts (
contract_id integer
constraint acs_sc_contracts_id_fk
references acs_objects(object_id)
on delete cascade
constraint acs_sc_contracts_pk
primary key,
contract_name varchar(1000)
constraint acs_sc_contracts_name_nn
not null
constraint acs_sc_contracts_name_un
unique,
contract_desc text
constraint acs_sc_contracts_desc_nn
not null
);
create table acs_sc_operations (
contract_id integer
constraint acs_sc_operations_cid_fk
references acs_sc_contracts(contract_id)
on delete cascade,
operation_id integer
constraint acs_sc_operations_opid_fk
references acs_objects(object_id)
on delete cascade
constraint acs_sc_operations_pk
primary key,
contract_name varchar(1000),
operation_name varchar(100),
operation_desc text
constraint acs_sc_operations_desc_nn
not null,
operation_iscachable_p boolean,
operation_nargs integer,
operation_inputtype_id integer
constraint acs_sc_operations_intype_fk
references acs_sc_msg_types(msg_type_id),
operation_outputtype_id integer
constraint acs_sc_operations_outtype_fk
references acs_sc_msg_types(msg_type_id)
);
create table acs_sc_impls (
impl_id integer
constraint acs_sc_impls_impl_id_fk
references acs_objects(object_id)
on delete cascade
constraint acs_sc_impls_pk
primary key,
impl_name varchar(100),
impl_pretty_name varchar(200),
impl_owner_name varchar(1000),
impl_contract_name varchar(1000)
);
create table acs_sc_impl_aliases (
impl_id integer
constraint acs_sc_impl_proc_impl_id_fk
references acs_sc_impls(impl_id)
on delete cascade,
impl_name varchar(100),
impl_contract_name varchar(1000),
impl_operation_name varchar(100),
impl_alias varchar(100),
impl_pl varchar(100),
constraint acs_sc_impl_alias_un unique(impl_name,impl_contract_name,impl_operation_name)
);
create table acs_sc_bindings (
contract_id integer
constraint acs_sc_bindings_cid_fk
references acs_sc_contracts(contract_id)
on delete cascade,
impl_id integer
constraint acs_sc_bindings_impl_id_fk
references acs_sc_impls(impl_id)
on delete cascade
);
acs-service-contract-b3-5-0-patches/sql/postgresql/acs-sc-tables-drop.sql 0000664 0000000 0000000 00000000220 10747621074 0026433 0 ustar 00root root 0000000 0000000 drop table acs_sc_bindings;
drop table acs_sc_impl_aliases;
drop table acs_sc_impls;
drop table acs_sc_operations;
drop table acs_sc_contracts;
acs-service-contract-b3-5-0-patches/sql/postgresql/acs-sc-views-create.sql 0000664 0000000 0000000 00000004170 10747621074 0026625 0 ustar 00root root 0000000 0000000 -- $Id$
create view valid_uninstalled_bindings as
select c.contract_id, c.contract_name, i.impl_id, i.impl_name, i.impl_owner_name, i.impl_pretty_name
from acs_sc_contracts c, acs_sc_impls i
where c.contract_name = i.impl_contract_name
and not exists (select 1
from acs_sc_bindings b
where b.contract_id = c.contract_id
and b.impl_id = i.impl_id)
and not exists (select 1
from acs_sc_operations o
where o.contract_id = c.contract_id
and not exists (select 1
from acs_sc_impl_aliases a
where a.impl_contract_name = c.contract_name
and a.impl_id = i.impl_id
and a.impl_operation_name = o.operation_name));
create view invalid_uninstalled_bindings as
select c.contract_id, c.contract_name, i.impl_id, i.impl_name, i.impl_owner_name, i.impl_pretty_name
from acs_sc_contracts c, acs_sc_impls i
where c.contract_name = i.impl_contract_name
and not exists (select 1
from acs_sc_bindings b
where b.contract_id = c.contract_id
and b.impl_id = i.impl_id)
and exists (select 1
from acs_sc_operations o
where o.contract_id = c.contract_id
and not exists (select 1
from acs_sc_impl_aliases a
where a.impl_contract_name = c.contract_name
and a.impl_id = i.impl_id
and a.impl_operation_name = o.operation_name));
create view orphan_implementations as
select i.impl_id, i.impl_name, i.impl_owner_name, i.impl_contract_name, i.impl_pretty_name
from acs_sc_impls i
where not exists (select 1
from acs_sc_bindings b
where b.impl_id = i.impl_id)
and not exists (select 1
from acs_sc_contracts c
where c.contract_name = i.impl_contract_name);
acs-service-contract-b3-5-0-patches/sql/postgresql/acs-sc-views-drop.sql 0000664 0000000 0000000 00000000157 10747621074 0026327 0 ustar 00root root 0000000 0000000 drop view orphan_implementations;
drop view invalid_uninstalled_bindings;
drop view valid_uninstalled_bindings; acs-service-contract-b3-5-0-patches/sql/postgresql/acs-service-contract-create.sql 0000664 0000000 0000000 00000000225 10747621074 0030335 0 ustar 00root root 0000000 0000000 \i acs-sc-msg-types-create.sql
\i acs-sc-object-types-create.sql
\i acs-sc-tables-create.sql
\i acs-sc-packages-create.sql
\i acs-sc-views-create.sql acs-service-contract-b3-5-0-patches/sql/postgresql/acs-service-contract-drop.sql 0000664 0000000 0000000 00000000213 10747621074 0030033 0 ustar 00root root 0000000 0000000 \i acs-sc-views-drop.sql
\i acs-sc-packages-drop.sql
\i acs-sc-tables-drop.sql
\i acs-sc-object-types-drop.sql
\i acs-sc-msg-types-drop.sql acs-service-contract-b3-5-0-patches/sql/postgresql/sc-sample-create.sql 0000664 0000000 0000000 00000005213 10747621074 0026204 0 ustar 00root root 0000000 0000000 -- CREATE CONTRACT
select acs_sc_contract__new (
'ObjectDisplay', -- contract_name
'Object display' -- contract_desc
);
select acs_sc_msg_type__new ('ObjectDisplay.Name.InputType','object_id:integer');
select acs_sc_msg_type__new ('ObjectDisplay.Name.OutputType','object_name:string');
select acs_sc_operation__new (
'ObjectDisplay', -- contract_name
'name', -- operation_name
'Returns object''s name', -- operation_desc
'f', -- operation_iscachable_p
1, -- operation_nargs
'ObjectDisplay.Name.InputType', -- operation_inputtype
'ObjectDisplay.Name.OutputType' -- operation_outputtype
);
select acs_sc_msg_type__new ('ObjectDisplay.Url.InputType','object_id:integer');
select acs_sc_msg_type__new ('ObjectDisplay.Url.OutputType','object_url:uri');
select acs_sc_operation__new (
'ObjectDisplay', -- contract_name
'url', -- operation_name
'Returns object''s url', -- operation_desc
'f', -- operation_iscachable_p
1, -- operation_nargs
'ObjectDisplay.Url.InputType', -- operation_inputtype
'ObjectDisplay.Url.OutputType' -- operation_outputtype
);
select acs_sc_msg_type__new ('ObjectDisplay.SampleHello.InputType','object_id:integer,object_txt:string');
select acs_sc_msg_type__new ('ObjectDisplay.SampleHello.OutputType','object_sample:string[],xxx_p:boolean');
select acs_sc_operation__new (
'ObjectDisplay', -- contract_name
'sample_hello', -- operation_name
'Returns object''s url', -- operation_desc
't', -- operation_iscachable_p
1, -- operation_nargs
'ObjectDisplay.SampleHello.InputType', -- operation_inputtype
'ObjectDisplay.SampleHello.OutputType' -- operation_outputtype
);
-- CREATE IMPLEMENTATION
select acs_sc_impl__new(
'ObjectDisplay', -- impl_contract_name
'bboard_message', -- impl_name
'bboard' -- impl_owner_name
);
select acs_sc_impl_alias__new(
'ObjectDisplay', -- impl_contract_name
'bboard_message', -- impl_name
'name', -- impl_operation_name
'bboard_message__name', -- impl_alias
'PLPGSQL' -- impl_pl
);
select acs_sc_impl_alias__new(
'ObjectDisplay', -- impl_contract_name
'bboard_message', -- impl_name
'url', -- impl_operation_name
'bboard_message__url', -- impl_alias
'PLPGSQL' -- impl_pl
);
select acs_sc_impl_alias__new(
'ObjectDisplay', -- impl_contract_name
'bboard_message', -- impl_name
'sample_hello', -- impl_operation_name
'bboard_message__sample_hello', -- impl_alias
'TCL' -- impl_pl
);
acs-service-contract-b3-5-0-patches/sql/postgresql/sc-sample-drop.sql 0000664 0000000 0000000 00000001102 10747621074 0025676 0 ustar 00root root 0000000 0000000 select acs_sc_contract__delete('ObjectDisplay');
select acs_sc_msg_type__delete ('ObjectDisplay.Name.InputType');
select acs_sc_msg_type__delete ('ObjectDisplay.Name.OutputType');
select acs_sc_msg_type__delete ('ObjectDisplay.Url.InputType');
select acs_sc_msg_type__delete ('ObjectDisplay.Url.OutputType');
select acs_sc_msg_type__delete ('ObjectDisplay.SampleHello.InputType');
select acs_sc_msg_type__delete ('ObjectDisplay.SampleHello.OutputType');
select acs_sc_impl__delete(
'ObjectDisplay', -- impl_contract_name
'bboard_message' -- impl_name
);
acs-service-contract-b3-5-0-patches/sql/postgresql/upgrade/ 0000775 0000000 0000000 00000000000 10747621074 0023764 5 ustar 00root root 0000000 0000000 acs-service-contract-b3-5-0-patches/sql/postgresql/upgrade/upgrade-4.5.1-4.6.sql 0000664 0000000 0000000 00000002252 10747621074 0027105 0 ustar 00root root 0000000 0000000 -- packages/acs-service-contract/sql/oracle/upgrade/upgrade-4.5-4.5.1.sql
--
-- @author Vinod Kurup (vinod@kurup.com)
-- @creation_date 2002-08-14
--
-- $Id$
-- 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;
v_contract_name varchar;
v_impl_name varchar;
v_count integer;
begin
v_contract_name := acs_sc_contract__get_name(p_contract_id);
v_impl_name := acs_sc_impl__get_name(p_impl_id);
select count(*) into v_count
from acs_sc_operations
where contract_id = p_contract_id
and operation_name not in (select impl_operation_name
from acs_sc_impl_aliases
where impl_contract_name = v_contract_name
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;
end if;
insert into acs_sc_bindings (
contract_id,
impl_id
) values (
p_contract_id,
p_impl_id
);
return 0;
end;' language 'plpgsql';
acs-service-contract-b3-5-0-patches/sql/postgresql/upgrade/upgrade-4.7d2-4.7d3.sql 0000664 0000000 0000000 00000006515 10747621074 0027434 0 ustar 00root root 0000000 0000000 --
-- @author Simon Carstensen (simon@collaboraid.biz)
-- @creation_date 2003-09-10
--
-- $Id$
-- add column impl_pretty_name
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;
v_impl_id integer;
begin
v_impl_id := acs_object__new(
null,
''acs_sc_implementation'',
now(),
null,
null,
null
);
insert into acs_sc_impls (
impl_id,
impl_name,
impl_pretty_name,
impl_owner_name,
impl_contract_name
) values (
v_impl_id,
p_impl_name,
p_impl_pretty_name,
p_impl_owner_name,
p_impl_contract_name
);
return v_impl_id;
end;' language 'plpgsql';
drop view valid_uninstalled_bindings;
create view valid_uninstalled_bindings as
select c.contract_id, c.contract_name, i.impl_id, i.impl_name, i.impl_owner_name, i.impl_pretty_name
from acs_sc_contracts c, acs_sc_impls i
where c.contract_name = i.impl_contract_name
and not exists (select 1
from acs_sc_bindings b
where b.contract_id = c.contract_id
and b.impl_id = i.impl_id)
and not exists (select 1
from acs_sc_operations o
where o.contract_id = c.contract_id
and not exists (select 1
from acs_sc_impl_aliases a
where a.impl_contract_name = c.contract_name
and a.impl_id = i.impl_id
and a.impl_operation_name = o.operation_name));
drop view invalid_uninstalled_bindings;
create view invalid_uninstalled_bindings as
select c.contract_id, c.contract_name, i.impl_id, i.impl_name, i.impl_owner_name, i.impl_pretty_name
from acs_sc_contracts c, acs_sc_impls i
where c.contract_name = i.impl_contract_name
and not exists (select 1
from acs_sc_bindings b
where b.contract_id = c.contract_id
and b.impl_id = i.impl_id)
and exists (select 1
from acs_sc_operations o
where o.contract_id = c.contract_id
and not exists (select 1
from acs_sc_impl_aliases a
where a.impl_contract_name = c.contract_name
and a.impl_id = i.impl_id
and a.impl_operation_name = o.operation_name));
drop view orphan_implementations;
create view orphan_implementations as
select i.impl_id, i.impl_name, i.impl_owner_name, i.impl_contract_name, i.impl_pretty_name
from acs_sc_impls i
where not exists (select 1
from acs_sc_bindings b
where b.impl_id = i.impl_id)
and not exists (select 1
from acs_sc_contracts c
where c.contract_name = i.impl_contract_name);
acs-service-contract-b3-5-0-patches/tcl/ 0000775 0000000 0000000 00000000000 10747621074 0020115 5 ustar 00root root 0000000 0000000 acs-service-contract-b3-5-0-patches/tcl/acs-service-contract-init-oracle.xql 0000664 0000000 0000000 00000000400 10747621074 0027060 0 ustar 00root root 0000000 0000000
oracle8.1.6
select acs_sc_binding.exists_p(:impl_contract_name,:impl_name) from dual
acs-service-contract-b3-5-0-patches/tcl/acs-service-contract-init-postgresql.xql 0000664 0000000 0000000 00000000370 10747621074 0030024 0 ustar 00root root 0000000 0000000
postgresql7.1
select acs_sc_binding__exists_p(:impl_contract_name,:impl_name)
acs-service-contract-b3-5-0-patches/tcl/acs-service-contract-init.tcl 0000664 0000000 0000000 00000001030 10747621074 0025573 0 ustar 00root root 0000000 0000000 # Loop over actual bindings, finding every impl alias for each contract operation
db_foreach impl_operation {
select ia.impl_contract_name,
ia.impl_operation_name,
ia.impl_name,
ia.impl_alias,
ia.impl_pl
from acs_sc_bindings b,
acs_sc_impl_aliases ia
where ia.impl_id = b.impl_id
} {
# 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
}
acs-service-contract-b3-5-0-patches/tcl/acs-service-contract-procs-oracle.xql 0000664 0000000 0000000 00000003135 10747621074 0027253 0 ustar 00root root 0000000 0000000
oracle8.1.6
select acs_sc_binding.exists_p(:contract,:impl) from dual
select impl_alias, impl_pl
from acs_sc_impl_aliases
where impl_contract_name = :contract
and impl_operation_name = :operation
and impl_name = :impl
select
operation_desc,
nvl(operation_iscachable_p,'f') as operation_iscachable_p,
operation_nargs,
operation_inputtype_id,
operation_outputtype_id
from acs_sc_operations
where contract_name = :contract
and operation_name = :operation
select
element_name,
acs_sc_msg_type.get_name(element_msg_type_id) as element_msg_type_name,
element_msg_type_isset_p,
element_pos
from acs_sc_msg_type_elements
where msg_type_id = :operation_inputtype_id
order by element_pos asc
select
element_name,
acs_sc_msg_type.get_name(element_msg_type_id) as element_msg_type_name,
element_msg_type_isset_p,
element_pos
from acs_sc_msg_type_elements
where msg_type_id = :operation_outputtype_id
order by element_pos asc
acs-service-contract-b3-5-0-patches/tcl/acs-service-contract-procs-postgresql.xql 0000664 0000000 0000000 00000003153 10747621074 0030211 0 ustar 00root root 0000000 0000000
postgresql7.1
select acs_sc_binding__exists_p(:contract,:impl)
select impl_alias, impl_pl
from acs_sc_impl_aliases
where impl_contract_name = :contract
and impl_operation_name = :operation
and impl_name = :impl
select distinct
operation_desc,
coalesce(operation_iscachable_p,'f') as operation_iscachable_p,
operation_nargs,
operation_inputtype_id,
operation_outputtype_id
from acs_sc_operations
where contract_name = :contract
and operation_name = :operation
select
element_name,
acs_sc_msg_type__get_name(element_msg_type_id) as element_msg_type_name,
element_msg_type_isset_p,
element_pos
from acs_sc_msg_type_elements
where msg_type_id = :operation_inputtype_id
order by element_pos asc
select
element_name,
acs_sc_msg_type__get_name(element_msg_type_id) as element_msg_type_name,
element_msg_type_isset_p,
element_pos
from acs_sc_msg_type_elements
where msg_type_id = :operation_outputtype_id
order by element_pos asc
acs-service-contract-b3-5-0-patches/tcl/acs-service-contract-procs.tcl 0000664 0000000 0000000 00000017072 10747621074 0025773 0 ustar 00root root 0000000 0000000 ad_library {
Support library for acs service contracts.
@author Neophytos Demetriou
@creation-date 2001-09-01
@cvs-id $Id$
}
namespace eval acs_sc {}
#####
#
# Invoke
#
#####
ad_proc -public acs_sc::invoke {
{-contract ""}
{-operation:required}
{-impl ""}
{-impl_id ""}
{-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.
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.
@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.
@param impl The name of the implementation you wish to use.
@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] } {
error "Cannot supply both impl and impl_id"
}
acs_sc::impl::get -impl_id $impl_id -array impl_info
set impl $impl_info(impl_name)
if { ![empty_string_p $contract] && ![string equal $contract $impl_info(impl_contract_name)] } {
error "The contract of implementation with id $impl_id does not match contract passed in. Expected contract to be '$contract', but contract of impl_id was '$impl_info(impl_contract_name)'"
}
set contract $impl_info(impl_contract_name)
}
if { ![exists_and_not_null impl] || ![exists_and_not_null contract] } {
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]
}
#####
#
# All the rest that used to be there
#
#####
ad_proc -public acs_sc_binding_exists_p {
contract
impl
} {
Returns a boolean depending on whether or not the binding between
the contract and implementation exists.
@param contract the contract name
@param impl the implementation name
@return 0 or 1
@author Neophytos Demetriou
} {
return [db_string binding_exists_p {*SQL*}]
}
ad_proc -private acs_sc_generate_name {
contract
impl
operation
} {
generate the internal proc name.
@author Neophytos Demetriou
} {
return "AcsSc.[util_text_to_url -no_resolve -replacement "_" -text $contract].[util_text_to_url -no_resolve -replacement "_" -text $operation].[util_text_to_url -no_resolve -replacement "_" -text $impl]"
}
ad_proc -private acs_sc_get_alias {
contract
operation
impl
} {
Returns the implementation alias (the
proc defined to handle a given operation
for a given implementation).
@author Neophytos Demetriou
} {
# 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 {*SQL*}
return [list $impl_alias $impl_pl]
}
ad_proc -private acs_sc_proc {
contract
operation
impl
{impl_alias {}}
{impl_pl {}}
} {
Builds the proc used by acs_sc_call, generally only called
in acs-service-contract-init.tcl at startup.
@return 0 on failure, 1 on success.
@author Neophytos Demetriou
} {
set arguments [list]
set docblock {}
set proc_name [acs_sc_generate_name $contract $impl $operation]
acs_sc_log SCDebug "ACS_SC_PROC: proc_name = $proc_name"
if { [empty_string_p $impl_alias] } {
foreach {impl_alias impl_pl} [acs_sc_get_alias $contract $operation $impl] break
}
if { [empty_string_p $impl_alias] } {
error "ACS-SC: Cannot find alias for $proc_name"
}
if {![db_0or1row get_operation_definition {*SQL*}]} {
ns_log warning "ACS-SC: operation definition not found for contract $contract operation $operation"
return 0
}
append docblock "\nacs-service-contract operation. Call via acs_sc_call.\n\n$operation_desc\n\n"
db_foreach operation_inputtype_element {*SQL*} {
lappend arguments "$element_name"
append docblock "\n@param $element_name $element_msg_type_name"
if { $element_msg_type_isset_p } {
append docblock " \[\]"
}
}
db_foreach operation_outputtype_element {*SQL*} {
append docblock "\n@return $element_name - $element_msg_type_name"
if { $element_msg_type_isset_p } {
append docblock " \[\]"
}
}
append docblock "\n@see $impl_alias\n@see acs_sc_call"
set full_statement [acs_sc_get_statement $impl_alias $impl_pl $arguments]
if { $operation_iscachable_p } {
set full_statement "util_memoize \"$full_statement\""
}
#FIX ME: CALL BY NAME USING UPVAR
set body "return \[$full_statement\]"
set arguments [join $arguments]
acs_sc_log SCDebug "ACS-SC: ad_proc $proc_name $arguments\n$docblock\n$body\n"
ad_proc -private $proc_name $arguments $docblock $body
return 1
}
ad_proc -private acs_sc_get_statement {
impl_alias
impl_pl
arguments
} {
Builds the statement to call from the provided metadata.
@param impl_alias tcl or plpgsql proc to call
@param impl_pl programmimg language of the proc to call (TCL or PLPGSQL)
@param arguments list of argument names
@author Neophytos Demetriou
} {
switch $impl_pl {
TCL {
set full_statement [list $impl_alias]
for {set __i 0} {$__i < [llength $arguments]} {incr __i} {
lappend full_statement "\$[lindex $arguments $__i]"
}
set full_statement [join $full_statement]
}
PLPGSQL {
set args_list [list]
for {set __i 0} {$__i < [llength $arguments]} {incr __i} {
lappend args_list "\$[lindex $arguments $__i]"
}
set args_final [join $args_list ,]
set full_statement "db_exec_plsql full_statement \"select ${impl_alias}(${args_final})\""
}
default {
error "ACS-SC: Unknown impl_pl: $impl_pl"
}
}
return $full_statement
}
ad_proc -private -deprecated acs_sc_call {
{-error:boolean}
contract
operation
{arguments ""}
{impl ""}
} {
Additional documentation and commentary at http://openacs.org/forums/message-view?message_id=108614.
@param contract the contract name
@param operation the method to invoke
@param arguments list of arguments to pass to the method
@param impl the implementation name.
@param error If specified, will throw an error if the operation isn't implemented.
@author Neophytos Demetriou
@see acs_sc::invoke
} {
set proc_name [acs_sc_generate_name $contract $impl $operation]
if { [llength [info procs $proc_name]] == 1 } {
return [apply $proc_name $arguments]
} else {
if { $error_p } {
error "Operation $operation is not implemented in '$impl' implementation of contract '$contract'
$proc_name $arguments
"
} else {
ns_log warning "ACS-SC: Function Not Found: $proc_name [info procs $proc_name]"
}
return
}
}
##
## Logging
##
# Private logging proc
proc acs_sc_log {level msg} {
# If you want to debug the SC, uncomment the Debug log below
if { ![string equal "SCDebug" $level] } {
ns_log $level "$msg"
} else {
# ns_log Debug "$msg"
}
}
acs-service-contract-b3-5-0-patches/tcl/contract-procs-oracle.xql 0000664 0000000 0000000 00000004246 10747621074 0025055 0 ustar 00root root 0000000 0000000
oracle8.1.6
begin
:1 := acs_sc_contract.new(
:name,
:description
);
end;
acs_sc_contract.get_name(
:contract_id
) from dual
select acs_sc_contract.get_id(
:name
) from dual
select operation_id,
operation_inputtype_id,
operation_outputtype_id
from acs_sc_operations
where contract_id = :contract_id
begin
acs_sc_contract.del(
contract_name => :name
);
end;
begin
:1 := acs_sc_operation.new(
:contract_name,
:operation,
:description,
:is_cachable_p,
:nargs,
:input_type_name,
:output_type_name
);
end;
select contract_name,
operation_name
from acs_sc_operations
where operation_id = :operation_id
begin
acs_sc_operation.del(
contract_name => :contract_name,
operation_name => :operation_name
);
end;
acs-service-contract-b3-5-0-patches/tcl/contract-procs-postgresql.xql 0000664 0000000 0000000 00000003607 10747621074 0026013 0 ustar 00root root 0000000 0000000
postgresql7.2
select acs_sc_contract__new(
:name,
:description
);
select acs_sc_contract__get_name(:contract_id);
select acs_sc_contract__get_id(:name);
select operation_id,
operation_inputtype_id,
operation_outputtype_id
from acs_sc_operations
where contract_id = :contract_id
select acs_sc_contract__delete(:name);
select acs_sc_operation__new(
:contract_name,
:operation,
:description,
:is_cachable_p,
:nargs,
:input_type_name,
:output_type_name
);
select contract_name,
operation_name
from acs_sc_operations
where operation_id = :operation_id
select acs_sc_operation__delete(:contract_name, :operation_name);
acs-service-contract-b3-5-0-patches/tcl/contract-procs.tcl 0000664 0000000 0000000 00000021246 10747621074 0023567 0 ustar 00root root 0000000 0000000 ad_library {
Support library for acs service contracts.
@author Lars Pind (lars@collaboraid.biz)
@creation-date 2003-01-14
@cvs-id $Id$
}
namespace eval acs_sc::contract {}
namespace eval acs_sc::contract::operation {}
#####
#
# Contract
#
#####
ad_proc -public acs_sc::contract::new {
{-name:required}
{-description:required}
} {
Procedure to call to define and new service contract and
the message types, implementations and bindings.
Refer to the Service contract Tcl API discussion at
http://openacs.org/forums/message-view?message_id=71799
@param name Name of the service contract
@param description Comment/description of the service contract
@return id of the contract
} {
return [db_exec_plsql insert_sc_contract {}]
}
ad_proc -public acs_sc::contract::new_from_spec {
{-spec:required}
} {
Takes a complete service contract specification and creates the new service contract.
The spec looks like this:
set spec {
name "Action_SideEffect"
description "Get the name of the side effect to create action"
operations {
GetObjectTypes {
description "Get the object types for which this implementation is valid."
output { object_types:string,multiple }
iscachable_p "t"
}
GetPrettyName {
description "Get the pretty name of this implementation."
output { pretty_name:string }
iscachable_p "t"
}
DoSideEffect {
description "Do the side effect"
input {
case_id:integer
object_id:integer
action_id:integer
entry_id:integer
}
}
}
}
acs_sc::contract::new_from_spec -spec $spec
Here's the detailed explanation:
The spec should be an array-list with 3 entries:
- name: The name of the service contract.
- description: A human-readable descirption.
- operations: An array-list of operations in this service contract.
The operations array-list has the operation name as key, and
another array-list containing the specification for the operation as the value.
That array-list has the following entries:
- description: Human-readable description of the operation.
- input: Specification of the input to this operation.
- output: Specification of the output of this operation.
- iscachable_p: A 't' or 'f' for whether output from this service contract implementation
should automatically be cached using util_memoize.
The format of the 'input' and 'output' specs is a Tcl list of parameter specs,
each of which consist of name, colon (:),
datatype plus an optional comma (,) and the flag 'multiple'.
@param spec The service contract specification as described above.
@return The contract_id of the newly created service contract.
@see util_memoize
@see acs_sc::invoke
} {
# Default values
array set contract { description "" }
# Get the spec
array set contract $spec
db_transaction {
set contract_id [new \
-name $contract(name) \
-description $contract(description)]
acs_sc::contract::operation::parse_operations_spec \
-name $contract(name) \
-spec $contract(operations)
}
return $contract_id
}
ad_proc -public acs_sc::contract::delete {
{-contract_id}
{-name}
{-no_cascade:boolean}
} {
Delete a service contract definition. Supply either contract_id or name.
@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] } {
error "You must supply either name or contract_id"
}
db_transaction {
# Need both name and ID below
if { ![exists_and_not_null name] } {
set name [db_string get_name_by_id {}]
} elseif { ![exists_and_not_null contract_id] } {
set contract_id [db_string get_id_by_name {}]
}
if { !$no_cascade_p } {
set operations [list]
set msg_types [list]
db_foreach select_operations {} {
# Put them on list of mesage types and operations to delete
lappend msg_types $operation_inputtype_id
lappend msg_types $operation_outputtype_id
lappend operations $operation_id
}
# Delete the operations
foreach operation_id $operations {
acs_sc::contract::operation::delete -operation_id $operation_id
}
# Delete msg types
foreach msg_type_id $msg_types {
if { ![empty_string_p $msg_type_id] } {
acs_sc::msg_type::delete -msg_type_id $msg_type_id
}
}
}
# 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_exec_plsql delete_by_name {}
}
}
ad_proc -public acs_sc::contract::get_operations {
{-contract_name:required}
} {
Get a list of names of operations for the contract.
} {
return [db_list select_operations {
select o.operation_name
from acs_sc_operations o,
acs_sc_contracts c
where c.contract_name = :contract_name
and o.contract_id = c.contract_id
}]
}
#####
#
# Operations
#
#####
ad_proc -public acs_sc::contract::operation::new {
{-contract_name:required}
{-operation:required}
{-input:required}
{-output:required}
{-description:required}
{-is_cachable_p ""}
} {
Call the service contract function to create the
operation in the database.
} {
db_transaction {
# Create the input type
set input_type_name "${contract_name}.${operation}.InputType"
set nargs [acs_sc::msg_type::parse_spec \
-name $input_type_name \
-spec $input]
# Create the output type
set output_type_name "${contract_name}.${operation}.OutputType"
acs_sc::msg_type::parse_spec \
-name $output_type_name \
-spec $output
# Create the operation
db_exec_plsql insert_operation {}
}
}
ad_proc -public acs_sc::contract::operation::delete {
{-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] ) } {
error "You must supply either contract_name and operation_name, or operation_id"
}
# 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
if { ![exists_and_not_null contract_name] || ![exists_and_not_null operation_name] } {
# get contract_name and operation_name
db_1row select_names {}
}
db_exec_plsql delete_by_name {}
}
ad_proc -public acs_sc::contract::operation::parse_operations_spec {
{-name:required}
{-spec:required}
} {
Parse the operations defined in the operations specification
@param name Name of the contract
@spec spec Specification of all the operations
} {
foreach { operation subspec } $spec {
acs_sc::contract::operation::parse_spec \
-contract_name $name \
-operation $operation \
-spec $subspec
}
}
ad_proc -public acs_sc::contract::operation::parse_spec {
{-contract_name:required}
{-operation:required}
{-spec:required}
} {
Parse one operation
} {
# Default values
array set attributes {
description {}
input {}
output {}
is_cachable_p "f"
}
# Get the sepc
array set attributes $spec
# New operation
acs_sc::contract::operation::new \
-contract_name $contract_name \
-operation $operation \
-description $attributes(description) \
-input $attributes(input) \
-output $attributes(output) \
-is_cachable_p $attributes(is_cachable_p)
}
acs-service-contract-b3-5-0-patches/tcl/implementation-procs-oracle.xql 0000664 0000000 0000000 00000002701 10747621074 0026257 0 ustar 00root root 0000000 0000000
oracle8.1.6
begin
:1 := acs_sc_impl.new(
:contract_name,
:name,
:pretty_name,
:owner
);
end;
begin
:1 := acs_sc_impl_alias.new(
:contract_name,
:impl_name,
:operation,
:alias,
:language
);
end;
begin
acs_sc_binding.new(
contract_name => :contract_name,
impl_name => :impl_name
);
end;
begin
acs_sc_impl.del(
impl_contract_name => :contract_name,
impl_name => :impl_name
);
end;
acs-service-contract-b3-5-0-patches/tcl/implementation-procs-postgresql.xql 0000664 0000000 0000000 00000002407 10747621074 0027220 0 ustar 00root root 0000000 0000000
postgresql7.2
select acs_sc_impl__new(
:contract_name,
:name,
:pretty_name,
:owner
);
select acs_sc_impl_alias__new(
:contract_name,
:impl_name,
:operation,
:alias,
:language
);
select acs_sc_binding__new(
:contract_name,
:impl_name
);
select acs_sc_impl__delete(
:contract_name,
:impl_name
);
acs-service-contract-b3-5-0-patches/tcl/implementation-procs.tcl 0000664 0000000 0000000 00000023207 10747621074 0024776 0 ustar 00root root 0000000 0000000 ad_library {
Support library for acs service contracts. Implements the acs_sc::impl namespace.
@author Lars Pind (lars@collaboraid.biz)
@creation-date 2003-01-14
@cvs-id $Id$
}
namespace eval acs_sc::impl {}
namespace eval acs_sc::impl::alias {}
namespace eval acs_sc::impl::binding {}
#####
#
# Implementations
#
#####
ad_proc -public acs_sc::impl::new {
{-contract_name:required}
{-name:required}
{-pretty_name ""}
{-owner:required}
} {
Add new service contract implementation.
@param name The internal name of the implementation. Referred to when invoking the implementation.
Alphanumeric characters and underscores only.
@param pretty_name The name of the implementation when display to users. Defaults to 'name'.
@return the ID of the new implementation
} {
if { [empty_string_p $pretty_name] } {
set pretty_name $name
}
return [db_exec_plsql impl_new {}]
}
ad_proc -public acs_sc::impl::delete {
{-contract_name:required}
{-impl_name:required}
} {
Delete a service contract implementation
} {
if { ![exists_and_not_null contract_name] || ![exists_and_not_null impl_name] } {
error "You must supply contract_name and impl_name"
}
db_exec_plsql delete_impl {}
}
ad_proc -public acs_sc::impl::new_from_spec {
{-spec:required}
} {
Add new service contract implementation from an array-list style implementation,
and binds it to the specified contract.
The specification takes the following form:
set spec {
contract_name "Action_SideEffect"
owner "bug-tracker"
name "CaptureResolutionCode"
pretty_name "Capture Resolution Code"
aliases {
GetObjectType bug_tracker::bug::object_type
GetPrettyName bug_tracker::bug::capture_resolution_code::pretty_name
DoSideEffect bug_tracker::bug::capture_resolution_code::do_side_effect
}
}
acs_sc::impl::new_from_spec -spec $spec
And here's the explanation:
The spec is an array-list with the following entries:
- contract_name: The name of the service contract you're implementing.
- owner: Owner of the implementation, use the package-key.
- name: Name of your implementation.
- name: Pretty name of your implementation. You'd typically use this when displaying the service contract implementation through a UI.
- aliases: Specification of the tcl procedures for each of the service contract's operations.
The aliases section is itself an array-list. The keys are the operation names
from the service contract. The values are the names of Tcl procedures in your package,
which implement these operations.
@param spec The specification for the new service contract implementation.
@return the impl_id of the newly registered implementation
} {
# Spec contains: contract_name, name, pretty_name, owner, aliases
array set impl $spec
if { ![exists_and_not_null impl(pretty_name)] } {
set impl(pretty_name) ""
}
db_transaction {
set impl_id [new \
-contract_name $impl(contract_name) \
-name $impl(name) \
-pretty_name $impl(pretty_name) \
-owner $impl(owner)]
acs_sc::impl::alias::parse_aliases_spec \
-contract_name $impl(contract_name) \
-impl_name $impl(name) \
-spec $impl(aliases)
acs_sc::impl::binding::new \
-contract_name $impl(contract_name) \
-impl_name $impl(name)
}
# Initialize the procs so we can start calling them right away
acs_sc::impl::binding::init_procs -impl_id $impl_id
return $impl_id
}
ad_proc -public acs_sc::impl::get_id {
{-owner:required}
{-name:required}
-contract
} {
if {[exists_and_not_null contract]} {
return [db_string select_impl_id_with_contract {}]
} else {
return [db_string select_impl_id {}]
}
}
ad_proc -public acs_sc::impl::get {
{-impl_id:required}
{-array:required}
} {
Get information about a service contract implementation.
@param array Name of an array into which you want the info.
Available columns are: impl_name, impl_owner_name, impl_contract_name.
@author Lars Pind (lars@collaboraid.biz)
} {
upvar 1 $array row
db_1row select_impl {} -column_array row
}
ad_proc -public acs_sc::impl::get_options {
{-contract_name:required}
{-exclude_names ""}
{-empty_label "-"}
} {
Get a list of service contract implementation options
for an HTML multiple choice widget.
@param contract_name The name of the service contract
to return options for.
@param exclude_names A list of implementation names to exclude
@param empty_label If provided an option with id empty string and the provided label will be added.
@return A list of lists with the inner lists having label in first element and id in second.
@author Peter Marklund
} {
set full_list [db_list_of_lists select_impl_options {
select case when impl_pretty_name is not null then impl_pretty_name else impl_name end as impl_name,
impl_id
from acs_sc_impls
where impl_contract_name = :contract_name
}]
set impl_list [list]
if { ![empty_string_p $empty_label] } {
lappend impl_list [list $empty_label ""]
}
if { [llength $exclude_names] > 0 } {
# There are exclude names
foreach element $full_list {
set impl_name [lindex $element 0]
if { [lsearch -exact $exclude_names $impl_name] == -1 } {
# Name is not in exclude list so add option
lappend impl_list $element
}
}
} else {
# No exclude names, use all options
set impl_list [concat $impl_list $full_list]
}
return $impl_list
}
#####
#
# Aliases
#
#####
ad_proc -public acs_sc::impl::alias::new {
{-contract_name:required}
{-impl_name:required}
{-operation:required}
{-alias:required}
{-language "TCL"}
} {
Add new service contract implementation alias
(the procedure that implements the operation in a contract).
@return the ID of the implementation
} {
set impl_id [db_exec_plsql alias_new {}]
}
ad_proc -private acs_sc::impl::alias::parse_aliases_spec {
{-contract_name:required}
{-impl_name:required}
{-spec:required}
} {
Parse multiple aliases.
} {
foreach { operation subspec } $spec {
parse_spec \
-contract_name $contract_name \
-impl_name $impl_name \
-operation $operation \
-spec $subspec
}
}
ad_proc -private acs_sc::impl::alias::parse_spec {
{-contract_name:required}
{-impl_name:required}
{-operation:required}
{-spec:required}
} {
Parse the spec for a single alias. The spec can either be just the
name of a Tcl procedure, or it can be an array list containing the
two keys 'alias' and 'language'.
} {
if { [llength $spec] == 1 } {
# Single-element spec, which means it's the name of a Tcl procedure
new \
-contract_name $contract_name \
-impl_name $impl_name \
-operation $operation \
-alias $spec
} else {
# It's a full spec, expect 'alias' and 'language'
array set alias $spec
new \
-contract_name $contract_name \
-impl_name $impl_name \
-operation $operation \
-alias $alias(alias) \
-language $alias(language)
}
}
#####
#
# Bindings
#
#####
ad_proc -public acs_sc::impl::binding::new {
{-contract_name:required}
{-impl_name:required}
} {
Bind implementation to the contract. Bombs if not all operations
have aliases.
} {
db_exec_plsql binding_new {}
}
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
#----------------------------------------------------------------------
# NOTE: End of actual proc above this line. Stale code below
#----------------------------------------------------------------------
# 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
} -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)
}
}
acs-service-contract-b3-5-0-patches/tcl/implementation-procs.xql 0000664 0000000 0000000 00000001531 10747621074 0025014 0 ustar 00root root 0000000 0000000
select impl_id
from acs_sc_impls
where impl_owner_name = :owner
and impl_name = :name
select impl_id
from acs_sc_impls
where impl_owner_name = :owner
and impl_name = :name
and impl_contract_name = :contract
select impl_name,
impl_pretty_name,
impl_owner_name,
impl_contract_name
from acs_sc_impls
where impl_id = :impl_id
acs-service-contract-b3-5-0-patches/tcl/msg-type-procs-oracle.xql 0000664 0000000 0000000 00000002256 10747621074 0025004 0 ustar 00root root 0000000 0000000
oracle8.1.6
begin
:1 := acs_sc_msg_type.new(
:name,
:specification
);
end;
begin
acs_sc_msg_type.del(
msg_type_id => :msg_type_id
);
end;
begin
acs_sc_msg_type.del(
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;
acs-service-contract-b3-5-0-patches/tcl/msg-type-procs-postgresql.xql 0000664 0000000 0000000 00000001442 10747621074 0025736 0 ustar 00root root 0000000 0000000
postgresql7.2
select acs_sc_msg_type__new(
:name,
:specification);
select acs_sc_msg_type__delete(:name);
select acs_sc_msg_type__new_element(
:msg_type_name,
:element_name,
:element_msg_type_name,
:element_msg_type_isset_p,
:element_pos
);
acs-service-contract-b3-5-0-patches/tcl/msg-type-procs.tcl 0000664 0000000 0000000 00000006361 10747621074 0023520 0 ustar 00root root 0000000 0000000 ad_library {
Support library for acs service contracts.
@author Lars Pind (lars@collaboraid.biz)
@creation-date 2003-01-14
@cvs-id $Id$
}
namespace eval acs_sc::msg_type {}
namespace eval acs_sc::msg_type::element {}
ad_proc -public acs_sc::msg_type::new {
{-name:required}
{-specification ""}
} {
@param specification Msg type specification in the format required by the SQL proc, namely
'foo:integer,bar:[string]'
} {
db_exec_plsql insert_msg_type {}
}
ad_proc -public acs_sc::msg_type::delete {
{-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] } {
error "You must supply either name or msg_type_id"
}
# 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
if { ![exists_and_not_null name] } {
# get msg_type name
db_1row select_name {}
}
db_exec_plsql delete_by_name {}
}
ad_proc -public acs_sc::msg_type::parse_spec {
{-name:required}
{-spec:required}
} {
#The specification for the message type could be like this!
#case_id:integer
#foobar:string,multiple
@param name Name of new msg_type
@param spec Spec in ad_page_contract style format, namely { foo:integer bar:string,multiple }
} {
db_transaction {
# First, create the msg_type
acs_sc::msg_type::new -name $name
set nargs 0
# Then create the elements
foreach element $spec {
incr nargs
# element:flag,flag
set elementv [split $element :]
set flagsv [split [lindex $elementv 1] ","]
set element_name [string trim [lindex $elementv 0]]
if { [llength $flagsv] > 1 } {
set idx [lsearch $flagsv "multiple"]
if { [llength $flagsv] > 2 || $idx == -1 } {
error "Only one modified flag allowed, and that's multiple as in foo:integer,multiple"
}
# Remove the 'multiple' flag
set flagsv [lreplace $flagsv $idx $idx]
set element_type "[lindex $flagsv 0]"
set isset_p "t"
} else {
set element_type [lindex $flagsv 0]
set isset_p "f"
}
acs_sc::msg_type::element::new \
-msg_type_name $name \
-element_name $element_name \
-element_msg_type_name $element_type \
-element_msg_type_isset_p $isset_p \
-element_pos $nargs
}
}
return $nargs
}
#####
#
# Msg_type Element
#
#####
ad_proc -public acs_sc::msg_type::element::new {
{-msg_type_name:required}
{-element_name:required}
{-element_msg_type_name:required}
{-element_msg_type_isset_p:required}
{-element_pos:required}
} {
Insert a new msg_type element
} {
db_exec_plsql insert_msg_type_element {}
}
acs-service-contract-b3-5-0-patches/tcl/msg-type-procs.xql 0000664 0000000 0000000 00000000414 10747621074 0023533 0 ustar 00root root 0000000 0000000
select msg_type_name as name
from acs_sc_msg_types
where msg_type_id = :msg_type_id
acs-service-contract-b3-5-0-patches/tcl/test/ 0000775 0000000 0000000 00000000000 10747621074 0021074 5 ustar 00root root 0000000 0000000 acs-service-contract-b3-5-0-patches/tcl/test/acs-service-contract-procs.tcl 0000664 0000000 0000000 00000005457 10747621074 0026756 0 ustar 00root root 0000000 0000000 ad_library {
Register acs-automated-testing test cases for acs-service-contract
package on server startup.
@author Simon Carstensen
@creation-date 2003-09-10
@cvs-id $Id$
}
aa_register_case acs_sc_impl_new_from_spec {
Test the acs_sc::impl::new_from_spec proc.
} {
aa_run_with_teardown \
-rollback \
-test_code {
set spec {
name "foo_contract"
description "Blah blah blah blah"
operations {
Authenticate {
description {
Validate this username/password combination, and return the result.
Valid auth_status codes are 'ok', 'no_account', 'bad_password', 'auth_error', 'failed_to_connect'.
The last, 'failed_to_connect', is reserved for communications or implementation errors.
auth_message is a human-readable explanation of what went wrong, may contain HTML.
Only checked if auth_status is not ok.
Valid account_status codes are 'ok' and 'closed'.
account_message may be supplied regardless of account_status, and may contain HTML.
}
input {
username:string
password:string
parameters:string,multiple
}
output {
auth_status:string
auth_message:string
account_status:string
account_message:string
}
}
GetParameters {
description {
Get an arraay-list of the parameters required by this service contract implementation.
}
output {
parameters:string,multiple
}
}
}
}
acs_sc::contract::new_from_spec -spec $spec
set spec {
contract_name "foo_contract"
owner "acs-service-contract"
name "foo"
pretty_name "Foo Driver"
aliases {
Authenticate auth::local::authentication::Authenticate
GetParameters auth::local::authentication::GetParameters
}
}
set impl_id [acs_sc::impl::new_from_spec -spec $spec]
acs_sc::impl::get -impl_id $impl_id -array impl
aa_equals "pretty_name dit not get inserted correctly" $impl(impl_pretty_name) "Foo Driver"
}
}
acs-service-contract-b3-5-0-patches/www/ 0000775 0000000 0000000 00000000000 10747621074 0020157 5 ustar 00root root 0000000 0000000 acs-service-contract-b3-5-0-patches/www/binding-install-oracle.xql 0000664 0000000 0000000 00000000524 10747621074 0025227 0 ustar 00root root 0000000 0000000
oracle8.1.6
begin
acs_sc_binding.new(
contract_id => :contract_id,
impl_id => :impl_id);
end;
acs-service-contract-b3-5-0-patches/www/binding-install-postgresql.xql 0000664 0000000 0000000 00000000453 10747621074 0026166 0 ustar 00root root 0000000 0000000
postgresql7.1
select acs_sc_binding__new(cast(:contract_id as integer), cast(:impl_id as integer))
acs-service-contract-b3-5-0-patches/www/binding-install.tcl 0000664 0000000 0000000 00000000321 10747621074 0023735 0 ustar 00root root 0000000 0000000 ad_page_contract {
@author Neophytos Demetriou
} {
contract_id:integer
impl_id:integer
}
db_exec_plsql binding_install "select acs_sc_binding__new($contract_id,$impl_id)"
ad_returnredirect ""
acs-service-contract-b3-5-0-patches/www/binding-uninstall-oracle.xql 0000664 0000000 0000000 00000000446 10747621074 0025575 0 ustar 00root root 0000000 0000000
oracle8.1.6
begin
select acs_sc_binding.del(:contract_id,:impl_id)
end;
acs-service-contract-b3-5-0-patches/www/binding-uninstall-postgresql.xql 0000664 0000000 0000000 00000000407 10747621074 0026530 0 ustar 00root root 0000000 0000000
postgresql7.1
select acs_sc_binding__delete(:contract_id,:impl_id)
acs-service-contract-b3-5-0-patches/www/binding-uninstall.tcl 0000664 0000000 0000000 00000000326 10747621074 0024305 0 ustar 00root root 0000000 0000000 ad_page_contract {
@author Neophytos Demetriou
} {
contract_id:integer
impl_id:integer
}
db_exec_plsql binding_uninstall "select acs_sc_binding__delete($contract_id,$impl_id)"
ad_returnredirect ""
acs-service-contract-b3-5-0-patches/www/contract-display-oracle.xql 0000664 0000000 0000000 00000001061 10747621074 0025426 0 ustar 00root root 0000000 0000000
oracle8.1.6
select
b.contract_id,
b.impl_id,
acs_sc_impl.get_name(b.impl_id) as impl_name,
impl.impl_owner_name,
impl.impl_pretty_name
from
acs_sc_bindings b,
acs_sc_impls impl
where
b.contract_id = :id
and impl.impl_id = b.impl_id
acs-service-contract-b3-5-0-patches/www/contract-display-postgresql.xql 0000664 0000000 0000000 00000001064 10747621074 0026367 0 ustar 00root root 0000000 0000000
postgresql7.1
select
b.contract_id,
b.impl_id,
acs_sc_impl__get_name(b.impl_id) as impl_name,
impl.impl_owner_name,
impl.impl_pretty_name
from
acs_sc_bindings b,
acs_sc_impls impl
where
b.contract_id = :id
and impl.impl_id = b.impl_id
acs-service-contract-b3-5-0-patches/www/contract-display.adp 0000664 0000000 0000000 00000001166 10747621074 0024131 0 ustar 00root root 0000000 0000000
Contract @contract_name;noquote@
{@contract_name;noquote@}
- @contract.operation_name@ -
@contract.operation_desc@
- @contract.inout@ @contract.param@
@contract.param_type@ []
Valid Installed Bindings
acs-service-contract-b3-5-0-patches/www/contract-display.tcl 0000664 0000000 0000000 00000002746 10747621074 0024154 0 ustar 00root root 0000000 0000000 ad_page_contract {
Display a given service contract
} {
id:integer,notnull
}
set contract_name [db_string contract_name {select contract_name from acs_sc_contracts where contract_id = :id}]
db_multirow contract contract {select o.contract_name, o.operation_name, o.operation_desc, (case when t.msg_type_id = o.operation_inputtype_id then 'input' else 'output' end) as inout,
e.element_name as param, e.element_msg_type_isset_p as set_p, et.msg_type_name as param_type
from acs_sc_operations o,
acs_sc_msg_types t,
acs_sc_msg_type_elements e,
acs_sc_msg_types et
where contract_id = :id
and t.msg_type_id in (o.operation_inputtype_id, operation_outputtype_id)
and e.msg_type_id = t.msg_type_id
and et.msg_type_id = e.element_msg_type_id
order by o.contract_name, o.operation_name, t.msg_type_name, e.element_pos }
template::list::create \
-name bindings \
-multirow valid_installed_binding \
-elements {
impl_name {
label "Implementation Name"
}
impl_pretty_name {
label "Label"
}
impl_owner_name {
label "Owner"
}
uninstall {
label {}
link_url_eval {[export_vars -base binding-uninstall { contract_id impl_id }]}
link_html { title "Uninstall binding" }
display_template {Uninstall}
sub_class narrow
}
}
db_multirow valid_installed_binding valid_installed_binding {}
acs-service-contract-b3-5-0-patches/www/doc/ 0000775 0000000 0000000 00000000000 10747621074 0020724 5 ustar 00root root 0000000 0000000 acs-service-contract-b3-5-0-patches/www/doc/index.html 0000664 0000000 0000000 00000013405 10747621074 0022724 0 ustar 00root root 0000000 0000000
ACS Service Contract Documentation
ACS Service Contract Documentation
Why
To facilitate greater code reuse, application integration,
and package extensibility within the OpenACS.
To do this acs-service-contract defines an api for the creation
of interfaces and discovery of interface implementations.
Background
Most component systems are based on the use of interfaces. Interfaces
allow components to create contracts which define their functional
level of reuse and customization. It also provides the infrastructure
for runtime discovery of which implemented interfaces are available.
The ACS4 is based on a thin object system, that is primarily relational
but the acs_objects system allows a veneer of object orientedness
by providing globally unique object ids, object metadata, and bundling
of data and methods as an object. While this permits a level of
reuse on an object or package basis, it requires hardcoding the unit
of reuse.
ACS Service contract allows these objects and packages to also
define and register their implementation of interfaces, so the level
of reuse is defined at the contract level.
In addition ACS Service contract provides mean to dispatch method
calls on an interface implementation. The dispatch means
is only available through tcl.
Interface Discovery is available programmatically as well as via
documentation through ad_proc.
The Service Contract interface specification was inspired by
WDSL, the interface specfication for web services.
Hitchiker's Guide to Service Contract Definitions
- contract - analagous to interface, contracts serve as logical
containers for operations.
- operation - a method of an interface. defines a method signature,
including both input and outputs as well as metadata
such as caching.
- implementation - an implementation is a set of concrete functions
that fufills an interface.
- implementation alias - is the method of an implementation that
fufills a given operation of the contract.
- bindings - association between an interface and an implementation.
- types - define the kind of input and outputs a operation recieves.
Usage
Design the Contract
First Off design the interface for your contract, keeping in mind
that all implementations need to implement it and that extension of
the contract after deployment is often not practical. In other words
take the time to do a little future proofing and thinking about
possible uses that you weren't planning on.
Defining Operations
Next define the logical operations that will make up your contract
Register the Contract
with acs contracts.
Implement the Contract
FAQ
Why Does an implementation reference an interface?
This might seem a little strange since a binding is the official
reference between an implementation and an interface. However
it is quite possible that an implementation for interface might
exist prior to the interface being defined, ie the interface
defining package is not installed. By retaining this information
the interface defining package can be installed and the implementations
already installed on the system can be bound to it.
Api Reference
[for oracle please syntax replace __ with .]
Creating Message Types
Creating Interfaces
creates a new contract to serve as a logical
container for operations. contract_desc is a text
description of the contract.
- (sql):
acs_sc_operation__new (contract_name, operation_name,
operation_desc, operation_iscachable_p,
operation_inputtype, operation_outputtype
):
creates a new operation as part of a contract.
Creating Implementations
- (tcl) acs_sc_proc (contract, operation, impl):
registers an implementations. ?? why operation
Discovery
- (tcl) acs_sc_binding_exists_p (contract, impl):
returns boolean whether a binding exists between
a given contract name and implmentation.
Dispatching
- (tcl) acs_sc_call (contract, operation, [arguments, impl]):
calls an operation
Examples
Included in the service contract package are examples for oracle
and postgresql of a trivial contract.
Also the search contract functions as a non-trivial core contract
used by openacs4.
Further Reading
Abstract Factory Pattern - GOF
Component Systems - Clemens Syzperski
WSDL Spec
Credits
Most content was provided by Neophytos Demetriou. Most of the
errors were provided by Kapil Thangavelu.
acs-service-contract-b3-5-0-patches/www/doc/index.stx 0000664 0000000 0000000 00000011736 10747621074 0022603 0 ustar 00root root 0000000 0000000 ACS Service Contract Documentation
Why
To facilitate greater code reuse, application integration,
and package extensibility within the OpenACS.
To do this acs-service-contract defines an api for the creation
of interfaces and discovery of interface implementations.
Background
Most component systems are based on the use of interfaces. Interfaces
allow components to create contracts which define their functional
level of reuse and customization. It also provides the infrastructure
for runtime discovery of which implemented interfaces are available.
The ACS4 is based on a thin object system, that is primarily relational
but the acs_objects system allows a veneer of object orientedness
by providing globally unique object ids, object metadata, and bundling
of data and methods as an object. While this permits a level of
reuse on an object or package basis, it requires hardcoding the unit
of reuse.
ACS Service contract allows these objects and packages to also
define and register their implementation of interfaces, so the level
of reuse is defined at the contract level.
In addition ACS Service contract provides mean to dispatch method
calls on an interface implementation. The dispatch means
is only available through tcl.
Interface Discovery is available programmatically as well as via
documentation through ad_proc.
The Service Contract interface specification was inspired by
WDSL, the interface specfication for web services.
Hitchiker's Guide to Service Contract Definitions
- contract - analagous to interface, contracts serve as logical
containers for operations.
- operation - a method of an interface. defines a method signature,
including both input and outputs as well as metadata
such as caching.
- implementation - an implementation is a set of concrete functions
that fufills an interface.
- implementation alias - is the method of an implementation that
fufills a given operation of the contract.
- bindings - association between an interface and an implementation.
- types - define the kind of input and outputs a operation recieves.
Usage
Design the Contract
First Off design the interface for your contract, keeping in mind
that all implementations need to implement it and that extension of
the contract after deployment is often not practical. In other words
take the time to do a little future proofing and thinking about
possible uses that you weren't planning on.
Defining Operations
Next define the logical operations that will make up your contract
Register the Contract
with acs contracts.
Implement the Contract
FAQ
Why Does an implementation reference an interface?
This might seem a little strange since a binding is the official
reference between an implementation and an interface. However
it is quite possible that an implementation for interface might
exist prior to the interface being defined, ie the interface
defining package is not installed. By retaining this information
the interface defining package can be installed and the implementations
already installed on the system can be bound to it.
Api Reference
[for oracle please syntax replace __ with .]
Creating Message Types
- (sql)::
acs_sc_msg_type__new (name, spec):
defines a type based on spec. Spec should
be a string (possibly emtpy) that defines the
names and types that compose this type.
example 'ObjectDisplay.Name.InputType' as name
'object_id:integer' as spec.
Creating Interfaces
- (sql)::
acs_sc_contract__new (contract_name, contract_desc):
creates a new contract to serve as a logical
container for operations. contract_desc is a text
description of the contract.
- (sql)::
acs_sc_operation__new (contract_name, operation_name,
operation_desc, operation_iscachable_p,
operation_inputtype, operation_outputtype
):
creates a new operation as part of a contract.
Creating Implementations
- (tcl) acs_sc_proc (contract, operation, impl):
registers an implementations. ?? why operation
Discovery
- (tcl) acs_sc_binding_exists_p (contract, impl):
returns boolean whether a binding exists between
a given contract name and implmentation.
Dispatching
- (tcl) acs_sc_call (contract, operation, [arguments, impl]):
calls an operation
Examples
Included in the service contract package are examples for oracle
and postgresql of a trivial contract.
Also the search contract functions as a non-trivial core contract
used by openacs4.
Further Reading
Abstract Factory Pattern - GOF
Component Systems - Clemens Syzperski
WSDL Spec
Credits
Most content was provided by Neophytos Demetriou. Most of the
errors were provided by Kapil Thangavelu.
acs-service-contract-b3-5-0-patches/www/doc/index.xml 0000664 0000000 0000000 00000015600 10747621074 0022557 0 ustar 00root root 0000000 0000000
ACS Service Contract Documentation
ACS Service Contract Documentation
Why
To facilitate greater code reuse, application integration,
and package extensibility within the OpenACS.
To do this acs-service-contract defines an api for the creation
of interfaces and discovery of interface implementations.
Background
Most component systems are based on the use of interfaces. Interfaces
allow components to create contracts which define their functional
level of reuse and customization. It also provides the infrastructure
for runtime discovery of which implemented interfaces are available.
The ACS4 is based on a thin object system, that is primarily relational
but the acs_objects system allows a veneer of object orientedness
by providing globally unique object ids, object metadata, and bundling
of data and methods as an object. While this permits a level of
reuse on an object or package basis, it requires hardcoding the unit
of reuse.
ACS Service contract allows these objects and packages to also
define and register their implementation of interfaces, so the level
of reuse is defined at the contract level.
In addition ACS Service contract provides mean to dispatch method
calls on an interface implementation. The dispatch means
is only available through tcl.
Interface Discovery is available programmatically as well as via
documentation through ad_proc.
The Service Contract interface specification was inspired by
WDSL, the interface specfication for web services.
Hitchiker's Guide to Service Contract Definitions
contract - analagous to interface, contracts serve as logical
containers for operations.
operation - a method of an interface. defines a method signature,
including both input and outputs as well as metadata
such as caching.
implementation - an implementation is a set of concrete functions
that fufills an interface.
implementation alias - is the method of an implementation that
fufills a given operation of the contract.
bindings - association between an interface and an implementation.
types - define the kind of input and outputs a operation recieves.
Usage
Design the Contract
First Off design the interface for your contract, keeping in mind
that all implementations need to implement it and that extension of
the contract after deployment is often not practical. In other words
take the time to do a little future proofing and thinking about
possible uses that you weren't planning on.
Defining Operations
Next define the logical operations that will make up your contract
Register the Contract
with acs contracts.
Implement the Contract
FAQ
Why Does an implementation reference an interface?
This might seem a little strange since a binding is the official
reference between an implementation and an interface. However
it is quite possible that an implementation for interface might
exist prior to the interface being defined, ie the interface
defining package is not installed. By retaining this information
the interface defining package can be installed and the implementations
already installed on the system can be bound to it.
Api Reference
[for oracle please syntax replace __ with .]
Creating Message Types
(sql)::
acs_sc_msg_type__new (name, spec):
defines a type based on spec. Spec should
be a string (possibly emtpy) that defines the
names and types that compose this type.
example ObjectDisplay.Name.InputTypeas name
object_id:integeras spec.
Creating Interfaces
(sql):
creates a new contract to serve as a logical
container for operations. contract_desc is a text
description of the contract.
(sql):
creates a new operation as part of a contract.
Creating Implementations
(tcl) acs_sc_proc (contract, operation, impl):
registers an implementations. ?? why operation
Discovery
(tcl) acs_sc_binding_exists_p (contract, impl):
returns boolean whether a binding exists between
a given contract name and implmentation.
Dispatching
(tcl) acs_sc_call (contract, operation, [arguments, impl]):
calls an operation
Examples
Included in the service contract package are examples for oracle
and postgresql of a trivial contract.
Also the search contract functions as a non-trivial core contract
used by openacs4.
Further Reading
Abstract Factory Pattern - GOF
Component Systems - Clemens Syzperski
WSDL Spec
Credits
Most content was provided by Neophytos Demetriou. Most of the
errors were provided by Kapil Thangavelu.
acs-service-contract-b3-5-0-patches/www/doc/notes.html 0000664 0000000 0000000 00000002017 10747621074 0022742 0 ustar 00root root 0000000 0000000 ACS Service Contract Overview
by Neophytos Demetriou (k2pts@yahoo.com) and Kapil Thangavelu (k_vertigo@yahoo.com)
Goals
- To increase inter-application code reuse by designating interfaces for interaction.
- To increase flexibility by allowing developers to reimplement an interface for their needs.
- To provide the framework for constructing web services by housing the metadata needed to construct wsdl.
- To be low impediment to developers to create interfaces for their packages.
- To reduce fixed dependencies in packages.
Definitions
Interface - An abstract set of operations supported by one or more endpoints.
Operation - An abstract description of an action supported by the service.
Binding - A concrete implementation for a particular interface.
Function - The implementation of an operation.
Actors
Registrar - An entity that defines the specification of a contract and registers it with the repository.
Provider - Provides an implementation of the contract.
Dependant - Something that uses a contract.
acs-service-contract-b3-5-0-patches/www/index-oracle.xql 0000664 0000000 0000000 00000001407 10747621074 0023261 0 ustar 00root root 0000000 0000000
oracle8.1.6
select q.*
from (select
b.contract_id,
b.impl_id,
acs_sc_contract.get_name(contract_id) as contract_name,
acs_sc_impl.get_name(b.impl_id) as impl_name,
impl.impl_owner_name,
impl.impl_pretty_name
from
acs_sc_bindings b,
acs_sc_impls impl
where
impl.impl_id = b.impl_id) q
order by upper(contract_name), contract_name, upper(impl_name), impl_name
acs-service-contract-b3-5-0-patches/www/index-postgresql.xql 0000664 0000000 0000000 00000001413 10747621074 0024214 0 ustar 00root root 0000000 0000000
postgresql7.1
select q.*
from (select
b.contract_id,
b.impl_id,
acs_sc_contract__get_name(contract_id) as contract_name,
acs_sc_impl__get_name(b.impl_id) as impl_name,
impl.impl_owner_name,
impl.impl_pretty_name
from
acs_sc_bindings b,
acs_sc_impls impl
where
impl.impl_id = b.impl_id) q
order by upper(contract_name), contract_name, upper(impl_name), impl_name
acs-service-contract-b3-5-0-patches/www/index.adp 0000664 0000000 0000000 00000001162 10747621074 0021754 0 ustar 00root root 0000000 0000000
ACS Service Contract
@context;noquote@
Defined Contracts
Installed Bindings
Valid Uninstalled Bindings
Invalid Uninstalled Bindings
Orphan Implementations
acs-service-contract-b3-5-0-patches/www/index.tcl 0000664 0000000 0000000 00000006303 10747621074 0021774 0 ustar 00root root 0000000 0000000 set context [list]
db_multirow defined_contracts defined_contracts {
select contract_id,
contract_name,
contract_desc
from acs_sc_contracts
order by upper(contract_name), contract_name
}
template::list::create \
-name contracts \
-multirow defined_contracts \
-elements {
contract_name {
label "Name"
link_url_eval {[export_vars -base contract-display { { id $contract_id } }]}
link_html { title "View contract" }
}
contract_desc {
label "Description"
}
}
db_multirow valid_installed_bindings valid_installed_binding {}
template::list::create \
-name valid_installed_bindings \
-multirow valid_installed_bindings \
-elements {
contract_name {
label "Contract"
link_url_eval {[export_vars -base contract-display { { id $contract_id } }]}
link_html { title "View contract" }
}
impl_name {
label "Implementation"
}
impl_pretty_name {
label "Label"
}
impl_owner_name {
label "Owner"
}
uninstall {
label {}
link_url_eval {[export_vars -base binding-uninstall { contract_id impl_id }]}
link_html { title "Uninstall binding" }
display_template {Uninstall}
sub_class narrow
}
}
db_multirow valid_uninstalled_bindings valid_uninstalled_binding {}
template::list::create \
-name valid_uninstalled_bindings \
-multirow valid_uninstalled_bindings \
-elements {
contract_name {
label "Contract"
link_url_eval {[export_vars -base contract-display { { id $contract_id } }]}
link_html { title "View contract" }
}
impl_name {
label "Implementation"
}
impl_pretty_name {
label "Label"
}
impl_owner_name {
label "Owner"
}
install {
label {}
link_url_eval {[export_vars -base binding-install { contract_id impl_id }]}
link_html { title "Install binding" }
display_template {Install}
sub_class narrow
}
}
db_multirow invalid_uninstalled_bindings invalid_uninstalled_binding {}
template::list::create \
-name invalid_uninstalled_bindings \
-multirow invalid_uninstalled_bindings \
-elements {
contract_name {
label "Contract"
link_url_eval {[export_vars -base contract-display { { id $contract_id } }]}
link_html { title "View contract" }
}
impl_name {
label "Implementation"
}
impl_pretty_name {
label "Label"
}
impl_owner_name {
label "Owner"
}
}
db_multirow orphan_implementations orphan_implementation {}
template::list::create \
-name orphan_implementations \
-multirow orphan_implementations \
-elements {
impl_contract_name {
label "Contract"
}
impl_name {
label "Implementation"
}
impl_pretty_name {
label "Label"
}
} acs-service-contract-b3-5-0-patches/www/index.xql 0000664 0000000 0000000 00000001630 10747621074 0022014 0 ustar 00root root 0000000 0000000
select contract_id, contract_name, impl_name, impl_owner_name, impl_pretty_name, impl_id
from valid_uninstalled_bindings
order by upper(contract_name), contract_name, upper(impl_name), impl_name
select contract_id, contract_name, impl_name, impl_owner_name, impl_pretty_name, impl_id
from invalid_uninstalled_bindings
order by upper(contract_name), contract_name, upper(impl_name), impl_name
select impl_id, impl_name, impl_pretty_name, impl_contract_name
from orphan_implementations
order by upper(impl_name), impl_name