001/* 002 * Copyright (c) 2015 Maxim Yunusov 003 * Licensed under the Apache License, Version 2.0 (the "License"); 004 * you may not use this file except in compliance with the License. 005 * You may obtain a copy of the License at 006 * 007 * http://www.apache.org/licenses/LICENSE-2.0 008 * 009 * Unless required by applicable law or agreed to in writing, software 010 * distributed under the License is distributed on an "AS IS" BASIS, 011 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 * See the License for the specific language governing permissions and 013 * limitations under the License. 014 */ 015 016package org.maxur.perfmodel.backend.service.impl; 017 018import org.jvnet.hk2.annotations.Service; 019import org.maxur.perfmodel.backend.service.Application; 020import org.slf4j.Logger; 021import org.slf4j.LoggerFactory; 022 023import java.io.IOException; 024 025/** 026 * This class represents Performance Model Calculator Application. 027 * It's CLI Implementation. 028 * 029 * @author myunusov 030 * @version 1.0 031 * @since <pre>30.08.2015</pre> 032 */ 033@Service 034public final class CliApplication extends Application { 035 036 private static final Logger LOGGER = LoggerFactory.getLogger(CliApplication.class); 037 038 public CliApplication() { 039 } 040 041 @Override 042 public boolean isApplicable() { 043 return true; 044 } 045 046 @Override 047 public void onStart() { 048 LOGGER.info("Press Enter to stop\n"); 049 try { 050 //noinspection ResultOfMethodCallIgnored 051 System.in.read(); 052 stop(); 053 } catch (IOException e) { 054 LOGGER.error(e.getMessage(), e); 055 } 056 } 057 058}