Package org.apache.oozie

Examples of org.apache.oozie.SLAEventBean


     * @param slaId sla id
     * @param status sla status
     * @throws Exception thrown if unable to create sla bean
     */
    protected void addRecordToSLAEventTable(String slaId, SLAEvent.Status status) throws Exception {
        SLAEventBean sla = new SLAEventBean();
        sla.setSlaId(slaId);
        sla.setAppName("app-name");
        sla.setParentClientId("parent-child-id");
        sla.setParentSlaId("parent-sla-id");
        sla.setExpectedStart(new Date());
        sla.setExpectedEnd(new Date());
        sla.setNotificationMsg("notification-msg");
        sla.setAlertContact("alert-contact");
        sla.setDevContact("dev-contact");
        sla.setQaContact("qa-contact");
        sla.setSeContact("se-contact");
        sla.setAlertFrequency("alert-frequency");
        sla.setAlertPercentage("alert-percentage");
        sla.setUpstreamApps("upstream-apps");
        sla.setAppType(SLAEvent.SlaAppType.WORKFLOW_JOB);
        sla.setUser(getTestUser());
        sla.setGroupName(getTestGroup());
        sla.setJobStatus(status);
        sla.setStatusTimestamp(new Date());

        try {
            JPAService jpaService = Services.get().get(JPAService.class);
            assertNotNull(jpaService);
            SLAEventInsertJPAExecutor slaInsertCmd = new SLAEventInsertJPAExecutor(sla);
View Full Code Here


        // System.out.println("BBBBB SLA added");
        if (eSla == null) {
            return;
        }
        // System.out.println("Writing REG AAAAA " + slaId);
        SLAEventBean sla = new SLAEventBean();
        // sla.setClientId(getTagElement( eSla, "client-id"));
        // sla.setClientId(getClientId());
        sla.setAppName(getTagElement(eSla, "app-name"));
        sla.setParentClientId(getTagElement(eSla, "parent-child-id"));
        sla.setParentSlaId(getTagElement(eSla, "parent-sla-id"));
        String strNominalTime = getTagElement(eSla, "nominal-time");
        // System.out.println("AAAAA SLA nominal time "+ strNominalTime);
        if (strNominalTime == null || strNominalTime.length() == 0) {
            throw new RuntimeException("Nominal time is required"); // TODO:
            // change to
            // CommandException
        }
        Date nominalTime = DateUtils.parseDateUTC(strNominalTime);
        // Setting expected start time
        String strRelExpectedStart = getTagElement(eSla, "should-start");
        if (strRelExpectedStart == null || strRelExpectedStart.length() == 0) {
            throw new RuntimeException("should-start can't be empty");
        }
        int relExpectedStart = Integer.parseInt(strRelExpectedStart);
        if (relExpectedStart < 0) {
            sla.setExpectedStart(null);
        }
        else {
            Date expectedStart = new Date(nominalTime.getTime() + relExpectedStart * 60 * 1000);
            sla.setExpectedStart(expectedStart);
            // sla.setExpectedStart(nominalTime);
        }

        // Setting expected end time
        String strRelExpectedEnd = getTagElement(eSla, "should-end");
        if (strRelExpectedEnd == null || strRelExpectedEnd.length() == 0) {
            throw new RuntimeException("should-end can't be empty");
        }
        int relExpectedEnd = Integer.parseInt(strRelExpectedEnd);
        if (relExpectedEnd < 0) {
            sla.setExpectedEnd(null);
        }
        else {
            Date expectedEnd = new Date(nominalTime.getTime() + relExpectedEnd * 60 * 1000);
            sla.setExpectedEnd(expectedEnd);
        }

        sla.setNotificationMsg(getTagElement(eSla, "notification-msg"));
        sla.setAlertContact(getTagElement(eSla, "alert-contact"));
        sla.setDevContact(getTagElement(eSla, "dev-contact"));
        sla.setQaContact(getTagElement(eSla, "qa-contact"));
        sla.setSeContact(getTagElement(eSla, "se-contact"));
        sla.setAlertFrequency(getTagElement(eSla, "alert-frequency"));
        sla.setAlertPercentage(getTagElement(eSla, "alert-percentage"));

        sla.setUpstreamApps(getTagElement(eSla, "upstream-apps"));

        // Oozie defined

        sla.setSlaId(slaId);
        sla.setAppType(appType);
        sla.setUser(user);
        sla.setGroupName(groupName);
        sla.setJobStatus(Status.CREATED);
        sla.setStatusTimestamp(new Date());

        SLAStore slaStore = (SLAStore) Services.get().get(StoreService.class).getStore(SLAStore.class, store);
        slaStore.insertSLAEvent(sla);
    }
View Full Code Here

        // System.out.println("BBBBB SLA added");
        if (eSla == null) {
            return;
        }
        //System.out.println("Writing REG AAAAA " + slaId);
        SLAEventBean sla = new SLAEventBean();
        // sla.setClientId(getTagElement( eSla, "client-id"));
        // sla.setClientId(getClientId());
        sla.setAppName(getTagElement(eSla, "app-name"));
        sla.setParentClientId(getTagElement(eSla, "parent-child-id"));
        sla.setParentSlaId(getTagElement(eSla, "parent-sla-id"));
        String strNominalTime = getTagElement(eSla, "nominal-time");
        // System.out.println("AAAAA SLA nominal time "+ strNominalTime);
        if (strNominalTime == null || strNominalTime.length() == 0) {
            throw new RuntimeException("Nominal time is required"); // TODO:
            // change to
            // CommandException
        }
        Date nominalTime = DateUtils.parseDateUTC(strNominalTime);
        // Setting expected start time
        String strRelExpectedStart = getTagElement(eSla, "should-start");
        if (strRelExpectedStart == null || strRelExpectedStart.length() == 0) {
            throw new RuntimeException("should-start can't be empty");
        }
        int relExpectedStart = Integer.parseInt(strRelExpectedStart);
        if (relExpectedStart < 0) {
            sla.setExpectedStart(null);
        }
        else {
            Date expectedStart = new Date(nominalTime.getTime()
                    + relExpectedStart * 60 * 1000);
            sla.setExpectedStart(expectedStart);
            // sla.setExpectedStart(nominalTime);
        }

        // Setting expected end time
        String strRelExpectedEnd = getTagElement(eSla, "should-end");
        if (strRelExpectedEnd == null || strRelExpectedEnd.length() == 0) {
            throw new RuntimeException("should-end can't be empty");
        }
        int relExpectedEnd = Integer.parseInt(strRelExpectedEnd);
        if (relExpectedEnd < 0) {
            sla.setExpectedEnd(null);
        }
        else {
            Date expectedEnd = new Date(nominalTime.getTime() + relExpectedEnd
                    * 60 * 1000);
            sla.setExpectedEnd(expectedEnd);
        }

        sla.setNotificationMsg(getTagElement(eSla, "notification-msg"));
        sla.setAlertContact(getTagElement(eSla, "alert-contact"));
        sla.setDevContact(getTagElement(eSla, "dev-contact"));
        sla.setQaContact(getTagElement(eSla, "qa-contact"));
        sla.setSeContact(getTagElement(eSla, "se-contact"));
        sla.setAlertFrequency(getTagElement(eSla, "alert-frequency"));
        sla.setAlertPercentage(getTagElement(eSla, "alert-percentage"));

        sla.setUpstreamApps(getTagElement(eSla, "upstream-apps"));

        // Oozie defined

        sla.setSlaId(slaId);
        sla.setAppType(appType);
        sla.setUser(user);
        sla.setGroupName(groupName);
        sla.setJobStatus(Status.CREATED);
        sla.setStatusTimestamp(new Date());

        //SLAStore slaStore = (SLAStore) Services.get().get(StoreService.class)
        //        .getStore(SLAStore.class, store);
        //slaStore.insertSLAEvent(sla);

View Full Code Here

        }
    }

    public static void writeSlaStatusEvent(String id,
                                           Status status, Store store, SlaAppType appType) throws Exception {
        SLAEventBean sla = new SLAEventBean();
        sla.setSlaId(id);
        sla.setJobStatus(status);
        sla.setAppType(appType);
        sla.setStatusTimestamp(new Date());
        //System.out.println("Writing STATUS AAAAA " + id);
        SLAStore slaStore = (SLAStore) Services.get().get(StoreService.class)
                .getStore(SLAStore.class, store);
        slaStore.insertSLAEvent(sla);
    }
