Professional Documents
Culture Documents
IV SEM MCA
23.What is DCOM
• DCOM (Distributed Component Object Model) is a set of Microsoft concepts
and program interfaces in which client program object s can request services from
server program objects on other computers in a network.
• DCOM is based on the Component Object Model (COM), which provides a
set of interfaces allowing clients and servers to communicate within the same
computer
• DCOM can also work on a network within an enterprise or on other networks
besides the public Internet. It uses TCP/IP and Hypertext Transfer Protocol . DCOM
comes as part of the Windows operating systems.
• DCOM is or soon will be available on all major UNIX platforms and on
IBM's large server products. DCOM replaces OLE Remote Automation.
• DCOM is generally equivalent to the Common Object Request Broker
Architecture ( CORBA ) in terms of providing a set of distributed services. DCOM
is Microsoft's approach to a network-wide environment for program and data
objects.
24.Compare and contrast between CORBA and DCOM
25.What is threading
Single-threaded Apartments --
A logical grouping of related objects that all execute on the same thread, and so
must have synchronous execution could live on the same single-threaded
apartment thread. An apartment-model object cannot, however, reside on more
than one thread. Calls to objects in other processes must be made within the
context of the owning process, so distributed COM switches threads for you
automatically when you call on a proxy.
Multi-threaded Apartments –
In a multi-threaded apartment, all the threads in the process that have been
initialized as free-threading reside in a single apartment. Therefore, there is no need to
marshal between threads. The threads need not retrieve and dispatch messages because
COM does not use messages in this model.
Calls to methods of objects in the multi-threaded apartment can be run on any thread in
the apartment. There is no serialization of calls - many calls may occur to the same
method or to the same object simultaneously. Objects created in the multi-threaded
apartment must be able to handle calls on their methods from other threads at any time.
Multi-threaded object concurrency offers the highest performance and takes the best
advantage of multi-processor hardware for cross-thread, cross-process, and cross-
machine calling, since calls to objects are not serialized in any way. This means,
however, that the code for objects must provide synchronization in their interface
implementations, typically through the use of platform dependent synchronization
primitives. In addition, because the object doesn't control the lifetime of the threads that
are accessing it, no thread-specific state may be stored in the object (in Thread-Local-
Storage).
Multiple clients can call an object that supports free-threading simultaneously from
different threads: In free threaded out-of-process servers, COM, through the RPC sub-
system, creates a pool of threads in the server process and a client call (or multiple
client calls) can be delivered by any of these threads at any time. An out-of-process
server must also implement synchronization in its class factory. Free threaded, in-
process objects can receive direct calls from multiple threads of the client.
The client can do COM work in multiple threads. All threads belong to the same multi-
threaded apartment. Interface pointers are passed directly from thread to thread within a
multi-threaded apartment so interface pointers are not marshaled between its threads.
Message filters (implementations of IMessageFilter()) are not used in multi-threaded
apartments. The client thread will suspend when it makes a COM call to out-of-
apartment objects and will resume when the call returns. Calls between processes are
still handled by RPC.
Threads initialized with the free-threading model must implement their own
synchronization.
For libraries that target the .NET Framework, you can share assemblies
between applications by putting them in the global assembly cache (GAC).
Assemblies are only loaded into memory if they are required. If they aren't
used, they aren't loaded. This means that assemblies can be an efficient way to
manage resources in larger projects.
Assemblies provide the common language runtime with the information it needs to be
aware of type implementations. To the runtime, a type does not exist outside the context
of an assembly.
Code that the common language runtime executes. Note that each assembly can have
only one entry point: DllMain, WinMain, or Main.
Security boundary. An assembly is the unit at which permissions are requested and
granted. For more information about security boundaries in assemblies, see Assembly
security considerations.
Type boundary. Every type's identity includes the name of the assembly in which it
resides. A type called MyType that is loaded in the scope of one assembly is not the
same as a type called MyType that is loaded in the scope of another assembly.
Reference scope boundary. The assembly manifest has metadata that is used for
resolving types and satisfying resource requests. The manifest specifies the types and
resources to expose outside the assembly, and enumerates other assemblies on which it
depends. Microsoft intermediate language (MSIL) code in a portable executable (PE)
file won't be executed unless it has an associated assembly manifest.
Version boundary. The assembly is the smallest versionable unit in the common
language runtime. All types and resources in the same assembly are versioned as a unit.
The assembly manifest describes the version dependencies you specify for any
dependent assemblies.
Deployment unit. When an application starts, only the assemblies that the application
initially calls must be present. Other assemblies, such as assemblies containing
localization resources or utility classes, can be retrieved on demand. This allows apps to
be simple and thin when first downloaded.
.NET Framework's Reflection API allows you to fetch type (assembly) information at runtime
programmatically. We can also achieve late binding by using .NET Reflection. At runtime, the
Reflection mechanism uses the PE file to read information about the assembly. Reflection enables
you to use code that is not available at compile time. .NET Reflection allows an application to
collect information about itself and also to manipulate on itself. It can be used effectively to find all
types in an assembly and/or dynamically invoke methods in an assembly. This includes information
about the type, properties, methods, and events of an object. With Reflection, we can dynamically
create an instance of a type, bind the type to an existing object, or get the type from an existing
object and invoke its methods or access its fields and properties. We can also access attribute
information using Reflection.
Using Reflection, you can get any kind of information which you can see in a class viewer; for example,
information on the methods, properties, fields, and events of an object.
The System.Reflection namespace and the System.Type class plays a very important role in .NET
Reflection. These two work together and allow you to reflect over many other aspects of a type.
Class Description
Performs Reflection on a module. This class allows you to access a given module
Module
within a multi-file assembly.
This class allows you to discover numerous details behind an assembly's identity.
An assembly's identity consists of the following:
Simple name
AssemblyName
Version number
Cryptographic key pair
Supported culture
This class holds information for a given event. Use the EventInfo class to inspect
EventInfo
events and to bind to event handlers.
This class holds information for a given field. Fields are variables defined in the
class. FieldInfo provides access to the metadata for a field within a class, and
FieldInfo
provides dynamic set and get functionality for the field. The class is not loaded into
memory until Invoke or get is called on the object.
ParameterInf
This class holds information for a given parameter.
o
PropertyInfo This class holds information for a given property.
It represents type declarations: class types, interface types, array types, value types, enumeration types,
type parameters, generic type definitions, and open or closed constructed generic types.
Use the members of Type to get information about a type declaration, such as the constructors,
methods, fields, properties, and events of a class, as well as the module and the assembly in which the
class is deployed.
There are tree ways to obtain a Type reference:
The System.Type class defines a number of members that can be used to examine a type's
metadata, a great number of which return types from the System.Reflection namespace.
1. A number of properties retrieve the strings containing various names associated with the class,
as shown in the following table:
Property Returns
FullName The fully qualified name of the data type (including the namespace name).
Namespac
The name of the namespace in which the data type is defined.
e
2. It is also possible to retrieve references to further type objects that represent related classes, as
shown in the following table:
Property Returns Type Reference Corresponding To
The type that this type maps to in the .NET runtime (recall that
UnderlyingSystemTyp
certain .NET base types actually map to specific predefined types
e
recognized by IL).
3. A number of Boolean properties indicating whether this type is, for example, a class, an enum,
and so on.
Type Meaning in Life
ion
o IsGenericParameter
o IsInterface
o IsPrimitive
o IsPublic
o IsNestedPrivate
o IsNestedPublic
o IsSealed
o IsValueType
o IsPointer
Marshal by value: the server creates a copy of the object passes the copy to the
client.
Marshal by reference: the client creates a proxy for the object and then uses the
proxy to access the object.
Remote objects are accessed through channels. Channels are Transport protocols for
passing the messages between Remote objects. A channel is an object that makes
communication between a client and a remote object, across app domain boundaries.
The .NET Framework implements two default channel classes, as follows:
HttpChannel: Implements a channel that uses the HTTP
protocol. TcpChannel: Implements a channel that uses the TCP protocol (Transmission
Control Protocol). Channel take stream of data and creates package for a transport
protocol and sends to other machine. A simple architecture of .NET remoting is as in Fig
1.
As Fig.1 shows, Remoting system creates a proxy for the server object and a reference to
the proxy will be returned to the client. When client calls a method, Remoting system
sends request thro the channel to the server. Then client receives the response sent by
the server process thro the proxy.
30.Write a short notes on Active X Control and OLE containers
Support for the construction of models (typically in UML) and supporting further
metadata can help guide the component construction process.
At a minimum, such models help in documenting an effort.
In practically relevant cases
such as components representing relatively straightforward business
concepts in the presence of evolved application servers
components can actually be generated from their models with little further
input from developers.
Where this approach succeeds, modeling and generator tools can take the
marketing position of RAD tools.
After creating the component logic and writing the business logic, we can use the
component from a simple client program. A big advantage of the CORBA
component model is the ability to connect components together to form larger
structures called component assemblies.
Based on the CAD we can generate an assembly object that instantiates components
and connects them together to form a component assembly.
The component descriptor files are the base for the higher-level assembly descriptor,
which describes the components of the assembly and their connections. That means
that all information of the assembly descriptor comes from the component
descriptors of the related components (and some additional data from a GUI).
At runtime a managing object is needed that can establish an assembly instance. The
assembly object creates the component instances and connects their receptacles and
facets. All information for generating an assembly object comes from the assembly
descriptor (or its DOM model in memory). Note that this object must eventually be
able to create local or local/remote assembly instances.
UML Parser
After generating the component assembly and its descriptor file we have to package
these files into a zip file called a component assembly package. The assembly
packaging tool provides these functionalities to the assembly developer.
On the target host the component assembly package must be unzipped, and the
assembly must be deployed in the application server. The assembly deployment tool
provides these functionalities to the assembly deployer.