modules/fxpackager/src/main/native/library/common/Messages.cpp

Print this page




  33 
  34 #include "Messages.h"
  35 #include "Platform.h"
  36 #include "Lock.h"
  37 #include "FilePath.h"
  38 #include "Helpers.h"
  39 #include "Macros.h"
  40 
  41 
  42 Messages::Messages(void) {
  43     FMessages.SetReadOnly(false);
  44     FMessages.SetValue(LIBRARY_NOT_FOUND, _T("Failed to find library."));
  45     FMessages.SetValue(FAILED_CREATING_JVM, _T("Failed to create JVM"));
  46     FMessages.SetValue(FAILED_LOCATING_JVM_ENTRY_POINT, _T("Failed to locate JNI_CreateJavaVM"));
  47     FMessages.SetValue(NO_MAIN_CLASS_SPECIFIED, _T("No main class specified"));
  48     FMessages.SetValue(METHOD_NOT_FOUND, _T("No method %s in class %s."));
  49     FMessages.SetValue(CLASS_NOT_FOUND, _T("Class %s not found."));
  50     FMessages.SetValue(ERROR_INVOKING_METHOD, _T("Error invoking method."));
  51     //FMessages.SetValue(CONFIG_FILE_NOT_FOUND, _T("Configuration file %s is not found."));
  52     //FMessages.SetValue(BUNDLED_JVM_NOT_FOUND, _T("$JAVAVMLIBRARYNAME is not found in the bundled runtime."));

  53 }
  54 
  55 Messages& Messages::GetInstance() {
  56     Lock lock;
  57     static Messages instance; // Guaranteed to be destroyed. Instantiated on first use.
  58     return instance;
  59 }
  60 
  61 Messages::~Messages(void) {
  62 }
  63 
  64 TString Messages::GetMessage(const TString Key) {
  65     TString result;
  66     FMessages.GetValue(Key, result);
  67     Macros& macros = Macros::GetInstance();
  68     result = macros.ExpandMacros(result);
  69     return result;
  70 }


  33 
  34 #include "Messages.h"
  35 #include "Platform.h"
  36 #include "Lock.h"
  37 #include "FilePath.h"
  38 #include "Helpers.h"
  39 #include "Macros.h"
  40 
  41 
  42 Messages::Messages(void) {
  43     FMessages.SetReadOnly(false);
  44     FMessages.SetValue(LIBRARY_NOT_FOUND, _T("Failed to find library."));
  45     FMessages.SetValue(FAILED_CREATING_JVM, _T("Failed to create JVM"));
  46     FMessages.SetValue(FAILED_LOCATING_JVM_ENTRY_POINT, _T("Failed to locate JNI_CreateJavaVM"));
  47     FMessages.SetValue(NO_MAIN_CLASS_SPECIFIED, _T("No main class specified"));
  48     FMessages.SetValue(METHOD_NOT_FOUND, _T("No method %s in class %s."));
  49     FMessages.SetValue(CLASS_NOT_FOUND, _T("Class %s not found."));
  50     FMessages.SetValue(ERROR_INVOKING_METHOD, _T("Error invoking method."));
  51     //FMessages.SetValue(CONFIG_FILE_NOT_FOUND, _T("Configuration file %s is not found."));
  52     //FMessages.SetValue(BUNDLED_JVM_NOT_FOUND, _T("$JAVAVMLIBRARYNAME is not found in the bundled runtime."));
  53     FMessages.SetValue(APPCDS_CACHE_FILE_NOT_FOUND, _T("Error: AppCDS cache does not exists:\n\n%s"));
  54 }
  55 
  56 Messages& Messages::GetInstance() {
  57     //Lock lock;
  58     static Messages instance; // Guaranteed to be destroyed. Instantiated on first use.
  59     return instance;
  60 }
  61 
  62 Messages::~Messages(void) {
  63 }
  64 
  65 TString Messages::GetMessage(const TString Key) {
  66     TString result;
  67     FMessages.GetValue(Key, result);
  68     Macros& macros = Macros::GetInstance();
  69     result = macros.ExpandMacros(result);
  70     return result;
  71 }