Commit 503200dc authored by Malte Sussdorff's avatar Malte Sussdorff

- Malte

parent be9a6b1d
Pipeline #95 failed with stages
......@@ -7,17 +7,20 @@
<initial-install-p>t</initial-install-p>
<singleton-p>t</singleton-p>
<version name="5.1.5" url="http://openacs.org/repository/download/apm/acs-service-contract-5.1.5.apm">
<version name="5.3.1b1" url="http://openacs.org/repository/download/apm/acs-service-contract-5.3.1b1.apm">
<owner url="http://openacs.org">OpenACS</owner>
<summary>API and UI for service contracts</summary>
<release-date>2005-02-28</release-date>
<release-date>2007-04-15</release-date>
<maturity>3</maturity>
<vendor url="http://openacs.org">OpenACS</vendor>
<description format="text/html">Service contracts defines an API for the creation of interfaces and discovery of interface implementations.
Examples are the contracts used for search which provide a means to get content on a given object and to translate an object_id to a
<maturity>3</maturity>
<license url="http://www.gnu.org/copyleft/gpl.html">GPL version 2</license>
<description format="text/html">Service contracts defines an API for the creation of interfaces and discovery of interface implementations.
Examples are the contracts used for search which provide a means to get content on a given object and to translate an object_id to a
url or the contracts used by dotlrn and new-portals to allow packages to provide portalized panes.</description>
<provides url="acs-service-contract" version="5.1.5"/>
<requires url="acs-kernel" version="5.0.0"/>
<provides url="acs-service-contract" version="5.3.1b1"/>
<requires url="acs-kernel" version="5.3.1b1"/>
<callbacks>
</callbacks>
......@@ -27,3 +30,7 @@
</version>
</package>
......@@ -95,7 +95,8 @@ as
v_spec_parse_level integer;
begin
v_msg_type_id := acs_object.new(
object_type => 'acs_sc_msg_type'
object_type => 'acs_sc_msg_type',
title => msg_type_name
);
insert into acs_sc_msg_types (
......
......@@ -5,8 +5,8 @@ begin
pretty_name => 'ACS SC Contract',
pretty_plural => 'ACS SC Contracts',
supertype => 'acs_object',
table_name => 'ACS_SC_CONTRACTS',
id_column => 'CONTRACT_ID'
table_name => 'acs_sc_contracts',
id_column => 'contract_id'
);
acs_object_type.create_type(
......@@ -14,8 +14,8 @@ begin
pretty_name => 'ACS SC Operation',
pretty_plural => 'ACS SC Operations',
supertype => 'acs_object',
table_name => 'ACS_SC_OPERATIONS',
id_column => 'OPERATION_ID'
table_name => 'acs_sc_operations',
id_column => 'operation_id'
);
acs_object_type.create_type(
......@@ -23,8 +23,8 @@ begin
pretty_name => 'ACS SC Implementation',
pretty_plural => 'ACS SC Implementations',
supertype => 'acs_object',
table_name => 'ACS_SC_IMPLS',
id_column => 'IMPL_ID'
table_name => 'acs_sc_impls',
id_column => 'impl_id'
);
end;
/
......
......@@ -152,7 +152,10 @@ as
is
v_contract_id acs_sc_contracts.contract_id%TYPE;
begin
v_contract_id := acs_object.new( object_type=>'acs_sc_contract');
v_contract_id := acs_object.new(
object_type => 'acs_sc_contract',
title => contract_name
);
insert into acs_sc_contracts (
contract_id,
......@@ -250,7 +253,10 @@ as
begin
v_contract_id := acs_sc_contract.get_id(contract_name);
v_operation_id := acs_object.new (object_type=>'acs_sc_operation');
v_operation_id := acs_object.new (
object_type => 'acs_sc_operation',
title => operation_name
);
v_operation_inputtype_id := acs_sc_msg_type.get_id(operation_inputtype);
v_operation_outputtype_id := acs_sc_msg_type.get_id(operation_outputtype);
......@@ -341,7 +347,10 @@ as
is
v_impl_id acs_sc_impls.impl_id%TYPE;
begin
v_impl_id := acs_object.new (object_type => 'acs_sc_implementation');
v_impl_id := acs_object.new (
object_type => 'acs_sc_implementation',
title => impl_pretty_name
);
insert into acs_sc_impls (
impl_id,
......
......@@ -49,7 +49,7 @@ create table acs_sc_operations (
create table acs_sc_impls (
impl_id integer
constraint acs_sc_impl_impl_id_fk
constraint acs_sc_impls_impl_id_fk
references acs_objects(object_id)
on delete cascade
constraint acs_sc_impl_pk
......@@ -75,7 +75,7 @@ constraint acs_sc_impl_aliases_un unique(impl_name,impl_contract_name,impl_opera
create table acs_sc_bindings (
contract_id integer
constraint acs_sc_binding_cid_fk
constraint acs_sc_binding_contract_id_fk
references acs_sc_contracts(contract_id)
on delete cascade,
impl_id integer
......
This diff is collapsed.
......@@ -54,6 +54,9 @@ begin
now(),
null,
null,
null,
''t'',
p_msg_type_name,
null
);
......
......@@ -12,6 +12,9 @@ begin
now(),
null,
null,
null,
''t'',
p_contract_name,
null
);
......@@ -121,6 +124,9 @@ begin
now(),
null,
null,
null,
''t'',
p_operation_name,
null
);
......@@ -224,6 +230,9 @@ begin
now(),
null,
null,
null,
''t'',
p_impl_pretty_name,
null
);
......@@ -387,12 +396,13 @@ declare
v_contract_name varchar;
v_impl_name varchar;
v_count integer;
v_missing_op varchar;
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
select count(*),min(operation_name) into v_count, v_missing_op
from acs_sc_operations
where contract_id = p_contract_id
and operation_name not in (select impl_operation_name
......@@ -401,7 +411,7 @@ begin
and impl_id = p_impl_id);
if v_count > 0 then
raise exception ''Binding of % to % failed since certain operations are not implemented.'', v_contract_name, v_impl_name;
raise exception ''Binding of % to % failed since certain operations are not implemented like: %.'', v_contract_name, v_impl_name, v_missing_op;
end if;
insert into acs_sc_bindings (
......
......@@ -52,7 +52,7 @@ create table acs_sc_impls (
constraint acs_sc_impls_impl_id_fk
references acs_objects(object_id)
on delete cascade
constraint acs_sc_impls_pk
constraint acs_sc_impls_impl_id_pk
primary key,
impl_name varchar(100),
impl_pretty_name varchar(200),
......@@ -64,7 +64,7 @@ create table acs_sc_impls (
create table acs_sc_impl_aliases (
impl_id integer
constraint acs_sc_impl_proc_impl_id_fk
constraint acs_sc_impl_aliases_impl_id_fk
references acs_sc_impls(impl_id)
on delete cascade,
impl_name varchar(100),
......@@ -79,7 +79,7 @@ constraint acs_sc_impl_alias_un unique(impl_name,impl_contract_name,impl_operati
create table acs_sc_bindings (
contract_id integer
constraint acs_sc_bindings_cid_fk
constraint acs_sc_bindings_contract_id_fk
references acs_sc_contracts(contract_id)
on delete cascade,
impl_id integer
......
update acs_objects
set title = (select msg_type_name
from acs_sc_msg_types
where msg_type_id = object_id)
where object_type = 'acs_sc_msg_type';
update acs_objects
set title = (select contract_name
from acs_sc_contracts
where contract_id = object_id)
where object_type = 'acs_sc_contract';
update acs_objects
set title = (select operation_name
from acs_sc_operations
where operation_id = object_id)
where object_type = 'acs_sc_operation';
update acs_objects
set title = (select impl_pretty_name
from acs_sc_impls
where impl_id = object_id)
where object_type = 'acs_sc_implementation';
drop function acs_sc_msg_type__new(varchar,varchar);
create or replace function acs_sc_msg_type__new(varchar,varchar)
returns integer as '
declare
p_msg_type_name alias for $1;
p_msg_type_spec alias for $2;
v_msg_type_id integer;
begin
v_msg_type_id := acs_object__new(
null,
''acs_sc_msg_type'',
now(),
null,
null,
null,
''t'',
p_msg_type_name,
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';
drop function acs_sc_contract__new(varchar,text);
create or replace function acs_sc_contract__new(varchar,text)
returns integer as '
declare
p_contract_name alias for $1;
p_contract_desc alias for $2;
v_contract_id integer;
begin
v_contract_id := acs_object__new(
null,
''acs_sc_contract'',
now(),
null,
null,
null,
''t'',
p_contract_name,
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';
drop function acs_sc_operation__new(varchar,varchar,text,boolean,integer,varchar,varchar);
create or replace function acs_sc_operation__new(varchar,varchar,text,boolean,integer,varchar,varchar)
returns integer as '
declare
p_contract_name alias for $1;
p_operation_name alias for $2;
p_operation_desc alias for $3;
p_operation_iscachable_p alias for $4;
p_operation_nargs alias for $5;
p_operation_inputtype alias for $6;
p_operation_outputtype alias for $7;
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,
''t'',
p_operation_name,
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';
drop function acs_sc_impl__new(varchar,varchar,varchar,varchar);
create or replace function acs_sc_impl__new(varchar,varchar,varchar,varchar)
returns integer as '
declare
p_impl_contract_name alias for $1;
p_impl_name alias for $2;
p_impl_pretty_name alias for $3;
p_impl_owner_name alias for $4;
v_impl_id integer;
begin
v_impl_id := acs_object__new(
null,
''acs_sc_implementation'',
now(),
null,
null,
null,
''t'',
p_impl_pretty_name,
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';
......@@ -22,7 +22,7 @@ select acs_sc_binding__exists_p(:contract,:impl)
<fullquery name="acs_sc_proc.get_operation_definition">
<querytext>
select distinct
select
operation_desc,
coalesce(operation_iscachable_p,'f') as operation_iscachable_p,
operation_nargs,
......
......@@ -133,6 +133,19 @@ ad_proc -public acs_sc::impl::get_id {
{-owner:required}
{-name:required}
-contract
} {
Retrieves the ID for a service contract. If the contract is specified
then the ID is retrieved for the specified contract, otherwise all
service contract IDs will be retrieved that match the specified owner
and implementation name.
@param owner Owner of the service contract.
@param name Implementation name.
@param contract Implementation contract name.
@return Returns the ID for a specified service contract, or all IDs for
for service contracts that match the owner and implementation name of
a service contract,
if the contract is not specified.
} {
if {[exists_and_not_null contract]} {
return [db_string select_impl_id_with_contract {}]
......
<master>
<property name="title">Contract @contract_name;noquote@</property>
<property name="context">{@contract_name;noquote@}</property>
<h2>Binding @contract_name@</h2>
<p><listtemplate name="binding"></listtemplate></p>
<h2>Contract details</h2>
<ul>
<multiple name=contract>
<li> <b>@contract.operation_name@</b> -
@contract.operation_desc@
<ul>
<group column="operation_name">
<li>@contract.inout@ @contract.param@
@contract.param_type@ <if @contract.set_p@ eq t>[]</if></li>
</group>
</ul>
</multiple>
</ul>
ad_page_contract {
Display a given service contract
@author Jeff Davis <davis@xarg.net>
@creation-date 2005-02-05
@cvs-id $Id$
} {
id
impl_name:trim,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 binding \
-multirow binding \
-elements {
impl_operation_name {
label "Operation"
}
impl_pl {
label "Language"
}
impl_alias {
label "Alias"
display_template {@binding.impl_alias;noquote@}
}
}
db_multirow -extend {check} binding binding {
select impl_operation_name, impl_alias, impl_pl
from acs_sc_impl_aliases
where impl_name = :impl_name and impl_contract_name = :contract_name
order by lower(impl_operation_name)
} {
if {[string equal $impl_pl "TCL"]} {
regsub {^::} $impl_alias {} impl_alias
if {[empty_string_p [info proc ::$impl_alias]]} {
append impl_alias {</b> - <b style="color: red">NOT FOUND!</b>}
} else {
append impl_alias "</b> {[info args ::$impl_alias]}"
}
set impl_alias "<b>$impl_alias"
}
}
......@@ -6,7 +6,7 @@
<fullquery name="binding_uninstall">
<querytext>
begin
select acs_sc_binding.del(:contract_id,:impl_id)
acs_sc_binding.del(contract_id => :contract_id, impl_id => :impl_id);
end;
</querytext>
</fullquery>
......
......@@ -39,6 +39,13 @@ template::list::create \
display_template {Uninstall}
sub_class narrow
}
display {
label {}
link_url_eval {[export_vars -base binding-display { {id $contract_id} impl_name }]}
link_html { title "View this contracts implementation details" }
display_template {view}
sub_class narrow
}
}
db_multirow valid_installed_binding valid_installed_binding {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment