use of org.glassfish.api.container.Sniffer in project Payara by payara.
the class InplantedTest method Test.
@Test
public void Test() {
ServiceLocator habitat = server.getHabitat();
System.out.println("Process type is " + habitat.<ProcessEnvironment>getService(ProcessEnvironment.class).getProcessType());
for (Sniffer s : habitat.<Sniffer>getAllServices(Sniffer.class)) {
System.out.println("Got sniffer " + s.getModuleType());
}
}
use of org.glassfish.api.container.Sniffer in project Payara by payara.
the class DOLUtils method setExtensionArchivistForSubArchivist.
/**
* Sets the class for processing an archive on a subarchive
* <p>
* If there an exception occurs in this method it will be caught and logged as a warning
* @param habitat
* @param archive
* @param md
* @param app
* @param subArchivist
*/
public static void setExtensionArchivistForSubArchivist(ServiceLocator habitat, ReadableArchive archive, ModuleDescriptor md, Application app, Archivist subArchivist) {
try {
Collection<Sniffer> sniffers = getSniffersForModule(habitat, archive, md, app);
ArchivistFactory archivistFactory = habitat.getService(ArchivistFactory.class);
subArchivist.setExtensionArchivists(archivistFactory.getExtensionsArchivists(sniffers, subArchivist.getModuleType()));
} catch (Exception e) {
deplLogger.log(Level.WARNING, EXCEPTION_CAUGHT, new Object[] { e.getMessage(), e });
}
}
use of org.glassfish.api.container.Sniffer in project Payara by payara.
the class DolProvider method processDOL.
private Application processDOL(DeploymentContext dc) throws IOException {
ReadableArchive sourceArchive = dc.getSource();
sourceArchive.setExtraData(Types.class, dc.getTransientAppMetaData(Types.class.getName(), Types.class));
sourceArchive.setExtraData(Parser.class, dc.getTransientAppMetaData(Parser.class.getName(), Parser.class));
ClassLoader cl = dc.getClassLoader();
DeployCommandParameters params = dc.getCommandParameters(DeployCommandParameters.class);
sourceArchive.addArchiveMetaData(DeploymentProperties.APP_PROPS, dc.getAppProps());
sourceArchive.addArchiveMetaData(DeploymentProperties.COMMAND_PARAMS, params);
String name = params.name();
String archiveType = dc.getArchiveHandler().getArchiveType();
Archivist archivist = archivistFactory.getArchivist(archiveType, cl);
if (archivist == null) {
// an empty Application object
return Application.createApplication();
}
archivist.setAnnotationProcessingRequested(true);
String xmlValidationLevel = dasConfig.getDeployXmlValidation();
archivist.setXMLValidationLevel(xmlValidationLevel);
if (xmlValidationLevel.equals("none")) {
archivist.setXMLValidation(false);
}
archivist.setRuntimeXMLValidationLevel(xmlValidationLevel);
if (xmlValidationLevel.equals("none")) {
archivist.setRuntimeXMLValidation(false);
}
Collection<Sniffer> sniffers = dc.getTransientAppMetaData(DeploymentProperties.SNIFFERS, Collection.class);
archivist.setExtensionArchivists(archivistFactory.getExtensionsArchivists(sniffers, archivist.getModuleType()));
ApplicationHolder holder = dc.getModuleMetaData(ApplicationHolder.class);
File deploymentPlan = params.deploymentplan;
handleDeploymentPlan(deploymentPlan, archivist, sourceArchive, holder);
long start = System.currentTimeMillis();
Application application = null;
if (holder != null) {
application = holder.app;
application.setAppName(name);
application.setClassLoader(cl);
application.setRoleMapper(null);
if (application.isVirtual()) {
ModuleDescriptor md = application.getStandaloneBundleDescriptor().getModuleDescriptor();
md.setModuleName(name);
}
try {
applicationFactory.openWith(application, sourceArchive, archivist);
} catch (SAXParseException e) {
throw new IOException(e);
}
} else {
// and it's a standalone module
try {
application = applicationFactory.openArchive(name, archivist, sourceArchive, true);
application.setAppName(name);
ModuleDescriptor md = application.getStandaloneBundleDescriptor().getModuleDescriptor();
md.setModuleName(name);
} catch (SAXParseException e) {
throw new IOException(e);
}
}
application.setRegistrationName(name);
sourceArchive.removeExtraData(Types.class);
sourceArchive.removeExtraData(Parser.class);
Logger.getAnonymousLogger().log(Level.FINE, "DOL Loading time" + (System.currentTimeMillis() - start));
return application;
}
use of org.glassfish.api.container.Sniffer in project Payara by payara.
the class GetDeploymentConfigurationsCommand method execute.
/**
* Entry point from the framework into the command execution
* @param context context for the command.
*/
public void execute(AdminCommandContext context) {
final ActionReport report = context.getActionReport();
ActionReport.MessagePart part = report.getTopMessagePart();
final ApplicationInfo appInfo = appRegistry.get(appname);
if (appInfo == null) {
return;
}
try {
if (appInfo.getEngineRefs().size() > 0) {
// composite archive case, i.e. ear
for (EngineRef ref : appInfo.getEngineRefs()) {
Sniffer appSniffer = ref.getContainerInfo().getSniffer();
addToResultDDList("", appSniffer.getDeploymentConfigurations(appInfo.getSource()), part);
}
for (ModuleInfo moduleInfo : appInfo.getModuleInfos()) {
for (Sniffer moduleSniffer : moduleInfo.getSniffers()) {
ReadableArchive moduleArchive = appInfo.getSource().getSubArchive(moduleInfo.getName());
addToResultDDList(moduleInfo.getName(), moduleSniffer.getDeploymentConfigurations(moduleArchive), part);
}
}
} else {
// standalone module
for (Sniffer sniffer : appInfo.getSniffers()) {
addToResultDDList(appname, sniffer.getDeploymentConfigurations(appInfo.getSource()), part);
}
}
} catch (final IOException e) {
throw new RuntimeException(e);
}
}
use of org.glassfish.api.container.Sniffer in project Payara by payara.
the class IsSnifferUserVisibleCommand method execute.
public void execute(AdminCommandContext context) {
final ActionReport report = context.getActionReport();
ActionReport.MessagePart part = report.getTopMessagePart();
Sniffer sniffer = snifferManager.getSniffer(sniffername);
if (sniffer != null) {
String isVisible = String.valueOf(sniffer.isUserVisible());
part.addProperty(DeploymentProperties.IS_SNIFFER_USER_VISIBLE, isVisible);
part.setMessage(isVisible);
}
}
Aggregations