I try to extend the omero server by an own service by following the description at http://www.openmicroscopy.org/site/supp ... Omero.html .
Like descripted in the 'Non-service beans' section I generate a java file 'MyLoginAttemptListener.java' and a xml file 'blitz-myLoginListener.xml'.
- Code: Select all
package ome.services;
import ome.services.messages.LoginAttemptMessage;
import org.springframework.context.*;
import java.nio.file.*;
import java.nio.charset.*;
import java.util.*;
/**
* Trivial listener for login attempts.
*/
public class MyLoginAttemptListener implements ApplicationListener<LoginAttemptMessage>
{
public void onApplicationEvent(LoginAttemptMessage lam)
{
if (lam.success != null)
{
String message = "Login for user " + lam.user;
if(lam.success)
message += " successful!";
else
message += " failed!";
List<String> lines = Arrays.asList(message);
try
{
//System.out.println(message);
Files.write(Paths.get("loginLog.txt"), lines, StandardCharsets.UTF_8, StandardOpenOption.CREATE, StandardOpenOption.APPEND);
}
catch(Exception e)
{
}
}
}
}
Both files I add to the JAR file 'extension.jar' and copy this file to OMERO.server/lib/server path of my OMERO installation.
Then I restart my server and login via the web interface.
Unfortunately it seems not to work. I can't find the loginLog.txt file.
Do I miss some point? Or what is the easiest way (if possible without rebuild/reinstall the OMERO-server) to add an own service to OMERO.
Thanks,
Daniel