Changeset 2362
- Timestamp:
- 05/08/08 16:52:55 (7 months ago)
- Location:
- trunk/components
- Files:
-
- 6 modified
-
blitz/resources/omero/API.ice (modified) (2 diffs)
-
blitz/src/ome/services/blitz/util/ApiConsistencyCheck.java (modified) (11 diffs)
-
common/src/ome/api/IAdmin.java (modified) (6 diffs)
-
common/src/ome/api/RawPixelsStore.java (modified) (3 diffs)
-
server/src/ome/logic/AdminImpl.java (modified) (5 diffs)
-
server/src/ome/services/RawPixelsBean.java (modified) (30 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/components/blitz/resources/omero/API.ice
r2358 r2362 297 297 omero::model::RenderingDef createNewRenderingDef(omero::model::Pixels pixels) throws ServerError; 298 298 void resetDefaults(omero::model::RenderingDef def, omero::model::Pixels pixels) throws ServerError; 299 voidresetDefaultsNoSave(omero::model::RenderingDef def, omero::model::Pixels pixels) throws ServerError;299 omero::model::RenderingDef resetDefaultsNoSave(omero::model::RenderingDef def, omero::model::Pixels pixels) throws ServerError; 300 300 void resetDefaultsInImage(long imageId) throws ServerError; 301 301 omero::sys::LongList resetDefaultsInCategory(long categoryId) throws ServerError; … … 486 486 bool setPixelsId(long pixelsId) throws ServerError; 487 487 void setRenderingDefId(long renderingDefId) throws ServerError; 488 Ice::ByteSeq getThumbnail( int sizeX, int sizeY) throws ServerError;489 omero::sys::IdByteMap getThumbnailSet( int sizeX, int sizeY, omero::sys::LongList pixelsIds) throws ServerError;490 omero::sys::IdByteMap getThumbnailByLongestSideSet( int size, omero::sys::LongList pixelsIds) throws ServerError;491 Ice::ByteSeq getThumbnailByLongestSide( int size) throws ServerError;492 Ice::ByteSeq getThumbnailByLongestSideDirect( int size) throws ServerError;493 Ice::ByteSeq getThumbnailDirect( int sizeX, int sizeY) throws ServerError;494 Ice::ByteSeq getThumbnailForSectionDirect(int theZ, int theT, int sizeX, int sizeY) throws ServerError;495 Ice::ByteSeq getThumbnailForSectionByLongestSideDirect(int theZ, int theT, int size) throws ServerError;488 Ice::ByteSeq getThumbnail(omero::RInt sizeX, omero::RInt sizeY) throws ServerError; 489 omero::sys::IdByteMap getThumbnailSet(omero::RInt sizeX, omero::RInt sizeY, omero::sys::LongList pixelsIds) throws ServerError; 490 omero::sys::IdByteMap getThumbnailByLongestSideSet(omero::RInt size, omero::sys::LongList pixelsIds) throws ServerError; 491 Ice::ByteSeq getThumbnailByLongestSide(omero::RInt size) throws ServerError; 492 Ice::ByteSeq getThumbnailByLongestSideDirect(omero::RInt size) throws ServerError; 493 Ice::ByteSeq getThumbnailDirect(omero::RInt sizeX, omero::RInt sizeY) throws ServerError; 494 Ice::ByteSeq getThumbnailForSectionDirect(int theZ, int theT, omero::RInt sizeX, omero::RInt sizeY) throws ServerError; 495 Ice::ByteSeq getThumbnailForSectionByLongestSideDirect(int theZ, int theT, omero::RInt size) throws ServerError; 496 496 void createThumbnails() throws ServerError; 497 void createThumbnail( int sizeX, int sizeY) throws ServerError;498 bool thumbnailExists( int sizeX, int sizeY) throws ServerError;497 void createThumbnail(omero::RInt sizeX, omero::RInt sizeY) throws ServerError; 498 bool thumbnailExists(omero::RInt sizeX, omero::RInt sizeY) throws ServerError; 499 499 void resetDefaults() throws ServerError; 500 500 }; -
trunk/components/blitz/src/ome/services/blitz/util/ApiConsistencyCheck.java
r2302 r2362 6 6 import java.util.Arrays; 7 7 import java.util.Collection; 8 import java.util.Date; 8 9 import java.util.HashMap; 9 10 import java.util.List; … … 15 16 import ome.parameters.Filter; 16 17 import ome.parameters.Parameters; 18 import ome.system.EventContext; 17 19 import ome.system.Principal; 20 import ome.system.Roles; 21 import omeis.providers.re.RGBBuffer; 18 22 import omeis.providers.re.codomain.CodomainMapContext; 19 23 import omeis.providers.re.data.PlaneDef; 20 24 import omero.RInt; 25 import omero.RList; 26 import omero.RLong; 27 import omero.RObject; 21 28 import omero.RString; 29 import omero.RTime; 22 30 import omero.RType; 23 31 import omero.ServerError; … … 33 41 * @author Josh Moore, josh at glencoesoftware.com 34 42 * @since 3.0-Beta3 43 * @see <a href="http://trac.openmicroscopy.org.uk/omero/ticket/894">ticket:894</a> 35 44 */ 36 45 public class ApiConsistencyCheck implements BeanPostProcessor { … … 44 53 if (arg0 instanceof ServantDefinition) { 45 54 46 List<String> differences = new ArrayList<String>();47 48 ServantDefinition sd = (ServantDefinition) arg0;49 Class ops = sd.getOperationsClass();50 Class api = sd.getServiceClass();51 52 Method[] opsMethods = ops.getDeclaredMethods();53 Method[] apiMethods = api.getDeclaredMethods();54 55 Map<String, Method> opsMap = map(opsMethods);56 Map<String, Method> apiMap = map(apiMethods);55 final List<String> differences = new ArrayList<String>(); 56 57 final ServantDefinition sd = (ServantDefinition) arg0; 58 final Class ops = sd.getOperationsClass(); 59 final Class api = sd.getServiceClass(); 60 61 final Method[] opsMethods = ops.getDeclaredMethods(); 62 final Method[] apiMethods = api.getDeclaredMethods(); 63 64 final Map<String, Method> opsMap = map(opsMethods); 65 final Map<String, Method> apiMap = map(apiMethods); 57 66 58 67 for (String name : opsMap.keySet()) { … … 68 77 } 69 78 70 for (String name : apiMap.keySet()) { 71 Method opsMethod = opsMap.get(name); 79 for (final String name : apiMap.keySet()) { 80 81 final Method apiMethod = apiMap.get(name); 82 final Method opsMethod = opsMap.get(name); 83 72 84 if (opsMethod == null) { 73 85 differences.add("Missing method: " + name); … … 75 87 } 76 88 77 Class[] opsParams = opsMethod.getParameterTypes();78 Class[] apiParams = apiMap.get(name).getParameterTypes();89 final Class[] opsParams = opsMethod.getParameterTypes(); 90 final Class[] apiParams = apiMethod.getParameterTypes(); 79 91 80 92 // Blitz always has one more for the Ice.Current … … 86 98 continue; 87 99 } 100 101 // Check actual values 88 102 for (int i = 0; i < apiParams.length; i++) { 89 103 Class apiType = apiParams[i]; … … 91 105 if (!matches(apiType, opsType)) { 92 106 differences.add(String.format( 93 "Parameter type mismatch : %s & %s", apiType,94 opsType));107 "Parameter type mismatch in %s: %s <> %s", 108 apiMethod, apiType, opsType)); 95 109 continue; 96 110 } 97 111 } 98 112 113 // Now check the return type 114 115 Class opsReturn = opsMethod.getReturnType(); 116 Class apiReturn = apiMethod.getReturnType(); 117 118 if (!matches(apiReturn, opsReturn)) { 119 differences.add(String.format( 120 "Return type mismatch in %s: %s <> %s", apiMethod, 121 apiReturn, opsReturn)); 122 } 99 123 } 100 124 … … 127 151 */ 128 152 public static boolean matches(Class apiType, Class opsType) { 129 if (apiType == opsType) { 153 154 // Check for equality 155 if (apiType == opsType || apiType.equals(opsType)) { 130 156 return true; 131 157 } 132 158 133 if (apiType.equals(opsType)) { 134 return true; 135 } 136 137 if (apiType.equals(Long.class) && opsType.equals(long.class)) { 138 return true; 139 } 140 141 if (IObject.class.isAssignableFrom(apiType) 142 && omero.model.IObject.class.isAssignableFrom(opsType)) { 143 return true; 144 } 159 final ApiCheck check = new ApiCheck(apiType, opsType); 160 161 // 162 // Blacklist. If any of these match, we return false. 163 // 164 165 if (check.matches(Integer.class, int.class) 166 || check.matches(Long.class, long.class) 167 || check.matches(Double.class, double.class) 168 || check.matches(Float.class, float.class)) { 169 return false; 170 } 171 172 // 173 // Whitelist. If any one these match, we return true. 174 // 145 175 146 176 if (apiType.isArray() … … 150 180 } 151 181 152 if (Collection.class.isAssignableFrom(apiType) 153 && List.class.isAssignableFrom(opsType)) { 154 return true; 155 } 156 157 if (Permissions.class.isAssignableFrom(apiType) 158 && omero.model.Permissions.class.isAssignableFrom(opsType)) { 159 return true; 160 } 161 162 if (String.class.isAssignableFrom(apiType) 163 && RString.class.isAssignableFrom(opsType)) { 164 return true; 165 } 166 167 if (Integer.class.isAssignableFrom(apiType) 168 && int.class.isAssignableFrom(opsType)) { 169 return true; 170 } 171 172 if (Integer.class.isAssignableFrom(apiType) 173 && RInt.class.isAssignableFrom(opsType)) { 174 return true; 175 } 176 177 if (Class.class.isAssignableFrom(apiType) 178 && String.class.isAssignableFrom(opsType)) { 179 return true; 180 } 181 182 if (Parameters.class.isAssignableFrom(apiType) 183 && omero.sys.Parameters.class.isAssignableFrom(opsType)) { 184 return true; 185 } 186 187 if (Filter.class.isAssignableFrom(apiType) 188 && omero.sys.Filter.class.isAssignableFrom(opsType)) { 189 return true; 190 } 191 192 if (Principal.class.isAssignableFrom(apiType) 193 && omero.sys.Principal.class.isAssignableFrom(opsType)) { 194 return true; 195 } 196 197 if (PlaneDef.class.isAssignableFrom(apiType) 198 && omero.romio.PlaneDef.class.isAssignableFrom(opsType)) { 199 return true; 200 } 201 202 if (CodomainMapContext.class.isAssignableFrom(apiType) 203 && omero.romio.CodomainMapContext.class 204 .isAssignableFrom(opsType)) { 205 return true; 206 } 207 208 if (Details.class.isAssignableFrom(apiType) 209 && omero.model.Details.class.isAssignableFrom(opsType)) { 182 if (check.matches(Collection.class, List.class) 183 || check.matches(CodomainMapContext.class, 184 omero.romio.CodomainMapContext.class) 185 || check.matches(Date.class, RTime.class) 186 || check.matches(Details.class, omero.model.Details.class) 187 || check.matches(Class.class, String.class) 188 || check.matches(EventContext.class, 189 omero.sys.EventContext.class) 190 || check.matches(Filter.class, omero.sys.Filter.class) 191 || check.matches(Integer.class, RInt.class) 192 || check.matches(IObject.class, omero.model.IObject.class) 193 || check.matches(IObject.class, RObject.class) 194 || check.matches(List.class, RList.class) 195 || check.matches(Long.class, RLong.class) 196 || check.matches(Parameters.class, omero.sys.Parameters.class) 197 || check.matches(PlaneDef.class, omero.romio.PlaneDef.class) 198 || check.matches(Permissions.class, 199 omero.model.Permissions.class) 200 || check.matches(Principal.class, omero.sys.Principal.class) 201 || check.matches(RGBBuffer.class, omero.romio.RGBBuffer.class) 202 || check.matches(Roles.class, omero.sys.Roles.class) 203 || check.matches(String.class, RString.class)) { 210 204 return true; 211 205 } … … 261 255 } 262 256 } 257 258 /** 259 * Class to be used as a simple white or black list for checking consistency. To 260 * perform a white list, create an {@link ApiCheck} with the start value of 261 * false. Then 262 * 263 */ 264 class ApiCheck { 265 266 final Class apiType; 267 final Class opsType; 268 269 public ApiCheck(Class api, Class ops) { 270 this.apiType = api; 271 this.opsType = ops; 272 } 273 274 boolean matches(Class apiTest, Class opsTest) { 275 return apiTest.isAssignableFrom(apiType) 276 && opsTest.isAssignableFrom(opsType); 277 } 278 } -
trunk/components/common/src/ome/api/IAdmin.java
r2328 r2362 58 58 * if id does not exist. 59 59 */ 60 Experimenter getExperimenter(@NotNull 61 Long id); 60 Experimenter getExperimenter(long id); 62 61 63 62 /** … … 96 95 * @return Experimenter. Never null. 97 96 */ 98 String lookupLdapAuthExperimenter(@NotNull 99 Long id); 97 String lookupLdapAuthExperimenter(long id); 100 98 101 99 /** … … 109 107 * if id does not exist. 110 108 */ 111 ExperimenterGroup getGroup(@NotNull 112 Long id); 109 ExperimenterGroup getGroup(long id); 113 110 114 111 /** … … 143 140 * @return non-null array of all {@link Experimenter users} in this group. 144 141 */ 145 Experimenter[] containedExperimenters(@NotNull 146 Long groupId); 142 Experimenter[] containedExperimenters(long groupId); 147 143 148 144 /** … … 156 152 * user. 157 153 */ 158 ExperimenterGroup[] containedGroups(@NotNull 159 Long experimenterId); 154 ExperimenterGroup[] containedGroups(long experimenterId); 160 155 161 156 /** … … 168 163 * found, an exception will be thrown. 169 164 */ 170 ExperimenterGroup getDefaultGroup(@NotNull 171 Long experimenterId); 165 ExperimenterGroup getDefaultGroup(long experimenterId); 172 166 173 167 // ~ Updating users and groups -
trunk/components/common/src/ome/api/RawPixelsStore.java
r1807 r2362 13 13 14 14 // Application-internal dependencies 15 import ome.annotations.NotNull;16 15 17 16 /** … … 23 22 * Josh Moore <a 24 23 * href="mailto:josh.moore@gmx.de"> josh.moore@gmx.de</a> 25 * @version 3.0 <small> (<b>Internal version:</b> $Revision$ $Date: 26 * 2005/06/0815:21:59 $) </small>24 * @version 3.0 <small> (<b>Internal version:</b> $Revision$ $Date: 2005/06/08 25 * 15:21:59 $) </small> 27 26 * @since OME2.2 28 27 */ … … 38 37 * @see ome.io.nio.PixelBuffer#getPlaneSize() 39 38 */ 40 public IntegergetPlaneSize();39 public int getPlaneSize(); 41 40 42 public IntegergetRowSize();41 public int getRowSize(); 43 42 44 public IntegergetStackSize();43 public int getStackSize(); 45 44 46 public IntegergetTimepointSize();45 public int getTimepointSize(); 47 46 48 public IntegergetTotalSize();47 public int getTotalSize(); 49 48 50 public Long getRowOffset(@NotNull 51 Integer y, @NotNull 52 Integer z, @NotNull 53 Integer c, @NotNull 54 Integer t); 49 public long getRowOffset(int y, int z, int c, int t); 55 50 56 public Long getPlaneOffset(@NotNull 57 Integer z, @NotNull 58 Integer c, @NotNull 59 Integer t); 51 public long getPlaneOffset(int z, int c, int t); 60 52 61 public Long getStackOffset(@NotNull 62 Integer c, @NotNull 63 Integer t); 53 public long getStackOffset(int c, int t); 64 54 65 public Long getTimepointOffset(@NotNull 66 Integer t); 55 public long getTimepointOffset(int t); 67 56 68 public byte[] getRegion(@NotNull 69 Integer size, Long offset); 57 public byte[] getRegion(int size, long offset); 70 58 71 public byte[] getRow(@NotNull 72 Integer y, @NotNull 73 Integer z, @NotNull 74 Integer c, @NotNull 75 Integer t); 59 public byte[] getRow(int y, int z, int c, int t); 76 60 77 public byte[] getPlaneRegion(@NotNull 78 Integer z, @NotNull 79 Integer c, @NotNull 80 Integer t, @NotNull 81 Integer count, @NotNull 82 Integer offset); 83 84 public byte[] getPlane(@NotNull 85 Integer z, @NotNull 86 Integer c, @NotNull 87 Integer t); 61 public byte[] getPlaneRegion(int z, int c, int t, int count, int offset); 88 62 89 public byte[] getStack(@NotNull 90 Integer c, @NotNull 91 Integer t); 63 public byte[] getPlane(int z, int c, int t); 92 64 93 public byte[] getTimepoint(@NotNull 94 Integer t); 65 public byte[] getStack(int c, int t); 95 66 96 public void setRegion(@NotNull 97 Integer size, Long offset, @NotNull 98 byte[] buffer); 67 public byte[] getTimepoint(int t); 99 68 100 public void setRow(@NotNull 101 byte[] buffer, @NotNull 102 Integer y, @NotNull 103 Integer z, @NotNull 104 Integer c, @NotNull 105 Integer t); 69 public void setRegion(int size, long offset, byte[] buffer); 106 70 107 public void setPlane(@NotNull 108 byte[] buffer, @NotNull 109 Integer z, @NotNull 110 Integer c, @NotNull 111 Integer t); 71 public void setRow(byte[] buffer, int y, int z, int c, int t); 112 72 113 public void setStack(@NotNull 114 byte[] buffer, @NotNull 115 Integer z, @NotNull 116 Integer c, @NotNull 117 Integer t); 73 public void setPlane(byte[] buffer, int z, int c, int t); 118 74 119 public void set Timepoint(@NotNull120 byte[] buffer, @NotNull 121 Integert);75 public void setStack(byte[] buffer, int z, int c, int t); 76 77 public void setTimepoint(byte[] buffer, int t); 122 78 123 79 public int getByteWidth(); 124 80 125 81 public boolean isSigned(); 126 82 127 83 public boolean isFloat(); 128 84 129 85 public byte[] calculateMessageDigest(); 130 86 -
trunk/components/server/src/ome/logic/AdminImpl.java
r2326 r2362 302 302 303 303 @RolesAllowed("user") 304 public Experimenter getExperimenter(final Long id) {304 public Experimenter getExperimenter(final long id) { 305 305 Experimenter e = iQuery.execute(new UserQ(new Parameters().addId(id))); 306 306 … … 338 338 339 339 @RolesAllowed("user") 340 public String lookupLdapAuthExperimenter( Long id) {340 public String lookupLdapAuthExperimenter(long id) { 341 341 return LdapUtil.lookupLdapAuthExperimenter(jdbc, id); 342 342 } 343 343 344 344 @RolesAllowed("user") 345 public ExperimenterGroup getGroup( Long id) {345 public ExperimenterGroup getGroup(long id) { 346 346 ExperimenterGroup g = iQuery.execute(new GroupQ(new Parameters() 347 347 .addId(id))); … … 376 376 377 377 @RolesAllowed("user") 378 public Experimenter[] containedExperimenters( Long groupId) {378 public Experimenter[] containedExperimenters(long groupId) { 379 379 List<Experimenter> experimenters = iQuery.findAllByQuery( 380 380 "select e from Experimenter as e left outer " … … 386 386 387 387 @RolesAllowed("user") 388 public ExperimenterGroup[] containedGroups( Long experimenterId) {388 public ExperimenterGroup[] containedGroups(long experimenterId) { 389 389 List<ExperimenterGroup> groups = iQuery 390 390 .findAllByQuery( … … 655 655 @RolesAllowed("user") 656 656 public ExperimenterGroup getDefaultGroup(@NotNull 657 Long experimenterId) {657 long experimenterId) { 658 658 ExperimenterGroup g = iQuery.findByQuery( 659 659 "select g from ExperimenterGroup g, Experimenter e " -
trunk/components/server/src/ome/services/RawPixelsBean.java
r2305 r2362 26 26 import javax.interceptor.Interceptors; 27 27 28 // Third-party libraries29 import org.apache.commons.logging.Log;30 import org.apache.commons.logging.LogFactory;31 import org.jboss.annotation.ejb.LocalBinding;32 import org.jboss.annotation.ejb.RemoteBinding;33 import org.jboss.annotation.ejb.RemoteBindings;34 import org.springframework.transaction.annotation.Transactional;35 36 // Application-internal dependencies37 28 import ome.api.IPixels; 38 29 import ome.api.IRepositoryInfo; … … 46 37 import ome.model.core.Pixels; 47 38 import ome.services.util.OmeroAroundInvoke; 48 49 39 import omeis.providers.re.RenderingEngine; 40 41 import org.apache.commons.logging.Log; 42 import org.apache.commons.logging.LogFactory; 43 import org.jboss.annotation.ejb.LocalBinding; 44 import org.jboss.annotation.ejb.RemoteBinding; 45 import org.jboss.annotation.ejb.RemoteBindings; 46 import org.springframework.transaction.annotation.Transactional; 50 47 51 48 /** … … 53 50 * Josh Moore <a 54 51 * href="mailto:josh.moore@gmx.de"> josh.moore@gmx.de</a> 55 * @version 3.0 <small> (<b>Internal version:</b> $Revision$ $Date: 56 * 2005/07/0516:13:52 $) </small>52 * @version 3.0 <small> (<b>Internal version:</b> $Revision$ $Date: 2005/07/05 53 * 16:13:52 $) </small> 57 54 * @since OMERO3 58 55 */ … … 61 58 @Stateful 62 59 @Remote(RawPixelsStore.class) 63 @RemoteBindings({ 64 @RemoteBinding(jndiBinding = "omero/remote/ome.api.RawPixelsStore"), 65 @RemoteBinding(jndiBinding = "omero/secure/ome.api.RawPixelsStore", 66 clientBindUrl="sslsocket://0.0.0.0:3843") 67 }) 60 @RemoteBindings( { 61 @RemoteBinding(jndiBinding = "omero/remote/ome.api.RawPixelsStore"), 62 @RemoteBinding(jndiBinding = "omero/secure/ome.api.RawPixelsStore", clientBindUrl = "sslsocket://0.0.0.0:3843") }) 68 63 @Local(RenderingEngine.class) 69 64 @LocalBinding(jndiBinding = "omero/local/ome.api.RawPixelsStore") 70 65 @Interceptors( { OmeroAroundInvoke.class }) 71 public class RawPixelsBean extends AbstractStatefulBean implements RawPixelsStore { 66 public class RawPixelsBean extends AbstractStatefulBean implements 67 RawPixelsStore { 72 68 /** The logger for this particular class */ 73 69 private static Log log = LogFactory.getLog(RawPixelsBean.class); … … 76 72 77 73 private Long id; 78 74
