Table of Contents
VClientConnection
Inherits from | NSObjectController |
Represents object | Valenina, VConnection. |
Declared in | V4CC_VClientConnection.h |
Overview
VClientConnection Controller - provides access to the content of Valentina's server.
It manages two Valentina's classes - Valentina & VConnection. When you use VClientConnection Controller - it will make two steps:
- Init Valentina Client;
- Init VConnection in Client mode;
To get a connection to Valentina Server you should specify connections parameters. By default, VClientConnection connects to the 'localhost' with username 'sa' and password 'sa'.
To connect to a remote VServer - select 'Web' in the pop-up menu and specify needed parameters.
Tasks
Construction Methods
-initWithHost:userName:password:
-initWithHost:userName:password:port:
-initWithHost:userName:password:port:timeout:
-initWithHost:userName:password:port:timeout:options:
Init Connection Method
Properties
-localConnection
-setLocalConnection:
-currentConnectionMethod
-setCurrentConnectionMethod:
Class Methods
Init Methods
- (id)initWithHost:(NSString*)inHost userName:(NSString*)inUserName password:(NSString*)inUserPassword; - (id)initWithHost:(NSString*)inHost userName:(NSString*)inUserName password:(NSString*)inUserPassword port:(int)inPort; - (id)initWithHost:(NSString*)inHost userName:(NSString*)inUserName password:(NSString*)inUserPassword port:(int)inPort timeout:(int)inTimeOut; - (id)initWithHost:(NSString*)inHost userName:(NSString*)inUserName password:(NSString*)inUserPassword port:(int)inPort timeout:(int)inTimeOut options:(NSString*)inOptions;
This is a group of methods of initialization of VClientConnection properties. VClientConnection has properties, which are responsible for the connection type:
- host - host name where the Valentina Server was installed;
- userName - user name for connection to Valentina Server;
- userPassword - user password;
- port - port number;
- timeOut - time out;
- options - options parameters for connection.
host, userName and userPassword - this is obligatory parameters.
port, timeOut and options - options parameters.
To init properties - you can use one of the init methods in dependence of needed connection type. (For more info look VConnection )
dealock
Releases VClientConnection properties
- (void)dealloc;
initConnection
Initializes a client VConnection instance.
- (void)initConnection;
Discussion
VClientConnection contains two objects - Valentina instance and VConnection. This method consistently initializes Valentina instance and VConnection with given properties.
Be attentive: you should invoke this method after the properties have been initialized.
localConnection
Accessors for local connection property.
- (id)localConnection;
- (void)setLocalConnection:(VLocalConnection*)inVLocalConnection;
Discussion
If your application uses two types of connections - local and client, you should specify VLocalConnection using this method.
connection
Accessors for connection property.
- (VConnection*)connection;
- (void)setConnection:(VConnection*)inConnection;
Provides access to VConnection property controller.
Return Value
Returns a VConnection class object.
connectionMethods
Provides names of connection types for IBPlugin.
- (NSArray*)connectionMethods;
Return Value
Returns array of two strings - Localhost,Web.
currentConnectionMethod
Accessors for current connection property.
- (int) currentConnectionMethod;
- (void)setCurrentConnectionMethod:(int)inConnectMethod;
Discussion
If you set current connection method - 0 connection will be established to the localhost with username 'sa' and password 'sa'. If you set current connection method - 1, connection parameters will be empty and you will have to init them before connections init.
This method is used in IBPlugin. We do not advise you to use them programmatically. Use one of the Init Methods for init connection properties.
host
Accessors for the host property.
- (NSString*)host;
- (void)setHost:(NSString*)inHostName;
You can get, or set, the host name for the current connection.
userName
Accessors for the userName property.
- (NSString*)userName;
- (void)setUserName:(NSString*)inUserName;
You can get, or set, userName for the current connection.
userPassword
Accessors for the userPassword property.
- (NSString*)userPassword;
- (void)setUserPassword:(NSString*)inUserPassword;
You can get, or set, userPassword for the current connection.
port
Accessors for the port property.
- (int)port;
- (void)setPort:(int)inTimeOut;
You can get, or set, a port for the current connection.
timeOut
Accessors for the timeOut property.
- (int)timeOut;
- (void)setTimeOut:(int)inTimeOut;
You can get, or set, timeOut for the current connection.
options
Accessors for the options property.
- (NSString*)options;
- (void)setOptions:(NSString*)inOptions;
You can get, or set, options for the current connection.
Code Example
VClientConnection* myClientConnection; myClientConnection = [[VLocalConnection alloc] initWithHost:@"localhost" userName:@"sa" password:@"sa"]; [myClientConnection initConnection];