[jboss-svn-commits] JBL Code SVN: r16110 - in labs/jbossesb/trunk/product: install and 6 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Oct 27 03:55:48 EDT 2007


Author: kevin.conner at jboss.com
Date: 2007-10-27 03:55:48 -0400 (Sat, 27 Oct 2007)
New Revision: 16110

Added:
   labs/jbossesb/trunk/product/install/conf/esb.juddi.xml
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/PropertiesHelper.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyServiceMBean.java
   labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks.esb.xml
Removed:
   labs/jbossesb/trunk/product/install/conf/esb.juddi.properties
   labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks.esb.properties
Modified:
   labs/jbossesb/trunk/product/build-distr.xml
   labs/jbossesb/trunk/product/install/jboss-service.xml
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/JuddiRMIService.java
   labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/JuddiRMIServiceMBean.java
   labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksConfiguration.java
   labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksService.java
   labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksServiceMBean.java
   labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-service.xml
Log:
Code changes required for ServiceBinding: JBESB-871

Modified: labs/jbossesb/trunk/product/build-distr.xml
===================================================================
--- labs/jbossesb/trunk/product/build-distr.xml	2007-10-27 05:20:07 UTC (rev 16109)
+++ labs/jbossesb/trunk/product/build-distr.xml	2007-10-27 07:55:48 UTC (rev 16110)
@@ -131,7 +131,7 @@
         <copy todir="${build.dir}/jbossesb.sar">
             <fileset dir="${installation.files.dir}/conf">
                 <include name="jbossesb-properties.xml"/>
-                <include name="esb.juddi.properties"/>
+                <include name="esb.juddi.xml"/>
                 <include name="actionArtifactMap.properties"/>
             </fileset>
             <fileset dir="${installation.files.dir}/jUDDI-registry">

Deleted: labs/jbossesb/trunk/product/install/conf/esb.juddi.properties
===================================================================
--- labs/jbossesb/trunk/product/install/conf/esb.juddi.properties	2007-10-27 05:20:07 UTC (rev 16109)
+++ labs/jbossesb/trunk/product/install/conf/esb.juddi.properties	2007-10-27 07:55:48 UTC (rev 16110)
@@ -1,71 +0,0 @@
-# jUDDI Registry Properties (used by RegistryServer)
-# see http://www.juddi.org for more information
-
-# The UDDI Operator Name
-juddi.operatorName = jUDDI.org
-
-# The i18n locale default codes
-juddi.i18n.languageCode = en
-juddi.i18n.countryCode = US
-
-# The UDDI DiscoveryURL Prefix
-juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
-
-# The UDDI Operator Contact Email Address
-juddi.operatorEmailAddress = admin at juddi.org
-
-# The maximum name size and maximum number
-# of name elements allows in several of the
-# FindXxxx and SaveXxxx UDDI functions.
-juddi.maxNameLength=255
-juddi.maxNameElementsAllowed=5
-
-# The maximum number of UDDI artifacts allowed
-# per publisher. A value of '-1' indicates any 
-# number of artifacts is valid (These values can be
-# overridden at the individual publisher level).
-juddi.maxBusinessesPerPublisher=25
-juddi.maxServicesPerBusiness=20
-juddi.maxBindingsPerService=10
-juddi.maxTModelsPerPublisher=100
-
-# jUDDI Authentication module to use
-juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
-
-# jUDDI DataStore module currently to use
-juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
-
-# use a dataSource (if set to false a direct 
-# jdbc connection will be used.
-juddi.isUseDataSource=true
-
-# jUDDI DataSource to use
-juddi.dataSource=java:/juddiDB
-
-# jUDDI database creation 
-juddi.isCreateDatabase=true
-juddi.databaseExistsSql=select * from BUSINESS_ENTITY
-juddi.sqlFiles=juddi-sql/hsqldb/create_database.sql,juddi-sql/hsqldb/import.sql
-
-# jUDDI UUIDGen implementation to use
-juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
-
-# jUDDI Cryptor implementation to use
-juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
- 
-# jUDDI Validator to use
-juddi.validator=org.apache.juddi.validator.DefaultValidator
-
-# jUDDI Proxy Properties (used by RegistryProxy)
-juddi.proxy.adminURL = http://localhost:8080/juddi/admin
-juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
-juddi.proxy.publishURL = http://localhost:8080/juddi/publish
-juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
-juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
-juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
-
-# JNDI settings (used by RMITransport)
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.provider.url=jnp://localhost:1099
-java.naming.factory.url.pkgs=org.jboss.naming
-  

