http://git-wip-us.apache.org/repos/asf/syncope/blob/aa8e9f1e/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java index 38f86bc..954b245 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ReportRestClient.java @@ -32,6 +32,7 @@ import org.apache.syncope.common.lib.to.ExecTO; import org.apache.syncope.common.lib.to.JobTO; import org.apache.syncope.common.lib.to.ReportTO; import org.apache.syncope.common.lib.to.ReportTemplateTO; +import org.apache.syncope.common.lib.types.JobAction; import org.apache.syncope.common.lib.types.ReportExecExportFormat; import org.apache.syncope.common.lib.types.ReportTemplateFormat; import org.apache.syncope.common.rest.api.beans.ExecQuery; @@ -56,6 +57,10 @@ public class ReportRestClient extends BaseRestClient return getService(ReportService.class).listJobs(); } + public void actionJob(final String refKey, final JobAction jobAction) { + getService(ReportService.class).actionJob(refKey, jobAction); + } + public void create(final ReportTO reportTO) { getService(ReportService.class).create(reportTO); }
http://git-wip-us.apache.org/repos/asf/syncope/blob/aa8e9f1e/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java index 7ba375d..6e2c271 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java @@ -129,4 +129,12 @@ public class ResourceRestClient extends BaseRestClient { return getService(ResourceService.class).bulkDeassociation(patch); } + + public void setLatestSyncToken(final String key, final String anyType) { + getService(ResourceService.class).setLatestSyncToken(key, anyType); + } + + public void removeSyncToken(final String key, final String anyType) { + getService(ResourceService.class).removeSyncToken(key, anyType); + } } http://git-wip-us.apache.org/repos/asf/syncope/blob/aa8e9f1e/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java index bbec17d..e09259f 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/SchemaRestClient.java @@ -123,6 +123,19 @@ public class SchemaRestClient extends BaseRestClient { return getSchemaNames(SchemaType.VIRTUAL); } + public PlainSchemaTO read(final SchemaType schemaType, final String key) { + return getService(SchemaService.class).read(schemaType, key); + + } + + public void create(final SchemaType schemaType, final AbstractSchemaTO modelObject) { + getService(SchemaService.class).create(schemaType, modelObject); + } + + public void update(final SchemaType schemaType, final AbstractSchemaTO modelObject) { + getService(SchemaService.class).update(schemaType, modelObject); + } + public PlainSchemaTO deletePlainSchema(final String name) { PlainSchemaTO response = getService(SchemaService.class).read(SchemaType.PLAIN, name); getService(SchemaService.class).delete(SchemaType.PLAIN, name); http://git-wip-us.apache.org/repos/asf/syncope/blob/aa8e9f1e/client/console/src/main/java/org/apache/syncope/client/console/rest/SyncopeRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/SyncopeRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/SyncopeRestClient.java new file mode 100644 index 0000000..b479894 --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/SyncopeRestClient.java @@ -0,0 +1,37 @@ +/* + * 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.client.console.rest; + +import org.apache.syncope.common.lib.info.NumbersInfo; +import org.apache.syncope.common.lib.info.SystemInfo; +import org.apache.syncope.common.rest.api.service.SyncopeService; + +public class SyncopeRestClient extends BaseRestClient { + + private static final long serialVersionUID = -9013241672773442286L; + + public NumbersInfo numbers() { + return getService(SyncopeService.class).numbers(); + } + + public SystemInfo system() { + return getService(SyncopeService.class).system(); + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/aa8e9f1e/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java index f1b6ca9..3465c1d 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/TaskRestClient.java @@ -32,6 +32,7 @@ import org.apache.syncope.common.lib.to.ExecTO; import org.apache.syncope.common.lib.to.JobTO; import org.apache.syncope.common.lib.to.PagedResult; import org.apache.syncope.common.lib.types.AnyTypeKind; +import org.apache.syncope.common.lib.types.JobAction; import org.apache.syncope.common.lib.types.TaskType; import org.apache.syncope.common.rest.api.beans.ExecuteQuery; import org.apache.syncope.common.rest.api.beans.ExecQuery; @@ -50,6 +51,10 @@ public class TaskRestClient extends BaseRestClient implements ExecutionRestClien return getService(TaskService.class).listJobs(); } + public void actionJob(final String refKey, final JobAction jobAction) { + getService(TaskService.class).actionJob(refKey, jobAction); + } + public int count(final TaskType kind) { return getService(TaskService.class).list( new TaskQuery.Builder(kind).page(1).size(1).build()).getTotalCount(); http://git-wip-us.apache.org/repos/asf/syncope/blob/aa8e9f1e/client/console/src/main/java/org/apache/syncope/client/console/rest/UserSelfRestClient.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/UserSelfRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/UserSelfRestClient.java new file mode 100644 index 0000000..c796a88 --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/UserSelfRestClient.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.client.console.rest; + +import org.apache.syncope.common.rest.api.service.UserSelfService; + +public class UserSelfRestClient extends BaseRestClient { + + private static final long serialVersionUID = 100731599744900931L; + + public void changePassword(final String password) { + getService(UserSelfService.class).changePassword(password); + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/aa8e9f1e/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobActionPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobActionPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobActionPanel.java index 400e0c7..79e7997 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobActionPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobActionPanel.java @@ -26,6 +26,7 @@ import org.apache.syncope.client.console.commons.Constants; import org.apache.syncope.client.console.pages.BasePage; import org.apache.syncope.client.console.reports.ReportWizardBuilder; import org.apache.syncope.client.console.reports.ReportletDirectoryPanel; +import org.apache.syncope.client.console.rest.NotificationRestClient; import org.apache.syncope.client.console.rest.ReportRestClient; import org.apache.syncope.client.console.rest.TaskRestClient; import org.apache.syncope.client.console.tasks.SchedTaskWizardBuilder; @@ -39,9 +40,6 @@ import org.apache.syncope.common.lib.to.SchedTaskTO; import org.apache.syncope.common.lib.types.JobAction; import org.apache.syncope.common.lib.types.JobType; import org.apache.syncope.common.lib.types.StandardEntitlement; -import org.apache.syncope.common.rest.api.service.NotificationService; -import org.apache.syncope.common.rest.api.service.ReportService; -import org.apache.syncope.common.rest.api.service.TaskService; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy; @@ -63,6 +61,12 @@ public class JobActionPanel extends WizardMgtPanel<Serializable> { private final BaseModal<ReportTO> reportModal; + private final NotificationRestClient notificationRestClient = new NotificationRestClient(); + + private final ReportRestClient reportRestClient = new ReportRestClient(); + + private final TaskRestClient taskRestClient = new TaskRestClient(); + public JobActionPanel( final String id, final JobTO jobTO, @@ -191,18 +195,15 @@ public class JobActionPanel extends WizardMgtPanel<Serializable> { try { switch (jobTO.getType()) { case NOTIFICATION: - SyncopeConsoleSession.get().getService(NotificationService.class). - actionJob(JobAction.STOP); + notificationRestClient.actionJob(JobAction.STOP); break; case REPORT: - SyncopeConsoleSession.get().getService(ReportService.class). - actionJob(jobTO.getRefKey(), JobAction.STOP); + reportRestClient.actionJob(jobTO.getRefKey(), JobAction.STOP); break; case TASK: - SyncopeConsoleSession.get().getService(TaskService.class). - actionJob(jobTO.getRefKey(), JobAction.STOP); + taskRestClient.actionJob(jobTO.getRefKey(), JobAction.STOP); break; default: @@ -228,18 +229,15 @@ public class JobActionPanel extends WizardMgtPanel<Serializable> { try { switch (jobTO.getType()) { case NOTIFICATION: - SyncopeConsoleSession.get().getService(NotificationService.class). - actionJob(JobAction.START); + notificationRestClient.actionJob(JobAction.START); break; case REPORT: - SyncopeConsoleSession.get().getService(ReportService.class). - actionJob(jobTO.getRefKey(), JobAction.START); + reportRestClient.actionJob(jobTO.getRefKey(), JobAction.START); break; case TASK: - SyncopeConsoleSession.get().getService(TaskService.class). - actionJob(jobTO.getRefKey(), JobAction.START); + taskRestClient.actionJob(jobTO.getRefKey(), JobAction.START); break; default: http://git-wip-us.apache.org/repos/asf/syncope/blob/aa8e9f1e/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Relationships.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Relationships.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Relationships.java index b73f73f..b9e4f0f 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Relationships.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/Relationships.java @@ -28,7 +28,6 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.IterableUtils; import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.Predicate; -import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.client.console.commons.Constants; import org.apache.syncope.client.console.commons.SerializableTransformer; import org.apache.syncope.client.console.panels.AnyDirectoryPanel; @@ -42,6 +41,7 @@ import org.apache.syncope.client.console.panels.search.SearchClausePanel; import org.apache.syncope.client.console.panels.search.SearchUtils; import org.apache.syncope.client.console.rest.AnyTypeClassRestClient; import org.apache.syncope.client.console.rest.AnyTypeRestClient; +import org.apache.syncope.client.console.rest.RelationshipTypeRestClient; import org.apache.syncope.client.console.wicket.ajax.form.IndicatorAjaxFormComponentUpdatingBehavior; import org.apache.syncope.client.console.wicket.markup.html.bootstrap.tabs.Accordion; import org.apache.syncope.client.console.wicket.markup.html.form.ActionLink; @@ -59,7 +59,6 @@ import org.apache.syncope.common.lib.to.RelationshipTO; import org.apache.syncope.common.lib.to.RelationshipTypeTO; import org.apache.syncope.common.lib.types.AnyEntitlement; import org.apache.syncope.common.lib.types.AnyTypeKind; -import org.apache.syncope.common.rest.api.service.RelationshipTypeService; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.event.Broadcast; @@ -220,12 +219,14 @@ public class Relationships extends WizardStep { private WizardMgtPanel<AnyWrapper<AnyObjectTO>> anyObjectDirectoryPanel; + private final RelationshipTypeRestClient relationshipTypeRestClient = new RelationshipTypeRestClient(); + public Specification() { super("specification"); rel = new RelationshipTO(); final ArrayList<String> availableRels = CollectionUtils.collect( - SyncopeConsoleSession.get().getService(RelationshipTypeService.class).list(), + relationshipTypeRestClient.list(), EntityTOUtils.<RelationshipTypeTO>keyTransformer(), new ArrayList<String>()); final AjaxDropDownChoicePanel<String> type = new AjaxDropDownChoicePanel<>( http://git-wip-us.apache.org/repos/asf/syncope/blob/aa8e9f1e/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java ---------------------------------------------------------------------- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java index 1264c7a..9592b2f 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/resources/ResourceProvisionPanel.java @@ -47,7 +47,6 @@ import org.apache.syncope.common.lib.to.ProvisionTO; import org.apache.syncope.common.lib.to.ResourceTO; import org.apache.syncope.common.lib.to.OrgUnitTO; import org.apache.syncope.common.lib.types.StandardEntitlement; -import org.apache.syncope.common.rest.api.service.ResourceService; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.event.Broadcast; @@ -65,6 +64,8 @@ public class ResourceProvisionPanel extends AbstractModalPanel<Serializable> { private final ConnectorRestClient connectorRestClient = new ConnectorRestClient(); + private final ResourceRestClient resourceRestClient = new ResourceRestClient(); + private final ResourceTO resourceTO; private Model<OrgUnitTO> baseModel; @@ -239,8 +240,7 @@ public class ResourceProvisionPanel extends AbstractModalPanel<Serializable> { @Override public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) { try { - SyncopeConsoleSession.get().getService(ResourceService.class). - setLatestSyncToken(resourceTO.getKey(), provisionTO.getAnyType()); + resourceRestClient.setLatestSyncToken(resourceTO.getKey(), provisionTO.getAnyType()); SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); } catch (Exception e) { LOG.error("While setting latest sync token for {}/{}", @@ -258,8 +258,7 @@ public class ResourceProvisionPanel extends AbstractModalPanel<Serializable> { @Override public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) { try { - SyncopeConsoleSession.get().getService(ResourceService.class). - removeSyncToken(resourceTO.getKey(), provisionTO.getAnyType()); + resourceRestClient.removeSyncToken(resourceTO.getKey(), provisionTO.getAnyType()); SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED)); } catch (Exception e) { LOG.error("While removing sync token for {}/{}", @@ -326,7 +325,7 @@ public class ResourceProvisionPanel extends AbstractModalPanel<Serializable> { if (connObjectKeyCount != 1) { throw new RuntimeException(provision.getAnyType() + ": " + new StringResourceModel("connObjectKeyValidation", ResourceProvisionPanel.this). - getString()); + getString()); } } } http://git-wip-us.apache.org/repos/asf/syncope/blob/aa8e9f1e/client/console/src/main/resources/org/apache/syncope/client/console/pages/ErrorPage.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ErrorPage.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/ErrorPage.html deleted file mode 100644 index bea9c9f..0000000 --- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/ErrorPage.html +++ /dev/null @@ -1,37 +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. ---> -<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org"> - <wicket:extend> - - <div class="ui-widget"> - <div class="ui-state-error ui-corner-all"> - <p> - <span class="ui-icon ui-icon-alert"></span> - <strong><span wicket:id="errorTitle"/></strong> - <div><span wicket:id="errorMessage"/></div> - <p> - <a href="" wicket:id="home"> - <wicket:message key="home"/> - </a> - </p> - </p> - </div> - </div> - </wicket:extend> -</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/aa8e9f1e/client/console/src/main/resources/org/apache/syncope/client/console/pages/Login.html ---------------------------------------------------------------------- diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Login.html b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Login.html index 68e9283..f5b4c4d 100644 --- a/client/console/src/main/resources/org/apache/syncope/client/console/pages/Login.html +++ b/client/console/src/main/resources/org/apache/syncope/client/console/pages/Login.html @@ -38,6 +38,7 @@ under the License. <img class="login-logo" src="img/logo-green.png" /> <span wicket:id="feedback" role="alert"/> + <div class="box alert-danger" style="padding: 5px;text-align: center;" wicket:id="exceptionMessage"/> <form class="form-signin" wicket:id="login"> <fieldset class="form-group"> http://git-wip-us.apache.org/repos/asf/syncope/blob/aa8e9f1e/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/rest/CamelRoutesRestClient.java ---------------------------------------------------------------------- diff --git a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/rest/CamelRoutesRestClient.java b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/rest/CamelRoutesRestClient.java index 67bd1df..ac3c2aa 100644 --- a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/rest/CamelRoutesRestClient.java +++ b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/rest/CamelRoutesRestClient.java @@ -19,9 +19,11 @@ package org.apache.syncope.client.console.rest; import static org.apache.syncope.client.console.rest.BaseRestClient.getService; + import java.util.Collections; import java.util.List; import org.apache.syncope.client.console.SyncopeConsoleSession; +import org.apache.syncope.common.lib.to.CamelMetrics; import org.apache.syncope.common.lib.to.CamelRouteTO; import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.common.rest.api.service.CamelRouteService; @@ -50,10 +52,14 @@ public class CamelRoutesRestClient extends BaseRestClient { return anyTypeKind == AnyTypeKind.USER ? SyncopeConsoleSession.get().getPlatformInfo().getUserProvisioningManager().contains("Camel") : anyTypeKind == AnyTypeKind.ANY_OBJECT - ? SyncopeConsoleSession.get().getPlatformInfo(). - getAnyObjectProvisioningManager().contains("Camel") - : SyncopeConsoleSession.get().getPlatformInfo(). - getGroupProvisioningManager().contains("Camel"); + ? SyncopeConsoleSession.get().getPlatformInfo(). + getAnyObjectProvisioningManager().contains("Camel") + : SyncopeConsoleSession.get().getPlatformInfo(). + getGroupProvisioningManager().contains("Camel"); + + } + public CamelMetrics metrics() { + return getService(CamelRouteService.class).metrics(); } } http://git-wip-us.apache.org/repos/asf/syncope/blob/aa8e9f1e/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/widgets/CamelMetricsWidget.java ---------------------------------------------------------------------- diff --git a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/widgets/CamelMetricsWidget.java b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/widgets/CamelMetricsWidget.java index 642e4dc..b673bfa 100644 --- a/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/widgets/CamelMetricsWidget.java +++ b/ext/camel/client-console/src/main/java/org/apache/syncope/client/console/widgets/CamelMetricsWidget.java @@ -26,11 +26,10 @@ import java.util.Collections; import java.util.List; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.Transformer; -import org.apache.syncope.client.console.SyncopeConsoleSession; import org.apache.syncope.client.console.annotations.ExtWidget; +import org.apache.syncope.client.console.rest.CamelRoutesRestClient; import org.apache.syncope.client.console.wicket.ajax.IndicatorAjaxTimerBehavior; import org.apache.syncope.common.lib.to.CamelMetrics; -import org.apache.syncope.common.rest.api.service.CamelRouteService; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.markup.html.WebMarkupContainer; @@ -46,6 +45,8 @@ public class CamelMetricsWidget extends BaseExtWidget { private final BarChartPanel chart; + private final CamelRoutesRestClient restClient = new CamelRoutesRestClient(); + public CamelMetricsWidget(final String id, final PageReference pageRef) { super(id, pageRef); @@ -53,7 +54,7 @@ public class CamelMetricsWidget extends BaseExtWidget { container.setOutputMarkupId(true); add(container); - CamelMetrics metrics = SyncopeConsoleSession.get().getService(CamelRouteService.class).metrics(); + CamelMetrics metrics = restClient.metrics(); meanRates = new ArrayList<>(5); for (int i = 0; i < 5; i++) { meanRates.add(metrics.getResponseMeanRates().get(i)); @@ -68,7 +69,7 @@ public class CamelMetricsWidget extends BaseExtWidget { @Override protected void onTimer(final AjaxRequestTarget target) { - CamelMetrics metrics = SyncopeConsoleSession.get().getService(CamelRouteService.class).metrics(); + CamelMetrics metrics = restClient.metrics(); List<CamelMetrics.MeanRate> updatedMeanRates = new ArrayList<>(5); for (int i = 0; i < 5; i++) { updatedMeanRates.add(metrics.getResponseMeanRates().get(i));