<commit_before>import random
import sys
import traceback

wlsUser    = '<%= @weblogic_user %>'  
password   = sys.argv[1] 
machine    = '<%= @adminserver_address %>'
portNumber = '<%= @adminserver_port %>'
                                
eisName                     = '<%= @adapter_entry %>'
cfName                      = '<%= @adapter_entry_value %>'
propertyName                = '<%= @adapter_entry_property %>'
connectionFactoryInterface  = '<%= @connectionFactoryInterface %>'

appName                     = '<%= @adapter_name %>'
appPath                     = '<%= @adapter_path %>'
planPath                    = '<%= @adapter_plan_dir %>/<%= @adapter_plan %>'

useStoreConfig = '<%= @useStoreConfig %>'
 
moduleOverrideName=appName + '.rar'
moduleDescriptorName='META-INF/weblogic-ra.xml'
connectionInstance='ConnectionInstance_' + eisName

def makeDeploymentPlanVariable(wlstPlan, name, value, xpath, origin='planbased'):
 
    while wlstPlan.getVariableAssignment(name, moduleOverrideName, moduleDescriptorName):
        wlstPlan.destroyVariableAssignment(name, moduleOverrideName, moduleDescriptorName)
    
    while wlstPlan.getVariable(name):
        wlstPlan.destroyVariable(name)
    
    variableAssignment = wlstPlan.createVariableAssignment( name, moduleOverrideName, moduleDescriptorName )
    variableAssignment.setXpath( xpath )
    variableAssignment.setOrigin( origin )
    wlstPlan.createVariable( name, value )
 
def main():
    edit()
    try:
      startEdit()

      myPlan=loadApplication(appPath, planPath)

      print '___ BEGIN change plan'
      makeDeploymentPlanVariable(myPlan, connectionInstance, eisName, '/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="' + connectionFactoryInterface + '"]/connection-instance/[jndi-name="' + eisName + '"]/jndi-name')
      myPlan.save();

      pList = propertyName.split(';')
      vList = cfName.split(';')
      if len(pList) == len(vList):
        i = 0
        for p in pList:
          configProperty='ConfigProperty_' + p + '_'+eisName
          configPropertyValue=vList[i]
          makeDeploymentPlanVariable(myPlan, configProperty, configPropertyValue, '/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="' + connectionFactoryInterface + '"]/connection-instance/[jndi-name="' + eisName + '"]/connection-properties/properties/property/[name="' + p + '"]/value')
          myPlan.save();
          i += 1
        print '___ DONE change plan'
        save();
        activate(block='true');
      else:
        print 'ERROR: The amount of properties and values are not correct.'
        stopEdit('y')
    except:
      apply(traceback.print_exception, sys.exc_info())
      stopEdit('y')
<commit_msg>Allow escaping the semicolon in the properties of a resource adapter.<commit_after>import random
import sys
import traceback

wlsUser    = '<%= @weblogic_user %>'  
password   = sys.argv[1] 
machine    = '<%= @adminserver_address %>'
portNumber = '<%= @adminserver_port %>'
                                
eisName                     = '<%= @adapter_entry %>'
cfName                      = '<%= @adapter_entry_value %>'
propertyName                = '<%= @adapter_entry_property %>'
connectionFactoryInterface  = '<%= @connectionFactoryInterface %>'

appName                     = '<%= @adapter_name %>'
appPath                     = '<%= @adapter_path %>'
planPath                    = '<%= @adapter_plan_dir %>/<%= @adapter_plan %>'

useStoreConfig = '<%= @useStoreConfig %>'
 
moduleOverrideName=appName + '.rar'
moduleDescriptorName='META-INF/weblogic-ra.xml'
connectionInstance='ConnectionInstance_' + eisName

def makeDeploymentPlanVariable(wlstPlan, name, value, xpath, origin='planbased'):
 
    while wlstPlan.getVariableAssignment(name, moduleOverrideName, moduleDescriptorName):
        wlstPlan.destroyVariableAssignment(name, moduleOverrideName, moduleDescriptorName)
    
    while wlstPlan.getVariable(name):
        wlstPlan.destroyVariable(name)
    
    variableAssignment = wlstPlan.createVariableAssignment( name, moduleOverrideName, moduleDescriptorName )
    variableAssignment.setXpath( xpath )
    variableAssignment.setOrigin( origin )
    wlstPlan.createVariable( name, value )
 
def main():
    edit()
    try:
      startEdit()

      myPlan=loadApplication(appPath, planPath)

      print '___ BEGIN change plan'
      makeDeploymentPlanVariable(myPlan, connectionInstance, eisName, '/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="' + connectionFactoryInterface + '"]/connection-instance/[jndi-name="' + eisName + '"]/jndi-name')
      myPlan.save();

      pList = propertyName.split(';')

      encodedValues = cfName.replace('\;','#') # Replace escaped semicolons for a dash
      encodedList = encodedValues.split(';')

      vList = []
      for valueString in encodedList:
        vList.append(valueString.replace('#', ';'))

      if len(pList) == len(vList):
        i = 0
        for p in pList:
          configProperty='ConfigProperty_' + p + '_'+eisName
          configPropertyValue=vList[i]
          makeDeploymentPlanVariable(myPlan, configProperty, configPropertyValue, '/weblogic-connector/outbound-resource-adapter/connection-definition-group/[connection-factory-interface="' + connectionFactoryInterface + '"]/connection-instance/[jndi-name="' + eisName + '"]/connection-properties/properties/property/[name="' + p + '"]/value')
          myPlan.save();
          i += 1
        print '___ DONE change plan'
        save();
        activate(block='true');
      else:
        print 'ERROR: The amount of properties and values are not correct.'
        stopEdit('y')
    except:
      apply(traceback.print_exception, sys.exc_info())
      stopEdit('y')

{'fraction_non_alphanumeric': 0.12824453551912568, 'fraction_numerical': 0.0010245901639344263, 'mean_word_length': 3.201578192252511, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2493466', 'n_tokens_mistral': 1692, 'n_tokens_neox': 1626, 'n_words': 298}