use of com.enonic.xp.app.Application in project xp by enonic.
the class ApplicationServiceImpl method doInstallGlobalApplication.
private Application doInstallGlobalApplication(final ByteSource byteSource) {
final ApplicationKey applicationKey = getApplicationKey(byteSource);
if (!appFilterService.accept(applicationKey)) {
throw new ApplicationInstallException(String.format("Application %s is not permitted on this instance", applicationKey));
}
final Application application = installOrUpdateApplication(byteSource, applicationKey, false, true);
LOG.info("Global Application [{}] installed successfully", applicationKey);
doPublishInstalledEvent(applicationKey);
doStartApplication(applicationKey, true, false);
return application;
}
use of com.enonic.xp.app.Application in project xp by enonic.
the class ApplicationServiceImpl method installGlobalApplication.
@Override
public Application installGlobalApplication(final URL url, final byte[] sha512) {
return ApplicationHelper.callWithContext(() -> {
final Application application = doInstallGlobalApplication(applicationLoader.load(url, sha512));
applicationAuditLogSupport.installApplication(application.getKey(), url);
return application;
});
}
use of com.enonic.xp.app.Application in project xp by enonic.
the class ApplicationServiceImpl method doInstallStoredApplications.
private void doInstallStoredApplications(final ApplicationInstallationParams params) {
LOG.info("Searching for installed applications");
final Nodes applicationNodes = repoService.getApplications();
LOG.info("Found [" + applicationNodes.getSize() + "] installed applications");
for (final Node applicationNode : applicationNodes) {
try {
final Application application = doInstallStoredApplication(applicationNode.id());
if (application == null) {
continue;
}
final ApplicationKey applicationKey = application.getKey();
LOG.info("Stored application [{}] installed successfully", applicationKey);
if (params.isTriggerEvent()) {
doPublishInstalledEvent(applicationNode);
}
if (params.isStart() && storedApplicationIsStarted(applicationNode)) {
doStartApplication(applicationKey, params.isTriggerEvent(), false);
}
} catch (Exception e) {
LOG.error("Cannot install application [{}]", applicationNode.name(), e);
}
}
}
use of com.enonic.xp.app.Application in project xp by enonic.
the class ApplicationServiceImpl method doInstallStoredApplication.
private Application doInstallStoredApplication(final NodeId nodeId, final ApplicationInstallationParams params) {
final Application application = doInstallStoredApplication(nodeId);
if (application == null) {
return null;
}
final ApplicationKey applicationKey = application.getKey();
LOG.info("Stored application [{}] installed successfully", applicationKey);
if (params.isTriggerEvent()) {
doPublishInstalledEvent(applicationKey);
}
if (params.isStart()) {
doStartApplication(applicationKey, params.isTriggerEvent(), false);
}
return application;
}
use of com.enonic.xp.app.Application in project xp by enonic.
the class ApplicationClusterEventListenerTest method uninstall.
@Test
void uninstall() {
final Application application = mock(Application.class);
final ApplicationKey appKey = ApplicationKey.from("appKey");
when(application.getKey()).thenReturn(appKey);
this.applicationClusterEventListener.onEvent(Event.create(ApplicationClusterEvents.EVENT_TYPE).localOrigin(false).value(ApplicationClusterEvents.EVENT_TYPE_KEY, ApplicationClusterEvents.UNINSTALL).value(ApplicationClusterEvents.APPLICATION_KEY_PARAM, appKey).build());
verify(this.applicationService, times(1)).uninstallApplication(appKey, false);
}
Aggregations