View Javadoc

1   /*
2   Karma core - Core of the Karma application
3   Copyright (C) 2004  Toolforge <www.toolforge.nl>
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 nl.toolforge.karma.core.location;
20  
21  import nl.toolforge.karma.core.boot.WorkingContext;
22  import nl.toolforge.karma.core.vc.AuthenticationException;
23  import nl.toolforge.karma.core.vc.AuthenticatorKey;
24  
25  /***
26   * <p>A <code>Location</code> describes a location aspect of a module. Source modules are kept in a version control
27   * system, binary (third party) modules are kept in libraries. These locations are maintained in
28   * <code>locations.xml</code>.
29   * <p/>
30   * <p>A developer should maintain a <code>location-authentication.xml</code> file in the Karma configuration directory.
31   * This file contains
32   *
33   * @author D.A. Smedes
34   * @version $Id: Location.java,v 1.11 2004/11/02 23:57:06 asmedes Exp $
35   */
36  public interface Location {
37  
38    /***
39     * Is the (remote) location available on the specified port ? Usefull to implement for remote locations.
40     * @return <code>false</code> if the location is not available, <code>true</code> if it is.
41     */
42    public boolean isAvailable();
43  
44    /***
45     * The locations' type descriptor.
46     *
47     * @return A <code>Location.Type</code> instance.
48     */
49    public LocationType getType();
50  
51    /***
52     * A locations' identifier. Should be unique over all <code>location</code>-elements. This id is
53     * matched against the <code>id</code>-attribute of a <code>location</code>-element in the
54     * <code>location-authentication.xml</code> file (see class documentation {@link nl.toolforge.karma.core.location.Location}.
55     *
56     * @return An identifier string for a location.
57     */
58    public String getId();
59  
60    /***
61     * Returns a &lt;location&gt-element for the specific type of location.
62     */
63    public StringBuffer asXML();
64  
65    /***
66     * <p>Tries to open a connection to the server if the protocol is a remote protocol.
67     *
68     * @throws LocationException When connection failed. The ErrorCode will tell the reason.
69     */
70    public void connect() throws AuthenticationException, LocationException;
71  
72    public void setWorkingContext(WorkingContext workingContext);
73  
74    public AuthenticatorKey getAuthenticatorKey();
75  }