Module: PuppetX::EnterpriseModules::Oracle::JavaSourceHandling
- Defined in:
- lib/puppet_x/enterprisemodules/oracle/java_source_handling.rb
Overview
The JavaSourceHandling module provides methods to manage and process Java source definitions within an Oracle database. It includes functionality to retrieve, process, and describe changes to Java source definitions, as well as to check for compilation errors.
This module is designed to be used within Puppet manifests to ensure that Java source definitions are correctly managed and maintained in the Oracle database.
Instance Method Summary collapse
- 
  
    
      #change_to_s(currentvalue, _newvalue)  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    Returns a string representation of the change based on the current value. 
- #compilation_errors ⇒ Object
- 
  
    
      #current_content  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    Retrieves the current content of the Java source definition from the database. 
- 
  
    
      #process_content(content)  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    Processes the content by removing unnecessary elements and formatting it for comparison. 
Instance Method Details
#change_to_s(currentvalue, _newvalue) ⇒ String
Returns a string representation of the change based on the current value.
| 31 32 33 34 35 36 37 | # File 'lib/puppet_x/enterprisemodules/oracle/java_source_handling.rb', line 31 def change_to_s(currentvalue, _newvalue) if currentvalue.to_s == 'absent' 'created java source definition' else 'changed to new java source definition' end end | 
#compilation_errors ⇒ Object
| 52 53 54 55 | # File 'lib/puppet_x/enterprisemodules/oracle/java_source_handling.rb', line 52 def compilation_errors results = sql template('ora_config/ora_java_source/java_source_errors.sql.erb', binding), :sid => resource.sid results.first['ERRORS'].to_i end | 
#current_content ⇒ String
Retrieves the current content of the Java source definition from the database.
| 22 23 24 | # File 'lib/puppet_x/enterprisemodules/oracle/java_source_handling.rb', line 22 def current_content @current_content ||= process_content(sql(template('ora_config/ora_java_source/java_source_definition.sql.erb', binding), :sid => resource.sid, :parse => false)) end | 
#process_content(content) ⇒ String
Processes the content by removing unnecessary elements and formatting it for comparison.
| 43 44 45 46 47 48 49 50 | # File 'lib/puppet_x/enterprisemodules/oracle/java_source_handling.rb', line 43 def process_content(content) content.gsub(/CREATE(\s|\n)+OR(\s|\n)+REPLACE(\s|\n)+AND(\s|\n)+RESOLVE(\s|\n)+JAVA(\s|\n)+SOURCE(\s|\n)+NAMED.*AS(\s|\n)+/mi, ''). gsub(/1\* SELECT text as content FROM all_source WHERE name.*/, ''). gsub(/--.*\n/, ''). gsub(%r{^/\s*$}, ''). gsub(/\s|\s|"|'/, ''). delete("\n").upcase end |