activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r521386 - /activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/
Date Thu, 22 Mar 2007 18:02:54 GMT
Author: rajdavies
Date: Thu Mar 22 11:02:53 2007
New Revision: 521386

URL: http://svn.apache.org/viewvc?view=rev&rev=521386
Log:
Use DefaultComponent

Added:
    activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiComponent.java
      - copied, changed from r521321, activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelServiceEngine.java
    activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiEndpoint.java
      - copied, changed from r521329, activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelServiceEngineEndpoint.java
Removed:
    activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelContainerBootstrap.java
    activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelContainerDeployer.java
    activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelEndpointComponent.java
    activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelServiceEngine.java
    activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelServiceEngineEndpoint.java

Copied: activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiComponent.java
(from r521321, activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelServiceEngine.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiComponent.java?view=diff&rev=521386&p1=activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelServiceEngine.java&r1=521321&p2=activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiComponent.java&r2=521386
==============================================================================
--- activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelServiceEngine.java
(original)
+++ activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiComponent.java
Thu Mar 22 11:02:53 2007
@@ -1,56 +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.
+ * 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.camel.component.jbi;
 
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.servicemix.common.BaseComponent;
-import org.apache.servicemix.common.BaseServiceUnitManager;
-import org.apache.servicemix.common.Deployer;
+import java.util.List;
+import org.apache.servicemix.common.DefaultComponent;
 
 /**
  * Deploys the camel endpoints within JBI
+ * 
  * @version $Revision: 426415 $
  */
-public class CamelServiceEngine extends BaseComponent {
-    
-    private RouteBuilder[] builders;
+public class CamelJbiComponent extends DefaultComponent{
+
+    private CamelJbiEndpoint[] endpoints;
 
-    /* (non-Javadoc)
-     * @see org.servicemix.common.BaseComponent#createServiceUnitManager()
+    /**
+     * @return the endpoints
      */
-    public BaseServiceUnitManager createServiceUnitManager() {
-        Deployer[] deployers = new Deployer[] { new CamelContainerDeployer(this,builders)
};
-        return new BaseServiceUnitManager(this, deployers);
+    public CamelJbiEndpoint[] getEndpoints(){
+        return this.endpoints;
     }
 
-    
     /**
-     * @return the builders
+     * @param endpoints the endpoints to set
      */
-    public RouteBuilder[] getBuilders(){
-        return this.builders;
+    public void setEndpoints(CamelJbiEndpoint[] endpoints){
+        this.endpoints=endpoints;
     }
 
-    
     /**
-     * @param builders the builders to set
+     * @return List of endpoints
+     * @see org.apache.servicemix.common.DefaultComponent#getConfiguredEndpoints()
      */
-    public void setBuilders(RouteBuilder[] builders){
-        this.builders=builders;
+    @Override protected List getConfiguredEndpoints(){
+        return asList(getEndpoints());
     }
 
+    /**
+     * @return Class[]
+     * @see org.apache.servicemix.common.DefaultComponent#getEndpointClasses()
+     */
+    @Override protected Class[] getEndpointClasses(){
+        return new Class[] { CamelJbiEndpoint.class };
+    }
 }

Copied: activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiEndpoint.java
(from r521329, activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelServiceEngineEndpoint.java)
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiEndpoint.java?view=diff&rev=521386&p1=activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelServiceEngineEndpoint.java&r1=521329&p2=activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiEndpoint.java&r2=521386
==============================================================================
--- activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelServiceEngineEndpoint.java
(original)
+++ activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiEndpoint.java
Thu Mar 22 11:02:53 2007
@@ -1,73 +1,48 @@
 /*
- * 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.
+ * 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.camel.component.jbi;
 
-import javax.jbi.component.ComponentContext;
 import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
-import javax.jbi.messaging.MessageExchange.Role;
+import javax.jbi.messaging.NormalizedMessage;
 import javax.xml.namespace.QName;
-import org.apache.camel.CamelContext;
-import org.apache.servicemix.MessageExchangeListener;
-import org.apache.servicemix.common.ExchangeProcessor;
-import org.apache.servicemix.jbi.container.JBIContainer;
-import org.apache.servicemix.jbi.framework.ComponentContextImpl;
+import org.apache.servicemix.common.endpoints.ProviderEndpoint;
 
 /**
  * The endpoint in the service engine
+ * 
  * @version $Revision: 426415 $
  */
-public class CamelServiceEngineEndpoint extends org.apache.servicemix.common.Endpoint {
-
-    private static final QName SERVICE_NAME = new QName("http://camel.servicemix.org", "CamelEndpointComponent");
-    
-    private CamelContext camelContext;
-    private CamelEndpointComponent camelEndpointComponent;
-    
-    public CamelServiceEngineEndpoint(CamelContext camelContext,JbiEndpoint jbiEndpoint)
{
-        this.camelEndpointComponent = new CamelEndpointComponent(camelContext,jbiEndpoint);
-        this.service = SERVICE_NAME;
-        this.endpoint=jbiEndpoint.getEndpointUri();
-    }
-    
-    public Role getRole() {
-        throw new UnsupportedOperationException();
-    }
+public class CamelJbiEndpoint extends ProviderEndpoint{
 
-    public void activate() throws Exception {
-        getContainer().activateComponent(camelEndpointComponent,camelEndpointComponent.getName());
-    }
+    private static final QName SERVICE_NAME=new QName("http://camel.servicemix.org","CamelEndpointComponent");
+    private JbiEndpoint jbiEndpoint;
 
-    public void deactivate() throws Exception {
-        getContainer().deactivateComponent(camelEndpointComponent.getName());
+    public CamelJbiEndpoint(JbiEndpoint jbiEndpoint){
+        this.jbiEndpoint=jbiEndpoint;
+        this.service=SERVICE_NAME;
+        this.endpoint=jbiEndpoint.getEndpointUri();
     }
 
-    public ExchangeProcessor getProcessor() {
-        throw new UnsupportedOperationException();
+    protected void processInOnly(MessageExchange exchange,NormalizedMessage in) throws Exception{
+        /*
+         * ToDo
+         */
     }
 
-    public JBIContainer getContainer() {
-        ComponentContext context = getServiceUnit().getComponent().getComponentContext();
-        if( context instanceof ComponentContextImpl ) {
-            return ((ComponentContextImpl) context).getContainer();
-        }
-        throw new IllegalStateException("LwContainer component can only be deployed in ServiceMix");
+    protected void processInOut(MessageExchange exchange,NormalizedMessage in,NormalizedMessage
out) throws Exception{
+        /*
+         * ToDo
+         */
     }
-    
-   
-
 }



Mime
View raw message