package com.github.aureliano.achmed.os.service;

import org.apache.log4j.Logger;

import com.github.aureliano.achmed.command.CommandFacade;
import com.github.aureliano.achmed.command.CommandResponse;
import com.github.aureliano.achmed.helper.StringHelper;

public class DebianService extends LinuxService {

	private static final Logger logger = Logger.getLogger(DebianService.class);
	private static final String SERVICE_APP = "service";
	
	public DebianService() {
		super();
	}
	
	@Override
	public CommandResponse start() {
		if (this.isRunning()) {
			logger.debug("Service " + super.properties.getName() + " is already running.");
			return null;
		}
		
		if (StringHelper.isEmpty(super.properties.getBinary())) {
			return CommandFacade.executeCommand(SERVICE_APP, super.properties.getName(), "start");
		}
		
		return super.start();
	}
	
	@Override
	public boolean isRunning() {
		if ((super.properties.getHasStatus() != null) && (super.properties.getHasStatus())) {
			CommandResponse res = CommandFacade.executeCommand(SERVICE_APP, super.properties.getName(), "status");
			return (res.getExitStatusCode() == 0);
		}
		
		return super.isRunning();
	}

	public CommandResponse enableBootstrap() {
		throw new UnsupportedOperationException("Not implemented yet.");
	}

	public CommandResponse disableBootstrap() {
		throw new UnsupportedOperationException("Not implemented yet.");
	}
}
@@ -842,32 +842,389 @@
 %09%7D%0A%09%0A%09@Override%0A
+%09public CommandResponse stop() %7B%0A%09%09if (!this.isRunning()) %7B%0A%09%09%09logger.debug(%22Service %22 + super.properties.getName() + %22 is not running.%22);%0A%09%09%09return null;%0A%09%09%7D%0A%09%09%0A%09%09if (StringHelper.isEmpty(super.properties.getBinary())) %7B%0A%09%09%09return CommandFacade.executeCommand(SERVICE_APP, super.properties.getName(), %22stop%22);%0A%09%09%7D%0A%09%09%0A%09%09return super.stop();%0A%09%7D%0A%09%0A%09@Override%0A
 %09public boolean 

Implement stop process.