Search in sources :

Example 1 with Journal

use of jp.ossc.nimbus.service.journal.Journal in project nimbus by nimbus-org.

the class DatabaseTimerScheduleFactoryService method createJournal.

protected Journal createJournal(String scheduleName, ResultSet rs) throws Exception {
    Journal journal = null;
    if (scheduleJournalServiceNameQueryIndex > 0) {
        final String serviceNameStr = rs.getString(scheduleJournalServiceNameQueryIndex);
        if (serviceNameStr != null) {
            final ServiceNameEditor serviceNameEditor = new ServiceNameEditor();
            serviceNameEditor.setAsText(serviceNameStr);
            journal = (Journal) ServiceManagerFactory.getServiceObject((ServiceName) serviceNameEditor.getValue());
        }
    }
    if (journal == null) {
        journal = scheduleJournal;
    }
    return journal;
}
Also used : Journal(jp.ossc.nimbus.service.journal.Journal)

Example 2 with Journal

use of jp.ossc.nimbus.service.journal.Journal in project nimbus by nimbus-org.

the class DatabaseTimerScheduleFactoryService method createSchedule.

protected TimerScheduleService createSchedule(ResultSet rs, int rowNum) throws Exception {
    final TimerScheduleService schedule = new TimerScheduleService();
    final String name = createScheduleName(rs, rowNum);
    schedule.setServiceManagerName(getServiceManagerName());
    schedule.setServiceName(name);
    schedule.setName(name);
    schedule.setTask(createScheduleTask(name, rs));
    schedule.setStartTime(createStartTime(name, rs));
    final Boolean isExecuteWhenOverStartTime = createExecuteWhenOverStartTime(name, rs);
    if (isExecuteWhenOverStartTime != null) {
        schedule.setExecuteWhenOverStartTime(isExecuteWhenOverStartTime.booleanValue());
    }
    schedule.setEndTime(createEndTime(name, rs));
    final long delay = createDelay(name, rs);
    if (delay > 0) {
        schedule.setDelay(delay);
    }
    final long period = createPeriod(name, rs);
    if (period > 0) {
        schedule.setPeriod(period);
    }
    final int count = createCount(name, rs);
    if (count > 0) {
        schedule.setCount(count);
    }
    final Boolean isFixedRate = createFixedRate(name, rs);
    if (isFixedRate != null) {
        schedule.setFixedRate(isFixedRate.booleanValue());
    }
    final String[] dependsScheduleNames = createDependsScheduleNames(name, rs);
    if (dependsScheduleNames != null) {
        schedule.setDependsScheduleNames(dependsScheduleNames);
    }
    final long dependencyTimeout = createDependencyTimeout(name, rs);
    if (dependencyTimeout > 0) {
        schedule.setDependencyTimeout(dependencyTimeout);
    }
    final long dependencyConfirmInterval = createDependencyConfirmInterval(name, rs);
    if (dependencyConfirmInterval > 0) {
        schedule.setDependencyConfirmInterval(dependencyConfirmInterval);
    }
    final String errorLogMessageId = createErrorLogMessageId(name, rs);
    if (errorLogMessageId != null) {
        schedule.setErrorLogMessageId(errorLogMessageId);
    }
    final String timeoutLogMessageId = createTimeoutLogMessageId(name, rs);
    if (timeoutLogMessageId != null) {
        schedule.setTimeoutLogMessageId(timeoutLogMessageId);
    }
    final Journal journal = createJournal(name, rs);
    if (journal != null) {
        schedule.setJournal(journal);
    }
    final Queue queue = createQueue(name, rs);
    if (queue != null) {
        schedule.setQueue(queue);
    }
    final Boolean isGarbageQueue = createGarbageQueue(name, rs);
    if (isGarbageQueue != null) {
        schedule.setGarbageQueue(isGarbageQueue.booleanValue());
    }
    final ScheduleStateManager stateManager = createScheduleStateManager(name, rs);
    if (stateManager != null) {
        schedule.setScheduleStateManager(stateManager);
    }
    return schedule;
}
Also used : Journal(jp.ossc.nimbus.service.journal.Journal) Queue(jp.ossc.nimbus.service.queue.Queue)

Example 3 with Journal

use of jp.ossc.nimbus.service.journal.Journal in project nimbus by nimbus-org.

the class BeanFlowServlet method doService.

