-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
17 changed files
with
1,436 additions
and
900 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...com/ericsson/bss/cassandra/ecchronos/rest/osgi/RepairManagementOnDemandRESTComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* Copyright 2023 Telefonaktiebolaget LM Ericsson | ||
* | ||
* Licensed 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 com.ericsson.bss.cassandra.ecchronos.rest.osgi; | ||
|
||
import com.ericsson.bss.cassandra.ecchronos.core.repair.OnDemandRepairScheduler; | ||
import com.ericsson.bss.cassandra.ecchronos.core.repair.types.OnDemandRepair; | ||
import com.ericsson.bss.cassandra.ecchronos.core.utils.ReplicatedTableProvider; | ||
import com.ericsson.bss.cassandra.ecchronos.core.utils.TableReferenceFactory; | ||
import com.ericsson.bss.cassandra.ecchronos.rest.OnDemandRepairManagementREST; | ||
import com.ericsson.bss.cassandra.ecchronos.rest.OnDemandRepairManagementRESTImpl; | ||
import org.osgi.service.component.annotations.Activate; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Reference; | ||
import org.osgi.service.component.annotations.ReferenceCardinality; | ||
import org.osgi.service.component.annotations.ReferencePolicy; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* OSGi component wrapping {@link OnDemandRepairManagementREST} bound with OSGi services. | ||
*/ | ||
@Component | ||
public class RepairManagementOnDemandRESTComponent implements OnDemandRepairManagementREST | ||
{ | ||
@Reference (service = OnDemandRepairScheduler.class, | ||
cardinality = ReferenceCardinality.MANDATORY, | ||
policy = ReferencePolicy.STATIC) | ||
private volatile OnDemandRepairScheduler myOnDemandRepairScheduler; | ||
|
||
@Reference(service = TableReferenceFactory.class, | ||
cardinality = ReferenceCardinality.MANDATORY, | ||
policy = ReferencePolicy.STATIC) | ||
private volatile TableReferenceFactory myTableReferenceFactory; | ||
|
||
@Reference(service = ReplicatedTableProvider.class, | ||
cardinality = ReferenceCardinality.MANDATORY, | ||
policy = ReferencePolicy.STATIC) | ||
private volatile ReplicatedTableProvider myReplicatedTableProvider; | ||
|
||
private volatile OnDemandRepairManagementREST myDelegateOnDemandRESTImpl; | ||
|
||
@Activate | ||
public final synchronized void activate() | ||
{ | ||
myDelegateOnDemandRESTImpl = new OnDemandRepairManagementRESTImpl(myOnDemandRepairScheduler, | ||
myTableReferenceFactory, myReplicatedTableProvider); | ||
} | ||
|
||
@Override | ||
public final ResponseEntity<List<OnDemandRepair>> getRepairs(final String keyspace, | ||
final String table, | ||
final String hostId) | ||
{ | ||
return myDelegateOnDemandRESTImpl.getRepairs(keyspace, table, hostId); | ||
} | ||
|
||
@Override | ||
public final ResponseEntity<List<OnDemandRepair>> getRepairs(final String id, final String hostId) | ||
{ | ||
return myDelegateOnDemandRESTImpl.getRepairs(id, hostId); | ||
} | ||
|
||
@Override | ||
public final ResponseEntity<List<OnDemandRepair>> runRepair(final String keyspace, | ||
final String table, | ||
final boolean isLocal) | ||
{ | ||
return myDelegateOnDemandRESTImpl.runRepair(keyspace, table, isLocal); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...com/ericsson/bss/cassandra/ecchronos/rest/osgi/RepairManagementScheduleRESTComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright 2023 Telefonaktiebolaget LM Ericsson | ||
* | ||
* Licensed 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 com.ericsson.bss.cassandra.ecchronos.rest.osgi; | ||
|
||
import com.ericsson.bss.cassandra.ecchronos.core.repair.RepairScheduler; | ||
import com.ericsson.bss.cassandra.ecchronos.core.repair.types.Schedule; | ||
import com.ericsson.bss.cassandra.ecchronos.rest.ScheduleRepairManagementREST; | ||
import com.ericsson.bss.cassandra.ecchronos.rest.ScheduleRepairManagementRESTImpl; | ||
import org.osgi.service.component.annotations.Activate; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Reference; | ||
import org.osgi.service.component.annotations.ReferenceCardinality; | ||
import org.osgi.service.component.annotations.ReferencePolicy; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* OSGi component wrapping {@link ScheduleRepairManagementREST} bound with OSGi services. | ||
*/ | ||
@Component | ||
public class RepairManagementScheduleRESTComponent implements ScheduleRepairManagementREST | ||
{ | ||
@Reference (service = RepairScheduler.class, | ||
cardinality = ReferenceCardinality.MANDATORY, | ||
policy = ReferencePolicy.STATIC) | ||
private volatile RepairScheduler myRepairScheduler; | ||
|
||
private volatile ScheduleRepairManagementREST myDelegateScheduleRESTImpl; | ||
|
||
@Activate | ||
public final synchronized void activate() | ||
{ | ||
myDelegateScheduleRESTImpl = new ScheduleRepairManagementRESTImpl(myRepairScheduler); | ||
} | ||
|
||
@Override | ||
public final ResponseEntity<List<Schedule>> getSchedules(final String keyspace, final String table) | ||
{ | ||
return myDelegateScheduleRESTImpl.getSchedules(keyspace, table); | ||
} | ||
|
||
@Override | ||
public final ResponseEntity<Schedule> getSchedules(final String id, final boolean full) | ||
{ | ||
return myDelegateScheduleRESTImpl.getSchedules(id, full); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...src/main/java/com/ericsson/bss/cassandra/ecchronos/rest/OnDemandRepairManagementREST.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright 2023 Telefonaktiebolaget LM Ericsson | ||
* | ||
* Licensed 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 com.ericsson.bss.cassandra.ecchronos.rest; | ||
|
||
import com.ericsson.bss.cassandra.ecchronos.core.repair.types.OnDemandRepair; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* On Demand Repair REST interface. | ||
* | ||
* Whenever the interface is changed it must be reflected in docs. | ||
*/ | ||
public interface OnDemandRepairManagementREST | ||
{ | ||
/** | ||
* Get a list of on demand repairs. Will fetch all if no keyspace or table is specified. | ||
* | ||
* @param keyspace The keyspace of the table (optional) | ||
* @param table The table to get status of (optional) | ||
* @param hostId The hostId of the on demand repair (optional) | ||
* @return A list of JSON representations of {@link OnDemandRepair} | ||
*/ | ||
ResponseEntity<List<OnDemandRepair>> getRepairs(String keyspace, String table, String hostId); | ||
/** | ||
* Get a list of on demand repairs associated with a specific id. | ||
* | ||
* @param id The id of the on demand repair | ||
* @param hostId The hostId of the on demand repair (optional) | ||
* @return A list of JSON representations of {@link OnDemandRepair} | ||
*/ | ||
ResponseEntity<List<OnDemandRepair>> getRepairs(String id, String hostId); | ||
|
||
/** | ||
* Schedule an on demand repair to be run on a specific table. | ||
* | ||
* @param keyspace The keyspace of the table | ||
* @param table The table | ||
* @param isLocal If repair should be only run for the local node (optional) | ||
* @return A JSON representation of {@link OnDemandRepair} | ||
*/ | ||
ResponseEntity<List<OnDemandRepair>> runRepair(String keyspace, String table, boolean isLocal); | ||
} |
Oops, something went wrong.