Rem
Rem This file is used to register the Flights of Fancy provider
Rem in a portal schema.
Rem
Rem Usage:  login to sqlplus as the portal schema owner
Rem (e.g. portal30/portal30)
Rem In sqlplus type the following:
Rem @flreg.sql <portal_schema> <provider_schema>
Rem where 
Rem <portal_schema> is the schema associated with the provider
Rem <provider_schema> is the schema where the provider has 
Rem been installed
Rem
Rem Note:  This script must be run only after the script
Rem flights_install.sql has successfully been run.  The
Rem register_provider api performs a validation check to
Rem ensure that the provider implementation package exist
Rem in the provider schema.
Rem 

set serveroutput on size 1000000
set define on

declare
    l_prov_rec     wwpro_api_provider_registry.provider_record;
    l_prov_id      integer;
begin

    l_prov_rec.name                 := 'FlightsOfFancyProvider';
    l_prov_rec.display_name         := 'Flights of Fancy Provider';
    l_prov_rec.timeout              := 10;
    l_prov_rec.timeout_msg          := 'The provider timed out';
    l_prov_rec.implementation_style := wwpro_api_provider_registry.DATABASE_IMPL;
    l_prov_rec.implementation_owner := '&&2';
    l_prov_rec.implementation_name  := 'flights_of_fancy_provider';
    l_prov_rec.language             := wwctx_api.get_nls_language;
    l_prov_rec.enable_distribution  := true;
    l_prov_rec.login_frequency      := wwpro_api_provider_registry.LOGIN_FREQUENCY_ONCE;
    l_prov_rec.created_on           := sysdate;
    l_prov_rec.created_by           := '&&1';
    l_prov_rec.last_updated_on      := sysdate;
    l_prov_rec.last_updated_by      := '&&1';

    l_prov_id := wwpro_api_provider_registry.register_provider(l_prov_rec);
    commit;
    
    dbms_output.put_line('Flights of Fancy Provider successfully registered');

exception
    when others then
        dbms_output.put_line('ERROR: Could not register Flights of Fancy Provider');
        dbms_output.put_line('SQLERRM: ' || SQLERRM);
        rollback;
end;
/
