@Override public boolean start() throws PluginException { String database = InjectHelper.instanceWithName(String.class, "org.socialmusicdiscovery.server.database"); String forcedUpdateOfSearchRelations = System.getProperty("org.socialmusicdiscovery.server.searchrelations"); if ((database != null && (database.endsWith("-test"))) || (forcedUpdateOfSearchRelations != null && forcedUpdateOfSearchRelations.equalsIgnoreCase("true"))) { System.out.println("Starting to update search relations..."); SearchRelationPostProcessor searchRelationPostProcessor = new SearchRelationPostProcessor(); searchRelationPostProcessor.init(); searchRelationPostProcessor.execute( new ProcessingStatusCallback() { public void progress( String module, String currentDescription, Long currentNo, Long totalNo) { System.out.println(currentNo + " of " + totalNo + ": " + currentDescription); } public void failed(String module, String error) { System.err.println("Failed with error: " + error); } public void finished(String module) { System.out.println("Finish updating search relations"); } public void aborted(String module) {} }); } return false; }
/** * Default implementation which resets abort flag and makes sure the entity manager and execution * parameters are ready to use */ @Override public void init(Map<String, String> executionParameters) throws InitializationFailedException { InjectHelper.injectMembers(this); this.aborted = false; this.executionParameters = executionParameters; if (this.executionParameters == null) { this.executionParameters = new HashMap<String, String>(); } }