Module: AssMaintainer::InfoBase::ServerIb

Defined in:
lib/ass_maintainer/info_base/server_ib.rb,
lib/ass_maintainer/info_base/server_ib/enterprise_servers.rb,
lib/ass_maintainer/info_base/server_ib/enterprise_servers/cluster.rb,
lib/ass_maintainer/info_base/server_ib/enterprise_servers/support.rb,
lib/ass_maintainer/info_base/server_ib/enterprise_servers/server_agent.rb,
lib/ass_maintainer/info_base/server_ib/enterprise_servers/wp_connection.rb

Overview

Mixins for infobase deployed on 1C:Eneterprise server

Defined Under Namespace

Modules: EnterpriseServers Classes: InfoBaseWrapper, ServerBaseDestroyer, ServerBaseMaker

Instance Method Summary collapse

Instance Method Details

#exists?Object

True if infobase exists



190
191
192
# File 'lib/ass_maintainer/info_base/server_ib.rb', line 190

def exists?
  infobase_wrapper.exists?
end

#lock(from: Time.now, to: Time.now + 3600, message: '') ⇒ Object

Note:

It must work for AssMaintainer::InfoBase::ServerIb only. For FileIb it must do nothing

Locking infobase if it possible. Be careful it terminate all sessions! Before do it should set InfoBase#unlock_code! Schedule jobs will be locked to!

Raises:



147
148
149
150
151
152
153
154
155
156
# File 'lib/ass_maintainer/info_base/server_ib.rb', line 147

def lock(from: Time.now, to: Time.now + 3600, message: '')
  fail LockError, '#unlock_code is required' if unlock_code.to_s.empty?
  unlock
  wp_connection.lock_sessions!(from, to, unlock_code, message)
  lock_schjobs
  sessions.each do |sess|
    sess.terminate
  end
  nil
end

#lock_schjobsObject

Note:

It must work for AssMaintainer::InfoBase::ServerIb only. For FileIb it must do nothing

Lock schedule jobs



173
174
175
176
# File 'lib/ass_maintainer/info_base/server_ib.rb', line 173

def lock_schjobs
  wp_connection.lock_schjobs!
  nil
end

#locked?Object

Note:

For FileIb it must always return false It work for AssMaintainer::InfoBase::ServerIb only.

Return true if on server flag SessionsDenied == true



185
186
187
# File 'lib/ass_maintainer/info_base/server_ib.rb', line 185

def locked?
  wp_connection.locked?
end

#sessionsArray <InfoBase::Session>

Note:

For FileIb must returns empty array

Returns array of infobase sessions exclude AssMaintainer::InfoBase::Session::EXCLUDE_APP_IDS application types



140
141
142
143
144
# File 'lib/ass_maintainer/info_base/server_ib.rb', line 140

def sessions
  infobase_wrapper.sessions.map do |s|
    s.to_session(self) unless Session::EXCLUDE_APP_IDS.include? s.AppId
  end.compact
end

#unlockObject

Note:

It must work for AssMaintainer::InfoBase::ServerIb only. For FileIb it must do nothing

Soft unlocking infobase if it possible. For force unlocking exec ##unlock!

Raises:



159
160
161
162
163
# File 'lib/ass_maintainer/info_base/server_ib.rb', line 159

def unlock
  wp_connection.raise_unless_unlock_possable UnlockError, unlock_code
  unlock!
  nil
end

#unlock!Object

Note:

It must work for AssMaintainer::InfoBase::ServerIb only. For FileIb it must do nothing

Force unlock infobase.



166
167
168
169
170
# File 'lib/ass_maintainer/info_base/server_ib.rb', line 166

def unlock!
  wp_connection.unlock_schjobs!
  wp_connection.unlock_sessions!
  nil
end

#unlock_schjobsObject

Note:

It must work for AssMaintainer::InfoBase::ServerIb only. For FileIb it must do nothing

Unlock schedule jobs



179
180
181
182
# File 'lib/ass_maintainer/info_base/server_ib.rb', line 179

def unlock_schjobs
  wp_connection.unlock_schjobs!
  nil
end