Finished integration of license manager in producer.

[email protected]
Newsgroups gmane.comp.multimedia.helix.devel
Message-ID <[email protected]>
Synopsis
========
Finished integration of licensing Manager to producer_13_0_RN

Branches: PRODUCER_13_0_RN.
Suggested Reviewer: Anyone.


Description
===========
1. Modifed and cleaned up the session maanger to create license Manager as
instance of class. This is to ensure that license file directory setting
remains valid.
Added log message printing machine ID in case license is not valid.

2. Added check in license manager for checking valid machine ID.

3. Some files from client_rn/encode/encsession were not checked in
PRODUCER_13_0_RN. Also there was bug fix on SERVER_13_0_RN which was
missing.
So got the latest files from SERVER_13_0_RN.

4. Added a deault licenses folder to installer and modifed producer.pref
file to point to it.

5. Modified Active-x control to create license manager and set licenses
directory.

Files Affected
==============
client/encodesvc/activex/ctrl/ProducerCtrl.cpp & .h
producerapps/cmdproducer/session.cpp
producerapps/cmdproducer/session.h
producerapps/common/util/hxtpreferenceshandler.cpp
producerapps/common/util/pub/hxtpreferenceconstants.h

Testing Performed
=================
Tested with valid file in GUI and commandline producer.

Tested with invalid file.

Tested with valid license file but invalid machine id.

Performance Tests:
- None

Platforms Tested: win32-i386-vc7
Build verified: win32-i386-vc7

QA Hints
========
Please test licence manager feature.

Index: ProducerCtrl.cpp
===================================================================
RCS file: /cvsroot/client/encodesvc/activex/ctrl/ProducerCtrl.cpp,v
retrieving revision 1.3.2.4
diff -u -r1.3.2.4 ProducerCtrl.cpp
--- ProducerCtrl.cpp	25 Jun 2009 21:49:00 -0000	1.3.2.4
+++ ProducerCtrl.cpp	27 Jun 2009 06:26:15 -0000
@@ -5073,6 +5073,17 @@
 	}
     }

+    if (SUCCEEDED( res ))
+    {
+	res = m_spFactory->CreateInstance(IID_IHXTLicenseManager,
m_spLicenseManager.AdoptVoid());
+	if (SUCCEEDED(res))
+	{
+	    CHXString strCommonPath = m_szMediaPlatformPath;
+	    strCommonPath += "licenses";
+
+	    res = m_spLicenseManager->SetLicenseFileDirectory((const
char*)strCommonPath);
+	}
+    }

     if ( SUCCEEDED( res ) )
     {
@@ -5189,6 +5200,7 @@

     HX_RELEASE(m_pLogContext);
     */
+    m_spLicenseManager = NULL;
     m_spLogSystem = NULL;
     m_spCodecUpdator = NULL;
     //Job factory should be released only at the end.


Index: session.cpp
===================================================================
RCS file: /cvsroot/producerapps/cmdproducer/session.cpp,v
retrieving revision 1.153.2.7
diff -u -r1.153.2.7 session.cpp
--- session.cpp	26 Jun 2009 19:59:05 -0000	1.153.2.7
+++ session.cpp	27 Jun 2009 06:38:46 -0000
@@ -389,6 +389,12 @@
 	PrintLiteVersion();
     }

