[jboss-cvs] JBossCache/src/org/jboss/cache/pojo/notification/event ...
Jason Thomas Greene
jgreene at jboss.com
Fri Jun 29 00:34:01 EDT 2007
User: jgreene
Date: 07/06/29 00:34:01
Added: src/org/jboss/cache/pojo/notification/event
ArrayModifiedEvent.java AttachedEvent.java
DetachedEvent.java Event.java
FieldModifiedEvent.java ListModifiedEvent.java
MapModifiedEvent.java SetModifiedEvent.java
TransactionCompletedEvent.java
TransactionRegisteredEvent.java
Log:
Implement new POJO Annotation Notification API
Revision Changes Path
1.1 date: 2007/06/29 04:34:01; author: jgreene; state: Exp;JBossCache/src/org/jboss/cache/pojo/notification/event/ArrayModifiedEvent.java
Index: ArrayModifiedEvent.java
===================================================================
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.cache.pojo.notification.event;
import org.jboss.cache.pojo.notification.NotificationContext;
/**
* A notification that indicates an array was modified.
*
* @author Jason T. Greene
*/
public final class ArrayModifiedEvent extends Event
{
private final int index;
private final Object value;
public ArrayModifiedEvent(NotificationContext context, Object source, int index, Object value, boolean local)
{
super(context, source, local);
this.index = index;
this.value = value;
}
/**
* Gets the index of the change.
*
* @return the index of this change
*/
public int getIndex()
{
return index;
}
/**
* Gets the new value for this change.
*
* @return the new value.
*/
public Object getValue()
{
return value;
}
}
1.1 date: 2007/06/29 04:34:01; author: jgreene; state: Exp;JBossCache/src/org/jboss/cache/pojo/notification/event/AttachedEvent.java
Index: AttachedEvent.java
===================================================================
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.cache.pojo.notification.event;
import org.jboss.cache.pojo.notification.NotificationContext;
/**
* A notification that indicates an object was attached to the cache instance.
*
* @author Jason T. Greene
*/
public final class AttachedEvent extends Event
{
public AttachedEvent(NotificationContext context, Object source, boolean local)
{
super(context, source, local);
}
}
1.1 date: 2007/06/29 04:34:01; author: jgreene; state: Exp;JBossCache/src/org/jboss/cache/pojo/notification/event/DetachedEvent.java
Index: DetachedEvent.java
===================================================================
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.cache.pojo.notification.event;
import org.jboss.cache.pojo.notification.NotificationContext;
/**
* A notification that indicates an object was detached from the cache instance.
*
* @author Jason T. Greene
*/
public final class DetachedEvent extends Event
{
public DetachedEvent(NotificationContext context, Object source, boolean local)
{
super(context, source, local);
}
}
1.1 date: 2007/06/29 04:34:01; author: jgreene; state: Exp;JBossCache/src/org/jboss/cache/pojo/notification/event/Event.java
Index: Event.java
===================================================================
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.cache.pojo.notification.event;
import java.util.EventObject;
import org.jboss.cache.pojo.notification.NotificationContext;
/**
* Base class for all POJO Cache events.
*
* @author Jason T. Greene
*/
public abstract class Event extends EventObject
{
private final NotificationContext context;
private final boolean local;
public Event(NotificationContext context, Object source, boolean local)
{
super(source);
this.context = context;
this.local = local;
}
/**
* Determines if this event originated locally.
*
* @return true if this event originated locally, otherwise false.
*/
public boolean isLocal()
{
return local;
}
/**
* Obtain the context associated with this notification.
*
* @return the notification context
*/
public NotificationContext getContext()
{
return context;
}
}
1.1 date: 2007/06/29 04:34:01; author: jgreene; state: Exp;JBossCache/src/org/jboss/cache/pojo/notification/event/FieldModifiedEvent.java
Index: FieldModifiedEvent.java
===================================================================
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.cache.pojo.notification.event;
import java.lang.reflect.Field;
import org.jboss.cache.pojo.notification.NotificationContext;
/**
* A notification that indicates a field was changed on an attached object.
*
* @author Jason T. Greene.
*/
public final class FieldModifiedEvent extends Event
{
private final Field field;
private final Object value;
public FieldModifiedEvent(NotificationContext context, Object source, Field field, Object value, boolean local)
{
super(context, source, local);
this.field = field;
this.value = value;
}
/**
* Gets the field that was or is being modified (depending on the notification phase).
*
* @return the modified field
*/
public Field getField()
{
return field;
}
/**
* Gets the new value that this field is being set to.
*
* @return the new value
*/
public Object getValue()
{
return value;
}
}
1.1 date: 2007/06/29 04:34:01; author: jgreene; state: Exp;JBossCache/src/org/jboss/cache/pojo/notification/event/ListModifiedEvent.java
Index: ListModifiedEvent.java
===================================================================
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.cache.pojo.notification.event;
import java.util.List;
import org.jboss.cache.pojo.notification.NotificationContext;
/**
* A notification that indicates an attached List was modified.
*
* @author Jason T. Greene
*/
public final class ListModifiedEvent extends Event
{
public enum Operation {ADD, SET, REMOVE}
private final Operation operation;
private final int index;
private final Object value;
public ListModifiedEvent(NotificationContext context, List source, Operation operation, int index, Object value, boolean local)
{
super(context, source, local);
this.operation = operation;
this.index = index;
this.value = value;
}
/**
* Gets the index of the change. For an add operation this may be equal to the current size (append).
*
* @return the index of this change
*/
public int getIndex()
{
return index;
}
/**
* Gets the new value for this change. Returns null on a remove operation.
*
* @return the new value, or null if remove
*/
public Object getValue()
{
return value;
}
/**
* Gets the operation of this change.
*
* @return the operation.
*/
public Operation getOperation()
{
return operation;
}
@Override
public List getSource()
{
return (List) super.getSource();
}
}
1.1 date: 2007/06/29 04:34:01; author: jgreene; state: Exp;JBossCache/src/org/jboss/cache/pojo/notification/event/MapModifiedEvent.java
Index: MapModifiedEvent.java
===================================================================
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.cache.pojo.notification.event;
import java.util.Map;
import org.jboss.cache.pojo.notification.NotificationContext;
/**
* A notification that indicates an attached Map was modified.
*
* @author Jason T. Greene
*/
public final class MapModifiedEvent extends Event
{
public enum Operation {PUT, REMOVE}
private final Operation operation;
private final Object key;
private final Object value;
public MapModifiedEvent(NotificationContext context, Map source, Operation operation, Object key, Object value, boolean local)
{
super(context, source, local);
this.operation = operation;
this.key = key;
this.value = value;
}
/**
* Gets the operation of this change.
*
* @return the operation.
*/
public Operation getOperation()
{
return operation;
}
/**
* Gets the new value for this change. Returns null on a remove operation.
*
* @return the new value, or null if remove
*/
public Object getValue()
{
return value;
}
/**
* Gets the key for the modified entry.
*
* @return the key
*/
public Object getKey()
{
return key;
}
@Override
public Map getSource()
{
return (Map) super.getSource();
}
}
1.1 date: 2007/06/29 04:34:01; author: jgreene; state: Exp;JBossCache/src/org/jboss/cache/pojo/notification/event/SetModifiedEvent.java
Index: SetModifiedEvent.java
===================================================================
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.cache.pojo.notification.event;
import java.util.Set;
import org.jboss.cache.pojo.notification.NotificationContext;
/**
* A notification that indicates an attached Set was modified.
*
* @author Jason T. Greene
*/
public final class SetModifiedEvent extends Event
{
public enum Operation {ADD, REMOVE}
private final Operation operation;
private final Object value;
public SetModifiedEvent(NotificationContext context, Set source, Operation operation, Object value, boolean local)
{
super(context, source, local);
this.operation = operation;
this.value = value;
}
/**
* Gets the operation of this change.
*
* @return the operation.
*/
public Operation getOperation()
{
return operation;
}
/**
* Gets the new value for this change. Returns null on a remove operation.
*
* @return the new value, or null if remove
*/
public Object getValue()
{
return value;
}
@Override
public Set getSource()
{
return (Set) super.getSource();
}
}
1.1 date: 2007/06/29 04:34:01; author: jgreene; state: Exp;JBossCache/src/org/jboss/cache/pojo/notification/event/TransactionCompletedEvent.java
Index: TransactionCompletedEvent.java
===================================================================
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.cache.pojo.notification.event;
import javax.transaction.Transaction;
import org.jboss.cache.pojo.notification.NotificationContext;
/**
* A notification that indicates a transaction completed.
*
* @author Jason T. Greene
*/
public final class TransactionCompletedEvent extends Event
{
private final boolean successful;
public TransactionCompletedEvent(NotificationContext context, boolean successful, boolean local)
{
super(context, context.getTransaction(), local);
this.successful = successful;
}
@Override
public Transaction getSource()
{
return (Transaction) super.getSource();
}
/**
* Whether or not the transaction was successful.
*
* @return success boolean
*/
public boolean isSuccessful()
{
return successful;
}
}
1.1 date: 2007/06/29 04:34:01; author: jgreene; state: Exp;JBossCache/src/org/jboss/cache/pojo/notification/event/TransactionRegisteredEvent.java
Index: TransactionRegisteredEvent.java
===================================================================
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.cache.pojo.notification.event;
import javax.transaction.Transaction;
import org.jboss.cache.pojo.notification.NotificationContext;
/**
* A notification that indicates a transaction has been registered.
*
* @author Jason T. Greene
*/
public final class TransactionRegisteredEvent extends Event
{
public TransactionRegisteredEvent(NotificationContext context, boolean local)
{
super(context, context.getTransaction(), local);
}
@Override
public Transaction getSource()
{
return (Transaction) super.getSource();
}
}
More information about the jboss-cvs-commits
mailing list