diff --git a/airline/client/axis1/src/main/java/org/springframework/ws/samples/airline/client/axis1/AxisMain.java b/airline/client/axis1/src/main/java/org/springframework/ws/samples/airline/client/axis1/AxisMain.java index 9f11f8d..dbd81be 100644 --- a/airline/client/axis1/src/main/java/org/springframework/ws/samples/airline/client/axis1/AxisMain.java +++ b/airline/client/axis1/src/main/java/org/springframework/ws/samples/airline/client/axis1/AxisMain.java @@ -1,11 +1,11 @@ /* - * Copyright 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -24,7 +24,8 @@ import java.util.Date; import javax.xml.rpc.ServiceException; /** - * Simple client that calls the GetFlights and BookFlight operations using JAX-RPC (Axis 1). + * Simple client that calls the GetFlights and BookFlight + * operations using JAX-RPC (Axis 1). * * @author Arjen Poutsma */ diff --git a/airline/client/jax-ws/src/main/java/org/springframework/ws/samples/airline/client/jaxws/JaxWsMain.java b/airline/client/jax-ws/src/main/java/org/springframework/ws/samples/airline/client/jaxws/JaxWsMain.java index cf76f97..2dac3b5 100644 --- a/airline/client/jax-ws/src/main/java/org/springframework/ws/samples/airline/client/jaxws/JaxWsMain.java +++ b/airline/client/jax-ws/src/main/java/org/springframework/ws/samples/airline/client/jaxws/JaxWsMain.java @@ -1,11 +1,11 @@ /* - * Copyright 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -28,7 +28,8 @@ import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; /** - * Simple client that calls the GetFlights and BookFlight operations using JAX-WS. + * Simple client that calls the GetFlights and BookFlight + * operations using JAX-WS. * * @author Arjen Poutsma */ @@ -41,7 +42,8 @@ public class JaxWsMain { if (args.length == 0) { service = new AirlineService(); - } else { + } + else { QName serviceName = new QName("http://www.springframework.org/spring-ws/samples/airline/definitions", "AirlineService"); service = new AirlineService(new URL(args[0]), serviceName); @@ -52,8 +54,8 @@ public class JaxWsMain { GetFlightsRequest request = new GetFlightsRequest(); request.setFrom("AMS"); request.setTo("VCE"); - XMLGregorianCalendar departureDate = DatatypeFactory.newInstance().newXMLGregorianCalendarDate(2006, 1, 31, - DatatypeConstants.FIELD_UNDEFINED); + XMLGregorianCalendar departureDate = DatatypeFactory.newInstance() + .newXMLGregorianCalendarDate(2006, 1, 31, DatatypeConstants.FIELD_UNDEFINED); request.setDepartureDate(departureDate); System.out.format("Requesting flights on %1tD%n", departureDate.toGregorianCalendar()); @@ -75,7 +77,8 @@ public class JaxWsMain { writeTicket(ticket); } - } catch (SOAPFaultException ex) { + } + catch (SOAPFaultException ex) { System.out.format("SOAP Fault Code %1s%n", ex.getFault().getFaultCodeAsQName()); System.out.format("SOAP Fault String: %1s%n", ex.getFault().getFaultString()); } diff --git a/airline/client/jms/src/main/java/org/springframework/ws/samples/airline/client/jms/JmsClient.java b/airline/client/jms/src/main/java/org/springframework/ws/samples/airline/client/jms/JmsClient.java index edcd06a..2bc47d8 100644 --- a/airline/client/jms/src/main/java/org/springframework/ws/samples/airline/client/jms/JmsClient.java +++ b/airline/client/jms/src/main/java/org/springframework/ws/samples/airline/client/jms/JmsClient.java @@ -1,11 +1,11 @@ /* - * Copyright 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -21,7 +21,9 @@ import javax.xml.transform.stream.StreamResult; import org.springframework.ws.client.core.support.WebServiceGatewaySupport; import org.springframework.xml.transform.StringSource; -/** @author Arjen Poutsma */ +/** + * @author Arjen Poutsma + */ public class JmsClient extends WebServiceGatewaySupport { private static final String PAYLOAD = "" @@ -31,4 +33,5 @@ public class JmsClient extends WebServiceGatewaySupport { public void getFlights() { getWebServiceTemplate().sendSourceAndReceiveToResult(new StringSource(PAYLOAD), new StreamResult(System.out)); } + } diff --git a/airline/client/jms/src/main/java/org/springframework/ws/samples/airline/client/jms/JmsConfiguration.java b/airline/client/jms/src/main/java/org/springframework/ws/samples/airline/client/jms/JmsConfiguration.java index ad8079e..b249b32 100644 --- a/airline/client/jms/src/main/java/org/springframework/ws/samples/airline/client/jms/JmsConfiguration.java +++ b/airline/client/jms/src/main/java/org/springframework/ws/samples/airline/client/jms/JmsConfiguration.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -43,4 +43,5 @@ public class JmsConfiguration { jmsClient.setMessageSender(messageSender); return jmsClient; } + } diff --git a/airline/client/jms/src/main/java/org/springframework/ws/samples/airline/client/jms/JmsMain.java b/airline/client/jms/src/main/java/org/springframework/ws/samples/airline/client/jms/JmsMain.java index 6fb5c6e..d0e4309 100644 --- a/airline/client/jms/src/main/java/org/springframework/ws/samples/airline/client/jms/JmsMain.java +++ b/airline/client/jms/src/main/java/org/springframework/ws/samples/airline/client/jms/JmsMain.java @@ -1,11 +1,11 @@ /* - * Copyright 2020 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -39,4 +39,5 @@ public class JmsMain { client.getFlights(); }; } + } diff --git a/airline/client/saaj/src/main/java/org/springframework/ws/samples/airline/client/saaj/GetFlights.java b/airline/client/saaj/src/main/java/org/springframework/ws/samples/airline/client/saaj/GetFlights.java index f6e1bb1..722cba5 100644 --- a/airline/client/saaj/src/main/java/org/springframework/ws/samples/airline/client/saaj/GetFlights.java +++ b/airline/client/saaj/src/main/java/org/springframework/ws/samples/airline/client/saaj/GetFlights.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2011 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -79,7 +79,8 @@ public class GetFlights { SOAPMessage response = connection.call(request, url); if (!response.getSOAPBody().hasFault()) { writeGetFlightsResponse(response); - } else { + } + else { SOAPFault fault = response.getSOAPBody().getFault(); System.err.println("Received SOAP Fault"); System.err.println("SOAP Fault Code: " + fault.getFaultCode()); @@ -91,7 +92,8 @@ public class GetFlights { SOAPEnvelope envelope = message.getSOAPPart().getEnvelope(); Name getFlightsResponseName = envelope.createName("GetFlightsResponse", PREFIX, NAMESPACE_URI); SOAPBodyElement getFlightsResponseElement = (SOAPBodyElement) message.getSOAPBody() - .getChildElements(getFlightsResponseName).next(); + .getChildElements(getFlightsResponseName) + .next(); Name flightName = envelope.createName("flight", PREFIX, NAMESPACE_URI); Iterator iterator = getFlightsResponseElement.getChildElements(flightName); Transformer transformer = transfomerFactory.newTransformer(); @@ -106,4 +108,5 @@ public class GetFlights { transformer.transform(source, new StreamResult(System.out)); } } + } diff --git a/airline/client/saaj/src/main/java/org/springframework/ws/samples/airline/client/saaj/SaajMain.java b/airline/client/saaj/src/main/java/org/springframework/ws/samples/airline/client/saaj/SaajMain.java index b33c14e..ea722c8 100644 --- a/airline/client/saaj/src/main/java/org/springframework/ws/samples/airline/client/saaj/SaajMain.java +++ b/airline/client/saaj/src/main/java/org/springframework/ws/samples/airline/client/saaj/SaajMain.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2011 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -38,4 +38,5 @@ public class SaajMain { GetFlights getFlights = new GetFlights(url); getFlights.getFlights(); } + } diff --git a/airline/client/spring-ws/src/main/java/org/springframework/ws/samples/airline/client/sws/GetFlights.java b/airline/client/spring-ws/src/main/java/org/springframework/ws/samples/airline/client/sws/GetFlights.java index 4ca07af..ba1d293 100644 --- a/airline/client/spring-ws/src/main/java/org/springframework/ws/samples/airline/client/sws/GetFlights.java +++ b/airline/client/spring-ws/src/main/java/org/springframework/ws/samples/airline/client/sws/GetFlights.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2011 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -40,22 +40,24 @@ public class GetFlights extends WebServiceGatewaySupport { getFlightsRequest.setTo("VCE"); XMLGregorianCalendar departureDate = null; try { - departureDate = DatatypeFactory.newInstance().newXMLGregorianCalendarDate(2006, 1, 31, - DatatypeConstants.FIELD_UNDEFINED); - } catch (DatatypeConfigurationException e) { + departureDate = DatatypeFactory.newInstance() + .newXMLGregorianCalendarDate(2006, 1, 31, DatatypeConstants.FIELD_UNDEFINED); + } + catch (DatatypeConfigurationException e) { throw new RuntimeException(e); } getFlightsRequest.setDepartureDate(departureDate); System.out.println("Requesting flights on " + departureDate); - GetFlightsResponse response = null; - try { - response = (GetFlightsResponse) getWebServiceTemplate().marshalSendAndReceive(getFlightsRequest); - } catch (Exception e) { - throw new RuntimeException(e); - } - System.out.println("Got " + response.getFlight().size() + " results"); + GetFlightsResponse response = null; + try { + response = (GetFlightsResponse) getWebServiceTemplate().marshalSendAndReceive(getFlightsRequest); + } + catch (Exception e) { + throw new RuntimeException(e); + } + System.out.println("Got " + response.getFlight().size() + " results"); if (response.getFlight().size() > 0) { // Book the first flight using John Doe as a frequent flyer BookFlightRequest bookFlightRequest = new BookFlightRequest(); @@ -66,7 +68,7 @@ public class GetFlights extends WebServiceGatewaySupport { bookFlightRequest.setPassengers(passengers); JAXBElement ticket = (JAXBElement) getWebServiceTemplate() - .marshalSendAndReceive(bookFlightRequest); + .marshalSendAndReceive(bookFlightRequest); writeTicket(ticket.getValue()); } @@ -92,11 +94,12 @@ public class GetFlights extends WebServiceGatewaySupport { System.out.println(flight.getDepartureTime()); System.out.println(flight.getNumber() + "\t" + flight.getServiceClass()); System.out.println("------------"); - System.out.println( - "Depart:\t" + flight.getFrom().getCode() + "-" + flight.getFrom().getName() + "\t" + flight.getDepartureTime()); + System.out.println("Depart:\t" + flight.getFrom().getCode() + "-" + flight.getFrom().getName() + "\t" + + flight.getDepartureTime()); System.out.println("\t" + flight.getFrom().getCity()); - System.out.println( - "Arrive:\t" + flight.getTo().getCode() + "-" + flight.getTo().getName() + "\t" + flight.getArrivalTime()); + System.out.println("Arrive:\t" + flight.getTo().getCode() + "-" + flight.getTo().getName() + "\t" + + flight.getArrivalTime()); System.out.println("\t" + flight.getTo().getCity()); } + } diff --git a/airline/client/spring-ws/src/main/java/org/springframework/ws/samples/airline/client/sws/GetFrequentFlyerMileage.java b/airline/client/spring-ws/src/main/java/org/springframework/ws/samples/airline/client/sws/GetFrequentFlyerMileage.java index 1f93fce..3b9967e 100644 --- a/airline/client/spring-ws/src/main/java/org/springframework/ws/samples/airline/client/sws/GetFrequentFlyerMileage.java +++ b/airline/client/spring-ws/src/main/java/org/springframework/ws/samples/airline/client/sws/GetFrequentFlyerMileage.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2011 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -36,4 +36,5 @@ public class GetFrequentFlyerMileage extends WebServiceGatewaySupport { getWebServiceTemplate().sendSourceAndReceiveToResult(source, new StreamResult(System.out)); } + } diff --git a/airline/client/spring-ws/src/main/java/org/springframework/ws/samples/airline/client/sws/SpringWsMain.java b/airline/client/spring-ws/src/main/java/org/springframework/ws/samples/airline/client/sws/SpringWsMain.java index 6e91a54..f645c0b 100644 --- a/airline/client/spring-ws/src/main/java/org/springframework/ws/samples/airline/client/sws/SpringWsMain.java +++ b/airline/client/spring-ws/src/main/java/org/springframework/ws/samples/airline/client/sws/SpringWsMain.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2011 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -33,4 +33,5 @@ public class SpringWsMain { GetFrequentFlyerMileage getFrequentFlyerMileage = ctx.getBean(GetFrequentFlyerMileage.class); getFrequentFlyerMileage.getFrequentFlyerMileage(); } + } diff --git a/airline/client/spring-ws/src/main/java/org/springframework/ws/samples/airline/client/sws/WsConfiguration.java b/airline/client/spring-ws/src/main/java/org/springframework/ws/samples/airline/client/sws/WsConfiguration.java index 6241a5c..a6a9f9e 100644 --- a/airline/client/spring-ws/src/main/java/org/springframework/ws/samples/airline/client/sws/WsConfiguration.java +++ b/airline/client/spring-ws/src/main/java/org/springframework/ws/samples/airline/client/sws/WsConfiguration.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.springframework.ws.samples.airline.client.sws; import org.springframework.context.annotation.Bean; @@ -56,4 +72,5 @@ public class WsConfiguration { securityInterceptor.setSecurementPassword("changeme"); return securityInterceptor; } + } diff --git a/airline/client/spring-ws/src/test/java/org/springframework/ws/samples/airline/client/sws/GetFlightsTest.java b/airline/client/spring-ws/src/test/java/org/springframework/ws/samples/airline/client/sws/GetFlightsTest.java index d0cce92..57b13ab 100644 --- a/airline/client/spring-ws/src/test/java/org/springframework/ws/samples/airline/client/sws/GetFlightsTest.java +++ b/airline/client/spring-ws/src/test/java/org/springframework/ws/samples/airline/client/sws/GetFlightsTest.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2010 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -34,7 +34,8 @@ import org.springframework.ws.test.client.MockWebServiceServer; import org.springframework.xml.transform.StringSource; /** - * This test illustrates the use of the client-side testing API, introduced in Spring-WS 2.0. + * This test illustrates the use of the client-side testing API, introduced in Spring-WS + * 2.0. * * @author Arjen Poutsma */ @@ -42,7 +43,8 @@ import org.springframework.xml.transform.StringSource; @Import(WsConfiguration.class) public class GetFlightsTest { - @Autowired GetFlights getFlights; + @Autowired + GetFlights getFlights; private MockWebServiceServer mockServer; @@ -58,8 +60,9 @@ public class GetFlightsTest { @Test public void getFlights() { - Source getFlightsRequest = new StringSource("" + "AMS" - + "VCE" + "2006-01-31" + ""); + Source getFlightsRequest = new StringSource( + "" + "AMS" + "VCE" + + "2006-01-31" + ""); String flightInfo = "KL1653" + "2006-01-31T10:05:00.000+01:00" @@ -81,9 +84,9 @@ public class GetFlightsTest { Map namespaces = Collections.singletonMap("m", MESSAGES_NS); mockServer.expect(xpath("/m:BookFlightRequest/m:flightNumber", namespaces).exists()) - .andExpect(xpath("/m:BookFlightRequest/m:departureTime", namespaces).exists()) - .andExpect(xpath("/m:BookFlightRequest/m:passengers", namespaces).exists()) - .andRespond(withPayload(bookFlightResponse)); + .andExpect(xpath("/m:BookFlightRequest/m:departureTime", namespaces).exists()) + .andExpect(xpath("/m:BookFlightRequest/m:passengers", namespaces).exists()) + .andRespond(withPayload(bookFlightResponse)); getFlights.getFlights(); diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/AirlineServerApplication.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/AirlineServerApplication.java index 1d52b3e..d1656ac 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/AirlineServerApplication.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/AirlineServerApplication.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.springframework.ws.samples.airline; import org.springframework.boot.SpringApplication; @@ -10,4 +26,5 @@ public class AirlineServerApplication { public static void main(String[] args) { SpringApplication.run(AirlineServerApplication.class, args); } + } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/AirportDao.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/AirportDao.java index 5730213..37f3183 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/AirportDao.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/AirportDao.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.springframework.ws.samples.airline.dao; import org.springframework.data.repository.CrudRepository; diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/Databaseinit.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/Databaseinit.java index 2e20dae..5e00efc 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/Databaseinit.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/Databaseinit.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.springframework.ws.samples.airline.dao; import java.time.ZoneId; @@ -15,7 +31,8 @@ import org.springframework.ws.samples.airline.domain.ServiceClass; public class Databaseinit { @Bean - CommandLineRunner initializeDatabase(AirportDao airportDao, FlightDao flightDao, FrequentFlyerDao frequentFlyerDao) { + CommandLineRunner initializeDatabase(AirportDao airportDao, FlightDao flightDao, + FrequentFlyerDao frequentFlyerDao) { return args -> { Airport amsterdam = airportDao.save(new Airport("AMS", "Schiphol Airport", "Amsterdam")); Airport venice = airportDao.save(new Airport("VCE", "Marco Polo Airport", "Venice")); @@ -49,4 +66,5 @@ public class Databaseinit { frequentFlyerDao.save(new FrequentFlyer("John", "Doe", "john", "changeme")); }; } + } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/FlightDao.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/FlightDao.java index 453e4e1..f094c4d 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/FlightDao.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/FlightDao.java @@ -1,11 +1,11 @@ /* - * Copyright 2005 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -35,4 +35,5 @@ public interface FlightDao extends CrudRepository { @Param("class") ServiceClass serviceClass); Flight findFlightByNumberAndDepartureTime(String flightNumber, ZonedDateTime departureTime); + } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/FrequentFlyerDao.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/FrequentFlyerDao.java index 3c63fe4..b399d2c 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/FrequentFlyerDao.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/FrequentFlyerDao.java @@ -1,11 +1,11 @@ /* - * Copyright 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/TicketDao.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/TicketDao.java index afe0b21..8d3c34d 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/TicketDao.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/TicketDao.java @@ -1,11 +1,11 @@ /* - * Copyright 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/Airport.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/Airport.java index 9b9c778..a2ed6a3 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/Airport.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/Airport.java @@ -1,11 +1,11 @@ /* - * Copyright 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -28,13 +28,17 @@ import java.io.Serializable; public class Airport implements Serializable { @Id - @Column(name = "CODE") private String code; + @Column(name = "CODE") + private String code; - @Column(name = "NAME") private String name; + @Column(name = "NAME") + private String name; - @Column(name = "CITY") private String city; + @Column(name = "CITY") + private String city; - public Airport() {} + public Airport() { + } public Airport(String code, String name, String city) { this.code = code; @@ -68,4 +72,5 @@ public class Airport implements Serializable { public int hashCode() { return code.hashCode(); } + } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/Flight.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/Flight.java index 8a66933..91ad319 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/Flight.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/Flight.java @@ -1,11 +1,11 @@ /* - * Copyright 2005, 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -28,30 +28,40 @@ public class Flight implements Serializable { @Id @Column(name = "ID") - @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; - @Column(name = "NUMBER") private String number; + @Column(name = "NUMBER") + private String number; @Column(name = "DEPARTURE_TIME") - @Persistent private ZonedDateTime departureTime; + @Persistent + private ZonedDateTime departureTime; @ManyToOne - @JoinColumn(name = "FROM_AIRPORT_CODE", nullable = false) private Airport from; + @JoinColumn(name = "FROM_AIRPORT_CODE", nullable = false) + private Airport from; @Column(name = "ARRIVAL_TIME") - @Persistent private ZonedDateTime arrivalTime; + @Persistent + private ZonedDateTime arrivalTime; @ManyToOne - @JoinColumn(name = "TO_AIRPORT_CODE", nullable = false) private Airport to; + @JoinColumn(name = "TO_AIRPORT_CODE", nullable = false) + private Airport to; @Column(name = "SERVICE_CLASS") - @Enumerated(EnumType.STRING) private ServiceClass serviceClass; + @Enumerated(EnumType.STRING) + private ServiceClass serviceClass; - @Column(name = "SEATS_AVAILABLE") private int seatsAvailable; + @Column(name = "SEATS_AVAILABLE") + private int seatsAvailable; - @Column(name = "MILES") private int miles; + @Column(name = "MILES") + private int miles; - public Flight() {} + public Flight() { + } public Flight(Long id) { this.id = id; @@ -154,4 +164,5 @@ public class Flight implements Serializable { public String toString() { return getNumber() + " " + getDepartureTime(); } + } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/FrequentFlyer.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/FrequentFlyer.java index a73c5ac..5632808 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/FrequentFlyer.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/FrequentFlyer.java @@ -1,11 +1,11 @@ /* - * Copyright 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -26,13 +26,17 @@ import jakarta.persistence.Table; @PrimaryKeyJoinColumn(name = "PASSENGER_ID") public class FrequentFlyer extends Passenger { - @Column(name = "USERNAME") private String username; + @Column(name = "USERNAME") + private String username; - @Column(name = "PASSWORD") private String password; + @Column(name = "PASSWORD") + private String password; - @Column(name = "MILES") private int miles; + @Column(name = "MILES") + private int miles; - public FrequentFlyer() {} + public FrequentFlyer() { + } public FrequentFlyer(String username) { this.username = username; @@ -94,4 +98,5 @@ public class FrequentFlyer extends Passenger { public void addMiles(int miles) { this.miles += miles; } + } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/Passenger.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/Passenger.java index 117712a..80f0192 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/Passenger.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/Passenger.java @@ -1,11 +1,11 @@ /* - * Copyright 2005, 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -26,13 +26,17 @@ public class Passenger implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "ID") private Long id; + @Column(name = "ID") + private Long id; - @Column(name = "FIRST_NAME") private String firstName; + @Column(name = "FIRST_NAME") + private String firstName; - @Column(name = "LAST_NAME") private String lastName; + @Column(name = "LAST_NAME") + private String lastName; - public Passenger() {} + public Passenger() { + } public Passenger(String firstName, String lastName) { this.firstName = firstName; @@ -86,4 +90,5 @@ public class Passenger implements Serializable { result = 29 * result + getLastName().hashCode(); return result; } + } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/ServiceClass.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/ServiceClass.java index 2c6dc5d..dbea6a3 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/ServiceClass.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/ServiceClass.java @@ -1,11 +1,11 @@ /* - * Copyright 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -18,9 +18,10 @@ package org.springframework.ws.samples.airline.domain; public enum ServiceClass { - ECONOMY, + ECONOMY, - BUSINESS, + BUSINESS, + + FIRST - FIRST } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/Ticket.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/Ticket.java index 40d08e7..aec4600 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/Ticket.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/domain/Ticket.java @@ -1,11 +1,11 @@ /* - * Copyright 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -30,19 +30,24 @@ import org.springframework.data.annotation.Persistent; public class Ticket implements Serializable { @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; @Column(name = "ISSUE_DATE") - @Persistent private LocalDate issueDate; + @Persistent + private LocalDate issueDate; @ManyToOne - @JoinColumn(name = "FLIGHT_ID", nullable = false) private Flight flight; + @JoinColumn(name = "FLIGHT_ID", nullable = false) + private Flight flight; @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }) - @JoinTable(name = "PASSENGER_TICKET", joinColumns = @JoinColumn(name = "TICKET_ID"), inverseJoinColumns = @JoinColumn( - name = "PASSENGER_ID")) private Set passengers = new HashSet(); + @JoinTable(name = "PASSENGER_TICKET", joinColumns = @JoinColumn(name = "TICKET_ID"), + inverseJoinColumns = @JoinColumn(name = "PASSENGER_ID")) + private Set passengers = new HashSet(); - public Ticket() {} + public Ticket() { + } public Ticket(Long id) { this.id = id; @@ -79,4 +84,5 @@ public class Ticket implements Serializable { public void addPassenger(Passenger passenger) { passengers.add(passenger); } + } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/jms/JmsConfiguration.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/jms/JmsConfiguration.java index b069be3..5b49d37 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/jms/JmsConfiguration.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/jms/JmsConfiguration.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.springframework.ws.samples.airline.jms; import jakarta.jms.ConnectionFactory; @@ -30,7 +46,8 @@ public class JmsConfiguration { } /** - * Listen for JMS messages and route them into the SOAP-based {@link WebServiceMessageListener}. + * Listen for JMS messages and route them into the SOAP-based + * {@link WebServiceMessageListener}. */ @Bean DefaultMessageListenerContainer containerFactory(ConnectionFactory connectionFactory, @@ -52,4 +69,5 @@ public class JmsConfiguration { messageListener.setMessageReceiver(messageReceiver); return messageListener; } + } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/schema/support/SchemaConversionUtils.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/schema/support/SchemaConversionUtils.java index a95daf1..90c2986 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/schema/support/SchemaConversionUtils.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/schema/support/SchemaConversionUtils.java @@ -1,11 +1,11 @@ /* - * Copyright 2007 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -30,10 +30,13 @@ import javax.xml.datatype.XMLGregorianCalendar; import org.springframework.ws.samples.airline.domain.Passenger; import org.springframework.ws.samples.airline.schema.*; -/** @author Arjen Poutsma */ +/** + * @author Arjen Poutsma + */ public abstract class SchemaConversionUtils { - private SchemaConversionUtils() {} + private SchemaConversionUtils() { + } public static Flight toSchemaType(org.springframework.ws.samples.airline.domain.Flight domainFlight) throws DatatypeConfigurationException { @@ -51,14 +54,15 @@ public abstract class SchemaConversionUtils { public static List toSchemaType(List domainFlights) { return domainFlights.stream() // - .map(flight -> { - try { - return toSchemaType(flight); - } catch (DatatypeConfigurationException e) { - throw new RuntimeException(e); - } - }) // - .collect(Collectors.toList()); + .map(flight -> { + try { + return toSchemaType(flight); + } + catch (DatatypeConfigurationException e) { + throw new RuntimeException(e); + } + }) // + .collect(Collectors.toList()); } public static XMLGregorianCalendar toXMLGregorianCalendar(ZonedDateTime dateTime) @@ -72,7 +76,8 @@ public abstract class SchemaConversionUtils { return calendar.toGregorianCalendar().toZonedDateTime(); } - public static XMLGregorianCalendar toXMLGregorianCalendar(LocalDate localDate) throws DatatypeConfigurationException { + public static XMLGregorianCalendar toXMLGregorianCalendar(LocalDate localDate) + throws DatatypeConfigurationException { DatatypeFactory factory = DatatypeFactory.newInstance(); return factory.newXMLGregorianCalendarDate(localDate.getYear(), localDate.getMonthValue(), @@ -148,4 +153,5 @@ public abstract class SchemaConversionUtils { } return schemaTicket; } + } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/security/FrequentFlyerDetails.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/security/FrequentFlyerDetails.java index d3b2124..a9d5026 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/security/FrequentFlyerDetails.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/security/FrequentFlyerDetails.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.springframework.ws.samples.airline.security; import java.util.Collection; @@ -11,7 +27,7 @@ import org.springframework.ws.samples.airline.domain.FrequentFlyer; public class FrequentFlyerDetails implements UserDetails { private static final List GRANTED_AUTHORITIES = List - .of(new SimpleGrantedAuthority("ROLE_FREQUENT_FLYER")); + .of(new SimpleGrantedAuthority("ROLE_FREQUENT_FLYER")); private FrequentFlyer frequentFlyer; @@ -62,4 +78,5 @@ public class FrequentFlyerDetails implements UserDetails { public String toString() { return "FrequentFlyerDetails{" + "frequentFlyer=" + frequentFlyer + '}'; } + } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/security/FrequentFlyerSecurityService.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/security/FrequentFlyerSecurityService.java index 4873b11..c5826a6 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/security/FrequentFlyerSecurityService.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/security/FrequentFlyerSecurityService.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.springframework.ws.samples.airline.security; import org.springframework.ws.samples.airline.domain.FrequentFlyer; @@ -12,17 +28,17 @@ public interface FrequentFlyerSecurityService { /** * Returns the FrequentFlyer with the given username. - * * @param username the username - * @return the frequent flyer with the given username, or null if not found + * @return the frequent flyer with the given username, or null if not + * found * @throws NoSuchFrequentFlyerException when the frequent flyer cannot be found */ FrequentFlyer getFrequentFlyer(String username) throws NoSuchFrequentFlyerException; /** * Returns the FrequentFlyer that is currently logged in. - * - * @return the frequent flyer that is currently logged in, or null if not found + * @return the frequent flyer that is currently logged in, or null if not + * found */ FrequentFlyer getCurrentlyAuthenticatedFrequentFlyer(); diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/security/SecurityConfiguration.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/security/SecurityConfiguration.java index 2f68f7d..132c071 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/security/SecurityConfiguration.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/security/SecurityConfiguration.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.springframework.ws.samples.airline.security; import org.springframework.context.annotation.Bean; @@ -23,15 +39,16 @@ public class SecurityConfiguration { return NoOpPasswordEncoder.getInstance(); } -// @Bean -// SecurityFilterChain securityFilterChain(HttpSecurity security) throws Exception { -// -// security.authorizeHttpRequests() // -// .requestMatchers("/login", "/error", "/logout").permitAll() // -// .anyRequest().authenticated() // -// .and() // -// .csrf().disable(); -// -// return security.build(); -// } + // @Bean + // SecurityFilterChain securityFilterChain(HttpSecurity security) throws Exception { + // + // security.authorizeHttpRequests() // + // .requestMatchers("/login", "/error", "/logout").permitAll() // + // .anyRequest().authenticated() // + // .and() // + // .csrf().disable(); + // + // return security.build(); + // } + } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/security/SpringSecurityFrequentFlyerService.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/security/SpringSecurityFrequentFlyerService.java index b5518ae..6343910 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/security/SpringSecurityFrequentFlyerService.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/security/SpringSecurityFrequentFlyerService.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.springframework.ws.samples.airline.security; import org.apache.wss4j.common.principal.UsernameTokenPrincipal; @@ -32,7 +48,7 @@ public class SpringSecurityFrequentFlyerService implements FrequentFlyerSecurity @Transactional public FrequentFlyer getFrequentFlyer(String username) throws NoSuchFrequentFlyerException { return frequentFlyerDao.findByUsername(username) // - .orElseThrow(() -> new NoSuchFrequentFlyerException(username)); + .orElseThrow(() -> new NoSuchFrequentFlyerException(username)); } @Override @@ -55,11 +71,12 @@ public class SpringSecurityFrequentFlyerService implements FrequentFlyerSecurity log.debug("Looking up " + username); FrequentFlyerDetails details = frequentFlyerDao.findByUsername(username) // - .map(FrequentFlyerDetails::new) // - .orElseThrow(() -> new UsernameNotFoundException("Frequent flyer '" + username + "' not found")); + .map(FrequentFlyerDetails::new) // + .orElseThrow(() -> new UsernameNotFoundException("Frequent flyer '" + username + "' not found")); log.debug("Found " + details); return details; } + } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/security/StubFrequentFlyerSecurityService.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/security/StubFrequentFlyerSecurityService.java index 11dc4da..5739f2f 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/security/StubFrequentFlyerSecurityService.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/security/StubFrequentFlyerSecurityService.java @@ -1,12 +1,29 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.springframework.ws.samples.airline.security; import org.springframework.ws.samples.airline.domain.FrequentFlyer; import org.springframework.ws.samples.airline.service.NoSuchFrequentFlyerException; /** - * Stub implementation of FrequentFlyerSecurityService. This implementation is used by default by - * {@link org.springframework.ws.samples.airline.service.impl.AirlineServiceImpl}, to allow it to run without depending - * on Spring Security. + * Stub implementation of FrequentFlyerSecurityService. This implementation + * is used by default by + * {@link org.springframework.ws.samples.airline.service.impl.AirlineServiceImpl}, to + * allow it to run without depending on Spring Security. * * @author Arjen Poutsma */ @@ -23,7 +40,8 @@ public class StubFrequentFlyerSecurityService implements FrequentFlyerSecuritySe public FrequentFlyer getFrequentFlyer(String username) throws NoSuchFrequentFlyerException { if (john.getUsername().equals(username)) { return john; - } else { + } + else { throw new NoSuchFrequentFlyerException(username); } } @@ -32,4 +50,5 @@ public class StubFrequentFlyerSecurityService implements FrequentFlyerSecuritySe public FrequentFlyer getCurrentlyAuthenticatedFrequentFlyer() { return john; } + } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/service/AirlineService.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/service/AirlineService.java index 3932307..2891448 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/service/AirlineService.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/service/AirlineService.java @@ -1,11 +1,11 @@ /* - * Copyright 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -29,16 +29,16 @@ public interface AirlineService { /** * Returns a single Flight with the given id. - * * @param id the flight identifier * @return the flight - * @throws NoSuchFlightException if a flight with the specified flight iddoes not exist + * @throws NoSuchFlightException if a flight with the specified flight iddoes not + * exist */ Flight getFlight(Long id) throws NoSuchFlightException; /** - * Returns a list of Flight objects that fall within the specified criteria. - * + * Returns a list of Flight objects that fall within the specified + * criteria. * @param fromAirportCode the three-letter airport code to get flights from * @param toAirportCode the three-letter airport code to get flights to * @param departureDate the date of the flights @@ -49,28 +49,31 @@ public interface AirlineService { ServiceClass serviceClass); /** - * Books a single flight for a number of passengers. Passengers can be either specified by name or by frequent flyer - * username. If a {@link FrequentFlyer} is specified, the first and last name are looked up in the database. - * + * Books a single flight for a number of passengers. Passengers can be either + * specified by name or by frequent flyer username. If a {@link FrequentFlyer} is + * specified, the first and last name are looked up in the database. * @param flightNumber the number of the flight to book * @param departureTime the departure time of the flight to book - * @param passengers the list of passengers for the flight to book. Can be either {@link Passenger} objects with a - * first and last name, or {@link FrequentFlyer} objects with a username. + * @param passengers the list of passengers for the flight to book. Can be either + * {@link Passenger} objects with a first and last name, or {@link FrequentFlyer} + * objects with a username. * @return the created ticket - * @throws NoSuchFlightException if a flight with the specified flight number and departure time does not exist + * @throws NoSuchFlightException if a flight with the specified flight number and + * departure time does not exist * @throws NoSeatAvailableException if not enough seats are available for the flight - * @throws NoSuchFrequentFlyerException if a specified {@link FrequentFlyer} cannot be found + * @throws NoSuchFrequentFlyerException if a specified {@link FrequentFlyer} cannot be + * found * @see Passenger * @see FrequentFlyer */ Ticket bookFlight(String flightNumber, ZonedDateTime departureTime, List passengers) throws NoSuchFlightException, NoSeatAvailableException, NoSuchFrequentFlyerException; - /** - * Returns the amount of frequent flyer award miles for the currently logged in frequent flyer. - * - * @return the amount of frequent flyer miles - */ - int getFrequentFlyerMileage(); -} + /** + * Returns the amount of frequent flyer award miles for the currently logged in + * frequent flyer. + * @return the amount of frequent flyer miles + */ + int getFrequentFlyerMileage(); +} diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/service/NoSeatAvailableException.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/service/NoSeatAvailableException.java index d04c62d..19a9c7f 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/service/NoSeatAvailableException.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/service/NoSeatAvailableException.java @@ -1,11 +1,11 @@ /* - * Copyright 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -28,14 +28,15 @@ import org.springframework.ws.soap.server.endpoint.annotation.SoapFault; @SoapFault(faultCode = FaultCode.SERVER) public class NoSeatAvailableException extends Exception { - private Flight flight; + private Flight flight; - public NoSeatAvailableException(Flight flight) { - super("Flight [" + flight + "] has not more seats available"); - this.flight = flight; - } + public NoSeatAvailableException(Flight flight) { + super("Flight [" + flight + "] has not more seats available"); + this.flight = flight; + } + + public Flight getFlight() { + return flight; + } - public Flight getFlight() { - return flight; - } } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/service/NoSuchFlightException.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/service/NoSuchFlightException.java index e6681ca..73c4866 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/service/NoSuchFlightException.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/service/NoSuchFlightException.java @@ -1,11 +1,11 @@ /* - * Copyright 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -29,25 +29,26 @@ import org.springframework.ws.soap.server.endpoint.annotation.SoapFault; @SoapFault(faultCode = FaultCode.CLIENT) public class NoSuchFlightException extends Exception { - private String flightNumber; + private String flightNumber; - private ZonedDateTime departureTime; + private ZonedDateTime departureTime; - public NoSuchFlightException(String flightNumber, ZonedDateTime departureTime) { - super("No flight with number [" + flightNumber + "] and departure time [" + departureTime + "]"); - this.flightNumber = flightNumber; - this.departureTime = departureTime; - } + public NoSuchFlightException(String flightNumber, ZonedDateTime departureTime) { + super("No flight with number [" + flightNumber + "] and departure time [" + departureTime + "]"); + this.flightNumber = flightNumber; + this.departureTime = departureTime; + } - public NoSuchFlightException(Long id) { - super("No flight with id [" + id + "]"); - } + public NoSuchFlightException(Long id) { + super("No flight with id [" + id + "]"); + } - public String getFlightNumber() { - return flightNumber; - } + public String getFlightNumber() { + return flightNumber; + } + + public ZonedDateTime getDepartureTime() { + return departureTime; + } - public ZonedDateTime getDepartureTime() { - return departureTime; - } } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/service/NoSuchFrequentFlyerException.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/service/NoSuchFrequentFlyerException.java index 3b8a821..de5e6dd 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/service/NoSuchFrequentFlyerException.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/service/NoSuchFrequentFlyerException.java @@ -1,11 +1,11 @@ /* - * Copyright 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -28,14 +28,15 @@ import org.springframework.ws.soap.server.endpoint.annotation.SoapFault; @SoapFault(faultCode = FaultCode.CLIENT) public class NoSuchFrequentFlyerException extends Exception { - private String username; + private String username; - public NoSuchFrequentFlyerException(String username) { - super("No frequent flyer with name [" + username + "]"); - this.username = username; - } + public NoSuchFrequentFlyerException(String username) { + super("No frequent flyer with name [" + username + "]"); + this.username = username; + } + + public String getusername() { + return username; + } - public String getusername() { - return username; - } } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/service/impl/AirlineServiceImpl.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/service/impl/AirlineServiceImpl.java index f0189fc..6c5ed8e 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/service/impl/AirlineServiceImpl.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/service/impl/AirlineServiceImpl.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2011 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -65,8 +65,8 @@ public class AirlineServiceImpl implements AirlineService { this.frequentFlyerSecurityService = frequentFlyerSecurityService; } - @Transactional(readOnly = false, - rollbackFor = { NoSuchFlightException.class, NoSeatAvailableException.class, NoSuchFrequentFlyerException.class }) + @Transactional(readOnly = false, rollbackFor = { NoSuchFlightException.class, NoSeatAvailableException.class, + NoSuchFrequentFlyerException.class }) public Ticket bookFlight(String flightNumber, ZonedDateTime departureTime, List passengers) throws NoSuchFlightException, NoSeatAvailableException, NoSuchFrequentFlyerException { @@ -80,7 +80,8 @@ public class AirlineServiceImpl implements AirlineService { if (flight == null) { throw new NoSuchFlightException(flightNumber, departureTime); - } else if (flight.getSeatsAvailable() < passengers.size()) { + } + else if (flight.getSeatsAvailable() < passengers.size()) { throw new NoSeatAvailableException(flight); } @@ -95,7 +96,8 @@ public class AirlineServiceImpl implements AirlineService { FrequentFlyer frequentFlyer = frequentFlyerSecurityService.getFrequentFlyer(username); frequentFlyer.addMiles(flight.getMiles()); ticket.addPassenger(frequentFlyer); - } else { + } + else { ticket.addPassenger(passenger); } } @@ -111,7 +113,7 @@ public class AirlineServiceImpl implements AirlineService { public Flight getFlight(Long id) throws NoSuchFlightException { return flightDao.findById(id) // - .orElseThrow(() -> new NoSuchFlightException(id)); + .orElseThrow(() -> new NoSuchFlightException(id)); } public List getFlights(String fromAirportCode, String toAirportCode, ZonedDateTime departureDate, @@ -122,7 +124,8 @@ public class AirlineServiceImpl implements AirlineService { } if (logger.isDebugEnabled()) { - logger.debug("Getting flights from '" + fromAirportCode + "' to '" + toAirportCode + "' on " + departureDate); + logger + .debug("Getting flights from '" + fromAirportCode + "' to '" + toAirportCode + "' on " + departureDate); } List flights = flightDao.findFlights(fromAirportCode, toAirportCode, departureDate, serviceClass); @@ -143,7 +146,8 @@ public class AirlineServiceImpl implements AirlineService { } return Optional.ofNullable(frequentFlyerSecurityService.getCurrentlyAuthenticatedFrequentFlyer()) - .map(FrequentFlyer::getMiles) // - .orElse(0); + .map(FrequentFlyer::getMiles) // + .orElse(0); } + } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/web/FlightsController.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/web/FlightsController.java index 09cc56c..bfccdfd 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/web/FlightsController.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/web/FlightsController.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2011 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -32,7 +32,9 @@ import org.springframework.ws.samples.airline.domain.ServiceClass; import org.springframework.ws.samples.airline.service.AirlineService; import org.springframework.ws.samples.airline.service.NoSuchFlightException; -/** @author Arjen Poutsma */ +/** + * @author Arjen Poutsma + */ @Controller @RequestMapping("/flights") public class FlightsController { diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/AirlineEndpoint.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/AirlineEndpoint.java index bc7ea4d..c275fb9 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/AirlineEndpoint.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/AirlineEndpoint.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2011 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -50,8 +50,8 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; /** - * Endpoint that handles the Airline Web Service messages using a combination of JAXB2 marshalling and XPath - * expressions. + * Endpoint that handles the Airline Web Service messages using a combination of JAXB2 + * marshalling and XPath expressions. * * @author Arjen Poutsma */ @@ -72,9 +72,8 @@ public class AirlineEndpoint { } /** - * This endpoint method uses a combination of XPath expressions and marshalling to handle message with a - * <GetFlightsRequest> payload. - * + * This endpoint method uses a combination of XPath expressions and marshalling to + * handle message with a <GetFlightsRequest> payload. * @param from the from airport * @param to the to airport * @param departureDateString the string representation of the departure date @@ -110,8 +109,8 @@ public class AirlineEndpoint { } /** - * This endpoint method uses marshalling to handle message with a <BookFlightRequest> payload. - * + * This endpoint method uses marshalling to handle message with a + * <BookFlightRequest> payload. * @param request the JAXB2 representation of a <BookFlightRequest> * @return the JAXB2 representation of a <BookFlightResponse> */ @@ -121,8 +120,8 @@ public class AirlineEndpoint { DatatypeConfigurationException, NoSuchFlightException, NoSuchFrequentFlyerException { if (logger.isDebugEnabled()) { - logger.debug("Received BookingFlightRequest '" + request.getFlightNumber() + "' on '" + request.getDepartureTime() - + "' for " + request.getPassengers().getPassengerOrUsername()); + logger.debug("Received BookingFlightRequest '" + request.getFlightNumber() + "' on '" + + request.getDepartureTime() + "' for " + request.getPassengers().getPassengerOrUsername()); } Ticket ticket = bookSchemaFlight(request.getFlightNumber(), request.getDepartureTime(), @@ -145,7 +144,8 @@ public class AirlineEndpoint { if (passengerOrUsername instanceof Name passengerName) { Passenger passenger = new Passenger(passengerName.getFirst(), passengerName.getLast()); passengers.add(passenger); - } else if (passengerOrUsername instanceof String frequentFlyerUsername) { + } + else if (passengerOrUsername instanceof String frequentFlyerUsername) { FrequentFlyer frequentFlyer = new FrequentFlyer(frequentFlyerUsername); passengers.add(frequentFlyer); } @@ -173,4 +173,5 @@ public class AirlineEndpoint { return response; } + } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/AirlineWebServiceConstants.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/AirlineWebServiceConstants.java index b951c9b..273ccf7 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/AirlineWebServiceConstants.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/AirlineWebServiceConstants.java @@ -1,11 +1,11 @@ /* - * Copyright 2007 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -16,16 +16,19 @@ package org.springframework.ws.samples.airline.ws; -/** @author Arjen Poutsma */ +/** + * @author Arjen Poutsma + */ public interface AirlineWebServiceConstants { - String BOOK_FLIGHT_REQUEST = "BookFlightRequest"; + String BOOK_FLIGHT_REQUEST = "BookFlightRequest"; - String GET_FLIGHTS_REQUEST = "GetFlightsRequest"; + String GET_FLIGHTS_REQUEST = "GetFlightsRequest"; - String GET_FREQUENT_FLYER_MILEAGE_RESPONSE = "GetFrequentFlyerMileageResponse"; + String GET_FREQUENT_FLYER_MILEAGE_RESPONSE = "GetFrequentFlyerMileageResponse"; - String MESSAGES_NAMESPACE = "http://www.springframework.org/spring-ws/samples/airline/schemas/messages"; + String MESSAGES_NAMESPACE = "http://www.springframework.org/spring-ws/samples/airline/schemas/messages"; + + String GET_FREQUENT_FLYER_MILEAGE_REQUEST = "GetFrequentFlyerMileageRequest"; - String GET_FREQUENT_FLYER_MILEAGE_REQUEST = "GetFrequentFlyerMileageRequest"; } diff --git a/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/WebServicesConfiguration.java b/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/WebServicesConfiguration.java index 82963ee..4cedbc0 100644 --- a/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/WebServicesConfiguration.java +++ b/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/WebServicesConfiguration.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.springframework.ws.samples.airline.ws; import javax.security.auth.callback.CallbackHandler; @@ -60,8 +76,10 @@ public class WebServicesConfiguration { Wss4jSecurityInterceptor securityInterceptor(SpringSecurityPasswordValidationCallbackHandler handler) { /** - * - * + * + * + * */ Wss4jSecurityInterceptor securityInterceptor = new Wss4jSecurityInterceptor(); securityInterceptor.setValidationActions("UsernameToken"); @@ -73,7 +91,8 @@ public class WebServicesConfiguration { @Bean PayloadRootSmartSoapEndpointInterceptor smartSoapEndpointInterceptor(Wss4jSecurityInterceptor securityInterceptor) { return new PayloadRootSmartSoapEndpointInterceptor(securityInterceptor, - "http://www.springframework.org/spring-ws/samples/airline/schemas/messages", "GetFrequentFlyerMileageRequest"); + "http://www.springframework.org/spring-ws/samples/airline/schemas/messages", + "GetFrequentFlyerMileageRequest"); } @Bean diff --git a/echo/client/saaj/src/main/java/org/springframework/ws/samples/echo/client/saaj/EchoClient.java b/echo/client/saaj/src/main/java/org/springframework/ws/samples/echo/client/saaj/EchoClient.java index 3b2ce01..d1d6c8c 100644 --- a/echo/client/saaj/src/main/java/org/springframework/ws/samples/echo/client/saaj/EchoClient.java +++ b/echo/client/saaj/src/main/java/org/springframework/ws/samples/echo/client/saaj/EchoClient.java @@ -1,11 +1,11 @@ /* - * Copyright 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -68,7 +68,8 @@ public class EchoClient { SOAPMessage response = connection.call(request, url); if (!response.getSOAPBody().hasFault()) { writeEchoResponse(response); - } else { + } + else { SOAPFault fault = response.getSOAPBody().getFault(); logger.error("Received SOAP Fault"); logger.error("SOAP Fault Code :" + fault.getFaultCode()); @@ -80,9 +81,11 @@ public class EchoClient { SOAPEnvelope envelope = message.getSOAPPart().getEnvelope(); Name echoResponseName = envelope.createName("echoResponse", PREFIX, NAMESPACE_URI); - SOAPBodyElement echoResponseElement = (SOAPBodyElement) message.getSOAPBody().getChildElements(echoResponseName) - .next(); + SOAPBodyElement echoResponseElement = (SOAPBodyElement) message.getSOAPBody() + .getChildElements(echoResponseName) + .next(); String echoValue = echoResponseElement.getTextContent(); logger.info("Echo Response [" + echoValue + "]"); } + } diff --git a/echo/client/saaj/src/main/java/org/springframework/ws/samples/echo/client/saaj/SaajEchoClient.java b/echo/client/saaj/src/main/java/org/springframework/ws/samples/echo/client/saaj/SaajEchoClient.java index b0d2277..e8533a9 100644 --- a/echo/client/saaj/src/main/java/org/springframework/ws/samples/echo/client/saaj/SaajEchoClient.java +++ b/echo/client/saaj/src/main/java/org/springframework/ws/samples/echo/client/saaj/SaajEchoClient.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.springframework.ws.samples.echo.client.saaj; import jakarta.xml.soap.SOAPException; @@ -21,4 +37,5 @@ public class SaajEchoClient { EchoClient echoClient = new EchoClient(url); echoClient.callWebService(); } + } diff --git a/echo/client/spring-ws/src/main/java/org/springframework/ws/samples/echo/client/sws/EchoClient.java b/echo/client/spring-ws/src/main/java/org/springframework/ws/samples/echo/client/sws/EchoClient.java index 40e5f94..385b03b 100644 --- a/echo/client/spring-ws/src/main/java/org/springframework/ws/samples/echo/client/sws/EchoClient.java +++ b/echo/client/spring-ws/src/main/java/org/springframework/ws/samples/echo/client/sws/EchoClient.java @@ -1,11 +1,11 @@ /* - * Copyright 2007 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -47,4 +47,5 @@ public class EchoClient extends WebServiceGatewaySupport { logger.info(result.toString()); } + } diff --git a/echo/client/spring-ws/src/main/java/org/springframework/ws/samples/echo/client/sws/SpringWsEchoClient.java b/echo/client/spring-ws/src/main/java/org/springframework/ws/samples/echo/client/sws/SpringWsEchoClient.java index 6507859..75d275d 100644 --- a/echo/client/spring-ws/src/main/java/org/springframework/ws/samples/echo/client/sws/SpringWsEchoClient.java +++ b/echo/client/spring-ws/src/main/java/org/springframework/ws/samples/echo/client/sws/SpringWsEchoClient.java @@ -1,11 +1,11 @@ /* - * Copyright 2007 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -38,4 +38,5 @@ public class SpringWsEchoClient { echoClient.echo(); }; } + } diff --git a/echo/server/src/main/java/org/springframework/ws/samples/echo/EchoApplication.java b/echo/server/src/main/java/org/springframework/ws/samples/echo/EchoApplication.java index 775d859..f684abe 100644 --- a/echo/server/src/main/java/org/springframework/ws/samples/echo/EchoApplication.java +++ b/echo/server/src/main/java/org/springframework/ws/samples/echo/EchoApplication.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.springframework.ws.samples.echo; import org.springframework.boot.SpringApplication; @@ -9,4 +25,5 @@ public class EchoApplication { public static void main(String[] args) { SpringApplication.run(EchoApplication.class, args); } + } diff --git a/echo/server/src/main/java/org/springframework/ws/samples/echo/config/EchoConfig.java b/echo/server/src/main/java/org/springframework/ws/samples/echo/config/EchoConfig.java index 5f77ffa..5d6bca0 100644 --- a/echo/server/src/main/java/org/springframework/ws/samples/echo/config/EchoConfig.java +++ b/echo/server/src/main/java/org/springframework/ws/samples/echo/config/EchoConfig.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2014 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -64,4 +64,5 @@ public class EchoConfig extends WsConfigurerAdapter { return definition; } + } diff --git a/echo/server/src/main/java/org/springframework/ws/samples/echo/service/EchoService.java b/echo/server/src/main/java/org/springframework/ws/samples/echo/service/EchoService.java index a4de3bd..4b6cec6 100644 --- a/echo/server/src/main/java/org/springframework/ws/samples/echo/service/EchoService.java +++ b/echo/server/src/main/java/org/springframework/ws/samples/echo/service/EchoService.java @@ -1,11 +1,11 @@ /* - * Copyright 2006 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -26,8 +26,8 @@ public interface EchoService { /** * Returns the given string. - * * @return message */ String echo(String message); + } diff --git a/echo/server/src/main/java/org/springframework/ws/samples/echo/service/impl/EchoServiceImpl.java b/echo/server/src/main/java/org/springframework/ws/samples/echo/service/impl/EchoServiceImpl.java index 266681f..a682d67 100755 --- a/echo/server/src/main/java/org/springframework/ws/samples/echo/service/impl/EchoServiceImpl.java +++ b/echo/server/src/main/java/org/springframework/ws/samples/echo/service/impl/EchoServiceImpl.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2010 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -31,4 +31,5 @@ public class EchoServiceImpl implements EchoService { public String echo(String message) { return message; } + } diff --git a/echo/server/src/main/java/org/springframework/ws/samples/echo/ws/EchoEndpoint.java b/echo/server/src/main/java/org/springframework/ws/samples/echo/ws/EchoEndpoint.java index b0b6136..6351b6e 100755 --- a/echo/server/src/main/java/org/springframework/ws/samples/echo/ws/EchoEndpoint.java +++ b/echo/server/src/main/java/org/springframework/ws/samples/echo/ws/EchoEndpoint.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2010 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -33,7 +33,8 @@ import org.w3c.dom.NodeList; import org.w3c.dom.Text; /** - * Simple echoing Web service endpoint. Uses a EchoService to create a response string. + * Simple echoing Web service endpoint. Uses a EchoService to create a + * response string. * * @author Ingo Siebert * @author Arjen Poutsma @@ -66,7 +67,6 @@ public class EchoEndpoint { /** * Reads the given requestElement, and sends a the response back. - * * @param requestElement the contents of the SOAP message as DOM elements * @return the response element */ @@ -101,4 +101,5 @@ public class EchoEndpoint { return responseElement; } + } diff --git a/echo/server/src/test/java/org/springframework/ws/samples/echo/ws/EchoEndpointTest.java b/echo/server/src/test/java/org/springframework/ws/samples/echo/ws/EchoEndpointTest.java index d5dab28..2f75115 100644 --- a/echo/server/src/test/java/org/springframework/ws/samples/echo/ws/EchoEndpointTest.java +++ b/echo/server/src/test/java/org/springframework/ws/samples/echo/ws/EchoEndpointTest.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2010 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -68,4 +68,5 @@ public class EchoEndpointTest { verify(echoServiceMock); } + } diff --git a/mtom/client/spring-ws/src/main/java/org/springframework/ws/samples/mtom/client/sws/MtomClientConfig.java b/mtom/client/spring-ws/src/main/java/org/springframework/ws/samples/mtom/client/sws/MtomClientConfig.java index 04de5f7..c0a4f08 100644 --- a/mtom/client/spring-ws/src/main/java/org/springframework/ws/samples/mtom/client/sws/MtomClientConfig.java +++ b/mtom/client/spring-ws/src/main/java/org/springframework/ws/samples/mtom/client/sws/MtomClientConfig.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.springframework.ws.samples.mtom.client.sws; import org.springframework.context.annotation.Bean; diff --git a/mtom/client/spring-ws/src/main/java/org/springframework/ws/samples/mtom/client/sws/SaajMtomClient.java b/mtom/client/spring-ws/src/main/java/org/springframework/ws/samples/mtom/client/sws/SaajMtomClient.java index 738f2ee..1943d5d 100644 --- a/mtom/client/spring-ws/src/main/java/org/springframework/ws/samples/mtom/client/sws/SaajMtomClient.java +++ b/mtom/client/spring-ws/src/main/java/org/springframework/ws/samples/mtom/client/sws/SaajMtomClient.java @@ -1,11 +1,11 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -35,8 +35,8 @@ import org.springframework.ws.client.core.support.WebServiceGatewaySupport; import org.springframework.ws.soap.saaj.SaajSoapMessageFactory; /** - * Simple client that demonstrates MTOM by invoking {@code StoreImage} and {@code LoadImage} using a WebServiceTemplate - * and SAAJ. + * Simple client that demonstrates MTOM by invoking {@code StoreImage} and + * {@code LoadImage} using a WebServiceTemplate and SAAJ. * * @author Tareq Abed Rabbo * @author Arjen Poutsma @@ -60,6 +60,7 @@ public class SaajMtomClient extends WebServiceGatewaySupport { private static final Logger logger = LoggerFactory.getLogger(SaajMtomClient.class); private ObjectFactory objectFactory = new ObjectFactory(); + private StopWatch stopWatch = new StopWatch(ClassUtils.getShortName(getClass())); public SaajMtomClient(SaajSoapMessageFactory messageFactory) { @@ -71,8 +72,8 @@ public class SaajMtomClient extends WebServiceGatewaySupport { StoreContentRequest storeContentRequest = this.objectFactory.createStoreContentRequest(); storeContentRequest.setName("spring-ws-logo"); - storeContentRequest - .setContent(new DataHandler(Thread.currentThread().getContextClassLoader().getResource("spring-ws-logo.png"))); + storeContentRequest.setContent( + new DataHandler(Thread.currentThread().getContextClassLoader().getResource("spring-ws-logo.png"))); this.stopWatch.start("store"); @@ -96,7 +97,7 @@ public class SaajMtomClient extends WebServiceGatewaySupport { this.stopWatch.start("load"); LoadContentResponse loadContentResponse = (LoadContentResponse) getWebServiceTemplate() - .marshalSendAndReceive(loadContentRequest); + .marshalSendAndReceive(loadContentRequest); this.stopWatch.stop(); @@ -132,4 +133,5 @@ public class SaajMtomClient extends WebServiceGatewaySupport { return size; } + } diff --git a/mtom/server/src/main/java/org/springframework/ws/samples/mtom/MtomServer.java b/mtom/server/src/main/java/org/springframework/ws/samples/mtom/MtomServer.java index 8ab8042..df48d4d 100644 --- a/mtom/server/src/main/java/org/springframework/ws/samples/mtom/MtomServer.java +++ b/mtom/server/src/main/java/org/springframework/ws/samples/mtom/MtomServer.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.springframework.ws.samples.mtom; import org.springframework.boot.SpringApplication; @@ -9,4 +25,5 @@ public class MtomServer { public static void main(String[] args) { SpringApplication.run(MtomServer.class, args); } + } diff --git a/mtom/server/src/main/java/org/springframework/ws/samples/mtom/config/MtomServerConfiguration.java b/mtom/server/src/main/java/org/springframework/ws/samples/mtom/config/MtomServerConfiguration.java index 8013e0b..a9e9017 100644 --- a/mtom/server/src/main/java/org/springframework/ws/samples/mtom/config/MtomServerConfiguration.java +++ b/mtom/server/src/main/java/org/springframework/ws/samples/mtom/config/MtomServerConfiguration.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.springframework.ws.samples.mtom.config; import java.util.Collections; diff --git a/mtom/server/src/main/java/org/springframework/ws/samples/mtom/service/ContentRepository.java b/mtom/server/src/main/java/org/springframework/ws/samples/mtom/service/ContentRepository.java index ffe693a..62db61c 100644 --- a/mtom/server/src/main/java/org/springframework/ws/samples/mtom/service/ContentRepository.java +++ b/mtom/server/src/main/java/org/springframework/ws/samples/mtom/service/ContentRepository.java @@ -1,11 +1,11 @@ /* - * Copyright 2007 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -21,7 +21,9 @@ import jakarta.activation.DataHandler; import java.io.File; import java.io.IOException; -/** @author Arjen Poutsma */ +/** + * @author Arjen Poutsma + */ public interface ContentRepository { File loadContent(String name); diff --git a/mtom/server/src/main/java/org/springframework/ws/samples/mtom/service/ContentRepositoryImpl.java b/mtom/server/src/main/java/org/springframework/ws/samples/mtom/service/ContentRepositoryImpl.java index 90d0b13..285829b 100644 --- a/mtom/server/src/main/java/org/springframework/ws/samples/mtom/service/ContentRepositoryImpl.java +++ b/mtom/server/src/main/java/org/springframework/ws/samples/mtom/service/ContentRepositoryImpl.java @@ -1,11 +1,11 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -25,7 +25,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -/** @author Arjen Poutsma */ +/** + * @author Arjen Poutsma + */ @Service class ContentRepositoryImpl implements ContentRepository { @@ -56,4 +58,5 @@ class ContentRepositoryImpl implements ContentRepository { } logger.info("Content stored."); } + } diff --git a/mtom/server/src/main/java/org/springframework/ws/samples/mtom/ws/ContentRepositoryEndpoint.java b/mtom/server/src/main/java/org/springframework/ws/samples/mtom/ws/ContentRepositoryEndpoint.java index b96e5b8..1d2b330 100644 --- a/mtom/server/src/main/java/org/springframework/ws/samples/mtom/ws/ContentRepositoryEndpoint.java +++ b/mtom/server/src/main/java/org/springframework/ws/samples/mtom/ws/ContentRepositoryEndpoint.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2012 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -30,7 +30,9 @@ import org.springframework.ws.server.endpoint.annotation.PayloadRoot; import org.springframework.ws.server.endpoint.annotation.RequestPayload; import org.springframework.ws.server.endpoint.annotation.ResponsePayload; -/** @author Arjen Poutsma */ +/** + * @author Arjen Poutsma + */ @Endpoint public class ContentRepositoryEndpoint { diff --git a/pom.xml b/pom.xml index 0017830..60494a2 100644 --- a/pom.xml +++ b/pom.xml @@ -40,6 +40,7 @@ 3.0.2 2.0.6.1 3.0.0 + 0.0.43 1.6.3 2.3.1 @@ -125,6 +126,19 @@ + + io.spring.javaformat + spring-javaformat-maven-plugin + ${spring-javaformat.version} + + + validate + + validate + + + + org.springframework.boot spring-boot-maven-plugin diff --git a/tutorial/src/main/java/com/mycompany/hr/HrApplication.java b/tutorial/src/main/java/com/mycompany/hr/HrApplication.java index bb79949..492e56f 100644 --- a/tutorial/src/main/java/com/mycompany/hr/HrApplication.java +++ b/tutorial/src/main/java/com/mycompany/hr/HrApplication.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.mycompany.hr; import org.springframework.boot.SpringApplication; @@ -9,4 +25,5 @@ public class HrApplication { public static void main(String[] args) { SpringApplication.run(HrApplication.class, args); } + } diff --git a/tutorial/src/main/java/com/mycompany/hr/config/HRConfiguration.java b/tutorial/src/main/java/com/mycompany/hr/config/HRConfiguration.java index 1927da0..972edda 100644 --- a/tutorial/src/main/java/com/mycompany/hr/config/HRConfiguration.java +++ b/tutorial/src/main/java/com/mycompany/hr/config/HRConfiguration.java @@ -1,3 +1,19 @@ +/* + * Copyright 2006-2025 the original author or authors. + * + * 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 + * + * https://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.mycompany.hr.config; import org.springframework.context.annotation.Bean; @@ -30,4 +46,5 @@ public class HRConfiguration { collection.setInline(true); return collection; } + } diff --git a/tutorial/src/main/java/com/mycompany/hr/service/HumanResourceService.java b/tutorial/src/main/java/com/mycompany/hr/service/HumanResourceService.java index ebc47d8..3e55a46 100644 --- a/tutorial/src/main/java/com/mycompany/hr/service/HumanResourceService.java +++ b/tutorial/src/main/java/com/mycompany/hr/service/HumanResourceService.java @@ -1,11 +1,11 @@ /* - * Copyright 2007 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -19,20 +19,19 @@ package com.mycompany.hr.service; import java.util.Date; /** - * This interface defined the contract for a HR business service. It is used by the {@link - * com.mycompany.hr.ws.HolidayEndpoint}. + * This interface defined the contract for a HR business service. It is used by the + * {@link com.mycompany.hr.ws.HolidayEndpoint}. * * @author Arjen Poutsma */ public interface HumanResourceService { - /** - * Books a holiday. - * - * @param startDate the start date of the holiday - * @param endDate the end date of the holiday - * @param name the name of the person taking the holiday - */ - void bookHoliday(Date startDate, Date endDate, String name); + /** + * Books a holiday. + * @param startDate the start date of the holiday + * @param endDate the end date of the holiday + * @param name the name of the person taking the holiday + */ + void bookHoliday(Date startDate, Date endDate, String name); } diff --git a/tutorial/src/main/java/com/mycompany/hr/service/StubHumanResourceService.java b/tutorial/src/main/java/com/mycompany/hr/service/StubHumanResourceService.java index 3da8b6d..4526e19 100644 --- a/tutorial/src/main/java/com/mycompany/hr/service/StubHumanResourceService.java +++ b/tutorial/src/main/java/com/mycompany/hr/service/StubHumanResourceService.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2010 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -24,16 +24,18 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** - * Simple stub implementation of {@link HumanResourceService}, which does nothing but logging. + * Simple stub implementation of {@link HumanResourceService}, which does nothing but + * logging. * * @author Arjen Poutsma */ @Service public class StubHumanResourceService implements HumanResourceService { - private static final Log logger = LogFactory.getLog(StubHumanResourceService.class); + private static final Log logger = LogFactory.getLog(StubHumanResourceService.class); + + public void bookHoliday(Date startDate, Date endDate, String name) { + logger.info("Booking holiday for [" + startDate + "-" + endDate + "] for [" + name + "] "); + } - public void bookHoliday(Date startDate, Date endDate, String name) { - logger.info("Booking holiday for [" + startDate + "-" + endDate + "] for [" + name + "] "); - } } diff --git a/tutorial/src/main/java/com/mycompany/hr/ws/HolidayEndpoint.java b/tutorial/src/main/java/com/mycompany/hr/ws/HolidayEndpoint.java index 00e5442..549a9d2 100644 --- a/tutorial/src/main/java/com/mycompany/hr/ws/HolidayEndpoint.java +++ b/tutorial/src/main/java/com/mycompany/hr/ws/HolidayEndpoint.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2010 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -33,8 +33,9 @@ import org.springframework.ws.server.endpoint.annotation.RequestPayload; import com.mycompany.hr.service.HumanResourceService; /** - * This endpoint handles holiday requests. It uses a combination of JDOM and XPath to extract interesting pieces of XML - * from the incoming message, and invoked the injected {@link HumanResourceService} with those. + * This endpoint handles holiday requests. It uses a combination of JDOM and XPath to + * extract interesting pieces of XML from the incoming message, and invoked the injected + * {@link HumanResourceService} with those. * * @author Arjen Poutsma */ @@ -83,7 +84,8 @@ public class HolidayEndpoint { if (result != null) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); return dateFormat.parse(result.getText()); - } else { + } + else { throw new IllegalArgumentException("Could not evaluate [" + expression + "] on [" + element + "]"); } } diff --git a/tutorial/src/test/java/com/mycompany/hr/ws/HolidayEndpointTest.java b/tutorial/src/test/java/com/mycompany/hr/ws/HolidayEndpointTest.java index d1fcca6..ec1d158 100644 --- a/tutorial/src/test/java/com/mycompany/hr/ws/HolidayEndpointTest.java +++ b/tutorial/src/test/java/com/mycompany/hr/ws/HolidayEndpointTest.java @@ -1,11 +1,11 @@ /* - * Copyright 2005-2010 the original author or authors. + * Copyright 2006-2025 the original author or authors. * * 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 + * https://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, @@ -48,7 +48,8 @@ public class HolidayEndpointTest { InputStream is = getClass().getResourceAsStream("holidayRequest.xml"); try { holidayRequest = builder.build(is); - } finally { + } + finally { is.close(); } endpoint = new HolidayEndpoint(serviceMock);