SPR40 Polishing
- Copyright - White space
This commit is contained in:
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2013 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
|
||||
*
|
||||
* 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.integration;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -6,62 +21,71 @@ import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.support.MessageHeaderAccessor;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
*
|
||||
* Adds standard SI Headers.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @since 4.0
|
||||
*
|
||||
*/
|
||||
public class EiMessageHeaderAccessor extends MessageHeaderAccessor {
|
||||
|
||||
public static final String CORRELATION_ID = "correlationId";
|
||||
public static final String CORRELATION_ID = "correlationId";
|
||||
|
||||
public static final String EXPIRATION_DATE = "expirationDate";
|
||||
public static final String EXPIRATION_DATE = "expirationDate";
|
||||
|
||||
public static final String PRIORITY = "priority";
|
||||
public static final String PRIORITY = "priority";
|
||||
|
||||
public static final String SEQUENCE_NUMBER = "sequenceNumber";
|
||||
public static final String SEQUENCE_NUMBER = "sequenceNumber";
|
||||
|
||||
public static final String SEQUENCE_SIZE = "sequenceSize";
|
||||
public static final String SEQUENCE_SIZE = "sequenceSize";
|
||||
|
||||
public static final String SEQUENCE_DETAILS = "sequenceDetails";
|
||||
public static final String SEQUENCE_DETAILS = "sequenceDetails";
|
||||
|
||||
public static final String POSTPROCESS_RESULT = "postProcessResult";
|
||||
public static final String POSTPROCESS_RESULT = "postProcessResult";
|
||||
|
||||
public EiMessageHeaderAccessor(Message<?> message) {
|
||||
super(message);
|
||||
}
|
||||
public EiMessageHeaderAccessor(Message<?> message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public Long getExpirationDate() {
|
||||
return this.getHeader(EXPIRATION_DATE, Long.class);
|
||||
}
|
||||
public Long getExpirationDate() {
|
||||
return this.getHeader(EXPIRATION_DATE, Long.class);
|
||||
}
|
||||
|
||||
public Object getCorrelationId() {
|
||||
return this.getHeader(CORRELATION_ID);
|
||||
}
|
||||
public Object getCorrelationId() {
|
||||
return this.getHeader(CORRELATION_ID);
|
||||
}
|
||||
|
||||
public Integer getSequenceNumber() {
|
||||
Integer sequenceNumber = this.getHeader(SEQUENCE_NUMBER, Integer.class);
|
||||
return (sequenceNumber != null ? sequenceNumber : 0);
|
||||
}
|
||||
public Integer getSequenceNumber() {
|
||||
Integer sequenceNumber = this.getHeader(SEQUENCE_NUMBER, Integer.class);
|
||||
return (sequenceNumber != null ? sequenceNumber : 0);
|
||||
}
|
||||
|
||||
public Integer getSequenceSize() {
|
||||
Integer sequenceSize = this.getHeader(SEQUENCE_SIZE, Integer.class);
|
||||
return (sequenceSize != null ? sequenceSize : 0);
|
||||
}
|
||||
public Integer getSequenceSize() {
|
||||
Integer sequenceSize = this.getHeader(SEQUENCE_SIZE, Integer.class);
|
||||
return (sequenceSize != null ? sequenceSize : 0);
|
||||
}
|
||||
|
||||
public Integer getPriority() {
|
||||
return this.getHeader(PRIORITY, Integer.class);
|
||||
}
|
||||
public Integer getPriority() {
|
||||
return this.getHeader(PRIORITY, Integer.class);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getHeader(String key, Class<T> type) {
|
||||
Object value = getHeader(key);
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if (!type.isAssignableFrom(value.getClass())) {
|
||||
throw new IllegalArgumentException("Incorrect type specified for header '" + key + "'. Expected [" + type
|
||||
+ "] but actual type is [" + value.getClass() + "]");
|
||||
}
|
||||
return (T) value;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T getHeader(String key, Class<T> type) {
|
||||
Object value = getHeader(key);
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if (!type.isAssignableFrom(value.getClass())) {
|
||||
throw new IllegalArgumentException("Incorrect type specified for header '" + key + "'. Expected [" + type
|
||||
+ "] but actual type is [" + value.getClass() + "]");
|
||||
}
|
||||
return (T) value;
|
||||
}
|
||||
|
||||
protected void verifyType(String headerName, Object headerValue) {
|
||||
@Override
|
||||
protected void verifyType(String headerName, Object headerValue) {
|
||||
if (headerName != null && headerValue != null) {
|
||||
super.verifyType(headerName, headerValue);
|
||||
if (EiMessageHeaderAccessor.EXPIRATION_DATE.equals(headerName)) {
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
/*
|
||||
<<<<<<< HEAD
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
=======
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
>>>>>>> Further Spring 4 updates.
|
||||
*
|
||||
* 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
|
||||
@@ -21,6 +17,7 @@ import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.expression.Expression;
|
||||
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
|
||||
import org.springframework.integration.router.AbstractMappingMessageRouter;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2013 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.
|
||||
@@ -22,6 +22,12 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
import org.springframework.messaging.MessageHeaders.IdGenerator;
|
||||
|
||||
// TODO Discuss and agree where these should go. In SI or in Spring 4?
|
||||
/**
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @since 4.0
|
||||
*
|
||||
*/
|
||||
public class IdGenerators {
|
||||
|
||||
public static class JdkIdGenerator implements IdGenerator {
|
||||
|
||||
Reference in New Issue
Block a user