1 5 package com.tc.object.bytecode; 6 7 import com.tc.asm.Type; 8 import com.tc.cluster.Cluster; 9 import com.tc.cluster.ClusterEventListener; 10 import com.tc.lang.StartupHelper; 11 import com.tc.lang.TCThreadGroup; 12 import com.tc.lang.ThrowableHandler; 13 import com.tc.lang.StartupHelper.StartupAction; 14 import com.tc.logging.TCLogger; 15 import com.tc.logging.TCLogging; 16 import com.tc.management.beans.sessions.SessionMonitorMBean; 17 import com.tc.object.ClientObjectManager; 18 import com.tc.object.ClientShutdownManager; 19 import com.tc.object.DistributedObjectClient; 20 import com.tc.object.LiteralValues; 21 import com.tc.object.ObjectID; 22 import com.tc.object.Portability; 23 import com.tc.object.SerializationUtil; 24 import com.tc.object.TCObject; 25 import com.tc.object.bytecode.hook.impl.PreparedComponentsFromL2Connection; 26 import com.tc.object.config.DSOClientConfigHelper; 27 import com.tc.object.event.DmiManager; 28 import com.tc.object.loaders.ClassProvider; 29 import com.tc.object.lockmanager.api.LockLevel; 30 import com.tc.object.logging.NullRuntimeLogger; 31 import com.tc.object.logging.RuntimeLogger; 32 import com.tc.object.tx.ClientTransactionManager; 33 import com.tc.object.tx.WaitInvocation; 34 import com.tc.object.tx.optimistic.OptimisticTransactionManager; 35 import com.tc.object.tx.optimistic.OptimisticTransactionManagerImpl; 36 import com.tc.properties.TCProperties; 37 import com.tc.properties.TCPropertiesImpl; 38 import com.tc.util.Assert; 39 import com.tc.util.Util; 40 import com.tc.util.concurrent.SetOnceFlag; 41 42 import java.util.Collection ; 43 import java.util.HashMap ; 44 import java.util.Iterator ; 45 import java.util.Map ; 46 47 50 public class ManagerImpl implements Manager { 51 private static final TCLogger logger = TCLogging.getLogger(Manager.class); 52 53 private final LiteralValues literals = new LiteralValues(); 54 55 private final SetOnceFlag clientStarted = new SetOnceFlag(); 56 private final DSOClientConfigHelper config; 57 private final ClassProvider classProvider; 58 private final boolean startClient; 59 private final PreparedComponentsFromL2Connection connectionComponents; 60 private final Thread shutdownAction; 61 private final Portability portability; 62 private final Cluster cluster; 63 64 private RuntimeLogger runtimeLogger = new NullRuntimeLogger(); 65 private ClientObjectManager objectManager; 66 private ClientShutdownManager shutdownManager; 67 private ClientTransactionManager txManager; 68 private DistributedObjectClient dso; 69 private DmiManager methodCallManager; 70 private OptimisticTransactionManager optimisticTransactionManager; 71 private SerializationUtil serializer = new SerializationUtil(); 72 private MethodDisplayNames methodDisplay = new MethodDisplayNames(serializer); 73 74 public ManagerImpl(DSOClientConfigHelper config, ClassProvider classProvider, 75 PreparedComponentsFromL2Connection connectionComponents) { 76 this(true, null, null, config, classProvider, connectionComponents, true); 77 } 78 79 public ManagerImpl(boolean startClient, ClientObjectManager objectManager, ClientTransactionManager txManager, 81 DSOClientConfigHelper config, ClassProvider classProvider, 82 PreparedComponentsFromL2Connection connectionComponents) { 83 this(startClient, objectManager, txManager, config, classProvider, connectionComponents, true); 84 } 85 86 public ManagerImpl(boolean startClient, ClientObjectManager objectManager, ClientTransactionManager txManager, 88 DSOClientConfigHelper config, ClassProvider classProvider, 89 PreparedComponentsFromL2Connection connectionComponents, boolean shutdownActionRequired) { 90 this.objectManager = objectManager; 91 this.portability = config.getPortability(); 92 this.txManager = txManager; 93 this.config = config; 94 this.startClient = startClient; 95 this.classProvider = classProvider; 96 this.connectionComponents = connectionComponents; 97 this.cluster = new Cluster(); 98 if (shutdownActionRequired) { 99 shutdownAction = new Thread (new ShutdownAction()); 100 Runtime.getRuntime().addShutdownHook(shutdownAction); 102 } else { 103 shutdownAction = null; 104 } 105 106 } 107 108 public SessionMonitorMBean getSessionMonitorMBean() { 109 return dso.getSessionMonitorMBean(); 110 } 111 112 public void init() { 113 resolveClasses(); 115 if (startClient) { 116 if (clientStarted.attemptSet()) { 117 startClient(); 118 } 119 } 120 } 121 122 public String getClientID() { 123 return String.valueOf(this.dso.getChannel().getChannelIDProvider().getChannelID().toLong()); 124 } 125 126 private void resolveClasses() { 127 133 Object o = new Manageable() { 134 public void __tc_managed(TCObject t) { 135 throw new AssertionError (); 136 } 137 138 public TCObject __tc_managed() { 139 return null; 140 } 141 142 public boolean __tc_isManaged() { 143 return false; 144 } 145 }; 146 lookupExistingOrNull(o); 147 monitorEnter(o, LOCK_TYPE_WRITE); 148 monitorExit(o); 149 logicalInvoke(new HashMap (), SerializationUtil.CLEAR_SIGNATURE, new Object [] {}); 150 } 151 152 private void startClient() { 153 final TCThreadGroup group = new TCThreadGroup(new ThrowableHandler(TCLogging 154 .getLogger(DistributedObjectClient.class))); 155 156 StartupAction action = new StartupHelper.StartupAction() { 157 public void execute() throws Throwable { 158 dso = new DistributedObjectClient(config, group, classProvider, connectionComponents, ManagerImpl.this, cluster); 159 dso.start(); 160 objectManager = dso.getObjectManager(); 161 txManager = dso.getTransactionManager(); 162 runtimeLogger = dso.getRuntimeLogger(); 163 164 optimisticTransactionManager = new OptimisticTransactionManagerImpl(objectManager, txManager); 165 166 methodCallManager = dso.getDmiManager(); 167 168 shutdownManager = new ClientShutdownManager(objectManager, dso.getRemoteTransactionManager(), dso 169 .getStageManager(), dso.getCommunicationsManager(), dso.getChannel(), dso.getClientHandshakeManager(), 170 connectionComponents); 171 } 172 }; 173 174 StartupHelper startupHelper = new StartupHelper(group, action); 175 startupHelper.startUp(); 176 } 177 178 public void stop() { 179 shutdown(false); 180 } 181 182 private void shutdown(boolean fromShutdownHook) { 183 if (shutdownManager != null) { 184 try { 185 shutdownManager.execute(fromShutdownHook); 188 } finally { 189 if (Thread.currentThread() != shutdownAction) { 191 try { 192 Runtime.getRuntime().removeShutdownHook(shutdownAction); 193 } catch (Exception e) { 194 } 196 } 197 } 198 } 199 } 200 201 public void logicalInvoke(Object object, String methodSignature, Object [] params) { 202 Manageable m = (Manageable) object; 203 if (m.__tc_managed() != null) { 204 TCObject tco = lookupExistingOrNull(object); 205 206 try { 207 if (tco != null) { 208 209 if (SerializationUtil.ADD_ALL_SIGNATURE.equals(methodSignature)) { 210 logicalAddAllInvoke(serializer.methodToID(methodSignature), methodSignature, (Collection ) params[0], tco); 211 } else if (SerializationUtil.ADD_ALL_AT_SIGNATURE.equals(methodSignature)) { 212 logicalAddAllAtInvoke(serializer.methodToID(methodSignature), methodSignature, ((Integer ) params[0]) 213 .intValue(), (Collection ) params[1], tco); 214 } else { 215 adjustForJava1ParametersIfNecessary(methodSignature, params); 216 tco.logicalInvoke(serializer.methodToID(methodSignature), methodDisplay 217 .getDisplayForSignature(methodSignature), params); 218 } 219 } 220 } catch (Throwable t) { 221 Util.printLogAndRethrowError(t, logger); 222 } 223 } 224 } 225 226 public void logicalInvokeWithTransaction(Object object, Object lockObject, String methodName, Object [] params) { 227 monitorEnter(lockObject, LockLevel.WRITE); 228 try { 229 logicalInvoke(object, methodName, params); 230 } finally { 231 monitorExit(lockObject); 232 } 233 } 234 235 private void adjustForJava1ParametersIfNecessary(String methodName, Object [] params) { 236 if ((params.length == 2) && (params[1] != null) && (params[1].getClass().equals(Integer .class))) { 237 if (SerializationUtil.SET_ELEMENT_SIGNATURE.equals(methodName) 238 || SerializationUtil.INSERT_ELEMENT_AT_SIGNATURE.equals(methodName)) { 239 Object tmp = params[0]; 241 params[0] = params[1]; 242 params[1] = tmp; 243 } 244 } 245 } 246 247 private void logicalAddAllInvoke(int method, String methodSignature, Collection collection, TCObject tcobj) { 248 for (Iterator i = collection.iterator(); i.hasNext();) { 249 tcobj.logicalInvoke(method, methodDisplay.getDisplayForSignature(methodSignature), new Object [] { i.next() }); 250 } 251 } 252 253 private void logicalAddAllAtInvoke(int method, String methodSignature, int index, Collection collection, 254 TCObject tcobj) { 255 256 for (Iterator i = collection.iterator(); i.hasNext();) { 257 tcobj.logicalInvoke(method, methodDisplay.getDisplayForSignature(methodSignature), new Object [] { 258 new Integer (index++), i.next() }); 259 } 260 } 261 262 public Object lookupOrCreateRoot(String name, Object object) { 263 return lookupOrCreateRoot(name, object, false); 264 } 265 266 public Object lookupOrCreateRootNoDepth(String name, Object obj) { 267 return lookupOrCreateRoot(name, obj, true); 268 } 269 270 public Object createOrReplaceRoot(String name, Object object) { 271 try { 272 return this.objectManager.createOrReplaceRoot(name, object); 273 } catch (Throwable t) { 274 Util.printLogAndRethrowError(t, logger); 275 276 throw new AssertionError (); 278 } 279 } 280 281 private Object lookupOrCreateRoot(String rootName, Object object, boolean noDepth) { 282 try { 283 if (noDepth) { return this.objectManager.lookupOrCreateRootNoDepth(rootName, object); } 284 return this.objectManager.lookupOrCreateRoot(rootName, object, true); 285 } catch (Throwable t) { 286 Util.printLogAndRethrowError(t, logger); 287 288 throw new AssertionError (); 290 } 291 } 292 293 public void beginLock(String lockID, int type) { 294 try { 295 begin(lockID, type, null, null); 296 } catch (Throwable t) { 297 Util.printLogAndRethrowError(t, logger); 298 } 299 } 300 301 public void beginVolatile(TCObject tcObject, String fieldName, int type) { 302 if (tcObject == null) { throw new NullPointerException ("beginVolatile called on a null TCObject"); } 303 304 begin(generateVolatileLockName(tcObject, fieldName), type, null, null); 305 } 306 307 private void begin(String lockID, int type, Object instance, TCObject tcobj) { 308 this.txManager.begin(lockID, type); 309 if (runtimeLogger.lockDebug()) { 310 runtimeLogger.lockAcquired(lockID, type, instance, tcobj); 311 } 312 } 313 314 private boolean tryBegin(String lockID, int type, Object instance, TCObject tcobj) { 315 boolean locked = this.txManager.tryBegin(lockID, type); 316 if (locked && runtimeLogger.lockDebug()) { 317 runtimeLogger.lockAcquired(lockID, type, instance, tcobj); 318 } 319 return locked; 320 } 321 322 public void commitVolatile(TCObject tcObject, String fieldName) { 323 if (tcObject == null) { throw new NullPointerException ("commitVolatile called on a null TCObject"); } 324 325 commitLock(generateVolatileLockName(tcObject, fieldName)); 326 } 327 328 public void commitLock(String lockName) { 329 330 try { 331 this.txManager.commit(lockName); 332 } catch (Throwable t) { 333 Util.printLogAndRethrowError(t, logger); 334 } 335 } 336 337 public void objectNotify(Object obj) { 338 if (obj == null) { throw new NullPointerException ("notify() called on a null reference"); } 339 340 TCObject tco = lookupExistingOrNull(obj); 341 342 if (tco != null) { 343 managedObjectNotify(obj, tco, false); 344 } else { 345 obj.notify(); 346 } 347 } 348 349 public void objectNotifyAll(Object obj) { 350 if (obj == null) { throw new NullPointerException ("notifyAll() called on a null reference"); } 351 352 TCObject tco = lookupExistingOrNull(obj); 353 354 if (tco != null) { 355 managedObjectNotify(obj, tco, true); 356 } else { 357 obj.notifyAll(); 358 } 359 } 360 361 private void managedObjectNotify(Object obj, TCObject tco, boolean all) { 362 try { 363 if (runtimeLogger.waitNotifyDebug()) { 364 runtimeLogger.objectNotify(all, obj, tco); 365 } 366 this.txManager.notify(generateAutolockName(tco), all, obj); 367 } catch (Throwable t) { 368 Util.printLogAndRethrowError(t, logger); 369 } 370 } 371 372 public void objectWait0(Object obj) throws InterruptedException { 373 TCObject tco = lookupExistingOrNull(obj); 374 375 if (tco != null) { 376 try { 377 WaitInvocation call = new WaitInvocation(); 378 if (runtimeLogger.waitNotifyDebug()) { 379 runtimeLogger.objectWait(call, obj, tco); 380 } 381 this.txManager.wait(generateAutolockName(tco), call, obj); 382 } catch (InterruptedException ie) { 383 throw ie; 384 } catch (Throwable t) { 385 Util.printLogAndRethrowError(t, logger); 386 } 387 } else { 388 obj.wait(); 389 } 390 } 391 392 public void objectWait1(Object obj, long millis) throws InterruptedException { 393 TCObject tco = lookupExistingOrNull(obj); 394 if (tco != null) { 395 try { 396 WaitInvocation call = new WaitInvocation(millis); 397 if (runtimeLogger.waitNotifyDebug()) { 398 runtimeLogger.objectWait(call, obj, tco); 399 } 400 this.txManager.wait(generateAutolockName(tco), call, obj); 401 } catch (InterruptedException ie) { 402 throw ie; 403 } catch (Throwable t) { 404 Util.printLogAndRethrowError(t, logger); 405 } 406 } else { 407 obj.wait(millis); 408 } 409 } 410 411 public void objectWait2(Object obj, long millis, int nanos) throws InterruptedException { 412 TCObject tco = lookupExistingOrNull(obj); 413 414 if (tco != null) { 415 try { 416 WaitInvocation call = new WaitInvocation(millis, nanos); 417 if (runtimeLogger.waitNotifyDebug()) { 418 runtimeLogger.objectWait(call, obj, tco); 419 } 420 this.txManager.wait(generateAutolockName(tco), call, obj); 421 } catch (InterruptedException ie) { 422 throw ie; 423 } catch (Throwable t) { 424 Util.printLogAndRethrowError(t, logger); 425 } 426 } else { 427 obj.wait(millis, nanos); 428 } 429 } 430 431 private boolean isLiteralAutolock(Object o) { 432 if (o instanceof Manageable) { return false; } 433 return (!(o instanceof Class )) && literals.isLiteralInstance(o); 434 } 435 436 public void monitorEnter(Object obj, int type) { 437 if (obj == null) { throw new NullPointerException ("monitorEnter called on a null object"); } 438 439 TCObject tco = lookupExistingOrNull(obj); 440 441 try { 442 if (tco != null) { 443 if (tco.autoLockingDisabled()) { return; } 444 445 begin(generateAutolockName(tco), type, obj, tco); 446 } else if (isLiteralAutolock(obj)) { 447 begin(generateLiteralLockName(obj), type, obj, null); 448 } 449 } catch (Throwable t) { 450 Util.printLogAndRethrowError(t, logger); 451 } 452 } 453 454 public void monitorExit(Object obj) { 455 if (obj == null) { throw new NullPointerException ("monitorExit called on a null object"); } 456 457 TCObject tco = lookupExistingOrNull(obj); 458 459 try { 460 if (tco != null) { 461 if (tco.autoLockingDisabled()) { return; } 462 463 this.txManager.commit(generateAutolockName(tco)); 465 } else if (isLiteralAutolock(obj)) { 466 this.txManager.commit(generateLiteralLockName(obj)); 467 } 468 } catch (Throwable t) { 469 Util.printLogAndRethrowError(t, logger); 470 } 471 } 472 473 public boolean isLocked(Object obj) { 474 if (obj == null) { throw new NullPointerException ("isLocked called on a null object"); } 475 476 TCObject tco = lookupExistingOrNull(obj); 477 478 if (tco != null) { 479 return this.txManager.isLocked(generateAutolockName(tco)); 480 } else { 481 return this.txManager.isLocked(generateLiteralLockName(obj)); 482 } 483 } 484 485 public boolean tryMonitorEnter(Object obj, int type) { 486 if (obj == null) { throw new NullPointerException ("monitorEnter called on a null object"); } 487 488 TCObject tco = lookupExistingOrNull(obj); 489 490 try { 491 if (tco != null) { 492 if (tco.autoLockingDisabled()) { return false; } 493 494 return tryBegin(generateAutolockName(tco), type, obj, tco); 495 } else if (isLiteralAutolock(obj)) { return tryBegin(generateLiteralLockName(obj), type, obj, null); } 496 } catch (Throwable t) { 497 Util.printLogAndRethrowError(t, logger); 498 } 499 return false; 500 } 501 502 public boolean tryBeginLock(String lockID, int type) { 503 return tryBegin(lockID, type, null, null); 504 } 505 506 public boolean isHeldByCurrentThread(Object obj, int lockLevel) { 507 if (obj == null) { throw new NullPointerException ("isHeldByCurrentThread called on a null object"); } 508 509 TCObject tco = lookupExistingOrNull(obj); 510 511 if (tco != null) { 512 return this.txManager.isHeldByCurrentThread(generateAutolockName(tco), lockLevel); 513 } else { 514 return this.txManager.isHeldByCurrentThread(generateLiteralLockName(obj), lockLevel); 515 } 516 517 } 518 519 public int queueLength(Object obj) { 520 if (obj == null) { throw new NullPointerException ("queueLength called on a null object"); } 521 522 TCObject tco = lookupExistingOrNull(obj); 523 524 if (tco != null) { 525 return this.txManager.queueLength(generateAutolockName(tco)); 526 } else { 527 return this.txManager.queueLength(generateLiteralLockName(obj)); 528 } 529 } 530 531 public int waitLength(Object obj) { 532 if (obj == null) { throw new NullPointerException ("waitLength called on a null object"); } 533 534 TCObject tco = lookupExistingOrNull(obj); 535 536 if (tco != null) { 537 return this.txManager.waitLength(generateAutolockName(tco)); 538 } else { 539 return this.txManager.waitLength(generateLiteralLockName(obj)); 540 } 541 } 542 543 public boolean isCreationInProgress() { 544 return this.objectManager.isCreationInProgress() || this.txManager.isTransactionLoggingDisabled(); 545 } 546 547 public TCObject shareObjectIfNecessary(Object pojo) { 548 TCObject tobj = ((Manageable) pojo).__tc_managed(); 549 if (tobj != null) { return tobj; } 550 551 try { 552 return this.objectManager.lookupOrShare(pojo); 553 } catch (Throwable t) { 554 Util.printLogAndRethrowError(t, logger); 555 556 throw new AssertionError (); 558 } 559 } 560 561 public TCObject lookupOrCreate(Object obj) { 562 if (obj instanceof Manageable) { return ((Manageable) obj).__tc_managed(); } 563 return this.objectManager.lookupOrCreate(obj); 564 } 565 566 public TCObject lookupExistingOrNull(Object pojo) { 567 if (pojo instanceof Manageable) { return ((Manageable) pojo).__tc_managed(); } 568 569 try { 570 return this.objectManager.lookupExistingOrNull(pojo); 571 } catch (Throwable t) { 572 Util.printLogAndRethrowError(t, logger); 573 574 throw new AssertionError (); 576 } 577 } 578 579 public Object lookupObject(ObjectID id) throws ClassNotFoundException { 580 return this.objectManager.lookupObject(id); 581 } 582 583 public boolean distributedMethodCall(Object receiver, String method, Object [] params, boolean runOnAllNodes) { 584 TCObject tco = lookupExistingOrNull(receiver); 585 586 try { 587 if (tco != null) { 588 return methodCallManager.distributedInvoke(receiver, method, params, runOnAllNodes); 589 } else { 590 return false; 591 } 592 } catch (Throwable t) { 593 Util.printLogAndRethrowError(t, logger); 594 return false; 595 } 596 } 597 598 public void distributedMethodCallCommit() { 599 methodCallManager.distributedInvokeCommit(); 600 } 601 602 public void checkWriteAccess(Object context) { 603 if (isManaged(context)) { 605 try { 606 txManager.checkWriteAccess(context); 607 } catch (Throwable t) { 608 Util.printLogAndRethrowError(t, logger); 609 } 610 } 611 } 612 613 public boolean isManaged(Object obj) { 614 if (obj instanceof Manageable) { 615 TCObject tcobj = ((Manageable) obj).__tc_managed(); 616 617 return tcobj != null && tcobj.isShared(); 618 } 619 return this.objectManager.isManaged(obj); 620 } 621 622 public Object lookupRoot(String name) { 623 try { 624 return this.objectManager.lookupRoot(name); 625 } catch (Throwable t) { 626 Util.printLogAndRethrowError(t, logger); 627 628 throw new AssertionError (); 630 } 631 } 632 633 private static String generateVolatileLockName(TCObject tcobj, String fieldName) { 634 Assert.assertNotNull(tcobj); 635 return ByteCodeUtil.generateVolatileLockName(tcobj.getObjectID(), fieldName); 636 } 637 638 private static String generateAutolockName(TCObject tcobj) { 639 Assert.assertNotNull(tcobj); 640 return ByteCodeUtil.generateAutolockName(tcobj.getObjectID()); 641 } 642 643 private static String generateLiteralLockName(Object obj) { 644 Assert.assertNotNull(obj); 645 return ByteCodeUtil.generateLiteralLockName(obj); 646 } 647 648 public boolean isLogical(Object object) { 649 return this.config.isLogical(object.getClass().getName()); 650 } 651 652 public boolean isRoot(String className, String fieldName) { 653 return this.config.isRoot(className, fieldName); 654 } 655 656 public Object deepCopy(Object source) { 657 Object ret = null; 658 try { 659 ret = this.objectManager.deepCopy(source, optimisticTransactionManager); 660 } catch (Throwable t) { 661 Util.printLogAndRethrowError(t, logger); 662 } 663 return ret; 664 } 665 666 public TCProperties getTCProperites() { 667 return TCPropertiesImpl.getProperties(); 668 } 669 670 private class ShutdownAction implements Runnable { 671 public void run() { 672 675 shutdown(true); 676 } 677 } 678 679 public void optimisticBegin() { 680 this.optimisticTransactionManager.begin(); 681 } 682 683 public void optimisticCommit() throws ClassNotFoundException { 684 this.optimisticTransactionManager.commit(); 685 } 686 687 public void optimisticRollback() { 688 this.optimisticTransactionManager.rollback(); 689 } 690 691 public boolean isPhysicallyInstrumented(Class clazz) { 692 return this.portability.isClassPhysicallyInstrumented(clazz); 693 } 694 695 public TCLogger getLogger(String loggerName) { 696 return TCLogging.getLogger(loggerName); 697 } 698 699 private static class MethodDisplayNames { 700 701 private final Map display = new HashMap (); 702 703 public MethodDisplayNames(SerializationUtil serializer) { 704 String [] sigs = serializer.getSignatures(); 705 for (int i = 0; i < sigs.length; i++) { 706 display.put(sigs[i], getDisplayStringFor(sigs[i])); 707 } 708 } 709 710 private String getDisplayStringFor(String signature) { 711 String methodName = signature.substring(0, signature.indexOf('(')); 712 StringBuffer rv = new StringBuffer (methodName); 713 rv.append('('); 714 715 Type[] args = Type.getArgumentTypes(signature.substring(signature.indexOf('('))); 716 for (int i = 0; i < args.length; i++) { 717 if (i > 0) { 718 rv.append(','); 719 } 720 Type t = args[i]; 721 int sort = t.getSort(); 722 switch (sort) { 723 case Type.ARRAY: 724 Type elemType = t.getElementType(); 725 if (elemType.getSort() == Type.OBJECT) { 726 rv.append(getShortName(elemType)); 727 } else { 728 rv.append(elemType.getClassName()); 729 } 730 for (int d = t.getDimensions(); d > 0; --d) { 731 rv.append("[]"); 732 } 733 break; 734 case Type.OBJECT: 735 rv.append(getShortName(t)); 736 break; 737 case Type.BOOLEAN: 738 case Type.BYTE: 739 case Type.CHAR: 740 case Type.DOUBLE: 741 case Type.FLOAT: 742 case Type.INT: 743 case Type.LONG: 744 case Type.SHORT: 745 rv.append(t.getClassName()); 746 break; 747 default: 748 throw new AssertionError ("unknown sort: " + sort); 749 } 750 } 751 752 rv.append(')'); 753 return rv.toString(); 754 } 755 756 private String getShortName(Type t) { 757 String fqName = t.getClassName(); 758 int lastDot = fqName.lastIndexOf('.'); 759 if (lastDot > -1) { return fqName.substring(lastDot + 1); } 760 return fqName; 761 } 762 763 String getDisplayForSignature(String methodSignature) { 764 String rv = (String ) display.get(methodSignature); 765 if (rv == null) { throw new AssertionError ("missing display string for signature: " + methodSignature); } 766 return rv; 767 } 768 } 769 770 public void addClusterEventListener(ClusterEventListener cel) { 771 cluster.addClusterEventListener(cel); 772 } 773 774 public DmiManager getDmiManager() { 775 return this.methodCallManager; 776 } 777 778 } 779 | Popular Tags |