/** * Returns the marshaled context representing the state of all shared contexts. * * @return A ContextItems object representing the current state of all shared contexts. */ public ContextItems getMarshaledContext() { ContextItems marshaledContext = new ContextItems(); for (IManagedContext<?> managedContext : managedContexts) { marshaledContext.addItems(managedContext.getContextItems(false)); } return marshaledContext; }
/** * Returns the marshaled context representing the state of all shared contexts. * * @return A ContextItems object representing the current state of all shared contexts. */ public ContextItems getMarshaledContext() { ContextItems marshaledContext = new ContextItems(); for (IManagedContext managedContext : managedContexts) { marshaledContext.addItems(managedContext.getContextItems(false)); } return marshaledContext; }
/** * Unmarshals the marshaled context. Performs digital signature verification, then returns the * unmarshaled context items. * * @param marshaledContext Marshaled context * @param authSignature If set, the digital signature is verified. * @return The unmarshaled context. * @throws Exception Unspecified exception. */ public ContextItems unmarshal(String marshaledContext, String authSignature) throws Exception { ContextItems contextItems = new ContextItems(); contextItems.addItems(marshaledContext); String whichKey = contextItems.getItem(PROPNAME_KEY); String timestamp = contextItems.getItem(PROPNAME_TIME); if (authSignature != null && !signer.verify(authSignature, marshaledContext, timestamp, whichKey)) { throw new MarshalException("Invalid digital signature"); } return contextItems; } }
/** * Unmarshals the marshaled context. Performs digital signature verification, then returns the * unmarshaled context items. * * @param marshaledContext Marshaled context * @param authSignature If set, the digital signature is verified. * @return The unmarshaled context. * @throws Exception Unspecified exception. */ public ContextItems unmarshal(String marshaledContext, String authSignature) throws Exception { ContextItems contextItems = new ContextItems(); contextItems.addItems(marshaledContext); String whichKey = contextItems.getItem(PROPNAME_KEY); String timestamp = contextItems.getItem(PROPNAME_TIME); if (authSignature != null && !signer.verify(authSignature, marshaledContext, timestamp, whichKey)) { throw new MarshalException("Invalid digital signature"); } return contextItems; } }