package gr.ebs.gss.mbeans;
import static gr.ebs.gss.server.configuration.GSSConfigurationFactory.getConfiguration;
+import gr.ebs.gss.server.ejb.ExternalAPI;
import gr.ebs.gss.server.ejb.ExternalAPIRemote;
import javax.management.JMRuntimeException;
*
*/
public class Solr extends ServiceMBeanSupport implements SolrMBean {
- /* (non-Javadoc)
- * @see gr.ebs.gss.SolrMBean#rebuildIndex()
- */
- public void rebuildIndex() {
+
+ @Override
+ public String rebuildIndex() {
try {
InitialContext ctx = new InitialContext();
Object ref = ctx.lookup(getConfiguration().getString("externalApiPath"));
- ExternalAPIRemote service = (ExternalAPIRemote) PortableRemoteObject.narrow(ref, ExternalAPIRemote.class);
- service.rebuildSolrIndex();
+ ExternalAPI service = (ExternalAPI) PortableRemoteObject.narrow(ref, ExternalAPI.class);
+ return service.rebuildSolrIndex();
} catch (ClassCastException e) {
throw new JMRuntimeException(e.getMessage());
} catch (NamingException e) {
throw new JMRuntimeException(e.getMessage());
}
}
+
+ @Override
+ public String refreshIndex() {
+ try {
+ InitialContext ctx = new InitialContext();
+ Object ref = ctx.lookup(getConfiguration().getString("externalApiPath"));
+ ExternalAPI service = (ExternalAPI) PortableRemoteObject.narrow(ref, ExternalAPI.class);
+ return service.refreshSolrIndex();
+ } catch (ClassCastException e) {
+ throw new JMRuntimeException(e.getMessage());
+ } catch (NamingException e) {
+ throw new JMRuntimeException(e.getMessage());
+ }
+ }
}