Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java @ 293:a367a0d011af
Set an interface for the global context; added a method to the artifact database to return an instance of an Artifact.
artifacts/trunk@2331 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 14 Jul 2011 14:22:23 +0000 |
parents | 39c0ff00d188 |
children | b530e83acf2e |
comparison
equal
deleted
inserted
replaced
292:39c0ff00d188 | 293:a367a0d011af |
---|---|
21 import de.intevation.artifacts.ArtifactNamespaceContext; | 21 import de.intevation.artifacts.ArtifactNamespaceContext; |
22 import de.intevation.artifacts.ArtifactSerializer; | 22 import de.intevation.artifacts.ArtifactSerializer; |
23 import de.intevation.artifacts.CallContext; | 23 import de.intevation.artifacts.CallContext; |
24 import de.intevation.artifacts.CallMeta; | 24 import de.intevation.artifacts.CallMeta; |
25 import de.intevation.artifacts.CollectionItem; | 25 import de.intevation.artifacts.CollectionItem; |
26 import de.intevation.artifacts.GlobalContext; | |
26 import de.intevation.artifacts.Hook; | 27 import de.intevation.artifacts.Hook; |
27 import de.intevation.artifacts.Service; | 28 import de.intevation.artifacts.Service; |
28 import de.intevation.artifacts.ServiceFactory; | 29 import de.intevation.artifacts.ServiceFactory; |
29 import de.intevation.artifacts.User; | 30 import de.intevation.artifacts.User; |
30 import de.intevation.artifacts.UserFactory; | 31 import de.intevation.artifacts.UserFactory; |
65 DatabaseCleaner.LockedIdsProvider, | 66 DatabaseCleaner.LockedIdsProvider, |
66 Backend.FactoryLookup | 67 Backend.FactoryLookup |
67 { | 68 { |
68 private static Logger logger = | 69 private static Logger logger = |
69 Logger.getLogger(ArtifactDatabaseImpl.class); | 70 Logger.getLogger(ArtifactDatabaseImpl.class); |
71 | |
72 /** The key under which the artifact database is stored in the global | |
73 * context.*/ | |
74 public static final String GLOBAL_CONTEXT_KEY = "global.artifact.database"; | |
70 | 75 |
71 /** Message that is returned if an operation was successful.*/ | 76 /** Message that is returned if an operation was successful.*/ |
72 public static final String OPERATION_SUCCESSFUL = | 77 public static final String OPERATION_SUCCESSFUL = |
73 "SUCCESS"; | 78 "SUCCESS"; |
74 | 79 |
401 */ | 406 */ |
402 protected Backend backend; | 407 protected Backend backend; |
403 /** | 408 /** |
404 * Reference of the global context of the artifact runtime system. | 409 * Reference of the global context of the artifact runtime system. |
405 */ | 410 */ |
406 protected Object context; | 411 protected GlobalContext context; |
407 | 412 |
408 /** | 413 /** |
409 * The signing secret to be used for ex-/importing artifacts. | 414 * The signing secret to be used for ex-/importing artifacts. |
410 */ | 415 */ |
411 protected byte [] exportSecret; | 416 protected byte [] exportSecret; |
461 setupServices(bootstrap); | 466 setupServices(bootstrap); |
462 setupUserFactory(bootstrap); | 467 setupUserFactory(bootstrap); |
463 setupCallContextListener(bootstrap); | 468 setupCallContextListener(bootstrap); |
464 setupHooks(bootstrap); | 469 setupHooks(bootstrap); |
465 | 470 |
466 context = bootstrap.getContext(); | 471 context = bootstrap.getContext(); |
472 context.put(GLOBAL_CONTEXT_KEY, this); | |
473 | |
467 exportSecret = bootstrap.getExportSecret(); | 474 exportSecret = bootstrap.getExportSecret(); |
468 | 475 |
469 wireWithBackend(backend); | 476 wireWithBackend(backend); |
470 } | 477 } |
471 | 478 |
711 finally { | 718 finally { |
712 cc.postCall(); | 719 cc.postCall(); |
713 } | 720 } |
714 } | 721 } |
715 | 722 |
723 | |
724 public Artifact getRawArtifact(String identifier) | |
725 throws ArtifactDatabaseException | |
726 { | |
727 PersistentArtifact artifact = backend.getArtifact(identifier); | |
728 | |
729 if (artifact == null) { | |
730 throw new ArtifactDatabaseException(NO_SUCH_ARTIFACT); | |
731 } | |
732 | |
733 return artifact.getArtifact(); | |
734 } | |
735 | |
736 | |
716 public Document describe( | 737 public Document describe( |
717 String identifier, | 738 String identifier, |
718 Document data, | 739 Document data, |
719 CallMeta callMeta | 740 CallMeta callMeta |
720 ) | 741 ) |