01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.php
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package edu.iu.uis.eden.messaging.objectremoting;
18:
19: import javax.transaction.Synchronization;
20: import javax.xml.namespace.QName;
21:
22: import org.apache.log4j.Logger;
23: import org.kuali.rice.resourceloader.GlobalResourceLoader;
24:
25: /**
26: * {@link Synchronization} to cleanup any remote objects created during the
27: * current transaction.
28: *
29: * @author Kuali Rice Team (kuali-rice@googlegroups.com)
30: */
31: public class RemoteObjectCleanup implements Synchronization {
32:
33: private static final Logger LOG = Logger
34: .getLogger(RemoteObjectCleanup.class);
35:
36: private QName objectRemoterName;
37:
38: private QName serviceToRemove;
39:
40: public RemoteObjectCleanup(QName objectRemoterName,
41: QName serviceToRemove) {
42: this .setObjectRemoterName(objectRemoterName);
43: this .setServiceToRemove(serviceToRemove);
44: }
45:
46: public void afterCompletion(int status) {
47: LOG
48: .debug("Removing service: " + this .getServiceToRemove()
49: + " from ObjectRemoter: "
50: + this .getObjectRemoterName());
51: ObjectRemoterService objectRemoter = (ObjectRemoterService) GlobalResourceLoader
52: .getService(this .getObjectRemoterName());
53: objectRemoter.removeService(this .getServiceToRemove());
54: }
55:
56: public void beforeCompletion() {
57: // template method
58: }
59:
60: public QName getObjectRemoterName() {
61: return this .objectRemoterName;
62: }
63:
64: public void setObjectRemoterName(QName objectRemoterName) {
65: this .objectRemoterName = objectRemoterName;
66: }
67:
68: public QName getServiceToRemove() {
69: return this .serviceToRemove;
70: }
71:
72: public void setServiceToRemove(QName serviceToRemove) {
73: this.serviceToRemove = serviceToRemove;
74: }
75: }
|