Changeset 1172
- Timestamp:
- 10/24/11 17:41:17 (20 months ago)
- Location:
- raptor-information-model/trunk/src/main/java/uk/ac/cardiff
- Files:
-
- 1 added
- 14 edited
-
model/event/AuthenticationFailureEvent.java (modified) (2 diffs)
-
model/event/Event.java (modified) (5 diffs)
-
model/event/EzproxyAuthenticationEvent.java (modified) (3 diffs)
-
model/event/EzproxyProxyEvent.java (modified) (2 diffs)
-
model/event/OpenathenslaAuthenticationEvent.java (modified) (3 diffs)
-
model/event/ProxyEvent.java (modified) (2 diffs)
-
model/event/ShibbolethIdpAuthenticationEvent.java (modified) (1 diff)
-
model/event/auxiliary/PrincipalInformation.java (modified) (4 diffs)
-
model/report/AggregatorGraphModel.java (modified) (1 diff)
-
model/wsmodel/Capabilities.java (modified) (11 diffs)
-
model/wsmodel/EventPushMessage.java (modified) (1 diff)
-
model/wsmodel/LogFileUpload.java (modified) (10 diffs)
-
model/wsmodel/LogFileUploadResult.java (modified) (6 diffs)
-
model/wsmodel/MethodParameter.java (modified) (1 diff)
-
utility/StringUtils.java (added)
Legend:
- Unmodified
- Added
- Removed
-
raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/event/AuthenticationFailureEvent.java
r614 r1172 4 4 package uk.ac.cardiff.model.event; 5 5 6 import uk.ac.cardiff.utility.StringUtils; 7 6 8 /** 7 9 * @author philsmart 8 * 10 * 9 11 */ 10 12 public class AuthenticationFailureEvent { … … 14 16 private String errorDescription; 15 17 18 public void setErrorCode(String errorCode) { 19 this.errorCode = errorCode; 20 } 16 21 17 public void setErrorCode(String errorCode) {18 this.errorCode =errorCode;22 public String getErrorCode() { 23 return errorCode; 19 24 } 20 public String getErrorCode() { 21 return errorCode; 25 26 public void setErrorType(String errorType) { 27 this.errorType = errorType; 22 28 } 23 public void setErrorType(String errorType) { 24 this.errorType = errorType; 29 30 public String getErrorType() { 31 return errorType; 25 32 } 26 public String getErrorType() { 27 return errorType; 33 34 public void setErrorDescription(String errorDescription) { 35 this.errorDescription = errorDescription; 28 36 } 29 public void setErrorDescription(String errorDescription) { 30 this.errorDescription = errorDescription; 37 38 public String getErrorDescription() { 39 return errorDescription; 31 40 } 32 public String getErrorDescription() { 33 return errorDescription; 41 42 public String toString() { 43 return StringUtils.buildToString(this); 34 44 } 35 45 -
raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/event/Event.java
r800 r1172 24 24 25 25 import uk.ac.cardiff.model.event.auxiliary.EventMetadata; 26 import uk.ac.cardiff.utility.StringUtils; 26 27 27 28 /** 28 * For any class that extends this class, equality must be computed for the 29 * same fields as the hash. Otherwise a discrepancy will occur when checking 29 * For any class that extends this class, equality must be computed for the same fields as the hash. Otherwise a discrepancy will occur when checking 30 30 * containment through object equality (e.g. set containment), and through hashcodes. 31 * 31 * 32 32 * @author philsmart 33 * 33 * 34 34 */ 35 35 public class Event { 36 36 37 /** used if a persistant db primary key is required. Not to 38 * be used in the computation of the hash or equals methods */ 37 /** 38 * used if a persistant db primary key is required. Not to be used in the computation of the hash or equals methods 39 */ 39 40 private Long persistantId; 40 41 41 /** attributes generic to all entries */42 /** attributes generic to all entries. */ 42 43 private DateTime eventTime; 43 44 44 /** Event id, as generated and added by the hashcode of this method.45 * Not to be used in computation of the hash or equals methods.45 /** 46 * Event id, as generated and added by the hashcode of this method. Not to be used in computation of the hash or equals methods. 46 47 */ 47 48 private int eventId; 49 50 /** The service id. */ 48 51 private String serviceId; 52 53 /** The event type. */ 49 54 private String eventType; 55 56 /** The service host. */ 50 57 private String serviceHost; 58 59 /** The resource host. */ 51 60 private String resourceHost; 61 62 /** The resource id. */ 52 63 private String resourceId; 53 64 54 /** User defined category for this event for this resourceId, e.g. internal resource or external resource.55 * 1 - Internal56 * 2 - External*/65 /** 66 * User defined category for this event for this resourceId, e.g. internal resource or external resource. 1 - Internal 2 - External 67 */ 57 68 private int resourceIdCategory; 58 69 59 /** Metadata about the service this event was generated from. Not used in 60 * Hash or Equality methods. */ 70 /** 71 * Metadata about the service this event was generated from. Not used in Hash or Equality methods. 72 */ 61 73 private EventMetadata eventMetadata; 62 74 63 64 public Event(){ 65 66 } 67 68 /** A Copy constructor */ 69 public Event(Event event){ 70 //this has a defensive getter, so a direct assignment is possible 75 /** 76 * Instantiates a new event. 77 */ 78 public Event() { 79 80 } 81 82 /** 83 * A Copy constructor. 84 * 85 * @param event 86 * the event 87 */ 88 public Event(Event event) { 89 // this has a defensive getter, so a direct assignment is possible 71 90 this.eventTime = event.getEventTime(); 72 91 this.eventId = event.getEventId(); … … 79 98 } 80 99 81 public Event copy(){ 100 /** 101 * Copy. 102 * 103 * @return the event 104 */ 105 public Event copy() { 82 106 return new Event(this); 83 107 } 84 108 109 /** 110 * New instance. 111 * 112 * @return the event 113 */ 85 114 public static Event newInstance() { 86 115 return new Event(); 87 } 88 89 116 } 117 118 /** 119 * Sets the event time. 120 * 121 * @param eventTime 122 * the new event time 123 */ 90 124 public void setEventTime(DateTime eventTime) { 91 this.eventTime = eventTime; 92 } 93 94 /** 95 * Returns the eventTime using a defensive copy 96 * @return 125 this.eventTime = eventTime; 126 } 127 128 /** 129 * Returns the eventTime using a defensive copy. 130 * 131 * @return the event time 97 132 */ 98 133 public DateTime getEventTime() { 99 return new DateTime(eventTime);134 return new DateTime(eventTime); 100 135 } 101 136 … … 104 139 * convert from DateTime to Date 105 140 * <p> 106 * 141 * 107 142 * @return a Date representation of the eventTime DateTime format 108 143 */ 109 144 public Date getDate() { 110 Date now = new Date(eventTime.getMillis());111 return now;145 Date now = new Date(eventTime.getMillis()); 146 return now; 112 147 113 148 } … … 117 152 * convert from the XML Date to the DateTime used by eventTime 118 153 * <p> 119 * 154 * 155 * @param date 156 * the new date 120 157 * @return a Date representation of the eventTime DateTime format 121 158 */ 122 159 public void setDate(Date date) { 123 eventTime = new DateTime(date.getTime()); 124 125 } 126 127 /** 128 * Gets the event time in milliseconds since EPOCH. Used for consistent hashing 129 * of the <code>eventTime<code> field. 130 * 131 * @return 132 */ 133 public long getEventTimeMillis(){ 160 eventTime = new DateTime(date.getTime()); 161 162 } 163 164 /** 165 * Gets the event time in milliseconds since EPOCH. Used for consistent hashing of the <code>eventTime<code> field. 166 * 167 * @return the event time millis 168 */ 169 public long getEventTimeMillis() { 134 170 return eventTime.getMillis(); 135 171 } 136 172 173 /** 174 * Sets the persistant id. 175 * 176 * @param persistantId 177 * the new persistant id 178 */ 137 179 public void setPersistantId(Long persistantId) { 138 this.persistantId = persistantId; 139 } 140 180 this.persistantId = persistantId; 181 } 182 183 /** 184 * Gets the persistant id. 185 * 186 * @return the persistant id 187 */ 141 188 public Long getPersistantId() { 142 return persistantId; 143 } 144 189 return persistantId; 190 } 191 192 /** 193 * Sets the event type. 194 * 195 * @param eventType 196 * the new event type 197 */ 145 198 public void setEventType(String eventType) { 146 this.eventType = eventType; 147 } 148 199 this.eventType = eventType; 200 } 201 202 /** 203 * Gets the event type. 204 * 205 * @return the event type 206 */ 149 207 public String getEventType() { 150 return eventType; 151 } 152 208 return eventType; 209 } 210 211 /** 212 * Sets the service host. 213 * 214 * @param serviceHost 215 * the new service host 216 */ 153 217 public void setServiceHost(String serviceHost) { 154 this.serviceHost = serviceHost; 155 } 156 218 this.serviceHost = serviceHost; 219 } 220 221 /** 222 * Gets the service host. 223 * 224 * @return the service host 225 */ 157 226 public String getServiceHost() { 158 return serviceHost; 159 } 160 227 return serviceHost; 228 } 229 230 /** 231 * Sets the resource host. 232 * 233 * @param resourceHost 234 * the new resource host 235 */ 161 236 public void setResourceHost(String resourceHost) { 162 this.resourceHost = resourceHost; 163 } 164 237 this.resourceHost = resourceHost; 238 } 239 240 /** 241 * Gets the resource host. 242 * 243 * @return the resource host 244 */ 165 245 public String getResourceHost() { 166 return resourceHost; 167 } 168 246 return resourceHost; 247 } 248 249 /** 250 * Sets the resource id. 251 * 252 * @param resourceId 253 * the new resource id 254 */ 169 255 public void setResourceId(String resourceId) { 170 this.resourceId = resourceId; 171 } 172 256 this.resourceId = resourceId; 257 } 258 259 /** 260 * Gets the resource id. 261 * 262 * @return the resource id 263 */ 173 264 public String getResourceId() { 174 return resourceId; 175 } 176 177 /** 178 * @param resourceIdCategory the resourceIdCategory to set 265 return resourceId; 266 } 267 268 /** 269 * Sets the resource id category. 270 * 271 * @param resourceIdCategory 272 * the resourceIdCategory to set 179 273 */ 180 274 public void setResourceIdCategory(int resourceIdCategory) { 181 this.resourceIdCategory = resourceIdCategory; 182 } 183 184 /** 275 this.resourceIdCategory = resourceIdCategory; 276 } 277 278 /** 279 * Gets the resource id category. 280 * 185 281 * @return the resourceIdCategory 186 282 */ 187 283 public int getResourceIdCategory() { 188 return resourceIdCategory; 189 } 190 284 return resourceIdCategory; 285 } 286 287 /** 288 * Sets the event id. 289 * 290 * @param eventId 291 * the new event id 292 */ 191 293 public void setEventId(int eventId) { 192 294 this.eventId = eventId; 193 295 } 194 296 297 /** 298 * Gets the event id. 299 * 300 * @return the event id 301 */ 195 302 public int getEventId() { 196 303 return eventId; 197 304 } 198 305 306 /** 307 * Sets the service id. 308 * 309 * @param serviceId 310 * the new service id 311 */ 199 312 public void setServiceId(String serviceId) { 200 313 this.serviceId = serviceId; 201 314 } 202 315 316 /** 317 * Gets the service id. 318 * 319 * @return the service id 320 */ 203 321 public String getServiceId() { 204 322 return serviceId; 205 323 } 206 324 207 325 /* 326 * (non-Javadoc) 327 * 328 * @see java.lang.Object#toString() 329 */ 208 330 public String toString() { 209 return getClass().getName()+"@[" + this.getEventTime() + "," + this.getServiceHost() + "," + this.getResourceHost() + "]"; 210 } 211 212 /** 213 * @param eventMetadata the eventMetadata to set 331 return StringUtils.buildToString(this); 332 } 333 334 /** 335 * Sets the event metadata. 336 * 337 * @param eventMetadata 338 * the eventMetadata to set 214 339 */ 215 340 public void setEventMetadata(EventMetadata eventMetadata) { … … 218 343 219 344 /** 345 * Gets the event metadata. 346 * 220 347 * @return the eventMetadata 221 348 */ -
raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/event/EzproxyAuthenticationEvent.java
r815 r1172 4 4 package uk.ac.cardiff.model.event; 5 5 6 import java.lang.reflect.Method;7 8 6 import uk.ac.cardiff.utility.EqualsUtil; 9 7 import uk.ac.cardiff.utility.HashCodeUtil; 8 import uk.ac.cardiff.utility.StringUtils; 10 9 11 10 /** 11 * The Class EzproxyAuthenticationEvent. 12 * 12 13 * @author philsmart 13 *14 14 */ 15 public class EzproxyAuthenticationEvent extends AuthenticationEvent {15 public class EzproxyAuthenticationEvent extends AuthenticationEvent { 16 16 17 /** The requester ip. */ 17 18 private String requesterIp; 19 20 /** The session id. */ 18 21 private String sessionId; 19 22 20 public EzproxyAuthenticationEvent(){ 23 /** 24 * Instantiates a new ezproxy authentication event. 25 */ 26 public EzproxyAuthenticationEvent() { 21 27 super(); 22 28 } 23 29 24 protected EzproxyAuthenticationEvent(EzproxyAuthenticationEvent event){ 30 /** 31 * Instantiates a new ezproxy authentication event. 32 * 33 * @param event 34 * the event 35 */ 36 protected EzproxyAuthenticationEvent(EzproxyAuthenticationEvent event) { 25 37 super(event); 26 38 this.requesterIp = event.getRequesterIp(); … … 30 42 /** 31 43 * Copy method. Alternative to clone. 44 * 45 * @return the ezproxy authentication event 32 46 */ 33 public EzproxyAuthenticationEvent copy() {47 public EzproxyAuthenticationEvent copy() { 34 48 return new EzproxyAuthenticationEvent(this); 35 49 } 36 50 51 /** 52 * Sets the requester ip. 53 * 54 * @param requesterIp 55 * the new requester ip 56 */ 37 57 public void setRequesterIp(String requesterIp) { 38 this.requesterIp = requesterIp; 39 } 40 41 public String getRequesterIp() { 42 return requesterIp; 58 this.requesterIp = requesterIp; 43 59 } 44 60 45 61 /** 46 * @param sessionId the sessionId to set 62 * Gets the requester ip. 63 * 64 * @return the requester ip 47 65 */ 48 public void setSessionId(String sessionId) {49 this.sessionId = sessionId;66 public String getRequesterIp() { 67 return requesterIp; 50 68 } 51 69 52 70 /** 71 * Sets the session id. 72 * 73 * @param sessionId 74 * the sessionId to set 75 */ 76 public void setSessionId(String sessionId) { 77 this.sessionId = sessionId; 78 } 79 80 /** 81 * Gets the session id. 82 * 53 83 * @return the sessionId 54 84 */ 55 85 public String getSessionId() { 56 return sessionId;86 return sessionId; 57 87 } 58 88 89 /* 90 * (non-Javadoc) 91 * 92 * @see uk.ac.cardiff.model.event.Event#toString() 93 */ 59 94 public String toString() { 60 Method[] methods = this.getClass().getMethods(); 61 StringBuilder builder = new StringBuilder(); 62 builder.append(this.getClass() + "@["); 63 for (Method method : methods) { 64 try { 65 if (method.getName().startsWith("get") && !method.getName().equals("getClass")) { 66 this.getClass().getMethod(method.getName(), (Class[]) null); 67 Object object = method.invoke(this, (Object[]) null); 68 builder.append(method.getName() + " [" + object + "],"); 69 70 } 71 } catch (Exception e){ 72 //do nothing 73 } 74 } 75 builder.append("]"); 76 return builder.toString(); 95 return StringUtils.buildToString(this); 77 96 } 78 97 79 80 98 /** 81 * create a unique hash, with as uniform a distribution as possible 99 * create a unique hash, with as uniform a distribution as possible. 100 * 101 * @return the int 82 102 */ 83 public int hashCode() {103 public int hashCode() { 84 104 int hash = HashCodeUtil.SEED; 85 105 86 hash = HashCodeUtil.hash(hash,getEventTimeMillis()); 87 hash = HashCodeUtil.hash(hash,getEventId()); 88 hash = HashCodeUtil.hash(hash,getAuthenticationType()); 89 hash = HashCodeUtil.hash(hash,getServiceHost()); 90 hash = HashCodeUtil.hash(hash,getRequesterIp()); 91 hash = HashCodeUtil.hash(hash,getSessionId()); 92 hash = HashCodeUtil.hash(hash,getResourceHost()); 93 hash = HashCodeUtil.hash(hash,getPrincipalName()); 94 hash = HashCodeUtil.hash(hash,getEventType()); 95 hash = HashCodeUtil.hash(hash,getServiceId()); 96 hash = HashCodeUtil.hash(hash,getResourceId()); 97 106 hash = HashCodeUtil.hash(hash, getEventTimeMillis()); 107 hash = HashCodeUtil.hash(hash, getEventId()); 108 hash = HashCodeUtil.hash(hash, getAuthenticationType()); 109 hash = HashCodeUtil.hash(hash, getServiceHost()); 110 hash = HashCodeUtil.hash(hash, getRequesterIp()); 111 hash = HashCodeUtil.hash(hash, getSessionId()); 112 hash = HashCodeUtil.hash(hash, getResourceHost()); 113 hash = HashCodeUtil.hash(hash, getPrincipalName()); 114 hash = HashCodeUtil.hash(hash, getEventType()); 115 hash = HashCodeUtil.hash(hash, getServiceId()); 116 hash = HashCodeUtil.hash(hash, getResourceId()); 98 117 99 118 return hash; … … 102 121 103 122 /** 104 * For hibernate, so the hashcode can be persisted 105 * @return 123 * For hibernate, so the hashcode can be persisted. 124 * 125 * @return the hash code 106 126 */ 107 public int getHashCode() {127 public int getHashCode() { 108 128 return hashCode(); 109 129 } 110 130 111 131 /** 112 * For hibernate, does nothing as the hascode is computed on the fly 113 * from the <code>hashCode</code> method 114 * 132 * For hibernate, does nothing as the hascode is computed on the fly from the <code>hashCode</code> method. 133 * 115 134 * @param hashCode 135 * the new hash code 116 136 */ 117 public void setHashCode(int hashCode) {137 public void setHashCode(int hashCode) { 118 138 119 139 } 120 140 121 public boolean equals(Object obj){ 122 if ( this == obj ) return true; 123 if((obj == null) || (obj.getClass() != this.getClass())) 141 /* 142 * (non-Javadoc) 143 * 144 * @see java.lang.Object#equals(java.lang.Object) 145 */ 146 public boolean equals(Object obj) { 147 if (this == obj) 148 return true; 149 if ((obj == null) || (obj.getClass() != this.getClass())) 124 150 return false; 125 EzproxyAuthenticationEvent that = (EzproxyAuthenticationEvent)obj; 126 boolean areEqual = 127 EqualsUtil.areEqual(this.getEventTimeMillis(), that.getEventTimeMillis()) && 128 EqualsUtil.areEqual(this.getEventId(), that.getEventId()) && 129 EqualsUtil.areEqual(this.getAuthenticationType(), that.getAuthenticationType()) && 130 EqualsUtil.areEqual(this.getServiceHost(), that.getServiceHost()) && 131 EqualsUtil.areEqual(this.getRequesterIp(), that.getRequesterIp()) && 132 EqualsUtil.areEqual(this.getSessionId(), that.getSessionId()) && 133 EqualsUtil.areEqual(this.getResourceHost(), that.getResourceHost()) && 134 EqualsUtil.areEqual(this.getServiceId(), that.getServiceId()) && 135 EqualsUtil.areEqual(this.getEventType(), that.getEventType()) && 136 EqualsUtil.areEqual(this.getResourceId(), that.getResourceId()) && 137 EqualsUtil.areEqual(this.getPrincipalName(), that.getPrincipalName()); 151 EzproxyAuthenticationEvent that = (EzproxyAuthenticationEvent) obj; 152 boolean areEqual = EqualsUtil.areEqual(this.getEventTimeMillis(), that.getEventTimeMillis()) && EqualsUtil.areEqual(this.getEventId(), that.getEventId()) 153 && EqualsUtil.areEqual(this.getAuthenticationType(), that.getAuthenticationType()) && EqualsUtil.areEqual(this.getServiceHost(), that.getServiceHost()) 154 && EqualsUtil.areEqual(this.getRequesterIp(), that.getRequesterIp()) && EqualsUtil.areEqual(this.getSessionId(), that.getSessionId()) 155 && EqualsUtil.areEqual(this.getResourceHost(), that.getResourceHost()) && EqualsUtil.areEqual(this.getServiceId(), that.getServiceId()) 156 && EqualsUtil.areEqual(this.getEventType(), that.getEventType()) && EqualsUtil.areEqual(this.getResourceId(), that.getResourceId()) 157 && EqualsUtil.areEqual(this.getPrincipalName(), that.getPrincipalName()); 138 158 139 159 return areEqual; -
raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/event/EzproxyProxyEvent.java
r788 r1172 4 4 package uk.ac.cardiff.model.event; 5 5 6 import java.lang.reflect.InvocationTargetException; 7 import java.lang.reflect.Method; 6 import uk.ac.cardiff.utility.StringUtils; 8 7 9 8 /** 9 * The Class EzproxyProxyEvent. 10 * 10 11 * @author philsmart 11 *12 12 */ 13 public class EzproxyProxyEvent extends ProxyEvent {13 public class EzproxyProxyEvent extends ProxyEvent { 14 14 15 /** The session id. */ 15 16 private String sessionId; 16 17 17 public EzproxyProxyEvent(){ 18 /** 19 * Instantiates a new ezproxy proxy event. 20 */ 21 public EzproxyProxyEvent() { 18 22 super(); 19 23 } 20 24 21 25 /** 22 * Copy constructor 23 * 26 * Copy constructor. 27 * 24 28 * @param event 29 * the event 25 30 */ 26 protected EzproxyProxyEvent(EzproxyProxyEvent event) {31 protected EzproxyProxyEvent(EzproxyProxyEvent event) { 27 32 super(event); 28 33 this.sessionId = event.getSessionId(); … … 31 36 /** 32 37 * Copy method. Alternative to clone. 38 * 39 * @return the ezproxy proxy event 33 40 */ 34 public EzproxyProxyEvent copy() {41 public EzproxyProxyEvent copy() { 35 42 return new EzproxyProxyEvent(this); 36 43 } 37 44 38 45 /** 46 * Sets the session id. 47 * 39 48 * @param sessionId 40 49 * the sessionId to set 41 50 */ 42 51 public void setSessionId(String sessionId) { 43 this.sessionId = sessionId;52 this.sessionId = sessionId; 44 53 } 45 54 46 55 /** 56 * Gets the session id. 57 * 47 58 * @return the sessionId 48 59 */ 49 60 public String getSessionId() { 50 return sessionId;61 return sessionId; 51 62 } 52 63 64 /* 65 * (non-Javadoc) 66 * 67 * @see uk.ac.cardiff.model.event.ProxyEvent#toString() 68 */ 53 69 public String toString() { 54 Method[] methods = this.getClass().getMethods(); 55 StringBuilder builder = new StringBuilder(); 56 builder.append(this.getClass() + "@["); 57 for (Method method : methods) { 58 try { 59 if (method.getName().startsWith("get") && !method.getName().equals("getClass")) { 60 this.getClass().getMethod(method.getName(), (Class[]) null); 61 Object object = method.invoke(this, (Object[]) null); 62 builder.append(method.getName() + " [" + object + "],"); 63 64 } 65 } catch (IllegalArgumentException e) { 66 e.printStackTrace(); 67 } catch (SecurityException e) { 68 e.printStackTrace(); 69 } catch (NoSuchMethodException e) { 70 e.printStackTrace(); 71 } catch (IllegalAccessException e) { 72 e.printStackTrace(); 73 } catch (InvocationTargetException e) { 74 e.printStackTrace(); 75 } 76 } 77 builder.append("]"); 78 return builder.toString(); 70 return StringUtils.buildToString(this); 79 71 } 80 72 -
raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/event/OpenathenslaAuthenticationEvent.java
r788 r1172 4 4 package uk.ac.cardiff.model.event; 5 5 6 import uk.ac.cardiff.utility.StringUtils; 7 6 8 /** 9 * The Class OpenathenslaAuthenticationEvent. 10 * 7 11 * @author philsmart 8 *9 12 */ 10 public class OpenathenslaAuthenticationEvent extends Event {13 public class OpenathenslaAuthenticationEvent extends Event { 11 14 15 /** The requester ip. */ 12 16 private String requesterIP; 13 17 14 public OpenathenslaAuthenticationEvent(){ 18 /** 19 * Instantiates a new openathensla authentication event. 20 */ 21 public OpenathenslaAuthenticationEvent() { 15 22 super(); 16 23 } … … 18 25 /** 19 26 * Copy constructor. 20 * 27 * 21 28 * @param event 29 * the event 22 30 */ 23 public OpenathenslaAuthenticationEvent(OpenathenslaAuthenticationEvent event) {31 public OpenathenslaAuthenticationEvent(OpenathenslaAuthenticationEvent event) { 24 32 super(event); 25 33 this.requesterIP = event.getRequesterIP(); … … 28 36 /** 29 37 * Copy method. Alternative to clone. 38 * 39 * @return the openathensla authentication event 30 40 */ 31 public OpenathenslaAuthenticationEvent copy() {41 public OpenathenslaAuthenticationEvent copy() { 32 42 return new OpenathenslaAuthenticationEvent(this); 33 43 } 34 44 35 45 /** 46 * Sets the requester ip. 47 * 48 * @param requesterIP 49 * the new requester ip 50 */ 36 51 public void setRequesterIP(String requesterIP) { 37 this.requesterIP = requesterIP;52 this.requesterIP = requesterIP; 38 53 } 39 54 55 /** 56 * Gets the requester ip. 57 * 58 * @return the requester ip 59 */ 40 60 public String getRequesterIP() { 41 return requesterIP; 61 return requesterIP; 62 } 63 64 /* 65 * (non-Javadoc) 66 * 67 * @see uk.ac.cardiff.model.event.Event#toString() 68 */ 69 public String toString() { 70 return StringUtils.buildToString(this); 42 71 } 43 72 -
raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/event/ProxyEvent.java
r788 r1172 6 6 import org.joda.time.DateTime; 7 7 8 import uk.ac.cardiff.utility.StringUtils; 8 9 9 10 /** 11 * The Class ProxyEvent. 12 * 10 13 * @author philsmart 11 *12 14 */ 13 public class ProxyEvent extends Event {15 public class ProxyEvent extends Event { 14 16 17 /** The request url. */ 15 18 private String requestURL; 19 20 /** The http response code. */ 16 21 private int httpResponseCode; 22 23 /** The response size. */ 17 24 private long responseSize; 25 26 /** The response time. */ 18 27 private DateTime responseTime; 28 29 /** The requester ip. */ 19 30 private String requesterIp; 20 31 21 public ProxyEvent(){ 32 /** 33 * Instantiates a new proxy event. 34 */ 35 public ProxyEvent() { 22 36 super(); 23 37 } 24 38 25 39 /** 26 * Copy constructor 40 * Copy constructor. 41 * 27 42 * @param event 43 * the event 28 44 */ 29 public ProxyEvent(ProxyEvent event) {45 public ProxyEvent(ProxyEvent event) { 30 46 super(event); 31 47 this.requestURL = event.getRequestURL(); … … 38 54 /** 39 55 * Copy method. Alternative to clone. 56 * 57 * @return the proxy event 40 58 */ 41 public ProxyEvent cop() {59 public ProxyEvent cop() { 42 60 return new ProxyEvent(this); 43 61 } 44 62 45 63 /** 64 * Sets the request url. 65 * 66 * @param requestURL 67 * the new request url 68 */ 46 69 public void setRequestURL(String requestURL) { 47 this.requestURL = requestURL; 48 } 49 public String getRequestURL() { 50 return requestURL; 51 } 52 public void setHttpResponseCode(int httpResponseCode) { 53 this.httpResponseCode = httpResponseCode; 54 } 55 public int getHttpResponseCode() { 56 return httpResponseCode; 57 } 58 public void setResponseSize(long responseSize) { 59 this.responseSize = responseSize; 60 } 61 public long getResponseSize() { 62 return responseSize; 63 } 64 public void setResponseTime(DateTime responseTime) { 65 this.responseTime = responseTime; 70 this.requestURL = requestURL; 66 71 } 67 72 68 73 /** 69 * Get response time, using a defensive copy 70 * 71 * @return 74 * Gets the request url. 75 * 76 * @return the request url 77 */ 78 public String getRequestURL() { 79 return requestURL; 80 } 81 82 /** 83 * Sets the http response code. 84 * 85 * @param httpResponseCode 86 * the new http response code 87 */ 88 public void setHttpResponseCode(int httpResponseCode) { 89 this.httpResponseCode = httpResponseCode; 90 } 91 92 /** 93 * Gets the http response code. 94 * 95 * @return the http response code 96 */ 97 public int getHttpResponseCode() { 98 return httpResponseCode; 99 } 100 101 /** 102 * Sets the response size. 103 * 104 * @param responseSize 105 * the new response size 106 */ 107 public void setResponseSize(long responseSize) { 108 this.responseSize = responseSize; 109 } 110 111 /** 112 * Gets the response size. 113 * 114 * @return the response size 115 */ 116 public long getResponseSize() { 117 return responseSize; 118 } 119 120 /** 121 * Sets the response time. 122 * 123 * @param responseTime 124 * the new response time 125 */ 126 public void setResponseTime(DateTime responseTime) { 127 this.responseTime = responseTime; 128 } 129 130 /** 131 * Get response time, using a defensive copy. 132 * 133 * @return the response time 72 134 */ 73 135 public DateTime getResponseTime() { 74 return new DateTime(responseTime);136 return new DateTime(responseTime); 75 137 } 138 76 139 /** 77 * @param requesterIp the requesterIp to set 140 * Sets the requester ip. 141 * 142 * @param requesterIp 143 * the requesterIp to set 78 144 */ 79 145 public void setRequesterIp(String requesterIp) { 80 this.requesterIp = requesterIp;146 this.requesterIp = requesterIp; 81 147 } 148 82 149 /** 150 * Gets the requester ip. 151 * 83 152 * @return the requesterIp 84 153 */ 85 154 public String getRequesterIp() { 86 return requesterIp; 155 return requesterIp; 156 } 157 158 /* 159 * (non-Javadoc) 160 * 161 * @see uk.ac.cardiff.model.event.Event#toString() 162 */ 163 public String toString() { 164 return StringUtils.buildToString(this); 87 165 } 88 166 -
raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/event/ShibbolethIdpAuthenticationEvent.java
r815 r1172 4 4 package uk.ac.cardiff.model.event; 5 5 6 import java.lang.reflect.Method;7 6 import java.util.Arrays; 8 import java.util.Collection;9 10 7 11 8 import uk.ac.cardiff.utility.EqualsUtil; 12 9 import uk.ac.cardiff.utility.HashCodeUtil; 10 import uk.ac.cardiff.utility.StringUtils; 13 11 14 12 /** 13 * The Class ShibbolethIdpAuthenticationEvent. 14 * 15 15 * @author philsmart 16 *17 16 */ 18 public class ShibbolethIdpAuthenticationEvent extends AuthenticationEvent{ 19 20 21 private String requestId; 22 private String messageProfileId; 23 private String responseBinding; 24 private String responseId; 25 private String requestBinding; 26 private String nameIdentifier; 27 private String[] assertionId; 28 private String[] releasedAttributes; 29 30 31 public ShibbolethIdpAuthenticationEvent(){ 32 super(); 33 } 34 35 public static ShibbolethIdpAuthenticationEvent newInstance() { 36 return new ShibbolethIdpAuthenticationEvent(); 37 } 38 39 /** 40 * Copy constructor 41 * 42 * @param event 43 */ 44 protected ShibbolethIdpAuthenticationEvent(ShibbolethIdpAuthenticationEvent event){ 45 super (event); 46 this.requestId = event.getRequestId(); 47 this.messageProfileId = event.getMessageProfileId(); 48 this.responseBinding = event.getResponseBinding(); 49 this.responseId = event.getResponseId(); 50 this.requestBinding = event.getRequestBinding(); 51 this.nameIdentifier = event.getNameIdentifier(); 52 53 //shallow copy is OK here, as a new array is created with immutable objects (String). 54 this.assertionId = event.getAssertionId().clone(); 55 this.releasedAttributes = event.getReleasedAttributes().clone(); 56 } 57 58 /** 59 * Copy method. Alternative to clone. 60 */ 61 public ShibbolethIdpAuthenticationEvent copy(){ 62 return new ShibbolethIdpAuthenticationEvent(this); 63 } 64 65 public void setResponseBinding(String responseBinding) { 66 this.responseBinding = responseBinding; 67 } 68 public String getResponseBinding() { 69 return responseBinding; 70 } 71 72 public void setRequestBinding(String requestBinding) { 73 this.requestBinding = requestBinding; 74 } 75 public String getRequestBinding() { 76 return requestBinding; 77 } 78 public void setMessageProfileId(String messageProfileId) { 79 this.messageProfileId = messageProfileId; 80 } 81 public String getMessageProfileId() { 82 return messageProfileId; 83 } 84 /** 85 * @param releasedAttributes the releasedAttributes to set 86 */ 87 public void setReleasedAttributes(String[] releasedAttributes) { 88 this.releasedAttributes = releasedAttributes; 89 } 90 /** 91 * @return the releasedAttributes 92 */ 93 public String[] getReleasedAttributes() { 94 return releasedAttributes; 95 } 96 97 public String toString() { 98 Method[] methods = this.getClass().getMethods(); 99 StringBuilder builder = new StringBuilder(); 100 builder.append(this.getClass() + "@["); 101 for (Method method : methods) { 102 try { 103 if (method.getName().startsWith("get") && !method.getName().equals("getClass")) { 104 this.getClass().getMethod(method.getName(), (Class[]) null); 105 Object object = method.invoke(this, (Object[]) null); 106 if (object instanceof Collection){ 107 builder.append(method.getName() + " [" + Arrays.asList(object) + "],"); 108 } 109 else if (object.getClass().isArray()){ 110 Object[] array = (Object[])object; 111 builder.append(method.getName() + " [" + Arrays.asList(array) + "],"); 112 } 113 else{ 114 builder.append(method.getName() + " [" + object + "],"); 115 } 116 } 117 } catch (Exception e){ 118 //do nothing 119 } 120 } 121 builder.append("]"); 122 return builder.toString(); 123 } 124 125 @Override 126 public boolean equals(Object obj){ 127 if ( this == obj ) return true; 128 if((obj == null) || (obj.getClass() != this.getClass())) 129 return false; 130 ShibbolethIdpAuthenticationEvent that = (ShibbolethIdpAuthenticationEvent)obj; 131 boolean areEqual = 132 EqualsUtil.areEqual(this.getEventTimeMillis(), that.getEventTimeMillis()) && 133 EqualsUtil.areEqual(this.getEventId(), that.getEventId()) && 134 EqualsUtil.areEqual(this.getAuthenticationType(), that.getAuthenticationType()) && 135 EqualsUtil.areEqual(this.getServiceHost(), that.getServiceHost()) && 136 EqualsUtil.areEqual(this.getRequestId(), that.getRequestId()) && 137 EqualsUtil.areEqual(this.getResponseBinding(), that.getResponseBinding()) && 138 EqualsUtil.areEqual(this.getResourceHost(), that.getResourceHost()) && 139 EqualsUtil.areEqual(this.getMessageProfileId(), that.getMessageProfileId()) && 140 EqualsUtil.areEqual(this.getRequestBinding(), that.getRequestBinding()) && 141 EqualsUtil.areEqual(this.getPrincipalName(), that.getPrincipalName()) && 142 EqualsUtil.areEqual(this.getNameIdentifier(), that.getNameIdentifier()) && 143 EqualsUtil.areEqual(this.getResponseId(), that.getResponseId()) && 144 EqualsUtil.areEqual(this.getServiceId(), that.getServiceId()) && 145 EqualsUtil.areEqual(this.getEventType(), that.getEventType()) && 146 EqualsUtil.areEqual(this.getResourceId(), that.getResourceId()) && 147 Arrays.equals(this.getAssertionId(), that.getAssertionId()) && 148 Arrays.equals(this.getReleasedAttributes(), that.getReleasedAttributes()); 149 150 return areEqual; 151 } 152 153 /** 154 * For hibernate, so the hashcode can be persisted 155 * @return 156 */ 157 public int getHashCode(){ 158 return hashCode(); 159 } 160 161 /** 162 * For hibernate, does nothing as the hascode is computed on the fly 163 * from the <code>hashCode</code> method 164 * 165 * @param hashCode 166 */ 167 public void setHashCode(int hashCode){ 168 169 } 170 171 172 /** 173 * create a unique hash, with as uniform a distribution as possible 174 */ 175 @Override 176 public int hashCode(){ 177 int hash = HashCodeUtil.SEED; 178 179 hash = HashCodeUtil.hash(hash,getEventTimeMillis()); 180 hash = HashCodeUtil.hash(hash,getAuthenticationType()); 181 hash = HashCodeUtil.hash(hash,getEventId()); 182 hash = HashCodeUtil.hash(hash,getServiceHost()); 183 hash = HashCodeUtil.hash(hash,getRequestId()); 184 hash = HashCodeUtil.hash(hash,getResponseBinding()); 185 hash = HashCodeUtil.hash(hash,getResourceHost()); 186 hash = HashCodeUtil.hash(hash,getReleasedAttributes()); 187 hash = HashCodeUtil.hash(hash,getMessageProfileId()); 188 hash = HashCodeUtil.hash(hash,getRequestBinding()); 189 hash = HashCodeUtil.hash(hash,getPrincipalName()); 190 hash = HashCodeUtil.hash(hash,getNameIdentifier()); 191 hash = HashCodeUtil.hash(hash,getResponseId()); 192 hash = HashCodeUtil.hash(hash,getAssertionId()); 193 hash = HashCodeUtil.hash(hash,getEventType()); 194 hash = HashCodeUtil.hash(hash,getServiceId()); 195 hash = HashCodeUtil.hash(hash,getResourceId()); 196 return hash; 197 198 } 199 public void setNameIdentifier(String nameIdentifier) { 200 this.nameIdentifier = nameIdentifier; 201 } 202 public String getNameIdentifier() { 203 return nameIdentifier; 204 } 205 public void setAssertionId(String[] assertionId) { 206 this.assertionId = assertionId; 207 } 208 public String[] getAssertionId() { 209 return assertionId; 210 } 211 public void setResponseId(String responseId) { 212 this.responseId = responseId; 213 } 214 public String getResponseId() { 215 return responseId; 216 } 217 public void setRequestId(String requestId) { 218 this.requestId = requestId; 219 } 220 public String getRequestId() { 221 return requestId; 222 } 223 224 225 226 227 17 public class ShibbolethIdpAuthenticationEvent extends AuthenticationEvent { 18 19 /** The request id. */ 20 private String requestId; 21 22 /** The message profile id. */ 23 private String messageProfileId; 24 25 /** The response binding. */ 26 private String responseBinding; 27 28 /** The response id. */ 29 private String responseId; 30 31 /** The request binding. */ 32 private String requestBinding; 33 34 /** The name identifier. */ 35 private String nameIdentifier; 36 37 /** The assertion id. */ 38 private String[] assertionId; 39 40 /** The released attributes. */ 41 private String[] releasedAttributes; 42 43 /** 44 * Instantiates a new shibboleth idp authentication event. 45 */ 46 public ShibbolethIdpAuthenticationEvent() { 47 super(); 48 } 49 50 /** 51 * New instance. 52 * 53 * @return the shibboleth idp authentication event 54 */ 55 public static ShibbolethIdpAuthenticationEvent newInstance() { 56 return new ShibbolethIdpAuthenticationEvent(); 57 } 58 59 /** 60 * Copy constructor. 61 * 62 * @param event 63 * the event to copy 64 */ 65 protected ShibbolethIdpAuthenticationEvent(ShibbolethIdpAuthenticationEvent event) { 66 super(event); 67 this.requestId = event.getRequestId(); 68 this.messageProfileId = event.getMessageProfileId(); 69 this.responseBinding = event.getResponseBinding(); 70 this.responseId = event.getResponseId(); 71 this.requestBinding = event.getRequestBinding(); 72 this.nameIdentifier = event.getNameIdentifier(); 73 74 // shallow copy is OK here, as a new array is created with immutable objects (String). 75 this.assertionId = event.getAssertionId().clone(); 76 this.releasedAttributes = event.getReleasedAttributes().clone(); 77 } 78 79 /** 80 * Copy method. Alternative to clone. Returns a copied version of this event. 81 * 82 * @return the shibboleth idp authentication event 83 */ 84 public ShibbolethIdpAuthenticationEvent copy() { 85 return new ShibbolethIdpAuthenticationEvent(this); 86 } 87 88 /** 89 * Sets the response binding. 90 * 91 * @param responseBinding 92 * the new response binding 93 */ 94 public void setResponseBinding(String responseBinding) { 95 this.responseBinding = responseBinding; 96 } 97 98 /** 99 * Gets the response binding. 100 * 101 * @return the response binding 102 */ 103 public String getResponseBinding() { 104 return responseBinding; 105 } 106 107 /** 108 * Sets the request binding. 109 * 110 * @param requestBinding 111 * the new request binding 112 */ 113 public void setRequestBinding(String requestBinding) { 114 this.requestBinding = requestBinding; 115 } 116 117 /** 118 * Gets the request binding. 119 * 120 * @return the request binding 121 */ 122 public String getRequestBinding() { 123 return requestBinding; 124 } 125 126 /** 127 * Sets the message profile id. 128 * 129 * @param messageProfileId 130 * the new message profile id 131 */ 132 public void setMessageProfileId(String messageProfileId) { 133 this.messageProfileId = messageProfileId; 134 } 135 136 /** 137 * Gets the message profile id. 138 * 139 * @return the message profile id 140 */ 141 public String getMessageProfileId() { 142 return messageProfileId; 143 } 144 145 /** 146 * Sets the released attributes. 147 * 148 * @param releasedAttributes 149 * the releasedAttributes to set 150 */ 151 public void setReleasedAttributes(String[] releasedAttributes) { 152 this.releasedAttributes = releasedAttributes; 153 } 154 155 /** 156 * Gets the released attributes. 157 * 158 * @return the releasedAttributes 159 */ 160 public String[] getReleasedAttributes() { 161 return releasedAttributes; 162 } 163 164 /* 165 * (non-Javadoc) 166 * 167 * @see uk.ac.cardiff.model.event.Event#toString() 168 */ 169 public String toString() { 170 return StringUtils.buildToString(this); 171 } 172 173 /* 174 * (non-Javadoc) 175 * 176 * @see java.lang.Object#equals(java.lang.Object) 177 */ 178 @Override 179 public boolean equals(Object obj) { 180 if (this == obj) 181 return true; 182 if ((obj == null) || (obj.getClass() != this.getClass())) 183 return false; 184 ShibbolethIdpAuthenticationEvent that = (ShibbolethIdpAuthenticationEvent) obj; 185 boolean areEqual = EqualsUtil.areEqual(this.getEventTimeMillis(), that.getEventTimeMillis()) && EqualsUtil.areEqual(this.getEventId(), that.getEventId()) 186 && EqualsUtil.areEqual(this.getAuthenticationType(), that.getAuthenticationType()) && EqualsUtil.areEqual(this.getServiceHost(), that.getServiceHost()) 187 && EqualsUtil.areEqual(this.getRequestId(), that.getRequestId()) && EqualsUtil.areEqual(this.getResponseBinding(), that.getResponseBinding()) 188 && EqualsUtil.areEqual(this.getResourceHost(), that.getResourceHost()) && EqualsUtil.areEqual(this.getMessageProfileId(), that.getMessageProfileId()) 189 && EqualsUtil.areEqual(this.getRequestBinding(), that.getRequestBinding()) && EqualsUtil.areEqual(this.getPrincipalName(), that.getPrincipalName()) 190 && EqualsUtil.areEqual(this.getNameIdentifier(), that.getNameIdentifier()) && EqualsUtil.areEqual(this.getResponseId(), that.getResponseId()) 191 && EqualsUtil.areEqual(this.getServiceId(), that.getServiceId()) && EqualsUtil.areEqual(this.getEventType(), that.getEventType()) 192 && EqualsUtil.areEqual(this.getResourceId(), that.getResourceId()) && Arrays.equals(this.getAssertionId(), that.getAssertionId()) 193 && Arrays.equals(this.getReleasedAttributes(), that.getReleasedAttributes()); 194 195 return areEqual; 196 } 197 198 /** 199 * For hibernate, so the hashcode can be persisted. 200 * 201 * @return the hash code 202 */ 203 public int getHashCode() { 204 return hashCode(); 205 } 206 207 /** 208 * For hibernate, does nothing as the hascode is computed on the fly from the <code>hashCode</code> method. 209 * 210 * @param hashCode 211 * the new hash code 212 */ 213 public void setHashCode(int hashCode) { 214 215 } 216 217 /** 218 * create a unique hash, with as uniform a distribution as possible. 219 * 220 * @return the int 221 */ 222 @Override 223 public int hashCode() { 224 int hash = HashCodeUtil.SEED; 225 226 hash = HashCodeUtil.hash(hash, getEventTimeMillis()); 227 hash = HashCodeUtil.hash(hash, getAuthenticationType()); 228 hash = HashCodeUtil.hash(hash, getEventId()); 229 hash = HashCodeUtil.hash(hash, getServiceHost()); 230 hash = HashCodeUtil.hash(hash, getRequestId()); 231 hash = HashCodeUtil.hash(hash, getResponseBinding()); 232 hash = HashCodeUtil.hash(hash, getResourceHost()); 233 hash = HashCodeUtil.hash(hash, getReleasedAttributes()); 234 hash = HashCodeUtil.hash(hash, getMessageProfileId()); 235 hash = HashCodeUtil.hash(hash, getRequestBinding()); 236 hash = HashCodeUtil.hash(hash, getPrincipalName()); 237 hash = HashCodeUtil.hash(hash, getNameIdentifier()); 238 hash = HashCodeUtil.hash(hash, getResponseId()); 239 hash = HashCodeUtil.hash(hash, getAssertionId()); 240 hash = HashCodeUtil.hash(hash, getEventType()); 241 hash = HashCodeUtil.hash(hash, getServiceId()); 242 hash = HashCodeUtil.hash(hash, getResourceId()); 243 return hash; 244 245 } 246 247 /** 248 * Sets the name identifier. 249 * 250 * @param nameIdentifier 251 * the new name identifier 252 */ 253 public void setNameIdentifier(String nameIdentifier) { 254 this.nameIdentifier = nameIdentifier; 255 } 256 257 /** 258 * Gets the name identifier. 259 * 260 * @return the name identifier 261 */ 262 public String getNameIdentifier() { 263 return nameIdentifier; 264 } 265 266 /** 267 * Sets the assertion id. 268 * 269 * @param assertionId 270 * the new assertion id 271 */ 272 public void setAssertionId(String[] assertionId) { 273 this.assertionId = assertionId; 274 } 275 276 /** 277 * Gets the assertion id. 278 * 279 * @return the assertion id 280 */ 281 public String[] getAssertionId() { 282 return assertionId; 283 } 284 285 /** 286 * Sets the response id. 287 * 288 * @param responseId 289 * the new response id 290 */ 291 public void setResponseId(String responseId) { 292 this.responseId = responseId; 293 } 294 295 /** 296 * Gets the response id. 297 * 298 * @return the response id 299 */ 300 public String getResponseId() { 301 return responseId; 302 } 303 304 /** 305 * Sets the request id. 306 * 307 * @param requestId 308 * the new request id 309 */ 310 public void setRequestId(String requestId) { 311 this.requestId = requestId; 312 } 313 314 /** 315 * Gets the request id. 316 * 317 * @return the request id 318 */ 319 public String getRequestId() { 320 return requestId; 321 } 228 322 229 323 } -
raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/event/auxiliary/PrincipalInformation.java
r815 r1172 1 1 package uk.ac.cardiff.model.event.auxiliary; 2 2 3 import java.lang.reflect.Method; 4 import java.util.Arrays; 5 import java.util.Collection; 3 import uk.ac.cardiff.utility.StringUtils; 6 4 7 5 public class PrincipalInformation { … … 16 14 private String affiliation; 17 15 18 19 16 /** 20 17 * Default constructor 21 * 18 * 22 19 */ 23 public PrincipalInformation() {20 public PrincipalInformation() { 24 21 25 22 } … … 27 24 /** 28 25 * Copy constructor 29 * 26 * 30 27 * @param principalInformation 31 28 */ 32 public PrincipalInformation(PrincipalInformation principalInformation) {29 public PrincipalInformation(PrincipalInformation principalInformation) { 33 30 this.school = principalInformation.getSchool(); 34 31 this.affiliation = principalInformation.getAffiliation(); … … 65 62 } 66 63 67 /**68 * Reflection based toString method that outputs all the field value pairs of this class69 */70 64 public String toString() { 71 Method[] methods = this.getClass().getMethods(); 72 StringBuilder builder = new StringBuilder(); 73 builder.append(this.getClass() + "@["); 74 for (Method method : methods) { 75 try { 76 if (method.getName().startsWith("get") && !method.getName().equals("getClass")) { 77 this.getClass().getMethod(method.getName(), (Class[]) null); 78 Object object = method.invoke(this, (Object[]) null); 79 if (object instanceof Collection) { 80 builder.append(method.getName() + " [" + Arrays.asList(object) + "],"); 81 } else { 82 builder.append(method.getName() + " [" + object + "],"); 83 } 84 } 85 } catch (Exception e) { 86 // do nothing 87 } 88 } 89 builder.append("]"); 90 return builder.toString(); 65 return StringUtils.buildToString(this); 91 66 } 92 67 -
raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/report/AggregatorGraphModel.java
r815 r1172 6 6 import java.util.List; 7 7 8 /* 9 * based on the Apache Trinidad ChartModel, for compatibility. However, does not extend the Apache Trinidad Model 10 * so as to remain view agnostic. 8 /** 9 * based on the Apache Trinidad ChartModel, for compatibility. However, does not extend the Apache Trinidad Model so as to remain view agnostic. 11 10 */ 12 11 -
raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/wsmodel/Capabilities.java
r830 r1172 10 10 import uk.ac.cardiff.model.resource.ResourceMetadata; 11 11 12 13 12 /** 13 * The Class Capabilities. 14 * 14 15 * @author philsmart 15 *16 16 */ 17 17 public class Capabilities implements Serializable { 18 18 19 /* Generated Serial UID*/19 /** Generated Serial UID. */ 20 20 private static final long serialVersionUID = -4008642148652388534L; 21 21 22 /** The list of attached MUAs. */ 22 23 private List<String> attached; 24 25 /** The list of statistical services the attached MUA has configured. */ 23 26 private List<StatisticalUnitInformation> statisticalServices; 27 28 /** Any error message that occurs during processing. */ 24 29 private String errorMessage; 30 31 /** If an error occured during processing. */ 25 32 private boolean error; 33 34 /** The metadata of the attached Service e.g. the attached MUA. */ 26 35 private ServiceMetadata metadata; 36 37 /** The suggestion values used by the UI to display in suggestion boxes. */ 27 38 private SuggestionValues suggestionValues; 39 40 /** The resource metadata. */ 28 41 private List<ResourceMetadata> resourceMetadata; 29 42 43 /** The number of events store in the attached MUA. */ 30 44 private long numberOfEntries; 31 45 46 /** 47 * Sets the statistical services. 48 * 49 * @param statisticalServices 50 * the new statistical services 51 */ 32 52 public void setStatisticalServices(List<StatisticalUnitInformation> statisticalServices) { 33 53 this.statisticalServices = statisticalServices; … … 35 55 36 56 /** 37 * Returns all configured statistical units 38 * 39 * @return 57 * Returns all configured statistical units. 58 * 59 * @return the statistical services 40 60 */ 41 61 public List<StatisticalUnitInformation> getStatisticalServices() { … … 43 63 } 44 64 65 /** 66 * Sets the attached. 67 * 68 * @param attached 69 * the new attached 70 */ 45 71 public void setAttached(List<String> attached) { 46 72 this.attached = attached; 47 73 } 48 74 75 /** 76 * Gets the attached. 77 * 78 * @return the attached 79 */ 49 80 public List<String> getAttached() { 50 81 return attached; … … 52 83 53 84 /** 85 * Sets the error message. 86 * 54 87 * @param errorMessage 55 88 * the errorMessage to set … … 60 93 61 94 /** 95 * Gets the error message. 96 * 62 97 * @return the errorMessage 63 98 */ … … 67 102 68 103 /** 104 * Sets the error. 105 * 69 106 * @param error 70 107 * the error to set … … 75 112 76 113 /** 114 * Checks if is error. 115 * 77 116 * @return the error 78 117 */ … … 81 120 } 82 121 122 /** 123 * Sets the suggestion values. 124 * 125 * @param suggestionValues 126 * the new suggestion values 127 */ 83 128 public void setSuggestionValues(SuggestionValues suggestionValues) { 84 129 this.suggestionValues = suggestionValues; 85 130 } 86 131 132 /** 133 * Gets the suggestion values. 134 * 135 * @return the suggestion values 136 */ 87 137 public SuggestionValues getSuggestionValues() { 88 138 return suggestionValues; 89 139 } 90 140 141 /** 142 * Sets the metadata. 143 * 144 * @param metadata 145 * the new metadata 146 */ 91 147 public void setMetadata(ServiceMetadata metadata) { 92 148 this.metadata = metadata; 93 149 } 94 150 151 /** 152 * Gets the metadata. 153 * 154 * @return the metadata 155 */ 95 156 public ServiceMetadata getMetadata() { 96 157 return metadata; 97 158 } 98 159 160 /** 161 * Sets the number of authentications stored. 162 * 163 * @param numberOfEntries 164 * the new number of authentications stored 165 */ 99 166 public void setNumberOfAuthenticationsStored(long numberOfEntries) { 100 167 this.numberOfEntries = numberOfEntries; … … 102 169 } 103 170 104 public long getNumberOfAuthenticationsStored(){ 171 /** 172 * Gets the number of authentications stored. 173 * 174 * @return the number of authentications stored 175 */ 176 public long getNumberOfAuthenticationsStored() { 105 177 return numberOfEntries; 106 178 } 107 179 108 180 /** 109 * @param resourceMetadata the resourceMetadata to set 181 * Sets the resource metadata. 182 * 183 * @param resourceMetadata 184 * the resourceMetadata to set 110 185 */ 111 186 public void setResourceMetadata(List<ResourceMetadata> resourceMetadata) { … … 114 189 115 190 /** 191 * Gets the resource metadata. 192 * 116 193 * @return the resourceMetadata 117 194 */ … … 120 197 } 121 198 122 123 124 125 199 } -
raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/wsmodel/EventPushMessage.java
r747 r1172 11 11 12 12 /** 13 * The Class EventPushMessage. 14 * 13 15 * @author philsmart 14 *15 16 */ 16 17 public class EventPushMessage { 17 // TODO to be replaced by SAML messages18 // TODO to be replaced by SAML messages 18 19 20 /** The list of events that are being sent. */ 19 21 private List<Event> events; 22 23 /** The metadata of the client sending the events. */ 20 24 private ServiceMetadata clientMetadata; 25 26 /** The time instant the message was created push. */ 21 27 private Date timeOfPush; 22 28 29 /** 30 * Sets the events. 31 * 32 * @param events 33 * the new events 34 */ 23 35 public void setEvents(List<Event> events) { 24 this.events = events;36 this.events = events; 25 37 } 38 39 /** 40 * Gets the events. 41 * 42 * @return the events 43 */ 26 44 public List<Event> getEvents() { 27 return events;45 return events; 28 46 } 47 48 /** 49 * Sets the time of push. 50 * 51 * @param timeOfPush 52 * the new time of push 53 */ 29 54 public void setTimeOfPush(Date timeOfPush) { 30 this.timeOfPush = timeOfPush;55 this.timeOfPush = timeOfPush; 31 56 } 57 58 /** 59 * Gets the time of push. 60 * 61 * @return the time of push 62 */ 32 63 public Date getTimeOfPush() { 33 return timeOfPush;64 return timeOfPush; 34 65 } 66 67 /** 68 * Sets the client metadata. 69 * 70 * @param clientMetadata 71 * the new client metadata 72 */ 35 73 public void setClientMetadata(ServiceMetadata clientMetadata) { 36 this.clientMetadata = clientMetadata;74 this.clientMetadata = clientMetadata; 37 75 } 76 77 /** 78 * Gets the client metadata. 79 * 80 * @return the client metadata 81 */ 38 82 public ServiceMetadata getClientMetadata() { 39 return clientMetadata;83 return clientMetadata; 40 84 } 41 85 -
raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/wsmodel/LogFileUpload.java
r734 r1172 3 3 import java.io.Serializable; 4 4 5 6 public class LogFileUpload implements Serializable{ 7 8 /** Generated Serial UID */ 5 /** 6 * The Class LogFileUpload. 7 */ 8 public class LogFileUpload implements Serializable { 9 10 /** Generated Serial UID. */ 9 11 private static final long serialVersionUID = -6283086431616419079L; 10 12 13 /** The Name. */ 11 14 private String Name; 15 16 /** The mime. */ 12 17 private String mime; 18 19 /** The length. */ 13 20 private long length; 14 21 15 /** Random ID that we can use for tracking */22 /** Random ID that we can use for tracking. */ 16 23 private long id; 17 24 18 /** The contents of the file in <code>bytes</code> */25 /** The contents of the file in <code>bytes</code>. */ 19 26 private byte[] data; 20 27 21 public enum ParsingEventType{ 28 /** 29 * The Enum ParsingEventType. 30 */ 31 public enum ParsingEventType { 32 33 /** The NA. */ 22 34 NA("Not Selected. Please Select"), 35 36 /** The SHIBBOLET h13. */ 23 37 SHIBBOLETH13("Shibboleth 1.3"), 38 39 /** The SHIBBOLET h2. */ 24 40 SHIBBOLETH2("Shibboleth 2"), 41 42 /** The EZPROXY. */ 25 43 EZPROXY("Ezproxy"); 26 44 45 /** The friendly name. */ 27 46 public String friendlyName; 28 47 29 ParsingEventType(String friendlyName){ 48 /** 49 * Instantiates a new parsing event type. 50 * 51 * @param friendlyName 52 * the friendly name 53 */ 54 ParsingEventType(String friendlyName) { 30 55 this.friendlyName = friendlyName; 31 56 } 32 57 } 33 58 34 /** The type of event that this file upload represents */59 /** The type of event that this file upload represents. */ 35 60 private ParsingEventType eventType; 36 61 37 /** Store <code>String</code> messages reflecting, in human readable form,38 * the current processing status of this batch file.62 /** 63 * Store <code>String</code> messages reflecting, in human readable form, the current processing status of this batch file. 39 64 */ 40 65 private String processingStatus; 41 66 67 /** The processed. */ 42 68 private boolean processed; 43 69 44 public LogFileUpload(){ 70 /** 71 * Instantiates a new log file upload. 72 */ 73 public LogFileUpload() { 45 74 eventType = ParsingEventType.NA; 46 75 } 47 76 77 /** 78 * Gets the data. 79 * 80 * @return the data 81 */ 48 82 public byte[] getData() { 49 83 return data; 50 84 } 51 85 86 /** 87 * Sets the data. 88 * 89 * @param data 90 * the new data 91 */ 52 92 public void setData(byte[] data) { 53 93 this.data = data; 54 94 } 55 95 96 /** 97 * Gets the name. 98 * 99 * @return the name 100 */ 56 101 public String getName() { 57 102 return Name; 58 103 } 59 104 105 /** 106 * Sets the name. 107 * 108 * @param name 109 * the new name 110 */ 60 111 public void setName(String name) { 61 112 Name = name; … … 73 124 } 74 125 126 /** 127 * Gets the length. 128 * 129 * @return the length 130 */ 75 131 public long getLength() { 76 132 return length; 77 133 } 78 134 135 /** 136 * Sets the length. 137 * 138 * @param length 139 * the new length 140 */ 79 141 public void setLength(long length) { 80 142 this.length = length; 81 143 } 82 144 145 /** 146 * Gets the mime. 147 * 148 * @return the mime 149 */ 83 150 public String getMime() { 84 151 return mime; 85 152 } 86 153 87 public void setMime(String mime){ 154 /** 155 * Sets the mime. 156 * 157 * @param mime 158 * the new mime 159 */ 160 public void setMime(String mime) { 88 161 this.mime = mime; 89 162 } 90 163 91 92 /** 164 /** 165 * Sets the processing status. 166 * 93 167 * @param processingStatus 168 * the new processing status 94 169 */ 95 170 public void setProcessingStatus(String processingStatus) { … … 98 173 } 99 174 100 public String getProcessingStatus(){ 175 /** 176 * Gets the processing status. 177 * 178 * @return the processing status 179 */ 180 public String getProcessingStatus() { 101 181 return processingStatus; 102 182 } 103 183 104 184 /** 105 * @param processed the processed to set 185 * Sets the processed. 186 * 187 * @param processed 188 * the processed to set 106 189 */ 107 190 public void setProcessed(boolean processed) { … … 110 193 111 194 /** 195 * Checks if is processed. 196 * 112 197 * @return the processed 113 198 */ … … 117 202 118 203 /** 119 * @param eventType the eventType to set 204 * Sets the event type. 205 * 206 * @param eventType 207 * the eventType to set 120 208 */ 121 209 public void setEventType(ParsingEventType eventType) { … … 123 211 } 124 212 213 /** 214 * Sets the event type string. 215 * 216 * @param eventType 217 * the new event type string 218 */ 125 219 public void setEventTypeString(String eventType) { 126 for (ParsingEventType pet : ParsingEventType.values()) {127 if (pet.friendlyName.equals(eventType)) {220 for (ParsingEventType pet : ParsingEventType.values()) { 221 if (pet.friendlyName.equals(eventType)) { 128 222 this.eventType = pet; 129 223 } … … 131 225 } 132 226 133 134 /** 227 /** 228 * Gets the event type. 229 * 135 230 * @return the eventType 136 231 */ … … 139 234 } 140 235 236 /** 237 * Gets the event type string. 238 * 239 * @return the event type string 240 */ 141 241 public String getEventTypeString() { 142 242 return eventType.friendlyName; … … 144 244 145 245 /** 146 * @param id the id to set 246 * Sets the id. 247 * 248 * @param id 249 * the id to set 147 250 */ 148 251 public void setId(long id) { … … 151 254 152 255 /** 256 * Gets the id. 257 * 153 258 * @return the id 154 259 */ -
raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/wsmodel/LogFileUploadResult.java
r734 r1172 5 5 6 6 /** 7 * The Class LogFileUploadResult. 8 * 7 9 * @author philsmart 8 *9 10 */ 10 11 public class LogFileUploadResult { 11 12 13 /** The id of this <code>LogFileUploadResult</code> instance. */ 12 14 private long id; 13 15 16 /** The status. */ 14 17 private String status; 15 18 19 /** Has the upload successfully been processed. */ 16 20 private boolean processed; 17 21 18 22 /** 19 * @param id the id to set 23 * Sets the id. 24 * 25 * @param id 26 * the id to set 20 27 */ 21 28 public void setId(long id) { … … 24 31 25 32 /** 33 * Gets the id. 34 * 26 35 * @return the id 27 36 */ … … 31 40 32 41 /** 33 * @param status the status to set 42 * Sets the status. 43 * 44 * @param status 45 * the status to set 34 46 */ 35 47 public void setStatus(String status) { … … 38 50 39 51 /** 52 * Gets the status. 53 * 40 54 * @return the status 41 55 */ … … 45 59 46 60 /** 47 * @param processed the processed to set 61 * Sets the processed. 62 * 63 * @param processed 64 * the processed to set 48 65 */ 49 66 public void setProcessed(boolean processed) { … … 52 69 53 70 /** 71 * Checks if is processed. 72 * 54 73 * @return the processed 55 74 */ -
raptor-information-model/trunk/src/main/java/uk/ac/cardiff/model/wsmodel/MethodParameter.java
r815 r1172 5 5 6 6 import java.io.Serializable; 7 import java.util.List;8 7 9 8 import org.slf4j.Logger; 10 9 import org.slf4j.LoggerFactory; 11 10 11 /** 12 * The Class MethodParameter. 13 * 14 * @author philsmart 15 */ 16 public class MethodParameter implements Serializable { 12 17 13 /** 14 * @author philsmart 15 * 16 */ 17 public class MethodParameter implements Serializable{ 18 19 20 /** Generated SerialUID*/ 18 /** Generated SerialUID. */ 21 19 private static final long serialVersionUID = -290473614440091625L; 22 20 23 /** Class logger */21 /** Class logger. */ 24 22 private final Logger log = LoggerFactory.getLogger(MethodParameter.class); 25 23 26 /** enum, which holds information about the parameter 27 * FIELD - name of a field in the model 28 * VALUE - a primitive data type value*/ 29 public enum ParameterType{FIELD, VALUE}; 24 /** 25 * enum, which holds information about the parameter FIELD - name of a field in the model VALUE - a primitive data type value. 26 */ 27 public enum ParameterType { 28 /** The FIELD. */ 29 FIELD, 30 /** The VALUE. */ 31 VALUE 32 }; 30 33 34 /** The parameter type. */ 31 35 private ParameterType parameterType; 32 36 33 /** friendly name of the parameter, for the benefit of the view */37 /** friendly name of the parameter, for the benefit of the view. */ 34 38 private String parameterName; 35 39 36 /** value of the parameter */40 /** value of the parameter. */ 37 41 private String value; 38 42 39 40 43 /** 44 * Sets the value. 45 * 46 * @param value 47 * the new value 48 */ 41 49 public void setValue(String value) { 42 this.value = value;50 this.value = value; 43 51 } 44 52 53 /** 54 * Gets the value. 55 * 56 * @return the value 57 */ 45 58 public String getValue() { 46 return value;59 return value; 47 60 } 48 61 62 /** 63 * Sets the parameter name. 64 * 65 * @param parameterName 66 * the new parameter name 67 */ 49 68 public void setParameterName(String parameterName) { 50 this.parameterName = parameterName;69 this.parameterName = parameterName; 51 70 } 52 71 72 /** 73 * Gets the parameter name. 74 * 75 * @return the parameter name 76 */ 53 77 public String getParameterName() { 54 return parameterName;78 return parameterName; 55 79 } 56 80 81 /** 82 * Sets the parameter type. 83 * 84 * @param parameterType 85 * the new parameter type 86 */ 57 87 public void setParameterType(ParameterType parameterType) { 58 this.parameterType = parameterType;88 this.parameterType = parameterType; 59 89 } 60 90 91 /** 92 * Gets the parameter type. 93 * 94 * @return the parameter type 95 */ 61 96 public ParameterType getParameterType() { 62 return parameterType;97 return parameterType; 63 98 } 64 99 65 66 67 68 69 100 }
Note: See TracChangeset
for help on using the changeset viewer.