View Full Code Here

                .getStore(SLAStore.class, store);
        slaStore.insertSLAEvent(sla);
    }

    public static void writeSlaStatusEvent(String id, Status status, SlaAppType appType, XLog log) throws Exception {
        SLAEventBean sla = new SLAEventBean();
        sla.setSlaId(id);
        sla.setJobStatus(status);
        sla.setAppType(appType);
        sla.setStatusTimestamp(new Date());
        // System.out.println("Writing STATUS AAAAA " + id);
        //SLAStore slaStore = (SLAStore) Services.get().get(StoreService.class).getStore(SLAStore.class, store);
        //slaStore.insertSLAEvent(sla);

        JPAService jpaService = Services.get().get(JPAService.class);
View Full Code Here

                                                 SlaAppType appType, String user, String groupName)
            throws Exception {
        if (eSla == null) {
            return;
        }
        SLAEventBean sla = new SLAEventBean();
        // sla.setClientId(getTagElement( eSla, "client-id"));
        // sla.setClientId(getClientId());
        sla.setAppName(getTagElement(eSla, "app-name"));
        sla.setParentClientId(getTagElement(eSla, "parent-child-id"));
        sla.setParentSlaId(getTagElement(eSla, "parent-sla-id"));
        String strNominalTime = getTagElement(eSla, "nominal-time");
        if (strNominalTime == null || strNominalTime.length() == 0) {
            throw new CommandException(ErrorCode.E1101);
        }
        Date nominalTime = DateUtils.parseDateUTC(strNominalTime);
        // Setting expected start time
        String strRelExpectedStart = getTagElement(eSla, "should-start");
        if (strRelExpectedStart == null || strRelExpectedStart.length() == 0) {
            throw new CommandException(ErrorCode.E1102);
        }
        int relExpectedStart = Integer.parseInt(strRelExpectedStart);
        if (relExpectedStart < 0) {
            sla.setExpectedStart(null);
        }
        else {
            Date expectedStart = new Date(nominalTime.getTime()
                    + relExpectedStart * 60 * 1000);
            sla.setExpectedStart(expectedStart);
        }

        // Setting expected end time
        String strRelExpectedEnd = getTagElement(eSla, "should-end");
        if (strRelExpectedEnd == null || strRelExpectedEnd.length() == 0) {
            throw new RuntimeException("should-end can't be empty");
        }
        int relExpectedEnd = Integer.parseInt(strRelExpectedEnd);
        if (relExpectedEnd < 0) {
            sla.setExpectedEnd(null);
        }
        else {
            Date expectedEnd = new Date(nominalTime.getTime() + relExpectedEnd * 60 * 1000);
            sla.setExpectedEnd(expectedEnd);
        }

        sla.setNotificationMsg(getTagElement(eSla, "notification-msg"));
        sla.setAlertContact(getTagElement(eSla, "alert-contact"));
        sla.setDevContact(getTagElement(eSla, "dev-contact"));
        sla.setQaContact(getTagElement(eSla, "qa-contact"));
        sla.setSeContact(getTagElement(eSla, "se-contact"));
        sla.setAlertFrequency(getTagElement(eSla, "alert-frequency"));
        sla.setAlertPercentage(getTagElement(eSla, "alert-percentage"));

        sla.setUpstreamApps(getTagElement(eSla, "upstream-apps"));

        // Oozie defined
        sla.setSlaId(slaId);
        sla.setAppType(appType);
        sla.setUser(user);
        sla.setGroupName(groupName);
        sla.setJobStatus(Status.CREATED);
        sla.setStatusTimestamp(new Date());

        JPAService jpaService = Services.get().get(JPAService.class);

        if (jpaService != null) {
            jpaService.execute(new SLAEventInsertJPAExecutor(sla));
View Full Code Here

     * @param appType SLA app type
     * @throws Exception
     */
    public static void writeSlaStatusEvent(String id,
                                           Status status, SlaAppType appType) throws Exception {
        SLAEventBean sla = new SLAEventBean();
        sla.setSlaId(id);
        sla.setJobStatus(status);
        sla.setAppType(appType);
        sla.setStatusTimestamp(new Date());

        JPAService jpaService = Services.get().get(JPAService.class);

        if (jpaService != null) {
            jpaService.execute(new SLAEventInsertJPAExecutor(sla));
View Full Code Here

        }
        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;
    }
View Full Code Here

     */
    private void writeActionRegistration(String actionXml, CoordinatorActionBean actionBean, String user, String group)
            throws Exception {
        Element eAction = XmlUtils.parseXml(actionXml);
        Element eSla = eAction.getChild("action", eAction.getNamespace()).getChild("info", eAction.getNamespace("sla"));
        SLAEventBean slaEvent = SLADbOperations.createSlaRegistrationEvent(eSla, actionBean.getId(),
                SlaAppType.COORDINATOR_ACTION, user, group, LOG);
        if(slaEvent != null) {
            insertList.add(slaEvent);
        }
    }
View Full Code Here

    }

    private void writeActionRegistration(String actionXml, CoordinatorActionBean actionBean) throws Exception {
        Element eAction = XmlUtils.parseXml(actionXml);
        Element eSla = eAction.getChild("action", eAction.getNamespace()).getChild("info", eAction.getNamespace("sla"));
        SLAEventBean slaEvent = SLADbOperations.createSlaRegistrationEvent(eSla, actionBean.getId(), SlaAppType.COORDINATOR_ACTION, coordJob
                .getUser(), coordJob.getGroup(), LOG);
        if(slaEvent != null) {
            insertList.add(slaEvent);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.oozie.SLAEventBean

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.