Revision 672:163de098320c src/gr/ebs/gss/mbeans/Solr.java

b/src/gr/ebs/gss/mbeans/Solr.java
1 1
/*
2
 * Copyright 2008, 2009 Electronic Business Systems Ltd.
2
 * Copyright 2008, 2009, 2010 Electronic Business Systems Ltd.
3 3
 *
4 4
 * This file is part of GSS.
5 5
 *
......
18 18
 */
19 19
package gr.ebs.gss.mbeans;
20 20

  
21
import static gr.ebs.gss.server.configuration.GSSConfigurationFactory.getConfiguration;
22
import gr.ebs.gss.server.ejb.ExternalAPIRemote;
21
import gr.ebs.gss.server.ejb.ExternalAPI;
22
import gr.ebs.gss.server.ejb.ExternalAPIBean;
23 23

  
24 24
import javax.management.JMRuntimeException;
25
import javax.naming.InitialContext;
26
import javax.naming.NamingException;
27
import javax.rmi.PortableRemoteObject;
28 25

  
29 26
import org.jboss.system.ServiceMBeanSupport;
30 27

  
......
38 35
	@Override
39 36
	public void rebuildIndex() {
40 37
		try {
41
			InitialContext ctx = new InitialContext();
42
			Object ref = ctx.lookup(getConfiguration().getString("externalApiPath"));
43
			ExternalAPIRemote service = (ExternalAPIRemote) PortableRemoteObject.narrow(ref, ExternalAPIRemote.class);
38
			ExternalAPI service = new ExternalAPIBean();
44 39
			service.rebuildSolrIndex();
45 40
		} catch (ClassCastException e) {
46 41
			throw new JMRuntimeException(e.getMessage());
47
		} catch (NamingException e) {
48
			throw new JMRuntimeException(e.getMessage());
49 42
		}
50 43
	}
51 44
}

Also available in: Unified diff