1 16 package org.apache.cocoon.webapps.authentication.user; 17 18 import org.apache.avalon.framework.configuration.Configuration; 19 import org.apache.cocoon.ProcessingException; 20 import org.apache.cocoon.webapps.authentication.configuration.ApplicationConfiguration; 21 import org.apache.excalibur.source.SourceResolver; 22 23 24 32 public final class RequestState 33 implements java.io.Serializable { 34 35 36 private UserHandler handler; 37 38 39 private String application; 40 41 44 public RequestState(UserHandler handler, String app) { 45 this.handler = handler; 46 this.application = app; 47 } 48 49 52 public void initialize(SourceResolver resolver) 53 throws ProcessingException { 54 if ( this.application != null && !this.handler.getApplicationsLoaded()) { 55 ApplicationConfiguration conf = (ApplicationConfiguration) this.handler.getHandlerConfiguration().getApplications().get(this.application); 56 if ( !this.handler.isApplicationLoaded( conf ) ) { 57 this.handler.getContext().loadApplicationXML( conf, resolver ); 58 } 59 } 60 } 61 62 public String getApplicationName() { 63 return this.application; 64 } 65 66 public UserHandler getHandler() { 67 return this.handler; 68 } 69 70 public String getHandlerName() { 71 return this.handler.getHandlerName(); 72 } 73 74 public ApplicationConfiguration getApplicationConfiguration() { 75 if ( this.application != null ) { 76 return (ApplicationConfiguration)this.handler.getHandlerConfiguration().getApplications().get(this.application); 77 } 78 return null; 79 } 80 81 84 public Configuration getModuleConfiguration(String name) { 85 Configuration conf = null; 86 87 if (this.handler != null && this.application != null) { 88 conf = this.getApplicationConfiguration().getConfiguration(name); 89 } 90 if (this.handler != null && conf == null) { 91 conf = this.handler.getHandlerConfiguration().getConfiguration(name); 92 } 93 94 return conf; 95 } 96 } 97 | Popular Tags |