<commit_before>/**
 *  Copyright (c) 2012, 2016 Sme.UP and others.
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 *
 *
 * Contributors:
 *   <NAME> - Initial API and implementation
 */
package org.smeup.sys.os.core.base.api;

import javax.inject.Inject;

import org.smeup.sys.dk.core.annotation.Supported;
import org.smeup.sys.dk.core.annotation.ToDo;
import org.smeup.sys.il.data.QBinary;
import org.smeup.sys.il.data.QCharacter;
import org.smeup.sys.il.data.QDataStructWrapper;
import org.smeup.sys.il.data.QEnum;
import org.smeup.sys.il.data.QScroller;
import org.smeup.sys.il.data.annotation.DataDef;
import org.smeup.sys.il.data.annotation.Main;
import org.smeup.sys.il.data.annotation.Program;
import org.smeup.sys.il.data.annotation.Special;
import org.smeup.sys.il.data.def.BinaryType;
import org.smeup.sys.os.core.QSystemManager;
import org.smeup.sys.os.core.jobs.QJob;
import org.smeup.sys.rt.core.QApplicationManager;
import org.smeup.sys.rt.repo.QRepositoryManager;

@Program(name = "QWCCSDSC")
public class SystemEnder {

	@Inject
	private QApplicationManager applicationManager;
	@Inject
	private QRepositoryManager repositoryManager;
	@Inject
	private QSystemManager systemManager;
	@Inject
	private QJob job;

	@Main
	public void main(@ToDo @DataDef(length = 1) QEnum<HOWTOENDEnum, QCharacter> howToEnd,
			@Supported @DataDef(binaryType = BinaryType.INTEGER) QEnum<CONTROLLEDENDDELAYTIMEEnum, QBinary> controlledEndDelayTime,
			@Supported @DataDef(length = 4) QEnum<UPGRADEEnum, QCharacter> upgrade,
			@Supported RESTARTOPTIONS restartOptions, @DataDef(length = 1) QEnum<IPLSOURCEEnum, QCharacter> iPLSource,
			@DataDef(length = 10) QCharacter imageCatalog,
			@DataDef(dimension = 3, length = 10) QScroller<QEnum<ENDSUBSYSTEMOPTIONEnum, QCharacter>> endSubsystemOption,
			@DataDef(length = 1) QEnum<TIMEOUTOPTIONEnum, QCharacter> timeoutOption,
			@DataDef(length = 10) QEnum<CONFIRMEnum, QCharacter> confirm) {

		systemManager.stop();

		switch (upgrade.asEnum()) {
		case NO:
			break;
		case YES:
			repositoryManager.updateAll(job);
			break;<commit_msg>Chiusura job attivi al pwrdwnsys<commit_after>/**
 *  Copyright (c) 2012, 2016 Sme.UP and others.
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 *
 *
 * Contributors:
 *   <NAME> - Initial API and implementation
 */
package org.smeup.sys.os.core.base.api;

import java.util.Iterator;

import javax.inject.Inject;

import org.smeup.sys.dk.core.annotation.Supported;
import org.smeup.sys.dk.core.annotation.ToDo;
import org.smeup.sys.il.data.QBinary;
import org.smeup.sys.il.data.QCharacter;
import org.smeup.sys.il.data.QDataStructWrapper;
import org.smeup.sys.il.data.QEnum;
import org.smeup.sys.il.data.QScroller;
import org.smeup.sys.il.data.annotation.DataDef;
import org.smeup.sys.il.data.annotation.Main;
import org.smeup.sys.il.data.annotation.Program;
import org.smeup.sys.il.data.annotation.Special;
import org.smeup.sys.il.data.def.BinaryType;
import org.smeup.sys.os.core.QSystemManager;
import org.smeup.sys.os.core.jobs.QJob;
import org.smeup.sys.os.core.jobs.QJobManager;
import org.smeup.sys.rt.core.QApplicationManager;
import org.smeup.sys.rt.repo.QRepositoryManager;

@Program(name = "QWCCSDSC")
public class SystemEnder {

	@Inject
	private QApplicationManager applicationManager;
	@Inject
	private QRepositoryManager repositoryManager;
	@Inject
	private QSystemManager systemManager;
	@Inject
	private QJob job;
	@Inject
	private QJobManager jobManager;

	@Main
	public void main(@ToDo @DataDef(length = 1) QEnum<HOWTOENDEnum, QCharacter> howToEnd,
			@Supported @DataDef(binaryType = BinaryType.INTEGER) QEnum<CONTROLLEDENDDELAYTIMEEnum, QBinary> controlledEndDelayTime,
			@Supported @DataDef(length = 4) QEnum<UPGRADEEnum, QCharacter> upgrade,
			@Supported RESTARTOPTIONS restartOptions, @DataDef(length = 1) QEnum<IPLSOURCEEnum, QCharacter> iPLSource,
			@DataDef(length = 10) QCharacter imageCatalog,
			@DataDef(dimension = 3, length = 10) QScroller<QEnum<ENDSUBSYSTEMOPTIONEnum, QCharacter>> endSubsystemOption,
			@DataDef(length = 1) QEnum<TIMEOUTOPTIONEnum, QCharacter> timeoutOption,
			@DataDef(length = 10) QEnum<CONFIRMEnum, QCharacter> confirm) {

		systemManager.stop();

		switch (upgrade.asEnum()) {
		case NO:
			break;
		case YES:
			repositoryManager.updateAll(job);
			break;
		}
		
		// Close all active jobs
		for (QJob qJob : jobManager.getActiveJobs()) {
			jobManager.close(qJob);
{'fraction_non_alphanumeric': 0.11295681063122924, 'fraction_numerical': 0.009551495016611296, 'mean_word_length': 5.059119496855346, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5530541', 'n_tokens_mistral': 1761, 'n_tokens_neox': 1663, 'n_words': 342}