+    res = ValidateLicense();
+    if (FAILED(res))
+    {
+	return res;
+    }
+
     if ( m_Params.bPIDfilename )
     {
 	if (FAILED(m_PID.writeTo( m_Params.strPIDfilename.c_str(), m_ulPID )))
@@ -633,6 +639,7 @@
     m_spAudDefEnum = NULL;

     m_spJob = NULL;
+    m_spLicenseManager = NULL;

     if(!m_Params.m_bQuiet)
     {
@@ -3859,8 +3866,6 @@

 HX_RESULT CSDKSession::CreateFactory()
 {
-    IHXTLicenseManager* pLicenseManager;
-    realstring sLicensedir = "";
     HX_RESULT res = HXR_FAIL;

     UINT32 ulNameLen = ENC_MAX_STR;
@@ -3968,22 +3973,6 @@
 		goto setup_cleanup;
 	}

-#define kszLicenseDir "licenseDir"
-
-
-
-    res = m_appprefs.GetStringSetting( kszPathsElement, kszLicenseDir,
sLicensedir);
-    res = m_spFactory->CreateInstance(IID_IHXTLicenseManager, (void **)
&pLicenseManager);
-    pLicenseManager->SetLicenseFileDirectory(sLicensedir.c_str());
-    UCHAR* pMachineID = pLicenseManager->GetMachineID();
-    res = pLicenseManager->PerformLicenseValidation();
-
-    if (res != HXR_OK)
-	{
-		pszErrMsg = "License Validation Failed";
-		goto setup_cleanup;
-	}
-
 setup_cleanup:
     // Did we encounter an error?
     if (res != HXR_OK)
@@ -3996,6 +3985,30 @@
     return res;
 }

+HX_RESULT CSDKSession::ValidateLicense()
+{
+    realstring sLicensedir = "";
+    HX_RESULT res = HXR_OK;
+
+    res = m_spFactory->CreateInstance(IID_IHXTLicenseManager,
m_spLicenseManager.AdoptVoid());
+
+    m_appprefs.GetStringSetting( kszPathsElement, kszLicenseDir,
sLicensedir);
+    if(sLicensedir.length())
+    {
+	m_spLicenseManager->SetLicenseFileDirectory(sLicensedir.c_str());
+    }
+
+    UCHAR* pMachineID = m_spLicenseManager->GetMachineID();
+    res = m_spLicenseManager->PerformLicenseValidation();
+
+    if (res != HXR_OK)
+    {
+	HX_ASSERT(FALSE);
+        printf("\nYour Licence file is invalid. Your machine ID is
\"%s\". Please use this machine ID to obtain a valid license
file.\n",pMachineID);
+    }
+
+    return res;
+}

 HX_RESULT CSDKSession::GetFactory( IHXCommonClassFactory **ppClassFactory )
 {
Index: session.h
===================================================================
RCS file: /cvsroot/producerapps/cmdproducer/session.h,v
retrieving revision 1.28
diff -u -r1.28 session.h
--- session.h	22 May 2009 10:46:37 -0000	1.28
+++ session.h	27 Jun 2009 06:38:46 -0000
@@ -254,6 +254,8 @@
     HX_RESULT FindFileObserver(IHXTFileObserver** ppObserver);
     void      SubscribeFileObserver(HXBOOL bSubscribe);

+    HX_RESULT ValidateLicense();
+
 #ifdef PRODUCER_BASIC_BUILD
     HX_RESULT checkVideoCodec(IHXTAudiencePtr& spAudDef);
 #endif //#ifndef PRODUCER_BASIC_BUILD
@@ -361,7 +363,8 @@
     };

 	eBroadcastType m_eBroadcastType;
-
+
+    IHXTLicenseManagerPtr m_spLicenseManager;
 };

Index: hxtpreferenceshandler.cpp
===================================================================
RCS file: /cvsroot/producerapps/common/util/hxtpreferenceshandler.cpp,v
retrieving revision 1.11
diff -u -r1.11 hxtpreferenceshandler.cpp
--- hxtpreferenceshandler.cpp	6 May 2004 21:55:49 -0000	1.11
+++ hxtpreferenceshandler.cpp	27 Jun 2009 06:39:27 -0000
@@ -687,6 +687,14 @@
 			sAttrib = "%TEMP%";
 			return HXR_OK;
 		}
+		else if( 0 == strcmp(szAttribName, kszLicenseDir) )
+		{
+			sAttrib = ".";
+			sAttrib.append(HXT_PATH_SEPARATOR_STRING);
+			sAttrib.append("licenses");
+			sAttrib.append(HXT_PATH_SEPARATOR_STRING);
+			return HXR_OK;
+		}
 	}

 	if( 0 == strcmp(szPrefsSectionName, kszFileLogElement) )

Index: pub/hxtpreferenceconstants.h
===================================================================
RCS file: /cvsroot/producerapps/common/util/pub/hxtpreferenceconstants.h,v
retrieving revision 1.2
diff -u -r1.2 hxtpreferenceconstants.h
--- pub/hxtpreferenceconstants.h	10 Dec 2003 18:42:24 -0000	1.2
+++ pub/hxtpreferenceconstants.h	27 Jun 2009 06:39:27 -0000
@@ -77,6 +77,7 @@
 static const char* kszAudienceDefinitionDir = "audiences"; //string
 static const char* kszServerDefinitionDir = "servers"; //string
 static const char* kszTempDir = "tempDir"; //string
+static const char* kszLicenseDir = "licenseDir"; //string

 //filelog
 static const char* kszDisable = "disable"; //BOOL
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.