mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-16 18:02:05 +02:00
[ONOS-3203] Remove final keyword from method arguements
Removing as requested by Thomas Vachuska so to be consistent with rest of ONOS code. Note : ./tools/build/conf/src/main/resources/onos/pmd.xml deliberately excludes MethodArgumentCouldBeFinal from optimizations.xml Change-Id: Ib1468d5ac39876797b79bd1f6dabd779bfe337bd
This commit is contained in:
parent
e462182180
commit
a5404813fe
@ -73,7 +73,7 @@ public class AlarmsManager implements AlarmService {
|
||||
private final AtomicLong alarmIdGenerator = new AtomicLong(0);
|
||||
|
||||
@Override
|
||||
public Alarm update(final Alarm replacement) {
|
||||
public Alarm update(Alarm replacement) {
|
||||
|
||||
final Alarm found = alarms.get(replacement.id());
|
||||
if (found == null) {
|
||||
@ -87,14 +87,14 @@ public class AlarmsManager implements AlarmService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getActiveAlarmCount(final DeviceId deviceId) {
|
||||
public int getActiveAlarmCount(DeviceId deviceId) {
|
||||
//TODO
|
||||
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
|
||||
}
|
||||
private static final String NOT_SUPPORTED_YET = "Not supported yet.";
|
||||
|
||||
@Override
|
||||
public Alarm getAlarm(final AlarmId alarmId) {
|
||||
public Alarm getAlarm(AlarmId alarmId) {
|
||||
return nullIsNotFound(
|
||||
alarms.get(alarmId),
|
||||
"Alarm is not found");
|
||||
@ -113,7 +113,7 @@ public class AlarmsManager implements AlarmService {
|
||||
|
||||
}
|
||||
|
||||
private static DefaultAlarm generateFake(final DeviceId deviceId, final AlarmId alarmId) {
|
||||
private static DefaultAlarm generateFake(DeviceId deviceId, AlarmId alarmId) {
|
||||
|
||||
return new DefaultAlarm.Builder(
|
||||
alarmId, deviceId, "NE is not reachable", Alarm.SeverityLevel.MAJOR, System.currentTimeMillis()).
|
||||
@ -125,36 +125,36 @@ public class AlarmsManager implements AlarmService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Alarm> getAlarms(final Alarm.SeverityLevel severity) {
|
||||
public Set<Alarm> getAlarms(Alarm.SeverityLevel severity) {
|
||||
//TODO
|
||||
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Alarm> getAlarms(final DeviceId deviceId) {
|
||||
public Set<Alarm> getAlarms(DeviceId deviceId) {
|
||||
//TODO
|
||||
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Alarm> getAlarms(final DeviceId deviceId, final AlarmEntityId source) {
|
||||
public Set<Alarm> getAlarms(DeviceId deviceId, AlarmEntityId source) {
|
||||
//TODO
|
||||
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Alarm> getAlarmsForLink(final ConnectPoint src, final ConnectPoint dst) {
|
||||
public Set<Alarm> getAlarmsForLink(ConnectPoint src, ConnectPoint dst) {
|
||||
//TODO
|
||||
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Alarm> getAlarmsForFlow(final DeviceId deviceId, final long flowId) {
|
||||
public Set<Alarm> getAlarmsForFlow(DeviceId deviceId, long flowId) {
|
||||
//TODO
|
||||
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
|
||||
}
|
||||
|
||||
private void discoverAlarmsForDevice(final DeviceId deviceId) {
|
||||
private void discoverAlarmsForDevice(DeviceId deviceId) {
|
||||
final AlarmId alarmId = new AlarmId(alarmIdGenerator.incrementAndGet());
|
||||
|
||||
// TODO In a new thread invoke SNMP Provider with DeviceId and device type and when done update our of alarms
|
||||
@ -166,14 +166,14 @@ public class AlarmsManager implements AlarmService {
|
||||
private class InternalAlarmListener implements AlarmListener {
|
||||
|
||||
@Override
|
||||
public void event(final AlarmEvent event) {
|
||||
public void event(AlarmEvent event) {
|
||||
// TODO
|
||||
throw new UnsupportedOperationException(NOT_SUPPORTED_YET);
|
||||
}
|
||||
}
|
||||
|
||||
@Activate
|
||||
public void activate(final ComponentContext context) {
|
||||
public void activate(ComponentContext context) {
|
||||
log.info("Activate ...");
|
||||
appId = coreService.registerApplication("org.onos.faultmanagement.alarms");
|
||||
idGenerator = coreService.getIdGenerator("alarm-ids");
|
||||
@ -185,7 +185,7 @@ public class AlarmsManager implements AlarmService {
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
public void deactivate(final ComponentContext context) {
|
||||
public void deactivate(ComponentContext context) {
|
||||
log.info("Deactivate ...");
|
||||
// cfgService.unregisterProperties(getClass(), false);
|
||||
|
||||
@ -193,7 +193,7 @@ public class AlarmsManager implements AlarmService {
|
||||
}
|
||||
|
||||
@Modified
|
||||
public boolean modified(final ComponentContext context) {
|
||||
public boolean modified(ComponentContext context) {
|
||||
log.info("context={}", context);
|
||||
if (context == null) {
|
||||
log.info("No configuration file");
|
||||
@ -209,7 +209,7 @@ public class AlarmsManager implements AlarmService {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void discover(final String ipaddresses) {
|
||||
private void discover(String ipaddresses) {
|
||||
for (String deviceEntry : ipaddresses.split(",")) {
|
||||
final DeviceId deviceId = DeviceId.deviceId(deviceEntry);
|
||||
if (deviceId != null) {
|
||||
|
@ -38,7 +38,7 @@ public final class AlarmCodec extends JsonCodec<Alarm> {
|
||||
private final Logger log = getLogger(getClass());
|
||||
|
||||
@Override
|
||||
public ObjectNode encode(final Alarm alarm, final CodecContext context) {
|
||||
public ObjectNode encode(Alarm alarm, CodecContext context) {
|
||||
checkNotNull(alarm, "Alarm cannot be null");
|
||||
|
||||
return context.mapper().createObjectNode()
|
||||
@ -60,7 +60,7 @@ public final class AlarmCodec extends JsonCodec<Alarm> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Alarm decode(final ObjectNode json, final CodecContext context) {
|
||||
public Alarm decode(ObjectNode json, CodecContext context) {
|
||||
if (json == null || !json.isObject()) {
|
||||
return null;
|
||||
}
|
||||
@ -76,8 +76,7 @@ public final class AlarmCodec extends JsonCodec<Alarm> {
|
||||
final JsonNode jsonTimeCleared = json.get("timeCleared");
|
||||
final Long timeCleared = jsonTimeCleared == null || jsonTimeCleared.isNull() ? null : jsonTimeCleared.asLong();
|
||||
|
||||
final Alarm.SeverityLevel severity
|
||||
= Alarm.SeverityLevel.valueOf(json.get("severity").asText().toUpperCase());
|
||||
final Alarm.SeverityLevel severity = Alarm.SeverityLevel.valueOf(json.get("severity").asText().toUpperCase());
|
||||
|
||||
final Boolean serviceAffecting = json.get("serviceAffecting").asBoolean();
|
||||
final Boolean acknowledged = json.get("acknowledged").asBoolean();
|
||||
|
@ -59,7 +59,7 @@ public class AlarmsWebResource extends AbstractWebResource {
|
||||
*/
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getAlarms(@DefaultValue("false") @QueryParam("includeCleared") final boolean includeCleared
|
||||
public Response getAlarms(@DefaultValue("false") @QueryParam("includeCleared") boolean includeCleared
|
||||
) {
|
||||
|
||||
log.info("Requesting all alarms, includeCleared={}", includeCleared);
|
||||
@ -86,7 +86,7 @@ public class AlarmsWebResource extends AbstractWebResource {
|
||||
@GET
|
||||
@Path("{id}")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getAlarm(@PathParam("id") final String id) {
|
||||
public Response getAlarm(@PathParam("id") String id) {
|
||||
log.info("HTTP GET alarm for id={}", id);
|
||||
|
||||
final AlarmId alarmId = toAlarmId(id);
|
||||
@ -109,7 +109,7 @@ public class AlarmsWebResource extends AbstractWebResource {
|
||||
@Path("{alarm_id}")
|
||||
@Consumes(MediaType.APPLICATION_JSON)
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response update(@PathParam("alarm_id") final String alarmIdPath, final InputStream stream) {
|
||||
public Response update(@PathParam("alarm_id") String alarmIdPath, InputStream stream) {
|
||||
log.info("PUT NEW ALARM at /{}", alarmIdPath);
|
||||
|
||||
try {
|
||||
@ -134,7 +134,7 @@ public class AlarmsWebResource extends AbstractWebResource {
|
||||
}
|
||||
}
|
||||
|
||||
private static AlarmId toAlarmId(final String id) {
|
||||
private static AlarmId toAlarmId(String id) {
|
||||
try {
|
||||
return AlarmId.valueOf(Long.parseLong(id));
|
||||
} catch (NumberFormatException ex) {
|
||||
|
@ -107,7 +107,7 @@ public class AlarmCodecTest {
|
||||
|
||||
}
|
||||
|
||||
private void assertCommon(final Alarm alarm) {
|
||||
private void assertCommon(Alarm alarm) {
|
||||
assertThat(alarm.id(), is(new AlarmId(10L)));
|
||||
assertThat(alarm.description(), is("NE is not reachable"));
|
||||
assertThat(alarm.source(), is(AlarmEntityId.NONE));
|
||||
@ -124,9 +124,9 @@ public class AlarmCodecTest {
|
||||
*
|
||||
* @param resourceName resource to use to read the JSON for the rule
|
||||
* @return decoded flow rule
|
||||
* @throws IOException if processing the resource failsdecode
|
||||
* @throws IOException if processing the resource fails to decode
|
||||
*/
|
||||
private Alarm getDecodedAlarm(final JsonCodec<Alarm> codec, final String resourceName) throws IOException {
|
||||
private Alarm getDecodedAlarm(JsonCodec<Alarm> codec, String resourceName) throws IOException {
|
||||
final InputStream jsonStream = AlarmCodecTest.class
|
||||
.getResourceAsStream(resourceName);
|
||||
final JsonNode json = context.mapper().readTree(jsonStream);
|
||||
|
@ -28,12 +28,12 @@ public final class AlarmJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNode>
|
||||
|
||||
private final Alarm alarm;
|
||||
|
||||
private AlarmJsonMatcher(final Alarm alarm) {
|
||||
private AlarmJsonMatcher(Alarm alarm) {
|
||||
this.alarm = alarm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchesSafely(final JsonNode jsonAlarm, final Description description) {
|
||||
public boolean matchesSafely(JsonNode jsonAlarm, Description description) {
|
||||
final String jsonAlarmId = jsonAlarm.get("id").asText();
|
||||
final String alarmId = Long.toString(alarm.id().fingerprint());
|
||||
if (!jsonAlarmId.equals(alarmId)) {
|
||||
@ -119,7 +119,7 @@ public final class AlarmJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNode>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void describeTo(final Description description) {
|
||||
public void describeTo(Description description) {
|
||||
description.appendText(alarm.toString());
|
||||
}
|
||||
|
||||
@ -129,7 +129,7 @@ public final class AlarmJsonMatcher extends TypeSafeDiagnosingMatcher<JsonNode>
|
||||
* @param alarm alarm object we are looking for
|
||||
* @return matcher
|
||||
*/
|
||||
public static AlarmJsonMatcher matchesAlarm(final Alarm alarm) {
|
||||
public static AlarmJsonMatcher matchesAlarm(Alarm alarm) {
|
||||
return new AlarmJsonMatcher(alarm);
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,7 @@ public class AlarmsWebResourceTest extends ResourceTest {
|
||||
final CodecManager codecService = new CodecManager();
|
||||
codecService.activate();
|
||||
|
||||
final ServiceDirectory testDirectory
|
||||
= new TestServiceDirectory()
|
||||
final ServiceDirectory testDirectory = new TestServiceDirectory()
|
||||
// Currently no alarms-service implemented
|
||||
// .add(AlarmsService.class, alarmsService)
|
||||
.add(CodecService.class, codecService);
|
||||
|
@ -43,7 +43,7 @@ public class SNMPAlarmProvider extends AbstractProvider implements AlarmProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
public void triggerProbe(final DeviceId deviceId) {
|
||||
public void triggerProbe(DeviceId deviceId) {
|
||||
|
||||
// TODO in shout term should this just be synchronous and return result?
|
||||
LOG.info("Run a SNMP discovery for device at {} when done invoke on AlarmProviderService", deviceId);
|
||||
|
Loading…
x
Reference in New Issue
Block a user