1 package org.xvsm.lookup;
2
3 import java.util.Properties;
4
5 import org.xvsm.core.ContainerRef;
6 import org.xvsm.core.aspect.GlobalAspect;
7 import org.xvsm.internal.exceptions.AspectNotOkException;
8 import org.xvsm.internal.exceptions.AspectRescheduleException;
9 import org.xvsm.internal.exceptions.AspectSkipException;
10 import org.xvsm.internal.exceptions.XCoreException;
11 import org.xvsm.lookup.exceptions.ContainerNotPublishedException;
12 import org.xvsm.lookup.exceptions.LookupException;
13
14 /***
15 * The purpose of this class is to unpublish a container before it gets destroyed
16 *
17 * @author Hannu-Daniel Goiss
18 */
19 public class LookupAspect extends GlobalAspect {
20 LookupManager lm;
21
22 public LookupAspect(LookupManager lm) {
23 super();
24
25 this.lm = lm;
26 }
27
28 public void preContainerDestroy(ContainerRef cref,
29 Properties contextProperties) throws AspectNotOkException,
30 AspectRescheduleException, AspectSkipException {
31
32 try {
33 if(lm.getGepublished(cref) == true) {
34 lm.unpublish(cref);
35 }
36 }
37 catch(ContainerNotPublishedException cnpe) {
38 return;
39 }
40 catch(LookupException le) {
41 throw new AspectNotOkException(le);
42 }
43 catch(XCoreException xce) {
44 throw new AspectNotOkException(xce);
45 }
46 }
47 }