use of play.classloading.ApplicationClasses.ApplicationClass in project play-cookbook by spinscale.
the class SearchHelperPlugin method getStatus.
@Override
public String getStatus() {
String output = "SearchHelperPlugin:\n~~~~~~~~~~~~~~~~~~~\n";
List<ApplicationClass> classes = Play.classes.getAssignableClasses(IndexedModel.class);
for (ApplicationClass applicationClass : classes) {
if (isIndexed(applicationClass)) {
List<String> fieldList = getIndexedFields(applicationClass);
output += "Entity " + applicationClass.name + ": " + fieldList + "\n";
}
}
return output;
}
use of play.classloading.ApplicationClasses.ApplicationClass in project play-cookbook by spinscale.
the class SearchHelperPlugin method getJsonStatus.
@Override
public JsonObject getJsonStatus() {
JsonObject obj = new JsonObject();
List<ApplicationClass> classes = Play.classes.getAssignableClasses(IndexedModel.class);
for (ApplicationClass applicationClass : classes) {
if (isIndexed(applicationClass)) {
List<String> fieldList = getIndexedFields(applicationClass);
JsonArray fields = new JsonArray();
for (String field : fieldList) {
fields.add(new JsonPrimitive(field));
}
obj.add(applicationClass.name, fields);
}
}
return obj;
}
use of play.classloading.ApplicationClasses.ApplicationClass in project play-cookbook by spinscale.
the class RegistrationPlugin method onApplicationStart.
public void onApplicationStart() {
ApplicationClass registrationService = Play.classes.getAssignableClasses(RegistrationService.class).get(0);
if (registrationService == null) {
Logger.error("Registration plugin disabled. No class implements RegistrationService interface");
} else {
try {
service = (RegistrationService) registrationService.javaClass.newInstance();
pluginActive = true;
} catch (Exception e) {
Logger.error(e, "Registration plugin disabled. Error when creating new instance");
}
}
}
use of play.classloading.ApplicationClasses.ApplicationClass in project play-cookbook by spinscale.
the class ApiPlugin method onApplicationStart.
@Override
public void onApplicationStart() {
try {
List<ApplicationClass> applicationClasses = Play.classes.getAnnotatedClasses(XmlRootElement.class);
List<Class> classes = new ArrayList<Class>();
for (ApplicationClass applicationClass : applicationClasses) {
classes.add(applicationClass.javaClass);
}
jc = JAXBContext.newInstance(classes.toArray(new Class[] {}));
} catch (JAXBException e) {
Logger.error(e, "Problem initializing jaxb context: %s", e.getMessage());
}
gson = new GsonBuilder().create();
Logger.info("ApiPlugin loaded");
}
use of play.classloading.ApplicationClasses.ApplicationClass in project play-cookbook by spinscale.
the class ApiPlugin method onApplicationStart.
public void onApplicationStart() {
Logger.info("ApiPlugin loaded");
try {
List<ApplicationClass> applicationClasses = Play.classes.getAnnotatedClasses(XmlRootElement.class);
List<Class> classes = new ArrayList<Class>();
for (ApplicationClass applicationClass : applicationClasses) {
classes.add(applicationClass.javaClass);
}
jc = JAXBContext.newInstance(classes.toArray(new Class[] {}));
} catch (JAXBException e) {
Logger.error(e, "Problem initializing jaxb context: %s", e.getMessage());
}
gson = new GsonBuilder().create();
}
Aggregations