src/ directory. You can name it anyway you want too, and place it in any package you want too.
import psoft.hsphere.resource.registrar.LoggableRegistrar;
import psoft.hsphere.resource.registrar.RegistrarTransactionData;
import psoft.hsphere.resource.registrar.RegistrarException;
public class MyRegistrar extends LoggableRegistrar {
....
}
Note: You should use AsyncLoggableRegistrar in case if you are implementing a registrar that supports asyncronic registration.
log variable, that you will later use for loggin purposes (see log4j manual for more info):
private static org.apache.log4j.Category log =
org.apache.log4j.Category.getInstance(MyRegistrar.class);
protected String server;
protected int port;
protected String login;
protected String password;
Integer id, String description. Initialize registrar settings. You can perform any other initialization actions there as well. The id parameter corresponds to Entity ID.
public MyRegistrar(Integer id, String description) throws Exception {
super(id, description);
/* see Deployment Descriptor form tag for defining registrar settings */
server = get("server");
try {
port = Integer.parseInt(get("port"));
} catch (NumberFormatException nfe) {
port = 20001; //setting default port value, if we cannot parse the settings
}
login = get("login");
password = get("password");
...
}
throw new RegistrarException(RegistrarException.NOT_IMPLEMENTED,
"NOT IMPLEMENTED");
getSupportedTLDs method. It should list TLDs that are supported by this implementation of registrar.
public String[] getSupportedTLDs() throws Exception {
return new String[]{"com", "net", "org", "biz", "info", "us"};
}