View Javadoc

1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.om.profile.psml;
18  
19  
20  // Java imports
21  import java.util.Vector;
22  import java.util.Iterator;
23  
24  // Jetspeed imports
25  import org.apache.jetspeed.om.SecurityReference;
26  import org.apache.jetspeed.om.profile.*;
27  import org.apache.jetspeed.services.PortalToolkit;
28  import org.apache.jetspeed.om.profile.Portlets;
29  
30  
31  /***
32   * Base simple bean-like implementation of the Portlets interface
33   * suitable for Castor XML serialization.
34   *
35   * sure wish I could figure out how to use Proxies with Castor...
36   * 
37   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
38   * @version $Id: PsmlReference.java,v 1.5 2004/02/23 03:02:54 jford Exp $
39   */
40  public class PsmlReference extends PsmlPortlets implements Reference, java.io.Serializable                                                
41  {
42      protected String path;
43  
44      protected PsmlPortlets ref = new PsmlPortlets();
45  
46      /*** Holds value of property securityRef. */
47      private SecurityReference securityRef;
48      
49      public Portlets getPortletsReference()
50      {
51          return ref;
52      }
53  
54      public void setPath(String path)
55      {
56          this.path = path;
57          PsmlPortlets tempRef = (PsmlPortlets)PortalToolkit.getReference(path);
58          if(tempRef != null)
59          {
60              ref = tempRef;
61          }
62      }
63  
64      public String getPath()
65      {
66          return this.path;
67      }
68  
69      public PsmlReference()
70      {
71          super();
72      }
73  
74      public Controller getController()
75      {
76          return ref.getController();
77      }
78  
79      public void setController(Controller controller)
80      {
81          ref.setController(controller);       
82      }
83  
84      public void setSecurity(Security security)
85      {
86          ref.setSecurity(security);
87      }
88   
89      public Security getSecurity()
90      {
91          return ref.getSecurity();
92      }
93  
94      public Vector getEntries()
95      {
96          return ref.getEntries();
97      }
98  
99      public void setEntries(Vector entries)
100     {
101         ref.setEntries(entries);
102     }
103 
104     public Vector getPortlets()
105     {
106         return ref.getPortlets();
107     }
108 
109     public void setPortlets(Vector portlets)
110     {
111         ref.setPortlets(portlets);
112     }
113 
114     public int getEntryCount()
115     {
116         return ref.getEntryCount();
117     }
118 
119     public int getPortletsCount()
120     {
121         return ref.getPortletsCount();
122     }
123 
124     public Entry removeEntry(int index)
125     {
126         return ref.removeEntry(index);
127     } 
128 
129     public Portlets removePortlets(int index)
130     {
131         return ref.removePortlets(index);
132     } 
133 
134     public Entry getEntry(int index)
135         throws java.lang.IndexOutOfBoundsException
136     {
137         return ref.getEntry(index);
138     } 
139 
140     public Portlets getPortlets(int index)
141         throws java.lang.IndexOutOfBoundsException
142     {
143         return ref.getPortlets(index);
144     } 
145 
146 
147     public Iterator getEntriesIterator()
148     {
149         return ref.getEntriesIterator();
150     }
151 
152     public Iterator getPortletsIterator()
153     {
154         return ref.getPortletsIterator();
155     }
156 
157     public void addEntry(Entry entry)
158         throws java.lang.IndexOutOfBoundsException
159     {
160         ref.addEntry(entry);
161     } 
162 
163     public void addPortlets(Portlets p)
164         throws java.lang.IndexOutOfBoundsException
165     {
166         ref.addPortlets(p);
167     } 
168 
169     public Entry[] getEntriesArray()
170     {
171         return ref.getEntriesArray();
172     }
173 
174     public Portlets[] getPortletsArray()
175     {
176         return ref.getPortletsArray();
177     }
178 
179     //////////////////////////////////////////////////////////////////////////
180 
181     public Control getControl()
182     {
183         return ref.getControl();
184     }
185 
186     public void setControl(Control control)
187     {
188         ref.setControl(control);
189     }
190 
191 
192     // Castor serialization methods
193     
194     /*** Required by Castor 0.8.11 XML serialization for retrieving the metainfo
195       */
196     public MetaInfo getMetaInfo()
197     {
198         MetaInfo info = super.getMetaInfo();
199         if (info == null)
200         {
201             info = ref.getMetaInfo();
202         }        
203         return info;
204     }
205                                 
206 // helper getter setters into meta info
207 
208     /*** @see org.apache.jetspeed.om.registry.MetaInfo#getTitle */
209     public String getTitle()
210     {
211         return ref.getTitle();
212     }
213                                 
214     /*** @see org.apache.jetspeed.om.registry.MetaInfo#setTitle */
215     public void setTitle(String title)
216     {
217         ref.setTitle(title);
218     }
219 
220     /*** @see org.apache.jetspeed.om.registry.MetaInfo#getDescription */
221     public String getDescription()
222     {
223         return ref.getDescription();
224     }
225                                 
226     /*** @see org.apache.jetspeed.om.registry.MetaInfo#setDescription */
227     public void setDescription(String description)
228     {
229         ref.setDescription(description);
230     }
231 
232     /*** @see org.apache.jetspeed.om.registry.MetaInfo#getImage */
233     public String getImage()
234     {
235         return ref.getImage();
236     }
237                                 
238     /*** @see org.apache.jetspeed.om.registry.MetaInfo#setImage */
239     public void setImage(String image)
240     {
241         ref.setImage(image);
242     }
243 
244     /////////////////////////////////////////////////////////////////////////
245 
246    /*** @return the parameters */
247     public Vector getParameters()
248     {
249         return ref.getParameters();
250     }
251                                 
252     /*** Sets the parameters for this element
253      * @param parameters 
254      */
255     public void setParameters(Vector parameters)
256     {
257         ref.setParameters(parameters);
258     }
259 
260     public String getParameterValue(String name)
261     {
262         return ref.getParameterValue(name);
263     }
264 
265     public Parameter getParameter(String name)
266     {
267         return ref.getParameter(name);
268     }
269 
270     public Iterator getParameterIterator()
271     {
272         return ref.getParameterIterator();
273     }
274 
275     public Parameter getParameter(int index)
276         throws java.lang.IndexOutOfBoundsException
277     {
278         return ref.getParameter(index);
279     } 
280 
281     public int getParameterCount()
282     {
283         return ref.getParameterCount();
284     } 
285 
286     public int getReferenceCount()
287     {
288         return ref.getReferenceCount();
289     }
290 
291     public void removeAllParameter()
292     {
293         ref.removeAllParameter();
294     } 
295 
296     public Parameter removeParameter(int index)
297     {
298         return ref.removeParameter(index);
299     } 
300 
301     public void setParameter(int index, Parameter vParameter)
302         throws java.lang.IndexOutOfBoundsException
303     {
304         ref.setParameter(index,vParameter);
305     } 
306 
307     public Parameter[] getParameter()
308     {
309         return ref.getParameter();
310     } 
311 
312     public void addParameter(Parameter vParameter)
313         throws java.lang.IndexOutOfBoundsException
314     {
315         ref.addParameter(vParameter);
316     } 
317 
318     public Reference getReference(int index)
319         throws java.lang.IndexOutOfBoundsException
320     {
321         return ref.getReference(index);
322     }
323 
324     public Reference removeReference(int index)
325     {
326         return ref.removeReference(index);
327     }
328 
329     public Iterator getReferenceIterator()
330     {
331         return ref.getReferenceIterator();
332     }
333 
334     public void addReference(Reference ref)
335         throws java.lang.IndexOutOfBoundsException
336     {
337         ref.addReference(ref);
338     }
339 
340     public Reference[] getReferenceArray()
341     {
342         return ref.getReferenceArray();
343     }
344 
345     /*** Getter for property securityRef.
346      * @return Value of property securityRef.
347      */
348     public SecurityReference getSecurityRef()
349     {
350         return securityRef;
351     }    
352 
353     /*** Setter for property securityRef.
354      * @param securityRef New value of property securityRef.
355      */
356     public void setSecurityRef(SecurityReference securityRef)
357     {
358         this.securityRef = securityRef;
359     }    
360 
361     /***
362      * Create a clone of this object
363      */
364     public Object clone()
365         throws java.lang.CloneNotSupportedException
366     {
367         Object cloned = super.clone();
368 
369         ((PsmlReference)cloned).ref = ((this.ref == null) ? null : (PsmlPortlets) this.ref.clone());
370         ((PsmlReference)cloned).securityRef = ((this.securityRef == null) ? null : (SecurityReference) this.securityRef.clone());
371 
372         return cloned;
373 
374     }   // clone
375 
376 }
377