vgritsenko 2003/09/18 07:40:25
Modified: src/java/org/apache/cocoon/environment
AbstractEnvironment.java
Log:
kill tabs
Revision Changes Path
1.16 +76 -77
cocoon-2.1/src/java/org/apache/cocoon/environment/AbstractEnvironment.java
Index: AbstractEnvironment.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/environment/AbstractEnvironment.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- AbstractEnvironment.java 10 Jul 2003 13:17:03 -0000 1.15
+++ AbstractEnvironment.java 18 Sep 2003 14:40:25 -0000 1.16
@@ -97,7 +97,7 @@
/** The Context path */
protected String context = null;
- /** The context path stored temporarily between constructor and
initComponents */
+ /** The context path stored temporarily between constructor and
initComponents */
private String tempInitContext = null;
/** The root context path */
@@ -143,17 +143,17 @@
this(uri, view, file.toURL().toExternalForm(), action);
}
- /**
- * Constructs the abstract environment
- */
- public AbstractEnvironment(String uri, String view, String context,
String action)
- throws MalformedURLException {
- this.uris = uri;
- this.view = view;
- this.tempInitContext = context;
- this.action = action;
- this.objectModel = new HashMap();
- }
+ /**
+ * Constructs the abstract environment
+ */
+ public AbstractEnvironment(String uri, String view, String context,
String action)
+ throws MalformedURLException {
+ this.uris = uri;
+ this.view = view;
+ this.tempInitContext = context;
+ this.action = action;
+ this.objectModel = new HashMap();
+ }
// Sitemap methods
@@ -168,9 +168,9 @@
* Get the Root Context
*/
public String getRootContext() {
- if ( !this.initializedComponents) {
- this.initComponents();
- }
+ if ( !this.initializedComponents) {
+ this.initComponents();
+ }
return this.rootContext;
}
@@ -178,9 +178,9 @@
* Get the current Context
*/
public String getContext() {
- if ( !this.initializedComponents) {
- this.initComponents();
- }
+ if ( !this.initializedComponents) {
+ this.initComponents();
+ }
return this.context;
}
@@ -208,27 +208,27 @@
this.context = context;
}
- /**
- * Set the context. This is similar to changeContext()
- * except that it is absolute.
- */
- public void setContext(String prefix, String uri, String context) {
- this.setContext(context);
- this.setURIPrefix(prefix == null ? "" : prefix);
- this.uris = uri;
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Reset context to " + this.context);
- }
- }
+ /**
+ * Set the context. This is similar to changeContext()
+ * except that it is absolute.
+ */
+ public void setContext(String prefix, String uri, String context) {
+ this.setContext(context);
+ this.setURIPrefix(prefix == null ? "" : prefix);
+ this.uris = uri;
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Reset context to " + this.context);
+ }
+ }
/**
* Adds an prefix to the overall stripped off prefix from the request uri
*/
public void changeContext(String prefix, String newContext)
throws IOException {
- if ( !this.initializedComponents) {
- this.initComponents();
- }
+ if ( !this.initializedComponents) {
+ this.initComponents();
+ }
if (getLogger().isDebugEnabled()) {
getLogger().debug("Changing Cocoon context");
@@ -263,10 +263,10 @@
org.apache.excalibur.source.Source source = null;
try {
- source = this.sourceResolver.resolveURI(this.context +
newContext);
- this.context = source.getURI();
+ source = this.sourceResolver.resolveURI(this.context +
newContext);
+ this.context = source.getURI();
} finally {
- this.sourceResolver.release(source);
+ this.sourceResolver.release(source);
}
} else {
String sContext;
@@ -290,11 +290,11 @@
org.apache.excalibur.source.Source source = null;
try {
- source = this.sourceResolver.resolveURI(sContext);
- this.context = source.getURI();
- } finally {
- this.sourceResolver.release(source);
- }
+ source = this.sourceResolver.resolveURI(sContext);
+ this.context = source.getURI();
+ } finally {
+ this.sourceResolver.release(source);
+ }
}
if (getLogger().isDebugEnabled()) {
@@ -517,8 +517,9 @@
* Releases a resolved resource
*/
public void release( final org.apache.excalibur.source.Source source ) {
- if ( null != source )
+ if ( null != source ) {
this.sourceResolver.release( source );
+ }
}
/**
@@ -530,46 +531,44 @@
try {
this.manager =
CocoonComponentManager.getSitemapComponentManager();
this.sourceResolver =
(org.apache.excalibur.source.SourceResolver)this.manager.lookup(org.apache.excalibur.source.SourceResolver.ROLE);
- if (this.tempInitContext != null) {
- org.apache.excalibur.source.Source source =
null;
- try {
- source =
this.sourceResolver.resolveURI(this.tempInitContext);
- this.context = source.getURI();
-
- if (this.rootContext == null) // hack
for EnvironmentWrapper
- this.rootContext = this.context;
- } finally {
- this.sourceResolver.release(source);
- }
- this.tempInitContext = null;
- }
+ if (this.tempInitContext != null) {
+ org.apache.excalibur.source.Source source = null;
+ try {
+ source =
this.sourceResolver.resolveURI(this.tempInitContext);
+ this.context = source.getURI();
+
+ if (this.rootContext == null) // hack for
EnvironmentWrapper
+ this.rootContext = this.context;
+ } finally {
+ this.sourceResolver.release(source);
+ }
+ this.tempInitContext = null;
+ }
} catch (ComponentException ce) {
// this should never happen!
throw new CascadingRuntimeException("Unable to lookup
component.", ce);
- } catch (IOException ie) {
- throw new CascadingRuntimeException("Unable to resolve
URI: "+this.tempInitContext, ie);
- }
+ } catch (IOException ie) {
+ throw new CascadingRuntimeException("Unable to resolve URI:
"+this.tempInitContext, ie);
+ }
}
- /**
- * Notify that the processing starts.
- */
- public void startingProcessing() {
+ /**
+ * Notify that the processing starts.
+ */
+ public void startingProcessing() {
// do nothing here
- }
+ }
- /**
- * Notify that the processing is finished
- * This can be used to cleanup the environment object
- */
- public void finishingProcessing() {
- if ( null != this.manager ) {
- this.manager.release( this.sourceResolver );
- this.manager = null;
- this.sourceResolver = null;
- }
+ /**
+ * Notify that the processing is finished
+ * This can be used to cleanup the environment object
+ */
+ public void finishingProcessing() {
+ if ( null != this.manager ) {
+ this.manager.release( this.sourceResolver );
+ this.manager = null;
+ this.sourceResolver = null;
+ }
this.initializedComponents = false;
- }
-
-
+ }
}