root / src / gr / ebs / gss / mbeans / Solr.java @ 023f6f1e
History | View | Annotate | Download (1.6 kB)
1 | 14ad7326 | pastith | /*
|
---|---|---|---|
2 | 14ad7326 | pastith | * Copyright 2008, 2009 Electronic Business Systems Ltd.
|
3 | 14ad7326 | pastith | *
|
4 | 14ad7326 | pastith | * This file is part of GSS.
|
5 | 14ad7326 | pastith | *
|
6 | 14ad7326 | pastith | * GSS is free software: you can redistribute it and/or modify
|
7 | 14ad7326 | pastith | * it under the terms of the GNU General Public License as published by
|
8 | 14ad7326 | pastith | * the Free Software Foundation, either version 3 of the License, or
|
9 | 14ad7326 | pastith | * (at your option) any later version.
|
10 | 14ad7326 | pastith | *
|
11 | 14ad7326 | pastith | * GSS is distributed in the hope that it will be useful,
|
12 | 14ad7326 | pastith | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 | 14ad7326 | pastith | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 | 14ad7326 | pastith | * GNU General Public License for more details.
|
15 | 14ad7326 | pastith | *
|
16 | 14ad7326 | pastith | * You should have received a copy of the GNU General Public License
|
17 | 14ad7326 | pastith | * along with GSS. If not, see <http://www.gnu.org/licenses/>.
|
18 | 14ad7326 | pastith | */
|
19 | 14ad7326 | pastith | package gr.ebs.gss.mbeans; |
20 | 14ad7326 | pastith | |
21 | 8c2595cb | pastith | import static gr.ebs.gss.server.configuration.GSSConfigurationFactory.getConfiguration; |
22 | 14ad7326 | pastith | import gr.ebs.gss.server.ejb.ExternalAPIRemote; |
23 | 14ad7326 | pastith | |
24 | 14ad7326 | pastith | import javax.management.JMRuntimeException; |
25 | 14ad7326 | pastith | import javax.naming.InitialContext; |
26 | 14ad7326 | pastith | import javax.naming.NamingException; |
27 | 14ad7326 | pastith | import javax.rmi.PortableRemoteObject; |
28 | 14ad7326 | pastith | |
29 | 14ad7326 | pastith | import org.jboss.system.ServiceMBeanSupport; |
30 | 14ad7326 | pastith | |
31 | 14ad7326 | pastith | |
32 | 14ad7326 | pastith | /**
|
33 | 14ad7326 | pastith | * @author chstath
|
34 | 14ad7326 | pastith | *
|
35 | 14ad7326 | pastith | */
|
36 | 14ad7326 | pastith | public class Solr extends ServiceMBeanSupport implements SolrMBean { |
37 | 023f6f1e | Panagiotis Astithas | |
38 | 023f6f1e | Panagiotis Astithas | @Override
|
39 | 14ad7326 | pastith | public void rebuildIndex() { |
40 | 14ad7326 | pastith | try {
|
41 | 14ad7326 | pastith | InitialContext ctx = new InitialContext(); |
42 | 8c2595cb | pastith | Object ref = ctx.lookup(getConfiguration().getString("externalApiPath")); |
43 | 14ad7326 | pastith | ExternalAPIRemote service = (ExternalAPIRemote) PortableRemoteObject.narrow(ref, ExternalAPIRemote.class);
|
44 | 14ad7326 | pastith | service.rebuildSolrIndex(); |
45 | 14ad7326 | pastith | } catch (ClassCastException e) { |
46 | 14ad7326 | pastith | throw new JMRuntimeException(e.getMessage()); |
47 | 14ad7326 | pastith | } catch (NamingException e) { |
48 | 14ad7326 | pastith | throw new JMRuntimeException(e.getMessage()); |
49 | 14ad7326 | pastith | } |
50 | 14ad7326 | pastith | } |
51 | 14ad7326 | pastith | } |