public String getHostAddress() { if (_id != null && _id.getDistributedMember() != null) return _id.getDistributedMember().getHost(); return null; }
/** * Returns this <code>ClientProxyMembershipID</code>'s durable attributes. * * @return this <code>ClientProxyMembershipID</code>'s durable attributes * * @since GemFire 5.5 */ protected DurableClientAttributes getDurableAttributes() { return getDistributedMember().getDurableClientAttributes(); }
public Version getClientVersion() { return ((InternalDistributedMember) getDistributedMember()).getVersionObject(); }
InternalDistributedMember getDistributedMember(ServerConnection serverConnection) { return (InternalDistributedMember) serverConnection.getProxyID().getDistributedMember(); }
public AuthorizeRequest(String authzFactoryName, ClientProxyMembershipID id, Principal principal, Cache cache) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, NotAuthorizedException { this(authzFactoryName, id.getDistributedMember(), principal, cache); this.id = id; if (this.logger.infoEnabled()) { this.logger.info( String.format("AuthorizeRequest: Client[%s] is setting authorization callback to %s.", new Object[] {id, authzFactoryName})); } }
/** * Returns whether this <code>ClientProxyMembershipID</code> is durable. * * @return whether this <code>ClientProxyMembershipID</code> is durable * * @since GemFire 5.5 */ public boolean isDurable() { String durableClientId = getDistributedMember().getDurableClientAttributes().getId(); return durableClientId != null && !(durableClientId.length() == 0); }
private String getMemberIdAsString() { String memberIdAsString = null; InternalDistributedMember idm = (InternalDistributedMember) getDistributedMember(); if (getClientVersion().compareTo(Version.GFE_90) < 0) { memberIdAsString = idm.toString(); } else { StringBuilder sb = new StringBuilder(); idm.addFixedToString(sb); memberIdAsString = sb.toString(); } return memberIdAsString; }
private void sendCredentialsForWan(OutputStream out, InputStream in) { try { Properties wanCredentials = getCredentials(this.id.getDistributedMember()); DataOutputStream dos = new DataOutputStream(out); DataInputStream dis = new DataInputStream(in); writeCredentials(dos, dis, wanCredentials, false, this.system.getDistributedMember()); } // The exception while getting the credentials is just logged as severe catch (Exception e) { this.system.getSecurityLogWriter().severe( String.format("An exception was thrown while sending wan credentials: %s", e.getLocalizedMessage())); } }
@Override public String toString() { if (this.identity != null && ((InternalDistributedMember) getDistributedMember()).getPort() == 0) { return this.toStringNoCache(); } if (this._toString == null) { this._toString = this.toStringNoCache(); } return this._toString; }
public String getDSMembership() { if (identity == null) { // some unit tests create IDs that have no real identity, so return null return "null"; } // don't cache if we haven't connected to the server yet if (((InternalDistributedMember) getDistributedMember()).getPort() == 0) { return getMemberIdAsString(); } if (memberIdString == null) { memberIdString = getMemberIdAsString(); } return memberIdString; }
/** * expire the transaction states for the given client. This uses the transactionTimeToLive setting * that is inherited from the TXManagerImpl. If that setting is non-positive we expire the states * immediately * */ private void expireTXStates(ClientProxyMembershipID proxyID) { final TXManagerImpl txMgr = (TXManagerImpl) this._cache.getCacheTransactionManager(); final Set<TXId> txIds = txMgr.getTransactionsForClient((InternalDistributedMember) proxyID.getDistributedMember()); if (this._cache.isClosed()) { return; } if (!txIds.isEmpty()) { txMgr.expireDisconnectedClientTransactions(txIds, true); } }
public Object verifyCredentials() throws AuthenticationRequiredException, AuthenticationFailedException { String methodName = this.system.getProperties().getProperty(SECURITY_CLIENT_AUTHENTICATOR); return verifyCredentials(methodName, this.credentials, this.system.getSecurityProperties(), (InternalLogWriter) this.system.getLogWriter(), (InternalLogWriter) this.system.getSecurityLogWriter(), this.id.getDistributedMember(), this.securityService); }
public AuthorizeRequestPP(String postAuthzFactoryName, ClientProxyMembershipID id, Principal principal, Cache cache) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException { this.id = id; this.principal = principal; if (this.principal instanceof Serializable) { this.isPrincipalSerializable = true; } else { this.isPrincipalSerializable = false; } this.logger = cache.getSecurityLogger(); Method postAuthzMethod = ClassLoadUtil.methodFromName(postAuthzFactoryName); this.postAuthzCallback = (AccessControl) postAuthzMethod.invoke(null, (Object[]) null); this.postAuthzCallback.init(principal, id.getDistributedMember(), cache); if (this.logger.infoEnabled()) { this.logger.info( String.format( "AuthorizeRequestPP: Setting post process authorization callback to %s for client[%s].", new Object[] {id, postAuthzFactoryName})); } }
public void basicBridgeDestroyRegion(Object callbackArg, final ClientProxyMembershipID client, boolean fromClient, EventID eventId) throws TimeoutException, EntryExistsException, CacheWriterException { if (fromClient) { // If this region is also wan-enabled, then wrap that callback arg in a // GatewayEventCallbackArgument to store the event id. if (isGatewaySenderEnabled()) { callbackArg = new GatewaySenderEventCallbackArgument(callbackArg); } } RegionEventImpl event = new ClientRegionEventImpl(this, Operation.REGION_DESTROY, callbackArg, false, client.getDistributedMember(), client, eventId); basicDestroyRegion(event, true); }
public void basicBridgeClear(Object callbackArg, final ClientProxyMembershipID client, boolean fromClient, EventID eventId) throws TimeoutException, EntryExistsException, CacheWriterException { if (fromClient) { // If this region is also wan-enabled, then wrap that callback arg in a // GatewayEventCallbackArgument to store the event id. if (isGatewaySenderEnabled()) { callbackArg = new GatewaySenderEventCallbackArgument(callbackArg); } } RegionEventImpl event = new ClientRegionEventImpl(this, Operation.REGION_CLEAR, callbackArg, false, client.getDistributedMember(), client, eventId); basicClear(event, true); }
/** * Convert a ClientProxyMembershipID distribted member ID array into one usable by EventIDs * * @param client the client's ID * @return a byte array that may be used in EventID formation */ public static byte[] getMembershipId(ClientProxyMembershipID client) { try { HeapDataOutputStream hdos = new HeapDataOutputStream(256, client.getClientVersion()); ((InternalDistributedMember) client.getDistributedMember()).writeEssentialData(hdos); return hdos.toByteArray(); } catch (IOException ioe) { throw new InternalGemFireException( "Unable to serialize identity", ioe); } }
protected static void writeCommitResponse(TXCommitMessage response, Message origMsg, ServerConnection servConn) throws IOException { Message responseMsg = servConn.getResponseMessage(); responseMsg.setMessageType(MessageType.RESPONSE); responseMsg.setTransactionId(origMsg.getTransactionId()); responseMsg.setNumberOfParts(1); if (response != null) { response.setClientVersion(servConn.getClientVersion()); } responseMsg.addObjPart(response, false); servConn.getCache().getCancelCriterion().checkCancelInProgress(null); if (logger.isDebugEnabled()) { logger.debug("TX: sending a nonNull response for transaction: {}", new TXId((InternalDistributedMember) servConn.getProxyID().getDistributedMember(), origMsg.getTransactionId())); } responseMsg.send(servConn); origMsg.clearParts(); }
public void basicBridgeUpdateVersionStamp(Object key, Object callbackArg, ClientProxyMembershipID memberId, boolean fromClient, EntryEventImpl clientEvent) { // Create an event and update version stamp of the entry @Released EntryEventImpl event = EntryEventImpl.create(this, Operation.UPDATE_VERSION_STAMP, key, null, null, false, memberId.getDistributedMember(), false, clientEvent.getEventId()); event.setContext(memberId); // if this is a replayed operation we may already have a version tag event.setVersionTag(clientEvent.getVersionTag()); try { basicUpdateEntryVersion(event); } finally { clientEvent.setVersionTag(event.getVersionTag()); clientEvent.isConcurrencyConflict(event.isConcurrencyConflict()); event.release(); } }
public void basicBridgeRemove(Object key, Object expectedOldValue, Object callbackArg, ClientProxyMembershipID memberId, boolean fromClient, EntryEventImpl clientEvent) throws TimeoutException, EntryNotFoundException, CacheWriterException { if (fromClient) { // If this region is also wan-enabled, then wrap that callback arg in a // GatewayEventCallbackArgument to store the event id. if (isGatewaySenderEnabled()) { callbackArg = new GatewaySenderEventCallbackArgument(callbackArg); } } // Create an event and put the entry @Released final EntryEventImpl event = EntryEventImpl.create(this, Operation.REMOVE, key, null, callbackArg, false, memberId.getDistributedMember(), true, clientEvent.getEventId()); try { event.setContext(memberId); // we rely on exceptions to tell us that the operation didn't take // place. AbstractRegionMap performs the checks and throws the exception try { basicDestroy(event, true, expectedOldValue); } finally { clientEvent.setVersionTag(event.getVersionTag()); clientEvent.setIsRedestroyedEntry(event.getIsRedestroyedEntry()); } } finally { event.release(); } }
public void basicBridgeInvalidate(Object key, Object callbackArg, ClientProxyMembershipID memberId, boolean fromClient, EntryEventImpl clientEvent) throws TimeoutException, EntryNotFoundException, CacheWriterException { Object theCallbackArg = callbackArg; if (fromClient) { // If this region is also wan-enabled, then wrap that callback arg in a // GatewayEventCallbackArgument to store the event id. if (isGatewaySenderEnabled()) { theCallbackArg = new GatewaySenderEventCallbackArgument(theCallbackArg); } } // Create an event and put the entry @Released final EntryEventImpl event = EntryEventImpl.create(this, Operation.INVALIDATE, key, null, theCallbackArg, false, memberId.getDistributedMember(), true, clientEvent.getEventId()); try { event.setContext(memberId); // if this is a replayed operation we may already have a version tag event.setVersionTag(clientEvent.getVersionTag()); try { basicInvalidate(event); } finally { clientEvent.setVersionTag(event.getVersionTag()); clientEvent.isConcurrencyConflict(event.isConcurrencyConflict()); } } finally { event.release(); } }