Changeset 2511

Show
Ignore:
Timestamp:
10/09/08 11:48:38 (3 months ago)
Author:
jimse
Message:

Made HelloWorld? allow for the endpoint to be overridden on the command line

Location:
trunk/otis
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/otis/samples/HelloWorld.java

    r2509 r2511  
    55import org.bandit.otis.api.IAuthSession; 
    66import org.bandit.otis.impl.AuthSessionManager; 
     7import org.bandit.otis.utils.Constants; 
    78import org.eclipse.higgins.configuration.xml.ConfigurationHandler; 
    89import org.eclipse.higgins.idas.api.IAttribute; 
     
    2324        protected IAuthSession service; 
    2425 
    25         public HelloWorld() throws Exception 
     26        public HelloWorld( 
     27                String[] args) throws Exception 
    2628        { 
    2729                String settingFileName = "otis-config.client.remote.xml"; 
     
    3638                        System.out.println("failed to get config of: settingFileDir" + settingFileName); 
    3739                } 
    38  
     40                 
    3941                manager = new AuthSessionManager(settings); 
    4042                service = manager.getAuthSession(); 
     43 
     44                if (args.length > 0)  
     45                {                        
     46                        System.out.println("Resetting endpoint to " + args[0]); 
     47                        service.setComponentSetting(Constants.OTIS_ENDPOINT_SETTING, args[0]); 
     48                } 
     49 
    4150        } 
    4251 
     
    4958                try 
    5059                { 
    51                         HelloWorld hw = new HelloWorld(); 
     60                        HelloWorld hw = new HelloWorld(args); 
    5261                         
    5362                        hw.loginAsAnon(); 
  • trunk/otis/src/org/bandit/otis/impl/IEndPoint.java

    r2471 r2511  
    5454        public void throwError( 
    5555                IEndPointResponse response) throws AuthSessionException; 
     56 
     57        public void setEndpoint( 
     58                String endpointURI); 
    5659} 
  • trunk/otis/src/org/bandit/otis/impl/RemoteAuthSession.java

    r2497 r2511  
    4242import org.eclipse.higgins.idas.api.ITypedValue; 
    4343import org.eclipse.higgins.idas.api.IdASException; 
     44import org.eclipse.higgins.idas.api.UnhandledExtensionException; 
    4445import org.eclipse.higgins.idas.registry.IdASRegistry; 
    4546import org.eclipse.higgins.util.xml.DomFuncs; 
     
    11301131                Object arg1) throws IdASException 
    11311132        { 
    1132                 throw new UnsupportedOperationException(); 
     1133                setComponentSetting(arg0, arg1, false); 
    11331134        } 
    11341135 
    11351136        public void setComponentSetting( 
    1136                 String arg0, 
    1137                 Object arg1, 
    1138                 boolean arg2) throws IdASException 
    1139         { 
    1140                 throw new UnsupportedOperationException(); 
     1137                String key, 
     1138                Object val, 
     1139                boolean bCritical) throws IdASException 
     1140        { 
     1141                if (key == Constants.OTIS_ENDPOINT_SETTING) 
     1142                { 
     1143                        m_endPoint.setEndpoint((String)val); 
     1144                        return; 
     1145                } 
     1146                if (bCritical == true) 
     1147                { 
     1148                        throw new UnhandledExtensionException(); 
     1149                } 
    11411150        } 
    11421151         
  • trunk/otis/src/org/bandit/otis/impl/RemoteEndPointClient.java

    r2471 r2511  
    392392        } /* end private class RemoteEndPointClientResponse */ 
    393393 
     394        public void setEndpoint( 
     395                String endpointURI) 
     396        { 
     397                m_endPoint = endpointURI; 
     398                m_settings.put(Constants.OTIS_ENDPOINT_SETTING, endpointURI); 
     399        } 
     400 
    394401}