001    /*
002     * Copyright 2005 Stephen J. McConnell.
003     *
004     * Licensed  under the  Apache License,  Version 2.0  (the "License");
005     * you may not use  this file  except in  compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *   http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed  under the  License is distributed on an "AS IS" BASIS,
012     * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
013     * implied.
014     *
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     */
018    
019    package net.dpml.transit.model;
020    
021    import java.net.URL;
022    import java.net.PasswordAuthentication;
023    import java.rmi.Remote;
024    import java.rmi.RemoteException;
025    
026    /** 
027     * The HostModel interface is implemented by objects that control the
028     * the configuration of resource host implementations.  An instance of an 
029     * implementation of HostModel may be passed as a constructor argument 
030     * to a resource host implmentation. Implementation shall maintain 
031     * synchronization via change events raised by implementations of this 
032     * interface.
033     *
034     * @author <a href="http://www.dpml.net">Digital Product Meta Library</a>
035     * @version 1.0.3
036     */
037    public interface HostModel extends Remote
038    {
039       /**
040        * HTTP port number.
041        */
042        static final int HTTP_PORT = 80;
043    
044       /**
045        * FTP port number.
046        */
047        static final int FTP_PORT = 21;
048    
049       /**
050        * HTTPS port number.
051        */
052        static final int HTTPS_PORT = 443;
053    
054       /**
055        * Return an immutable host identifier.  The host identifier shall be 
056        * guranteed to be unique and constant for the life of the model.
057        * @return the host id
058        * @exception RemoteException if a remote exception occurs
059        */
060        String getID() throws RemoteException;
061    
062       /**
063        * Return the host priority.
064        * @return the host priority setting
065        * @exception RemoteException if a remote exception occurs
066        */
067        int getPriority() throws RemoteException;
068    
069       /**
070        * Return the host base path.
071        * @return the base path
072        * @exception RemoteException if a remote exception occurs
073        */
074        String getBasePath() throws RemoteException;
075    
076       /**
077        * Return the host base url.
078        * @return the base url
079        * @exception RemoteException if a remote exception occurs
080        */
081        URL getBaseURL() throws RemoteException;
082    
083       /**
084        * Return index path.
085        * @return the index path
086        * @exception RemoteException if a remote exception occurs
087        */
088        String getIndexPath() throws RemoteException;
089    
090       /**
091        * Return index url.
092        * @return the index url
093        * @exception RemoteException if a remote exception occurs
094        */
095        URL getIndexURL() throws RemoteException;
096    
097       /**
098        * Return the enabled status of the host.
099        * @return TRUE if enabled 
100        * @exception RemoteException if a remote exception occurs
101        */
102        boolean getEnabled() throws RemoteException;
103    
104       /**
105        * Return the trusted status.
106        * @return TRUE if trusted 
107        * @exception RemoteException if a remote exception occurs
108        */
109        boolean getTrusted() throws RemoteException;
110       
111       /**
112        * Return the host password authentication credentials.
113        * @return the password authentication credentials
114        * @exception RemoteException if a remote exception occurs
115        */
116        PasswordAuthentication getAuthentication() throws RemoteException; 
117    
118       /**
119        * Return the host request identifier.
120        * @return the identifier
121        * @exception RemoteException if a remote exception occurs
122        */
123        RequestIdentifier getRequestIdentifier() throws RemoteException; 
124    
125       /**
126        * Return the layout strategy model.
127        * @return the layout model
128        * @exception RemoteException if a remote exception occurs
129        */
130        LayoutModel getLayoutModel() throws RemoteException;
131    
132       /**
133        * Add a host change listener to the director.
134        * @param listener the host change listener to add
135        * @exception RemoteException if a remote exception occurs
136        */
137        void addHostListener( HostListener listener ) throws RemoteException;
138    
139       /**
140        * Remove a host change listener from the director.
141        * @param listener the host change listener to remove
142        * @exception RemoteException if a remote exception occurs
143        */
144        void removeHostListener( HostListener listener ) throws RemoteException;
145    
146    }
147