// Copyright 2012 Citrix Systems, Inc. Licensed under the
// Apache License, Version 2.0 (the "License"); you may not use this
// file except in compliance with the License. Citrix Systems, Inc.
// reserves all rights not expressly granted by 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.
//
// Automatically generated by addcopyright.py at 04/03/2012
package com.cloud.storage.listener;
import org.apache.log4j.Logger;
import com.cloud.agent.Listener;
import com.cloud.agent.api.AgentControlAnswer;
import com.cloud.agent.api.AgentControlCommand;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.StartupCommand;
import com.cloud.host.HostVO;
import com.cloud.host.Status;
public class StorageSyncListener implements Listener {
private static final Logger s_logger = Logger.getLogger(StorageSyncListener.class);
public StorageSyncListener() {
}
@Override
public boolean isRecurring() {
return false;
}
@Override
public boolean processAnswers(long agentId, long seq, Answer[] answers) {
for (Answer answer : answers) {
if (answer.getResult() == false) {
s_logger.warn("Unable to execute sync command: " + answer.toString());
} else {
s_logger.debug("Sync command executed: " + answer.toString());
}
}
return true;
}
@Override
public void processConnect(HostVO agent, StartupCommand cmd, boolean forRebalance) {
}
@Override
public boolean processDisconnect(long agentId, Status state) {
s_logger.debug("Disconnecting");
return true;
}
@Override
public boolean processCommands(long agentId, long seq, Command[] request) {
return false;
}
@Override
public AgentControlAnswer processControlCommand(long agentId, AgentControlCommand cmd) {
return null;
}
@Override
public boolean processTimeout(long agentId, long seq) {
return true;
}
@Override
public int getTimeout() {
return -1;
}
}