Changeset 1041
- Timestamp:
- 10/16/06 12:20:13 (2 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/components/server/src/ome/services/RawPixelsBean.java
r1038 r1041 36 36 import java.io.Serializable; 37 37 import java.nio.BufferOverflowException; 38 import java.nio.ByteBuffer; 38 39 import java.nio.MappedByteBuffer; 39 40 … … 60 61 import ome.api.ServiceInterface; 61 62 import ome.conditions.ApiUsageException; 63 import ome.conditions.ResourceError; 62 64 import ome.io.nio.DimensionsOutOfBoundsException; 63 65 import ome.io.nio.PixelBuffer; … … 81 83 */ 82 84 @TransactionManagement(TransactionManagementType.BEAN) 83 @Transactional 85 @Transactional(readOnly=false) 84 86 @Stateful 85 87 @Remote(RawPixelsStore.class) … … 149 151 150 152 @RolesAllowed("user") 151 @Transactional( readOnly = true )152 153 public void setPixelsId( long pixelsId ) 153 154 { … … 187 188 { 188 189 return buffer.calculateMessageDigest(); 189 } catch (IOException e) 190 { 191 e.printStackTrace(); 192 throw new RuntimeException("Unimplemented exception."); 193 } 190 } 191 catch (Exception e) 192 { 193 handleException(e); 194 } 195 return null; 194 196 } 195 197 … … 199 201 errorIfNotLoaded(); 200 202 201 MappedByteBuffer plane ;203 MappedByteBuffer plane = null; 202 204 try 203 205 { … … 206 208 catch (Exception e) 207 209 { 208 throw new RuntimeException(e);210 handleException(e); 209 211 } 210 212 211 return bufferAsByteArrayWithExceptionIfNull( plane);213 return bufferAsByteArrayWithExceptionIfNull(plane); 212 214 } 213 215 … … 220 222 { 221 223 return buffer.getPlaneOffset(arg0, arg1, arg2); 222 } catch (DimensionsOutOfBoundsException e) 223 { 224 e.printStackTrace(); 225 throw new RuntimeException("Unimplemented exception."); 226 } 224 } 225 catch (Exception e) 226 { 227 handleException(e); 228 } 229 return null; 227 230 } 228 231 … … 240 243 errorIfNotLoaded(); 241 244 242 MappedByteBuffer region ;245 MappedByteBuffer region = null; 243 246 try 244 247 { 245 248 region = buffer.getRegion(arg0, arg1); 246 } catch (IOException e) 247 { 248 e.printStackTrace(); 249 throw new RuntimeException("Unimplemented exception."); 250 } 251 return bufferAsByteArrayWithExceptionIfNull( region ); 249 } catch (Exception e) 250 { 251 handleException(e); 252 } 253 return bufferAsByteArrayWithExceptionIfNull(region); 252 254 } 253 255 … … 257 259 errorIfNotLoaded(); 258 260 259 MappedByteBuffer row ;261 MappedByteBuffer row = null; 260 262 try 261 263 { 262 264 row = buffer.getRow(arg0, arg1, arg2, arg3); 263 } catch (IOException e) 264 { 265 e.printStackTrace(); 266 throw new RuntimeException("Unimplemented exception."); 267 } catch (DimensionsOutOfBoundsException e) 268 { 269 e.printStackTrace(); 270 throw new RuntimeException("Unimplemented exception."); 265 } 266 catch (Exception e) 267 { 268 handleException(e); 271 269 } 272 270 return bufferAsByteArrayWithExceptionIfNull( row ); … … 282 280 { 283 281 return buffer.getRowOffset(arg0, arg1, arg2, arg3); 284 } catch (DimensionsOutOfBoundsException e) 285 { 286 e.printStackTrace(); 287 throw new RuntimeException("Unimplemented exception."); 288 } 282 } 283 catch (Exception e) 284 { 285 handleException(e); 286 } 287 return null; 289 288 } 290 289 … … 302 301 errorIfNotLoaded(); 303 302 304 MappedByteBuffer stack ;303 MappedByteBuffer stack = null; 305 304 try 306 305 { 307 306 stack = buffer.getStack(arg0, arg1); 308 } catch (IOException e) 309 { 310 e.printStackTrace(); 311 throw new RuntimeException("Unimplemented exception."); 312 } catch (DimensionsOutOfBoundsException e) 313 { 314 e.printStackTrace(); 315 throw new RuntimeException("Unimplemented exception."); 307 } 308 catch (Exception e) 309 { 310 handleException(e); 316 311 } 317 312 return bufferAsByteArrayWithExceptionIfNull( stack ); … … 326 321 { 327 322 return buffer.getStackOffset(arg0, arg1); 328 } catch (DimensionsOutOfBoundsException e) 329 { 330 e.printStackTrace(); 331 throw new RuntimeException("Unimplemented exception."); 332 } 323 } 324 catch (Exception e) 325 { 326 handleException(e); 327 } 328 return null; 333 329 } 334 330 … … 346 342 errorIfNotLoaded(); 347 343 348 MappedByteBuffer timepoint ;344 MappedByteBuffer timepoint = null; 349 345 try 350 346 { 351 347 timepoint = buffer.getTimepoint(arg0); 352 } catch (IOException e) 353 { 354 e.printStackTrace(); 355 throw new RuntimeException("Unimplemented exception."); 356 } catch (DimensionsOutOfBoundsException e) 357 { 358 e.printStackTrace(); 359 throw new RuntimeException("Unimplemented exception."); 360 } 361 return bufferAsByteArrayWithExceptionIfNull( timepoint ); 348 } 349 catch (Exception e) 350 { 351 handleException(e); 352 } 353 return bufferAsByteArrayWithExceptionIfNull(timepoint); 362 354 } 363 355 … … 370 362 { 371 363 return buffer.getTimepointOffset(arg0); 372 } catch (DimensionsOutOfBoundsException e) 373 { 374 e.printStackTrace(); 375 throw new RuntimeException("Unimplemented exception."); 376 } 364 } 365 catch (Exception e) 366 { 367 handleException(e); 368 } 369 return null; 377 370 } 378 371 … … 401 394 { 402 395 buffer.setPlane(arg0, arg1, arg2, arg3); 403 } catch (BufferOverflowException e) 404 { 405 e.printStackTrace(); 406 throw new RuntimeException("Unimplemented exception."); 407 } catch (IOException e) 408 { 409 e.printStackTrace(); 410 throw new RuntimeException("Unimplemented exception."); 411 } catch (DimensionsOutOfBoundsException e) 412 { 413 e.printStackTrace(); 414 throw new RuntimeException("Unimplemented exception."); 396 } 397 catch (Exception e) 398 { 399 handleException(e); 415 400 } 416 401 } … … 424 409 { 425 410 buffer.setRegion(arg0, arg1, arg2); 426 } catch (BufferOverflowException e) 427 { 428 e.printStackTrace(); 429 throw new RuntimeException("Unimplemented exception."); 430 } catch (IOException e) 431 { 432 e.printStackTrace(); 433 throw new RuntimeException("Unimplemented exception."); 411 } 412 catch (Exception e) 413 { 414 handleException(e); 434 415 } 435 416 } … … 440 421 errorIfNotLoaded(); 441 422 442 // FIXME buffer.setRow(arg0, arg1, arg2, arg3, arg4); 443 throw new RuntimeException("Not implemented yet."); 423 try 424 { 425 ByteBuffer buf = ByteBuffer.wrap(arg0); 426 buffer.setRow(buf, arg1, arg2, arg3, arg4); 427 } 428 catch (Exception e) 429 { 430 handleException(e); 431 } 444 432 } 445 433 … … 452 440 { 453 441 buffer.setStack(arg0, arg1, arg2, arg3); 454 } catch (BufferOverflowException e) 455 { 456 e.printStackTrace(); 457 throw new RuntimeException("Unimplemented exception."); 458 } catch (IOException e) 459 { 460 e.printStackTrace(); 461 throw new RuntimeException("Unimplemented exception."); 462 } catch (DimensionsOutOfBoundsException e) 463 { 464 e.printStackTrace(); 465 throw new RuntimeException("Unimplemented exception."); 442 } 443 catch (Exception e) 444 { 445 handleException(e); 466 446 } 467 447 } … … 475 455 { 476 456 buffer.setTimepoint(arg0, arg1); 477 } catch (BufferOverflowException e) 478 { 479 e.printStackTrace(); 480 throw new RuntimeException("Unimplemented exception."); 481 } catch (IOException e) 482 { 483 e.printStackTrace(); 484 throw new RuntimeException("Unimplemented exception."); 485 } catch (DimensionsOutOfBoundsException e) 486 { 487 e.printStackTrace(); 488 throw new RuntimeException("Unimplemented exception."); 457 } 458 catch (Exception e) 459 { 460 handleException(e); 489 461 } 490 462 } … … 499 471 return b; 500 472 } 473 474 private void handleException(Exception e) 475 { 476 e.printStackTrace(); 477 478 if (e instanceof IOException) 479 { 480 throw new ResourceError(e.getMessage()); 481 } 482 if (e instanceof DimensionsOutOfBoundsException) 483 { 484 throw new ApiUsageException(e.getMessage()); 485 } 486 if (e instanceof BufferOverflowException) 487 { 488 throw new ResourceError(e.getMessage()); 489 } 490 491 // Fallthrough 492 throw new RuntimeException(e); 493 } 501 494 }
