Class: Appscript::Application

Inherits:
Reference show all
Defined in:
lib/rb-scpt.rb

Overview

APPLICATION

Constant Summary

Constants inherited from Reference

Reference::DefaultConsiderations, Reference::DefaultConsidersAndIgnores, Reference::IgnoreEnums

Constants inherited from AS_SafeObject

AS_SafeObject::EXCLUDE

Instance Attribute Summary

Attributes inherited from Reference

#AS_aem_reference, #AS_app_data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Reference

#==, #ID, #[], _pack_uint32, #_resolve_range_boundary, #_send_command, #after, #and, #any, #before, #beginning, #begins_with, #commands, #contains, #does_not_begin_with, #does_not_contain, #does_not_end_with, #elements, #end, #ends_with, #eq, #first, #ge, #gt, #hash, #help, #is_in, #is_not_in, #is_running?, #keywords, #last, #le, #lt, #method_missing, #methods, #middle, #ne, #next, #not, #or, #parameters, #previous, #properties, #respond_to?, #to_s

Methods inherited from AS_SafeObject

hide

Constructor Details

#initialize(constructor, identifier, terms) ⇒ Application

Returns a new instance of Application.



846
847
848
# File 'lib/rb-scpt.rb', line 846

def initialize(constructor, identifier, terms)
  super(AppData.new(_aem_application_class, constructor, identifier, terms), AEM.app)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Appscript::Reference

Class Method Details

.by_aem_app(aem_app, terms = true) ⇒ Object



872
873
874
# File 'lib/rb-scpt.rb', line 872

def Application.by_aem_app(aem_app, terms=true)
  return new(:by_aem_app, aem_app, terms)
end

.by_creator(creator, terms = true) ⇒ Object



860
861
862
# File 'lib/rb-scpt.rb', line 860

def Application.by_creator(creator, terms=true)
  return new(:by_path, FindApp.by_creator(creator), terms)
end

.by_id(id, terms = true) ⇒ Object



856
857
858
# File 'lib/rb-scpt.rb', line 856

def Application.by_id(id, terms=true)
  return new(:by_path, FindApp.by_id(id), terms)
end

.by_name(name, terms = true) ⇒ Object

constructors



852
853
854
# File 'lib/rb-scpt.rb', line 852

def Application.by_name(name, terms=true)
  return new(:by_path, FindApp.by_name(name), terms)
end

.by_pid(pid, terms = true) ⇒ Object



864
865
866
# File 'lib/rb-scpt.rb', line 864

def Application.by_pid(pid, terms=true)
  return new(:by_pid, pid, terms)
end

.by_url(url, terms = true) ⇒ Object



868
869
870
# File 'lib/rb-scpt.rb', line 868

def Application.by_url(url, terms=true)
  return new(:by_url, url, terms)
end

.current(terms = true) ⇒ Object



876
877
878
# File 'lib/rb-scpt.rb', line 876

def Application.current(terms=true)
  return new(:current, nil, terms)
end

Instance Method Details

#_aem_application_classObject

hook



842
843
844
# File 'lib/rb-scpt.rb', line 842

def _aem_application_class # hook
  return AEM::Application
end

#abort_transactionObject



898
899
900
# File 'lib/rb-scpt.rb', line 898

def abort_transaction
  @AS_app_data.target.abort_transaction
end

#AS_new_reference(ref) ⇒ Object



882
883
884
885
886
887
888
889
890
891
892
# File 'lib/rb-scpt.rb', line 882

def AS_new_reference(ref)
  if ref.is_a?(Appscript::GenericReference)
    return ref.AS_resolve(@AS_app_data)
  elsif ref.is_a?(AEMReference::Query)
    return Reference.new(@AS_app_data, ref)
  elsif ref == nil
    return  Reference.new(@AS_app_data, AEM.app)
  else
    return Reference.new(@AS_app_data, AEM.custom_root(ref))
  end
end

#begin_transaction(session = nil) ⇒ Object



894
895
896
# File 'lib/rb-scpt.rb', line 894

def begin_transaction(session=nil)
  @AS_app_data.target.begin_transaction(session)
end

#end_transactionObject



902
903
904
# File 'lib/rb-scpt.rb', line 902

def end_transaction
  @AS_app_data.target.end_transaction
end

#launchObject



906
907
908
909
910
911
912
913
914
915
916
917
# File 'lib/rb-scpt.rb', line 906

def launch
  if @AS_app_data.constructor == :by_path
    AEM::Application.launch(@AS_app_data.identifier)
    @AS_app_data.target.reconnect
  else
    begin
      @AS_app_data.target.event('ascrnoop').send # will send launch event to app if already running; else will error
    rescue AEM::EventError => e
      raise if e.to_i != -1708
    end
  end
end