X-Git-Url: https://code.grnet.gr/git/pithos/blobdiff_plain/023f6f1e5465d565189031ead1aaef7351476f73..8f00c3d85afe79328169795e3c99561c0277c694:/src/gr/ebs/gss/mbeans/Solr.java diff --git a/src/gr/ebs/gss/mbeans/Solr.java b/src/gr/ebs/gss/mbeans/Solr.java index ee09a20..bc4dce5 100644 --- a/src/gr/ebs/gss/mbeans/Solr.java +++ b/src/gr/ebs/gss/mbeans/Solr.java @@ -19,6 +19,7 @@ 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; @@ -36,16 +37,30 @@ import org.jboss.system.ServiceMBeanSupport; public class Solr extends ServiceMBeanSupport implements SolrMBean { @Override - public void rebuildIndex() { + 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()); + } + } }