root/trunk/components/common/src/ome/api/IConfig.java
| Revision 2477, 5.1 kB (checked in by jmoore, 5 months ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | /* |
| 2 | * ome.api.IConfig |
| 3 | * |
| 4 | * Copyright 2006 University of Dundee. All rights reserved. |
| 5 | * Use is subject to license terms supplied in LICENSE.txt |
| 6 | */ |
| 7 | |
| 8 | package ome.api; |
| 9 | |
| 10 | // Java imports |
| 11 | import java.util.Date; |
| 12 | |
| 13 | import ome.annotations.NotNull; |
| 14 | import ome.annotations.RevisionDate; |
| 15 | import ome.annotations.RevisionNumber; |
| 16 | import ome.conditions.ApiUsageException; |
| 17 | import ome.conditions.InternalException; |
| 18 | import ome.conditions.SecurityViolation; |
| 19 | |
| 20 | /** |
| 21 | * Access to server configuration. These methods provide access to the state and |
| 22 | * configuration of the server and its components (e.g. the database). However, |
| 23 | * it should not be assumed that two subsequent calls to a proxy for this |
| 24 | * service will go to the same server due to clustering. |
| 25 | * |
| 26 | * Not all possible server configuration is available through this API. Some |
| 27 | * values (such as DB connection info, ports, etc.) must naturally be set before |
| 28 | * this service is accessible. |
| 29 | * |
| 30 | * Also used as the main developer example for developing (stateless) ome.api |
| 31 | * interfaces. See source code documentation for more. |
| 32 | * |
| 33 | * @author Josh Moore, josh.moore at gmx.de |
| 34 | * @version $Revision$, $Date$ |
| 35 | * @since 3.0-M3 |
| 36 | */ |
| 37 | /* |
| 38 | * Developer notes: The two annotations below are activated by setting |
| 39 | * subversion properties on this class file. These values can then be accessed |
| 40 | * via ome.system.Version |
| 41 | */ |
| 42 | @RevisionDate("$Date$") |
| 43 | @RevisionNumber("$Revision$") |
| 44 | public interface IConfig extends ServiceInterface { |
| 45 | |
| 46 | /* |
| 47 | * Developer notes: Simple almost hello-world call. There should be almost |
| 48 | * nothing that causes this to throw an exception (except perhaps a Java |
| 49 | * security policy file which disallows "new Date()"). Therefore we don't |
| 50 | * add a throws clause here. Anything that is thrown will be wrapped in an |
| 51 | * InternalException see |
| 52 | * http://trac.openmicroscopy.org.uk/omero/wiki/ExceptionHandling |
| 53 | */ |
| 54 | /** |
| 55 | * checks the current server for it's time. This value may be variant |
| 56 | * depending on whether the service is clustered or not. |
| 57 | * |
| 58 | * @return Non-null {@link Date} representation of the server's own time. |
| 59 | */ |
| 60 | Date getServerTime(); |
| 61 | |
| 62 | /* |
| 63 | * Developer notes: This call hits the database through JDBC (not our own |
| 64 | * Hibernate infrastructure) and therefore it is more likely that an |
| 65 | * exception can occur. An InternalException will also be thrown (though |
| 66 | * this may change as more exceptions are created). We mark it here for |
| 67 | * general consumption; readers of the API will want to know why. |
| 68 | */ |
| 69 | /** |
| 70 | * checks the database for it's time using a SELECT statement. |
| 71 | * |
| 72 | * @return Non-null {@link Date} representation of the database's time. |
| 73 | * @throws InternalException |
| 74 | * though any call can throw an InternalException it is more |
| 75 | * likely that this can occur while contacting the DB. An |
| 76 | * exception here most likely means (A) a temporary issue with |
| 77 | * the DB or (B) a SQL dialect issue which must be corrected by |
| 78 | * the Omero team. |
| 79 | */ |
| 80 | Date getDatabaseTime() throws InternalException; |
| 81 | |
| 82 | /* |
| 83 | * Developer notes: The @NotNull annotation on the key parameter will cause |
| 84 | * all managed method calls on any implementation of this interface to be |
| 85 | * checked by ome.annotations.ApiConstraintChecker. This is done before any |
| 86 | * access to the Hibernate session is performed and so balances its own |
| 87 | * overhead somewhat. |
| 88 | */ |
| 89 | /** |
| 90 | * retrieve a configuration value from the backend store. Permissions |
| 91 | * applied to the configuration value may cause a {@link SecurityViolation} |
| 92 | * to be thrown. |
| 93 | * |
| 94 | * @param key |
| 95 | * The non-null name of the desired configuration value |
| 96 | * @return The {@link String} value linked to this key, possibly null if not |
| 97 | * set. |
| 98 | * @throws ApiUsageException |
| 99 | * if the key is null or invalid. |
| 100 | * @throws SecurityViolation |
| 101 | * if the value for the key is not readable. |
| 102 | */ |
| 103 | String getConfigValue(@NotNull |
| 104 | String key) throws ApiUsageException, SecurityViolation; |
| 105 | |
| 106 | /** |
| 107 | * set a configuration value in the backend store. Permissions applied to |
| 108 | * the configuration value may cause a {@link SecurityViolation} to be |
| 109 | * thrown. |
| 110 | * |
| 111 | * @param key |
| 112 | * The non-null name of the desired configuration value |
| 113 | * @param value |
| 114 | * The {@link String} value to assign to the given key. |
| 115 | * @throws ApiUsageException |
| 116 | * if the key or value is null or invalid. |
| 117 | * @throws SecurityViolation |
| 118 | * if the value is not writable. |
| 119 | */ |
| 120 | void setConfigValue(@NotNull |
| 121 | String key, @NotNull |
| 122 | String value) throws ApiUsageException, SecurityViolation; |
| 123 | |
| 124 | /** |
| 125 | * Provides the hard-coded server version string from |
| 126 | * {@link ome.system.Version}. OMERO-internal values will be in the form |
| 127 | * MAJOR.MINOR[.PATCH][-SUFFIX] where a typical value might be "3.0-RC1" or |
| 128 | * "3.1.1-Beta2". |
| 129 | * |
| 130 | * Customized values should begin with a alphabetic sequence followed by a |
| 131 | * hyphen: ACME-0.0.1 |
| 132 | */ |
| 133 | String getVersion(); |
| 134 | } |
Note: See TracBrowser
for help on using the browser.
