Search in sources :

Example 1 with BeanJSONConverter

use of jp.ossc.nimbus.util.converter.BeanJSONConverter in project nimbus by nimbus-org.

the class ScheduleManagerServlet method init.

/**
 * サーブレットの初期化を行う。<p>
 * サービス定義のロード及びロード完了チェックを行う。
 *
 * @exception ServletException サーブレットの初期化に失敗した場合
 */
public synchronized void init() throws ServletException {
    ServiceName jsonConverterServiceName = getJSONConverterServiceName();
    if (jsonConverterServiceName == null) {
        jsonConverter = new BeanJSONConverter();
        DateFormatConverter dateFormatConverter = new DateFormatConverter(DateFormatConverter.DATE_TO_STRING, "yyyyMMddHHmmssSSS");
        dateFormatConverter.setNullString(null);
        jsonConverter.setFormatConverter(Date.class, dateFormatConverter);
    } else {
        jsonConverter = (BeanJSONConverter) ServiceManagerFactory.getServiceObject(jsonConverterServiceName);
    }
    jsonConverter.setCharacterEncodingToStream("UTF-8");
    jsonConverter.setUnicodeEscape(isUnicodeEscape());
    toStringConverter = new StringStreamConverter(StringStreamConverter.STREAM_TO_STRING);
    toStringConverter.setCharacterEncodingToObject("UTF-8");
    ServiceName scheduleManagerServiceName = getScheduleManagerServiceName();
    if (scheduleManagerServiceName == null) {
        throw new ServletException("ScheduleManagerServiceName is null.");
    } else {
        scheduleManager = (ScheduleManager) ServiceManagerFactory.getServiceObject(scheduleManagerServiceName);
    }
    ServiceName schedulerServiceName = getSchedulerServiceName();
    if (schedulerServiceName != null) {
        scheduler = (Scheduler) ServiceManagerFactory.getServiceObject(schedulerServiceName);
    }
}
Also used : ServletException(javax.servlet.ServletException) ServiceName(jp.ossc.nimbus.core.ServiceName) BeanJSONConverter(jp.ossc.nimbus.util.converter.BeanJSONConverter) DateFormatConverter(jp.ossc.nimbus.util.converter.DateFormatConverter) StringStreamConverter(jp.ossc.nimbus.util.converter.StringStreamConverter)

Aggregations

ServletException (javax.servlet.ServletException)1 ServiceName (jp.ossc.nimbus.core.ServiceName)1 BeanJSONConverter (jp.ossc.nimbus.util.converter.BeanJSONConverter)1 DateFormatConverter (jp.ossc.nimbus.util.converter.DateFormatConverter)1 StringStreamConverter (jp.ossc.nimbus.util.converter.StringStreamConverter)1