001    /**
002     * Copyright (c) 2010 Yahoo! Inc. All rights reserved.
003     * Licensed under the Apache License, Version 2.0 (the "License");
004     * you may not use this file except in compliance with the License.
005     * You may obtain a copy of the License at
006     *
007     *   http://www.apache.org/licenses/LICENSE-2.0
008     *
009     *  Unless required by applicable law or agreed to in writing, software
010     *  distributed under the License is distributed on an "AS IS" BASIS,
011     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012     *  See the License for the specific language governing permissions and
013     *  limitations under the License. See accompanying LICENSE file.
014     */
015    package org.apache.oozie.service;
016    
017    import org.apache.oozie.ErrorCode;
018    import org.apache.oozie.store.CoordinatorStore;
019    import org.apache.oozie.store.SLAStore;
020    import org.apache.oozie.store.Store;
021    import org.apache.oozie.store.StoreException;
022    
023    public class SLAStoreService implements Service {
024    
025        @Override
026        public void destroy() {
027            // TODO Auto-generated method stub
028    
029        }
030    
031        @Override
032        public Class<? extends Service> getInterface() {
033            // TODO Auto-generated method stub
034            return SLAStoreService.class;
035        }
036    
037        /**
038         * Return a SLA store instance with a fresh transaction. <p/> The LSA store has to be committed and then closed to
039         * commit changes, if only close it rolls back.
040         *
041         * @return a SLA store.
042         * @throws StoreException thrown if the SLA store could not be created.
043         */
044        public SLAStore create() throws StoreException {
045            try {
046                return new SLAStore();
047            }
048            catch (Exception ex) {
049                throw new StoreException(ErrorCode.E0600, ex.getMessage(), ex);
050            }
051        }
052    
053        /**
054         * Return a SLA store instance with an existing transaction. <p/> The SLA store has to be committed and then closed
055         * to commit changes, if only close it rolls back.
056         *
057         * @return a SLA store.
058         * @throws StoreException thrown if the SLA store could not be created.
059         */
060        public <S extends Store> SLAStore create(S store) throws StoreException {
061            try {
062                return new SLAStore(store);
063            }
064            catch (Exception ex) {
065                throw new StoreException(ErrorCode.E0600, ex.getMessage(), ex);// TODO:
066                // Error
067                // CODE
068            }
069        }
070    
071        @Override
072        public void init(Services services) throws ServiceException {
073            // TODO Auto-generated method stub
074    
075        }
076    
077    }