javaextensions/wma/mms/pushplugin/src/mmsserverconnectionfactory.cpp
changeset 21 2a9601315dfc
child 78 71ad690e91f5
equal deleted inserted replaced
18:e8e63152f320 21:2a9601315dfc
       
     1 /*
       
     2 * Copyright (c) 2008 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:
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #include "logger.h"
       
    20 #include "mmsserverconnection.h"
       
    21 #include "mmsserverconnectionfactory.h"
       
    22 
       
    23 using namespace java::util;
       
    24 using namespace java::wma;
       
    25 
       
    26 #if defined(__SYMBIAN32__) && defined(__WINSCW__)
       
    27 #include <pls.h>
       
    28 #else
       
    29 static MmsServerConnectionFactory* sMmsSrvConnFac = 0;
       
    30 #endif
       
    31 
       
    32 #ifdef __SYMBIAN32__
       
    33 ServerConnectionFactory& getServerConnectionFactory()
       
    34 {
       
    35 #else
       
    36 extern "C"
       
    37 ServerConnectionFactory& getServerConnectionFactory()
       
    38 {
       
    39 #endif
       
    40     JELOG2(EWMA);
       
    41 
       
    42     //CONTEXT_REMOVAL
       
    43 #if defined(__SYMBIAN32__) && defined(__WINSCW__)
       
    44     TUid uid = TUid::Uid(0xE0000139);
       
    45     MmsServerConnectionFactory* retObj = Pls<MmsServerConnectionFactory>(uid);
       
    46     return *retObj;
       
    47 #else
       
    48     if (sMmsSrvConnFac == 0)
       
    49     {
       
    50         sMmsSrvConnFac = new MmsServerConnectionFactory();
       
    51     }
       
    52     return *sMmsSrvConnFac;
       
    53 #endif
       
    54 
       
    55     /*
       
    56      Context& context = Context::getContext();
       
    57      void* ptr = context.getService("mmspushplugin::ServerConnectionFactory");
       
    58      if(NULL == ptr)
       
    59      {
       
    60      MmsServerConnectionFactory* newObj = new MmsServerConnectionFactory();
       
    61      context.addService("mmspushplugin::ServerConnectionFactory",newObj);
       
    62      return *newObj;
       
    63      }
       
    64      ServerConnectionFactory* retObj = reinterpret_cast
       
    65      <ServerConnectionFactory*>(ptr);
       
    66      return *retObj;
       
    67      */
       
    68 }
       
    69 
       
    70 OS_EXPORT MmsServerConnectionFactory& MmsServerConnectionFactory::getFactory()
       
    71 {
       
    72     JELOG2(EWMA);
       
    73     ServerConnectionFactory& scf = ::getServerConnectionFactory();
       
    74     return reinterpret_cast<MmsServerConnectionFactory&>(scf);
       
    75 }
       
    76 
       
    77 /**
       
    78  *
       
    79  */
       
    80 OS_EXPORT MmsServerConnectionFactory::MmsServerConnectionFactory()
       
    81 {
       
    82     JELOG2(EWMA);
       
    83 }
       
    84 
       
    85 /**
       
    86  *
       
    87  */
       
    88 OS_EXPORT MmsServerConnectionFactory::~MmsServerConnectionFactory()
       
    89 {
       
    90     JELOG2(EWMA);
       
    91 }
       
    92 
       
    93 /**
       
    94  *
       
    95  */
       
    96 OS_EXPORT ServerConnection* MmsServerConnectionFactory::createSrvConnObj(
       
    97     const std::wstring& aUri,
       
    98     const std::wstring& aFilter)
       
    99 {
       
   100     return MmsServerConnection::getServerConnection(aUri,aFilter);
       
   101 }
       
   102 
       
   103 OS_EXPORT bool MmsServerConnectionFactory::isMultipleSrvConnAllowed()
       
   104 {
       
   105     return false;
       
   106 }
       
   107