StringValidator.getInstance());
if ((appType != DeploymentConstants.EAR) &&
(appType != DeploymentConstants.EJB))
{
String msg = localStrings.getString( "admin.server.core.mbean.config.expected_application_type" );
throw new AFException( msg );
}
String clientJarLocation = null;
try
{
ConfigContext serverContext = getConfigContext(mInstanceName);
InstanceEnvironment iEnv = new InstanceEnvironment(mInstanceName);
Applications applicationsConfigBean =
(Applications) ConfigBeansFactory.getConfigBeanByXPath(
serverContext, ServerXPathHelper.XPATH_APPLICATIONS);
String appLocation = null;
switch (appType)
{
case DeploymentConstants.EAR :
J2eeApplication app = applicationsConfigBean.
getJ2eeApplicationByName(appName);
AppsManager appsManager = new AppsManager(iEnv);
appLocation = appsManager.getGeneratedXMLLocation(appName);
// for upgrade scenario, we fall back to the original
// location
if (appLocation == null ||
!FileUtils.safeIsDirectory(appLocation)) {
appLocation = app.getLocation();
}
break;
case DeploymentConstants.EJB :
EjbModule module = applicationsConfigBean.
getEjbModuleByName(appName);
EjbModulesManager ejbManager = new EjbModulesManager(iEnv);
appLocation = ejbManager.getGeneratedXMLLocation(appName);
// for upgrade scenario, we fall back to the original
// location
if (appLocation == null ||
!FileUtils.safeIsDirectory(appLocation)) {
appLocation = module.getLocation();
}
break;
}
clientJarLocation = appLocation + java.io.File.separator +
appName + AdminConstants.CLIENT_JAR;
sLogger.log(Level.INFO, "mbean.cl_jar_loc", clientJarLocation);
}
catch (Exception e)
{
throw new AFException(e.getLocalizedMessage());
}
return clientJarLocation;
}