Q8M1 – SC Dudy Fathan Ali S.Kom Distributed Application Development Q8M1 Dudy Fathan Ali, S.Kom (DFA) 2017 CEP - CCIT Fakultas Teknik Universitas Indonesia
Q8M1 – SC Dudy Fathan Ali S.Kom
Distributed Application Development
Q8M1
Dudy Fathan Ali, S.Kom (DFA)2017
CEP - CCITFakultas Teknik Universitas Indonesia
Additional Documents
Q8M1 – SC Dudy Fathan Ali S.Kom
bit.ly/4sc1-repo
Download this Powerpoint Slide:
Objectives
Q8M1 – SC Dudy Fathan Ali S.Kom
Identify COM+
Create COM+ serviced components
Explore COM+ applications
Q8M1 – SC Dudy Fathan Ali S.Kom
Introducing COM+
Distributed Application Development
o Earlier distributed applications were based on DCOM.
o DCOM-based applications do not provide features such as secure communication and reliable data transfer.
o To include such features in the distributed applications, you need to implement COM+.
Q8M1 – SC Dudy Fathan Ali S.Kom
Evolution of COM+
Distributed Application Development
o Single-tier applications do not provide code reusability.
o COM was introduced to provide code reusability.
o COM had the following limitations:
o It does not allow a client application residing on a separate computer to access a component.
o It does not provide features such as security and consistency of data.
o These limitations led to the development of DCOM.
Q8M1 – SC Dudy Fathan Ali S.Kom
Evolution of COM+ (contd.)
Distributed Application Development
o DCOM:
o Allows developers to create a component that can be accessed by a client application residing on a separate computer.
o Provides features such as security and platform independence that are required in the distributed application architecture.
o DCOM does not provide features such as reliable data transfer, enhanced performance, and optimum memory consumption required in the distributed application architecture.
o This led to the development of COM+.
Q8M1 – SC Dudy Fathan Ali S.Kom
COM+ Services
Distributed Application Development
o COM+ provides various services that enable COM developers to develop scalable and robust distributed applications.
o Some of the COM+ services are:
o Just-in-time activation
o Role-based security
o Synchronization
o Object pooling
o Transactions
o Queued components
Q8M1 – SC Dudy Fathan Ali S.Kom
COM+ Services (contd.)
Distributed Application Development
o The just-in-time (JIT) activation service:
o Enables optimum use of server resources.
o Can be implemented in a COM+ serviced component, as shown in the following code snippet:
[JustInTimeActivation]
public class MyClass : ServicedComponent
{
//class body
}
Q8M1 – SC Dudy Fathan Ali S.Kom
COM+ Services (contd.)
Distributed Application Development
o The role-based security service:
o Is used to secure distributed applications.
o Provides role-based access to the components.
o Can be implemented in a COM+ serviced component, as shown in the following code snippet:
[SecurityRole("Manager", SetEveryoneAccess=false)]
public class MyClass : ServicedComponent
{
//class body
}
Q8M1 – SC Dudy Fathan Ali S.Kom
COM+ Services (contd.)
Distributed Application Development
o The synchronization service:
o Enables you to manage multiple client applications accessing a COM+ serviced component, simultaneously.
o Prohibits more than one application to access a component at a particular point in time.
o Can be implemented in a COM+ serviced component, as shown in the following code snippet:
[Synchronization(SynchronizationOption.Required)]
public class MyClass : ServicedComponent
{
//class body
}
Q8M1 – SC Dudy Fathan Ali S.Kom
COM+ Services (contd.)
Distributed Application Development
o A transaction:
o Enables a component to maintain data integrity and consistency by grouping various related operations as an atomic unit.
o Is successful only when all the operations contained in the atomic unit are completed successfully.
o Can be implemented in a COM+ serviced component, as shown in the following code snippet:
[Transaction(TransactionOption.Required)]
public class MyClass : ServicedComponent
{
//class body
}
Q8M1 – SC Dudy Fathan Ali S.Kom
COM+ Services (contd.)
Distributed Application Development
o Message queuing service:
o Enables a client to send a message to a COM+ serviced component even if the component is not available due to network connectivity.
o Can be implemented in a COM+ serviced component, as shown in the following code snippet:
[assembly: ApplicationQueuing(Enabled = true,
QueueListenerEnabled = true)]
namespace MyComponent
{
public class Class1:ServicedComponent
{
//class body
}
}
Q8M1 – SC Dudy Fathan Ali S.Kom
Creating COM+ Serviced Components
Distributed Application Development
o Components that use COM+ services are called COM+ serviced components.
o COM+ serviced components are derived from the .NET base class ServicedComponent present in the System.EnterpriseServicesnamespace.
o To implement COM+ services in a .NET component, you need to:
o Configure the component.
o Register the component.
Q8M1 – SC Dudy Fathan Ali S.Kom
Configuring a .NET Component
Distributed Application Development
o To implement COM+ services in a .NET component, you need to inherit the ServicedComponent class present in the System.EnterpriseServices namespace, as shown in the following code snippet:
using System.EnterpriseServices;
namespace MyComponent
{
public class MyComponentClass:ServicedComponent
{
//class body
}
}
Q8M1 – SC Dudy Fathan Ali S.Kom
Registering a .NET Component
Distributed Application Development
o To enable a client application to access a COM+ serviced component, you need to register it in the Component Services tool.
o You can register a component in the Component Services tool by using any one of the following ways:
o Manual registration
o Programmatic registration
o Dynamic registration
Q8M1 – SC Dudy Fathan Ali S.Kom
Summary
Distributed Application Development
o In this session, you learned that:
o COM+ is a programming model that provides a number of features such as security, queuing, and transactions.
o A component that implements the services provided by COM+ is known as a COM+ serviced component.
o Some of the services provided by COM+ are:
o Just-in-time activation
o Role-based security
o Synchronization
o Object pooling
o Transactions
o Queued components
Q8M1 – SC Dudy Fathan Ali S.Kom
Summary
Distributed Application Development
o COM+ serviced components are derived from the .NET base class, ServicedComponent present in the System.EnterpriseServicesnamespace.
o The three ways in which a COM+ serviced component can be registered are:
o Manual registration
o Programmatic registration
o Dynamic registration
o The COM+ serviced components that are related to each other and perform similar functions can be stored in a COM+ application.
Q8M1 – SC Dudy Fathan Ali S.Kom
Summary
Distributed Application Development
o The various types of COM+ applications are:
o Library applications
o Server applications
o Application proxies
o COM+ preinstalled applications
Exercise (contd.)
Q8M1 – SC Dudy Fathan Ali S.Kom
o Sam, a manager at Imperial Bank, is constantly required to calculate the interest amounts for the loans acquired by their customers. The bank has the following schemes to grant loan to the customers:
o A five-year scheme with 5% rate of interest.
o A three-year scheme with 10% rate of interest.
o A two-year scheme with 15% rate of interest.
o You, as a software developer, need to create a COM+ serviced component that calculates the interest and the total amount to be paid by the customer at the end of the loan duration.
Exercise (contd.)
Q8M1 – SC Dudy Fathan Ali S.Kom
o In addition, you need to create a client application that uses the COM+ serviced component. The client application should accept the customer name, the loan amount, and the number of years and display the total amount to be paid by the customer at the end of the period.
o To calculate the interest and the total amount by using a COM+ serviced component and to display the amount by using a client application, you need to perform the following tasks:
o Create a COM+ serviced component.
o Register the COM+ serviced component.
o Create a client application.
o Execute and verify the client application.
Exercise (contd.)
Q8M1 – SC Dudy Fathan Ali S.Kom
bit.ly/4sc1-repo
Upload your answers in .rar extension to:
Q8M1 – SC Dudy Fathan Ali S.Kom
Thank You!Dudy Fathan Ali, S.Kom