source: sandbox/expresso-solr/expressoMail1_2/inc/solrclient/library/Solarium/Plugin/Abstract.php @ 7576

Revision 7576, 4.8 KB checked in by adir, 11 years ago (diff)

Ticket #000 - Adicionando a integracao de buscas com Solr na base a ser isnerida na comunidade

Line 
1<?php
2/**
3 * Copyright 2011 Bas de Nooijer. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 *    this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 *    this listof conditions and the following disclaimer in the documentation
13 *    and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 *
27 * The views and conclusions contained in the software and documentation are
28 * those of the authors and should not be interpreted as representing official
29 * policies, either expressed or implied, of the copyright holder.
30 *
31 * @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl>
32 * @license http://github.com/basdenooijer/solarium/raw/master/COPYING
33 * @link http://www.solarium-project.org/
34 *
35 * @package Solarium
36 */
37
38/**
39 * Base class for plugins
40 *
41 * @package Solarium
42 * @subpackage Plugin
43 */
44abstract class Solarium_Plugin_Abstract extends Solarium_Configurable
45{
46
47    /**
48     * Client instance
49     *
50     * @var Solarium_Client
51     */
52    protected $_client;
53
54    /**
55     * Initialize
56     *
57     * This method is called when the plugin is registered to a client instance
58     *
59     * @param Solarium_Client $client
60     * @param array $options
61     */
62    public function init($client, $options)
63    {
64        $this->_client = $client;
65        parent::__construct($options);
66
67        $this->_initPlugin();
68    }
69
70    /**
71     * Plugin init function
72     *
73     * This is an extension point for plugin implementations.
74     * Will be called as soon as $this->_client and options have been set.
75     *
76     * @return void
77     */
78    protected function _initPlugin()
79    {
80
81    }
82
83    /**
84     * preCreateRequest hook
85     *
86     * @param Solarium_Query $query
87     * @return void|Solarium_Client_Request
88     */
89    public function preCreateRequest($query)
90    {
91    }
92
93    /**
94     * postCreateRequest hook
95     *
96     * @param Solarium_Query $query
97     * @param Solarium_Client_Request $request
98     * @return void
99     */
100    public function postCreateRequest($query, $request)
101    {
102    }
103
104    /**
105     * preExecuteRequest hook
106     *
107     * @param Solarium_Client_Request $request
108     * @return void|Solarium_Client_Response
109     */
110    public function preExecuteRequest($request)
111    {
112    }
113
114    /**
115     * postExecuteRequest hook
116     *
117     * @param Solarium_Client_Request $request
118     * @param Solarium_Client_Response $response
119     * @return void
120     */
121    public function postExecuteRequest($request, $response)
122    {
123    }
124
125    /**
126     * preCreateResult hook
127     *
128     * @param Solarium_Query $query
129     * @param Solarium_Client_Response $response
130     * @return void|Solarium_Result
131     */
132    public function preCreateResult($query, $response)
133    {
134    }
135
136    /**
137     * postCreateResult hook
138     *
139     * @param Solarium_Query $query
140     * @param Solarium_Client_Response $response
141     * @param Solarium_Result $result
142     * @return void
143     */
144    public function postCreateResult($query, $response, $result)
145    {
146    }
147
148    /**
149     * preExecute hook
150     *
151     * @param Solarium_Query $query
152     * @return void|Solarium_Result
153     */
154    public function preExecute($query)
155    {
156    }
157
158    /**
159     * postExecute hook
160     *
161     * @param Solarium_Query $query
162     * @param Solarium_Result $result
163     * @return void
164     */
165    public function postExecute($query, $result)
166    {
167    }
168
169    /**
170     * preCreateQuery hook
171     *
172     * @param string $type
173     * @param mixed $options
174     * @return void|Solarium_Query
175     */
176    public function preCreateQuery($type, $options)
177    {
178    }
179
180    /**
181     * postCreateQuery hook
182     *
183     * @param string $type
184     * @param mixed $options
185     * @param Solarium_Query
186     * @return void
187     */
188    public function postCreateQuery($type, $options, $query)
189    {
190    }
191
192}
Note: See TracBrowser for help on using the repository browser.