Subversion Repositories XServices

Rev

Rev 72 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

/*
 *   Copyright 2011 Brian Rosenberger (Brutex Network)
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */

package net.brutex.xservices.ws;

import java.util.List;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlElement;

import net.brutex.xservices.types.ScheduledJob;
import net.brutex.xservices.types.SchedulerStatisticsType;
import net.brutex.xservices.util.BrutexNamespaces;

import org.apache.cxf.annotations.WSDLDocumentation;

/**
 * Job management services.
 * @author Brian Rosenberger
 * @since 0.5.0
 *
 */
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES)
public interface JobService {
        
        public static final String SERVICE_NAME = "JobService";
        final String OPERATION_GETJOBLIST = "getJobs";
        final String OPERATION_SCHEDULEJOB = "scheduleJob";
        final String OPERATION_GETJOB = "getJob";
        final String OPERATION_DELETEJOB = "deleteJob";
        final String OPERATION_GETSTATISTICS = "getStatistics";
        final String PARAM_JOB = "job";
        
        
        /**
         * Get a full list of all scheduled jobs.
         * 
         * @return List of scheduled jobs
         * @throws XServicesFault
         */
        @WebMethod(operationName=OPERATION_GETJOBLIST)
        @WSDLDocumentation(value="Get list of scheduled jobs")
        public abstract List<ScheduledJob> getJobList() throws XServicesFault;
        
        /**
         * Add a job to the scheduler.
         * 
         * @param job
         * @return The unique identifier of the job.
         * @throws XServicesFault
         */
        @WebMethod(operationName=OPERATION_SCHEDULEJOB)
        @WSDLDocumentation(value="Schedule a job")
        public abstract String scheduleJob(
                        @WebParam(name=PARAM_JOB) @XmlElement(required=true) ScheduledJob job)
                        throws XServicesFault;
        
        /**
         * Get a job by id.
         * 
         * @param uuid
         * @return Job details
         * @throws XServicesFault
         */
        @WebMethod(operationName=OPERATION_GETJOB)
        @WSDLDocumentation(value="Get a job by id")
        public abstract ScheduledJob getJob(
                        @WebParam(name="id") @XmlElement(required=true) String uuid) throws XServicesFault;
        
        /**
         * Delete a job from scheduler.
         * 
         * @param uuid Id of the job that should be deleted
         * @throws XServicesFault
         */
        @WebMethod(operationName=OPERATION_DELETEJOB)
        @WSDLDocumentation(value="Delete a scheduled job.")
        public abstract void deleteJob(
                        @WebParam(name="id") @XmlElement(required=true) String uuid) throws XServicesFault;
        
        /**
         * Get statisctis about the scheduler
         * @throws XServicesFault 
         */
        @WebMethod(operationName=OPERATION_GETSTATISTICS)
        @WSDLDocumentation(value="Get scheduler statistics")
        public abstract SchedulerStatisticsType getStatistics() throws XServicesFault;
        
}