Search in sources :

Example 1 with FacadeCaller

use of jp.ossc.nimbus.service.ioccall.FacadeCaller in project nimbus by nimbus-org.

the class DatabaseTimerScheduleFactoryService method createScheduleTask.

protected ScheduleTask createScheduleTask(String scheduleName, ResultSet rs) throws Exception {
    final ServiceNameEditor serviceNameEditor = new ServiceNameEditor();
    if (scheduleBeanFlowNamesQueryIndex > 0) {
        final String beanFlowNames = rs.getString(scheduleBeanFlowNamesQueryIndex);
        if (beanFlowNames != null && beanFlowNames.length() != 0) {
            final StringArrayEditor stringArrayEditor = new StringArrayEditor();
            stringArrayEditor.setAsText(beanFlowNames);
            final String[] beanFlowNameArray = (String[]) stringArrayEditor.getValue();
            FacadeCaller facadeCaller = null;
            if (scheduleFacadeCallerServiceNameQueryIndex > 0) {
                final String serviceNameStr = rs.getString(scheduleFacadeCallerServiceNameQueryIndex);
                if (serviceNameStr != null) {
                    serviceNameEditor.setAsText(serviceNameStr);
                    facadeCaller = (FacadeCaller) ServiceManagerFactory.getServiceObject((ServiceName) serviceNameEditor.getValue());
                }
            }
            if (facadeCaller == null) {
                facadeCaller = scheduleFacadeCaller;
            }
            if (facadeCaller == null) {
                throw new IllegalArgumentException("FacadeCaller is null : " + scheduleName);
            }
            String iocCallType = null;
            if (scheduleIOCCallTypeQueryIndex > 0) {
                iocCallType = rs.getString(scheduleIOCCallTypeQueryIndex);
            }
            final IOCCallScheduleTaskService iocCallTask = new IOCCallScheduleTaskService();
            iocCallTask.setBeanFlowNames(beanFlowNameArray);
            iocCallTask.setFacadeCaller(facadeCaller);
            if (iocCallType != null) {
                iocCallTask.setIOCCallType(iocCallType);
            }
            iocCallTask.create();
            iocCallTask.start();
            return iocCallTask;
        }
    }
    if (scheduleBeanFlowNameQueryIndex > 0) {
        final String beanFlowName = rs.getString(scheduleBeanFlowNameQueryIndex);
        if (beanFlowName != null && beanFlowName.length() != 0) {
            BeanFlowInvokerFactory beanFlowInvokerFactory = null;
            if (scheduleBeanFlowInvokerFactoryServiceNameQueryIndex > 0) {
                final String serviceNameStr = rs.getString(scheduleBeanFlowInvokerFactoryServiceNameQueryIndex);
                if (serviceNameStr != null) {
                    serviceNameEditor.setAsText(serviceNameStr);
                    beanFlowInvokerFactory = (BeanFlowInvokerFactory) ServiceManagerFactory.getServiceObject((ServiceName) serviceNameEditor.getValue());
                }
            }
            if (beanFlowInvokerFactory == null) {
                beanFlowInvokerFactory = scheduleBeanFlowInvokerFactory;
            }
            if (beanFlowInvokerFactory == null) {
                throw new IllegalArgumentException("BeanFlowInvokerFactory is null : " + scheduleName);
            }
            final BeanFlowCallScheduleTaskService beanFlowTask = new BeanFlowCallScheduleTaskService();
            beanFlowTask.setBeanFlowName(beanFlowName);
            beanFlowTask.setBeanFlowInvokerFactory(beanFlowInvokerFactory);
            beanFlowTask.create();
            beanFlowTask.start();
            return beanFlowTask;
        }
    }
    if (scheduleTaskServiceNameQueryIndex > 0) {
        final String scheduleTaskServiceNameStr = rs.getString(scheduleTaskServiceNameQueryIndex);
        if (scheduleTaskServiceNameStr != null) {
            serviceNameEditor.setAsText(scheduleTaskServiceNameStr);
            return (ScheduleTask) ServiceManagerFactory.getServiceObject((ServiceName) serviceNameEditor.getValue());
        }
    }
    throw new IllegalArgumentException("Task is null : " + scheduleName);
}
Also used : BeanFlowInvokerFactory(jp.ossc.nimbus.service.beancontrol.interfaces.BeanFlowInvokerFactory) FacadeCaller(jp.ossc.nimbus.service.ioccall.FacadeCaller)

Aggregations

BeanFlowInvokerFactory (jp.ossc.nimbus.service.beancontrol.interfaces.BeanFlowInvokerFactory)1 FacadeCaller (jp.ossc.nimbus.service.ioccall.FacadeCaller)1