MemberMappedArgument extractMemberMappedArgument(Part part) throws IOException, ClassNotFoundException { MemberMappedArgument memberMappedArg = null; if (part != null) { Object obj = part.getObject(); if (obj instanceof MemberMappedArgument) { memberMappedArg = (MemberMappedArgument) obj; } } return memberMappedArg; }
public byte[] getSecureBytes() throws IOException, ClassNotFoundException { return (byte[]) this.securePart.getObject(); }
public Object getObject() throws IOException, ClassNotFoundException { return getObject(false); }
@Override protected Object getOptionalCallbackArg(Message msg) throws ClassNotFoundException, IOException { Part callbackPart = msg.getPart(5); return callbackPart.getObject(); }
@Override protected String[] getGroups(Message msg) throws IOException, ClassNotFoundException { String[] groups = null; Part messagePart = msg.getPart(4); if (messagePart != null) { groups = (String[]) messagePart.getObject(); } return groups; }
public Object getStringOrObject() throws IOException, ClassNotFoundException { if (isObject()) { return getObject(); } else { return getString(); } }
@Override protected void processAck(Message msg, String opName) throws Exception { final int msgType = msg.getMessageType(); if (msgType == MessageType.REPLY) { return; } else { Part part = msg.getPart(0); if (msgType == MessageType.EXCEPTION) { Throwable t = (Throwable) part.getObject(); if (t instanceof CommitConflictException || t instanceof SynchronizationCommitConflictException) { throw (GemFireException) t; } } super.processAck(msg, opName); } }
@Override protected Object processResponse(Message msg) throws Exception { final int msgType = msg.getMessageType(); if (msgType == MessageType.REPLY) { return null; } else { Part part = msg.getPart(0); if (msgType == MessageType.EXCEPTION) { Throwable t = (Throwable) part.getObject(); logger.warn("Function execution without result encountered an Exception on server.", t); } else if (isErrorResponse(msgType)) { logger.warn("Function execution without result encountered an Exception on server."); } else { throw new InternalGemFireError( "Unexpected message type " + MessageType.getString(msgType)); } return null; } }
protected static Operation getOperation(final Part operationPart, final Operation defaultOperation) throws Exception { if (operationPart.isBytes()) { final byte[] bytes = operationPart.getSerializedForm(); if (null == bytes || 0 == bytes.length) { // older clients can send empty bytes for default operation. return defaultOperation; } else { return Operation.fromOrdinal(bytes[0]); } } // Fallback for older clients. final Operation operation = (Operation) operationPart.getObject(); if (operation == null) { // native clients may send a null since the op is java-serialized. return defaultOperation; } return operation; }
@Override protected Object processResponse(Message msg) throws Exception { final int msgType = msg.getMessageType(); if (msgType == MessageType.REPLY) { return null; } else { Part part = msg.getPart(0); if (msgType == MessageType.EXCEPTION) { Throwable t = (Throwable) part.getObject(); logger.warn("Function execution without result encountered an Exception on server.", t); } else if (isErrorResponse(msgType)) { logger.warn("Function execution without result encountered an Exception on server."); } else { throw new InternalGemFireError( "Unexpected message type " + MessageType.getString(msgType)); } return null; } }
@Override protected Object processResponse(Message msg) throws Exception { Part part = msg.getPart(0); int msgType = msg.getMessageType(); if (msgType == MessageType.RESPONSE) { return (Map<Integer, PdxType>) part.getObject(); } else { if (msgType == MessageType.EXCEPTION) { String s = "While performing a remote " + "getPdxTypes"; throw new ServerOperationException(s, (Throwable) part.getObject()); } else if (isErrorResponse(msgType)) { throw new ServerOperationException(part.getString()); } else { throw new InternalGemFireError( "Unexpected message type " + MessageType.getString(msgType)); } } }
@Override protected Object processResponse(Message msg) throws Exception { Part part = msg.getPart(0); final int msgType = msg.getMessageType(); if (msgType == MessageType.REPLY) { return part.getObject(); } else if (msgType == MessageType.EXCEPTION) { String s = "While performing a remote proxy cache close"; throw new ServerOperationException(s, (Throwable) part.getObject()); // Get the exception toString part. // This was added for c++ thin client and not used in java } else if (isErrorResponse(msgType)) { throw new ServerOperationException(part.getString()); } else { throw new InternalGemFireError("Unexpected message type " + MessageType.getString(msgType)); } }
@Override protected Object processResponse(Message msg) throws Exception { Part part = msg.getPart(0); int msgType = msg.getMessageType(); if (msgType == MessageType.RESPONSE) { return (Map<Integer, EnumInfo>) part.getObject(); } else { if (msgType == MessageType.EXCEPTION) { String s = "While performing a remote " + "getPdxEnums"; throw new ServerOperationException(s, (Throwable) part.getObject()); } else if (isErrorResponse(msgType)) { throw new ServerOperationException(part.getString()); } else { throw new InternalGemFireError( "Unexpected message type " + MessageType.getString(msgType)); } } }
@Before public void setUp() throws Exception { this.getAll = new GetAll(); MockitoAnnotations.initMocks(this); when(this.authzRequest.getAuthorize(any(), any(), any())) .thenReturn(mock(GetOperationContext.class)); when(this.cache.getRegion(isA(String.class))).thenReturn(mock(LocalRegion.class)); when(this.cache.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); when(this.keyPart.getObject()).thenReturn(KEYS); when(this.message.getPart(eq(0))).thenReturn(this.regionNamePart); when(this.message.getPart(eq(1))).thenReturn(this.keyPart); when(this.regionNamePart.getString()).thenReturn(REGION_NAME); when(this.serverConnection.getCache()).thenReturn(this.cache); when(this.serverConnection.getCacheServerStats()).thenReturn(mock(CacheServerStats.class)); when(this.serverConnection.getAuthzRequest()).thenReturn(this.authzRequest); when(this.serverConnection.getCachedRegionHelper()).thenReturn(mock(CachedRegionHelper.class)); when(this.serverConnection.getChunkedResponseMessage()).thenReturn(this.chunkedResponseMessage); }
@Before public void setUp() throws Exception { this.getAll651 = new GetAll651(); MockitoAnnotations.initMocks(this); when(this.authzRequest.getAuthorize(any(), any(), any())) .thenReturn(mock(GetOperationContext.class)); when(this.cache.getRegion(isA(String.class))).thenReturn(mock(LocalRegion.class)); when(this.cache.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); when(this.keyPart.getObject()).thenReturn(KEYS); when(this.message.getPart(eq(0))).thenReturn(this.regionNamePart); when(this.message.getPart(eq(1))).thenReturn(this.keyPart); when(this.regionNamePart.getString()).thenReturn(REGION_NAME); when(this.serverConnection.getCache()).thenReturn(this.cache); when(this.serverConnection.getCacheServerStats()).thenReturn(mock(CacheServerStats.class)); when(this.serverConnection.getAuthzRequest()).thenReturn(this.authzRequest); when(this.serverConnection.getCachedRegionHelper()).thenReturn(mock(CachedRegionHelper.class)); when(this.serverConnection.getChunkedResponseMessage()).thenReturn(this.chunkedResponseMessage); }
@Before public void setUp() throws Exception { this.getAll70 = new GetAll70(); MockitoAnnotations.initMocks(this); when(this.authzRequest.getAuthorize(any(), any(), any())) .thenReturn(mock(GetOperationContext.class)); when(this.cache.getRegion(isA(String.class))).thenReturn(this.region); when(this.keyPart.getObject()).thenReturn(KEYS); when(this.message.getPart(eq(0))).thenReturn(this.regionNamePart); when(this.message.getPart(eq(1))).thenReturn(this.keyPart); when(this.message.getPart(eq(2))).thenReturn(this.requestSerializableValuesPart); when(this.region.getAttributes()).thenReturn(this.regionAttributes); when(this.regionAttributes.getConcurrencyChecksEnabled()).thenReturn(true); when(this.regionNamePart.getString()).thenReturn(REGION_NAME); when(this.requestSerializableValuesPart.getInt()).thenReturn(0); when(this.serverConnection.getCache()).thenReturn(this.cache); when(this.serverConnection.getAuthzRequest()).thenReturn(this.authzRequest); when(this.serverConnection.getChunkedResponseMessage()).thenReturn(this.chunkedResponseMessage); }
@Before public void setUp() throws Exception { this.getAll70 = new GetAll70(); MockitoAnnotations.initMocks(this); when(this.authzRequest.getAuthorize(any(), any(), any())) .thenReturn(mock(GetOperationContext.class)); when(this.cache.getRegion(isA(String.class))).thenReturn(this.region); when(this.cache.getCancelCriterion()).thenReturn(mock(CancelCriterion.class)); when(this.keyPart.getObject()).thenReturn(KEYS); when(this.message.getPart(eq(0))).thenReturn(this.regionNamePart); when(this.message.getPart(eq(1))).thenReturn(this.keyPart); when(this.message.getPart(eq(2))).thenReturn(this.requestSerializableValuesPart); when(this.region.getAttributes()).thenReturn(this.regionAttributes); when(this.regionAttributes.getConcurrencyChecksEnabled()).thenReturn(true); when(this.regionNamePart.getString()).thenReturn(REGION_NAME); when(this.requestSerializableValuesPart.getInt()).thenReturn(0); when(this.serverConnection.getCache()).thenReturn(this.cache); when(this.serverConnection.getCacheServerStats()).thenReturn(mock(CacheServerStats.class)); when(this.serverConnection.getAuthzRequest()).thenReturn(this.authzRequest); when(this.serverConnection.getCachedRegionHelper()).thenReturn(mock(CachedRegionHelper.class)); when(this.serverConnection.getChunkedResponseMessage()).thenReturn(this.chunkedResponseMessage); }
@Override protected Object processResponse(Message msg) throws Exception { Part part = msg.getPart(0); final int msgType = msg.getMessageType(); if (msgType == MessageType.RESPONSE) { return Integer.valueOf(part.getInt()); } else { if (msgType == MessageType.EXCEPTION) { String s = "While performing a remote " + "getPdxIdForType"; throw new ServerOperationException(s, (Throwable) part.getObject()); // Get the exception toString part. // This was added for c++ thin client and not used in java } else if (isErrorResponse(msgType)) { throw new ServerOperationException(part.getString()); } else { throw new InternalGemFireError( "Unexpected message type " + MessageType.getString(msgType)); } } }
@Override protected Object processResponse(Message msg) throws Exception { Part part = msg.getPart(0); final int msgType = msg.getMessageType(); if (msgType == MessageType.RESPONSE) { return Integer.valueOf(part.getInt()); } else { if (msgType == MessageType.EXCEPTION) { String s = "While performing a remote " + "getPdxIdForEnum"; throw new ServerOperationException(s, (Throwable) part.getObject()); // Get the exception toString part. // This was added for c++ thin client and not used in java } else if (isErrorResponse(msgType)) { throw new ServerOperationException(part.getString()); } else { throw new InternalGemFireError( "Unexpected message type " + MessageType.getString(msgType)); } } }
@Override public void handle(ChunkedMessage cm) throws Exception { Part part = cm.getPart(0); try { Object o = part.getObject(); if (o instanceof Throwable) { String s = "While performing a remote getAll"; exceptionRef[0] = new ServerOperationException(s, (Throwable) o); } else { VersionedObjectList chunk = (VersionedObjectList) o; chunk.replaceNullIDs(con.getEndpoint().getMemberId()); result.addAll(chunk); } } catch (Exception e) { exceptionRef[0] = new ServerOperationException("Unable to deserialize value", e); } } });