File agentPluginsDir = new File(serverPluginsDir.getParentFile(), "agentplugins");
agentPluginsDir.mkdirs();
File antBundlePlugin = new File(System.getProperty("rhq.ant-bundle.serverplugin.path"));
PluginDeploymentScannerMBean scanner = LookupUtil.getPluginDeploymentScanner();
//needed by server plugin lifecycle
prepareScheduler();
File targetFile = new File(serverPluginsDir, antBundlePlugin.getName());
//touch the file so that the plugin scanner picks it up again
targetFile.setLastModified(System.currentTimeMillis());
FileUtil.copyFile(antBundlePlugin, targetFile);
scanner.setAgentPluginDir(agentPluginsDir.getAbsolutePath());
scanner.setServerPluginDir(serverPluginsDir.getAbsolutePath());
//actually, this is resetting the plugin service to the real thing, because we need to deploy the
//real ant bundle server plugin
prepareCustomServerPluginService(ps);
// resourceManager = LookupUtil.getResourceManager();