Module: AssMaintainer::InfoBase::ServerIb::EnterpriseServers::ServerAgent Private

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Object descrbed 1C server agent connection.

Examples:

# Get 1C:Eneterprise server agent connection object and connect
# to net service
sagent = ServerAgent.new('localhost:1540', 'admin', 'password')
  .connect('~> 8.3.8.0')

# Working with server agent connection
sagent.ConnectionString #=> "tcp://localhost:1540"
cl = sagent.cluster_find 'localhost', '1542'

# Close connection
sagent.disconnect

Instance Attribute Summary

Attributes included from AssMaintainer::InfoBase::ServerIb::EnterpriseServers::Support::ServerConnection

#host, #password, #port, #user

Class Method Summary collapse

Instance Method Summary collapse

Methods included from AssMaintainer::InfoBase::ServerIb::EnterpriseServers::Support::OleRuntime

#_connect, #connected?, #disconnect, runtime_new

Methods included from AssMaintainer::InfoBase::ServerIb::EnterpriseServers::Support::ServerConnection

#eql?, #host_port, #initialize, #ping?, #tcp_ping

Class Method Details

.new(host_port, user, password) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Make new object of anonymous class which included this module.



26
27
28
29
30
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/server_agent.rb', line 26

def self.new(host_port, user, password)
  Class.new do
    include ServerAgent
  end.new host_port, user, password
end

Instance Method Details

#authenticateObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Authenticate AssMaintainer::InfoBase::ServerIb::EnterpriseServers::Support::ServerConnection#user

Raises:

  • if not connected



53
54
55
56
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/server_agent.rb', line 53

def authenticate
  AuthenticateAgent(user.to_s, password.to_s) if\
    connected? && !authenticate?
end

#authenticate?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

True if #AssMaintainer::InfoBase::ServerIb::EnterpriseServers::Support::ServerConnection#user authenticate

Returns:

  • (Boolean)


59
60
61
62
63
64
65
66
67
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/server_agent.rb', line 59

def authenticate?
  return false unless connected?
  begin
    ole_connector.GetAgentAdmins
  rescue WIN32OLERuntimeError
    return false
  end
  true
end

#cluster_find(host, port) ⇒ nil WIN32OLE

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns IClusterInfo ole object.

Returns:

  • (nil WIN32OLE)

    IClusterInfo ole object

Raises:

  • if not connected



71
72
73
74
75
76
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/server_agent.rb', line 71

def cluster_find(host, port)
  reconnect
  GetClusters().find do |cl|
    cl.HostName.upcase == host.upcase && cl.MainPort == port.to_i
  end
end

#connect(platform_require) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

while connecting in instance class will be included

Connect to 1C:Eneterprise server via OLE AssMaintainer::InfoBase::ServerIb::EnterpriseServers::Support::OleRuntime.runtime_new module 1C:Eneterprise version required

Parameters:

  • platform_require (String Gem::Requirement)

Returns:

  • self



47
48
49
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/server_agent.rb', line 47

def connect(platform_require)
  _connect(host_port, platform_require)
end

#default_portString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns wrapper for DEFAULT_SAGENT_PORT.

Returns:



33
34
35
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/server_agent.rb', line 33

def default_port
  InfoBase::DEFAULT_SAGENT_PORT
end

#platform_requireObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



78
79
80
81
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/server_agent.rb', line 78

def platform_require
  return unless connected?
  ole_connector.send(:__ole_binary__).requirement.to_s
end

#runtime_typeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



37
38
39
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/server_agent.rb', line 37

def runtime_type
  :agent
end