[jboss-svn-commits] JBL Code SVN: r33587 - in labs/jbossrules/trunk/drools-pipeline/drools-camel/src/main/java/org/drools: pipeline and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Jun 21 23:59:47 EDT 2010


Author: hzbarcea
Date: 2010-06-21 23:59:47 -0400 (Mon, 21 Jun 2010)
New Revision: 33587

Removed:
   labs/jbossrules/trunk/drools-pipeline/drools-camel/src/main/java/org/drools/camel/component/DroolsProxyEndpoint.java
   labs/jbossrules/trunk/drools-pipeline/drools-camel/src/main/java/org/drools/camel/component/DroolsProxyProducer.java
   labs/jbossrules/trunk/drools-pipeline/drools-camel/src/main/java/org/drools/pipeline/camel/
Log:
JBRULES-2347 Drools Pipeline integration with Camel
- cleanup of unnecessary classes after removal of secondary route.



Deleted: labs/jbossrules/trunk/drools-pipeline/drools-camel/src/main/java/org/drools/camel/component/DroolsProxyEndpoint.java
===================================================================
--- labs/jbossrules/trunk/drools-pipeline/drools-camel/src/main/java/org/drools/camel/component/DroolsProxyEndpoint.java	2010-06-22 03:56:04 UTC (rev 33586)
+++ labs/jbossrules/trunk/drools-pipeline/drools-camel/src/main/java/org/drools/camel/component/DroolsProxyEndpoint.java	2010-06-22 03:59:47 UTC (rev 33587)
@@ -1,140 +0,0 @@
-/*
- *  Licensed 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.
- *  under the License.
- */
-
-package org.drools.camel.component;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Consumer;
-import org.apache.camel.Processor;
-import org.apache.camel.Producer;
-import org.apache.camel.RuntimeCamelException;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.camel.model.ProcessorDefinition;
-import org.drools.grid.ExecutionNode;
-import org.drools.pipeline.camel.DroolsCamelContextInit;
-
-public class DroolsProxyEndpoint extends DefaultEndpoint {
-
-    private String id;
-    private String uri;
-    private String dataFormat;
-    private String xstream;
-    private String marshall;
-    private String unmarshall;
-    private RouteBuilder builder;
-    
-    public DroolsProxyEndpoint(String endpointUri, String remaining, DroolsComponent component) throws Exception {
-        super(endpointUri, component);
-        configure(component, remaining);
-    }
-
-    public Consumer createConsumer(Processor processor) throws Exception {
-        throw new RuntimeCamelException("Drools consumers not supported.");
-    }
-
-    public Producer createProducer() throws Exception {
-        // let's setup a route first
-        // we'll come up with a better way later
-        // final DataFormat xstream = new DroolsXStreamDataFormat();
-
-        if (builder == null) {
-            String nodeId = DroolsComponent.getSessionManagerId(uri);
-            final ExecutionNode node = (ExecutionNode)getCamelContext().getRegistry().lookup(nodeId);
-            if (node == null) {
-                throw new RuntimeCamelException("Cannot find ExecutionNode instance with id=\"" + 
-                    nodeId + "\" in the CamelContext registry.");
-            }
-
-            final String inFormat = (dataFormat == null) ? unmarshall : dataFormat;
-            final String outFormat = (dataFormat == null) ? marshall : dataFormat;
-            builder = new RouteBuilder() {
-                public void configure() throws Exception {
-                    // build the route step by step
-                    ProcessorDefinition<?> pipeline = from("direct:" + id).bean(new DroolsCamelContextInit(node));
-                    if (inFormat != null) {
-                        pipeline = pipeline.unmarshal(inFormat);
-                    }
-                    pipeline = pipeline.to("drools-embedded:" + uri);
-                    if (inFormat != null) {
-                        pipeline = pipeline.marshal(outFormat);
-                    }
-                }
-            };
-            
-            getEmbeddedContext().addRoutes(builder);
-        }
-        return new DroolsProxyProducer(this);
-    }
-
-    public boolean isSingleton() {
-        return true;
-    }
-
-    protected void configure(DroolsComponent component, String uri) throws Exception {
-        this.uri = uri;
-        // create unique id for embedded route
-        id = DroolsComponent.generateUuid();
-    }
-
-    @Override
-    public boolean isLenientProperties(){
-        return true;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public String getDataFormat() {
-        return dataFormat;
-    }
-
-    public void setDataFormat(String dataFormat) {
-        this.dataFormat = dataFormat;
-    }
-
-    public void setXstream(String xstream) {
-		this.xstream = xstream;
-	}
-
-	public String getXstream() {
-		return xstream;
-	}
-
-	public String getMarshall() {
-        return marshall;
-    }
-
-    public void setMarshall(String marshall) {
-        this.marshall = marshall;
-    }
-
-    public String getUnmarshall() {
-        return unmarshall;
-    }
-
-    public void setUnmarshall(String unmarshall) {
-        this.unmarshall = unmarshall;
-    }
-
-    public CamelContext getEmbeddedContext() {
-        return ((DroolsComponent)getComponent()).getEmbeddedContext();
-    }
-}

Deleted: labs/jbossrules/trunk/drools-pipeline/drools-camel/src/main/java/org/drools/camel/component/DroolsProxyProducer.java
===================================================================
--- labs/jbossrules/trunk/drools-pipeline/drools-camel/src/main/java/org/drools/camel/component/DroolsProxyProducer.java	2010-06-22 03:56:04 UTC (rev 33586)
+++ labs/jbossrules/trunk/drools-pipeline/drools-camel/src/main/java/org/drools/camel/component/DroolsProxyProducer.java	2010-06-22 03:59:47 UTC (rev 33587)
@@ -1,40 +0,0 @@
-/*
- *  Licensed 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.
- *  under the License.
- */
-
-package org.drools.camel.component;
-
-import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.impl.DefaultProducer;
-import org.apache.camel.util.ExchangeHelper;
-
-public class DroolsProxyProducer extends DefaultProducer {
-    private Endpoint droolsEndpoint;
-    private ProducerTemplate template;
-
-    public DroolsProxyProducer(Endpoint endpoint) {
-        super(endpoint);
-        DroolsProxyEndpoint de = (DroolsProxyEndpoint)endpoint;
-        droolsEndpoint = de.getEmbeddedContext().getEndpoint("direct:" + de.getId());
-        template = endpoint.getCamelContext().createProducerTemplate();
-        
-    }
-
-    public void process(Exchange exchange) throws Exception {
-        Exchange result = template.send(droolsEndpoint, exchange.copy());
-        exchange.getOut().copyFrom(ExchangeHelper.getResultMessage(result));
-    }
-}



More information about the jboss-svn-commits mailing list