Package org.apache.synapse.task

Examples of org.apache.synapse.task.TaskDescription


                                                     String name, String group) throws Exception {
        if (name == null || "".equals(name)) {
            handleException("Task Name cannot be empty");
        }
        name = name.trim();
        TaskDescription taskDescription = client.getTaskDescription(name, group);
        if (taskDescription == null) {
            handleException("No task description for name :" + name);
        }
        return taskDescription;
    }
View Full Code Here


    public static void registerJob() {

        String taskName = UUIDGenerator.generateUUID();
        String groupId = UUIDGenerator.generateUUID();

        TaskDescription taskDescription = new TaskDescription();
        taskDescription.setName(taskName);
        taskDescription.setGroup(groupId);
        // we are triggering only at the period

        //taskDescription.setInterval(200);
        taskDescription.setInterval(JOB_INTERVAL * 60 * 1000L);

        Map<String, Object> resources = new HashMap<String, Object>();

        TaskScheduler taskScheduler =
                TaskSchedulerFactory.getTaskScheduler(TASK_ID);
View Full Code Here

            // the job is done, just exit
            return;
        }*/
        String taskName = UUIDGenerator.generateUUID();

        TaskDescription taskDescription = new TaskDescription();
        taskDescription.setName(taskName);
        taskDescription.setGroup(BillingConstants.GROUP_ID);
        taskDescription.setCron(schedulerContext.getCronString());
        // we are triggering only at the period
        /*Date now = new Date();
        Date nextDateToTrigger = new Date(now.getTime() + nextToTrigger);
        */
        //taskDescription.setStartTime(nextDateToTrigger);
View Full Code Here

    private static void initializeScheduling(Task throttlingTask) {
        // generate tasks
        String taskName = UUIDGenerator.generateUUID();
        String groupId = UUIDGenerator.generateUUID();

        TaskDescription taskDescription = new TaskDescription();
        taskDescription.setName(taskName);
        taskDescription.setGroup(groupId);
        // we are triggering only at the period

        taskDescription.setInterval(throttlingTask.getTriggerInterval());

        //Delay first run by given minutes
        Calendar startTime = Calendar.getInstance();
        startTime.add(Calendar.MILLISECOND, throttlingTask.getStartDelayInterval());
        taskDescription.setStartTime(startTime.getTime());

        Map<String, Object> resources = new HashMap<String, Object>();
        resources.put(ThrottlingJob.THROTTLING_TASK_CONTEXT_KEY, throttlingTask);

        TaskScheduler taskScheduler = TaskSchedulerFactory.getTaskScheduler(THROTTLING_TASK_ID);
View Full Code Here

            } else if (SynapseAppDeployerConstants.MEDIATOR_TYPE.equals(type)) {
                mediatorList.add(instanceName);
            } else if (SynapseAppDeployerConstants.TASK_TYPE.equals(type)) {
                Startup task = SynapseAppServiceComponent.getScService().
                        getSynapseConfiguration().getStartup(instanceName);
                TaskDescription taskDescription = ((SimpleQuartz) task).getTaskDescription();
                TaskMetadata taskMetadata = new TaskMetadata();
                taskMetadata.setName(taskDescription.getName());
                taskMetadata.setGroupName(taskDescription.getGroup());
                taskList.add(taskMetadata);
            }
        }

        // Set found artifacts in the data object
View Full Code Here

        if (repository == null) {
            return taskDescriptions;
        }
        Iterator<TaskDescription> iterator = repository.getAllTaskDescriptions();
        while (iterator.hasNext()) {
            TaskDescription taskDescription = iterator.next();
            if (taskDescription != null) {
                taskDescriptions.add(taskDescription);
            }
        }
        if (log.isDebugEnabled()) {
View Full Code Here

            log.info("Throttling manager Validation info service Disabled");
        } else {
            String taskName = UUIDGenerator.generateUUID();
            String groupId = UUIDGenerator.generateUUID();

            TaskDescription taskDescription = new TaskDescription();
            taskDescription.setName(taskName);
            taskDescription.setGroup(groupId);
            // we are triggering only at the period

            taskDescription.setInterval(throttlingTask.getTriggerInterval());

            //Delay first run by given minutes
            Calendar startTime = Calendar.getInstance();
            startTime.add(Calendar.MILLISECOND, throttlingTask.getStartDelayInterval());
            taskDescription.setStartTime(startTime.getTime());

            Map<String, Object> resources = new HashMap<String, Object>();
            resources.put(ThrottlingJob.THROTTLING_TASK_CONTEXT_KEY, throttlingTask);

            TaskScheduler taskScheduler = TaskSchedulerFactory.getTaskScheduler(THROTTLING_TASK_ID);
View Full Code Here

            Map<String, Object> dataMap = job.getJobDataMap();
            dataMap.put(AutoscalingJob.AUTOSCALER_TASK, task);
            dataMap.put(AutoscalingJob.SYNAPSE_ENVI, synapseEnv);

            final TaskDescription taskDescription = new TaskDescription();
            taskDescription.setTaskClass(ServiceRequestsInFlightAutoscaler.class.getName());
            taskDescription.setName("autoscaler");
            //taskDescription.setCount(SimpleTrigger.REPEAT_INDEFINITELY);

            int interval = AutoscalerTaskDSHolder.getInstance().getLoadBalancerConfig().getAutoscalerTaskInterval();
            taskDescription.setInterval(interval);
            taskDescription.setStartTime(new Date(System.currentTimeMillis() + (interval*2)));

            TaskSchedulingManager scheduler = new TaskSchedulingManager();
            scheduler.scheduleTask(taskDescription, dataMap, configurationContext);


View Full Code Here

            String taskName, ConfigurationContext configurationContext) {
        if (log.isDebugEnabled()) {
            log.debug("Returning a Start up : " + taskName + " from the configuration");
        }

        TaskDescription taskDescription = getTaskDescriptionRepository(
                configurationContext).getTaskDescription(taskName);

        if (taskDescription != null) {
            if (log.isDebugEnabled()) {
                log.debug("Returning a Task Description : " + taskDescription);
View Full Code Here

                                                                          XMLStreamException {
        OMElement taskElement = AXIOMUtil.stringToOM(taskElementString);
        if (log.isDebugEnabled()) {
            log.debug("Add TaskDescription - Get a Task configuration  :" + taskElement);
        }
        TaskDescription taskDescription = validateAndCreate(taskElement);

        try {
            addTaskDescription(taskDescription);
        } catch (Exception e) {
            try {
                getTaskManager().deleteTaskDescription(taskDescription.getName(),
                        taskDescription.getGroup());
            } catch (Exception ignored) {
            }
            handleException("Error creating a task : " + e.getMessage(), e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.synapse.task.TaskDescription

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.