// CosPersistencePID Module, p 5-20 CORBAservices, 
// Persistent Object Service V1.0, 3/94

//#ifndef __COSPERSISTENCE
//#define __COSPERSISTENCE

#include <orb.idl>

#pragma prefix "omg.org"

module CosPersistencePID {

        interface PID {
                attribute string datastore_type;
                string get_PIDString();
        };
};

// CosPersistencePDS Module, p 5-20 CORBAservices, 
// Persistent Object Service V1.0, 3/94

// #include <CosPersistencePID.idl>

module CosPersistencePDS {

// interface Object;
        interface PDS {
                PDS     connect (in Object obj, 
                        in CosPersistencePID::PID p);
                void disconnect (in Object obj, 
                        in CosPersistencePID::PID p);
                void store (in Object obj, 
                        in CosPersistencePID::PID p);
                void restore (in Object obj, 
                        in CosPersistencePID::PID p);
                void delete (in Object obj, 
                        in CosPersistencePID::PID p);
        };
};


// CosPersistencePO Module, p 5-12 CORBAservices,
// Persistent Object Service V1.0, 3/94

// // #include <CosPersistencePDS.idl>
// CosPersistencePDS.idl 
// // #includes CosPersistencePID.idl

module CosPersistencePO {

        interface PO {
                attribute CosPersistencePID::PID p;
                CosPersistencePDS::PDS connect (
                        in CosPersistencePID::PID p);
                void disconnect (in CosPersistencePID::PID p);
                void store (in CosPersistencePID::PID p);
                void restore (in CosPersistencePID::PID p);
                void delete (in CosPersistencePID::PID p);
        };

        interface SD {
                void pre_store();
                void post_restore();
        };
};


// CosPersistencePOM Module, p 5-15 CORBAservices,
// Persistent Object Service V1.0, 3/94

// #include <CosPersistencePDS.idl>

// CosPersistencePDS.idl // #includes CosPersistencePID.idl

module CosPersistencePOM {

// interface Object;        

	interface POM {
                CosPersistencePDS::PDS connect (
                        in Object obj, 
                        in CosPersistencePID::PID p);
                void disconnect (
                        in Object obj, 
                        in CosPersistencePID::PID p);
                void store (
                        in Object obj, 
                        in CosPersistencePID::PID p);
                void restore (
                        in Object obj, 
                        in CosPersistencePID::PID p);
                void delete (
                        in Object obj, 
                        in CosPersistencePID::PID p);
 	       };
	};


// CosPersistencePDS_DA Module, p 5-22 CORBAservices,
// Persistent Object Service, V1.0, 3/94

// #include <CosPersistencePDS.idl>
// CosPersistencePDS.idl // #includes CosPersistencePID.idl

module CosPersistencePDS_DA {

        typedef string DAObjectID;

        interface PID_DA : CosPersistencePID::PID {
                attribute DAObjectID oid;
        };
        
        interface DAObject {
                boolean dado_same(in DAObject d);
                DAObjectID dado_oid();
                PID_DA dado_pid();
                void dado_remove();
                void dado_free();
        };

        interface DAObjectFactory {
                DAObject create();
        };

        interface DAObjectFactoryFinder {
                DAObjectFactory find_factory(in string key);
        };

        interface PDS_DA : CosPersistencePDS::PDS {
                DAObject get_data();
                void set_data(in DAObject new_data);
                DAObject lookup(in DAObjectID id);
                PID_DA get_pid();
                PID_DA get_object_pid(in DAObject dao);
                DAObjectFactoryFinder data_factories();
        };

        typedef sequence<string> AttributeNames;
        interface DynamicAttributeAccess {
                AttributeNames attribute_names();
                any attribute_get(in string name);
                void attribute_set(in string name, in any value);
        };

        typedef string ClusterID;
        typedef sequence<ClusterID> ClusterIDs;
        interface PDS_ClusteredDA : PDS_DA{
                ClusterID cluster_id();
                string cluster_kind();
                ClusterIDs clusters_of();
                PDS_ClusteredDA create_cluster(in string kind);
                PDS_ClusteredDA open_cluster(in ClusterID cluster);
                PDS_ClusteredDA copy_cluster(
                        in PDS_DA source);
        };
};

// CosPersistenceDDO Module, p 5-32 CORBAservices, Persistent Object Service V1.0, 3/94

// #include <CosPersistencePID.idl>
module CosPersistenceDDO {

        interface DDO {
                attribute string object_type;
                attribute CosPersistencePID::PID p;
                short add_data();
                short add_data_property (in short data_id);
                short get_data_count();
                short get_data_property_count (in short data_id);
                void get_data_property (in short data_id,
                        in short property_id,
                        out string property_name,
                        out any property_value);
                void set_data_property (in short data_id,
                        in short property_id,
                        in string property_name,
                        in any property_value);
                void get_data (in short data_id,
                        out string data_name,
                        out any data_value);
                void set_data (in short data_id,
                        in string data_name,
                        in any data_value);
        };
};

// CosPersistenceDS_CLI module, p 5-34 CORBAservices,
// Persistent Object Service V1.0, 3/94

// #include <CosPersistenceDDO.idl>
// CosPersistenceDDO.idl // #includes CosPersistencePID.idl

module CosPersistenceDS_CLI {
        interface UserEnvironment {
                void set_option (in long option,in any value);
                void get_option (in long option,out any value);
                void release();
        };

        interface Connection {
                void set_option (in long option,in any value);
                void get_option (in long option,out any value);
        };

        interface ConnectionFactory {
                Connection create_object (
                        in UserEnvironment user_envir);
        };

        interface Cursor { 
                void set_position (in long position,in any value);
                CosPersistenceDDO::DDO fetch_object();
        };

        interface CursorFactory {
                Cursor create_object (
                        in Connection connection);
        };

        interface PID_CLI : CosPersistencePID::PID {
                attribute string datastore_id;
                attribute string id;
        };



        interface Datastore_CLI {
                void connect (in Connection connection,
                        in string datastore_id,
                        in string user_name,
                        in string authentication);
                void disconnect (in Connection connection);
                Connection get_connection (
                        in string datastore_id,
                        in string user_name);
                void add_object (in Connection connection,
                        in CosPersistenceDDO::DDO data_obj);
                void delete_object (
                        in Connection connection,
                        in CosPersistenceDDO::DDO data_obj);
                void update_object (
                        in Connection connection,
                        in CosPersistenceDDO::DDO data_obj);
                void retrieve_object(
                        in Connection connection,
                        in CosPersistenceDDO::DDO data_obj);
                Cursor select_object(
                        in Connection connection,
                        in string key);
                void transact (in UserEnvironment user_envir,
                        in short completion_type);
                void assign_PID (in PID_CLI p);
                void assign_PID_relative (
                        in PID_CLI source_pid,
                        in PID_CLI target_pid);
                boolean is_identical_PID (
                        in PID_CLI pid_1,
                        in PID_CLI pid_2);
                string get_object_type (in PID_CLI p);
                void register_mapping_schema (in string schema_file); 
                Cursor execute (in Connection connection,
                        in string command); 
        };

};

