KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > java > plugin > PathResolver


1 /*****************************************************************************
2  * Java Plug-in Framework (JPF)
3  * Copyright (C) 2004-2007 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;
20
21 import java.net.URL JavaDoc;
22
23 import org.java.plugin.registry.Identity;
24 import org.java.plugin.util.ExtendedProperties;
25
26 /**
27  * This interface is intended to establish correspondence between relative path
28  * and absolute URL in context of plug-in or plug-in fragment.
29  *
30  * @see org.java.plugin.ObjectFactory#createPathResolver()
31  *
32  * @version $Id: PathResolver.java,v 1.10 2007/01/05 13:22:10 ddimon Exp $
33  */

34 public interface PathResolver {
35     /**
36      * Configures this resolver instance. Usually this method is called from
37      * {@link ObjectFactory object factory} implementation.
38      * @param config path resolver configuration data
39      * @throws Exception if any error has occurred
40      */

41     void configure(ExtendedProperties config) throws Exception JavaDoc;
42
43     /**
44      * Registers "home" URL for given plug-in element.
45      * @param idt plug-in element
46      * @param url "home" URL for a given plug-in element
47      */

48     void registerContext(Identity idt, URL JavaDoc url);
49     
50     /**
51      * Unregisters plug-in element from this path resolver.
52      * @param id plug-in element identifier
53      */

54     void unregisterContext(String JavaDoc id);
55     
56     /**
57      * Returns URL of {@link #registerContext(Identity, URL) registered} plug-in
58      * element context. If context for plug-in element with given ID not
59      * registered, this method should throw an {@link IllegalArgumentException}.
60      * In other words, this method shouldn't return <code>null</code>.
61      * @param id plug-in element identifier
62      * @return registered context "home" location
63      */

64     URL JavaDoc getRegisteredContext(String JavaDoc id);
65     
66     /**
67      * @param id plug-in element identifier
68      * @return <code>true</code> if context for plug-in element with given ID
69      * registered
70      */

71     boolean isContextRegistered(String JavaDoc id);
72
73     /**
74      * Should resolve given path to URL for a given identity.
75      * @param identity plug-in element for which to resolve path
76      * @param path path to be resolved
77      * @return resolved absolute URL
78      */

79     URL JavaDoc resolvePath(Identity identity, String JavaDoc path);
80 }
Popular Tags