OOZIE-2879 Remove unused class SLAStore and related classes (asalamon74 via kmarton)
diff --git a/core/src/main/java/org/apache/oozie/service/SLAStoreService.java b/core/src/main/java/org/apache/oozie/service/SLAStoreService.java
deleted file mode 100644
index 160329c..0000000
--- a/core/src/main/java/org/apache/oozie/service/SLAStoreService.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.oozie.service;
-
-import org.apache.oozie.ErrorCode;
-import org.apache.oozie.store.SLAStore;
-import org.apache.oozie.store.Store;
-import org.apache.oozie.store.StoreException;
-
-public class SLAStoreService implements Service {
-
- @Override
- public void destroy() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public Class<? extends Service> getInterface() {
- // TODO Auto-generated method stub
- return SLAStoreService.class;
- }
-
- /**
- * Return a SLA store instance with a fresh transaction. <p> The LSA store has to be committed and then closed to
- * commit changes, if only close it rolls back.
- *
- * @return a SLA store.
- * @throws StoreException thrown if the SLA store could not be created.
- */
- public SLAStore create() throws StoreException {
- try {
- return new SLAStore();
- }
- catch (Exception ex) {
- throw new StoreException(ErrorCode.E0600, ex.getMessage(), ex);
- }
- }
-
- /**
- * Return a SLA store instance with an existing transaction. <p> The SLA store has to be committed and then closed
- * to commit changes, if only close it rolls back.
- *
- * @param <S> child type of Store
- * @param store store definition
- * @return a SLA store.
- * @throws StoreException thrown if the SLA store could not be created.
- */
- public <S extends Store> SLAStore create(S store) throws StoreException {
- try {
- return new SLAStore(store);
- }
- catch (Exception ex) {
- throw new StoreException(ErrorCode.E0600, ex.getMessage(), ex);// TODO:
- // Error
- // CODE
- }
- }
-
- @Override
- public void init(Services services) throws ServiceException {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/core/src/main/java/org/apache/oozie/service/StoreService.java b/core/src/main/java/org/apache/oozie/service/StoreService.java
index ff7ce1d..2b40334 100644
--- a/core/src/main/java/org/apache/oozie/service/StoreService.java
+++ b/core/src/main/java/org/apache/oozie/service/StoreService.java
@@ -19,7 +19,6 @@
package org.apache.oozie.service;
import org.apache.oozie.store.StoreException;
-import org.apache.oozie.store.SLAStore;
import org.apache.oozie.store.Store;
import org.apache.oozie.store.WorkflowStore;
import org.apache.oozie.ErrorCode;
@@ -43,9 +42,6 @@
if (WorkflowStore.class.equals(klass)) {
return (S) Services.get().get(WorkflowStoreService.class).create();
}
- else if (SLAStore.class.equals(klass)) {
- return (S) Services.get().get(SLAStoreService.class).create();
- }
// to do add checks for other stores - coordinator and SLA stores
throw new StoreException(ErrorCode.E0607, " can not get store StoreService.getStore(Class)", "");
}
@@ -65,9 +61,6 @@
if (WorkflowStore.class.equals(klass)) {
return (S) Services.get().get(WorkflowStoreService.class).create(store);
}
- else if (SLAStore.class.equals(klass)) {
- return (S) Services.get().get(SLAStoreService.class).create(store);
- }
throw new StoreException(ErrorCode.E0607, " StoreService.getStore(Class, store)", "");
}
diff --git a/core/src/main/java/org/apache/oozie/store/SLAStore.java b/core/src/main/java/org/apache/oozie/store/SLAStore.java
deleted file mode 100644
index 5c19f0a..0000000
--- a/core/src/main/java/org/apache/oozie/store/SLAStore.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.oozie.store;
-
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.Callable;
-
-import javax.persistence.EntityManager;
-import org.apache.oozie.ErrorCode;
-import org.apache.oozie.SLAEventBean;
-import org.apache.oozie.executor.jpa.JPAExecutorException;
-import org.apache.oozie.executor.jpa.SLAEventsGetForSeqIdJPAExecutor;
-import org.apache.oozie.service.InstrumentationService;
-import org.apache.oozie.service.JPAService;
-import org.apache.oozie.service.Services;
-import org.apache.oozie.util.Instrumentation;
-import org.apache.oozie.util.ParamChecker;
-
-@Deprecated
-public class SLAStore extends Store {
- private EntityManager entityManager;
- private static final String INSTR_GROUP = "db";
-
- public SLAStore() throws StoreException {
- super();
- entityManager = getEntityManager();
-
- }
-
- public SLAStore(Store store) throws StoreException {
- super(store);
- entityManager = getEntityManager();
- }
-
- /**
- * Create an SLAEventBeane. It also creates the process instance for the job.
- *
- * @param slaEvent sla event bean
- * @throws StoreException is insertion fails
- */
-
- public void insertSLAEvent(final SLAEventBean slaEvent) throws StoreException {
- ParamChecker.notNull(slaEvent, "sLaEvent");
-
- doOperation("insertSLAEvent", new Callable<Void>() {
- public Void call() throws StoreException {
- entityManager.persist(slaEvent);
- return null;
- }
- });
- }
-
- /**
- * Get a list of SLA Events newer than a specific sequence with limit
- * clause.
- *
- * @param seqId sequence id
- * @param limitLen length limit
- * @param lastSeqId last sequence id
- * @return List of SLA Events
- * @throws StoreException if getting events fails
- */
- public List<SLAEventBean> getSLAEventListNewerSeqLimited(final long seqId, final int limitLen, long[] lastSeqId)
- throws StoreException {
- ParamChecker.notNull(seqId, "SLAEventListNewerSeqLimited");
- ParamChecker.checkGTZero(limitLen, "SLAEventListNewerSeqLimited");
-
- lastSeqId[0] = seqId;
-
- List<SLAEventBean> seBeans = (List<SLAEventBean>) doOperation("getSLAEventListNewerSeqLimited",
- new Callable<List<SLAEventBean>>() {
-
- public List<SLAEventBean> call() throws StoreException, JPAExecutorException {
-
- List<SLAEventBean> seBeans;
- try {
-
- JPAService jpaService = Services.get().get(JPAService.class);
- List<SLAEventBean> slaEventList = null;
- long lastSeqId[] = new long[1];
- if (jpaService != null) {
- seBeans = jpaService.execute(new SLAEventsGetForSeqIdJPAExecutor(seqId, limitLen,
- lastSeqId));
- }
- else {
- throw new StoreException(ErrorCode.E0610);
- }
-
- }
- catch (IllegalStateException e) {
- throw new StoreException(ErrorCode.E0601, e.getMessage(), e);
- }
- catch (JPAExecutorException e) {
- throw new JPAExecutorException(ErrorCode.E0610, e.getMessage(), e);
- }
- return seBeans;
- }
- });
- List<SLAEventBean> eventList = new ArrayList<SLAEventBean>();
- for (SLAEventBean j : seBeans) {
- lastSeqId[0] = Math.max(lastSeqId[0], j.getEvent_id());
- eventList.add(j);
- }
- return eventList;
- }
-
- private SLAEventBean copyEventBean(SLAEventBean e) {
- SLAEventBean event = new SLAEventBean();
- event.setAlertContact(e.getAlertContact());
- event.setAlertFrequency(e.getAlertFrequency());
- event.setAlertPercentage(e.getAlertPercentage());
- event.setAppName(e.getAppName());
- event.setAppType(e.getAppType());
- event.setAppTypeStr(e.getAppTypeStr());
- event.setDevContact(e.getDevContact());
- event.setEvent_id(e.getEvent_id());
- event.setEventType(e.getEventType());
- event.setExpectedEnd(e.getExpectedEnd());
- event.setExpectedStart(e.getExpectedStart());
- event.setGroupName(e.getGroupName());
- event.setJobData(e.getJobData());
- event.setJobStatus(e.getJobStatus());
- event.setJobStatusStr(e.getJobStatusStr());
- event.setNotificationMsg(e.getNotificationMsg());
- event.setParentClientId(e.getParentClientId());
- event.setParentSlaId(e.getParentSlaId());
- event.setQaContact(e.getQaContact());
- event.setSeContact(e.getSeContact());
- event.setSlaId(e.getSlaId());
- event.setStatusTimestamp(e.getStatusTimestamp());
- event.setUpstreamApps(e.getUpstreamApps());
- event.setUser(e.getUser());
- return event;
- }
-
- private <V> V doOperation(String name, Callable<V> command) throws StoreException {
- try {
- Instrumentation.Cron cron = new Instrumentation.Cron();
- cron.start();
- V retVal;
- try {
- retVal = command.call();
- }
- finally {
- cron.stop();
- }
- Services.get().get(InstrumentationService.class).get().addCron(INSTR_GROUP, name, cron);
- return retVal;
- }
- catch (StoreException ex) {
- throw ex;
- }
- catch (SQLException ex) {
- throw new StoreException(ErrorCode.E0611, name, ex.getMessage(), ex);
- }
- catch (Exception e) {
- throw new StoreException(ErrorCode.E0607, name, e.getMessage(), e);
- }
- }
-
-}
diff --git a/core/src/main/resources/oozie-default.xml b/core/src/main/resources/oozie-default.xml
index 811c8b9..f33c7b9 100644
--- a/core/src/main/resources/oozie-default.xml
+++ b/core/src/main/resources/oozie-default.xml
@@ -165,7 +165,6 @@
org.apache.oozie.service.LiteWorkflowAppService,
org.apache.oozie.service.JPAService,
org.apache.oozie.service.StoreService,
- org.apache.oozie.service.SLAStoreService,
org.apache.oozie.service.DBLiteWorkflowStoreService,
org.apache.oozie.service.CallbackService,
org.apache.oozie.service.ActionService,
diff --git a/core/src/test/java/org/apache/oozie/store/TestSLAStore.java b/core/src/test/java/org/apache/oozie/store/TestSLAStore.java
deleted file mode 100644
index 7c95718..0000000
--- a/core/src/test/java/org/apache/oozie/store/TestSLAStore.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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 org.apache.oozie.store;
-
-import java.util.List;
-
-import org.apache.oozie.SLAEventBean;
-import org.apache.oozie.service.SLAStoreService;
-import org.apache.oozie.service.Services;
-import org.apache.oozie.test.XTestCase;
-
-public class TestSLAStore extends XTestCase {
- Services services;
- SLAStore store;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- services = new Services();
- services.init();
- store = Services.get().get(SLAStoreService.class).create();
- }
-
- @Override
- protected void tearDown() throws Exception {
- services.destroy();
- super.tearDown();
- }
-
- public void testSLAStore() throws StoreException {
- String slaId = "1";
- try {
- _testInsertEvent(slaId);
- //_testGetSlaEventSeqNewer(0);
- //_testGetSlaEventSeqNewerLimited(0, 10);
- }
- finally {
-
- }
- }
-
- private void _testGetSlaEventSeqNewerLimited(long seqId, int limitLen) {
- // store.beginTrx();
- try {
- long lastSeqId[] = new long[1];
- List<SLAEventBean> slaEvents = store
- .getSLAEventListNewerSeqLimited(seqId, limitLen, lastSeqId);
- //System.out.println("AAA " + slaEvents.size() + " : " + lastSeqId[0]);
- if (slaEvents.size() == 0) {
- fail("Unable to GET Get any record of sequence id greater than ="
- + seqId);
- }
- /*for (int i = 0; i < slaEvents.size(); i++) {
- SLAEventBean event = (SLAEventBean) slaEvents.get(i);
- System.out.println("Limit seq_id " + event.getEvent_id()
- + " SLA IS: " + event.getSlaId());
- }*/
- // store.commitTrx();
- }
- catch (Exception ex) {
- //store.rollbackTrx();
- ex.printStackTrace();
- fail("Unable to GET Get record of sequence id greater than ="
- + seqId);
- }
- }
-
-/* private void _testGetSlaEventSeqNewer(long seqId) {
- store.beginTrx();
- try {
- List<SLAEventBean> slaEvents = store.getSLAEventListNewerSeq(seqId);
- System.out.println("Total # of Records " + slaEvents.size());
- if (slaEvents.size() == 0) {
- fail("Unable to GET Get any record of sequence id greater than ="
- + seqId);
- }
- store.commitTrx();
- }
- catch (Exception ex) {
- store.rollbackTrx();
- ex.printStackTrace();
- fail("Unable to GET Get record of sequence id greater than ="
- + seqId);
- }
- }*/
-
- private void _testInsertEvent(String slaId) {
- SLAEventBean sla = createSLAEvent(slaId);
- store.beginTrx();
- try {
- store.insertSLAEvent(sla);
- store.commitTrx();
- }
- catch (Exception ex) {
- store.rollbackTrx();
- ex.printStackTrace();
- fail("Unable to insert a record into COORD Job ");
- }
- }
-
- private SLAEventBean createSLAEvent(String slaId) {
- SLAEventBean sla = new SLAEventBean();
- sla.setSlaId(slaId);
- // sla.setClientId("GMS");
-
- return sla;
- }
-}
diff --git a/release-log.txt b/release-log.txt
index 3d5f528..89e6392 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
-- Oozie 5.2.0 release (trunk - unreleased)
+OOZIE-2879 Remove unused class SLAStore and related classes (asalamon74 via kmarton)
OOZIE-3510 TestProxyUserService.testInvalidGroup fails if executed by nobody (asalamon74 via kmarton)
OOZIE-3499 [Java 11] Fix TestLiteWorkflowAppParser (kmarton via asalamon74)
OOZIE-3503 TestJavaActionExecutor.testSubmitWithLauncherQueue unit test failure (asalamon74 via kmarton)