Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java @ 313:ddc35c950e97
Backend: Handle forgotten store/create event source.
artifacts/trunk@2440 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 01 Aug 2011 15:43:44 +0000 |
parents | 1d517e051e95 |
children | 1eb7863136f4 |
comparison
equal
deleted
inserted
replaced
312:fa056f9c8a0c | 313:ddc35c950e97 |
---|---|
460 * @param bootstrap The parameters to start this artifact database. | 460 * @param bootstrap The parameters to start this artifact database. |
461 * @param backend The storage backend. | 461 * @param backend The storage backend. |
462 */ | 462 */ |
463 public ArtifactDatabaseImpl(FactoryBootstrap bootstrap, Backend backend) { | 463 public ArtifactDatabaseImpl(FactoryBootstrap bootstrap, Backend backend) { |
464 | 464 |
465 logger.debug("new ArtifactDatabaseImpl"); | |
466 | |
465 backgroundIds = new HashSet<Integer>(); | 467 backgroundIds = new HashSet<Integer>(); |
466 | 468 |
467 setupArtifactCollectionFactory(bootstrap); | 469 setupArtifactCollectionFactory(bootstrap); |
468 setupArtifactFactories(bootstrap); | 470 setupArtifactFactories(bootstrap); |
469 setupServices(bootstrap); | 471 setupServices(bootstrap); |
475 context = bootstrap.getContext(); | 477 context = bootstrap.getContext(); |
476 context.put(GLOBAL_CONTEXT_KEY, this); | 478 context.put(GLOBAL_CONTEXT_KEY, this); |
477 | 479 |
478 exportSecret = bootstrap.getExportSecret(); | 480 exportSecret = bootstrap.getExportSecret(); |
479 | 481 |
480 wireWithBackend(backend); | 482 wireWithBackend(backend, bootstrap); |
481 | |
482 setupBackendListeners(bootstrap); | |
483 } | 483 } |
484 | 484 |
485 public CallContext.Listener getCallContextListener() { | 485 public CallContext.Listener getCallContextListener() { |
486 return callContextListener; | 486 return callContextListener; |
487 } | 487 } |
549 setPostFeedHook(bootstrap.getPostFeedHooks()); | 549 setPostFeedHook(bootstrap.getPostFeedHooks()); |
550 setPostAdvanceHook(bootstrap.getPostAdvanceHooks()); | 550 setPostAdvanceHook(bootstrap.getPostAdvanceHooks()); |
551 } | 551 } |
552 | 552 |
553 protected void setupBackendListeners(FactoryBootstrap bootstrap) { | 553 protected void setupBackendListeners(FactoryBootstrap bootstrap) { |
554 logger.debug("setupBackendListeners"); | |
554 List<BackendListener> bls = bootstrap.getBackendListeners(); | 555 List<BackendListener> bls = bootstrap.getBackendListeners(); |
555 if (bls != null) { | 556 if (bls != null && !bls.isEmpty()) { |
556 for (BackendListener listener: bls) { | 557 for (BackendListener listener: bls) { |
557 listener.setup(context); | 558 listener.setup(context); |
558 } | 559 } |
559 backend.addAllListeners(bls); | 560 backend.addAllListeners(bls); |
560 } | 561 } |
607 * Wires a storage backend to this artifact database and | 608 * Wires a storage backend to this artifact database and |
608 * establishes a callback to be able to revive artifacts | 609 * establishes a callback to be able to revive artifacts |
609 * via the serializers of this artifact factories. | 610 * via the serializers of this artifact factories. |
610 * @param backend The backend to be wired with this artifact database. | 611 * @param backend The backend to be wired with this artifact database. |
611 */ | 612 */ |
612 public void wireWithBackend(Backend backend) { | 613 public void wireWithBackend(Backend backend, FactoryBootstrap bootstrap) { |
614 logger.debug("wireWithBackend"); | |
613 if (backend != null) { | 615 if (backend != null) { |
614 this.backend = backend; | 616 this.backend = backend; |
615 backend.setFactoryLookup(this); | 617 backend.setFactoryLookup(this); |
618 setupBackendListeners(bootstrap); | |
616 } | 619 } |
617 } | 620 } |
618 | 621 |
619 /** | 622 /** |
620 * Called after an backgrounded artifact signals its | 623 * Called after an backgrounded artifact signals its |