blob: acf5f9bdcf90395d4736a3afc57b43cab8cb610b [file] [log] [blame]
/*********************************************************************
* Copyright (c) 2023 Boeing
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Boeing - initial API and implementation
**********************************************************************/
package org.eclipse.osee.ote.internal;
import java.io.IOException;
import java.util.logging.Level;
import org.eclipse.osee.framework.logging.OseeLog;
import org.eclipse.osee.ote.message.commands.ZeroizeElement;
import org.eclipse.osee.ote.message.event.OteEventMessageUtil;
import org.eclipse.osee.ote.message.interfaces.IRemoteMessageService;
import org.eclipse.osee.ote.remote.messages.SerializedZeroizeElementMessage;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventAdmin;
import org.osgi.service.event.EventHandler;
public class ZeroizeElementCommandListener implements EventHandler {
private final IRemoteMessageService messageService;
public ZeroizeElementCommandListener(EventAdmin eventAdmin, IRemoteMessageService messageService) {
this.messageService = messageService;
}
@Override
public void handleEvent(Event arg0) {
ZeroizeElement cmd;
try {
SerializedZeroizeElementMessage msg = new SerializedZeroizeElementMessage(OteEventMessageUtil.getBytes(arg0));
cmd = msg.getObject();
messageService.zeroizeElement(cmd);
} catch (IOException e) {
OseeLog.log(getClass(), Level.SEVERE, e);
} catch (ClassNotFoundException e) {
OseeLog.log(getClass(), Level.SEVERE, e);
}
}
}