You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2007/10/24 04:33:20 UTC
svn commit: r587749 - in
/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks:
./ components/ shielding/ util/
Author: vgritsenko
Date: Tue Oct 23 19:33:18 2007
New Revision: 587749
URL: http://svn.apache.org/viewvc?rev=587749&view=rev
Log:
setting svn properties
Modified:
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockCallStack.java (props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockConnection.java (props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockContext.java (props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockServlet.java (props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/DispatcherServlet.java (props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/DynamicProxyRequestHandler.java (contents, props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockPathModule.java (contents, props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockPropertyModule.java (contents, props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockSource.java (contents, props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockSourceFactory.java (contents, props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldedGroupClassLoaderManager.java (contents, props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldingBlockServlet.java (contents, props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldingClassLoaderInterceptor.java (contents, props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/BlockCallHttpServletRequest.java (props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/BlockCallHttpServletResponse.java (props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/RequestParameters.java (props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/ServletConfigurationWrapper.java (props changed)
cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/ServletContextWrapper.java (props changed)
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockCallStack.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Oct 23 19:33:18 2007
@@ -1 +1 @@
-Id
+Id Revision Author Date
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockConnection.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Oct 23 19:33:18 2007
@@ -1 +1 @@
-Id
+Id Revision Author Date
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockContext.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Oct 23 19:33:18 2007
@@ -1 +1 @@
-Id
+Id Revision Author Date
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockServlet.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Oct 23 19:33:18 2007
@@ -1 +1 @@
-Id
+Id Revision Author Date
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/DispatcherServlet.java
------------------------------------------------------------------------------
svn:keywords = Id Revision Author Date
Modified: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/DynamicProxyRequestHandler.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/DynamicProxyRequestHandler.java?rev=587749&r1=587748&r2=587749&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/DynamicProxyRequestHandler.java (original)
+++ cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/DynamicProxyRequestHandler.java Tue Oct 23 19:33:18 2007
@@ -25,7 +25,7 @@
* getServletPath and getPathInfo methods to relect the mount
* path of the block servlet.
*
- * @version $Id:$
+ * @version $Id$
*/
public class DynamicProxyRequestHandler implements InvocationHandler {
private final HttpServletRequest wrapped;
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/DynamicProxyRequestHandler.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Oct 23 19:33:18 2007
@@ -1 +1 @@
-Id
+Id Revision Author Date
Modified: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockPathModule.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockPathModule.java?rev=587749&r1=587748&r2=587749&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockPathModule.java (original)
+++ cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockPathModule.java Tue Oct 23 19:33:18 2007
@@ -1,70 +1,70 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.cocoon.blocks.components;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.blocks.BlockContext;
-import org.apache.cocoon.environment.Environment;
-import org.apache.cocoon.blocks.BlockCallStack;
-import org.apache.cocoon.components.modules.input.InputModule;
-import org.apache.cocoon.environment.internal.EnvironmentHelper;
-
-/**
- * BlockPathModule returns the absolute path of a block protocol path.
- *
- * @version $Id: BlockPathModule.java 448464 2006-09-21 05:29:11Z crossley $
- */
-public class BlockPathModule implements InputModule, ThreadSafe {
-
- public Object getAttribute( String name, Configuration modeConf, Map objectModel )
- throws ConfigurationException {
- Environment env = EnvironmentHelper.getCurrentEnvironment();
- BlockContext blockContext = (BlockContext) BlockCallStack.getBaseBlockContext();
- String absoluteURI = null;
- /* No relative block paths yet
- String baseURI = env.getURIPrefix();
- if (baseURI.length() == 0 || !baseURI.startsWith("/"))
- baseURI = "/" + baseURI;
- */
- try {
- // URI uri = BlockSource.resolveURI(new URI(name), new URI(null, null, baseURI, null));
- URI uri = new URI(name);
- absoluteURI= blockContext.absolutizeURI(uri).toString();
- } catch (URISyntaxException e) {
- throw new ConfigurationException("Couldn't absolutize " + name);
- }
- return absoluteURI;
- }
-
- public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- throw new UnsupportedOperationException();
- }
-
- public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- throw new UnsupportedOperationException();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cocoon.blocks.components;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.blocks.BlockContext;
+import org.apache.cocoon.environment.Environment;
+import org.apache.cocoon.blocks.BlockCallStack;
+import org.apache.cocoon.components.modules.input.InputModule;
+import org.apache.cocoon.environment.internal.EnvironmentHelper;
+
+/**
+ * BlockPathModule returns the absolute path of a block protocol path.
+ *
+ * @version $Id$
+ */
+public class BlockPathModule implements InputModule, ThreadSafe {
+
+ public Object getAttribute( String name, Configuration modeConf, Map objectModel )
+ throws ConfigurationException {
+ Environment env = EnvironmentHelper.getCurrentEnvironment();
+ BlockContext blockContext = (BlockContext) BlockCallStack.getBaseBlockContext();
+ String absoluteURI = null;
+ /* No relative block paths yet
+ String baseURI = env.getURIPrefix();
+ if (baseURI.length() == 0 || !baseURI.startsWith("/"))
+ baseURI = "/" + baseURI;
+ */
+ try {
+ // URI uri = BlockSource.resolveURI(new URI(name), new URI(null, null, baseURI, null));
+ URI uri = new URI(name);
+ absoluteURI= blockContext.absolutizeURI(uri).toString();
+ } catch (URISyntaxException e) {
+ throw new ConfigurationException("Couldn't absolutize " + name);
+ }
+ return absoluteURI;
+ }
+
+ public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
+ throws ConfigurationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
+ throws ConfigurationException {
+ throw new UnsupportedOperationException();
+ }
+}
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockPathModule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockPathModule.java
------------------------------------------------------------------------------
svn:keywords = Id Revision Author Date
Modified: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockPropertyModule.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockPropertyModule.java?rev=587749&r1=587748&r2=587749&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockPropertyModule.java (original)
+++ cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockPropertyModule.java Tue Oct 23 19:33:18 2007
@@ -1,50 +1,50 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.cocoon.blocks.components;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.blocks.BlockCallStack;
-import org.apache.cocoon.components.modules.input.InputModule;
-
-/**
- * BlockPropertyModule provides access to the properties of the current block.
- *
- * @version $Id: BlockPropertyModule.java 448464 2006-09-21 05:29:11Z crossley $
- */
-public class BlockPropertyModule implements InputModule, ThreadSafe {
-
- public Object getAttribute( String name, Configuration modeConf, Map objectModel )
- throws ConfigurationException {
- return BlockCallStack.getBaseBlockContext().getInitParameter(name);
- }
-
- public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- throw new UnsupportedOperationException();
- }
-
- public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- throw new UnsupportedOperationException();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cocoon.blocks.components;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.blocks.BlockCallStack;
+import org.apache.cocoon.components.modules.input.InputModule;
+
+/**
+ * BlockPropertyModule provides access to the properties of the current block.
+ *
+ * @version $Id$
+ */
+public class BlockPropertyModule implements InputModule, ThreadSafe {
+
+ public Object getAttribute( String name, Configuration modeConf, Map objectModel )
+ throws ConfigurationException {
+ return BlockCallStack.getBaseBlockContext().getInitParameter(name);
+ }
+
+ public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
+ throws ConfigurationException {
+ throw new UnsupportedOperationException();
+ }
+
+ public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
+ throws ConfigurationException {
+ throw new UnsupportedOperationException();
+ }
+}
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockPropertyModule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockPropertyModule.java
------------------------------------------------------------------------------
svn:keywords = Id Revision Author Date
Modified: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockSource.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockSource.java?rev=587749&r1=587748&r2=587749&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockSource.java (original)
+++ cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockSource.java Tue Oct 23 19:33:18 2007
@@ -1,62 +1,62 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.blocks.components;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.cocoon.blocks.BlockConnection;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceException;
-import org.apache.excalibur.source.impl.AbstractSource;
-
-/**
- * Implementation of a {@link Source} that gets its content by
- * invoking the Block.
- *
- * @version $Id$
- */
-public class BlockSource extends AbstractSource {
-
- private BlockConnection blockConnection;
-
- public BlockSource(String location, Logger logger) throws IOException {
- // the systemId (returned by getURI()) is by default null
- // using the block uri is a little bit questionable as it only is valid
- // whithin the current block, not globally
- setSystemId(location);
- this.blockConnection = new BlockConnection(location, logger);
- this.blockConnection.connect();
- }
-
- /* (non-Javadoc)
- * @see org.apache.excalibur.source.impl.AbstractSource#getInputStream()
- */
- public InputStream getInputStream() throws IOException, SourceException {
- return this.blockConnection.getInputStream();
- }
-
- /**
- * Returns true always.
- * @see org.apache.excalibur.source.Source#exists()
- */
- public boolean exists() {
- return true;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.blocks.components;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.cocoon.blocks.BlockConnection;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceException;
+import org.apache.excalibur.source.impl.AbstractSource;
+
+/**
+ * Implementation of a {@link Source} that gets its content by
+ * invoking the Block.
+ *
+ * @version $Id$
+ */
+public class BlockSource extends AbstractSource {
+
+ private BlockConnection blockConnection;
+
+ public BlockSource(String location, Logger logger) throws IOException {
+ // the systemId (returned by getURI()) is by default null
+ // using the block uri is a little bit questionable as it only is valid
+ // whithin the current block, not globally
+ setSystemId(location);
+ this.blockConnection = new BlockConnection(location, logger);
+ this.blockConnection.connect();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.excalibur.source.impl.AbstractSource#getInputStream()
+ */
+ public InputStream getInputStream() throws IOException, SourceException {
+ return this.blockConnection.getInputStream();
+ }
+
+ /**
+ * Returns true always.
+ * @see org.apache.excalibur.source.Source#exists()
+ */
+ public boolean exists() {
+ return true;
+ }
+
+}
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockSource.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockSource.java
------------------------------------------------------------------------------
svn:keywords = Id Revision Author Date
Modified: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockSourceFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockSourceFactory.java?rev=587749&r1=587748&r2=587749&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockSourceFactory.java (original)
+++ cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockSourceFactory.java Tue Oct 23 19:33:18 2007
@@ -1,71 +1,71 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.blocks.components;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.Map;
-
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceFactory;
-import org.apache.excalibur.source.SourceUtil;
-import org.apache.excalibur.source.URIAbsolutizer;
-
-/**
- * This class implements the block: protocol.
- *
- *
- * @version $Id$
- */
-public final class BlockSourceFactory
-extends AbstractLogEnabled
-implements SourceFactory, ThreadSafe, URIAbsolutizer
-{
-
-/* (non-Javadoc)
- * @see org.apache.excalibur.source.SourceFactory#getSource(java.lang.String, java.util.Map)
- */
-public Source getSource( String location, Map parameters )
- throws MalformedURLException, IOException {
- if( getLogger().isDebugEnabled() ) {
- getLogger().debug( "Creating source object for " + location );
- }
-
- return new BlockSource(location, getLogger());
-}
-
-/* (non-Javadoc)
- * @see org.apache.excalibur.source.SourceFactory#release(org.apache.excalibur.source.Source)
- */
-public void release( Source source ) {
- if ( null != source ) {
- if ( this.getLogger().isDebugEnabled() ) {
- this.getLogger().debug("Releasing source " + source.getURI());
- }
- }
-}
-
-/* (non-Javadoc)
- * @see org.apache.excalibur.source.URIAbsolutizer#absolutize(java.lang.String, java.lang.String)
- */
-public String absolutize(String baseURI, String location) {
- return SourceUtil.absolutize(baseURI, location, true);
-}
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.blocks.components;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Map;
+
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceFactory;
+import org.apache.excalibur.source.SourceUtil;
+import org.apache.excalibur.source.URIAbsolutizer;
+
+/**
+ * This class implements the block: protocol.
+ *
+ *
+ * @version $Id$
+ */
+public final class BlockSourceFactory
+extends AbstractLogEnabled
+implements SourceFactory, ThreadSafe, URIAbsolutizer
+{
+
+/* (non-Javadoc)
+ * @see org.apache.excalibur.source.SourceFactory#getSource(java.lang.String, java.util.Map)
+ */
+public Source getSource( String location, Map parameters )
+ throws MalformedURLException, IOException {
+ if( getLogger().isDebugEnabled() ) {
+ getLogger().debug( "Creating source object for " + location );
+ }
+
+ return new BlockSource(location, getLogger());
+}
+
+/* (non-Javadoc)
+ * @see org.apache.excalibur.source.SourceFactory#release(org.apache.excalibur.source.Source)
+ */
+public void release( Source source ) {
+ if ( null != source ) {
+ if ( this.getLogger().isDebugEnabled() ) {
+ this.getLogger().debug("Releasing source " + source.getURI());
+ }
+ }
+}
+
+/* (non-Javadoc)
+ * @see org.apache.excalibur.source.URIAbsolutizer#absolutize(java.lang.String, java.lang.String)
+ */
+public String absolutize(String baseURI, String location) {
+ return SourceUtil.absolutize(baseURI, location, true);
+}
+
+}
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockSourceFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/components/BlockSourceFactory.java
------------------------------------------------------------------------------
svn:keywords = Id Revision Author Date
Modified: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldedGroupClassLoaderManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldedGroupClassLoaderManager.java?rev=587749&r1=587748&r2=587749&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldedGroupClassLoaderManager.java (original)
+++ cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldedGroupClassLoaderManager.java Tue Oct 23 19:33:18 2007
@@ -1,143 +1,143 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.blocks.shielding;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-
-import org.apache.cocoon.classloader.ClassLoaderConfiguration;
-import org.apache.cocoon.classloader.ClassLoaderFactory;
-import org.apache.cocoon.classloader.DefaultClassLoaderFactory;
-
-/**
- * Used by the ShieldingBlockServlet to obtain a shielded classloader. Supports
- * groups of servlets that use the same classloader that is still shielded from
- * the rest of the webapp.
- */
-public class ShieldedGroupClassLoaderManager {
-
- // parameters
-
- public static final String SHIELDED_GROUP_PARAM = "shielded-group";
-
- public static final String SHIELDED_LIB_PARAM = "shielded-lib";
-
- public static final String SHIELDED_CLASSES_PARAM = "shielded-classes";
-
- public static final String CLASSLOADER_FACTORY_PARAM = "classloader-factory";
-
- // standard directories
-
- /**
- * Default directory for shielded libs (below COB-INF), must start with "/"
- */
- protected static final String SHIELDED_LIB = "shielded/lib";
-
- /**
- * Default directory for shielded classes (below COB-INF), must start with
- * "/"
- */
- protected static final String SHIELDED_CLASSES = "shielded/classes";
-
- /**
- * Maps group names (Strings) to their classloader.
- */
- protected static Map groupClassloaders = new HashMap();
-
- /**
- * Get the classloader, either an already instantiated classloader for a
- * group or create a completely new one.
- */
- public static synchronized ClassLoader getClassLoader(
- ServletContext servletContext, Map parameters)
- throws ServletException {
- final String classLoaderGroup = (String) parameters
- .get(SHIELDED_GROUP_PARAM);
- if (classLoaderGroup != null) {
- // check if the classloader for this group was already created
- if (groupClassloaders.containsKey(classLoaderGroup)) {
- return (ClassLoader) groupClassloaders.get(classLoaderGroup);
- }
- }
-
- ClassLoader shieldedClassLoader;
-
- shieldedClassLoader = createClassLoader(
- ShieldedGroupClassLoaderManager.class.getClassLoader(),
- servletContext, parameters);
-
- // if this classloader is part of a group, add it to the map
- if (classLoaderGroup != null) {
- groupClassloaders.put(classLoaderGroup, shieldedClassLoader);
- }
-
- return shieldedClassLoader;
- }
-
- /**
- * Create the shielded class loader.
- */
- protected static ClassLoader createClassLoader(ClassLoader parent,
- ServletContext servletContext, Map parameters)
- throws ServletException {
- String classesDirectory = ShieldedGroupClassLoaderManager.SHIELDED_CLASSES;
- String jarDirectory = ShieldedGroupClassLoaderManager.SHIELDED_LIB;
-
- if (parameters.get(SHIELDED_CLASSES_PARAM) != null) {
- classesDirectory = (String) parameters.get(SHIELDED_CLASSES_PARAM);
- }
- if (parameters.get(SHIELDED_LIB_PARAM) != null) {
- jarDirectory = (String) parameters.get(SHIELDED_LIB_PARAM);
- }
-
- ClassLoaderConfiguration config = new ClassLoaderConfiguration();
- config.addClassDirectory(classesDirectory);
- config.addLibDirectory(jarDirectory);
-
- String factoryClassName = DefaultClassLoaderFactory.class.getName();
- if (parameters.get(CLASSLOADER_FACTORY_PARAM) != null) {
- factoryClassName = (String) parameters.get(CLASSLOADER_FACTORY_PARAM);
- }
-
- try {
- final Class classLoaderFactoryClass = Class.forName(factoryClassName);
- ClassLoaderFactory factory = (ClassLoaderFactory) classLoaderFactoryClass.newInstance();
- return factory.createClassLoader(
- config.getClass().getClassLoader(), config, servletContext);
- } catch (InstantiationException e) {
- throw new ServletException(e.getMessage(), e);
- } catch (IllegalAccessException e) {
- throw new ServletException(e.getMessage(), e);
- } catch (ClassNotFoundException e) {
- throw new ServletException(e.getMessage(), e);
- } catch (SecurityException e) {
- throw new ServletException(e.getMessage(), e);
- } catch (NoSuchMethodException e) {
- throw new ServletException(e.getMessage(), e);
- } catch (IllegalArgumentException e) {
- throw new ServletException(e.getMessage(), e);
- } catch (InvocationTargetException e) {
- throw new ServletException(e.getMessage(), e);
- } catch (Exception e) {
- throw new ServletException(e.getMessage(), e);
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.blocks.shielding;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.apache.cocoon.classloader.ClassLoaderConfiguration;
+import org.apache.cocoon.classloader.ClassLoaderFactory;
+import org.apache.cocoon.classloader.DefaultClassLoaderFactory;
+
+/**
+ * Used by the ShieldingBlockServlet to obtain a shielded classloader. Supports
+ * groups of servlets that use the same classloader that is still shielded from
+ * the rest of the webapp.
+ */
+public class ShieldedGroupClassLoaderManager {
+
+ // parameters
+
+ public static final String SHIELDED_GROUP_PARAM = "shielded-group";
+
+ public static final String SHIELDED_LIB_PARAM = "shielded-lib";
+
+ public static final String SHIELDED_CLASSES_PARAM = "shielded-classes";
+
+ public static final String CLASSLOADER_FACTORY_PARAM = "classloader-factory";
+
+ // standard directories
+
+ /**
+ * Default directory for shielded libs (below COB-INF), must start with "/"
+ */
+ protected static final String SHIELDED_LIB = "shielded/lib";
+
+ /**
+ * Default directory for shielded classes (below COB-INF), must start with
+ * "/"
+ */
+ protected static final String SHIELDED_CLASSES = "shielded/classes";
+
+ /**
+ * Maps group names (Strings) to their classloader.
+ */
+ protected static Map groupClassloaders = new HashMap();
+
+ /**
+ * Get the classloader, either an already instantiated classloader for a
+ * group or create a completely new one.
+ */
+ public static synchronized ClassLoader getClassLoader(
+ ServletContext servletContext, Map parameters)
+ throws ServletException {
+ final String classLoaderGroup = (String) parameters
+ .get(SHIELDED_GROUP_PARAM);
+ if (classLoaderGroup != null) {
+ // check if the classloader for this group was already created
+ if (groupClassloaders.containsKey(classLoaderGroup)) {
+ return (ClassLoader) groupClassloaders.get(classLoaderGroup);
+ }
+ }
+
+ ClassLoader shieldedClassLoader;
+
+ shieldedClassLoader = createClassLoader(
+ ShieldedGroupClassLoaderManager.class.getClassLoader(),
+ servletContext, parameters);
+
+ // if this classloader is part of a group, add it to the map
+ if (classLoaderGroup != null) {
+ groupClassloaders.put(classLoaderGroup, shieldedClassLoader);
+ }
+
+ return shieldedClassLoader;
+ }
+
+ /**
+ * Create the shielded class loader.
+ */
+ protected static ClassLoader createClassLoader(ClassLoader parent,
+ ServletContext servletContext, Map parameters)
+ throws ServletException {
+ String classesDirectory = ShieldedGroupClassLoaderManager.SHIELDED_CLASSES;
+ String jarDirectory = ShieldedGroupClassLoaderManager.SHIELDED_LIB;
+
+ if (parameters.get(SHIELDED_CLASSES_PARAM) != null) {
+ classesDirectory = (String) parameters.get(SHIELDED_CLASSES_PARAM);
+ }
+ if (parameters.get(SHIELDED_LIB_PARAM) != null) {
+ jarDirectory = (String) parameters.get(SHIELDED_LIB_PARAM);
+ }
+
+ ClassLoaderConfiguration config = new ClassLoaderConfiguration();
+ config.addClassDirectory(classesDirectory);
+ config.addLibDirectory(jarDirectory);
+
+ String factoryClassName = DefaultClassLoaderFactory.class.getName();
+ if (parameters.get(CLASSLOADER_FACTORY_PARAM) != null) {
+ factoryClassName = (String) parameters.get(CLASSLOADER_FACTORY_PARAM);
+ }
+
+ try {
+ final Class classLoaderFactoryClass = Class.forName(factoryClassName);
+ ClassLoaderFactory factory = (ClassLoaderFactory) classLoaderFactoryClass.newInstance();
+ return factory.createClassLoader(
+ config.getClass().getClassLoader(), config, servletContext);
+ } catch (InstantiationException e) {
+ throw new ServletException(e.getMessage(), e);
+ } catch (IllegalAccessException e) {
+ throw new ServletException(e.getMessage(), e);
+ } catch (ClassNotFoundException e) {
+ throw new ServletException(e.getMessage(), e);
+ } catch (SecurityException e) {
+ throw new ServletException(e.getMessage(), e);
+ } catch (NoSuchMethodException e) {
+ throw new ServletException(e.getMessage(), e);
+ } catch (IllegalArgumentException e) {
+ throw new ServletException(e.getMessage(), e);
+ } catch (InvocationTargetException e) {
+ throw new ServletException(e.getMessage(), e);
+ } catch (Exception e) {
+ throw new ServletException(e.getMessage(), e);
+ }
+ }
+}
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldedGroupClassLoaderManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldedGroupClassLoaderManager.java
------------------------------------------------------------------------------
svn:keywords = Id Revision Author Date
Modified: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldingBlockServlet.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldingBlockServlet.java?rev=587749&r1=587748&r2=587749&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldingBlockServlet.java (original)
+++ cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldingBlockServlet.java Tue Oct 23 19:33:18 2007
@@ -1,115 +1,115 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.blocks.shielding;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-
-import org.apache.cocoon.blocks.BlockServlet;
-
-import org.springframework.aop.framework.ProxyFactory;
-
-/**
- * A servlet for use in cocoon blocks that adds shielded classloading support.
- */
-public class ShieldingBlockServlet extends BlockServlet {
-
- /**
- * Spring property, name of the group that will get the same classloader.
- */
- protected String shieldedGroup;
-
- /**
- * Spring property, path to the shielded libraries (jars) inside COB-INF/
- */
- protected String shieldedLib;
-
- /**
- * Spring property, path to the shielded classes inside COB-INF/
- */
- protected String shieldedClasses;
-
- /**
- * Spring property, name of the classloader factory
- */
- protected String classLoaderFactory;
-
- protected ClassLoader classLoader;
-
- public void setShieldedGroup(String shieldedGroup) {
- this.shieldedGroup = shieldedGroup;
- }
-
- public void setShieldedLib(String shieldedLib) {
- if (!shieldedLib.startsWith("/")) {
- this.shieldedLib = "/" + shieldedLib;
- } else {
- this.shieldedLib = shieldedLib;
- }
- }
-
- public void setShieldedClasses(String shieldedClasses) {
- if (!shieldedClasses.startsWith("/")) {
- this.shieldedClasses = "/" + shieldedClasses;
- } else {
- this.shieldedClasses = shieldedClasses;
- }
- }
-
- public void setClassLoaderFactory(String classLoaderFactory) {
- this.classLoaderFactory = classLoaderFactory;
- }
-
- protected Servlet createEmbeddedServlet(String embeddedServletClassName, ServletConfig servletConfig)
- throws ServletException {
- // create the classloader
- Map parameters = new HashMap();
- parameters.put(ShieldedGroupClassLoaderManager.SHIELDED_GROUP_PARAM,
- this.shieldedGroup);
- parameters.put(ShieldedGroupClassLoaderManager.SHIELDED_LIB_PARAM,
- this.shieldedLib);
- parameters.put(ShieldedGroupClassLoaderManager.SHIELDED_CLASSES_PARAM,
- this.shieldedClasses);
- parameters.put(ShieldedGroupClassLoaderManager.CLASSLOADER_FACTORY_PARAM,
- this.classLoaderFactory);
-
- this.classLoader =
- ShieldedGroupClassLoaderManager.getClassLoader(getBlockContext(), parameters);
-
- // Create the servlet
- final ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
- try {
- Thread.currentThread().setContextClassLoader(this.classLoader);
-
- Class servletClass = this.classLoader.loadClass(embeddedServletClassName);
- Servlet embeddedServlet = (Servlet) servletClass.newInstance();
- ProxyFactory proxyFactory = new ProxyFactory(embeddedServlet);
- proxyFactory.addAdvice(new ShieldingClassLoaderInterceptor(this.classLoader));
- return (Servlet) proxyFactory.getProxy();
- } catch (Exception e) {
- throw new ServletException(
- "Loading class for embedded servlet failed " + embeddedServletClassName, e);
- } finally {
- Thread.currentThread().setContextClassLoader(oldClassLoader);
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.blocks.shielding;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+
+import org.apache.cocoon.blocks.BlockServlet;
+
+import org.springframework.aop.framework.ProxyFactory;
+
+/**
+ * A servlet for use in cocoon blocks that adds shielded classloading support.
+ */
+public class ShieldingBlockServlet extends BlockServlet {
+
+ /**
+ * Spring property, name of the group that will get the same classloader.
+ */
+ protected String shieldedGroup;
+
+ /**
+ * Spring property, path to the shielded libraries (jars) inside COB-INF/
+ */
+ protected String shieldedLib;
+
+ /**
+ * Spring property, path to the shielded classes inside COB-INF/
+ */
+ protected String shieldedClasses;
+
+ /**
+ * Spring property, name of the classloader factory
+ */
+ protected String classLoaderFactory;
+
+ protected ClassLoader classLoader;
+
+ public void setShieldedGroup(String shieldedGroup) {
+ this.shieldedGroup = shieldedGroup;
+ }
+
+ public void setShieldedLib(String shieldedLib) {
+ if (!shieldedLib.startsWith("/")) {
+ this.shieldedLib = "/" + shieldedLib;
+ } else {
+ this.shieldedLib = shieldedLib;
+ }
+ }
+
+ public void setShieldedClasses(String shieldedClasses) {
+ if (!shieldedClasses.startsWith("/")) {
+ this.shieldedClasses = "/" + shieldedClasses;
+ } else {
+ this.shieldedClasses = shieldedClasses;
+ }
+ }
+
+ public void setClassLoaderFactory(String classLoaderFactory) {
+ this.classLoaderFactory = classLoaderFactory;
+ }
+
+ protected Servlet createEmbeddedServlet(String embeddedServletClassName, ServletConfig servletConfig)
+ throws ServletException {
+ // create the classloader
+ Map parameters = new HashMap();
+ parameters.put(ShieldedGroupClassLoaderManager.SHIELDED_GROUP_PARAM,
+ this.shieldedGroup);
+ parameters.put(ShieldedGroupClassLoaderManager.SHIELDED_LIB_PARAM,
+ this.shieldedLib);
+ parameters.put(ShieldedGroupClassLoaderManager.SHIELDED_CLASSES_PARAM,
+ this.shieldedClasses);
+ parameters.put(ShieldedGroupClassLoaderManager.CLASSLOADER_FACTORY_PARAM,
+ this.classLoaderFactory);
+
+ this.classLoader =
+ ShieldedGroupClassLoaderManager.getClassLoader(getBlockContext(), parameters);
+
+ // Create the servlet
+ final ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(this.classLoader);
+
+ Class servletClass = this.classLoader.loadClass(embeddedServletClassName);
+ Servlet embeddedServlet = (Servlet) servletClass.newInstance();
+ ProxyFactory proxyFactory = new ProxyFactory(embeddedServlet);
+ proxyFactory.addAdvice(new ShieldingClassLoaderInterceptor(this.classLoader));
+ return (Servlet) proxyFactory.getProxy();
+ } catch (Exception e) {
+ throw new ServletException(
+ "Loading class for embedded servlet failed " + embeddedServletClassName, e);
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldClassLoader);
+ }
+ }
+
+}
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldingBlockServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldingBlockServlet.java
------------------------------------------------------------------------------
svn:keywords = Id Revision Author Date
Modified: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldingClassLoaderInterceptor.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldingClassLoaderInterceptor.java?rev=587749&r1=587748&r2=587749&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldingClassLoaderInterceptor.java (original)
+++ cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldingClassLoaderInterceptor.java Tue Oct 23 19:33:18 2007
@@ -1,41 +1,41 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cocoon.blocks.shielding;
-
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.MethodInvocation;
-
-public class ShieldingClassLoaderInterceptor implements MethodInterceptor {
-
- private final ClassLoader classLoader;
-
- public ShieldingClassLoaderInterceptor(ClassLoader classLoader) {
- this.classLoader = classLoader;
- }
-
- public Object invoke(MethodInvocation invocation) throws Throwable {
- final ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
- try {
- Thread.currentThread().setContextClassLoader(this.classLoader);
-
- return invocation.proceed();
- } finally {
- Thread.currentThread().setContextClassLoader(oldClassLoader);
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.blocks.shielding;
+
+import org.aopalliance.intercept.MethodInterceptor;
+import org.aopalliance.intercept.MethodInvocation;
+
+public class ShieldingClassLoaderInterceptor implements MethodInterceptor {
+
+ private final ClassLoader classLoader;
+
+ public ShieldingClassLoaderInterceptor(ClassLoader classLoader) {
+ this.classLoader = classLoader;
+ }
+
+ public Object invoke(MethodInvocation invocation) throws Throwable {
+ final ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(this.classLoader);
+
+ return invocation.proceed();
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldClassLoader);
+ }
+ }
+
+}
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldingClassLoaderInterceptor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/shielding/ShieldingClassLoaderInterceptor.java
------------------------------------------------------------------------------
svn:keywords = Id Revision Author Date
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/BlockCallHttpServletRequest.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Oct 23 19:33:18 2007
@@ -1 +1 @@
-Id
+Id Revision Author Date
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/BlockCallHttpServletResponse.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Oct 23 19:33:18 2007
@@ -1 +1 @@
-Id
+Id Revision Author Date
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/RequestParameters.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Oct 23 19:33:18 2007
@@ -1 +1 @@
-Id
+Id Revision Author Date
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/ServletConfigurationWrapper.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Oct 23 19:33:18 2007
@@ -1 +1 @@
-Id
+Id Revision Author Date
Propchange: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/util/ServletContextWrapper.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Tue Oct 23 19:33:18 2007
@@ -1 +1 @@
-Id
+Id Revision Author Date