SecurityException,
NoSuchMethodException,
InvocationTargetException,
IllegalAccessException
{
MauiApplication retVal = null;
if (aClassName != null &&
aClassName.trim ().length () > 0)
{
//FolderInformation theFolderInformation = getFolder (aClassName);
//String theClassName = theFolderInformation.getClassName (aClassName);
//theClassName = getMauiApplicationClassName (theClassName);
//ApplicationClassWrapper theWrapper = (ApplicationClassWrapper) theFolderInformation.applications.get (theClassName);
final ApplicationClassWrapper theWrapper = getApplicationClassWrapper (aClassName);
if (theWrapper == null)
{
if (aCreateDefault)
{
String theLocation = (defaultFolder.trim ().length () == 0 ?
"" :
defaultFolder + "/");
retVal = createMauiApplication (aRequestHeader, aCheckpoint, aSession, theLocation + defaultApplicationClassName, false);
}
else
{
FolderInformation theFolderInformation = getFolder (aClassName);
String theClassName = theFolderInformation.getClassName (aClassName);
theClassName = getMauiApplicationClassName (theClassName);
throw new ClassNotFoundException (theClassName);
}
}
else
{
I_ApplicationInitializer theInitializer = new I_ApplicationInitializer ()
{
public void initializeApplication (MauiApplication aMauiApplication)
{
theWrapper.createWorkSpace ();
ComponentManager.getInstance ().setApplication (aMauiApplication);
ApplicationSuite theApplicationSuite = theWrapper.getApplicationSuite ();
aMauiApplication.setApplicationSuiteName (theApplicationSuite.getName ());
aMauiApplication.setApplicationName (aClassName);
aMauiApplication.setChainApplicationName (aClassName);
aMauiApplication.setShortName (getShortName (aClassName));
aMauiApplication.setSession (aSession);
aMauiApplication.setFolderName (theApplicationSuite.getLocation ());
aMauiApplication.setInboundCookies (aCheckpoint);
Properties theProperties = (Properties) theWrapper.getProperties ().clone ();
aMauiApplication.setProperties (theProperties);
String theProperty = theProperties.getProperty (scm.MAUI_APPLICATION_PREAMBLE);
if (theProperty != null)
{
aMauiApplication.setPreamble (theProperty);
}
theProperty = theProperties.getProperty (scm.MAUI_APPLICATION_POSTAMBLE);
if (theProperty != null)
{
aMauiApplication.setPostamble (theProperty);
}
theProperty = theProperties.getProperty (scm.MAUI_APPLICATION_BACKGROUND_COLOR);
if (theProperty != null)
{
aMauiApplication.setBackgroundColor (theProperty);
}
theProperty = theProperties.getProperty (scm.MAUI_APPLICATION_BACKGROUND_IMAGE);
if (theProperty != null)
{
aMauiApplication.setBackgroundImage (theProperty);
}
aMauiApplication.setDesktop (MDesktop.getInstance ());
aMauiApplication.initialize (aRequestHeader);
}
};
if ((retVal = doAuthorizationCheck (aSession, theInitializer)) == null)
{
retVal = theWrapper.instantiateApplication (theInitializer);
}
try
{
if (isOutOfDate (retVal))
{
retVal = createMauiApplication (aRequestHeader,
aCheckpoint,
aSession,
aClassName,
aCreateDefault);
}
}
catch (IOException e)
{
}
}
}
else if (aCreateDefault)
{
//
// Create a default application
//
retVal = createMauiApplication (aRequestHeader, aCheckpoint, aSession, defaultApplicationClassName, false);
}
else
{
throw new ClassNotFoundException ((aClassName == null ? defaultApplicationClassName : aClassName));
}
if (retVal != null)
{
retVal.staticInitialize ();
if (aClassName != null && aClassName.equals (defaultApplicationClassName))
{
retVal.setDefaultApplication (true);
}
}
return retVal;
}