本文整理匯總了Java中de.cinovo.cloudconductor.api.model.AgentOptions類的典型用法代碼示例。如果您正苦於以下問題:Java AgentOptions類的具體用法?Java AgentOptions怎麽用?Java AgentOptions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AgentOptions類屬於de.cinovo.cloudconductor.api.model包,在下文中一共展示了AgentOptions類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: run
import de.cinovo.cloudconductor.api.model.AgentOptions; //導入依賴的package包/類
@Override
public void run() {
HeartBeatJob.LOGGER.info("Starting HeartBeatJob");
AgentOptions newOptions;
try {
newOptions = ServerCom.heartBeat();
} catch (CloudConductorException e) {
HeartBeatJob.LOGGER.error("Couldn't retrieve ssh keys from server.", e);
return;
}
new OptionHandler(newOptions).run();
HeartBeatJob.LOGGER.info("Finished HeartBeatJob");
}
示例2: OptionHandler
import de.cinovo.cloudconductor.api.model.AgentOptions; //導入依賴的package包/類
/**
* @param newOptions the new options to use
*/
public OptionHandler(AgentOptions newOptions) {
this.newOptions = newOptions;
}
示例3: run
import de.cinovo.cloudconductor.api.model.AgentOptions; //導入依賴的package包/類
/**
*/
public void run() {
OptionHandler.LOGGER.info("Starting OptionHandler");
AgentOptions oldOptions = AgentState.getOptions();
AgentState.setOptions(this.newOptions);
// option timer
if ((oldOptions == null) || (this.newOptions.getAliveTimer() != oldOptions.getAliveTimer()) || (this.newOptions.getAliveTimerUnit() != oldOptions.getAliveTimerUnit())) {
OptionHandler.LOGGER.debug("Reseting OPTIONTIMER TO " + this.newOptions.getAliveTimer() + ":" + this.newOptions.getAliveTimerUnit());
SchedulerService.instance.resetTask(HeartBeatJob.JOB_NAME, this.newOptions.getAliveTimer(), this.newOptions.getAliveTimerUnit());
}
// SSH KEYS
switch (this.newOptions.getDoSshKeys()) {
case OFF:
OptionHandler.LOGGER.debug("OptionHandler: STOP SHH KEY");
SchedulerService.instance.stop(AuthorizedKeysJob.JOB_NAME);
break;
case ONCE:
OptionHandler.LOGGER.debug("OptionHandler: ONCE SHH KEY");
SchedulerService.instance.stop(AuthorizedKeysJob.JOB_NAME);
SchedulerService.instance.executeOnce(AuthorizedKeysJob.JOB_NAME);
break;
case REPEAT:
if ((oldOptions == null) || (this.newOptions.getSshKeysTimer() != oldOptions.getSshKeysTimer()) || (this.newOptions.getSshKeysTimerUnit() != oldOptions.getSshKeysTimerUnit())) {
OptionHandler.LOGGER.debug("OptionHandler: REPEAT SHH KEY");
SchedulerService.instance.resetTask(AuthorizedKeysJob.JOB_NAME, this.newOptions.getSshKeysTimer(), this.newOptions.getSshKeysTimerUnit());
}
break;
}
// FILE MANAGEMENT
switch (this.newOptions.getDoFileManagement()) {
case OFF:
OptionHandler.LOGGER.debug("OptionHandler: STOP FILE MNGMENT");
SchedulerService.instance.stop(DirectoriesJob.JOB_NAME);
SchedulerService.instance.stop(FilesJob.JOB_NAME);
break;
case ONCE:
OptionHandler.LOGGER.debug("OptionHandler: ONCE FILE MNGMENT");
SchedulerService.instance.stop(FilesJob.JOB_NAME);
SchedulerService.instance.stop(DirectoriesJob.JOB_NAME);
SchedulerService.instance.executeOnce(FilesJob.JOB_NAME);
SchedulerService.instance.executeOnce(DirectoriesJob.JOB_NAME);
break;
case REPEAT:
if ((oldOptions == null) || (this.newOptions.getFileManagementTimer() != oldOptions.getFileManagementTimer()) || (this.newOptions.getFileManagementTimerUnit() != oldOptions.getFileManagementTimerUnit())) {
OptionHandler.LOGGER.debug("OptionHandler: REPEATE FILE MNGMENT");
SchedulerService.instance.resetTask(FilesJob.JOB_NAME, this.newOptions.getFileManagementTimer(), this.newOptions.getFileManagementTimerUnit());
SchedulerService.instance.resetTask(DirectoriesJob.JOB_NAME, this.newOptions.getFileManagementTimer(), this.newOptions.getFileManagementTimerUnit());
}
break;
}
// PACKAGE MANAGEMENT
switch (this.newOptions.getDoPackageManagement()) {
case OFF:
OptionHandler.LOGGER.debug("OptionHandler: STOP PKG MNGMENT");
SchedulerService.instance.stop(DefaultJob.JOB_NAME);
break;
case ONCE:
OptionHandler.LOGGER.debug("OptionHandler: ONCE PKG MNGMENT");
SchedulerService.instance.stop(DefaultJob.JOB_NAME);
SchedulerService.instance.executeOnce(DefaultJob.JOB_NAME);
break;
case REPEAT:
if ((oldOptions == null) || (this.newOptions.getPackageManagementTimer() != oldOptions.getPackageManagementTimer()) || (this.newOptions.getPackageManagementTimerUnit().equals(oldOptions.getPackageManagementTimerUnit()))) {
OptionHandler.LOGGER.debug("OptionHandler: REPEATE PKG MNGMENT");
SchedulerService.instance.resetTask(DefaultJob.JOB_NAME, this.newOptions.getPackageManagementTimer(), this.newOptions.getPackageManagementTimerUnit());
}
break;
}
OptionHandler.LOGGER.debug("Finished OptionHandler");
}
示例4: getOptions
import de.cinovo.cloudconductor.api.model.AgentOptions; //導入依賴的package包/類
/**
* @return the options
*/
public static AgentOptions getOptions() {
return AgentState.options;
}
示例5: setOptions
import de.cinovo.cloudconductor.api.model.AgentOptions; //導入依賴的package包/類
/**
* @param options the options to set
*/
public static void setOptions(AgentOptions options) {
AgentState.options = options;
AgentState.info().updateTemplate(options.getTemplateName());
AgentState.info().updateUuid(options.getUuid());
}
示例6: heartBeat
import de.cinovo.cloudconductor.api.model.AgentOptions; //導入依賴的package包/類
@Override
@Transactional
public AgentOptions heartBeat(String tname, String hname, String agentN, String huuid) {
RESTAssert.assertNotEmpty(hname);
RESTAssert.assertNotEmpty(tname);
RESTAssert.assertNotEmpty(agentN);
RESTAssert.assertNotEmpty(huuid);
EAgent agent = this.dAgent.findAgentByName(agentN);
if (agent == null) {
agent = this.createNewAgent(agentN, null);
}
EHost host = this.dhost.findByUuid(huuid);
if(host == null){
host = this.createNewHost(hname, this.dtemplate.findByName(tname));
}
if(host == null){
host = this.createNewHost(hname, this.dtemplate.findByName(tname));
String uuid = UUID.randomUUID().toString();
host.setUuid(uuid);
}
DateTime now = new DateTime();
host.setLastSeen(now.getMillis());
host.setAgent(agent);
host = this.dhost.save(host);
EAgentOption options = this.dagentoptions.findByTemplate(host.getTemplate());
if (options == null) {
options = new EAgentOption();
options.setTemplate(host.getTemplate());
options = this.dagentoptions.save(options);
}
AgentOptions result = MAConverter.fromModel(options);
result.setTemplateName(host.getTemplate().getName());
boolean onceExecuted = false;
if (options.getDoSshKeys() == TaskState.ONCE) {
if (host.getExecutedSSH()) {
result.setDoSshKeys(TaskState.OFF);
} else {
onceExecuted = true;
host.setExecutedSSH(true);
}
}
if (options.getDoPackageManagement() == TaskState.ONCE) {
if (host.getExecutedPkg()) {
result.setDoPackageManagement(TaskState.OFF);
} else {
onceExecuted = true;
host.setExecutedPkg(true);
}
}
if (options.getDoFileManagement() == TaskState.ONCE) {
if (host.getExecutedFiles()) {
result.setDoFileManagement(TaskState.OFF);
} else {
onceExecuted = true;
host.setExecutedFiles(true);
}
}
if (onceExecuted) {
this.dhost.save(host);
}
result.setUuid(host.getUuid());
return result;
}
示例7: heartBeat
import de.cinovo.cloudconductor.api.model.AgentOptions; //導入依賴的package包/類
/**
* @param template the template name
* @param host the host name
* @param agent the agent name
* @return the current agent options
*/
@GET
@Path(IRestPath.AGENT_HEART_BEAT)
@Produces(MediaType.APPLICATION_JSON)
public AgentOptions heartBeat(@PathParam(IRestPath.VAR_TEMPLATE) String template, @PathParam(IRestPath.VAR_HOST) String host, @PathParam(IRestPath.VAR_AGENT) String agent, @PathParam(IRestPath.VAR_UUID) String uuid);