Author: ruwan
Date: Mon Nov 24 03:25:41 2008
New Revision: 24709
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=24709

Log:
task fixes for synapse (task code need to be revisited :-()

Added:
   trunk/esb/java/modules/core/src/main/java/org/
   trunk/esb/java/modules/core/src/main/java/org/wso2/
   trunk/esb/java/modules/core/src/main/java/org/wso2/esb/
   trunk/esb/java/modules/core/src/main/java/org/wso2/esb/core/
   trunk/esb/java/modules/core/src/main/java/org/wso2/esb/core/ESBActivator.java
Modified:
   trunk/esb/java/modules/core/pom.xml
   trunk/esb/java/modules/distribution/pom.xml
   trunk/esb/java/modules/distribution/src/main/assembly/bin.xml

Modified: trunk/esb/java/modules/core/pom.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/core/pom.xml?rev=24709&r1=24708&r2=24709&view=diff
==============================================================================
--- trunk/esb/java/modules/core/pom.xml (original)
+++ trunk/esb/java/modules/core/pom.xml Mon Nov 24 03:25:41 2008
@@ -9,8 +9,9 @@
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
+    <groupId>org.wso2.esb</groupId>
     <artifactId>org.wso2.esb.core</artifactId>
-    <packaging>jar</packaging>
+    <packaging>bundle</packaging>
     <name>WSO2 ESB Core</name>
     <url>http://wso2.org</url>
     <description>WSO2 Enterprise Service Bus Core Bundle</description>
@@ -23,6 +24,12 @@
     </repositories>
 
     <dependencies>
+
+        <dependency>
+            <groupId>org.apache.synapse</groupId>
+            <artifactId>synapse-core</artifactId>
+            <version>1.2.wso2v1</version>
+        </dependency>
     
         <dependency>
             <groupId>org.apache.felix</groupId>
@@ -89,7 +96,7 @@
 
     <build>
         <plugins>
-            <!--<plugin>
+            <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
@@ -98,16 +105,6 @@
                 </configuration>
             </plugin>
             <plugin>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <inherited>true</inherited>
-                <configuration>
-                    <forkMode>pertest</forkMode>
-                    <argLine>-enableassertions</argLine>
-                    <testFailureIgnore>false</testFailureIgnore>
-                    <skip>true</skip>
-                </configuration>
-            </plugin>
-            <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
                 <version>1.4.0</version>
@@ -117,11 +114,13 @@
                         
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
                         <Bundle-Name>${pom.artifactId}</Bundle-Name>
                         <Bundle-Version>1.0.0</Bundle-Version>
+                        
<Bundle-Activator>org.wso2.esb.core.ESBActivator</Bundle-Activator>
                         <Export-Package>
                             org.wso2.esb.core.*; version=1.0.0,
                         </Export-Package>
                         <Import-Package>
                             !org.wso2.esb.core,
+                            org.apache.synapse.*,
                             *;resolution:=optional
                         </Import-Package>
                         <Require-Bundle>
@@ -130,37 +129,7 @@
                         <DynamicImport-Package>*</DynamicImport-Package>
                     </instructions>
                 </configuration>
-            </plugin>-->
-            <!--<plugin>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-antrun-plugin</artifactId>
-                    <executions>
-                        <execution>
-                            <id>generate-test-repository</id>
-                            <phase>generate-test-sources</phase>
-                            <configuration>
-                                <tasks>
-                                    
<echo>######################################</echo>
-                                    <echo>creating repository for data 
services</echo>
-                                    
<echo>######################################</echo>
-                                    <mkdir dir="${basedir}/target/repository"/>
-                                    <mkdir 
dir="${basedir}/target/repository/dataservices"/>
-                                    <mkdir 
dir="${basedir}/target/repository/services"/>
-                                    <mkdir 
dir="${basedir}/target/repository/modules"/>
-                                    <property name="sample_dbs_files_dir" 
value="${basedir}/src/test/resources/test-dbs"/>
-                                    <copy 
todir="${basedir}/target/repository/dataservices">
-                                      <fileset dir="${sample_dbs_files_dir}">
-                                       <include name="**/*.dbs"/>
-                                      </fileset>
-                                    </copy>                                    
-                                </tasks>
-                            </configuration>
-                            <goals>
-                                <goal>run</goal>
-                            </goals>
-                        </execution>
-                    </executions>
-              </plugin>-->
+            </plugin>
         </plugins>
     </build>
 

Added: 
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/core/ESBActivator.java
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/core/src/main/java/org/wso2/esb/core/ESBActivator.java?pathrev=24709
==============================================================================
--- (empty file)
+++ 
trunk/esb/java/modules/core/src/main/java/org/wso2/esb/core/ESBActivator.java   
    Mon Nov 24 03:25:41 2008
@@ -0,0 +1,77 @@
+package org.wso2.esb.core;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.synapse.Startup;
+import org.apache.synapse.SynapseConstants;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.synapse.core.SynapseEnvironment;
+import org.osgi.framework.*;
+import org.wso2.carbon.utils.ConfigurationContextService;
+
+/**
+ *
+ */
+public class ESBActivator implements BundleActivator, BundleListener {
+
+    BundleContext bundleContext;
+
+    public void start(BundleContext bundleContext) throws Exception {
+        this.bundleContext = bundleContext;
+        initESB();
+    }
+
+    public void stop(BundleContext bundleContext) throws Exception {
+    }
+
+    public void bundleChanged(BundleEvent event) {
+
+        if 
(!event.getBundle().getSymbolicName().equals("org.wso2.carbon.core")) {
+            return;
+        }
+
+        if (event.getType() == BundleEvent.STARTED) {
+            initESB();
+        }
+    }
+
+    private void initESB() {
+        SynapseConfiguration synConfig = null;
+            ServiceReference ref = 
bundleContext.getServiceReference(ConfigurationContextService.class.getName());
+            Object serviceObject = bundleContext.getService(ref);
+            if (serviceObject instanceof ConfigurationContextService) {
+                ConfigurationContext configContext = 
((ConfigurationContextService)
+                        serviceObject).getServerConfigContext();
+                AxisConfiguration axisConf = 
configContext.getAxisConfiguration();
+                Parameter synEnv
+                        = axisConf.getParameter(SynapseConstants.SYNAPSE_ENV);
+                Parameter synCfg
+                        = 
axisConf.getParameter(SynapseConstants.SYNAPSE_CONFIG);
+
+                String message = "Unable to initialize the Synapse 
Configuration : Cannot find the ";
+                if (synCfg == null || synCfg.getValue() == null
+                        || !(synCfg.getValue() instanceof 
SynapseConfiguration)) {
+                    return;
+                } else {
+                    synConfig = (SynapseConfiguration) synCfg.getValue();
+                }
+
+                if (synEnv == null || synEnv.getValue() == null
+                        || !(synEnv.getValue() instanceof SynapseEnvironment)) 
{
+                    return;
+                } else {
+
+                    ((SynapseEnvironment) 
synEnv.getValue()).setInitialized(true);
+
+                    // initialize the startups
+                    for (Startup stp : synConfig.getStartups()) {
+                        if (stp != null) {
+                            stp.init((SynapseEnvironment) synEnv.getValue());
+                        }
+                    }
+                }
+            }
+    }
+}

Modified: trunk/esb/java/modules/distribution/pom.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/distribution/pom.xml?rev=24709&r1=24708&r2=24709&view=diff
==============================================================================
--- trunk/esb/java/modules/distribution/pom.xml (original)
+++ trunk/esb/java/modules/distribution/pom.xml Mon Nov 24 03:25:41 2008
@@ -31,6 +31,12 @@
         </dependency>
 
         <dependency>
+            <groupId>org.wso2.esb</groupId>
+            <artifactId>org.wso2.esb.core</artifactId>
+            <version>${pom.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>org.apache.synapse</groupId>
             <artifactId>synapse-transports</artifactId>
             <version>${synapse.version}</version>

Modified: trunk/esb/java/modules/distribution/src/main/assembly/bin.xml
URL: 
http://wso2.org/svn/browse/wso2/trunk/esb/java/modules/distribution/src/main/assembly/bin.xml?rev=24709&r1=24708&r2=24709&view=diff
==============================================================================
--- trunk/esb/java/modules/distribution/src/main/assembly/bin.xml       
(original)
+++ trunk/esb/java/modules/distribution/src/main/assembly/bin.xml       Mon Nov 
24 03:25:41 2008
@@ -48,6 +48,7 @@
                 <include>org.apache.synapse:synapse-tasks:jar</include>
                 <!-- ESB bundles -->
                 <include>org.wso2.esb:org.wso2.esb.styles:jar</include>
+                <include>org.wso2.esb:org.wso2.esb.core:jar</include>
                 <!-- Component bundles-->
                 
<include>org.wso2.carbon:org.wso2.carbon.mediation.utils:jar</include>
                 
<include>org.wso2.carbon:org.wso2.carbon.sequences:jar</include>

_______________________________________________
Esb-java-dev mailing list
[email protected]
https://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev

Reply via email to