Author: davsclaus Date: Sun Jan 30 11:25:43 2011 New Revision: 1065249 URL: http://svn.apache.org/viewvc?rev=1065249&view=rev Log: CAMEL-3587: Improved javadoc on DefaultEndpoint. Thanks to David Tombs for patch. Fixed CS.
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RoutePolicyProcessor.java camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoutePoliciesRefTest.java camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoutePoliciesTest.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java?rev=1065249&r1=1065248&r2=1065249&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultEndpoint.java Sun Jan 30 11:25:43 2011 @@ -56,20 +56,52 @@ public abstract class DefaultEndpoint ex private boolean synchronous; private final String id = EndpointHelper.createEndpointId(); + /** + * Constructs a fully-initialized DefaultEndpoint instance. This is the + * preferred method of constructing an object from Java code (as opposed to + * Spring beans, etc.). + * + * @param endpointUri the full URI used to create this endpoint + * @param component the component that created this endpoint + */ protected DefaultEndpoint(String endpointUri, Component component) { this(endpointUri, component.getCamelContext()); this.component = component; } + /** + * Constructs a DefaultEndpoint instance which has <b>not</b> been created using a {@link Component}. + * <p/> + * <b>Note:</b> It is preferred to create endpoints using the associated component. + * + * @param endpointUri the full URI used to create this endpoint + * @param camelContext the Camel Context in which this endpoint is operating + */ protected DefaultEndpoint(String endpointUri, CamelContext camelContext) { this(endpointUri); this.camelContext = camelContext; } + /** + * Constructs a partially-initialized DefaultEndpoint instance. + * <p/> + * <b>Note:</b> It is preferred to create endpoints using the associated component. + * + * @param endpointUri the full URI used to create this endpoint + */ protected DefaultEndpoint(String endpointUri) { this.setEndpointUri(endpointUri); } + /** + * Constructs a partially-initialized DefaultEndpoint instance. + * Useful when creating endpoints manually (e.g., as beans in Spring). + * <p/> + * Please note that the endpoint URI must be set through properties (or + * overriding {@link #createEndpointUri()} if one uses this constructor. + * <p/> + * <b>Note:</b> It is preferred to create endpoints using the associated component. + */ protected DefaultEndpoint() { super(); } @@ -130,6 +162,11 @@ public abstract class DefaultEndpoint ex return camelContext; } + /** + * Returns the component that created this endpoint. + * + * @return the component that created this endpoint, or <tt>null</tt> if none set + */ public Component getComponent() { return component; } @@ -179,14 +216,28 @@ public abstract class DefaultEndpoint ex return new DefaultExchange(this, pattern); } + /** + * Returns the default exchange pattern to use for createExchange(). + * + * @see #setExchangePattern(ExchangePattern exchangePattern) + */ public ExchangePattern getExchangePattern() { return exchangePattern; } + /** + * Sets the default exchange pattern to use for {@link #createExchange()}. + * The default value is {@link ExchangePattern#InOnly} + */ public void setExchangePattern(ExchangePattern exchangePattern) { this.exchangePattern = exchangePattern; } + /** + * Returns whether synchronous processing should be strictly used. + * + * @see #setSynchronous(boolean synchronous) + */ public boolean isSynchronous() { return synchronous; } @@ -223,6 +274,9 @@ public abstract class DefaultEndpoint ex } } + /** + * Sets the URI that created this endpoint. + */ protected void setEndpointUri(String endpointUri) { this.endpointUri = endpointUri; } @@ -242,6 +296,9 @@ public abstract class DefaultEndpoint ex // noop } + /** + * Removes detected sensitive information (such as passwords) from the URI and returns the result. + */ public static String sanitizeUri(String uri) { return uri == null ? null : SECRETS.matcher(uri).replaceAll("$1=******"); } Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RoutePolicyProcessor.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RoutePolicyProcessor.java?rev=1065249&r1=1065248&r2=1065249&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RoutePolicyProcessor.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RoutePolicyProcessor.java Sun Jan 30 11:25:43 2011 @@ -36,7 +36,7 @@ import org.apache.commons.logging.LogFac */ public class RoutePolicyProcessor extends DelegateAsyncProcessor { - private final Log LOG = LogFactory.getLog(RoutePolicyProcessor.class); + private static final Log LOG = LogFactory.getLog(RoutePolicyProcessor.class); private final List<RoutePolicy> routePolicies; private Route route; Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoutePoliciesRefTest.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoutePoliciesRefTest.java?rev=1065249&r1=1065248&r2=1065249&view=diff ============================================================================== --- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoutePoliciesRefTest.java (original) +++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoutePoliciesRefTest.java Sun Jan 30 11:25:43 2011 @@ -40,7 +40,7 @@ public class RoutePoliciesRefTest extend return jndi; } - private class MyCustomRoutePolicy extends RoutePolicySupport { + private final class MyCustomRoutePolicy extends RoutePolicySupport { private final String name; Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoutePoliciesTest.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoutePoliciesTest.java?rev=1065249&r1=1065248&r2=1065249&view=diff ============================================================================== --- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoutePoliciesTest.java (original) +++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RoutePoliciesTest.java Sun Jan 30 11:25:43 2011 @@ -31,7 +31,7 @@ public class RoutePoliciesTest extends C private final MyCustomRoutePolicy policyA = new MyCustomRoutePolicy("A"); private final MyCustomRoutePolicy policyB = new MyCustomRoutePolicy("B"); - private class MyCustomRoutePolicy extends RoutePolicySupport { + private final class MyCustomRoutePolicy extends RoutePolicySupport { private final String name;