1 27 package org.objectweb.speedo; 28 29 import java.util.Arrays ; 30 import java.util.Collection ; 31 import java.util.Collections ; 32 import java.util.HashMap ; 33 import java.util.Iterator ; 34 import java.util.Map ; 35 import java.util.Properties ; 36 37 import javax.jdo.JDOUserException; 38 import javax.jdo.PersistenceManager; 39 import javax.jdo.PersistenceManagerFactory; 40 import javax.jdo.datastore.DataStoreCache; 41 import javax.jdo.listener.InstanceLifecycleListener; 42 import javax.naming.InitialContext ; 43 import javax.naming.NamingException ; 44 45 import org.objectweb.fractal.adl.Factory; 46 import org.objectweb.fractal.adl.FactoryFactory; 47 import org.objectweb.fractal.api.Component; 48 import org.objectweb.fractal.api.Interface; 49 import org.objectweb.fractal.api.control.BindingController; 50 import org.objectweb.fractal.api.control.ContentController; 51 import org.objectweb.fractal.jmx.comm.CommunicatorAttributes; 52 import org.objectweb.fractal.util.Fractal; 53 import org.objectweb.jorm.api.PMapper; 54 import org.objectweb.jorm.mapper.rdb.lib.ConnectionSpecJDBC; 55 import org.objectweb.perseus.cache.api.CacheAttributeController; 56 import org.objectweb.perseus.concurrency.pessimistic.PessimisticConcurrencyManagerAC; 57 import org.objectweb.perseus.dependency.api.DependencyGraph; 58 import org.objectweb.perseus.pool.api.PoolAttributes; 59 import org.objectweb.speedo.api.Debug; 60 import org.objectweb.speedo.api.SpeedoException; 61 import org.objectweb.speedo.api.SpeedoProperties; 62 import org.objectweb.speedo.api.SpeedoVersion; 63 import org.objectweb.speedo.api.TransactionListener; 64 import org.objectweb.speedo.jmx.JMXConfigurator; 65 import org.objectweb.speedo.lib.FractalHelper; 66 import org.objectweb.speedo.mapper.api.JormFactoryAttributes; 67 import org.objectweb.speedo.mapper.api.MapperAttributes; 68 import org.objectweb.speedo.mapper.rdb.JDBCMapperAttributes; 69 import org.objectweb.speedo.pm.api.ProxyManager; 70 import org.objectweb.speedo.pm.api.ProxyManagerFactory; 71 import org.objectweb.speedo.query.api.QueryManagerAttribute; 72 import org.objectweb.speedo.sequence.api.SequenceManager; 73 import org.objectweb.speedo.workingset.lib.SpeedoTransaction; 74 import org.objectweb.util.monolog.Monolog; 75 import org.objectweb.util.monolog.api.BasicLevel; 76 import org.objectweb.util.monolog.api.Loggable; 77 import org.objectweb.util.monolog.api.Logger; 78 import org.objectweb.util.monolog.api.LoggerFactory; 79 80 93 public class Speedo implements PersistenceManagerFactory, ProxyManagerFactory { 94 95 public final static String CONNECTION_SPEC_FACTORY = 96 "org.objectweb.speedo.connectionSpecFactory"; 97 98 private final static String LOGGER_NAME = SpeedoProperties.LOGGER_NAME + ".init"; 99 private final static String SPEEDO_TEMPLATE = "org.objectweb.speedo.Speedo"; 100 private final static String SPEEDO_JMX_TEMPLATE = "org.objectweb.speedo.SpeedoJMX"; 101 private final static String OPTIMISTIC_CONCURRENCY_TEMPLATE = 102 "org.objectweb.perseus.persistence.concurrency.POptimisticConcurrencyManager"; 103 private final static String PESSIMISTIC_CONCURRENCY_TEMPLATE = 104 "org.objectweb.perseus.persistence.concurrency.PPessimisticConcurrencyManager"; 105 private final static String DBDELEGATE_CONCURRENCY_TEMPLATE = 106 "org.objectweb.perseus.persistence.concurrency.PDbDelegateConcurrencyManager"; 107 public final static String PM_POOL_PATH = "proxy-manager-pool"; 108 public final static String MEMORY_CACHE_PATH = "tpm.cache-manager"; 109 public final static String DEPENDENCY_GRAPH_PATH = "tpm.dependency-graph"; 110 public final static String QUERY_CACHE_PATH = "compiled-query-cache"; 111 public final static String QUERY_MANAGER = "query-manager"; 112 public final static String CONNECTION_POOL_PATH = "mapper.pool"; 113 public final static String MONOLOG_FACTORY_PATH = "monolog-factory"; 114 public final static String PRIMITIVE_MAPPER_PATH = "mapper.mapper"; 115 public final static String JORM_FACTORY_PATH = "mapper.jorm-factory"; 116 public final static String PMF_PATH = "proxy-manager-factory"; 117 public final static String JMX_AGENT_PATH = "agent"; 118 public final static String HTML_JMX_AGENT_PATH = JMX_AGENT_PATH + ".html"; 119 120 121 private static Map INSTANCES = new HashMap (); 122 private final static String FRACTAL_PROVIDER = "fractal.provider"; 123 private final static String DEFAULT_FRACTAL_PROVIDER 124 = "org.objectweb.fractal.julia.Julia"; 125 126 private final static String JULIA_LOADER = "julia.loader"; 127 private final static String DEFAULT_JULIA_LOADER 128 = "org.objectweb.fractal.julia.loader.DynamicLoader"; 129 130 private final static String JULIA_CONFIG = "julia.config"; 131 private final static String DEFAULT_JULIA_CONFIG = "julia.cfg"; 132 133 private static Factory factory = null; 134 private static Component speedoTemplate = null; 135 136 public static PersistenceManagerFactory getPersistenceManagerFactory( 138 Properties props) throws Throwable { 139 return getPersistenceManagerFactory((Map ) props); 140 } 141 public static PersistenceManagerFactory getPersistenceManagerFactory( 143 Map m) throws Throwable { 144 Object instance; 145 synchronized (INSTANCES) { 146 instance = INSTANCES.get(m); 147 if (instance == null) { 148 instance = new Speedo(m); 149 INSTANCES.put(m, instance); 150 } 151 } 152 return (PersistenceManagerFactory) instance; 153 } 154 155 public static void clearInstances() { 156 INSTANCES.clear(); 157 } 158 159 162 private PersistenceManagerFactory delegate = null; 163 ProxyManagerFactory pmfComponent = null; 164 private Logger logger = null; 165 private Component speedo = null; 166 boolean isPropertiesInitialized = false; 167 168 public Speedo() throws Throwable { 169 getSpeedoComponent(null); 170 isPropertiesInitialized = false; 171 } 172 176 public Speedo(Map props) throws Throwable { 177 try { 178 init(getSpeedoComponent(props), props); 179 isPropertiesInitialized = true; 180 } catch(Throwable e) { 181 System.err.println("Error during the instanciation of the Speedo " + 182 "persistence manager factory:"); 183 e.printStackTrace(System.err); 184 throw e; 185 } 186 } 187 188 public ProxyManagerFactory getPMFComponent() throws Exception { 189 return pmfComponent; 190 } 191 192 private Factory getADLFactory () throws Exception { 193 if (factory == null) { 194 factory = FactoryFactory.getFactory(FactoryFactory.FRACTAL_BACKEND); 195 } 196 return factory; 197 } 198 199 private static Object getProperty(Map m, String propName) { 200 return m.get(propName); 201 } 202 203 private static String getProperty(Map m, String propName, String defaultValue) { 204 Object res = m.get(propName); 205 if (res instanceof String ) { 206 return (String ) res; 207 } else { 208 return defaultValue; 209 } 210 } 211 private Component getSpeedoComponent(Map props) throws Throwable { 212 213 if (speedo == null) { 214 System.setProperty(FRACTAL_PROVIDER, DEFAULT_FRACTAL_PROVIDER); 216 System.setProperty(JULIA_LOADER, DEFAULT_JULIA_LOADER); 217 System.setProperty(JULIA_CONFIG, DEFAULT_JULIA_CONFIG); 218 219 221 Monolog.initialize(); 222 223 LoggerFactory loggerFactory = Monolog.monologFactory; 224 logger = loggerFactory.getLogger(LOGGER_NAME); 225 String templateName = SPEEDO_TEMPLATE; 226 if (props != null 227 && isTrue(getProperty(props, SpeedoProperties.JMX, "false"))) { 228 templateName = SPEEDO_JMX_TEMPLATE; 229 } 230 try { 232 if (speedoTemplate == null) { 233 speedoTemplate = (Component)getADLFactory().newComponent( 234 templateName, 235 Collections.singletonMap("template", "true")); 236 } 237 speedo = Fractal.getFactory(speedoTemplate).newFcInstance(); 239 } catch (Throwable e) { 240 System.err.println("Error during the template loading or the " + 241 "component instanciation '" + SPEEDO_TEMPLATE + "': "); 242 throw e; 243 } 244 Fractal.getNameController(speedo).setFcName("org.objectweb.speedo"); 245 delegate = (PersistenceManagerFactory) speedo.getFcInterface("persistence-manager-factory"); 246 } 247 return speedo; 248 } 249 250 public void init(Component speedo, Map pmfProps) throws Throwable { 251 logger.log(BasicLevel.INFO, "Speedo " + SpeedoVersion.SPEEDO_VERSION 252 + " is starting ..."); 253 254 Map props = new HashMap (); 257 props.putAll(pmfProps); 258 String strval; 259 260 props.remove(SpeedoProperties.JDO_PERSISTENCE_MANAGER_FACTORY_CLASS); 261 262 strval = getProperty(props, SpeedoProperties.IMRICATED_PM_ALLOWED, "false"); 263 props.remove(SpeedoProperties.IMRICATED_PM_ALLOWED); 264 boolean imbricatedPM = Boolean.valueOf(strval).booleanValue(); 265 if (imbricatedPM) { 266 logger.log(BasicLevel.INFO, "PM reused on imbricated PMF.getPM()"); 267 } 268 269 strval = getProperty(props, SpeedoProperties.DEBUG, null); 271 props.remove(SpeedoProperties.DEBUG); 272 if (strval != null) { 273 Debug.ON = Boolean.valueOf(strval).booleanValue(); 274 logger.log(BasicLevel.INFO, SpeedoProperties.DEBUG + ": " + Debug.ON); 275 } 276 277 boolean useConnectionFactory = configureMapper(speedo, props); 278 configurePool(getSubComponent(speedo, PM_POOL_PATH), 279 "PersistenceManager pool: ", 280 SpeedoProperties.PM_POOL_MIN, 281 SpeedoProperties.PM_POOL_MAX, 282 SpeedoProperties.PM_POOL_TTL, 283 SpeedoProperties.PM_POOL_INACTIVETTL, 284 SpeedoProperties.PM_POOL_TIMEOUT, 285 props); 286 configureCache(getSubComponent(speedo, MEMORY_CACHE_PATH), 287 "Persistent objects cache: ", 288 SpeedoProperties.CACHE_SIZE, 289 SpeedoProperties.CACHE_AUTO_CLEAN_SIZE, 290 SpeedoProperties.CACHE_AUTO_CLEAN_THRESHOLD, 291 SpeedoProperties.CACHE_REPLCAEMENT, 292 props); 293 configureCache(getSubComponent(speedo, QUERY_CACHE_PATH), 294 "Compiled query cache: ", 295 SpeedoProperties.COMPILED_QUERY_CACHE_SIZE, 296 SpeedoProperties.COMPILED_QUERY_CACHE_AUTO_CLEAN_SIZE, 297 SpeedoProperties.COMPILED_QUERY_CACHE_AUTO_CLEAN_THRESHOLD, 298 SpeedoProperties.COMPILED_QUERY_CACHE_POLICY, 299 props); 300 301 final String TM_NAME_old = "org.objectweb.perseus.connector.ra.jdo.TMName"; 303 strval = getProperty(props, TM_NAME_old, ""); 304 if (strval.length()>0) { 305 logger.log(BasicLevel.WARN, "Property " + TM_NAME_old 306 + " is deprecated, you must use " + SpeedoProperties.TM_NAME); 307 props.remove(TM_NAME_old); 308 pmfProps.remove(TM_NAME_old); 309 if (getProperty(props, SpeedoProperties.TM_NAME) == null) { 310 props.put(SpeedoProperties.TM_NAME, strval); 311 pmfProps.put(SpeedoProperties.TM_NAME, strval); 312 } 313 } 314 315 strval = getProperty(props, SpeedoProperties.MANAGED, ""); 317 if (strval.length()>0) { 318 boolean b = isTrue(strval); 319 if (!useConnectionFactory && b) { 320 String msg = "In a managed environnement, a connection factory is required"; 321 logger.log(BasicLevel.ERROR, msg); 322 throw new JDOUserException(msg); 323 } 324 logger.log(BasicLevel.INFO, SpeedoProperties.MANAGED + ": Speedo is used " 325 + (b 326 ? "in a managed environnement" 327 : "in stand alone")); 328 329 strval = getProperty(props, SpeedoProperties.TM_NAME, ""); 331 props.remove(SpeedoProperties.TM_NAME); 332 logger.log(BasicLevel.INFO, SpeedoProperties.TM_NAME + ": " 333 + (strval.length()>0 334 ? strval 335 : ": no value specified, use a well known application server")); 336 } else { 337 props.remove(SpeedoProperties.TM_NAME); 338 } 339 340 strval = getProperty(props, SpeedoProperties.TX_LISTENER, ""); 342 if (strval.length()>0) { 343 try { 344 SpeedoTransaction.txListener = (TransactionListener) 345 Class.forName(strval).newInstance(); 346 if (SpeedoTransaction.txListener instanceof Loggable) { 347 ((Loggable) SpeedoTransaction.txListener) 348 .setLoggerFactory(Monolog.monologFactory); 349 } 350 logger.log(BasicLevel.INFO, "Transaction listener: " + strval); 351 } catch (Exception e) { 352 logger.log(BasicLevel.WARN, 353 "Impossible to instanciate the TransactionListener specified '" 354 + strval + "': ", e); 355 } 356 } 357 358 configurePrefetching(speedo, props); 359 configureConcurrencyManager(speedo, props); 360 boolean jmxOn = configureJMX(speedo, props); 361 362 for (Iterator it = props.entrySet().iterator(); it.hasNext();) { 364 Map.Entry me = (Map.Entry ) it.next(); 365 String key = (String ) me.getKey(); 366 String value = (String ) me.getValue(); 367 boolean knownProperty = true; 368 if (SpeedoProperties.JDO_OPTION_RETAIN_VALUES.equals(key)) { 369 delegate.setRetainValues(Boolean.valueOf(value).booleanValue()); 370 371 } else if (SpeedoProperties.JDO_OPTION_RESTORE_VALUES.equals(key)) { 372 delegate.setRestoreValues(Boolean.valueOf(value).booleanValue()); 373 374 } else if (SpeedoProperties.JDO_OPTION_IGNORE_CACHE.equals(key)) { 375 delegate.setIgnoreCache(Boolean.valueOf(value).booleanValue()); 376 377 } else if (SpeedoProperties.JDO_OPTION_NON_TRANSACTIONAL_READ.equals(key)) { 378 delegate.setNontransactionalRead(Boolean.valueOf(value).booleanValue()); 379 380 } else if (SpeedoProperties.JDO_OPTION_NON_TRANSACTIONAL_WRITE.equals(key)) { 381 delegate.setNontransactionalWrite(Boolean.valueOf(value).booleanValue()); 382 383 } else if (SpeedoProperties.JDO_OPTION_MULTITREADED.equals(key)) { 384 delegate.setMultithreaded(Boolean.valueOf(value).booleanValue()); 385 386 } else { 387 knownProperty = false; 388 } 389 if (knownProperty) { 390 logger.log(BasicLevel.INFO, key + ": " + value); 391 it.remove(); 392 } 393 } 394 395 for (Iterator it = props.entrySet().iterator(); it.hasNext();) { 397 Map.Entry me = (Map.Entry ) it.next(); 398 String key = (String ) me.getKey(); 399 if (key.startsWith(SpeedoProperties.CACHE_CLASS_POLICY+"(") 400 || key.startsWith(SpeedoProperties.USER_CACHE_CLASS_POLICY+"(") 401 || key.startsWith(SpeedoProperties.PREFETCH_ON_GENCLASS+"(") 402 || key.startsWith(SpeedoProperties.PREFETCH_ON_QUERY+"(") 403 || key.startsWith(SpeedoProperties.PREFETCH_ON_EXTENT+"(") 404 ) { 405 continue; 406 } 407 String value = (String ) me.getValue(); 408 logger.log(BasicLevel.WARN, "The (" + key + ", " + value 409 + ") property is not managed"); 410 } 411 412 delegate.getProperties().putAll(pmfProps); 413 Fractal.getLifeCycleController(speedo).startFc(); 414 pmfComponent = (ProxyManagerFactory) getSubComponent( 415 ((Interface) delegate).getFcItfOwner(), PMF_PATH) 416 .getFcInterface("proxy-manager-factory"); 417 if (jmxOn) { 418 new JMXConfigurator(speedo, logger).init(); 419 } 420 } 421 private Component getSubComponent(Component parent, 422 String path) throws Exception { 423 return FractalHelper.getSubComponent(parent, path, logger); 424 } 425 426 private void configurePool(Component pool, 427 String poolLabel, 428 String minProp, 429 String maxProp, 430 String ttlProp, 431 String inactivettlProp, 432 String timeoutProp, 433 Map props) throws Exception { 434 String strval = null; 435 int poolMinSize = -2; 436 int poolMaxSize = -2; 437 long poolTTL = -2; 438 long poolInactiveTTL = -2; 439 long poolTimeout = -2; 440 boolean conf = false; 441 StringBuffer sb = new StringBuffer (poolLabel); 442 final String sep = ", "; 443 if (minProp != null) { 444 strval = getProperty(props, minProp, ""); 445 if (strval.length() > 0) { 446 props.remove(minProp); 447 poolMinSize = Integer.parseInt(strval); 448 if (conf) { 449 sb.append(sep); 450 } 451 sb.append("min=" + strval); 452 conf = true; 453 } 454 } 455 if (maxProp != null) { 456 strval = getProperty(props, maxProp, ""); 457 if (strval.length() > 0) { 458 props.remove(maxProp); 459 if (strval.equalsIgnoreCase("nolimit")) { 460 poolMaxSize = -1; 461 } else { 462 poolMaxSize = Integer.parseInt(strval); 463 } 464 if (conf) { 465 sb.append(sep); 466 } 467 sb.append("max=" + strval); 468 conf = true; 469 } 470 } 471 if (ttlProp != null) { 472 strval = getProperty(props, ttlProp, ""); 473 if (strval.length() > 0) { 474 props.remove(ttlProp); 475 try { 476 poolTTL = 1000 * Long.parseLong(strval); 477 } catch (NumberFormatException e) { 478 poolTTL = -1; 479 strval = "NOTTL"; 480 } 481 if (conf) { 482 sb.append(sep); 483 } 484 sb.append("ttl=" + strval); 485 conf = true; 486 } 487 } 488 if (inactivettlProp != null) { 489 strval = getProperty(props, inactivettlProp, ""); 490 if (strval.length() > 0) { 491 props.remove(inactivettlProp); 492 try { 493 poolInactiveTTL = 1000 * Long.parseLong(strval); 494 } catch (NumberFormatException e) { 495 poolInactiveTTL = -1; 496 strval = "NOTTL"; 497 } 498 if (conf) { 499 sb.append(sep); 500 } 501 sb.append("inactivettlProp=" + strval); 502 conf = true; 503 } 504 } 505 if (timeoutProp != null) { 506 strval = getProperty(props, timeoutProp, ""); 507 if (strval.length() > 0) { 508 props.remove(timeoutProp); 509 try { 510 poolTimeout = Long.parseLong(strval); 511 } catch (NumberFormatException e) { 512 poolTimeout = -1; 513 strval = "WAIT"; 514 } 515 if (conf) { 516 sb.append(sep); 517 } 518 sb.append("timeout=" + strval); 519 conf = true; 520 } 521 } 522 if (conf) { 523 logger.log(BasicLevel.INFO, sb.toString()); 524 PoolAttributes poolAttr; 525 try { 526 poolAttr = (PoolAttributes) 527 Fractal.getAttributeController(pool); 528 } catch (Exception e) { 529 Component[] children = Fractal.getContentController(speedo).getFcSubComponents(); 530 String [] strs= new String [children.length]; 531 for (int i = 0; i < strs.length; ++i) { 532 strs[i] = Fractal.getNameController(children[i]).getFcName(); 533 } 534 throw new RuntimeException ("" + Arrays.asList(strs)); 535 } 536 if (poolMaxSize > -2) { 537 poolAttr.setMaxSize(poolMaxSize); 538 } 539 if (poolMinSize > -2) { 540 poolAttr.setMinSize(poolMinSize); 541 } 542 if (poolTTL > -2) { 543 poolAttr.setTTL(poolTTL); 544 } 545 if (poolInactiveTTL > -2) { 546 poolAttr.setInactiveTTL(poolInactiveTTL); 547 } 548 if (poolTimeout > -2) { 549 poolAttr.setTimeout(poolTimeout); 550 } 551 } 552 } 553 554 559 private void configureCache(Component cm, 560 String cacheLabel, 561 String sizeProp, 562 String autoCleanSizeProp, 563 String autoCleanThresholdProp, 564 String policyProp, 565 Map props) 566 throws Exception { 567 int cacheSize = -2; 568 String autoCleanSize = null; 569 String autoCleanThreshold = null; 570 String policy = null; 571 StringBuffer sb = new StringBuffer (cacheLabel); 573 final String sep = ", "; 574 boolean conf = false; 575 String strval = getProperty(props, sizeProp, ""); 576 if (strval.length()>0) { 577 props.remove(sizeProp); 578 if (strval.equalsIgnoreCase("nolimit")) { 579 cacheSize = CacheAttributeController.NO_LIMIT; 580 } else { 581 cacheSize = Integer.parseInt(strval); 582 } 583 if (conf) { 584 sb.append(sep); 585 } 586 sb.append("max size=" + strval); 587 conf = true; 588 } 589 590 strval = getProperty(props, autoCleanSizeProp, ""); 592 if (strval.length() > 0) { 593 props.remove(autoCleanSizeProp); 594 autoCleanSize = strval; 595 if (conf) { 596 sb.append(sep); 597 } 598 sb.append("auto replacement size=" + strval); 599 conf = true; 600 } 601 602 strval = getProperty(props, autoCleanThresholdProp, ""); 604 if (strval.length() > 0) { 605 props.remove(autoCleanThresholdProp); 606 autoCleanThreshold = strval; 607 if (conf) { 608 sb.append(sep); 609 } 610 sb.append("auto replacement threshold=" + strval); 611 conf = true; 612 } 613 614 strval = getProperty(props, policyProp, ""); 616 if (strval.length() > 0) { 617 props.remove(policyProp); 618 policy = strval; 619 if (conf) { 620 sb.append(sep); 621 } 622 sb.append("replacement policy=" + strval); 623 conf = true; 624 } 625 if (!conf) { 626 return; 627 } 628 logger.log(BasicLevel.INFO, sb.toString()); 629 Component cmC = getSubComponent(cm, "cache-manager"); 630 CacheAttributeController cacheAttr = (CacheAttributeController) 631 Fractal.getAttributeController(cmC); 632 if (cacheSize > -2) { 633 cacheAttr.setMaxObjects(cacheSize); 634 } 635 if (autoCleanSize != null) { 636 cacheAttr.setAutoCleanSize(autoCleanSize); 637 } 638 if (autoCleanThreshold != null) { 639 cacheAttr.setAutoCleanThreshold(autoCleanThreshold); 640 } 641 if (policy != null) { 642 String tempName = null; 643 if (SpeedoProperties.CACHE_REPLCAEMENT_LRU.equalsIgnoreCase(policy)) { 644 } else if (SpeedoProperties.CACHE_REPLCAEMENT_MRU.equalsIgnoreCase(policy)) { 645 tempName = "org.objectweb.perseus.cache.replacement.lib.MRUReplacementManager"; 646 } else if (SpeedoProperties.CACHE_REPLCAEMENT_FIFO.equalsIgnoreCase(policy)) { 647 tempName = "org.objectweb.perseus.cache.replacement.lib.FIFOReplacementManager"; 648 } else { 649 logger.log(BasicLevel.ERROR, new SpeedoException( 650 "Unmanaged cache replacement policy: " + policy)); 651 } 652 if (tempName != null) { 653 Fractal.getBindingController(cm).unbindFc("replacement-manager"); 655 Fractal.getBindingController(cmC).unbindFc("replacement-manager"); 657 Fractal.getBindingController( 659 getSubComponent(cm, "replacement-manager")) 660 .unbindFc("unbind-manager"); 661 662 Fractal.getContentController(cm).removeFcSubComponent( 664 getSubComponent(cm, "replacement-manager")); 665 666 Component new_rm = (Component)getADLFactory().newComponent(tempName, null); 668 Fractal.getNameController(new_rm).setFcName("replacement-manager"); 669 670 Fractal.getContentController(cm).addFcSubComponent(new_rm); 672 673 Object rm = new_rm.getFcInterface("replacement-manager"); 674 Fractal.getBindingController(cm).bindFc("replacement-manager", rm); 676 Fractal.getBindingController(cmC).bindFc("replacement-manager", rm); 678 Fractal.getBindingController(new_rm).bindFc("unbind-manager", 680 cmC.getFcInterface("unbind-manager")); 681 } 682 } 683 } 684 685 686 private void configureConcurrencyManager(Component speedo, 687 Map props) 688 throws Exception { 689 String tempName; 690 String concurrencyMode; 691 StringBuffer sb = new StringBuffer ("Transaction/Concurrency management: "); 692 String strval = getProperty(props, SpeedoProperties.JDO_OPTION_OPTIMISTIC, "false"); 693 boolean optimistic = isTrue(strval); 694 sb.append("mode=").append((optimistic ? "Optimistic" : "Pessimitic")); 695 strval = getProperty(props, SpeedoProperties.TRANSACTION_LOCKING, 696 SpeedoProperties.SPEEDO_TRANSACTION_LOCKING); 697 props.remove(SpeedoProperties.TRANSACTION_LOCKING); 698 Component composite_tpm = getSubComponent(speedo, "tpm"); 700 Component cm = getSubComponent(composite_tpm, "concurrency-manager"); 701 if (strval.equals(SpeedoProperties.DB_TRANSACTION_LOCKING)) { 702 tempName = DBDELEGATE_CONCURRENCY_TEMPLATE; 703 sb.append(", delegated to database"); 704 } else { 705 sb.append(", managed by Speedo"); 706 if (!optimistic) { 707 709 strval = getProperty(props, 711 SpeedoProperties.TRANSACTION_LOCKING_PESSIMISTIC_POLICY, 712 SpeedoProperties.TRANSACTION_LOCKING_PESSIMISTIC_POLICY_RW_FIFO); 713 props.remove(SpeedoProperties.TRANSACTION_LOCKING_PESSIMISTIC_POLICY); 714 PessimisticConcurrencyManagerAC pcmAC = null; 715 if (!strval.equals(SpeedoProperties.TRANSACTION_LOCKING_PESSIMISTIC_POLICY_RW_FIFO)) { 716 pcmAC = (PessimisticConcurrencyManagerAC) 717 Fractal.getAttributeController(cm); 718 pcmAC.setPolicy(strval); 719 sb.append(", locking policy=").append(strval); 720 } 721 722 strval = getProperty(props, 724 SpeedoProperties.TRANSACTION_LOCKING_LEVEL_ENABLETHIN, 725 "false"); 726 props.remove(SpeedoProperties.TRANSACTION_LOCKING_LEVEL_ENABLETHIN); 727 boolean b = isTrue(strval); 728 if (b) { 729 logger.log(BasicLevel.INFO, "Speedo pessimistic thin locking level: enabled"); 730 pcmAC = (PessimisticConcurrencyManagerAC) 731 Fractal.getAttributeController(cm); 732 pcmAC.setThinkLockAllowed(true); 733 sb.append(", With thin locking level"); 734 } 735 logger.log(BasicLevel.INFO, sb.toString()); 736 return; 737 } 738 tempName = OPTIMISTIC_CONCURRENCY_TEMPLATE; 739 } 740 logger.log(BasicLevel.INFO, sb.toString()); 741 props.remove(SpeedoProperties.JDO_OPTION_OPTIMISTIC); 742 743 ContentController tpmCC = Fractal.getContentController(composite_tpm); 744 BindingController tpmBC = Fractal.getBindingController( 746 getSubComponent(composite_tpm, "transactional-persistence-manager")); 747 tpmBC.unbindFc("concurrency-manager"); 748 749 BindingController cmBC = Fractal.getBindingController(cm); 751 cmBC.unbindFc("state-manager"); 752 cmBC.unbindFc("storage-manager"); 753 cmBC.unbindFc("dependency-graph"); 754 tpmCC.removeFcSubComponent(cm); 755 756 757 cm = (Component)getADLFactory().newComponent(tempName, null); 759 tpmCC.addFcSubComponent(cm); 761 cmBC = Fractal.getBindingController(cm); 763 cmBC.bindFc("state-manager", 764 tpmCC.getFcInternalInterface("state-manager")); 765 cmBC.bindFc("storage-manager", 766 tpmCC.getFcInternalInterface("storage-manager")); 767 cmBC.bindFc("dependency-graph", 768 getSubComponent(composite_tpm, "dependency-graph").getFcInterface("dependency-graph")); 769 770 tpmBC.bindFc("concurrency-manager", cm.getFcInterface("concurrency-manager")); 772 } 773 774 private void configurePrefetching(Component speedo, 775 Map props) throws Throwable { 776 boolean prefetch = true; 778 StringBuffer sb = new StringBuffer ("Data prefetching: "); 779 String strval = getProperty(props, SpeedoProperties.PREFETCH, ""); 780 if (strval.length()>0) { 781 prefetch = !isFalse(strval); 782 props.remove(SpeedoProperties.PREFETCH); 783 } 784 Component qm = getSubComponent(speedo, QUERY_MANAGER); 785 QueryManagerAttribute qma = ((QueryManagerAttribute) Fractal.getAttributeController(qm)); 786 if (!prefetch) { 787 qma.setPrefetchActivatedOnQuery(false); 788 qma.setPrefetchActivatedOnExtent(false); 789 logger.log(BasicLevel.INFO, sb.append("NONE").toString()); 790 return; 791 } 792 boolean prefetchOnQuery = qma.getPrefetchActivatedOnQuery(); 793 boolean prefetchOnExtent = qma.getPrefetchActivatedOnExtent(); 794 boolean prefetchOnGenClass = true; 795 String sep = ", "; 796 797 boolean oneOf = false; 798 strval = getProperty(props, SpeedoProperties.PREFETCH_ON_QUERY, ""); 799 if (strval.length()>0) { 800 prefetchOnQuery = !isFalse(strval); 801 props.remove(SpeedoProperties.PREFETCH_ON_QUERY); 802 } 803 if (prefetchOnQuery) { 804 if (oneOf) { 805 sb.append(sep); 806 } 807 sb.append("QUERY"); 808 } 809 oneOf |= prefetchOnQuery; 810 qma.setPrefetchActivatedOnQuery(prefetchOnQuery); 811 812 strval = getProperty(props, SpeedoProperties.PREFETCH_ON_EXTENT, ""); 813 if (strval.length()>0) { 814 prefetchOnExtent = !isFalse(strval); 815 props.remove(SpeedoProperties.PREFETCH_ON_EXTENT); 816 } 817 if (prefetchOnExtent) { 818 if (oneOf) { 819 sb.append(sep); 820 } 821 sb.append("EXTENT"); 822 } 823 oneOf |= prefetchOnExtent; 824 qma.setPrefetchActivatedOnExtent(prefetchOnExtent); 825 826 strval = getProperty(props, SpeedoProperties.PREFETCH_ON_GENCLASS, ""); 827 if (strval.length()>0) { 828 prefetchOnGenClass= !isFalse(strval); 829 props.remove(SpeedoProperties.PREFETCH_ON_GENCLASS); 830 } 831 if (prefetchOnGenClass) { 832 if (oneOf) { 833 sb.append(sep); 834 } 835 sb.append("COLLECTION"); 836 } 837 oneOf |= prefetchOnGenClass; 838 839 logger.log(BasicLevel.INFO, sb.toString()); 840 } 841 842 850 private boolean configureMapper(Component speedo, 851 Map props) throws Throwable { 852 boolean useConnectionFactory; 853 String mapperName = getProperty(props, SpeedoProperties.MAPPER_NAME, "rdb.automatic"); 854 props.remove(SpeedoProperties.MAPPER_NAME); 855 856 Component component = getSubComponent(speedo, PRIMITIVE_MAPPER_PATH); 857 String strval = null; 858 String cfName = getProperty(props, SpeedoProperties.JDO_OPTION_CONNECTION_FACTORY_NAME, null); 860 props.remove(SpeedoProperties.JDO_OPTION_CONNECTION_FACTORY_NAME); 861 useConnectionFactory = cfName != null && cfName.length() > 0; 862 MapperAttributes ma = (MapperAttributes) Fractal.getAttributeController(component); 863 if (useConnectionFactory) { 864 Object cf = null; 865 try { 867 InitialContext ic = new InitialContext (); 868 cf = ic.lookup(cfName); 869 } catch (NamingException e) { 870 throw new SpeedoException( 871 "Problem to get the connection factory in JNDI (" 872 + cfName + ")", e); 873 } 874 if (cf == null) { 875 throw new SpeedoException( 876 "No connection factory registered in JNDI with the name " 877 + cfName); 878 } else if (cf instanceof ConnectionSpecJDBC) { 879 } else if (cf instanceof javax.sql.DataSource ) { 881 } else if (cf instanceof javax.resource.cci.ConnectionFactory ) { 883 System.out.println("The connection is JCA compliant: " + cf); 884 throw new SpeedoException("JCA datasource no yet supported"); 885 } else { 886 throw new SpeedoException("The connection factory registered " 887 + "in JNDI is not supported by Speedo " + cfName + " => " 888 + cf); 889 } 890 boolean ignoring = removeProps(props, new String []{ 891 SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME_old, 892 SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME_old2, 893 SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME, 894 SpeedoProperties.JDO_OPTION_CONNECTION_URL, 895 SpeedoProperties.JDO_OPTION_CONNECTION_USER_NAME, 896 SpeedoProperties.JDO_OPTION_CONNECTION_PASSWORD}); 897 if (ignoring) { 898 logger.log(BasicLevel.WARN, 899 "Ignoring direct JDBC access information (driver, url, user, password)"); 900 } 901 ignoring = removeProps(props, new String []{ 902 SpeedoProperties.CONNECTION_POOL_MIN, 903 SpeedoProperties.CONNECTION_POOL_MAX, 904 SpeedoProperties.CONNECTION_POOL_TTL, 905 SpeedoProperties.CONNECTION_POOL_TIMEOUT}); 906 if (ignoring) { 907 logger.log(BasicLevel.WARN, 908 "Ignoring connection pool configuration(min, max, ttl, timeout)"); 909 } 910 911 logger.log(BasicLevel.INFO, "Data source access through a connection factory found in JNDI:" 913 + "\n\tjndi name: " + cfName 914 + "\n\tconnection factory found: " + cf 915 + "\n\tmapper name: " + mapperName); 916 PMapper mapper = (PMapper) component.getFcInterface("mapper"); 917 mapper.setMapperName(mapperName); 918 mapper.setConnectionFactory(cf); 919 920 } else { 921 JDBCMapperAttributes jdbcma = (JDBCMapperAttributes) ma; 922 923 strval = getProperty(props, SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME_old, ""); 925 if (strval.length()>0) { 926 logger.log(BasicLevel.WARN, "Property " + SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME_old 927 + " is deprecated, you must use " + SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME); 928 props.remove(SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME_old); 929 930 if (getProperty(props, SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME) == null) { 931 props.put(SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME, strval); 932 } 933 } 934 strval = getProperty(props, SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME_old2, ""); 935 if (strval.length()>0) { 936 logger.log(BasicLevel.WARN, "Property " + SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME_old2 937 + " is deprecated, you must use " + SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME); 938 props.remove(SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME_old); 939 940 if (getProperty(props, SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME) == null) { 941 props.put(SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME, strval); 942 } 943 } 944 String jdbcDriverCN = getProperty(props, SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME, null); 945 props.remove(SpeedoProperties.JDO_OPTION_CONNECTION_DRIVER_NAME); 946 String jdbcUser = getProperty(props, SpeedoProperties.JDO_OPTION_CONNECTION_USER_NAME, null); 947 props.remove(SpeedoProperties.JDO_OPTION_CONNECTION_USER_NAME); 948 String jdbcUrl = getProperty(props, SpeedoProperties.JDO_OPTION_CONNECTION_URL, null); 949 props.remove(SpeedoProperties.JDO_OPTION_CONNECTION_URL); 950 String jdbcPass = getProperty(props, SpeedoProperties.JDO_OPTION_CONNECTION_PASSWORD, null); 951 props.remove(SpeedoProperties.JDO_OPTION_CONNECTION_PASSWORD); 952 logger.log(BasicLevel.INFO, "Data source access through a jdbc driver:" 953 + "\n\tdriver= " + jdbcDriverCN 954 + "\n\turl= " + jdbcUrl 955 + "\n\tuser= " + jdbcUser 956 + "\n\tmapper name: " + mapperName); 957 jdbcma.setMapperName(mapperName); 958 jdbcma.setDriverClassName(jdbcDriverCN); 959 jdbcma.setURL(jdbcUrl); 960 jdbcma.setUserName(jdbcUser); 961 jdbcma.setPassword(jdbcPass); 962 jdbcma.setPoolConnection(true); 963 964 configurePool(getSubComponent(speedo, CONNECTION_POOL_PATH), 966 "Connection pool: ", 967 SpeedoProperties.CONNECTION_POOL_MIN, 968 SpeedoProperties.CONNECTION_POOL_MAX, 969 SpeedoProperties.CONNECTION_POOL_TTL, 970 SpeedoProperties.CONNECTION_POOL_INACTIVETTL, 971 SpeedoProperties.CONNECTION_POOL_TIMEOUT, 972 props); 973 } 974 strval = (String ) props.remove(SpeedoProperties.CONNECTION_CHECK); 975 if (strval != null) { 976 boolean v = isTrue(strval); 977 ma.setCheckConnectivityAtStartup(v); 978 if (!v) { 979 logger.log(BasicLevel.INFO, "No connection checking at start up !"); 980 } 981 } 982 983 byte mappingStructureRule = JormFactoryAttributes.CREATE_IF_REQUIRED; 985 strval = getProperty(props, SpeedoProperties.MAPPING_STRUCTURE, ""); 986 if (strval.length()>0) { 987 props.remove(SpeedoProperties.MAPPING_STRUCTURE); 988 mappingStructureRule = getMappingStructure(strval); 989 if (mappingStructureRule == -1) { 990 mappingStructureRule = JormFactoryAttributes.CREATE_IF_REQUIRED; 991 logger.log(BasicLevel.WARN, "Unexpected value for the property '" 992 + SpeedoProperties.MAPPING_STRUCTURE 993 + "', found: '" + strval + "', expected [" 994 + SpeedoProperties.MAPPING_STRUCTURE_DN 995 + " | " + SpeedoProperties.MAPPING_STRUCTURE_DD 996 + " | " + SpeedoProperties.MAPPING_STRUCTURE_CIR 997 + " | " + SpeedoProperties.MAPPING_STRUCTURE_FC 998 + "]"); 999 } 1000 } 1001 component = getSubComponent(speedo, JORM_FACTORY_PATH); 1002 JormFactoryAttributes jfa = (JormFactoryAttributes) 1003 Fractal.getAttributeController(component); 1004 jfa.setMappingStructureRule(mappingStructureRule); 1005 logger.log(BasicLevel.INFO, "Data Structure: " 1006 + getMappingStructureString(mappingStructureRule)); 1007 1008 Properties jormFactoryProperties = new Properties (); 1009 for (Iterator it = props.entrySet().iterator(); it.hasNext();) { 1010 Map.Entry me = (Map.Entry ) it.next(); 1011 String key = (String ) me.getKey(); 1012 String value = (String ) me.getValue(); 1013 boolean knownProperty = true; 1014 if (key.indexOf('(') != -1) { 1015 jormFactoryProperties.put(key, value); 1016 } else { 1017 knownProperty = false; 1018 } 1019 if (knownProperty) { 1020 logger.log(BasicLevel.INFO, key + ": " + value); 1021 it.remove(); 1022 } 1023 } 1024 jfa.setSpeedoProperties(jormFactoryProperties); 1025 1026 return useConnectionFactory; 1027 } 1028 1029 private boolean configureJMX(Component speedo, 1030 Map props) throws Throwable { 1031 String val = (String ) props.remove(SpeedoProperties.JMX); 1032 if (val == null || !isTrue(val)) { 1033 return false; 1034 } 1035 if (Monolog.monologFactory.getLogger(SpeedoProperties.JMX) 1037 .isLoggable(BasicLevel.DEBUG)) { 1038 System.setProperty("mx4j.log.priority", "debug"); 1040 } 1041 val = (String ) props.remove(SpeedoProperties.JMX_HTTP_PORT); 1042 int port = 0; 1043 if (val != null) { 1044 try { 1045 port = Integer.parseInt(val); 1046 } catch (NumberFormatException e) { 1047 logger.log(BasicLevel.WARN, "Bad HTTP port for the administration console: " + val); 1048 port = -1; 1049 } 1050 } 1051 Component component = getSubComponent(speedo, HTML_JMX_AGENT_PATH); 1052 if (port < 0) { 1053 Fractal.getBindingController(component).unbindFc("adminAtt"); 1055 Fractal.getContentController( 1057 getSubComponent(speedo, JMX_AGENT_PATH)) 1058 .removeFcSubComponent(component); 1059 logger.log(BasicLevel.INFO, "JMX activated"); 1060 } else { 1061 if (port == 0) { 1062 port = 8000; 1064 } 1065 CommunicatorAttributes att = (CommunicatorAttributes) 1067 Fractal.getAttributeController(component); 1068 att.setPort(port); 1069 logger.log(BasicLevel.INFO, "JMX and HTTP console on port '" + port + "' activated"); 1070 } 1071 return true; 1072 } 1073 1074 private boolean removeProps(Map props, String [] wanted) { 1075 boolean found = false; 1076 for (int i = 0; i < wanted.length; i++) { 1077 found |= props.remove(wanted[i]) != null; 1078 } 1079 return found; 1080 } 1081 1082 private boolean isFalse(String val) { 1083 return "false".equalsIgnoreCase(val) 1084 || "off".equalsIgnoreCase(val) 1085 || "no".equalsIgnoreCase(val) 1086 || "non".equalsIgnoreCase(val) 1087 || "n".equalsIgnoreCase(val); 1088 } 1089 1090 private boolean isTrue(String val) { 1091 return "true".equalsIgnoreCase(val) 1092 || "on".equalsIgnoreCase(val) 1093 || "yes".equalsIgnoreCase(val) 1094 || "oui".equalsIgnoreCase(val) 1095 || "y".equalsIgnoreCase(val) 1096 || "o".equalsIgnoreCase(val); 1097 } 1098 1099 public static String getMappingStructureString(byte b) { 1100 switch(b) { 1101 case JormFactoryAttributes.DO_NOTHING: 1102 return SpeedoProperties.MAPPING_STRUCTURE_DN; 1103 case JormFactoryAttributes.DELETE_DATA: 1104 return SpeedoProperties.MAPPING_STRUCTURE_DD; 1105 case JormFactoryAttributes.FORCE_CREATE: 1106 return SpeedoProperties.MAPPING_STRUCTURE_FC; 1107 case JormFactoryAttributes.CREATE_IF_REQUIRED: 1108 return SpeedoProperties.MAPPING_STRUCTURE_CIR; 1109 default: 1110 return "UNKNOWN"; 1111 } 1112 } 1113 1114 public static byte getMappingStructure(String strval) { 1115 if (SpeedoProperties.MAPPING_STRUCTURE_DN.equals(strval)) { 1116 return JormFactoryAttributes.DO_NOTHING; 1117 } else if (SpeedoProperties.MAPPING_STRUCTURE_DD.equals(strval)) { 1118 return JormFactoryAttributes.DELETE_DATA; 1119 } else if (SpeedoProperties.MAPPING_STRUCTURE_CIR.equals(strval)) { 1120 return JormFactoryAttributes.CREATE_IF_REQUIRED; 1121 } else if (SpeedoProperties.MAPPING_STRUCTURE_FC.equals(strval)) { 1122 return JormFactoryAttributes.FORCE_CREATE; 1123 } else { 1124 return -1; 1125 } 1126 1127 } 1128 1129 public Object getConcurrencyManagerComponent() throws Exception { 1130 return getSubComponent(speedo, "tpm.concurrency-manager"); 1131 } 1132 1133 public DependencyGraph getDependencyGraph() throws Exception { 1134 Component cmC = (Component) getConcurrencyManagerComponent(); 1135 Object dg = Fractal.getBindingController(cmC).lookupFc("dependency-graph"); 1136 return (DependencyGraph) dg; 1137 } 1138 1139 public Collection getMemoryCacheEntries() throws Exception { 1140 Component cm = getSubComponent(speedo, MEMORY_CACHE_PATH); 1141 Component cmC = getSubComponent(cm, "cache-manager"); 1142 CacheAttributeController cacheAttr = (CacheAttributeController) 1143 Fractal.getAttributeController(cmC); 1144 return cacheAttr.getCurrentEntryIdentifiers(); 1145 } 1146 1147 1150 public PersistenceManager getPersistenceManager() { 1151 if (!isPropertiesInitialized) { 1152 try { 1153 Properties p = getProperties(); 1154 init(getSpeedoComponent(p), p); 1155 } catch(Throwable e) { 1156 System.err.println("Error during the initilization of the Speedo " + 1157 "persistence manager factory:"); 1158 e.printStackTrace(System.err); 1159 return null; 1160 } 1161 } 1162 1163 return delegate.getPersistenceManager(); 1164 } 1165 1166 public PersistenceManager getPersistenceManager(String s, String s1) { 1167 if (!isPropertiesInitialized) { 1168 try { 1169 Properties p = getProperties(); 1170 init(getSpeedoComponent(p), p); 1171 } catch(Throwable e) { 1172 System.err.println("Error during the initilization of the Speedo " + 1173 "persistence manager factory:"); 1174 e.printStackTrace(System.err); 1175 return null; 1176 } 1177 } 1178 return delegate.getPersistenceManager(s, s1); 1179 } 1180 1181 public void setConnectionUserName(String s) { 1182 delegate.setConnectionUserName(s); 1183 } 1184 1185 public String getConnectionUserName() { 1186 return delegate.getConnectionUserName(); 1187 } 1188 1189 public void setConnectionPassword(String s) { 1190 delegate.setConnectionPassword(s); 1191 } 1192 1193 public void setConnectionURL(String s) { 1194 delegate.setConnectionURL(s); 1195 } 1196 1197 public String getConnectionURL() { 1198 return delegate.getConnectionURL(); 1199 } 1200 1201 public void setConnectionDriverName(String s) { 1202 delegate.setConnectionDriverName(s); 1203 } 1204 1205 public String getConnectionDriverName() { 1206 return delegate.getConnectionDriverName(); 1207 } 1208 1209 public void setConnectionFactoryName(String s) { 1210 delegate.setConnectionFactoryName(s); 1211 } 1212 1213 public String getConnectionFactoryName() { 1214 return delegate.getConnectionFactoryName(); 1215 } 1216 1217 public void setConnectionFactory(Object o) { 1218 delegate.setConnectionFactory(o); 1219 } 1220 1221 public Object getConnectionFactory() { 1222 return delegate.getConnectionFactory(); 1223 } 1224 1225 public void setConnectionFactory2Name(String s) { 1226 delegate.setConnectionFactory2Name(s); 1227 } 1228 1229 public String getConnectionFactory2Name() { 1230 return delegate.getConnectionFactory2Name(); 1231 } 1232 1233 public void setConnectionFactory2(Object o) { 1234 delegate.setConnectionFactory2(o); 1235 } 1236 1237 public Object getConnectionFactory2() { 1238 return delegate.getConnectionFactory2(); 1239 } 1240 1241 public void setMultithreaded(boolean b) { 1242 delegate.setMultithreaded(b); 1243 } 1244 1245 public boolean getMultithreaded() { 1246 return delegate.getMultithreaded(); 1247 } 1248 1249 public void setOptimistic(boolean b) { 1250 delegate.setOptimistic(b); 1251 } 1252 1253 public boolean getOptimistic() { 1254 return delegate.getOptimistic(); 1255 } 1256 1257 public void setRetainValues(boolean b) { 1258 delegate.setRetainValues(b); 1259 } 1260 1261 public boolean getRetainValues() { 1262 return delegate.getRetainValues(); 1263 } 1264 1265 public void setRestoreValues(boolean b) { 1266 delegate.setRestoreValues(b); 1267 } 1268 1269 public boolean getRestoreValues() { 1270 return delegate.getRestoreValues(); 1271 } 1272 1273 public void setNontransactionalRead(boolean b) { 1274 delegate.setNontransactionalRead(b); 1275 } 1276 1277 public boolean getNontransactionalRead() { 1278 return delegate.getNontransactionalRead(); 1279 } 1280 1281 public void setNontransactionalWrite(boolean b) { 1282 delegate.setNontransactionalWrite(b); 1283 } 1284 1285 public boolean getNontransactionalWrite() { 1286 return delegate.getNontransactionalWrite(); 1287 } 1288 1289 public void setIgnoreCache(boolean b) { 1290 delegate.setIgnoreCache(b); 1291 } 1292 1293 public boolean getIgnoreCache() { 1294 return delegate.getIgnoreCache(); 1295 } 1296 1297 public Properties getProperties() { 1298 return delegate.getProperties(); 1299 } 1300 1301 public Collection supportedOptions() { 1302 return delegate.supportedOptions(); 1303 } 1304 1305 public PersistenceManagerFactory getDelegate() { 1306 return delegate; 1307 } 1308 1309 public ProxyManager lookup() { 1310 return pmfComponent.lookup(); 1311 } 1312 1313 public SequenceManager getSequenceManager() { 1314 return pmfComponent.getSequenceManager(); 1315 } 1316 1317 public void setSequenceManager(SequenceManager sequenceManager) { 1318 pmfComponent.setSequenceManager(sequenceManager); 1319 } 1320 1321 public void unbindPM() { 1322 pmfComponent.unbindPM(); 1323 } 1324 1325 public void bindPM2Thread(ProxyManager pm) { 1326 pmfComponent.bindPM2Thread(pm); 1327 } 1328 1329 public void proxyManagerClosed(ProxyManager pr) { 1330 pmfComponent.proxyManagerClosed(pr); 1331 } 1332 1333 public void close() { 1334 pmfComponent.close(); 1335 } 1336 1337 public DataStoreCache getDataStoreCache() { 1338 return pmfComponent.getDataStoreCache(); 1339 } 1340 1341 public String getMapping() { 1342 return pmfComponent.getMapping(); 1343 } 1344 1345 public boolean isClosed() { 1346 return pmfComponent.isClosed(); 1347 } 1348 1349 public void setMapping(String arg0) { 1350 pmfComponent.setMapping(arg0); 1351 } 1352 1353 public void evict(Object arg0) { 1354 pmfComponent.evict(arg0); 1355 } 1356 1357 public void evictAll() { 1358 pmfComponent.evictAll(); 1359 } 1360 1361 public void evictAll(Class arg0, boolean arg1) { 1362 pmfComponent.evictAll(arg0, arg1); 1363 } 1364 1365 public void evictAll(Collection arg0) { 1366 pmfComponent.evictAll(arg0); 1367 } 1368 1369 public void evictAll(Object [] arg0) { 1370 pmfComponent.evictAll(arg0); 1371 } 1372 public void pin(Object arg0) { 1373 pmfComponent.pin(arg0); 1374 } 1375 1376 public void pinAll(Class arg0, boolean arg1) { 1377 pmfComponent.pinAll(arg0, arg1); 1378 } 1379 1380 public void pinAll(Collection arg0) { 1381 pmfComponent.pinAll(arg0); 1382 } 1383 1384 public void pinAll(Object [] arg0) { 1385 pmfComponent.pinAll(arg0); 1386 } 1387 1388 public void unpin(Object arg0) { 1389 pmfComponent.unpin(arg0); 1390 } 1391 1392 public void unpinAll(Class arg0, boolean arg1) { 1393 pmfComponent.unpinAll(arg0, arg1); 1394 } 1395 1396 public void unpinAll(Collection arg0) { 1397 pmfComponent.unpinAll(arg0); 1398 } 1399 1400 public void unpinAll(Object [] arg0) { 1401 pmfComponent.unpinAll(arg0); 1402 } 1403 1404 public void addInstanceLifecycleListener( 1405 InstanceLifecycleListener arg0, 1406 Class [] arg1) { 1407 pmfComponent.addInstanceLifecycleListener(arg0, arg1); 1408 } 1409 public void removeInstanceLifecycleListener(InstanceLifecycleListener arg0) { 1410 pmfComponent.removeInstanceLifecycleListener(arg0); 1411 } 1412} 1413 | Popular Tags |