You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2006/10/31 12:19:26 UTC

svn commit: r469447 - in /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core: container/spring/SettingsBeanFactoryPostProcessor.java deployment/ deployment/DeploymentUtil.java

Author: cziegeler
Date: Tue Oct 31 03:19:25 2006
New Revision: 469447

URL: http://svn.apache.org/viewvc?view=rev&rev=469447
Log:
Prototyp runtime deployment

Added:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java   (with props)
Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SettingsBeanFactoryPostProcessor.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SettingsBeanFactoryPostProcessor.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SettingsBeanFactoryPostProcessor.java?view=diff&rev=469447&r1=469446&r2=469447
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SettingsBeanFactoryPostProcessor.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/SettingsBeanFactoryPostProcessor.java Tue Oct 31 03:19:25 2006
@@ -31,6 +31,7 @@
 import org.apache.cocoon.configuration.SettingsDefaults;
 import org.apache.cocoon.configuration.impl.MutableSettings;
 import org.apache.cocoon.configuration.impl.PropertyHelper;
+import org.apache.cocoon.core.deployment.DeploymentUtil;
 import org.apache.cocoon.util.ClassUtils;
 
 /**
@@ -58,6 +59,10 @@
      */
     public void init()
     throws Exception {
+        // first deploy block artifacts!
+        final DeploymentUtil deployer = new DeploymentUtil();
+        deployer.deploy();
+
         this.settings = this.createSettings();
 
         this.doInit();

Added: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java?view=auto&rev=469447
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java (added)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java Tue Oct 31 03:19:25 2006
@@ -0,0 +1,57 @@
+/* 
+ * 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.core.deployment;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+
+/**
+ * Helper class for deploying resources and configuration files from the
+ * block artifacts.
+ *
+ * @version $Id$
+ * @since 2.2
+ */
+public class DeploymentUtil {
+
+    public void deploy()
+    throws IOException {
+        try {
+            // find out all artifacts containing Cocoon specific configuration files
+            final Enumeration artifactUrls = this.getClass().getClassLoader().getResources("META-INF/cocoon");
+            while ( artifactUrls.hasMoreElements() ) {
+                final URL url = (URL)artifactUrls.nextElement();
+                String artifactUrl = url.toString();
+                int pos = artifactUrl.indexOf('!');
+                // url starts with "jar:"
+                artifactUrl = artifactUrl.substring(4, pos);
+                System.out.println("Trying to open " + artifactUrl);
+                final URL archiveUrl = new URL(artifactUrl);
+                final InputStream is = archiveUrl.openStream();
+                final byte[] b = new byte[2];
+                is.read(b);
+                System.out.println("..first two bytes: " + new String(b));
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

Propchange: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java
------------------------------------------------------------------------------
    svn:keywords = Id