You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ch...@apache.org on 2007/06/12 20:20:19 UTC
svn commit: r546580 [1/3] - in /activemq/camel/trunk:
camel-core/src/main/java/org/apache/camel/
camel-core/src/main/java/org/apache/camel/builder/
camel-core/src/main/java/org/apache/camel/component/direct/
camel-core/src/main/java/org/apache/camel/co...
Author: chirino
Date: Tue Jun 12 11:20:13 2007
New Revision: 546580
URL: http://svn.apache.org/viewvc?view=rev&rev=546580
Log:
Ran find . -name *.java | grep -v .svn | xargs -n 1 svn propset svn:eol-style native
Modified:
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelException.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Component.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Expression.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Fluent.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FluentArg.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/InterceptorBuilder.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PolicyBuilder.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXComponent.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXConsumer.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXEndpoint.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXExchange.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXMessage.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoComponent.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoEndpoint.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoExchange.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoInvocation.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/timer/TimerComponent.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/timer/TimerConsumer.java (contents, props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/timer/TimerEndpoint.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueComponent.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueEndpoint.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/CollectionConverter.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/NoPolicy.java (contents, props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/ArrayTypeConverter.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/PropertyEditorTypeConverter.java (contents, props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/ToStringTypeConverter.java (contents, props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateProcessor.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Marshaller.java (contents, props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Policy.java (contents, props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Unmarshaller.java (contents, props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlMarshaller.java (contents, props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlUnmarshaller.java (contents, props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/Time.java (props changed)
activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java (contents, props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/InterceptorBuilderTest.java (contents, props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/MyInterceptorProcessor.java (props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/MyProcessor.java (props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/direct/DirectRouteTest.java (props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/ISay.java (props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/PojoRouteTest.java (props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/SayService.java (props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/pojo/timer/TimerRouteTest.java (props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/queue/QueueRouteTest.java (props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java (contents, props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ChoiceTest.java (props changed)
activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/JoinRoutesTest.java (props changed)
activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/ActivityBuilder.java (props changed)
activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/ProcessBuilder.java (props changed)
activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/TimeExpression.java (props changed)
activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/model/ActivityState.java (props changed)
activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/model/EntitySupport.java (props changed)
activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/model/ProcessInstance.java (props changed)
activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/model/TemporalEntity.java (props changed)
activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/processor/BamProcessorSupport.java (props changed)
activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/processor/JpaBamProcessor.java (props changed)
activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/processor/JpaBamProcessorSupport.java (props changed)
activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/processor/NoCorrelationKeyException.java (props changed)
activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/rules/ActivityRules.java (props changed)
activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/rules/ProcessRules.java (props changed)
activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/rules/TemporalRule.java (props changed)
activemq/camel/trunk/components/camel-bam/src/test/java/org/apache/camel/bam/BamRouteTest.java (props changed)
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/HttpConsumer.java (props changed)
activemq/camel/trunk/components/camel-http/src/main/java/org/apache/camel/component/http/JettyHttpComponent.java (props changed)
activemq/camel/trunk/components/camel-http/src/test/java/org/apache/camel/component/http/HttpRouteTest.java (props changed)
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java (props changed)
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteUsingSpringAndJmsNameTest.java (props changed)
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteUsingSpringTest.java (props changed)
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteUsingSpringWithAutoWireTest.java (props changed)
activemq/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/TransactedJmsRouteTest.java (contents, props changed)
activemq/camel/trunk/components/camel-josql/src/main/java/org/apache/camel/builder/sql/SqlBuilder.java (props changed)
activemq/camel/trunk/components/camel-josql/src/test/java/org/apache/camel/builder/sql/Person.java (props changed)
activemq/camel/trunk/components/camel-josql/src/test/java/org/apache/camel/builder/sql/SqlTest.java (props changed)
activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiComponent.java (contents, props changed)
activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiConsumer.java (contents, props changed)
activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiEndpoint.java (contents, props changed)
activemq/camel/trunk/components/camel-rmi/src/main/java/org/apache/camel/component/rmi/RmiProducer.java (contents, props changed)
activemq/camel/trunk/components/camel-rmi/src/test/java/org/apache/camel/component/rmi/ISay.java (props changed)
activemq/camel/trunk/components/camel-rmi/src/test/java/org/apache/camel/component/rmi/RmiRouteTest.java (props changed)
activemq/camel/trunk/components/camel-rmi/src/test/java/org/apache/camel/component/rmi/SayService.java (props changed)
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelProxyFactoryBean.java (contents, props changed)
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/remoting/CamelServiceExporter.java (contents, props changed)
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java (contents, props changed)
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/BuilderAction.java (props changed)
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/BuilderStatement.java (props changed)
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelBeanDefinitionParser.java (props changed)
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/CamelNamespaceHandler.java (props changed)
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/IllegalActionException.java (props changed)
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/MethodInfo.java (props changed)
activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/xml/RouteBuilderFactoryBean.java (props changed)
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBean.java (props changed)
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/InjectedBeanTest.java (props changed)
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MyConsumer.java (props changed)
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/MySender.java (props changed)
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/PojoConsumerTest.java (props changed)
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/example/PojoSenderTest.java (props changed)
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/ISay.java (props changed)
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SayService.java (props changed)
activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingRouteTest.java (props changed)
activemq/camel/trunk/tests/camel-itest/src/main/java/org/apache/camel/itest/jms/JmsIntegrationTest.java (contents, props changed)
activemq/camel/trunk/tooling/camel-eclipse/camel.routing.editor/src-gen/org/apache/camel/eclipse/GeneratedPartitionScanner.java (contents, props changed)
activemq/camel/trunk/tooling/camel-eclipse/camel.routing.editor/src-gen/org/apache/camel/eclipse/camelUtilities.java (contents, props changed)
activemq/camel/trunk/tooling/camel-eclipse/camel.routing.editor/src/org/apache/camel/eclipse/camelEditorPlugin.java (contents, props changed)
activemq/camel/trunk/tooling/camel-eclipse/camel.routing.editor/src/org/apache/camel/eclipse/editor/camelEditor.java (contents, props changed)
activemq/camel/trunk/tooling/camel-eclipse/camel.routing/src-gen/org/apache/camel/eclipse/parser/ParserComponent.java (contents, props changed)
activemq/camel/trunk/tooling/camel-eclipse/camel.routing/src-gen/org/apache/camel/eclipse/parser/camelLexer.java (contents, props changed)
activemq/camel/trunk/tooling/camel-eclipse/camel.routing/src-gen/org/apache/camel/eclipse/parser/camelParser.java (contents, props changed)
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/CamelException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Component.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Expression.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/BuilderSupport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ExpressionBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/Fluent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/FluentArg.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/InterceptorBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PolicyBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PredicateBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ValueBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/direct/DirectEndpoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXConsumer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXEndpoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXExchange.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/jmx/JMXMessage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoEndpoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoExchange.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/PojoInvocation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/timer/TimerComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/timer/TimerConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/timer/TimerConsumer.java?view=diff&rev=546580&r1=546579&r2=546580
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/timer/TimerConsumer.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/timer/TimerConsumer.java Tue Jun 12 11:20:13 2007
@@ -1,120 +1,120 @@
-/**
- *
- * 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.pojo.timer;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import org.apache.camel.Processor;
-import org.apache.camel.component.pojo.PojoExchange;
-import org.apache.camel.component.pojo.PojoInvocation;
-import org.apache.camel.impl.DefaultConsumer;
-
-/**
- * @version $Revision: 523047 $
- */
-public class TimerConsumer extends DefaultConsumer<PojoExchange> implements InvocationHandler {
-
- private final TimerEndpoint endpoint;
- private Timer timer;
-
-
- public TimerConsumer(TimerEndpoint endpoint, Processor processor) {
- super(endpoint, processor);
- this.endpoint = endpoint;
- }
-
- @Override
- protected void doStart() throws Exception {
- TimerComponent component = endpoint.getComponent();
- component.addConsumer(this);
- timer=createTimerAndTask();
- }
-
- @Override
- protected void doStop() throws Exception {
- if(timer!=null){
- timer.cancel();
- }
- TimerComponent component = endpoint.getComponent();
- component.removeConsumer(this);
- }
-
- private Timer createTimerAndTask(){
-
- final Runnable proxy = createProxy();
- TimerTask task=new TimerTask(){
- @Override public void run(){
- proxy.run();
- }
- };
-
- Timer result=new Timer(endpoint.getTimerName(),endpoint.isDaemon());
- if(endpoint.isFixedRate()){
- if(endpoint.getTime()!=null){
- result.scheduleAtFixedRate(task,endpoint.getTime(),endpoint.getPeriod());
- }else{
- result.scheduleAtFixedRate(task,endpoint.getDelay(),endpoint.getPeriod());
- }
- }else{
- if(endpoint.getTime()!=null){
- if(endpoint.getPeriod()>=0){
- result.schedule(task,endpoint.getTime(),endpoint.getPeriod());
- }else{
- result.schedule(task,endpoint.getTime());
- }
- }else{
- if(endpoint.getPeriod()>=0){
- result.schedule(task,endpoint.getDelay(),endpoint.getPeriod());
- }else{
- result.schedule(task,endpoint.getDelay());
- }
- }
- }
- return result;
- }
-
- /**
- * Creates a Proxy which generates the inbound PojoExchanges
- */
- public Runnable createProxy() {
- return (Runnable) Proxy.newProxyInstance(Runnable.class.getClassLoader(), new Class[]{Runnable.class}, this);
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
- if (!isStarted()) {
- throw new IllegalStateException("The endpoint is not active: " + getEndpoint().getEndpointUri());
- }
- PojoInvocation invocation = new PojoInvocation(proxy, method, args);
- PojoExchange exchange = getEndpoint().createExchange();
- exchange.setInvocation(invocation);
- getProcessor().process(exchange);
- Throwable fault = exchange.getException();
- if (fault != null) {
- throw new InvocationTargetException(fault);
- }
- return exchange.getOut().getBody();
- }
-
-
-
-}
+/**
+ *
+ * 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.pojo.timer;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.apache.camel.Processor;
+import org.apache.camel.component.pojo.PojoExchange;
+import org.apache.camel.component.pojo.PojoInvocation;
+import org.apache.camel.impl.DefaultConsumer;
+
+/**
+ * @version $Revision: 523047 $
+ */
+public class TimerConsumer extends DefaultConsumer<PojoExchange> implements InvocationHandler {
+
+ private final TimerEndpoint endpoint;
+ private Timer timer;
+
+
+ public TimerConsumer(TimerEndpoint endpoint, Processor processor) {
+ super(endpoint, processor);
+ this.endpoint = endpoint;
+ }
+
+ @Override
+ protected void doStart() throws Exception {
+ TimerComponent component = endpoint.getComponent();
+ component.addConsumer(this);
+ timer=createTimerAndTask();
+ }
+
+ @Override
+ protected void doStop() throws Exception {
+ if(timer!=null){
+ timer.cancel();
+ }
+ TimerComponent component = endpoint.getComponent();
+ component.removeConsumer(this);
+ }
+
+ private Timer createTimerAndTask(){
+
+ final Runnable proxy = createProxy();
+ TimerTask task=new TimerTask(){
+ @Override public void run(){
+ proxy.run();
+ }
+ };
+
+ Timer result=new Timer(endpoint.getTimerName(),endpoint.isDaemon());
+ if(endpoint.isFixedRate()){
+ if(endpoint.getTime()!=null){
+ result.scheduleAtFixedRate(task,endpoint.getTime(),endpoint.getPeriod());
+ }else{
+ result.scheduleAtFixedRate(task,endpoint.getDelay(),endpoint.getPeriod());
+ }
+ }else{
+ if(endpoint.getTime()!=null){
+ if(endpoint.getPeriod()>=0){
+ result.schedule(task,endpoint.getTime(),endpoint.getPeriod());
+ }else{
+ result.schedule(task,endpoint.getTime());
+ }
+ }else{
+ if(endpoint.getPeriod()>=0){
+ result.schedule(task,endpoint.getDelay(),endpoint.getPeriod());
+ }else{
+ result.schedule(task,endpoint.getDelay());
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Creates a Proxy which generates the inbound PojoExchanges
+ */
+ public Runnable createProxy() {
+ return (Runnable) Proxy.newProxyInstance(Runnable.class.getClassLoader(), new Class[]{Runnable.class}, this);
+ }
+
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ if (!isStarted()) {
+ throw new IllegalStateException("The endpoint is not active: " + getEndpoint().getEndpointUri());
+ }
+ PojoInvocation invocation = new PojoInvocation(proxy, method, args);
+ PojoExchange exchange = getEndpoint().createExchange();
+ exchange.setInvocation(invocation);
+ getProcessor().process(exchange);
+ Throwable fault = exchange.getException();
+ if (fault != null) {
+ throw new InvocationTargetException(fault);
+ }
+ return exchange.getOut().getBody();
+ }
+
+
+
+}
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/timer/TimerConsumer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/pojo/timer/TimerEndpoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueComponent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/queue/QueueEndpoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/CollectionConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/NoPolicy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/NoPolicy.java?view=diff&rev=546580&r1=546579&r2=546580
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/NoPolicy.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/NoPolicy.java Tue Jun 12 11:20:13 2007
@@ -1,33 +1,33 @@
-/**
- *
- * 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.impl;
-
-import org.apache.camel.spi.Policy;
-import org.apache.camel.Processor;
-
-/**
- * Represents an {@link Policy} which adds no interceptors.
- *
- * @version $Revision: 1.1 $
- */
-public class NoPolicy<E> implements Policy<E> {
-
- public Processor wrap(Processor processor) {
- return processor;
- }
-}
+/**
+ *
+ * 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.impl;
+
+import org.apache.camel.spi.Policy;
+import org.apache.camel.Processor;
+
+/**
+ * Represents an {@link Policy} which adds no interceptors.
+ *
+ * @version $Revision: 1.1 $
+ */
+public class NoPolicy<E> implements Policy<E> {
+
+ public Processor wrap(Processor processor) {
+ return processor;
+ }
+}
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/NoPolicy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/ArrayTypeConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/PropertyEditorTypeConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/PropertyEditorTypeConverter.java?view=diff&rev=546580&r1=546579&r2=546580
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/PropertyEditorTypeConverter.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/PropertyEditorTypeConverter.java Tue Jun 12 11:20:13 2007
@@ -1,64 +1,64 @@
-/**
- *
- * 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.impl.converter;
-
-import java.beans.PropertyEditor;
-import java.beans.PropertyEditorManager;
-
-import org.apache.camel.TypeConverter;
-
-/**
- * Uses the java.beans.PropertyEditor conversion system to convert Objects to and from String values.
- *
- * @version $Revision: 523731 $
- */
-public class PropertyEditorTypeConverter implements TypeConverter {
-
-
- public <T> T convertTo(Class<T> toType, Object value) {
-
- // We can't convert null values since we can't figure out a property editor for it.
- if( value == null )
- return null;
-
- if( value.getClass() == String.class ) {
-
- // No conversion needed.
- if( toType == String.class ) {
- return toType.cast(value);
- }
-
- PropertyEditor editor = PropertyEditorManager.findEditor(toType);
- if( editor != null ) {
- editor.setAsText(value.toString());
- return toType.cast(editor.getValue());
- }
-
- } else if( toType == String.class ) {
-
- PropertyEditor editor = PropertyEditorManager.findEditor(value.getClass());
- if( editor != null ) {
- editor.setValue(value);
- return toType.cast(editor.getAsText());
- }
-
- }
- return null;
- }
-
-}
+/**
+ *
+ * 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.impl.converter;
+
+import java.beans.PropertyEditor;
+import java.beans.PropertyEditorManager;
+
+import org.apache.camel.TypeConverter;
+
+/**
+ * Uses the java.beans.PropertyEditor conversion system to convert Objects to and from String values.
+ *
+ * @version $Revision: 523731 $
+ */
+public class PropertyEditorTypeConverter implements TypeConverter {
+
+
+ public <T> T convertTo(Class<T> toType, Object value) {
+
+ // We can't convert null values since we can't figure out a property editor for it.
+ if( value == null )
+ return null;
+
+ if( value.getClass() == String.class ) {
+
+ // No conversion needed.
+ if( toType == String.class ) {
+ return toType.cast(value);
+ }
+
+ PropertyEditor editor = PropertyEditorManager.findEditor(toType);
+ if( editor != null ) {
+ editor.setAsText(value.toString());
+ return toType.cast(editor.getValue());
+ }
+
+ } else if( toType == String.class ) {
+
+ PropertyEditor editor = PropertyEditorManager.findEditor(value.getClass());
+ if( editor != null ) {
+ editor.setValue(value);
+ return toType.cast(editor.getAsText());
+ }
+
+ }
+ return null;
+ }
+
+}
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/PropertyEditorTypeConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/ToStringTypeConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/ToStringTypeConverter.java?view=diff&rev=546580&r1=546579&r2=546580
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/ToStringTypeConverter.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/ToStringTypeConverter.java Tue Jun 12 11:20:13 2007
@@ -1,39 +1,39 @@
-/**
- *
- * 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.impl.converter;
-
-import org.apache.camel.TypeConverter;
-
-/**
- * A simple converter that can convert any object to a String type by using the toString() method of the
- * object.
- *
- * @version $Revision: 523731 $
- */
-public class ToStringTypeConverter implements TypeConverter {
-
- public <T> T convertTo(Class<T> toType, Object value) {
- if (value != null) {
- if (toType.equals(String.class)) {
- return (T) value.toString();
- }
- }
- return null;
- }
-
-}
+/**
+ *
+ * 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.impl.converter;
+
+import org.apache.camel.TypeConverter;
+
+/**
+ * A simple converter that can convert any object to a String type by using the toString() method of the
+ * object.
+ *
+ * @version $Revision: 523731 $
+ */
+public class ToStringTypeConverter implements TypeConverter {
+
+ public <T> T convertTo(Class<T> toType, Object value) {
+ if (value != null) {
+ if (toType.equals(String.class)) {
+ return (T) value.toString();
+ }
+ }
+ return null;
+ }
+
+}
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/ToStringTypeConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/DelegateProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Marshaller.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Marshaller.java?view=diff&rev=546580&r1=546579&r2=546580
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Marshaller.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Marshaller.java Tue Jun 12 11:20:13 2007
@@ -1,31 +1,31 @@
-/*
- * 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.spi;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-/**
- * @version $Revision: 520124 $
- */
-public interface Marshaller {
-
- /**
- * Marshals the object to the given Stream.
- */
- void marshal(Object graph, OutputStream stream) throws IOException;
-}
+/*
+ * 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.spi;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * @version $Revision: 520124 $
+ */
+public interface Marshaller {
+
+ /**
+ * Marshals the object to the given Stream.
+ */
+ void marshal(Object graph, OutputStream stream) throws IOException;
+}
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Marshaller.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Policy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Policy.java?view=diff&rev=546580&r1=546579&r2=546580
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Policy.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Policy.java Tue Jun 12 11:20:13 2007
@@ -1,36 +1,36 @@
-/**
- *
- * 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.spi;
-
-import org.apache.camel.Processor;
-
-/**
- * A strategy capable of applying interceptors to a processor
- *
- * @version $Revision: 1.1 $
- */
-public interface Policy<E> {
-
- /**
- * Wraps any applicable interceptors around the given processor
- *
- * @param processor the processor to be intercepted
- * @return either the original processor or a processor wrapped in one or more interceptors
- */
- Processor wrap(Processor processor);
-}
+/**
+ *
+ * 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.spi;
+
+import org.apache.camel.Processor;
+
+/**
+ * A strategy capable of applying interceptors to a processor
+ *
+ * @version $Revision: 1.1 $
+ */
+public interface Policy<E> {
+
+ /**
+ * Wraps any applicable interceptors around the given processor
+ *
+ * @param processor the processor to be intercepted
+ * @return either the original processor or a processor wrapped in one or more interceptors
+ */
+ Processor wrap(Processor processor);
+}
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Policy.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Unmarshaller.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Unmarshaller.java?view=diff&rev=546580&r1=546579&r2=546580
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Unmarshaller.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Unmarshaller.java Tue Jun 12 11:20:13 2007
@@ -1,32 +1,32 @@
-/*
- * 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.spi;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * @version $Revision: 520124 $
- */
-public interface Unmarshaller {
-
- /**
- * Unmarshals the given stream into an object.
- */
- Object unmarshal(InputStream stream) throws IOException;
-
-}
+/*
+ * 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.spi;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @version $Revision: 520124 $
+ */
+public interface Unmarshaller {
+
+ /**
+ * Unmarshals the given stream into an object.
+ */
+ Object unmarshal(InputStream stream) throws IOException;
+
+}
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Unmarshaller.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlMarshaller.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlMarshaller.java?view=diff&rev=546580&r1=546579&r2=546580
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlMarshaller.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlMarshaller.java Tue Jun 12 11:20:13 2007
@@ -1,40 +1,40 @@
-/*
- * 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.spi;
-
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.xml.transform.Result;
-import javax.xml.transform.stream.StreamResult;
-
-/**
- * Marshallers that marshall to XML should extend this base class.
- *
- * @version $Revision: 520124 $
- */
-public abstract class XmlMarshaller implements Marshaller{
-
- /**
- * Marshals the object to the given Stream.
- */
- public void marshal(Object object, OutputStream result) throws IOException {
- marshal(object, new StreamResult(result));
- }
-
- abstract public void marshal(Object object, Result result);
-}
+/*
+ * 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.spi;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.stream.StreamResult;
+
+/**
+ * Marshallers that marshall to XML should extend this base class.
+ *
+ * @version $Revision: 520124 $
+ */
+public abstract class XmlMarshaller implements Marshaller{
+
+ /**
+ * Marshals the object to the given Stream.
+ */
+ public void marshal(Object object, OutputStream result) throws IOException {
+ marshal(object, new StreamResult(result));
+ }
+
+ abstract public void marshal(Object object, Result result);
+}
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlMarshaller.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlUnmarshaller.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlUnmarshaller.java?view=diff&rev=546580&r1=546579&r2=546580
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlUnmarshaller.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlUnmarshaller.java Tue Jun 12 11:20:13 2007
@@ -1,44 +1,44 @@
-/*
- * 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.spi;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-
-/**
- * Unmarshallers that unmarshall to XML should extend this base class.
- *
- * @version $Revision: 520124 $
- */
-public abstract class XmlUnmarshaller implements Unmarshaller {
-
- /**
- * Unmarshals the given stream into an object.
- */
- public Object unmarshal(InputStream stream) throws IOException {
- return unmarshal(new StreamSource(stream));
- }
-
- /**
- * Unmarshals the given stream into an object.
- */
- abstract public Object unmarshal(Source stream) throws IOException;
-
-}
+/*
+ * 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.spi;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+/**
+ * Unmarshallers that unmarshall to XML should extend this base class.
+ *
+ * @version $Revision: 520124 $
+ */
+public abstract class XmlUnmarshaller implements Unmarshaller {
+
+ /**
+ * Unmarshals the given stream into an object.
+ */
+ public Object unmarshal(InputStream stream) throws IOException {
+ return unmarshal(new StreamSource(stream));
+ }
+
+ /**
+ * Unmarshals the given stream into an object.
+ */
+ abstract public Object unmarshal(Source stream) throws IOException;
+
+}
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlUnmarshaller.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/FactoryFinder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/IntrospectionSupport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/Time.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java?view=diff&rev=546580&r1=546579&r2=546580
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java Tue Jun 12 11:20:13 2007
@@ -1,346 +1,346 @@
-/**
- *
- * 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.util;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URLDecoder;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * @version $Revision$
- */
-public class URISupport {
- public static class CompositeData {
- String scheme;
- String path;
- URI components[];
- Map parameters;
- String fragment;
- public String host;
-
- public URI[] getComponents() {
- return components;
- }
-
- public String getFragment() {
- return fragment;
- }
-
- public Map getParameters() {
- return parameters;
- }
-
- public String getScheme() {
- return scheme;
- }
-
- public String getPath() {
- return path;
- }
-
- public String getHost() {
- return host;
- }
-
- public URI toURI() throws URISyntaxException {
- StringBuffer sb = new StringBuffer();
- if (scheme != null) {
- sb.append(scheme);
- sb.append(':');
- }
-
- if (host != null && host.length() != 0) {
- sb.append(host);
- }
- else {
- sb.append('(');
- for (int i = 0; i < components.length; i++) {
- if (i != 0) {
- sb.append(',');
- }
- sb.append(components[i].toString());
- }
- sb.append(')');
- }
-
- if (path != null) {
- sb.append('/');
- sb.append(path);
- }
- if (!parameters.isEmpty()) {
- sb.append("?");
- sb.append(createQueryString(parameters));
- }
- if (fragment != null) {
- sb.append("#");
- sb.append(fragment);
- }
- return new URI(sb.toString());
- }
- }
-
- public static Map parseQuery(String uri) throws URISyntaxException {
- try {
- Map rc = new HashMap();
- if (uri != null) {
- String[] parameters = uri.split("&");
- for (int i = 0; i < parameters.length; i++) {
- int p = parameters[i].indexOf("=");
- if (p >= 0) {
- String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8");
- String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8");
- rc.put(name, value);
- }
- else {
- rc.put(parameters[i], null);
- }
- }
- }
- return rc;
- }
- catch (UnsupportedEncodingException e) {
- throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e);
- }
- }
-
- public static Map parseParamters(URI uri) throws URISyntaxException {
- String query = uri.getQuery();
- if (query == null) {
- String schemeSpecificPart = uri.getSchemeSpecificPart();
- int idx = schemeSpecificPart.lastIndexOf('?');
- if (idx < 0) {
- return Collections.EMPTY_MAP;
- }
- else {
- query = schemeSpecificPart.substring(idx + 1);
- }
- }
- else {
- query = stripPrefix(query, "?");
- }
- return parseQuery(query);
- }
-
- /**
- * Removes any URI query from the given uri
- */
- public static URI removeQuery(URI uri) throws URISyntaxException {
- return createURIWithQuery(uri, null);
- }
-
- /**
- * Creates a URI with the given query
- */
- public static URI createURIWithQuery(URI uri, String query) throws URISyntaxException {
- return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), query, uri.getFragment());
- }
-
- public static CompositeData parseComposite(URI uri) throws URISyntaxException {
-
- CompositeData rc = new CompositeData();
- rc.scheme = uri.getScheme();
- String ssp = stripPrefix(uri.getSchemeSpecificPart().trim(), "//").trim();
-
- parseComposite(uri, rc, ssp);
-
- rc.fragment = uri.getFragment();
- return rc;
- }
-
- /**
- * @param uri
- * @param rc
- * @param ssp
- * @throws URISyntaxException
- */
- private static void parseComposite(URI uri, CompositeData rc, String ssp) throws URISyntaxException {
- String componentString;
- String params;
-
- if (!checkParenthesis(ssp)) {
- throw new URISyntaxException(uri.toString(), "Not a matching number of '(' and ')' parenthesis");
- }
-
- int p;
- int intialParen = ssp.indexOf("(");
- if (intialParen == 0) {
- rc.host = ssp.substring(0, intialParen);
- p = rc.host.indexOf("/");
- if (p >= 0) {
- rc.path = rc.host.substring(p);
- rc.host = rc.host.substring(0, p);
- }
- p = ssp.lastIndexOf(")");
- componentString = ssp.substring(intialParen + 1, p);
- params = ssp.substring(p + 1).trim();
- }
- else {
- componentString = ssp;
- params = "";
- }
-
- String components[] = splitComponents(componentString);
- rc.components = new URI[components.length];
- for (int i = 0; i < components.length; i++) {
- rc.components[i] = new URI(components[i].trim());
- }
-
- p = params.indexOf("?");
- if (p >= 0) {
- if (p > 0) {
- rc.path = stripPrefix(params.substring(0, p), "/");
- }
- rc.parameters = parseQuery(params.substring(p + 1));
- }
- else {
- if (params.length() > 0) {
- rc.path = stripPrefix(params, "/");
- }
- rc.parameters = Collections.EMPTY_MAP;
- }
- }
-
- /**
- * @param str
- * @return
- */
- private static String[] splitComponents(String str) {
- ArrayList l = new ArrayList();
-
- int last = 0;
- int depth = 0;
- char chars[] = str.toCharArray();
- for (int i = 0; i < chars.length; i++) {
- switch (chars[i]) {
- case '(':
- depth++;
- break;
- case ')':
- depth--;
- break;
- case ',':
- if (depth == 0) {
- String s = str.substring(last, i);
- l.add(s);
- last = i + 1;
- }
- }
- }
-
- String s = str.substring(last);
- if (s.length() != 0) {
- l.add(s);
- }
-
- String rc[] = new String[l.size()];
- l.toArray(rc);
- return rc;
- }
-
- public static String stripPrefix(String value, String prefix) {
- if (value.startsWith(prefix)) {
- return value.substring(prefix.length());
- }
- return value;
- }
-
- public static URI stripScheme(URI uri) throws URISyntaxException {
- return new URI(stripPrefix(uri.getSchemeSpecificPart().trim(), "//"));
- }
-
- public static String createQueryString(Map options) throws URISyntaxException {
- try {
- if (options.size() > 0) {
- StringBuffer rc = new StringBuffer();
- boolean first = true;
- for (Iterator iter = options.keySet().iterator(); iter.hasNext();) {
- if (first) {
- first = false;
- }
- else {
- rc.append("&");
- }
-
- String key = (String) iter.next();
- String value = (String) options.get(key);
- rc.append(URLEncoder.encode(key, "UTF-8"));
- rc.append("=");
- rc.append(URLEncoder.encode(value, "UTF-8"));
- }
- return rc.toString();
- }
- else {
- return "";
- }
- }
- catch (UnsupportedEncodingException e) {
- throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e);
- }
- }
-
- /**
- * Creates a URI from the original URI and the remaining paramaters
- *
- * @throws URISyntaxException
- */
- public static URI createRemainingURI(URI originalURI, Map params) throws URISyntaxException {
- String s = createQueryString(params);
- if (s.length() == 0) {
- s = null;
- }
- return createURIWithQuery(originalURI, s);
- }
-
- static public URI changeScheme(URI bindAddr, String scheme) throws URISyntaxException {
- return new URI(scheme, bindAddr.getUserInfo(), bindAddr.getHost(), bindAddr.getPort(), bindAddr.getPath(), bindAddr.getQuery(), bindAddr.getFragment());
- }
-
- public static boolean checkParenthesis(String str) {
- boolean result = true;
- if (str != null) {
- int open = 0;
- int closed = 0;
-
- int i = 0;
- while ((i = str.indexOf('(', i)) >= 0) {
- i++;
- open++;
- }
- i = 0;
- while ((i = str.indexOf(')', i)) >= 0) {
- i++;
- closed++;
- }
- result = open == closed;
- }
- return result;
- }
-
- public int indexOfParenthesisMatch(String str) {
- int result = -1;
-
- return result;
- }
-}
+/**
+ *
+ * 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.util;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @version $Revision$
+ */
+public class URISupport {
+ public static class CompositeData {
+ String scheme;
+ String path;
+ URI components[];
+ Map parameters;
+ String fragment;
+ public String host;
+
+ public URI[] getComponents() {
+ return components;
+ }
+
+ public String getFragment() {
+ return fragment;
+ }
+
+ public Map getParameters() {
+ return parameters;
+ }
+
+ public String getScheme() {
+ return scheme;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public String getHost() {
+ return host;
+ }
+
+ public URI toURI() throws URISyntaxException {
+ StringBuffer sb = new StringBuffer();
+ if (scheme != null) {
+ sb.append(scheme);
+ sb.append(':');
+ }
+
+ if (host != null && host.length() != 0) {
+ sb.append(host);
+ }
+ else {
+ sb.append('(');
+ for (int i = 0; i < components.length; i++) {
+ if (i != 0) {
+ sb.append(',');
+ }
+ sb.append(components[i].toString());
+ }
+ sb.append(')');
+ }
+
+ if (path != null) {
+ sb.append('/');
+ sb.append(path);
+ }
+ if (!parameters.isEmpty()) {
+ sb.append("?");
+ sb.append(createQueryString(parameters));
+ }
+ if (fragment != null) {
+ sb.append("#");
+ sb.append(fragment);
+ }
+ return new URI(sb.toString());
+ }
+ }
+
+ public static Map parseQuery(String uri) throws URISyntaxException {
+ try {
+ Map rc = new HashMap();
+ if (uri != null) {
+ String[] parameters = uri.split("&");
+ for (int i = 0; i < parameters.length; i++) {
+ int p = parameters[i].indexOf("=");
+ if (p >= 0) {
+ String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8");
+ String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8");
+ rc.put(name, value);
+ }
+ else {
+ rc.put(parameters[i], null);
+ }
+ }
+ }
+ return rc;
+ }
+ catch (UnsupportedEncodingException e) {
+ throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e);
+ }
+ }
+
+ public static Map parseParamters(URI uri) throws URISyntaxException {
+ String query = uri.getQuery();
+ if (query == null) {
+ String schemeSpecificPart = uri.getSchemeSpecificPart();
+ int idx = schemeSpecificPart.lastIndexOf('?');
+ if (idx < 0) {
+ return Collections.EMPTY_MAP;
+ }
+ else {
+ query = schemeSpecificPart.substring(idx + 1);
+ }
+ }
+ else {
+ query = stripPrefix(query, "?");
+ }
+ return parseQuery(query);
+ }
+
+ /**
+ * Removes any URI query from the given uri
+ */
+ public static URI removeQuery(URI uri) throws URISyntaxException {
+ return createURIWithQuery(uri, null);
+ }
+
+ /**
+ * Creates a URI with the given query
+ */
+ public static URI createURIWithQuery(URI uri, String query) throws URISyntaxException {
+ return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), query, uri.getFragment());
+ }
+
+ public static CompositeData parseComposite(URI uri) throws URISyntaxException {
+
+ CompositeData rc = new CompositeData();
+ rc.scheme = uri.getScheme();
+ String ssp = stripPrefix(uri.getSchemeSpecificPart().trim(), "//").trim();
+
+ parseComposite(uri, rc, ssp);
+
+ rc.fragment = uri.getFragment();
+ return rc;
+ }
+
+ /**
+ * @param uri
+ * @param rc
+ * @param ssp
+ * @throws URISyntaxException
+ */
+ private static void parseComposite(URI uri, CompositeData rc, String ssp) throws URISyntaxException {
+ String componentString;
+ String params;
+
+ if (!checkParenthesis(ssp)) {
+ throw new URISyntaxException(uri.toString(), "Not a matching number of '(' and ')' parenthesis");
+ }
+
+ int p;
+ int intialParen = ssp.indexOf("(");
+ if (intialParen == 0) {
+ rc.host = ssp.substring(0, intialParen);
+ p = rc.host.indexOf("/");
+ if (p >= 0) {
+ rc.path = rc.host.substring(p);
+ rc.host = rc.host.substring(0, p);
+ }
+ p = ssp.lastIndexOf(")");
+ componentString = ssp.substring(intialParen + 1, p);
+ params = ssp.substring(p + 1).trim();
+ }
+ else {
+ componentString = ssp;
+ params = "";
+ }
+
+ String components[] = splitComponents(componentString);
+ rc.components = new URI[components.length];
+ for (int i = 0; i < components.length; i++) {
+ rc.components[i] = new URI(components[i].trim());
+ }
+
+ p = params.indexOf("?");
+ if (p >= 0) {
+ if (p > 0) {
+ rc.path = stripPrefix(params.substring(0, p), "/");
+ }
+ rc.parameters = parseQuery(params.substring(p + 1));
+ }
+ else {
+ if (params.length() > 0) {
+ rc.path = stripPrefix(params, "/");
+ }
+ rc.parameters = Collections.EMPTY_MAP;
+ }
+ }
+
+ /**
+ * @param str
+ * @return
+ */
+ private static String[] splitComponents(String str) {
+ ArrayList l = new ArrayList();
+
+ int last = 0;
+ int depth = 0;
+ char chars[] = str.toCharArray();
+ for (int i = 0; i < chars.length; i++) {
+ switch (chars[i]) {
+ case '(':
+ depth++;
+ break;
+ case ')':
+ depth--;
+ break;
+ case ',':
+ if (depth == 0) {
+ String s = str.substring(last, i);
+ l.add(s);
+ last = i + 1;
+ }
+ }
+ }
+
+ String s = str.substring(last);
+ if (s.length() != 0) {
+ l.add(s);
+ }
+
+ String rc[] = new String[l.size()];
+ l.toArray(rc);
+ return rc;
+ }
+
+ public static String stripPrefix(String value, String prefix) {
+ if (value.startsWith(prefix)) {
+ return value.substring(prefix.length());
+ }
+ return value;
+ }
+
+ public static URI stripScheme(URI uri) throws URISyntaxException {
+ return new URI(stripPrefix(uri.getSchemeSpecificPart().trim(), "//"));
+ }
+
+ public static String createQueryString(Map options) throws URISyntaxException {
+ try {
+ if (options.size() > 0) {
+ StringBuffer rc = new StringBuffer();
+ boolean first = true;
+ for (Iterator iter = options.keySet().iterator(); iter.hasNext();) {
+ if (first) {
+ first = false;
+ }
+ else {
+ rc.append("&");
+ }
+
+ String key = (String) iter.next();
+ String value = (String) options.get(key);
+ rc.append(URLEncoder.encode(key, "UTF-8"));
+ rc.append("=");
+ rc.append(URLEncoder.encode(value, "UTF-8"));
+ }
+ return rc.toString();
+ }
+ else {
+ return "";
+ }
+ }
+ catch (UnsupportedEncodingException e) {
+ throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e);
+ }
+ }
+
+ /**
+ * Creates a URI from the original URI and the remaining paramaters
+ *
+ * @throws URISyntaxException
+ */
+ public static URI createRemainingURI(URI originalURI, Map params) throws URISyntaxException {
+ String s = createQueryString(params);
+ if (s.length() == 0) {
+ s = null;
+ }
+ return createURIWithQuery(originalURI, s);
+ }
+
+ static public URI changeScheme(URI bindAddr, String scheme) throws URISyntaxException {
+ return new URI(scheme, bindAddr.getUserInfo(), bindAddr.getHost(), bindAddr.getPort(), bindAddr.getPath(), bindAddr.getQuery(), bindAddr.getFragment());
+ }
+
+ public static boolean checkParenthesis(String str) {
+ boolean result = true;
+ if (str != null) {
+ int open = 0;
+ int closed = 0;
+
+ int i = 0;
+ while ((i = str.indexOf('(', i)) >= 0) {
+ i++;
+ open++;
+ }
+ i = 0;
+ while ((i = str.indexOf(')', i)) >= 0) {
+ i++;
+ closed++;
+ }
+ result = open == closed;
+ }
+ return result;
+ }
+
+ public int indexOfParenthesisMatch(String str) {
+ int result = -1;
+
+ return result;
+ }
+}
Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/URISupport.java
------------------------------------------------------------------------------
svn:eol-style = native