[Mc4j-cvs] mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/notification EmsNotification.java,1
Brought to you by:
ghinkl
From: Greg H. <gh...@us...> - 2006-04-12 19:11:40
|
Update of /cvsroot/mc4j/mc4j/modules/ems/src/ems/org/mc4j/ems/connection/bean/notification In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18666/modules/ems/src/ems/org/mc4j/ems/connection/bean/notification Added Files: EmsNotification.java EmsNotificationEvent.java EmsNotificationListener.java Log Message: Merging EMS into head for the 2.0 release work --- NEW FILE: EmsNotification.java --- /* * Copyright 2002-2004 Greg Hinkle * * 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.mc4j.ems.connection.bean.notification; import java.util.List; /** * @author Greg Hinkle (gh...@us...), Apr 4, 2005 * @version $Revision: 1.2 $($Author: ghinkl $ / $Date: 2006/04/12 19:11:34 $) */ public interface EmsNotification extends Comparable { String getName(); String getDescription(); String[] getTypes(); void addNotificationListener(EmsNotificationListener listener); boolean removeNotificationListener(EmsNotificationListener listener); void startListening(); void stopListening(); List<EmsNotificationEvent> getEvents(); boolean isListening(); } --- NEW FILE: EmsNotificationListener.java --- /* * Copyright 2002-2005 Greg Hinkle * * 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.mc4j.ems.connection.bean.notification; /** * @author Greg Hinkle (gh...@us...), Nov 10, 2005 * @version $Revision: 1.2 $($Author: ghinkl $ / $Date: 2006/04/12 19:11:34 $) */ public interface EmsNotificationListener { void handleNotification(EmsNotificationEvent event); } --- NEW FILE: EmsNotificationEvent.java --- /* * Copyright 2002-2005 Greg Hinkle * * 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.mc4j.ems.connection.bean.notification; import org.mc4j.ems.connection.bean.EmsBean; import java.util.Date; /** * @author Greg Hinkle (gh...@us...), Nov 10, 2005 * @version $Revision: 1.2 $($Author: ghinkl $ / $Date: 2006/04/12 19:11:34 $) */ public class EmsNotificationEvent { private EmsBean bean; private String message; private long sequenceNumber; private String type; private long timeStamp; private Object userData; private Object source; public EmsNotificationEvent() { } public EmsNotificationEvent(EmsBean bean, String message, long sequenceNumber, String type, long timeStamp, Object userData, Object source) { this.bean = bean; this.message = message; this.sequenceNumber = sequenceNumber; this.type = type; this.timeStamp = timeStamp; this.userData = userData; this.source = source; } public EmsBean getBean() { return bean; } public String getMessage() { return message; } public long getSequenceNumber() { return sequenceNumber; } public String getType() { return type; } public long getTimeStamp() { return timeStamp; } public Object getUserData() { return userData; } public Object getSource() { return source; } public String toString() { StringBuffer buf = new StringBuffer(); buf.append("Notification Event on bean ["); buf.append(bean.getBeanName().getCanonicalName()); buf.append("]\n\tMessage: "); buf.append(message); buf.append("\n\tSequence: "); buf.append(sequenceNumber); buf.append("\n\tType: "); buf.append(type); buf.append("\n\tTimeStamp: "); buf.append(new Date(timeStamp)); buf.append("\n\tUser Data: "); buf.append(userData); buf.append("\n\tSource: "); buf.append(source); return buf.toString(); } } |