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