Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register

Changeset 3385

Show
Ignore:
Timestamp:
02/14/08 15:37:53 (11 months ago)
Author:
tmdugan
Message:

-- atd, dss, chica

continuing commit because of svn error

* changed activator methods to authenticate before checking global properties

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs-modules/dss/src/org/openmrs/module/dss/DssActivator.java

    r3261 r3385  
    88import org.openmrs.api.AdministrationService; 
    99import org.openmrs.api.context.Context; 
     10import org.openmrs.api.context.ContextAuthenticationException; 
    1011import org.openmrs.module.Activator; 
    1112 
     
    3132        private void checkGlobalProperties() 
    3233        { 
    33                 AdministrationService adminService = Context.getAdministrationService(); 
    34                 Iterator<GlobalProperty> properties = adminService 
    35                                 .getGlobalProperties().iterator(); 
    36                 GlobalProperty currProperty = null; 
    37                 String currValue = null; 
    38                 String currName = null; 
     34                try 
     35                { 
     36                        AdministrationService adminService = Context.getAdministrationService(); 
     37                        Context.authenticate(adminService 
     38                                        .getGlobalProperty("scheduler.username"), adminService 
     39                                        .getGlobalProperty("scheduler.password")); 
     40                        Iterator<GlobalProperty> properties = adminService 
     41                                        .getGlobalProperties().iterator(); 
     42                        GlobalProperty currProperty = null; 
     43                        String currValue = null; 
     44                        String currName = null; 
    3945 
    40                 while (properties.hasNext()) 
    41                 { 
    42                         currProperty = properties.next(); 
    43                         currName = currProperty.getProperty(); 
    44                         if (currName.startsWith("dss")) 
     46                        while (properties.hasNext()) 
    4547                        { 
    46                                 currValue = currProperty.getPropertyValue(); 
    47                                 if (currValue == null || currValue.length() == 0) 
     48                                currProperty = properties.next(); 
     49                                currName = currProperty.getProperty(); 
     50                                if (currName.startsWith("dss")) 
    4851                                { 
    49                                         this.log.error("You must set a value for global property: " 
    50                                                         + currName); 
     52                                        currValue = currProperty.getPropertyValue(); 
     53                                        if (currValue == null || currValue.length() == 0) 
     54                                        { 
     55                                                this.log.error("You must set a value for global property: " 
     56                                                                + currName); 
     57                                        } 
    5158                                } 
    5259                        } 
     60                } catch (ContextAuthenticationException e) 
     61                { 
     62                        this.log.error("Error checking global properties for dss module"); 
     63 
    5364                } 
    5465        }