001    /*
002     * 
003     * $Revision: 13085 $ $Date: 2008-02-06 18:27:24 +0100 (Mi, 06 Feb 2008) $
004     *
005     * This file is part of ***  M y C o R e  ***
006     * See http://www.mycore.de/ for details.
007     *
008     * This program is free software; you can use it, redistribute it
009     * and / or modify it under the terms of the GNU General Public License
010     * (GPL) as published by the Free Software Foundation; either version 2
011     * of the License or (at your option) any later version.
012     *
013     * This program is distributed in the hope that it will be useful, but
014     * WITHOUT ANY WARRANTY; without even the implied warranty of
015     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016     * GNU General Public License for more details.
017     *
018     * You should have received a copy of the GNU General Public License
019     * along with this program, in a file called gpl.txt or license.txt.
020     * If not, write to the Free Software Foundation Inc.,
021     * 59 Temple Place - Suite 330, Boston, MA  02111-1307 USA
022     */
023    
024    package org.mycore.services.fieldquery;
025    
026    import org.apache.log4j.Logger;
027    
028    /*
029     * This class is a base for all remote access classes. If it is instanced it set
030     * all data for one host defined in the file hosts.xml. Default values are the
031     * WebService data.
032     * 
033     * @author Jens Kupferschmidt @author Frank L�tzenkirchen
034     */
035    
036    public class MCRQueryClientBase implements MCRQueryClientInterface {
037    
038        /** The logger */
039        protected final static Logger LOGGER = Logger.getLogger(MCRQueryClientBase.class);
040    
041        /** The host alias */
042        protected String alias = "";
043    
044        /** The base URL for the remote host */
045        protected String url = "";
046    
047        /** The access mode for the remote host */
048        protected String access = "";
049    
050        /** The URL path for the remote host service */
051        protected String servicepath = "";
052    
053        /* The constructor. */
054        public MCRQueryClientBase() {
055        }
056    
057        /*
058         * The initialization.
059         * 
060         * @param xmlhost an entry of a remote host from hosts.xml
061         */
062        public void init(org.jdom.Element xmlhost) {
063            alias = xmlhost.getAttributeValue("alias");
064            url = xmlhost.getAttributeValue("url");
065            access = xmlhost.getAttributeValue("access");
066            StringBuffer sb = new StringBuffer(256);
067            sb.append("Host ").append(alias).append(" with access mode ").append(access).append(" uses host url ").append(url);
068            LOGGER.debug(sb.toString());
069        }
070    
071        /*
072         * The method return the alias of the host definition. @return the host
073         * alias as String
074         */
075        public final String getAlias() {
076            return alias;
077        }
078    
079        /**
080         * Executes a query on a single remote host using the defined service.
081         * 
082         * @param inDoc
083         *            the query as W3C DOM document
084         * @param results
085         *            the result list to add the hits to
086         */
087        public void search(org.w3c.dom.Document inDoc, MCRResults results) {
088        }
089    
090        /**
091         * Retrieves an Object from remote host using the defined service.
092         * 
093         * @param hostAlias
094         *            the alias of the remote host as defined in hosts.xml
095         * @param ID
096         *            the ID of the Object to retrieve
097         * @return the object document
098         */
099        public org.w3c.dom.Document doRetrieveObject(String ID) {
100            return null;
101        }
102    
103        /**
104         * Retrieves an classification part from remote host using the WebService.
105         * 
106         * @param level
107         *            the level of the classification to retrieve
108         * @param type
109         *            the type of the classification to retrieve
110         * @param classID
111         *            the class ID of the classification to retrieve
112         * @param categID
113         *            the category ID of the classification to retrieve
114         * @param format
115         *             of retrieved classification, valid values are: editor['['formatAlias']']|metadata
116         * @return the classification document
117         */
118        public org.w3c.dom.Document doRetrieveClassification(String level, String type, String classID, String categID, String format) {
119            return null;
120        }
121        
122        /**
123         * Retrieves an link from remote host using the WebService.
124         * 
125         * @param hostAlias
126         *            the alias of the remote host as defined in hosts.xml
127         * @param from
128         *            the source of the link
129         * @param to
130         *            the target of the link
131         * @param type
132         *            the type of the link
133         * @return the mcr:result document
134         */
135        public org.w3c.dom.Document doRetrieveLinks(String from, String to, String type) {
136            return null;        
137        }
138    }