diff -r f5050f1da672 -r 04becd199f91 javaruntimes/jvmargmodifier/file/src/jvmargsmodifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/javaruntimes/jvmargmodifier/file/src/jvmargsmodifier.cpp Tue Apr 27 16:30:29 2010 +0300 @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A default empty implementation for JvmArgs modifier. +* +*/ + +#include + +#include "jvmargsmodifier.h" +#include "logger.h" + +#include "jvmargsfilereader.h" +#include "argsmodifier.h" + +#ifdef __SYMBIAN32__ +#include +_LIT(KArgsTxt, "Note! Modified VM arguments used!"); +#endif + +void logArguments(std::wstring aArg) +{ + WLOG1(EJavaRuntime, " '%S'", aArg.c_str()); +} + +#ifdef __SYMBIAN32__ +void showWarningDialogL() +{ + ::CAknGlobalNote* globalNote = CAknGlobalNote::NewL(); + CleanupStack::PushL(globalNote); + globalNote->ShowNoteL(EAknGlobalInformationNote, KArgsTxt); + CleanupStack::PopAndDestroy(globalNote); +} +#endif + + +OS_EXPORT +void java::runtime::modifyJvmArguments(const std::wstring& aIdentifier, + std::list& aJvmArgs, + std::list& aApplicationAndArgs) +{ + JELOG2(EJavaRuntime); + +#ifdef __SYMBIAN32__ + // Open the extension directory of the J9 VM. + aJvmArgs.push_back(L"-Dcom.ibm.j9.ext.dirs=c:\\resource\\java\\jvm\\lib\\common;z:\\resource\\java\\jvm\\lib\\common"); +#endif + + JvmArgsFileReader reader(aIdentifier); + JvmArgsModifier modifier; + std::list newJvmArgs = reader.getJvmArguments(); + std::list newAppArgs = reader.getApplicationArguments(); + + modifier.combineArguments(aJvmArgs, newJvmArgs); + modifier.combineArguments(aApplicationAndArgs, newAppArgs); + + if (newJvmArgs.size() != 0 || newAppArgs.size() != 0) + { + WLOG(EJavaRuntime, "new JVM arguments"); + std::for_each(aJvmArgs.begin(), aJvmArgs.end(), logArguments); + WLOG(EJavaRuntime, "new App arguments"); + std::for_each(aApplicationAndArgs.begin(), aApplicationAndArgs.end(), logArguments); +#ifdef __SYMBIAN32__ + TRAP_IGNORE(showWarningDialogL()); +#endif + } +} +