Author: davsclaus Date: Fri Feb 27 12:13:31 2009 New Revision: 748491 URL: http://svn.apache.org/viewvc?rev=748491&view=rev Log: CAMEL-1373: CamelCase
Added: camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConstants.java (with props) Modified: camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrComponent.java camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConverter.java camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrEndpoint.java camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrProducer.java camel/trunk/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteTest.java Modified: camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrComponent.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrComponent.java?rev=748491&r1=748490&r2=748491&view=diff ============================================================================== --- camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrComponent.java (original) +++ camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrComponent.java Fri Feb 27 12:13:31 2009 @@ -26,12 +26,7 @@ */ public class JcrComponent extends DefaultComponent { - /** - * Property key for specifying the name of a node in the repository - */ - public static final String NODE_NAME = "org.apache.camel.component.jcr.node_name"; - - @Override @SuppressWarnings("unchecked") + @Override protected Endpoint createEndpoint(String uri, String remaining, Map properties) throws Exception { return new JcrEndpoint(uri, this); } Added: camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConstants.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConstants.java?rev=748491&view=auto ============================================================================== --- camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConstants.java (added) +++ camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConstants.java Fri Feb 27 12:13:31 2009 @@ -0,0 +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.component.jcr; + +/** + * JCR Constants. + */ +public final class JcrConstants { + /** + * Property key for specifying the name of a node in the repository + */ + public static final String NODE_NAME = "org.apache.camel.component.jcr.node_name"; + + + private JcrConstants() { + // Utility class + } +} Propchange: camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConstants.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConstants.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Modified: camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConverter.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConverter.java?rev=748491&r1=748490&r2=748491&view=diff ============================================================================== --- camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConverter.java (original) +++ camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrConverter.java Fri Feb 27 12:13:31 2009 @@ -33,41 +33,21 @@ @Converter public class JcrConverter { - /** - * Converts a {...@link Boolean} into a {...@link Value} - * @param bool the boolean - * @return the value - */ @Converter public Value toValue(Boolean bool) { return new BooleanValue(bool); } - /** - * Converts an {...@link InputStream} into a {...@link Value} - * @param stream the input stream - * @return the value - */ @Converter public Value toValue(InputStream stream) { return new BinaryValue(stream); } - /** - * Converts a {...@link Calendar} into a {...@link Value} - * @param calendar the calendar - * @return the value - */ @Converter public Value toValue(Calendar calendar) { return new DateValue(calendar); } - /** - * Converts a {...@link String} into a {...@link Value} - * @param value the string - * @return the value - */ @Converter public Value toValue(String value) { return new StringValue(value); Modified: camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrEndpoint.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrEndpoint.java?rev=748491&r1=748490&r2=748491&view=diff ============================================================================== --- camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrEndpoint.java (original) +++ camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrEndpoint.java Fri Feb 27 12:13:31 2009 @@ -38,7 +38,6 @@ private Repository repository; private String base; - @SuppressWarnings("unchecked") protected JcrEndpoint(String endpointUri, JcrComponent component) { super(endpointUri, component); try { @@ -46,7 +45,7 @@ if (uri.getUserInfo() != null && uri.getAuthority() != null) { this.credentials = new SimpleCredentials(uri.getUserInfo(), uri.getAuthority().toCharArray()); } - this.repository = (Repository) component.getCamelContext().getRegistry().lookup(uri.getHost()); + this.repository = component.getCamelContext().getRegistry().lookup(uri.getHost(), Repository.class); if (repository == null) { throw new RuntimeCamelException("No JCR repository defined under '" + uri.getHost() + "'"); } @@ -71,16 +70,10 @@ throw new RuntimeCamelException("No consumer endpoint support for JCR available"); } - /** - * Creates a new {...@link Producer} - */ public Producer createProducer() throws Exception { return new JcrProducer(this); } - /** - * {...@inheritdoc} - */ public boolean isSingleton() { return false; } Modified: camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrProducer.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrProducer.java?rev=748491&r1=748490&r2=748491&view=diff ============================================================================== --- camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrProducer.java (original) +++ camel/trunk/components/camel-jcr/src/main/java/org/apache/camel/component/jcr/JcrProducer.java Fri Feb 27 12:13:31 2009 @@ -16,7 +16,6 @@ */ package org.apache.camel.component.jcr; -import javax.jcr.LoginException; import javax.jcr.Node; import javax.jcr.RepositoryException; import javax.jcr.Session; @@ -28,8 +27,7 @@ public class JcrProducer extends DefaultProducer { - public JcrProducer(JcrEndpoint jcrEndpoint) throws LoginException, - RepositoryException { + public JcrProducer(JcrEndpoint jcrEndpoint) throws RepositoryException { super(jcrEndpoint); } @@ -55,8 +53,8 @@ } private String getNodeName(Exchange exchange) { - if (exchange.getProperty(JcrComponent.NODE_NAME) != null) { - return exchange.getProperty(JcrComponent.NODE_NAME).toString(); + if (exchange.getProperty(JcrConstants.NODE_NAME) != null) { + return exchange.getProperty(JcrConstants.NODE_NAME, String.class); } return exchange.getExchangeId(); } @@ -69,7 +67,7 @@ return baseNode; } - protected Session openSession() throws LoginException, RepositoryException { + protected Session openSession() throws RepositoryException { return getJcrEndpoint().getRepository().login(getJcrEndpoint().getCredentials()); } Modified: camel/trunk/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteTest.java?rev=748491&r1=748490&r2=748491&view=diff ============================================================================== --- camel/trunk/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteTest.java (original) +++ camel/trunk/components/camel-jcr/src/test/java/org/apache/camel/component/jcr/JcrRouteTest.java Fri Feb 27 12:13:31 2009 @@ -75,7 +75,7 @@ @Override public void configure() throws Exception { // START SNIPPET: jcr - from("direct:a").setProperty(JcrComponent.NODE_NAME, constant("node")) + from("direct:a").setProperty(JcrConstants.NODE_NAME, constant("node")) .setProperty("my.contents.property", body()).to("jcr://user:p...@repository/home/test"); // END SNIPPET: jcr }