Added: labs/jbossesb/trunk/product/install/conf/esb.juddi.xml
===================================================================
--- labs/jbossesb/trunk/product/install/conf/esb.juddi.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/install/conf/esb.juddi.xml	2007-10-27 07:55:48 UTC (rev 16110)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+<properties>
+  <comment>
+    jUDDI Registry Properties (used by RegistryServer)
+    see http://www.juddi.org for more information
+
+    N.B. This file is an XML Property equivalent of the
+    standard jUDDI property file.
+  </comment>
+
+  <!-- The UDDI Operator Name -->
+  <entry key="juddi.operatorName">jUDDI.org</entry>
+
+  <!-- The i18n locale default codes -->
+  <entry key="juddi.i18n.languageCode">en</entry>
+  <entry key="juddi.i18n.countryCode">US</entry>
+
+  <!-- The UDDI DiscoveryURL Prefix -->
+  <entry key="juddi.discoveryURL">http://localhost:8080/juddi/uddiget.jsp?</entry>
+
+  <!-- The UDDI Operator Contact Email Address -->
+  <entry key="juddi.operatorEmailAddress">admin at juddi.org</entry>
+
+  <!--
+    The maximum name size and maximum number
+    of name elements allows in several of the
+    FindXxxx and SaveXxxx UDDI functions.
+  -->
+  <entry key="juddi.maxNameLength">255</entry>
+  <entry key="juddi.maxNameElementsAllowed">5</entry>
+
+  <!--
+    The maximum number of UDDI artifacts allowed
+    per publisher. A value of '-1' indicates any 
+    number of artifacts is valid (These values can be
+    overridden at the individual publisher level).
+  -->
+  <entry key="juddi.maxBusinessesPerPublisher">25</entry>
+  <entry key="juddi.maxServicesPerBusiness">20</entry>
+  <entry key="juddi.maxBindingsPerService">10</entry>
+  <entry key="juddi.maxTModelsPerPublisher">100</entry>
+
+  <!-- jUDDI Authentication module to use -->
+  <entry key="juddi.auth">org.apache.juddi.auth.DefaultAuthenticator</entry>
+
+  <!-- jUDDI DataStore module currently to use -->
+  <entry key="juddi.dataStore">org.apache.juddi.datastore.jdbc.JDBCDataStore</entry>
+
+  <!--
+    use a dataSource (if set to false a direct 
+    jdbc connection will be used.
+  -->
+  <entry key="juddi.isUseDataSource">true</entry>
+
+  <!-- jUDDI DataSource to use -->
+  <entry key="juddi.dataSource">java:/juddiDB</entry>
+
+  <!-- jUDDI database creation -->
+  <entry key="juddi.isCreateDatabase">true</entry>
+  <entry key="juddi.databaseExistsSql">select * from BUSINESS_ENTITY</entry>
+  <entry key="juddi.sqlFiles">juddi-sql/hsqldb/create_database.sql,juddi-sql/hsqldb/import.sql</entry>
+
+  <!-- jUDDI UUIDGen implementation to use -->
+  <entry key="juddi.uuidgen">org.apache.juddi.uuidgen.DefaultUUIDGen</entry>
+
+  <!-- jUDDI Cryptor implementation to use -->
+  <entry key="juddi.cryptor">org.apache.juddi.cryptor.DefaultCryptor</entry>
+ 
+  <!-- jUDDI Validator to use -->
+  <entry key="juddi.validator">org.apache.juddi.validator.DefaultValidator</entry>
+
+  <!-- jUDDI Proxy Properties (used by RegistryProxy) -->
+  <entry key="juddi.proxy.adminURL">http://localhost:8080/juddi/admin</entry>
+  <entry key="juddi.proxy.inquiryURL">http://localhost:8080/juddi/inquiry</entry>
+  <entry key="juddi.proxy.publishURL">http://localhost:8080/juddi/publish</entry>
+  <entry key="juddi.proxy.transportClass">org.apache.juddi.proxy.AxisTransport</entry>
+  <entry key="juddi.proxy.securityProvider">com.sun.net.ssl.internal.ssl.Provider</entry>
+  <entry key="juddi.proxy.protocolHandler">com.sun.net.ssl.internal.www.protocol</entry>
+
+  <!-- JNDI settings (used by RMITransport) -->
+  <entry key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</entry>
+  <entry key="java.naming.provider.url">jnp://localhost:1099</entry>
+  <entry key="java.naming.factory.url.pkgs">org.jboss.naming</entry>
+</properties>


Property changes on: labs/jbossesb/trunk/product/install/conf/esb.juddi.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Modified: labs/jbossesb/trunk/product/install/jboss-service.xml
===================================================================
--- labs/jbossesb/trunk/product/install/jboss-service.xml	2007-10-27 05:20:07 UTC (rev 16109)
+++ labs/jbossesb/trunk/product/install/jboss-service.xml	2007-10-27 07:55:48 UTC (rev 16110)
@@ -1,13 +1,20 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <server>
+   <mbean code="org.jboss.soa.esb.common.JBossESBPropertyService"
+      name="jboss.esb:service=PropertyService">
+       <attribute name="PropertyFile">${jboss.server.home.dir}/deploy/jbossesb.sar/jbossesb-properties.xml</attribute>
+   </mbean>
    <mbean code="org.jboss.internal.soa.esb.services.registry.RegistryService"
       name="jboss.esb:service=ESBRegistry">
+       <depends>jboss.esb:service=PropertyService</depends>
    </mbean>
    <mbean code="org.jboss.internal.soa.esb.dependencies.JuddiRMIService"
        name="jboss.esb:service=JuddiRMI"
        description="Juddi RMI Service">
+       <attribute name="PropertiesResourceFile">${jboss.server.home.dir}/deploy/jbossesb.sar/esb.juddi.xml</attribute>
        <depends>jboss.jca:service=DataSourceBinding,name=juddiDB</depends>
+       <depends>jboss.esb:service=PropertyService</depends>
    </mbean>
    <mbean code="org.jboss.soa.esb.listeners.config.JBoss4ESBDeployer"
   	     name="jboss.esb:service=ESBDeployer">

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/JuddiRMIService.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/JuddiRMIService.java	2007-10-27 05:20:07 UTC (rev 16109)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/JuddiRMIService.java	2007-10-27 07:55:48 UTC (rev 16110)
@@ -23,8 +23,6 @@
 package org.jboss.internal.soa.esb.dependencies;
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
 import java.net.URI;
 import java.net.URL;
 import java.util.Properties;
@@ -33,7 +31,10 @@
 
 import org.apache.juddi.registry.rmi.JNDIRegistration;
 import org.apache.log4j.Logger;
+import org.jboss.internal.soa.esb.util.PropertiesHelper;
 import org.jboss.system.ServiceMBeanSupport;
+import org.jboss.system.server.ServerConfig;
+import org.jboss.system.server.ServerConfigLocator;
 
 public class JuddiRMIService extends ServiceMBeanSupport implements JuddiRMIServiceMBean
 {
@@ -42,45 +43,56 @@
    public static final String PROPNAME_JAVA_NAMING_PROVIDER_URL = "java.naming.provider.url";
    public static final String PROPNAME_JAVA_NAMING_FACTORY_URL_PKGS = "java.naming.factory.url.pkgs";
 
-   private String propertiesResourcePath = "esb.juddi.properties";
+   private static final String DEFAULT_PROPERTIES_RESOURCE_FILE = "esb.juddi.xml";
+   private static final String JUDDI_PROPERTIES_RESOURCE_FILE = "esb.juddi.properties";
+   private static final String JUDDI_PROPERTY_FILE_COMMENTS = "Auto generated property file, do not edit" ;
+   
+   private String propertiesResourceFile ;
 
-   public String getPropertiesResourcePath()
+   public String getPropertiesResourceFile()
    {
-      return propertiesResourcePath;
+      return propertiesResourceFile;
    }
 
-   public void setPropertiesResourcePath(String propertiesResourcePath)
+   public void setPropertiesResourceFile(String propertiesResourceFile)
    {
-      this.propertiesResourcePath = propertiesResourcePath;
+      this.propertiesResourceFile = propertiesResourceFile;
    }
 
    protected void startService() throws Exception
 	{
 		logger.info("starting juddi RMI service");
-        URL url = Thread.currentThread().getContextClassLoader().getResource(propertiesResourcePath);
-        URI uri = new URI(url.toString());
-        File confFile = new File(uri);
-		System.setProperty("juddi.propertiesFile", confFile.toString());
+        final File xmlPropertyFile ;
+        if (propertiesResourceFile == null)
+        {
+            URL url = Thread.currentThread().getContextClassLoader().getResource(DEFAULT_PROPERTIES_RESOURCE_FILE);
+            URI uri = new URI(url.toString());
+            xmlPropertyFile = new File(uri) ;
+        }
+        else
+        {
+            xmlPropertyFile = new File(propertiesResourceFile) ;
+        }
+        final ServerConfig serverConfig = ServerConfigLocator.locate() ;
+        final File dataDir = serverConfig.getServerDataDir() ;
+        final File juddiPropertyFile = new File(dataDir, JUDDI_PROPERTIES_RESOURCE_FILE) ;
+        
+        final Properties xmlProperties = PropertiesHelper.translateXMLToText(xmlPropertyFile, juddiPropertyFile, JUDDI_PROPERTY_FILE_COMMENTS) ;
+        System.setProperty("juddi.propertiesFile", juddiPropertyFile.getAbsolutePath());
         System.setProperty("javax.xml.registry.ConnectionFactoryClass","org.apache.ws.scout.registry.ConnectionFactoryImpl");
         
         // Read properties from file and if they exist - pass them on to juddi as system properties
-        Properties properties = new Properties();
-        try {
-            properties.load(new FileInputStream(confFile));
-            String factoryInitial =  properties.getProperty(PROPNAME_JAVA_NAMING_FACTORY_INITIAL, null);
-            String providerURL = properties.getProperty(PROPNAME_JAVA_NAMING_PROVIDER_URL, null); 
-            String factoryURLPkgs = properties.getProperty(PROPNAME_JAVA_NAMING_FACTORY_URL_PKGS, null);
-            if (factoryInitial != null) {
-            	System.setProperty(PROPNAME_JAVA_NAMING_FACTORY_INITIAL, factoryInitial);
-	    }
-	    if (providerURL != null) {
-            	System.setProperty(PROPNAME_JAVA_NAMING_PROVIDER_URL, providerURL);
-	    }
-            if (factoryURLPkgs != null) {
-            	System.setProperty(PROPNAME_JAVA_NAMING_FACTORY_URL_PKGS, factoryURLPkgs);
-            }
-        } catch (IOException e) {
-        	logger.error(e);
+        String factoryInitial =  xmlProperties.getProperty(PROPNAME_JAVA_NAMING_FACTORY_INITIAL, null);
+        String providerURL = xmlProperties.getProperty(PROPNAME_JAVA_NAMING_PROVIDER_URL, null); 
+        String factoryURLPkgs = xmlProperties.getProperty(PROPNAME_JAVA_NAMING_FACTORY_URL_PKGS, null);
+        if (factoryInitial != null) {
+            System.setProperty(PROPNAME_JAVA_NAMING_FACTORY_INITIAL, factoryInitial);
+	}
+	if (providerURL != null) {
+            System.setProperty(PROPNAME_JAVA_NAMING_PROVIDER_URL, providerURL);
+	}
+        if (factoryURLPkgs != null) {
+            System.setProperty(PROPNAME_JAVA_NAMING_FACTORY_URL_PKGS, factoryURLPkgs);
         }
         JNDIRegistration.register();
 	}

Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/JuddiRMIServiceMBean.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/JuddiRMIServiceMBean.java	2007-10-27 05:20:07 UTC (rev 16109)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/dependencies/JuddiRMIServiceMBean.java	2007-10-27 07:55:48 UTC (rev 16110)
@@ -27,9 +27,9 @@
 public interface JuddiRMIServiceMBean extends ServiceMBean
 {
 
-   String getPropertiesResourcePath()
+   String getPropertiesResourceFile()
            ;
 
-   void setPropertiesResourcePath(String propertiesResourcePath)
+   void setPropertiesResourceFile(String propertiesResourceFile)
            ;
 }

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/PropertiesHelper.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/PropertiesHelper.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/PropertiesHelper.java	2007-10-27 07:55:48 UTC (rev 16110)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.internal.soa.esb.util;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Utility functions for processing property files.
+ * @author <a href="mailto:kevin.conner at jboss.com">Kevin Conner</a>
+ */
+public class PropertiesHelper
+{
+    /**
+     * Translate a property file from an XML format to a text format.
+     * @param xmlPropertyFile The XML file
+     * @param propertyFile The property file
+     * @param propertyFileComments The property file comments
+     * @return The properties
+     * @throws IOException for errors during reading/writing.
+     */
+    public static Properties translateXMLToText(final File xmlPropertyFile,
+        final File propertyFile, final String propertyFileComments)
+        throws IOException
+    {
+        final FileInputStream fis = new FileInputStream(xmlPropertyFile) ;
+        try
+        {
+            final FileOutputStream fos = new FileOutputStream(propertyFile) ;
+            try
+            {
+                return translateXMLToText(fis, fos, propertyFileComments) ;
+            }
+            finally
+            {
+                
+                fos.close() ;
+            }
+        }
+        finally
+        {
+            fis.close() ;
+        }
+    }
+    
+    /**
+     * Translate a property file from an XML format to a text format.
+     * @param xmlPropertyInputStream The XML property input stream
+     * @param propertyOutputStream The property output stream
+     * @param propertyFileComments The property file comments
+     * @return The properties
+     * @throws IOException for errors during reading/writing.
+     */
+    public static Properties translateXMLToText(final FileInputStream xmlPropertyInputStream,
+        final FileOutputStream propertyOutputStream, final String propertyFileComments)
+        throws IOException
+    {
+        final Properties xmlProperties = new Properties() ;
+        final BufferedInputStream bis = new BufferedInputStream(xmlPropertyInputStream) ;
+        
+        xmlProperties.loadFromXML(bis) ;
+        
+        final BufferedOutputStream bos = new BufferedOutputStream(propertyOutputStream) ;
+        xmlProperties.store(bos, propertyFileComments) ;
+        bos.flush() ;
+        
+        return xmlProperties ;
+    }
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/internal/soa/esb/util/PropertiesHelper.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java	2007-10-27 07:55:48 UTC (rev 16110)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.common;
+
+import java.io.File;
+
+import org.jboss.soa.esb.ConfigurationException;
+import org.jboss.system.ServiceMBeanSupport;
+
+/**
+ * This MBean wraps the configuration to allow ServiceBindingManager
+ * to alter the configuration.
+ */
+public class JBossESBPropertyService extends ServiceMBeanSupport implements JBossESBPropertyServiceMBean
+{
+    /**
+     * The current property file name.
+     */
+    private String propertyFile ;
+    
+    /**
+     * Get the property file.
+     * @return The name of the property file being used.
+     */
+    public String getPropertyFile()
+    {
+        return propertyFile ;
+    }
+    
+    /**
+     * Set the property file.
+     * @param propertyFile The name of the property file being used.
+     */
+    public void setPropertyFile(final String propertyFile)
+    {
+        this.propertyFile = propertyFile ;
+    }
+    
+    /**
+     * Create the property service.
+     */
+    @Override
+    protected void createService()
+        throws Exception
+    {
+        if (propertyFile != null)
+        {
+            final File propertyFile = new File(this.propertyFile) ;
+            System.setProperty(Environment.PROPERTIES_FILE, "abs://" + propertyFile.getAbsolutePath());
+        }
+    }
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyService.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Added: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyServiceMBean.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyServiceMBean.java	                        (rev 0)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyServiceMBean.java	2007-10-27 07:55:48 UTC (rev 16110)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated 
+ * by the @authors tag. All rights reserved. 
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors. 
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A 
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
+ * MA  02110-1301, USA.
+ * 
+ * (C) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.common;
+
+import org.jboss.system.ServiceMBean;
+
+/**
+ * This MBean wraps the configuration to allow ServiceBindingManager
+ * to alter the configuration.
+ */
+public interface JBossESBPropertyServiceMBean extends ServiceMBean
+{
+    /**
+     * Get the property file.
+     * @return The name of the property file being used.
+     */
+    public String getPropertyFile() ;
+    /**
+     * Set the property file.
+     * @param propertyFile The name of the property file being used.
+     */
+    public void setPropertyFile(final String propertyFile) ;
+}


Property changes on: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/common/JBossESBPropertyServiceMBean.java
___________________________________________________________________
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native

Modified: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksConfiguration.java
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksConfiguration.java	2007-10-27 05:20:07 UTC (rev 16109)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksConfiguration.java	2007-10-27 07:55:48 UTC (rev 16110)
@@ -23,6 +23,8 @@
 import org.jboss.soa.esb.util.ClassUtil;
 
 import java.util.Properties;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.InputStream;
 import java.io.IOException;
 
@@ -35,12 +37,35 @@
 
     private static final Logger logger = Logger.getLogger(SmooksConfiguration.class);
     public static final String SMOOKS_ESB_PROPERTIES = "/smooks.esb.properties";
+    
+    private static volatile String defaultConfiguration ;
 
     SmooksConfiguration() {
         InputStream configStream = ClassUtil.getResourceAsStream(SMOOKS_ESB_PROPERTIES, SmooksConfiguration.class);
 
         if(configStream == null) {
-            logger.warn("Smooks.esb configuration file '" + SMOOKS_ESB_PROPERTIES + "' not found on classpath.");
+            final String defaultConfiguration = SmooksConfiguration.defaultConfiguration ;
+            if (defaultConfiguration != null) {
+                try {
+                    final FileInputStream fis = new FileInputStream(defaultConfiguration) ;
+                    try {
+                        load(fis) ;
+                    } catch (IOException e) {
+                        logger.warn("Error loading Smooks.esb default configuration file '" + defaultConfiguration + "'.", e);
+                    }
+                    finally {
+                        try {
+                            fis.close() ;
+                        } catch (IOException e) {
+                            logger.warn("Error closing stream for Smooks.esb default configuration file '" + defaultConfiguration + "'.", e);
+                        }
+                    }
+                } catch (final FileNotFoundException fnfe) {
+                    logger.warn("Smooks.esb default configuration file '" + defaultConfiguration + "' not found.");
+                }
+            } else {
+                logger.warn("Smooks.esb configuration file '" + SMOOKS_ESB_PROPERTIES + "' not found on classpath.");
+            }
         } else {
             try {
                 load(configStream);
@@ -55,4 +80,22 @@
             }
         }
     }
+    
+    /**
+     * Set the default configuration file.
+     * @param defaultConfiguration The default configuration file.
+     */
+    public static void setDefaultConfiguration(final String defaultConfiguration)
+    {
+        SmooksConfiguration.defaultConfiguration = defaultConfiguration ;
+    }
+    
+    /**
+     * Get the default configuration file.
+     * @return the default configuration file.
+     */
+    public static String getDefaultConfiguration()
+    {
+        return defaultConfiguration ;
+    }
 }

Modified: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksService.java
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksService.java	2007-10-27 05:20:07 UTC (rev 16109)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksService.java	2007-10-27 07:55:48 UTC (rev 16110)
@@ -19,9 +19,13 @@
  */
 package org.jboss.soa.esb.actions.converters;
 
+import org.jboss.internal.soa.esb.util.PropertiesHelper;
 import org.jboss.system.ServiceMBeanSupport;
+import org.jboss.system.server.ServerConfig;
+import org.jboss.system.server.ServerConfigLocator;
 import org.apache.log4j.Logger;
 
+import java.io.File;
 import java.util.Properties;
 
 /**
@@ -37,8 +41,26 @@
     private static SmooksInstanceManager globalSmooksInstanceManager;
     private static final String CONSOLE_URL = "console.url";
 
+    private static final String SMOOKS_PROPERTY_FILE = "smooks.esb.properties";
+    private static final String SMOOKS_PROPERTY_FILE_COMMENTS = "Auto generated property file, do not edit" ;
+
+    /**
+     * The smooks default property file.
+     */
+    private String propertyFile ;
+    
     protected void startService() throws Exception {
         super.startService();
+        
+        if (propertyFile != null) {
+            final File xmlPropertyFile = new File(propertyFile) ;
+            final ServerConfig serverConfig = ServerConfigLocator.locate() ;
+            final File dataDir = serverConfig.getServerDataDir() ;
+            final File smooksPropertyFile = new File(dataDir, SMOOKS_PROPERTY_FILE) ;
+            
+            PropertiesHelper.translateXMLToText(xmlPropertyFile, smooksPropertyFile, SMOOKS_PROPERTY_FILE_COMMENTS) ;
+            SmooksConfiguration.setDefaultConfiguration(smooksPropertyFile.getAbsolutePath()) ;
+        }
 
         Properties smooksEsbConfig = new SmooksConfiguration();
         String resourceConfig = smooksEsbConfig.getProperty(CONSOLE_URL);
@@ -63,4 +85,20 @@
     public static SmooksInstanceManager getGlobalSmooksInstanceManager() {
         return globalSmooksInstanceManager;
     }
+    
+    /**
+     * Get the property file.
+     * @return The name of the property file being used.
+     */
+    public String getPropertyFile() {
+        return propertyFile ;
+    }
+    
+    /**
+     * Set the property file.
+     * @param propertyFile The name of the property file being used.
+     */
+    public void setPropertyFile(final String propertyFile) {
+        this.propertyFile = propertyFile ;
+    }
 }

Modified: labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksServiceMBean.java
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksServiceMBean.java	2007-10-27 05:20:07 UTC (rev 16109)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/java/org/jboss/soa/esb/actions/converters/SmooksServiceMBean.java	2007-10-27 07:55:48 UTC (rev 16110)
@@ -29,4 +29,14 @@
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
  */
 public interface SmooksServiceMBean extends ServiceMBean {
+    /**
+     * Get the property file.
+     * @return The name of the property file being used.
+     */
+    public String getPropertyFile() ;
+    /**
+     * Set the property file.
+     * @param propertyFile The name of the property file being used.
+     */
+    public void setPropertyFile(final String propertyFile) ;
 }

Modified: labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-service.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-service.xml	2007-10-27 05:20:07 UTC (rev 16109)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks-service.xml	2007-10-27 07:55:48 UTC (rev 16110)
@@ -2,6 +2,8 @@
 <service>
     <mbean code="org.jboss.soa.esb.actions.converters.SmooksService"
            name="jboss.esb:service=SmooksService">
+        <attribute name="PropertyFile">${jboss.server.home.dir}/deploy/smooks.esb/smooks.esb.xml</attribute>
+
         <depends>jboss.esb.destination:service=Topic,name=org.jboss.soa.esb.transformation.Update</depends>
     </mbean>
 </service>

Deleted: labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks.esb.properties
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks.esb.properties	2007-10-27 05:20:07 UTC (rev 16109)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks.esb.properties	2007-10-27 07:55:48 UTC (rev 16110)
@@ -1,35 +0,0 @@
-####################################################################################
-# Configure in the following property to enable config loading
-# from the Transformation Admin Console.
-####################################################################################
-#console.url=http://localhost:8080/jboss-esb-console/transform/smooks-config.jsp
-
-####################################################################################
-#
-# Base configurations.  Added for all non-console based Smooks instances.
-# Value is comma-separated-list.  All resources must be in the "smooks-base-configs"
-# folder of this .esb.
-# 
-####################################################################################
-smooks.base.configs=creators.xml
-
-####################################################################################
-#
-# Context properties.
-#
-# Defaults to JBoss AS on localhost.
-# 
-####################################################################################
-java.naming.provider.url=localhost
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.factory.url.pkgs=
-
-####################################################################################
-#
-# JMS properties.
-#
-# Provider defaults to JBoss MQ.
-# 
-####################################################################################
-javax.jms.ConnectionFactory=ConnectionFactory
-update.notification.topic=topic/org.jboss.soa.esb.transformation.Update
\ No newline at end of file

Added: labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks.esb.xml
===================================================================
--- labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks.esb.xml	                        (rev 0)
+++ labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks.esb.xml	2007-10-27 07:55:48 UTC (rev 16110)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+<properties>
+  <!--
+    Configure in the following property to enable config loading
+    from the Transformation Admin Console.
+  -->
+  <!--
+  <entry key="console.url">http://localhost:8080/jboss-esb-console/transform/smooks-config.jsp</entry>
+  -->
+
+  <!--
+    Base configurations.  Added for all non-console based Smooks instances.
+    Value is comma-separated-list.  All resources must be in the
+    "smooks-base-configs" folder of this .esb.
+  -->
+  <entry key="smooks.base.configs">creators.xml</entry>
+
+  <!--
+    Context properties.
+   
+    Defaults to JBoss AS on localhost.
+  -->
+  <entry key="java.naming.provider.url">localhost</entry>
+  <entry key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</entry>
+  <!--
+  <entry key="java.naming.factory.url.pkgs"></entry>
+  -->
+
+  <!--
+    JMS properties.
+
+    Provider defaults to JBoss MQ.
+  -->
+  <entry key="javax.jms.ConnectionFactory">ConnectionFactory</entry>
+  <entry key="update.notification.topic">topic/org.jboss.soa.esb.transformation.Update</entry>
+</properties>


Property changes on: labs/jbossesb/trunk/product/services/smooks/src/main/resources/smooks.esb.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:keywords
   + Rev Date
Name: svn:eol-style
   + native




More information about the jboss-svn-commits mailing list