You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@syncope.apache.org by giacomolm <gi...@git.apache.org> on 2015/05/28 17:36:00 UTC

[GitHub] syncope pull request: [SYNCOPE-660] Added console utilities for ru...

GitHub user giacomolm opened a pull request:

    https://github.com/apache/syncope/pull/6

    [SYNCOPE-660] Added console utilities for runtime task management

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/giacomolm/syncope 1_2_X

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/syncope/pull/6.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #6
    
----
commit cdac2a5e277d3b61b1d2a739494869ca72f52695
Author: giacomolm <gi...@hotmail.it>
Date:   2015-05-28T15:27:12Z

    [SYNCOPE-660] Added console utilities for runtime task management

commit 6408db5bdc853f31d91d81e0593353e99e3d1f0c
Author: giacomolm <gi...@hotmail.it>
Date:   2015-05-28T15:27:44Z

    Merge branch '1_2_X' of https://github.com/apache/syncope into 1_2_X

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request: [SYNCOPE-660] Added console utilities for ru...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/6#discussion_r31246454
  
    --- Diff: console/src/main/java/org/apache/syncope/console/pages/panels/RuntimePanel.java ---
    @@ -0,0 +1,108 @@
    +/*
    + * 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.syncope.console.pages.panels;
    +
    +import org.apache.syncope.console.rest.JobRestClient;
    +import org.apache.syncope.console.wicket.ajax.markup.html.ClearIndicatingAjaxLink;
    +import org.apache.wicket.PageReference;
    +import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
    +import org.apache.wicket.ajax.AjaxRequestTarget;
    +import org.apache.wicket.markup.html.panel.Fragment;
    +import org.apache.wicket.model.IModel;
    +import org.apache.wicket.markup.html.panel.Panel;
    +
    +public class RuntimePanel extends Panel {
    +
    +    private static final long serialVersionUID = 1L;
    +
    +    private boolean latestStatus;
    +
    +    protected Fragment fragmentStop, fragmentSpinner;
    +
    +    public AbstractAjaxTimerBehavior timer;
    +
    +    final PageReference pageRef;
    --- End diff --
    
    please set scope (private?)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request: [SYNCOPE-660] Added console utilities for ru...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/6#discussion_r31246416
  
    --- Diff: console/src/main/java/org/apache/syncope/console/pages/panels/RuntimePanel.java ---
    @@ -0,0 +1,108 @@
    +/*
    + * 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.syncope.console.pages.panels;
    +
    +import org.apache.syncope.console.rest.JobRestClient;
    +import org.apache.syncope.console.wicket.ajax.markup.html.ClearIndicatingAjaxLink;
    +import org.apache.wicket.PageReference;
    +import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
    +import org.apache.wicket.ajax.AjaxRequestTarget;
    +import org.apache.wicket.markup.html.panel.Fragment;
    +import org.apache.wicket.model.IModel;
    +import org.apache.wicket.markup.html.panel.Panel;
    +
    +public class RuntimePanel extends Panel {
    +
    +    private static final long serialVersionUID = 1L;
    --- End diff --
    
    Please generate this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request: [SYNCOPE-660] Added console utilities for ru...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/6#discussion_r31246879
  
    --- Diff: console/src/main/java/org/apache/syncope/console/rest/ReportRestClient.java ---
    @@ -105,4 +108,24 @@ public void deleteExecution(final long reportExecId) {
         public Response exportExecutionResult(final Long executionId, final ReportExecExportFormat fmt) {
             return getService(ReportService.class).exportExecutionResult(executionId, fmt);
         }
    +
    +    @Override
    +    public boolean isJobRunning(final long reportId) {
    +        for (ReportExecTO reportExecTO : getService(ReportService.class).listJobs(JobStatusType.RUNNING)) {
    +            if (reportExecTO.getReport() == reportId) {
    +                return true;
    +            }
    +        }
    +        return false;
    +    }
    +
    +    @Override
    +    public void startJob(final long taskId) {
    +        getService(ReportService.class).actionJob(taskId, JobAction.START);
    +    }
    +
    +    @Override
    +    public void stopJob(final long taskId) {
    --- End diff --
    
    reportId


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request: [SYNCOPE-660] Added console utilities for ru...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/6#discussion_r31246817
  
    --- Diff: console/src/main/java/org/apache/syncope/console/rest/JobRestClient.java ---
    @@ -0,0 +1,31 @@
    +/*
    + * 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.syncope.console.rest;
    +
    +import org.springframework.stereotype.Component;
    +
    +@Component
    +public abstract class JobRestClient extends BaseRestClient{
    +
    +    public abstract boolean isJobRunning(final long reportId);
    --- End diff --
    
    `reportId` or `taskId`? Just put `id`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request: [SYNCOPE-660] Added console utilities for ru...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/6#discussion_r31247288
  
    --- Diff: core/src/main/java/org/apache/syncope/core/rest/controller/AbstractJobController.java ---
    @@ -158,7 +158,19 @@ protected void actionJob(final String jobName, final JobAction action) {
                     if (scheduler.getScheduler().checkExists(jobKey)) {
                         switch (action) {
                             case START:
    -                            scheduler.getScheduler().triggerJob(jobKey);
    +                            Long currentId = getIdFromJobName(jobKey);
    +                            boolean found = false;
    +                            //Two or more equals jobs cannot be executed concurrently
    +                            for (JobExecutionContext jec : scheduler.getScheduler().getCurrentlyExecutingJobs()) {
    --- End diff --
    
    Please use plain `for` with `found` as guard, thus avoiding `break`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request: [SYNCOPE-660] Added console utilities for ru...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/6#discussion_r31246625
  
    --- Diff: console/src/main/java/org/apache/syncope/console/pages/panels/RuntimePanel.java ---
    @@ -0,0 +1,108 @@
    +/*
    + * 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.syncope.console.pages.panels;
    +
    +import org.apache.syncope.console.rest.JobRestClient;
    +import org.apache.syncope.console.wicket.ajax.markup.html.ClearIndicatingAjaxLink;
    +import org.apache.wicket.PageReference;
    +import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
    +import org.apache.wicket.ajax.AjaxRequestTarget;
    +import org.apache.wicket.markup.html.panel.Fragment;
    +import org.apache.wicket.model.IModel;
    +import org.apache.wicket.markup.html.panel.Panel;
    +
    +public class RuntimePanel extends Panel {
    +
    +    private static final long serialVersionUID = 1L;
    +
    +    private boolean latestStatus;
    +
    +    protected Fragment fragmentStop, fragmentSpinner;
    +
    +    public AbstractAjaxTimerBehavior timer;
    +
    +    final PageReference pageRef;
    +
    +    private final long jobId;
    +
    +    private final JobRestClient jobRestClient;
    +
    +    public RuntimePanel(final String componentId, final IModel<?> model, final PageReference pageRef, final long jobId,
    +            final JobRestClient jobRestClient) {
    +        super(componentId, model);
    +        this.pageRef = pageRef;
    +        this.jobId = jobId;
    +        this.jobRestClient = jobRestClient;
    +        latestStatus = false;
    +        this.refresh();
    +
    +    }
    +
    +    public void refresh() {
    +        boolean currentStatus = jobRestClient.isJobRunning(jobId);
    +        if (currentStatus == true && latestStatus == false) {
    +            setRunning();
    +        } else if (currentStatus == false) {
    +            setNotRunning();
    +        }
    +
    +        latestStatus = currentStatus;
    +
    +    }
    +
    +    public void setRunning() {
    +        fragmentStop = new Fragment("panelStop", "fragmentStop", this);
    +        fragmentStop.addOrReplace(new ClearIndicatingAjaxLink<Void>("stopLink", pageRef) {
    +
    +            private static final long serialVersionUID = -7978723352517770644L;
    +
    +            @Override
    +            protected void onClickInternal(final AjaxRequestTarget target) {
    +
    --- End diff --
    
    Empty line


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request: [SYNCOPE-660] Added console utilities for ru...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/6#discussion_r31246542
  
    --- Diff: console/src/main/java/org/apache/syncope/console/pages/panels/RuntimePanel.java ---
    @@ -0,0 +1,108 @@
    +/*
    + * 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.syncope.console.pages.panels;
    +
    +import org.apache.syncope.console.rest.JobRestClient;
    +import org.apache.syncope.console.wicket.ajax.markup.html.ClearIndicatingAjaxLink;
    +import org.apache.wicket.PageReference;
    +import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
    +import org.apache.wicket.ajax.AjaxRequestTarget;
    +import org.apache.wicket.markup.html.panel.Fragment;
    +import org.apache.wicket.model.IModel;
    +import org.apache.wicket.markup.html.panel.Panel;
    +
    +public class RuntimePanel extends Panel {
    +
    +    private static final long serialVersionUID = 1L;
    +
    +    private boolean latestStatus;
    +
    +    protected Fragment fragmentStop, fragmentSpinner;
    +
    +    public AbstractAjaxTimerBehavior timer;
    +
    +    final PageReference pageRef;
    +
    +    private final long jobId;
    +
    +    private final JobRestClient jobRestClient;
    +
    +    public RuntimePanel(final String componentId, final IModel<?> model, final PageReference pageRef, final long jobId,
    +            final JobRestClient jobRestClient) {
    +        super(componentId, model);
    +        this.pageRef = pageRef;
    +        this.jobId = jobId;
    +        this.jobRestClient = jobRestClient;
    +        latestStatus = false;
    +        this.refresh();
    --- End diff --
    
    Non-final method called in constructor?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request: [SYNCOPE-660] Added console utilities for ru...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on the pull request:

    https://github.com/apache/syncope/pull/6#issuecomment-106742950
  
    LGTM: please go ahead and merge


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request: [SYNCOPE-660] Added console utilities for ru...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/6#discussion_r31246859
  
    --- Diff: console/src/main/java/org/apache/syncope/console/rest/ReportRestClient.java ---
    @@ -105,4 +108,24 @@ public void deleteExecution(final long reportExecId) {
         public Response exportExecutionResult(final Long executionId, final ReportExecExportFormat fmt) {
             return getService(ReportService.class).exportExecutionResult(executionId, fmt);
         }
    +
    +    @Override
    +    public boolean isJobRunning(final long reportId) {
    +        for (ReportExecTO reportExecTO : getService(ReportService.class).listJobs(JobStatusType.RUNNING)) {
    +            if (reportExecTO.getReport() == reportId) {
    +                return true;
    +            }
    +        }
    +        return false;
    +    }
    +
    +    @Override
    +    public void startJob(final long taskId) {
    --- End diff --
    
    reportId


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request: [SYNCOPE-660] Added console utilities for ru...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/syncope/pull/6


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request: [SYNCOPE-660] Added console utilities for ru...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/6#discussion_r31246483
  
    --- Diff: console/src/main/java/org/apache/syncope/console/pages/panels/RuntimePanel.java ---
    @@ -0,0 +1,108 @@
    +/*
    + * 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.syncope.console.pages.panels;
    +
    +import org.apache.syncope.console.rest.JobRestClient;
    +import org.apache.syncope.console.wicket.ajax.markup.html.ClearIndicatingAjaxLink;
    +import org.apache.wicket.PageReference;
    +import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
    +import org.apache.wicket.ajax.AjaxRequestTarget;
    +import org.apache.wicket.markup.html.panel.Fragment;
    +import org.apache.wicket.model.IModel;
    +import org.apache.wicket.markup.html.panel.Panel;
    +
    +public class RuntimePanel extends Panel {
    +
    +    private static final long serialVersionUID = 1L;
    +
    +    private boolean latestStatus;
    +
    +    protected Fragment fragmentStop, fragmentSpinner;
    --- End diff --
    
    Why protected?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request: [SYNCOPE-660] Added console utilities for ru...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/6#discussion_r31246599
  
    --- Diff: console/src/main/java/org/apache/syncope/console/pages/panels/RuntimePanel.java ---
    @@ -0,0 +1,108 @@
    +/*
    + * 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.syncope.console.pages.panels;
    +
    +import org.apache.syncope.console.rest.JobRestClient;
    +import org.apache.syncope.console.wicket.ajax.markup.html.ClearIndicatingAjaxLink;
    +import org.apache.wicket.PageReference;
    +import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
    +import org.apache.wicket.ajax.AjaxRequestTarget;
    +import org.apache.wicket.markup.html.panel.Fragment;
    +import org.apache.wicket.model.IModel;
    +import org.apache.wicket.markup.html.panel.Panel;
    +
    +public class RuntimePanel extends Panel {
    +
    +    private static final long serialVersionUID = 1L;
    +
    +    private boolean latestStatus;
    +
    +    protected Fragment fragmentStop, fragmentSpinner;
    +
    +    public AbstractAjaxTimerBehavior timer;
    +
    +    final PageReference pageRef;
    +
    +    private final long jobId;
    +
    +    private final JobRestClient jobRestClient;
    +
    +    public RuntimePanel(final String componentId, final IModel<?> model, final PageReference pageRef, final long jobId,
    +            final JobRestClient jobRestClient) {
    +        super(componentId, model);
    +        this.pageRef = pageRef;
    +        this.jobId = jobId;
    +        this.jobRestClient = jobRestClient;
    +        latestStatus = false;
    +        this.refresh();
    +
    +    }
    +
    +    public void refresh() {
    +        boolean currentStatus = jobRestClient.isJobRunning(jobId);
    +        if (currentStatus == true && latestStatus == false) {
    +            setRunning();
    +        } else if (currentStatus == false) {
    +            setNotRunning();
    +        }
    +
    +        latestStatus = currentStatus;
    +
    --- End diff --
    
    Empty line


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] syncope pull request: [SYNCOPE-660] Added console utilities for ru...

Posted by ilgrosso <gi...@git.apache.org>.
Github user ilgrosso commented on a diff in the pull request:

    https://github.com/apache/syncope/pull/6#discussion_r31246708
  
    --- Diff: console/src/main/java/org/apache/syncope/console/pages/panels/RuntimePanel.java ---
    @@ -0,0 +1,108 @@
    +/*
    + * 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.syncope.console.pages.panels;
    +
    +import org.apache.syncope.console.rest.JobRestClient;
    +import org.apache.syncope.console.wicket.ajax.markup.html.ClearIndicatingAjaxLink;
    +import org.apache.wicket.PageReference;
    +import org.apache.wicket.ajax.AbstractAjaxTimerBehavior;
    +import org.apache.wicket.ajax.AjaxRequestTarget;
    +import org.apache.wicket.markup.html.panel.Fragment;
    +import org.apache.wicket.model.IModel;
    +import org.apache.wicket.markup.html.panel.Panel;
    +
    +public class RuntimePanel extends Panel {
    +
    +    private static final long serialVersionUID = 1L;
    +
    +    private boolean latestStatus;
    +
    +    protected Fragment fragmentStop, fragmentSpinner;
    +
    +    public AbstractAjaxTimerBehavior timer;
    +
    +    final PageReference pageRef;
    +
    +    private final long jobId;
    +
    +    private final JobRestClient jobRestClient;
    +
    +    public RuntimePanel(final String componentId, final IModel<?> model, final PageReference pageRef, final long jobId,
    +            final JobRestClient jobRestClient) {
    +        super(componentId, model);
    +        this.pageRef = pageRef;
    +        this.jobId = jobId;
    +        this.jobRestClient = jobRestClient;
    +        latestStatus = false;
    +        this.refresh();
    +
    +    }
    +
    +    public void refresh() {
    +        boolean currentStatus = jobRestClient.isJobRunning(jobId);
    +        if (currentStatus == true && latestStatus == false) {
    --- End diff --
    
    Please rewrite this as `if (currentStatus && !latestStatus)`...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---