Persistence Service

download Persistence Service

of 27

Transcript of Persistence Service

  • 7/29/2019 Persistence Service

    1/27

    DCOM PERSISTENCESERVICE

    ABISHA.N, DIVYA.R

  • 7/29/2019 Persistence Service

    2/27

    DCOM Services:

    1. Persistence Service

    2. Queuing Service

    3. Transaction Service

    4. Security Service

    5. Clustering Service

    Major Services offered by DCOM are,

  • 7/29/2019 Persistence Service

    3/27

    PERSISTENCE

    Storing an Objects state permanently.

    Persistence is the ability of an object state to survive

    termination of the process in which the object executes.

    Persistence is transparent to client

    Persistent state service hide the details of data storesfrom server objects

  • 7/29/2019 Persistence Service

    4/27

    AIMS OF PERSISTENT SYSTEM

    1. Illustration of perpetuity which gives an illusion that the

    software system is continuously active.

    >>This is done by storing the state of the

    private member variables of an objects and then

    retrieving their values when needed.

    1. Allow a system to work with a large collection of data

    than that could be held by the system memory.

    2. Share data between multiple processes.

  • 7/29/2019 Persistence Service

    5/27

    ACHIEVEING PERSISTENCE

    To achieve persistence, an object should perform the

    following:

    Implement the IPersistFile interface.

    Read its data at the start of each method.

    Write data to Storage whenever the state of theobject changes. It is done without the

    acknowledgement of the client.

  • 7/29/2019 Persistence Service

    6/27

    REQUIREMENTS FOR PERSISTENT

    SERVICES

    1) Object-oriented databases

    2) File Systems

    3) Structured storage

    FILE SYSTEMS:

    In file systems, each bit has a unique

    address.

    Files that store data are identified by their

    pathname.

  • 7/29/2019 Persistence Service

    7/27

    Structured storage

    Structured hierarchy with the root file having the sub-

    storages.

    2 methods:

    Smart pointers:

    >> Includes Object ID along with the

    address.

    load store

  • 7/29/2019 Persistence Service

    8/27

    Structured Storage(CONT)

    Steps in storing objects to Structured storage:

    1. Construct object(Objects added to

    Persistent object registry)

    2. load and store cycle(Object utilize smart

    pointers to restore pointer values)

  • 7/29/2019 Persistence Service

    9/27

    ELEMENTS OF STRUCTURED

    STORAGE

    TYPES OFSTORAGE

    STREAM

    STORAGE

    STREAM : DISK STRUCTURE.

    STORAGE : DIRECTORY STRUCTURE.

  • 7/29/2019 Persistence Service

    10/27

    STREAM OBJECT

    Provides ISTREAM interface.

    Equivalent to single disk file.

    Can have internal structure.

  • 7/29/2019 Persistence Service

    11/27

    STORAGE OBJECT

    Provides ISTORAGE interface.

    Equivalent to directory structure.

    Can have any number of sub-storages and

    stream.

  • 7/29/2019 Persistence Service

    12/27

    MODES OF ACCESS

    DIRECT

    MODE

    TRANSACTE

    D MODE

    Changes made are

    immediate and

    permanent

    Changes are

    buffered so that

    they may be

    saved/committedwhen modifications

    are complete

  • 7/29/2019 Persistence Service

    13/27

    MONIKERS

    The file names is used to identify an object.

    However, file names are unintelligent. Intelligent can bebrought about by encapsulating the information of

    working with the names within the name itself.

    Here, the name becomes an object that implementsname- related interfaces. These objects are called

    monikers.

    Each individual moniker object maintains its own namedata that identifies some other particular object or

    operation.

  • 7/29/2019 Persistence Service

    14/27

    IMONIKER

    A moniker is simply an object that supports IMONIKERinterface.

    IMONIKER interface includes IPersistStream interface.

    PERSISTENT FORM OF MONIKERS:

    Can be saved to and loaded from streams.

    Also helps to provide transparency to clients.

  • 7/29/2019 Persistence Service

    15/27

    OPERATIONS OF IMONKER

    1. BINDING:

    Binding to the object that it points.

    Binding function in IMONKER takes as aparameter the interface identifier by which theclient communicates with object.

    Used to locate the object.

    Expensive Binding: Avoids repeated Connections.

  • 7/29/2019 Persistence Service

    16/27

    2. REDUCTION: Re-writes itself into another equivalent MONIKER.

    3. DISPLAY NAME: Equivalent to file name of an object.

    OPERATIONS OF

    IMONKER(cont)

    RUNNING OBJECT TABLE:Instantiated COM object register themselves and

    their MONIKER in the table, called Running object table.

  • 7/29/2019 Persistence Service

    17/27

    INTERFACES

    COM allows read and write itself to storage by providing

    additional interfaces.

    3 important interfaces are:

    IPersistStorage

    IPersistStream

    IPersistFile

  • 7/29/2019 Persistence Service

    18/27

    Monikers in Detail

    Object or Component that refers to specific

    instance of another object.

    Name which uniquely identifies an COM object

    Persistent Object & Naming Object 1:1

    IMoniker Interface is a Framework

    Co Create Instance cant be used

  • 7/29/2019 Persistence Service

    19/27

    Implementations of Monikers

    File Monikers: Wrapper for file path name

    Item Monikers: Object within another Object

    Pointer Monikers: Object Exist only in Running

    StateAnti-Moniker: Inverse of A moniker

    Composite Monikers: Composed of OtherMonikers

    Class Monikers: Wraps CLSID

    URL Monikers: Manages URL

    Custom Moniker: Object Implements IMoniker

    Interface

  • 7/29/2019 Persistence Service

    20/27

    IMoniker Interface

    Functionalities

    BindToObject

    BindToStorage

    GetDisplayName

    ParseDisplayName

    IsSystemMoniker

    Reduce

    RelativePathTo

    CompositeWith

    Enum

    IsEqual

    Hash

    IsRunning

    Inverse

    CommonPrefixTo

  • 7/29/2019 Persistence Service

    21/27

    Inheritance Hierarchy

    IUnknown

    IPersistIPersistStream

    IMoniker

  • 7/29/2019 Persistence Service

    22/27

    IPersist

    Main Interface

    Base for Persistent Framework

    Some Specific Interfaces:

    IPersistFile

    IPersistStorage

    IPersistSttream

    IPersistStreamInit

  • 7/29/2019 Persistence Service

    23/27

    IPersistFile

    Reads/Writes information into a Completely

    Separate File outside structured storage.

    Methods:

    1.Load

    2.Save

    3.IsDirty

    4.SaveCompleted

    5.GetCurFile

  • 7/29/2019 Persistence Service

    24/27

    IPersistentStorage

    Reads/Writes information in a storage

    hierarchy

    1.Load

    2.Save

    3.IsDirty

    4.SaveCompleted

    5.InitNew

    6.HandsOffStorage

  • 7/29/2019 Persistence Service

    25/27

    IPersistStream

    Reads/Write Information in a single stream

    Basic Model and provides semantics of simple

    load and save

    1.Load

    2.Save

    3.IsDirty

    4.GetSizeMax

  • 7/29/2019 Persistence Service

    26/27

    IPersistStreamInit

    Improves the functionality of IPersistStream

    Initialization function is added

  • 7/29/2019 Persistence Service

    27/27

    Real Time Examples

    a moniker is created for a query, the

    programmer can reuse the query simply by

    calling the moniker in the code.

    Transactions made in Ecommerce

    http://searchsqlserver.techtarget.com/definition/queryhttp://searchsqlserver.techtarget.com/definition/query