public Object Invoke(Object proxy, MethodInfo method, Object[] args) { //don't proxy toString, hashCode, or equals if (method.DeclaringType.Equals(typeof(object))) { return(method.Invoke(this, args)); } //partition arguments into arguments that can //be simply marshalled as part of the request and //those that are response handlers IList <Object> simpleMarshallArgs = CollectionUtil.NewList(args); ObjectStreamHandler streamHandlerArg = ExtractStreamHandler(ReflectionUtil.GetParameterTypes(method), simpleMarshallArgs); //build the request object RemoteConnectorInfoImpl connectorInfo = (RemoteConnectorInfoImpl)_configuration.ConnectorInfo; RemoteFrameworkConnectionInfo connectionInfo = connectorInfo.RemoteConnectionInfo; OperationRequest request = new OperationRequest( connectorInfo.ConnectorKey, _configuration, _operation, method.Name, simpleMarshallArgs); //create the connection RemoteFrameworkConnection connection = new RemoteFrameworkConnection(connectionInfo); try { connection.WriteObject(CultureInfo.CurrentUICulture); connection.WriteObject(connectionInfo.Key); //send the request connection.WriteObject(request); //now process each response stream (if any) if (streamHandlerArg != null) { HandleStreamResponse(connection, streamHandlerArg); } //finally return the actual return value OperationResponsePart response = (OperationResponsePart)connection.ReadObject(); if (response.Exception != null) { throw response.Exception; } return(response.Result); } finally { connection.Dispose(); } }
public RemoteOperationInvocationHandler(RemoteConnectorInfoImpl connectorInfo, String connectorFacadeKey, SafeType <APIOperation> operation) { _connectorInfo = connectorInfo; _connectorFacadeKey = connectorFacadeKey; _operation = operation; }
public void TestRemoteConnectorInfo() { RemoteConnectorInfoImpl v1 = new RemoteConnectorInfoImpl(); v1.Messages = (new ConnectorMessagesImpl()); v1.ConnectorKey = (new ConnectorKey("my bundle", "my version", "my connector")); ConfigurationPropertiesImpl configProperties = new ConfigurationPropertiesImpl(); configProperties.Properties = (new List<ConfigurationPropertyImpl>()); APIConfigurationImpl apiImpl = new APIConfigurationImpl(); apiImpl.ConfigurationProperties = (configProperties); v1.DefaultAPIConfiguration = (apiImpl); v1.ConnectorDisplayNameKey = ("mykey"); v1.ConnectorCategoryKey = ("LDAP"); RemoteConnectorInfoImpl v2 = (RemoteConnectorInfoImpl) CloneObject(v1); Assert.IsNotNull(v2.Messages); Assert.AreEqual("my bundle", v2.ConnectorKey.BundleName); Assert.AreEqual("my version", v2.ConnectorKey.BundleVersion); Assert.AreEqual("my connector", v2.ConnectorKey.ConnectorName); Assert.AreEqual("mykey", v2.ConnectorDisplayNameKey); Assert.AreEqual("LDAP", v2.ConnectorCategoryKey); Assert.IsNotNull(v2.DefaultAPIConfiguration); }
public void TestHelloResponse() { Exception ex = new Exception("foo"); IDictionary<string,object> serverInfo = new Dictionary<string, object>(1); serverInfo.Add(HelloResponse.SERVER_START_TIME, DateTimeUtil.GetCurrentUtcTimeMillis()); ConnectorKey key = new ConnectorKey("my bundle", "my version", "my connector"); RemoteConnectorInfoImpl info = new RemoteConnectorInfoImpl(); info.Messages = (new ConnectorMessagesImpl()); info.ConnectorKey = (key); ConfigurationPropertiesImpl configProperties = new ConfigurationPropertiesImpl(); configProperties.Properties = (new List<ConfigurationPropertyImpl>()); APIConfigurationImpl apiImpl = new APIConfigurationImpl(); apiImpl.ConfigurationProperties = (configProperties); info.DefaultAPIConfiguration = (apiImpl); info.ConnectorDisplayNameKey = ("mykey"); info.ConnectorCategoryKey = (""); HelloResponse v1 = new HelloResponse(ex, serverInfo, CollectionUtil.NewReadOnlyList<ConnectorKey>(key), CollectionUtil.NewReadOnlyList<RemoteConnectorInfoImpl>(info)); HelloResponse v2 = (HelloResponse)CloneObject(v1); Assert.IsNotNull(v2.Exception); Assert.IsNotNull(v2.ServerInfo[HelloResponse.SERVER_START_TIME]); Assert.IsNotNull(v2.ConnectorKeys.First()); Assert.IsNotNull(v2.ConnectorInfos.First()); }
public RemoteConnectorFacadeImpl(RemoteConnectorInfoImpl connectorInfo, string configuration) : base(configuration, connectorInfo) { remoteConnectorFacadeKey = GenerateRemoteConnectorFacadeKey(GetAPIConfiguration()); }
public RemoteOperationInvocationHandler(RemoteConnectorInfoImpl connectorInfo, String connectorFacadeKey, SafeType<APIOperation> operation) { _connectorInfo = connectorInfo; _connectorFacadeKey = connectorFacadeKey; _operation = operation; }
public void TestHelloResponse() { RemoteConnectorInfoImpl info = new RemoteConnectorInfoImpl(); info.Messages = (new ConnectorMessagesImpl()); info.ConnectorKey = (new ConnectorKey("my bundle", "my version", "my connector")); ConfigurationPropertiesImpl configProperties = new ConfigurationPropertiesImpl(); configProperties.Properties = (new List<ConfigurationPropertyImpl>()); APIConfigurationImpl apiImpl = new APIConfigurationImpl(); apiImpl.ConfigurationProperties = (configProperties); info.DefaultAPIConfiguration = (apiImpl); info.ConnectorDisplayNameKey = ("mykey"); Exception ex = new Exception("foo"); HelloResponse v1 = new HelloResponse(ex, CollectionUtil.NewReadOnlyList<RemoteConnectorInfoImpl>(info)); HelloResponse v2 = (HelloResponse)CloneObject(v1); Assert.IsNotNull(v2.Exception); Assert.IsNotNull(v2.ConnectorInfos.First()); }
public RemoteConnectorFacadeImpl(RemoteConnectorInfoImpl connectorInfo, String config, IConfigurationPropertyChangeListener changeListener) : this(connectorInfo, config) { GetAPIConfiguration().ChangeListener = changeListener; }