KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > java > plugin > registry > xml > PluginElementImpl


1 /*****************************************************************************
2  * Java Plug-in Framework (JPF)
3  * Copyright (C) 2004-2005 Dmitry Olshansky
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *****************************************************************************/

19 package org.java.plugin.registry.xml;
20
21 import org.java.plugin.registry.Documentation;
22 import org.java.plugin.registry.Identity;
23 import org.java.plugin.registry.ManifestProcessingException;
24 import org.java.plugin.registry.PluginDescriptor;
25 import org.java.plugin.registry.PluginElement;
26 import org.java.plugin.registry.PluginFragment;
27
28 /**
29  * @version $Id: PluginElementImpl.java,v 1.3 2005/11/23 18:25:35 ddimon Exp $
30  */

31 abstract class PluginElementImpl extends IdentityImpl implements PluginElement {
32     private final PluginDescriptor descriptor;
33     private final PluginFragment fragment;
34     private DocumentationImpl doc;
35
36     protected PluginElementImpl(final PluginDescriptor descr,
37             final PluginFragment aFragment, final String JavaDoc id,
38             final ModelDocumentation modelDoc)
39             throws ManifestProcessingException {
40         super(id);
41         descriptor = descr;
42         fragment = aFragment;
43         if (modelDoc != null) {
44             doc = new DocumentationImpl(this, modelDoc);
45         }
46     }
47
48     /**
49      * @see org.java.plugin.registry.xml.IdentityImpl#isEqualTo(
50      * org.java.plugin.registry.Identity)
51      */

52     protected boolean isEqualTo(final Identity idt) {
53         if (!getClass().getName().equals(idt.getClass().getName())) {
54             return false;
55         }
56         return getDeclaringPluginDescriptor().equals(
57                 ((PluginElementImpl) idt).getDeclaringPluginDescriptor())
58                 && getId().equals(idt.getId());
59     }
60
61     /**
62      * @see org.java.plugin.registry.PluginElement#getDeclaringPluginDescriptor()
63      */

64     public PluginDescriptor getDeclaringPluginDescriptor() {
65         return descriptor;
66     }
67
68     /**
69      * @see org.java.plugin.registry.PluginElement#getDeclaringPluginFragment()
70      */

71     public PluginFragment getDeclaringPluginFragment() {
72         return fragment;
73     }
74
75     /**
76      * @see org.java.plugin.registry.Documentable#getDocumentation()
77      */

78     public Documentation getDocumentation() {
79         return doc;
80     }
81
82     /**
83      * @see org.java.plugin.registry.Documentable#getDocsPath()
84      */

85     public String JavaDoc getDocsPath() {
86         return (fragment != null) ? fragment.getDocsPath()
87                 : descriptor.getDocsPath();
88     }
89 }
90
Popular Tags