ximpfw/core/srcprocessor/ximphostimp.cpp
changeset 0 e6b17d312c8b
child 21 cfd5c2994f10
equal deleted inserted replaced
-1:000000000000 0:e6b17d312c8b
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Presence connection host
       
    15  *
       
    16 */
       
    17 
       
    18 #include <ximpprotocolconnection.h>
       
    19 #include <ximpprotocolconnectionhostobserver.h>
       
    20 
       
    21 #include "ximpapiobjbase.h"
       
    22 #include "ximpstatusimp.h"
       
    23 #include "ximpoperationbase.h"
       
    24 #include "ximphostimp.h"
       
    25 #include "ximpglobals.h"
       
    26 #include "ximppluginfactory.h"
       
    27 #include "ximpeventmanager.h"
       
    28 #include "ximphoststates.h"
       
    29 #include "ximpcontextstateeventimp.h"
       
    30 #include "ximpobjectfactoryimp.h"
       
    31 #include "ximppanics.h"
       
    32 #include "ximppsccontextimp.h"
       
    33 #include "presencedatacacheimp.h"
       
    34 #include "ximpserviceinfoimp.h"
       
    35 #include "ximpoperationbase.h"
       
    36 #include "ximpoperationfactory.h"
       
    37 #include "ximpoperationfactory1.h"
       
    38 #include "ximpobjecthelpers.h"
       
    39 #include "ximpoperationdefs.h"
       
    40 #include "ximpcontexteventqueue.h"
       
    41 #include "ximphostmanager.h"
       
    42 #include "ximpidentityimp.h"
       
    43 #include "ximprestrictedobjectcollectionimp.h"
       
    44 #include "ximprequestcompleteeventimp.h"
       
    45 #include "ximpcontextclientinfoimp.h"
       
    46 
       
    47 #include "protocolpresencedatahostimp.h"
       
    48 
       
    49 #include "protocolpresenceauthorizationdatahostimp.h"
       
    50 #include "protocolpresencepublishingdatahostimp.h"
       
    51 #include "protocolpresencewatchingdatahostimp.h"
       
    52 #include "protocolpresentitygroupsdatahostimp.h"
       
    53 #include "ximpprotocolrequestcompleteeventimp.h"
       
    54 
       
    55 #include <protocoldatahost.h>
       
    56 
       
    57 #include "ximpdlluids.hrh"
       
    58 #include "ximptrace.h"
       
    59 
       
    60 // TODO: illegal dependency to presence operations
       
    61 #include "presenceoperationdefs.h"
       
    62 
       
    63 // ======== LOCAL FUNCTIONS ========
       
    64 const TInt KPluginArrayGranularity = 3;
       
    65 
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // OrderOfObservers()
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 TInt OrderOfObservers( const MXIMPProtocolConnectionHostObserver& aA, 
       
    72                        const MXIMPProtocolConnectionHostObserver& aB )
       
    73     {
       
    74     if( &aA < &aB )
       
    75         {
       
    76         return -1;
       
    77         }
       
    78     else if( &aA > &aB )
       
    79         {
       
    80         return 1;
       
    81         }
       
    82     return 0;
       
    83     }
       
    84 
       
    85 // ======== MEMBER FUNCTIONS ========
       
    86 
       
    87 using namespace NXIMPHost;
       
    88 
       
    89 // This should be variated. Branding variation can be one
       
    90 // possibility. One is to leave adaptation deside how soon
       
    91 // cleanup will be done.
       
    92 // Now 5 sec used for testing purposes. Better value could be
       
    93 // some minutes.
       
    94 const TInt KPscHostCleanerTimerLength = 5; // in sec
       
    95 
       
    96 // ---------------------------------------------------------------------------
       
    97 // CXIMPHost::CXIMPHost()
       
    98 // ---------------------------------------------------------------------------
       
    99 //
       
   100 CXIMPHost::CXIMPHost( MXIMPProtocolConnection& aConnection, TInt32 aProtocolUid  )
       
   101 : iConnection( aConnection ), iProtocolUid( aProtocolUid )
       
   102     {
       
   103     iState = NXIMPHost::EXIMPNotConnected;
       
   104 
       
   105     iHostOriginatedOpIndex = 1;
       
   106 
       
   107     iReferences = 1;
       
   108     
       
   109     iReqIdBuilder.SetSessionId( (unsigned) this );
       
   110     
       
   111     iForcedTearDown = EFalse;
       
   112     }
       
   113 
       
   114 
       
   115 // ---------------------------------------------------------------------------
       
   116 // CXIMPHost::ConstructL()
       
   117 // ---------------------------------------------------------------------------
       
   118 //
       
   119 void CXIMPHost::ConstructL()
       
   120     {
       
   121     iObjFactory = CXIMPObjectFactoryImp::NewL();
       
   122     iEventManager = CXIMPEventManager::NewL();
       
   123     
       
   124     iPresenceDataHost = CProtocolPresenceDataHostImp::NewL( *this );
       
   125 
       
   126     iDataHostArray = new(ELeave)CArrayFixFlat<MProtocolDataHost*>(KPluginArrayGranularity);
       
   127     
       
   128     LoadDataHostArrayL() ;
       
   129     
       
   130 /*    iDataCache = CPresenceDataCache::NewL( *this );
       
   131     iAuthDataHost = CProtocolPresenceAuthorizationDataHostImp::NewL( *this );
       
   132     iPublishingDataHost = CProtocolPresencePublishingDataHostImp::NewL( *this );
       
   133     iWatchingDataHost = CProtocolPresenceWatchingDataHostImp::NewL( *this );
       
   134     iGroupsDataHost = CProtocolPresentityGroupsDataHostImp::NewL( *this );
       
   135 */
       
   136     iCleanerTimer = CPeriodic::NewL( CActive::EPriorityStandard );
       
   137 
       
   138     for ( int i = 0;i < 5;i++ )
       
   139         {
       
   140         iCallBack.Append( new ( ELeave ) CAsyncCallBack( CActive::EPriorityHigh ) );
       
   141         }
       
   142     
       
   143     iCallBack[ECompleteRequestCallback]->Set( TCallBack( CompleteRequestCallback, this ) );
       
   144     iCallBack[ECompleteAdaptationRequestCallback]->Set( TCallBack( CompleteAdaptationRequestCallback, this ) );
       
   145     iCallBack[ECompleteSessionMgmtRequestCallback]->Set( TCallBack( CompleteSessionMgmtRequestCallback, this ) );
       
   146     iCallBack[ECompleteInternalRequestCallback]->Set( TCallBack( CompleteInternalRequestCallback, this ) );
       
   147     iCallBack[EStartProcessCallback]->Set( TCallBack( StartProcessCallback, this ) );
       
   148     
       
   149     iAdaptationReqCompleteEvent = CXIMPProtocolRequestCompleteEventImp::NewL();
       
   150 
       
   151     StartCleanerTimer();
       
   152     }
       
   153 
       
   154 
       
   155 // ---------------------------------------------------------------------------
       
   156 // CXIMPHost::NewLC()
       
   157 // ---------------------------------------------------------------------------
       
   158 //
       
   159 EXPORT_C CXIMPHost* CXIMPHost::NewLC( MXIMPProtocolConnection& aConnection, TInt32 aProtocolUid  )
       
   160     {
       
   161     CXIMPHost* self = new( ELeave ) CXIMPHost( aConnection, aProtocolUid );
       
   162     CleanupClosePushL( *self );
       
   163     self->ConstructL();
       
   164     return self;
       
   165     }
       
   166 
       
   167 
       
   168 // ---------------------------------------------------------------------------
       
   169 // CXIMPHost::~CXIMPHost()
       
   170 // ---------------------------------------------------------------------------
       
   171 //
       
   172 CXIMPHost::~CXIMPHost()
       
   173     {
       
   174     __ASSERT_ALWAYS( iReferences == 0, User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EHostStillReferenced ) );
       
   175 
       
   176     delete iCleanerTimer;
       
   177 
       
   178     delete iObjFactory;
       
   179     iOperations.Close();
       
   180     delete iEventManager;
       
   181     __ASSERT_ALWAYS( iCurrentOperation == 0,
       
   182                 User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EHostCurrentOperationStillActive ) );
       
   183     iRegSessions.Close();
       
   184 
       
   185     delete iPresenceDataHost;
       
   186 
       
   187     if ( iDataHostArray )
       
   188     {
       
   189     	TInt idx = KErrNotFound;
       
   190     	while( iDataHostArray->Count() )
       
   191         {
       
   192 	        idx = iDataHostArray->Count() - 1;
       
   193 	        // Delete object
       
   194 	        delete iDataHostArray->At( idx );
       
   195 	        // Delete element
       
   196 	        iDataHostArray->Delete( idx );
       
   197         }
       
   198     }
       
   199     delete iDataHostArray;
       
   200 
       
   201   /*  delete iDataCache;
       
   202     delete iAuthDataHost;
       
   203     delete iPublishingDataHost;
       
   204     delete iWatchingDataHost;
       
   205     delete iGroupsDataHost;
       
   206 */
       
   207     // delete iCallBack;
       
   208     iCallBack.ResetAndDestroy();
       
   209 
       
   210     CXIMPGlobals::Instance()->HostManager()->DisassociateHost( this );
       
   211     
       
   212     delete iAdaptationReqCompleteEvent;
       
   213     iConnectionHostObservers.Reset();
       
   214     }
       
   215 
       
   216 // ---------------------------------------------------------------------------
       
   217 // CXIMPHost::Open()
       
   218 // ---------------------------------------------------------------------------
       
   219 //
       
   220 void CXIMPHost::Open()
       
   221     {
       
   222     iReferences++;
       
   223     }
       
   224 
       
   225 // ---------------------------------------------------------------------------
       
   226 // CXIMPHost::Close()
       
   227 // ---------------------------------------------------------------------------
       
   228 //
       
   229 void CXIMPHost::Close()
       
   230     {
       
   231     __ASSERT_ALWAYS( iReferences >= 0, User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::EHostNegativeReferenceCount ));
       
   232 
       
   233     iReferences--;
       
   234 
       
   235     if ( iReferences <= 0 )
       
   236         {
       
   237         delete this;
       
   238         }
       
   239     }
       
   240 
       
   241 
       
   242 // ---------------------------------------------------------------------------
       
   243 // Implement supported interface access.
       
   244 // ---------------------------------------------------------------------------
       
   245 //
       
   246 XIMPIMP_IF_BASE_GET_INTERFACE_BEGIN( CXIMPHost, MXIMPProtocolConnectionHost )
       
   247 XIMPIMP_IF_BASE_GET_INTERFACE_END()
       
   248 XIMPIMP_IF_BASE_GET_CONST_INTERFACE_BEGIN( CXIMPHost, MXIMPProtocolConnectionHost )
       
   249 XIMPIMP_IF_BASE_GET_INTERFACE_END()
       
   250 
       
   251 
       
   252 
       
   253 // ---------------------------------------------------------------------------
       
   254 // CXIMPHost::ObjectFactory()
       
   255 // ---------------------------------------------------------------------------
       
   256 //
       
   257 MXIMPObjectFactory& CXIMPHost::ObjectFactory()
       
   258     {
       
   259     return *iObjFactory;
       
   260     }
       
   261 
       
   262 // ---------------------------------------------------------------------------
       
   263 // From MXIMPProtocolConnectionHost class.
       
   264 // CXIMPHost::AuthorizationDataHost()
       
   265 // ---------------------------------------------------------------------------
       
   266 //
       
   267 MProtocolPresenceDataHost& CXIMPHost::ProtocolPresenceDataHost()
       
   268     {
       
   269     return *iPresenceDataHost;
       
   270     }
       
   271 
       
   272 
       
   273 // ---------------------------------------------------------------------------
       
   274 // CXIMPHost::RegisterObserverL()
       
   275 // ---------------------------------------------------------------------------
       
   276 //
       
   277 void CXIMPHost::RegisterObserverL(
       
   278         MXIMPProtocolConnectionHostObserver& aObserver,
       
   279         const TArray<TInt32>* aEventFilter /*= NULL*/ )
       
   280     {
       
   281     XIMP_UNUSED_FORMAL_PARAM( aEventFilter );
       
   282     TLinearOrder< MXIMPProtocolConnectionHostObserver > order( *OrderOfObservers );
       
   283     TInt error = iConnectionHostObservers.InsertInOrder( &aObserver, order );
       
   284     if( error != KErrAlreadyExists )
       
   285         {
       
   286         User::LeaveIfError( error );
       
   287         }
       
   288     }
       
   289 
       
   290 // ---------------------------------------------------------------------------
       
   291 // CXIMPHost::UnregisterConnectionHostObserver()
       
   292 // ---------------------------------------------------------------------------
       
   293 //
       
   294 void CXIMPHost::UnregisterConnectionHostObserver(
       
   295         MXIMPProtocolConnectionHostObserver& aObserver )
       
   296     {
       
   297     TLinearOrder< MXIMPProtocolConnectionHostObserver > order( *OrderOfObservers );
       
   298     TInt index = iConnectionHostObservers.FindInOrder( &aObserver, order );
       
   299     if( index > KErrNotFound )
       
   300         {
       
   301         iConnectionHostObservers.Remove( index );
       
   302         }
       
   303     }
       
   304 
       
   305 // ---------------------------------------------------------------------------
       
   306 // CXIMPHost::HandleRequestCompleted()
       
   307 // ---------------------------------------------------------------------------
       
   308 //
       
   309 void CXIMPHost::HandleRequestCompleted(
       
   310     TXIMPRequestId aReqId,
       
   311     TInt aResultCode )
       
   312     {
       
   313     CXIMPOperationBase& operation = OperationForRequestId( aReqId );
       
   314 
       
   315     operation.SetResultCode( aResultCode );
       
   316     CompleteRequest( aReqId );
       
   317     }
       
   318 
       
   319 // ---------------------------------------------------------------------------
       
   320 // CXIMPHost::HandleRequestCompleted()
       
   321 // ---------------------------------------------------------------------------
       
   322 //
       
   323 void CXIMPHost::HandleRequestCompleted( TXIMPRequestId aReqId,
       
   324                                        MXIMPStatus* aResult )
       
   325     {
       
   326     CXIMPOperationBase& operation = OperationForRequestId( aReqId );
       
   327     
       
   328     operation.SetStatus( aResult );
       
   329     CompleteRequest( aReqId );
       
   330     }
       
   331 
       
   332 
       
   333 // ---------------------------------------------------------------------------
       
   334 // CXIMPHost::HandleRequestCompleted()
       
   335 // ---------------------------------------------------------------------------
       
   336 //
       
   337 void CXIMPHost::HandleRequestCompleted( TXIMPRequestId aReqId,
       
   338                                        MXIMPStatus* aResult,
       
   339                                        MXIMPBase* aParameter )
       
   340     {    
       
   341     CXIMPOperationBase& operation = OperationForRequestId( aReqId );
       
   342     
       
   343     operation.SetObjectCollection( aParameter );
       
   344     HandleRequestCompleted( aReqId, aResult );
       
   345     }
       
   346 
       
   347 // ---------------------------------------------------------------------------
       
   348 // CXIMPHost::CompleteRequest()
       
   349 // ---------------------------------------------------------------------------
       
   350 //
       
   351 void CXIMPHost::CompleteRequest( TXIMPRequestId aReqId )
       
   352     {
       
   353     CXIMPOperationBase& operation = OperationForRequestId( aReqId );
       
   354 
       
   355 #ifdef _DEBUG
       
   356 	if ( operation.Context() )	
       
   357 		TRACE_2( _L("Operation completed for client \"%S\" with result code: %d"), 
       
   358 			 	&operation.Context()->ClientInfo()->ClientId().Identity(), 
       
   359 			 	operation.Status().ResultCode() );
       
   360 #endif			 
       
   361 			 
       
   362     // iCallBack->Set( TCallBack( CompleteRequestCallback, this ) );
       
   363     iCallBack[ECompleteRequestCallback]->CallBack();
       
   364     }
       
   365 
       
   366 // ---------------------------------------------------------------------------
       
   367 // CXIMPHost::HandleConnectionTerminated()
       
   368 // ---------------------------------------------------------------------------
       
   369 //
       
   370 TXIMPRequestId CXIMPHost::HandleConnectionTerminated( MXIMPStatus* aReason )
       
   371     {
       
   372 	TRACE_1( _L("CXIMPHost::HandleConnectionTerminated aReason = %d"), aReason );
       
   373     // This should be set for operation as a reason.
       
   374     XIMP_UNUSED_FORMAL_PARAM( aReason );
       
   375 /*
       
   376     if ( iState != EXIMPConnected )
       
   377         {
       
   378         // we are not in a valid state
       
   379         User::Panic( NXIMPPrivPanic::KCategory,
       
   380                 NXIMPPrivPanic::EInvalidStateForSessionLost );
       
   381         }
       
   382 */
       
   383     TXIMPRequestId reqId;
       
   384 
       
   385     // tear down
       
   386     // we must run the cached unbinds to force teardown
       
   387     // Right way to do this is using non leaving operation add. This can be done
       
   388     // if operation queue is implemented as linked list. When operation queue is fixed
       
   389     // assert should be removed.
       
   390     TRAPD( error, reqId = AddNewOperationL( NXIMPOps::EXIMPForcedTeardown ) );
       
   391     __ASSERT_ALWAYS( error == KErrNone, User::Panic( _L("HandleSessionLost"), -667 ) );
       
   392 
       
   393     iForcedTearDown = ETrue;
       
   394 	
       
   395     return reqId;
       
   396     }
       
   397 
       
   398 
       
   399 // ---------------------------------------------------------------------------
       
   400 // CXIMPHost::UnregisterSession()
       
   401 // ---------------------------------------------------------------------------
       
   402 //
       
   403 void CXIMPHost::UnregisterSession( CXIMPPscContext* aContext )
       
   404     {
       
   405     if( !aContext )
       
   406         {
       
   407         return;
       
   408         }
       
   409     iEventManager->UnregisterSessionQueue( aContext->EventQueue() );
       
   410     TLinearOrder< CXIMPPscContext > order( *CXIMPPscContext::OrderOfContexts );
       
   411     TInt index = iRegSessions.FindInOrder( aContext, order );
       
   412     if( index >= 0 )
       
   413         {
       
   414         iPresenceDataHost->PresenceDataCache().CleanResources( *aContext );
       
   415         iRegSessions.Remove( index );
       
   416         }
       
   417     }
       
   418 
       
   419 // ---------------------------------------------------------------------------
       
   420 // CXIMPHost::FakeCompleteRequest()
       
   421 // ---------------------------------------------------------------------------
       
   422 //
       
   423 void CXIMPHost::FakeCompleteRequest( TXIMPRequestId aReqId, TInt aResult )
       
   424     {
       
   425     HandleRequestCompleted( aReqId, aResult );
       
   426     }
       
   427 
       
   428 // ---------------------------------------------------------------------------
       
   429 // CXIMPHost::HandleAdaptationRequestCompleted()
       
   430 // ---------------------------------------------------------------------------
       
   431 //
       
   432 void CXIMPHost::HandleAdaptationRequestCompleted( TXIMPRequestId aReqId, TInt aResult )
       
   433     {
       
   434     CXIMPOperationBase& operation = OperationForRequestId( aReqId );
       
   435     
       
   436     operation.SetResultCode( aResult );
       
   437     // iCallBack->Set( TCallBack( CompleteAdaptationRequestCallback, this ) );
       
   438     iCallBack[ECompleteAdaptationRequestCallback]->CallBack();
       
   439     }
       
   440 
       
   441 // ---------------------------------------------------------------------------
       
   442 // CXIMPHost::HandleSessionMgmtRequestCompleted()
       
   443 // ---------------------------------------------------------------------------
       
   444 //
       
   445 void CXIMPHost::HandleSessionMgmtRequestCompleted( TXIMPRequestId aReqId, TInt aResult )
       
   446     {
       
   447     CXIMPOperationBase& operation = OperationForRequestId( aReqId );
       
   448 
       
   449     operation.SetResultCode( aResult );
       
   450     // iCallBack->Set( TCallBack( CompleteSessionMgmtRequestCallback, this ) );
       
   451     iCallBack[ECompleteSessionMgmtRequestCallback]->CallBack();
       
   452     }
       
   453 
       
   454 // ---------------------------------------------------------------------------
       
   455 // CXIMPHost::HandleInternalRequestCompleted()
       
   456 // ---------------------------------------------------------------------------
       
   457 //
       
   458 void CXIMPHost::HandleInternalRequestCompleted( TXIMPRequestId aReqId, TInt aResult )
       
   459     {
       
   460     CXIMPOperationBase& operation = OperationForRequestId( aReqId );
       
   461 
       
   462     operation.SetResultCode( aResult );
       
   463     // iCallBack->Set( TCallBack( CompleteInternalRequestCallback, this ) );
       
   464     iCallBack[ECompleteInternalRequestCallback]->CallBack();
       
   465     }
       
   466 
       
   467 // ---------------------------------------------------------------------------
       
   468 // CXIMPHost::PresenceDataAccess()
       
   469 // ---------------------------------------------------------------------------
       
   470 //
       
   471 CProtocolPresenceDataHostImp& CXIMPHost::PresenceDataAccess()
       
   472     {
       
   473     return *iPresenceDataHost;
       
   474     }
       
   475 
       
   476 // ---------------------------------------------------------------------------
       
   477 // CXIMPHost::DataAccess()
       
   478 // ---------------------------------------------------------------------------
       
   479 //
       
   480 /*CPresenceDataCache& CXIMPHost::DataAccess()
       
   481     {
       
   482     return *iDataCache;
       
   483     }
       
   484 
       
   485 // ---------------------------------------------------------------------------
       
   486 // CXIMPHost::AuthorizationDataAccess()
       
   487 // ---------------------------------------------------------------------------
       
   488 //
       
   489 CProtocolPresenceAuthorizationDataHostImp& CXIMPHost::AuthorizationDataAccess()
       
   490     {
       
   491     return *iAuthDataHost;
       
   492     }
       
   493 
       
   494 // ---------------------------------------------------------------------------
       
   495 // CXIMPHost::PublishingDataAccess()
       
   496 // ---------------------------------------------------------------------------
       
   497 //
       
   498 CProtocolPresencePublishingDataHostImp& CXIMPHost::PublishingDataAccess()
       
   499     {
       
   500     return *iPublishingDataHost;
       
   501     }
       
   502 
       
   503 // ---------------------------------------------------------------------------
       
   504 // CXIMPHost::WatchingDataAccess()
       
   505 // ---------------------------------------------------------------------------
       
   506 //
       
   507 CProtocolPresenceWatchingDataHostImp& CXIMPHost::WatchingDataAccess()
       
   508     {
       
   509     return *iWatchingDataHost;
       
   510     }
       
   511 
       
   512 // ---------------------------------------------------------------------------
       
   513 // CXIMPHost::GroupsDataAccess()
       
   514 // ---------------------------------------------------------------------------
       
   515 //
       
   516 CProtocolPresentityGroupsDataHostImp& CXIMPHost::GroupsDataAccess()
       
   517     {
       
   518     return *iGroupsDataHost;
       
   519     }
       
   520 */
       
   521 // ---------------------------------------------------------------------------
       
   522 // CXIMPHost::RegisterSessionL()
       
   523 // ---------------------------------------------------------------------------
       
   524 //
       
   525 void CXIMPHost::RegisterSessionL( CXIMPPscContext* aContext )
       
   526     {
       
   527     if( !aContext )
       
   528         {
       
   529         User::Leave( KErrArgument );
       
   530         }
       
   531     iEventManager->RegisterSessionQueueL( aContext->EventQueue() );
       
   532     TLinearOrder< CXIMPPscContext > order( *CXIMPPscContext::OrderOfContexts );
       
   533     TInt err = iRegSessions.InsertInOrder( aContext, order );
       
   534     if( err != KErrNone )
       
   535         {
       
   536         iEventManager->UnregisterSessionQueue( aContext->EventQueue() );
       
   537         User::Leave( err );
       
   538         }
       
   539     }
       
   540 
       
   541 // ---------------------------------------------------------------------------
       
   542 // CXIMPHost::AddNewOperationL()
       
   543 // ---------------------------------------------------------------------------
       
   544 //
       
   545 void CXIMPHost::AddNewOperationL( CXIMPOperationBase& aOperation )
       
   546     {
       
   547     iOperations.AppendL( &aOperation );
       
   548     aOperation.SetHost( *this );
       
   549 
       
   550     if ( !iProcessing )
       
   551         {
       
   552         ActivateProcessing();
       
   553         }
       
   554     }
       
   555 
       
   556 // ---------------------------------------------------------------------------
       
   557 // CXIMPHost::AddNewOperationL()
       
   558 // ---------------------------------------------------------------------------
       
   559 //
       
   560 TXIMPRequestId CXIMPHost::AddNewOperationL( NXIMPOps::TXIMPOpTypes aOpType )
       
   561     {
       
   562     iReqIdBuilder.SetProtocolId( iProtocolUid );
       
   563     iReqIdBuilder.SetRequestId( iAdaptationOperationIndex );
       
   564     TXIMPRequestId reqId = iReqIdBuilder.BuildRequestId();
       
   565 
       
   566     iAdaptationOperationIndex++;
       
   567     CXIMPOperationBase* op =
       
   568         CXIMPGlobals::Instance()->OperationFactory()->CreateOperationL( aOpType );
       
   569     CleanupStack::PushL( op );
       
   570     op->BaseConstructL( reqId, NULL );
       
   571     op->ConstructL( KNullDesC8 );
       
   572     AddNewOperationL( *op );
       
   573     CleanupStack::Pop(); //operation
       
   574     return reqId;
       
   575     }
       
   576 
       
   577 // ---------------------------------------------------------------------------
       
   578 // CXIMPHost::AddNewOperationL()
       
   579 // ---------------------------------------------------------------------------
       
   580 //
       
   581 TXIMPRequestId CXIMPHost::AddNewOperationL( CXIMPOperationBase* aOperation )
       
   582     {
       
   583     iReqIdBuilder.SetProtocolId( iProtocolUid );
       
   584     iReqIdBuilder.SetRequestId( iAdaptationOperationIndex );
       
   585     TXIMPRequestId reqId = iReqIdBuilder.BuildRequestId();
       
   586 
       
   587     iAdaptationOperationIndex++;
       
   588     aOperation->BaseConstructL( reqId, NULL );
       
   589     aOperation->ConstructL( KNullDesC8 );
       
   590     AddNewOperationL( *aOperation );
       
   591     return reqId;
       
   592     }
       
   593 
       
   594 
       
   595 // ---------------------------------------------------------------------------
       
   596 // CXIMPHost::GetConnection()
       
   597 // ---------------------------------------------------------------------------
       
   598 //
       
   599 MXIMPProtocolConnection& CXIMPHost::GetConnection() const
       
   600     {
       
   601     return iConnection;
       
   602     }
       
   603 
       
   604 // ---------------------------------------------------------------------------
       
   605 // CXIMPHost::AddEventL()
       
   606 // ---------------------------------------------------------------------------
       
   607 //
       
   608 void CXIMPHost::AddEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext  )
       
   609     {
       
   610     AddEventL( aEvent, static_cast< CXIMPPscContext* >( aContext ) );
       
   611     }
       
   612 
       
   613 // ---------------------------------------------------------------------------
       
   614 // CXIMPHost::AddEventL()
       
   615 // ---------------------------------------------------------------------------
       
   616 //
       
   617 void CXIMPHost::AddEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext  )
       
   618     {
       
   619     if( aContext )
       
   620         {
       
   621         iEventManager->AddEventL( aEvent, aContext );
       
   622         }
       
   623     else
       
   624         {
       
   625         iEventManager->AddEventL( aEvent, iRegSessions );
       
   626         }
       
   627     }
       
   628 
       
   629 // ---------------------------------------------------------------------------
       
   630 // CXIMPHost::ActivateEventL()
       
   631 // ---------------------------------------------------------------------------
       
   632 //
       
   633 void CXIMPHost::ActivateEventL( CXIMPApiEventBase& aEvent, MXIMPPscContext* aContext  )
       
   634     {
       
   635     ActivateEventL( aEvent, static_cast< CXIMPPscContext* >( aContext ) );
       
   636     }
       
   637 
       
   638 // ---------------------------------------------------------------------------
       
   639 // CXIMPHost::ActivateEventL()
       
   640 // ---------------------------------------------------------------------------
       
   641 //
       
   642 void CXIMPHost::ActivateEventL( CXIMPApiEventBase& aEvent, CXIMPPscContext* aContext  )
       
   643     {
       
   644     iEventManager->ActivateEventL( aEvent, aContext );
       
   645     }
       
   646 
       
   647 // ---------------------------------------------------------------------------
       
   648 // CXIMPHost::StartProcessing()
       
   649 // ---------------------------------------------------------------------------
       
   650 //
       
   651 void CXIMPHost::StartProcessing()
       
   652     {
       
   653     CXIMPOperationBase* currentOperation = iCurrentOperation;
       
   654     iCurrentOperation = NULL;
       
   655 
       
   656     iProcessing = EFalse;
       
   657 
       
   658     if( iOperations.Count() > 0 )
       
   659         {
       
   660         ActivateProcessing();
       
   661         }
       
   662 
       
   663     delete currentOperation; // might invoke destruction of host.
       
   664     }
       
   665 
       
   666 // ---------------------------------------------------------------------------
       
   667 // CXIMPHost::ActivateProcessing()
       
   668 // ---------------------------------------------------------------------------
       
   669 //
       
   670 void CXIMPHost::ActivateProcessing()
       
   671     {
       
   672     // take the first operation from the queue
       
   673     if( !iCurrentOperation )
       
   674         {
       
   675         if( iOperations.Count() <= 0 )
       
   676             {
       
   677             return;
       
   678             }
       
   679         iCurrentOperation = iOperations[0];
       
   680         iOperations.Remove( 0 );
       
   681         }
       
   682 
       
   683     iCurrentOperation->BeginOperation();
       
   684     iProcessing = ETrue;
       
   685     // iCallBack->Set( TCallBack( StartProcessCallback, this ) );
       
   686     iCallBack[EStartProcessCallback]->CallBack();
       
   687     }
       
   688 
       
   689 // ---------------------------------------------------------------------------
       
   690 // CXIMPHost::StartProcessCallback()
       
   691 // ---------------------------------------------------------------------------
       
   692 //
       
   693 TInt CXIMPHost::StartProcessCallback( TAny *aInstance )
       
   694     {
       
   695     ( static_cast< CXIMPHost* >( aInstance ) )->DoStartProcessCallback();
       
   696     return 0; // ignored by CAsychCallBack
       
   697     }
       
   698 
       
   699 // ---------------------------------------------------------------------------
       
   700 // CXIMPHost::DoStartProcessCallbackL()
       
   701 // ---------------------------------------------------------------------------
       
   702 //
       
   703 void CXIMPHost::DoStartProcessCallback()
       
   704     {
       
   705 #ifdef _DEBUG    
       
   706     if ( iCurrentOperation->Context() )
       
   707 		TRACE_1( _L("Start processing operation for client \"%S\""), 
       
   708 			 	&iCurrentOperation->Context()->ClientInfo()->ClientId().Identity() );
       
   709 #endif
       
   710 
       
   711     TRAPD( err, iCurrentOperation->ProcessL() );
       
   712 
       
   713     if ( err != KErrNone )
       
   714         {
       
   715         HandleRequestCompleted( iCurrentOperation->RequestId(), err  );
       
   716         // internal operation End event and deletion of iCurrentOperation happen within CompleteRequest
       
   717         }
       
   718     }
       
   719 
       
   720 // ---------------------------------------------------------------------------
       
   721 // CXIMPHost::CompleteRequestCallback()
       
   722 // ---------------------------------------------------------------------------
       
   723 //
       
   724 TInt CXIMPHost::CompleteRequestCallback( TAny *aInstance )
       
   725     {
       
   726     static_cast< CXIMPHost* >( aInstance )->DoCompleteRequestCallback();
       
   727     return 0; // ignored by CAsychCallBack
       
   728     }
       
   729 
       
   730 // ---------------------------------------------------------------------------
       
   731 // CXIMPHost::CompleteAdaptationRequestCallback()
       
   732 // ---------------------------------------------------------------------------
       
   733 //
       
   734 TInt CXIMPHost::CompleteAdaptationRequestCallback( TAny *aInstance )
       
   735     {
       
   736     static_cast< CXIMPHost* >( aInstance )->DoCompleteAdaptationRequestCallback();
       
   737     return 0; // ignored by CAsychCallBack
       
   738     }
       
   739 
       
   740 // ---------------------------------------------------------------------------
       
   741 // CXIMPHost::CompleteSessionMgmtRequestCallback()
       
   742 // ---------------------------------------------------------------------------
       
   743 //
       
   744 TInt CXIMPHost::CompleteSessionMgmtRequestCallback( TAny *aInstance )
       
   745     {
       
   746     static_cast< CXIMPHost* >( aInstance )->DoCompleteSessionMgmtRequestCallback();
       
   747     return 0; // ignored by CAsychCallBack
       
   748     }
       
   749 
       
   750 // ---------------------------------------------------------------------------
       
   751 // CXIMPHost::CompleteInternalRequestCallback()
       
   752 // ---------------------------------------------------------------------------
       
   753 //
       
   754 TInt CXIMPHost::CompleteInternalRequestCallback( TAny *aInstance )
       
   755     {
       
   756     static_cast< CXIMPHost* >( aInstance )->DoCompleteInternalRequestCallback();
       
   757     return 0; // ignored by CAsychCallBack
       
   758     }
       
   759 
       
   760 // ---------------------------------------------------------------------------
       
   761 // CXIMPHost::DoCompleteRequestCallback()
       
   762 // ---------------------------------------------------------------------------
       
   763 //
       
   764 void CXIMPHost::DoCompleteRequestCallback()
       
   765     {
       
   766     TRAPD( error, iCurrentOperation->RequestCompletedL() );
       
   767 
       
   768     // Get event and update result code to event's status container
       
   769     CXIMPRequestCompleteEventImp* reqCompEvent = iCurrentOperation->GetReqCompleteEvent();
       
   770 
       
   771     if( error != KErrNone )
       
   772         {
       
   773         reqCompEvent->CompletionResultImp().SetResultCode( error );
       
   774         }
       
   775 
       
   776 	if(!(iCurrentOperation->IsServerOperation()))
       
   777     	{
       
   778         // send the event
       
   779         iEventManager->ActivateRequestCompleteEvent( *reqCompEvent, iCurrentOperation->Context() );
       
   780     	}
       
   781 
       
   782     iCurrentOperation->EndOperation();
       
   783     StartProcessing();
       
   784     }
       
   785 
       
   786 // ---------------------------------------------------------------------------
       
   787 // CXIMPHost::DoCompleteAdaptationRequestCallback()
       
   788 // ---------------------------------------------------------------------------
       
   789 //
       
   790 void CXIMPHost::DoCompleteAdaptationRequestCallback()
       
   791     {
       
   792     TInt leaveError = KErrNone;
       
   793     TRAP( leaveError, iCurrentOperation->RequestCompletedL() ); // CSI: 42 #
       
   794     
       
   795     if( leaveError != KErrNone )
       
   796         {
       
   797         iAdaptationReqCompleteEvent->SetResultCode( leaveError );
       
   798         }
       
   799     else
       
   800         {
       
   801         const TXIMPRequestId reqId = iCurrentOperation->RequestId();        
       
   802         const TInt result = iCurrentOperation->Status().ResultCode();
       
   803         
       
   804         iAdaptationReqCompleteEvent->SetRequestId( reqId );
       
   805         iAdaptationReqCompleteEvent->SetResultCode( result );
       
   806         }        
       
   807         
       
   808     
       
   809     TInt count = iConnectionHostObservers.Count();
       
   810     for( TInt a = 0; a < count; ++a )
       
   811         {
       
   812         iConnectionHostObservers[ a ]->HandleProtocolConnectionHostEvent( *this,
       
   813                                                                           *iAdaptationReqCompleteEvent );
       
   814         }
       
   815 
       
   816     iCurrentOperation->EndOperation();
       
   817 
       
   818     StartProcessing();
       
   819     }
       
   820 
       
   821 // ---------------------------------------------------------------------------
       
   822 // CXIMPHost::DoCompleteSessionMgmtRequestCallback()
       
   823 // ---------------------------------------------------------------------------
       
   824 //
       
   825 void CXIMPHost::DoCompleteSessionMgmtRequestCallback()
       
   826     {
       
   827     TRAP_IGNORE( 
       
   828         iCurrentOperation->RequestCompletedL();
       
   829         iCurrentOperation->EndOperation();
       
   830         )
       
   831         
       
   832     StartProcessing();
       
   833     }
       
   834 
       
   835 // ---------------------------------------------------------------------------
       
   836 // CXIMPHost::DoCompleteInternalRequestCallback()
       
   837 // ---------------------------------------------------------------------------
       
   838 //
       
   839 void CXIMPHost::DoCompleteInternalRequestCallback()
       
   840     {
       
   841     TRAP_IGNORE( 
       
   842         iCurrentOperation->RequestCompletedL();
       
   843         iCurrentOperation->EndOperation();
       
   844         )
       
   845 
       
   846     StartProcessing();
       
   847     }
       
   848 
       
   849 // ---------------------------------------------------------------------------
       
   850 // CXIMPHost::ForcedTeardown()
       
   851 // ---------------------------------------------------------------------------
       
   852 //
       
   853 void CXIMPHost::ForcedTeardownL()
       
   854     {
       
   855     // activate all cached unbinds in all contexts,
       
   856     // first ones will do unshare, the last one will be the actual unbind.
       
   857     // psc host FSA takes care of proper events.
       
   858     //
       
   859     // but if all binds failed, then there are no cached unbinds since
       
   860     // each bind operation has destroyed the cached unbind. in that
       
   861     // case we are already in PSCNotConnected state.
       
   862 
       
   863     TInt foundOps = 0;
       
   864 
       
   865     for ( TInt i = 0; i < iRegSessions.Count(); i++ )
       
   866         {
       
   867         CXIMPPscContext* context = iRegSessions[ i ];
       
   868         CXIMPOperationBase* op = context->GetCachedUnbind();
       
   869 
       
   870         // the operation might already be killed
       
   871         if ( op )
       
   872             {
       
   873             op->SetServerOperation();
       
   874             foundOps++;
       
   875 
       
   876             // This trap can be removed after event queue is changed to 
       
   877             // linked list. See CXIMPHost::HandleConnectionTerminated
       
   878             TRAPD( err, AddNewOperationL( *op ); );
       
   879             if ( err != KErrNone )
       
   880                 {
       
   881                 // could not append operation, so just delete it
       
   882                 delete op;
       
   883                 }
       
   884             }
       
   885         }
       
   886 
       
   887     //__ASSERT_ALWAYS( foundOps > 0, User::Panic( NXIMPPrivPanic::KCategory, NXIMPPrivPanic::ENoCachedUnbindsFound ) );
       
   888     }
       
   889 
       
   890 
       
   891 // ---------------------------------------------------------------------------
       
   892 // CXIMPHost::StartCleanerTimer()
       
   893 // ---------------------------------------------------------------------------
       
   894 //
       
   895 void CXIMPHost::StartCleanerTimer()
       
   896     {
       
   897     if( !iCleanerTimer->IsActive() )
       
   898         {
       
   899         TInt time = 1000000 * KPscHostCleanerTimerLength;
       
   900         TCallBack callback( CleanerCallback, this );
       
   901         iCleanerTimer->Start( time, time, callback );
       
   902         }
       
   903     }
       
   904 
       
   905 
       
   906 // ---------------------------------------------------------------------------
       
   907 // CXIMPHost::CreateOperationL()
       
   908 // ---------------------------------------------------------------------------
       
   909 //
       
   910 TXIMPRequestId CXIMPHost::AddNewOperationL( 
       
   911     TInt aOperation, 
       
   912     MXIMPBase* aParam, 
       
   913     MXIMPBase* aParam2 /*=NULL*/ )
       
   914     {
       
   915     CXIMPRestrictedObjectCollectionImp* collection = CXIMPRestrictedObjectCollectionImp::NewLC( EFalse );
       
   916     collection->AddOrReplaceTypeL( aParam );
       
   917     if( aParam2 )
       
   918         {
       
   919         collection->AddOrReplaceTypeL( aParam2 );
       
   920         }
       
   921     TXIMPRequestId reqId = AddNewOperationL( aOperation, collection );
       
   922     CleanupStack::Pop( collection );
       
   923     return reqId;
       
   924     } 
       
   925     
       
   926     
       
   927 // ---------------------------------------------------------------------------
       
   928 // CXIMPHost::AddNewOperationL()
       
   929 // ---------------------------------------------------------------------------
       
   930 //
       
   931 TXIMPRequestId CXIMPHost::AddNewOperationL( 
       
   932     TInt aOperation, 
       
   933     CXIMPRestrictedObjectCollectionImp* aParams )
       
   934     {
       
   935     CXIMPOperationBase* operation = 
       
   936         CXIMPGlobals::Instance()->OperationFactory()->CreateOperationL( aOperation );
       
   937     CleanupStack::PushL( operation );
       
   938     TXIMPRequestId reqId = AddNewOperationL( operation );
       
   939     CleanupStack::Pop( operation );
       
   940     operation->SetObjectCollection( aParams );
       
   941     aParams->SetObjectOwnership();
       
   942     return reqId;
       
   943     }
       
   944 
       
   945 // ---------------------------------------------------------------------------
       
   946 // CXIMPHost::CleanerCallback()
       
   947 // ---------------------------------------------------------------------------
       
   948 //
       
   949 TInt CXIMPHost::CleanerCallback( TAny* aMyself )
       
   950     {
       
   951     (static_cast<CXIMPHost*>(aMyself))->DoCleanerCallback();
       
   952     return 0; // ignored by CPeriodic
       
   953     }
       
   954 
       
   955 // ---------------------------------------------------------------------------
       
   956 // CXIMPHost::DoCleanerCallback()
       
   957 // ---------------------------------------------------------------------------
       
   958 //
       
   959 void CXIMPHost::DoCleanerCallback()
       
   960     {
       
   961     TRAPD( err, DoCleanerCallbackL() );
       
   962 
       
   963     if ( err != KErrNone )
       
   964         {
       
   965         // Try to start cleaner again after interval when error happened.
       
   966         StartCleanerTimer();
       
   967         }
       
   968     }
       
   969 
       
   970 // ---------------------------------------------------------------------------
       
   971 // CXIMPHost::DoCleanerCallbackL()
       
   972 // ---------------------------------------------------------------------------
       
   973 //
       
   974 void CXIMPHost::DoCleanerCallbackL()
       
   975     {
       
   976     // create CleanerOperation
       
   977 
       
   978     iCleanerTimer->Cancel();  // CPeriodic must be stopped
       
   979 
       
   980     // host originated operations have session id of 0
       
   981     iReqIdBuilder.SetProtocolId( 0 );
       
   982     iReqIdBuilder.SetRequestId( iHostOriginatedOpIndex );
       
   983     TXIMPRequestId reqId = iReqIdBuilder.BuildRequestId();
       
   984 
       
   985     iHostOriginatedOpIndex++;
       
   986 	//// for Presence Operation Cleaner
       
   987     CXIMPOperationBase* op =
       
   988         CXIMPGlobals::Instance()->OperationFactory()->CreateOperationL(
       
   989                 NPresenceOps::EXIMPCleaner );
       
   990     op->BaseConstructL( reqId, NULL );
       
   991     CleanupStack::PushL( op );
       
   992     AddNewOperationL( *op ); // ownership was transferred to operation queue
       
   993     CleanupStack::Pop( op );
       
   994     
       
   995 
       
   996 	// let every protocol host create their cleanup operation
       
   997 	TInt count = iDataHostArray->Count() ;
       
   998 
       
   999 	for(TInt i=0; i<count; i++)
       
  1000 		{
       
  1001 		TXIMPRequestId reqIdim = iReqIdBuilder.BuildRequestId();
       
  1002 		
       
  1003 		TInt cleanupid = iDataHostArray->At(i)->GetCleanupOperation();
       
  1004 	    CXIMPOperationBase* cleanupop =
       
  1005 	        		CXIMPGlobals::Instance()->OperationFactory()->CreateOperationL(cleanupid);
       
  1006 					
       
  1007 		if ( cleanupop )
       
  1008 			{
       
  1009 			cleanupop->BaseConstructL( reqIdim, NULL );
       
  1010 			CleanupStack::PushL( cleanupop );
       
  1011 			AddNewOperationL( *cleanupop ); // ownership was transferred to operation queue
       
  1012 			CleanupStack::Pop( cleanupop );
       
  1013 			}
       
  1014 		}
       
  1015     }
       
  1016 
       
  1017 
       
  1018 // ---------------------------------------------------------------------------
       
  1019 // CXIMPHost::OperationForRequestId()
       
  1020 // ---------------------------------------------------------------------------
       
  1021 //
       
  1022 CXIMPOperationBase& CXIMPHost::OperationForRequestId( TXIMPRequestId aReqId )
       
  1023     {
       
  1024     __ASSERT_ALWAYS( iCurrentOperation, User::Panic( NXIMPPrivPanic::KCategory,
       
  1025             NXIMPPrivPanic::ECurrentOperationNull ) );
       
  1026 
       
  1027     if ( iCurrentOperation->RequestId() != aReqId )
       
  1028         {
       
  1029         // we were not processing this request, panic the plugin (and the
       
  1030         // server, as it is...)
       
  1031         User::Panic( NXIMPPlugin::KCategory, NXIMPPlugin::EInvalidRequestId );
       
  1032         }
       
  1033     return *iCurrentOperation;
       
  1034     }
       
  1035 
       
  1036 // ---------------------------------------------------------------------------
       
  1037 // CXIMPHost::ProtocolUID()
       
  1038 // ---------------------------------------------------------------------------
       
  1039 //
       
  1040 TInt32 CXIMPHost::ProtocolUID()
       
  1041 	{
       
  1042 	return iProtocolUid;
       
  1043 	}
       
  1044 
       
  1045 
       
  1046 // ---------------------------------------------------------------------------
       
  1047 // CXIMPHost::SetProtocolHosts()
       
  1048 // ---------------------------------------------------------------------------
       
  1049 //
       
  1050 void CXIMPHost::SetProtocolHosts()
       
  1051 	{
       
  1052 	// enumurate through all the host plugins to set the host in corresponding protocol features 
       
  1053 	TInt count = iDataHostArray->Count() ;
       
  1054 
       
  1055 	for(TInt i=0; i<count; i++)
       
  1056 		{
       
  1057 		iDataHostArray->At(i)->SetHostToProtocol() ;
       
  1058 		}
       
  1059 	}
       
  1060 // ---------------------------------------------------------------------------
       
  1061 // CXIMPHost::GetProtocolHost()
       
  1062 // ---------------------------------------------------------------------------
       
  1063 //
       
  1064 TAny* CXIMPHost::GetProtocolHost(TInt aInterfaceId)
       
  1065 	{
       
  1066 	// provide interface by enumurating and getting the one
       
  1067 	TAny* ptr = NULL ;
       
  1068 	TInt count = iDataHostArray->Count() ;
       
  1069 
       
  1070 	for(TInt i=0; i<count; i++)
       
  1071 		{
       
  1072 		ptr = iDataHostArray->At(i)->GetInterface(aInterfaceId);
       
  1073 		if(ptr)
       
  1074 			{
       
  1075 				break ;		
       
  1076 			}
       
  1077 		}
       
  1078 	return ptr;
       
  1079 	}
       
  1080 
       
  1081 void CXIMPHost::LoadDataHostArrayL() 
       
  1082 	{
       
  1083 	RImplInfoPtrArray pluginArray;		
       
  1084 	MProtocolDataHost::ListAllImplementationsL(pluginArray) ;	
       
  1085 	if ( pluginArray.Count() )
       
  1086 		{
       
  1087 		for( TInt i = 0; i < pluginArray.Count(); i++ )
       
  1088 			{
       
  1089 			MProtocolDataHost* implementation = NULL ;			
       
  1090 			CImplementationInformation* info = pluginArray[ i ];        
       
  1091         	TUid id = info->ImplementationUid();        	
       
  1092         	TRAPD(err, implementation = MProtocolDataHost::NewL( id,*this) );
       
  1093         	CleanupStack::PushL(implementation);
       
  1094         	if(err == KErrNone)
       
  1095         		{
       
  1096         		iDataHostArray->AppendL( implementation );
       
  1097         		}
       
  1098         	CleanupStack::Pop(implementation);
       
  1099 			}
       
  1100 		}
       
  1101 	pluginArray.ResetAndDestroy();
       
  1102 
       
  1103 	}
       
  1104 // End of file