KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > aop > microcontainer > beans > IntroductionBinding


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.aop.microcontainer.beans;
23
24 import java.util.List JavaDoc;
25
26 import org.jboss.aop.AspectManager;
27 import org.jboss.aop.introduction.InterfaceIntroduction;
28 import org.jboss.util.id.GUID;
29
30 /**
31  * An AspectBinding.
32  *
33  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
34  * @version $Revision: 58323 $
35  */

36 public class IntroductionBinding
37 {
38    protected AspectManager manager;
39    
40    protected String JavaDoc name = GUID.asString();
41    
42    protected String JavaDoc classes;
43    
44    protected List JavaDoc<String JavaDoc> interfaces;
45
46    public String JavaDoc getName()
47    {
48       return name;
49    }
50
51    public void setName(String JavaDoc name)
52    {
53       this.name = name;
54    }
55
56    /**
57     * Get the classes.
58     *
59     * @return the classes.
60     */

61    public String JavaDoc getClasses()
62    {
63       return classes;
64    }
65
66    /**
67     * Set the classes.
68     *
69     * @param classes The classes to set.
70     */

71    public void setClasses(String JavaDoc classes)
72    {
73       this.classes = classes;
74    }
75
76    /**
77     * Get the interfaces.
78     *
79     * @return the interfaces.
80     */

81    public List JavaDoc getInterfaces()
82    {
83       return interfaces;
84    }
85
86    /**
87     * Set the interfaces.
88     *
89     * @param interfaces The interfaces to set.
90     */

91    public void setInterfaces(List JavaDoc<String JavaDoc> interfaces)
92    {
93       this.interfaces = interfaces;
94    }
95
96    /**
97     * Get the manager.
98     *
99     * @return the manager.
100     */

101    public AspectManager getManager()
102    {
103       return manager;
104    }
105
106    /**
107     * Set the manager.
108     *
109     * @param manager The manager to set.
110     */

111    public void setManager(AspectManager manager)
112    {
113       this.manager = manager;
114    }
115
116    public void start() throws Exception JavaDoc
117    {
118       if (manager == null)
119          throw new IllegalArgumentException JavaDoc("Null manager");
120       if (classes == null)
121          throw new IllegalArgumentException JavaDoc("Null classes");
122       if (interfaces == null)
123          throw new IllegalArgumentException JavaDoc("Null interfaces");
124       String JavaDoc[] intfs = interfaces.toArray(new String JavaDoc[interfaces.size()]);
125       InterfaceIntroduction introduction = new InterfaceIntroduction(name, classes, intfs);
126       manager.addInterfaceIntroduction(introduction);
127    }
128    
129    public void stop() throws Exception JavaDoc
130    {
131       manager.removeInterfaceIntroduction(name);
132    }
133 }
134
Popular Tags