/**
 * 検証BeanFlow及びアクションBeanFlowの呼び出しを制御する。<p>
 *
 * @param req HTTPリクエスト
 * @param resp HTTPレスポンス
 * @exception ServletException
 * @exception IOException
 */
protected void doService(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    String flowName = processSelectBeanFlow(req, resp);
    if (flowName == null || flowName.length() == 0) {
        handleNotFound(req, resp, flowName);
        return;
    }
    final BeanFlowInvokerFactory beanFlowInvokerFactory = (BeanFlowInvokerFactory) ServiceManagerFactory.getServiceObject(beanFlowInvokerFactoryServiceName);
    if (!beanFlowInvokerFactory.containsFlow(flowName)) {
        handleNotFound(req, resp, flowName);
        return;
    }
    Journal journal = null;
    EditorFinder editorFinder = null;
    EditorFinder validateEditorFinder = null;
    EditorFinder actionEditorFinder = null;
    String requestId = null;
    if (journalServiceName != null) {
        journal = (Journal) ServiceManagerFactory.getServiceObject(journalServiceName);
        if (editorFinderServiceName != null) {
            editorFinder = (EditorFinder) ServiceManagerFactory.getServiceObject(editorFinderServiceName);
        }
        if (validateEditorFinderServiceName != null) {
            validateEditorFinder = (EditorFinder) ServiceManagerFactory.getServiceObject(validateEditorFinderServiceName);
        }
        if (actionEditorFinderServiceName != null) {
            actionEditorFinder = (EditorFinder) ServiceManagerFactory.getServiceObject(actionEditorFinderServiceName);
        }
        if (contextServiceName != null) {
            Context context = (Context) ServiceManagerFactory.getServiceObject(contextServiceName);
            requestId = (String) context.get(ThreadContextKey.REQUEST_ID);
        }
    }
    try {
        if (journal != null) {
            journal.startJournal(JOURNAL_KEY_PROCESS, editorFinder);
            if (requestId != null) {
                journal.setRequestId(requestId);
            }
        }
        final BeanFlowServletContext context = new BeanFlowServletContext(req, resp, req.getAttribute(inputAttributeName));
        if (validateFlowPrefix != null && isValidate) {
            final String validateFlowName = validateFlowPrefix + flowName;
            if (beanFlowInvokerFactory.containsFlow(validateFlowName)) {
                final BeanFlowInvoker validateFlow = beanFlowInvokerFactory.createFlow(validateFlowName);
                try {
                    if (journal != null) {
                        journal.addStartStep(JOURNAL_KEY_VALIDATE, validateEditorFinder);
                        journal.addInfo(JOURNAL_KEY_FLOW_NAME, validateFlowName);
                    }
                    if (!processValidate(req, resp, context, validateFlow, journal)) {
                        if (!handleValidateError(req, resp, context, journal)) {
                            return;
                        }
                    }
                } finally {
                    if (journal != null) {
                        journal.addEndStep();
                    }
                }
            }
        }
        final BeanFlowInvoker flow = beanFlowInvokerFactory.createFlow(flowName);
        try {
            if (journal != null) {
                journal.addStartStep(JOURNAL_KEY_ACTION, actionEditorFinder);
                journal.addInfo(JOURNAL_KEY_FLOW_NAME, flowName);
            }
            processAction(req, resp, context, flow, journal);
        } finally {
            if (journal != null) {
                journal.addEndStep();
            }
        }
    } finally {
        if (journal != null) {
            journal.endJournal();
        }
    }
}
Also used : Context(jp.ossc.nimbus.service.context.Context) EditorFinder(jp.ossc.nimbus.service.journal.editorfinder.EditorFinder) BeanFlowInvokerFactory(jp.ossc.nimbus.service.beancontrol.interfaces.BeanFlowInvokerFactory) Journal(jp.ossc.nimbus.service.journal.Journal) BeanFlowInvoker(jp.ossc.nimbus.service.beancontrol.interfaces.BeanFlowInvoker)

Aggregations

Journal (jp.ossc.nimbus.service.journal.Journal)3 BeanFlowInvoker (jp.ossc.nimbus.service.beancontrol.interfaces.BeanFlowInvoker)1 BeanFlowInvokerFactory (jp.ossc.nimbus.service.beancontrol.interfaces.BeanFlowInvokerFactory)1 Context (jp.ossc.nimbus.service.context.Context)1 EditorFinder (jp.ossc.nimbus.service.journal.editorfinder.EditorFinder)1 Queue (jp.ossc.nimbus.service.queue.Queue)1