/* * Copyright 2013 Pavel Stastny <pavel.stastny at gmail.com>. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.aplikator.server.processes; import java.io.File; import java.text.SimpleDateFormat; import java.util.Date; import org.aplikator.client.shared.descriptor.ProcessDTO; /** * Represents aplikator process * * @author Pavel Stastny <pavel.stastny at gmail.com> */ public interface Process { public static final SimpleDateFormat FORMAT = new SimpleDateFormat("yyyy/dd/MM hh:mm:ss"); /** * Returns identifier * * @return */ public String getIdentifier(); /** * Returns application name * * @return */ public String getApplicationName(); /** * Start process * * @param params */ public void startMe() throws CannotCallStartException; /** * Stop process */ public void stopMe() throws CannotCallStopException; /** * Returns true, if the process is alive * * @return */ public boolean isLiveProcess(); /** * Redirect standard output stream to given file * * @param f File */ public void redirectOutputStream(File f); /** * Redirect error stream to given file * * @param f File */ public void redirectErrorStream(File f); // /** * Returns process type * * @return */ public ProcessType getType(); /** * Returns process state * * @return */ public ProcessState getProcessState(); /** * Updationg internal process state * * @param value */ public void updateProcessIntrnalState(Object value); /** * Return process properties * * @return */ public ProcessPropeties getProcessProperties(); public Date getStartedDate(); public Date getStoppedDate(); /** * Creates transfer object * * @return */ public ProcessDTO toProcessDTO(); }