001/* 002 * HA-JDBC: High-Availability JDBC 003 * Copyright (C) 2012 Paul Ferraro 004 * 005 * This program is free software: you can redistribute it and/or modify 006 * it under the terms of the GNU Lesser General Public License as published by 007 * the Free Software Foundation, either version 3 of the License, or 008 * (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public License 016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 017 */ 018package net.sf.hajdbc.durability; 019 020/** 021 * @author Paul Ferraro 022 */ 023public class InvokerEventImpl extends DurabilityEventImpl implements InvokerEvent 024{ 025 private static final long serialVersionUID = -1477607646901022715L; 026 027 private final String databaseId; 028 private InvokerResult result; 029 030 /** 031 * Constructs a new InvokerEventImpl 032 * @param transactionId a transaction identifier 033 * @param phase the durability phase 034 * @param databaseId a database identifier 035 */ 036 public InvokerEventImpl(Object transactionId, Durability.Phase phase, String databaseId) 037 { 038 super(transactionId, phase); 039 040 this.databaseId = databaseId; 041 } 042 043 /** 044 * {@inheritDoc} 045 * @see net.sf.hajdbc.durability.InvokerEvent#getDatabaseId() 046 */ 047 @Override 048 public String getDatabaseId() 049 { 050 return this.databaseId; 051 } 052 053 /** 054 * {@inheritDoc} 055 * @see net.sf.hajdbc.durability.InvokerEvent#setResult(net.sf.hajdbc.durability.InvokerResult) 056 */ 057 @Override 058 public void setResult(InvokerResult result) 059 { 060 this.result = result; 061 } 062 063 /** 064 * {@inheritDoc} 065 * @see net.sf.hajdbc.durability.InvokerEvent#getResult() 066 */ 067 @Override 068 public InvokerResult getResult() 069 { 070 return this.result; 071 } 072 073 /** 074 * {@inheritDoc} 075 * @see net.sf.hajdbc.durability.DurabilityEventImpl#equals(java.lang.Object) 076 */ 077 @Override 078 public boolean equals(Object object) 079 { 080 if ((object == null) || !(object instanceof InvokerEvent)) return false; 081 082 InvokerEvent event = (InvokerEvent) object; 083 084 return super.equals(object) && this.databaseId.equals(event.getDatabaseId()); 085 } 086}