Repository: camel Updated Branches: refs/heads/master ef55316f2 -> 02361967c
Component docs Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/02361967 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/02361967 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/02361967 Branch: refs/heads/master Commit: 02361967cfaa0264c4afe9562f32f3a2624b1f44 Parents: ef55316 Author: Claus Ibsen <davscl...@apache.org> Authored: Mon May 11 14:04:12 2015 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Mon May 11 14:04:12 2015 +0200 ---------------------------------------------------------------------- .../component/linkedin/LinkedInComponent.java | 10 +++ .../linkedin/LinkedInConfiguration.java | 73 +++++++++++++++++++- .../component/linkedin/LinkedInEndpoint.java | 8 --- 3 files changed, 81 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/02361967/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInComponent.java ---------------------------------------------------------------------- diff --git a/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInComponent.java b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInComponent.java index a4c65d2..aad21e9 100644 --- a/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInComponent.java +++ b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInComponent.java @@ -55,9 +55,19 @@ public class LinkedInComponent extends AbstractApiComponent<LinkedInApiName, Lin return LinkedInApiName.fromValue(apiNameStr); } + /** + * To use the shared configuration + */ + @Override + public void setConfiguration(LinkedInConfiguration configuration) { + super.setConfiguration(configuration); + } + @Override protected Endpoint createEndpoint(String uri, String methodName, LinkedInApiName apiName, LinkedInConfiguration endpointConfiguration) { + endpointConfiguration.setApiName(apiName); + endpointConfiguration.setMethodName(methodName); return new LinkedInEndpoint(uri, this, apiName, methodName, endpointConfiguration); } http://git-wip-us.apache.org/repos/asf/camel/blob/02361967/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInConfiguration.java ---------------------------------------------------------------------- diff --git a/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInConfiguration.java b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInConfiguration.java index 3a043bd..83560cb 100644 --- a/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInConfiguration.java +++ b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInConfiguration.java @@ -21,8 +21,11 @@ import java.util.Map; import org.apache.camel.component.linkedin.api.OAuthScope; import org.apache.camel.component.linkedin.api.OAuthSecureStorage; +import org.apache.camel.component.linkedin.internal.LinkedInApiName; +import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriParams; +import org.apache.camel.spi.UriPath; import org.apache.camel.util.ObjectHelper; import org.apache.commons.lang3.builder.HashCodeBuilder; @@ -32,9 +35,23 @@ import org.apache.commons.lang3.builder.HashCodeBuilder; @UriParams public class LinkedInConfiguration { - @UriParam + @UriPath + @Metadata(required = "true") + private LinkedInApiName apiName; + @UriPath(enums = "addActivity,addComment,addCompanyUpdateComment,addCompanyUpdateCommentAsCompany,addGroupMembership,addInvite" + + ",addJob,addJobBookmark,addPost,addShare,addUpdateComment,editJob,flagCategory,followCompany,followPost,getComment" + + ",getCompanies,getCompanyById,getCompanyByName,getCompanyUpdateComments,getCompanyUpdateLikes,getCompanyUpdates" + + ",getConnections,getConnectionsById,getConnectionsByUrl,getFollowedCompanies,getGroup,getGroupMemberships,getGroupMembershipSettings" + + ",getHistoricalFollowStatistics,getHistoricalStatusUpdateStatistics,getJob,getJobBookmarks,getNetworkStats,getNetworkUpdates" + + ",getNetworkUpdatesById,getNumberOfFollowers,getPerson,getPersonById,getPersonByUrl,getPost,getPostComments,getPosts" + + ",getStatistics,getSuggestedCompanies,getSuggestedGroupPosts,getSuggestedGroups,getSuggestedJobs,getUpdateComments" + + ",getUpdateLikes,isShareEnabled,isViewerShareEnabled,likeCompanyUpdate,likePost,likeUpdate,removeComment,removeGroupMembership" + + ",removeGroupSuggestion,removeJob,removeJobBookmark,removePost,searchCompanies,searchJobs,searchPeople,share,stopFollowingCompany,updateGroupMembership") + @Metadata(required = "true") + private String methodName; + @UriParam @Metadata(required = "true") private String userName; - @UriParam + @UriParam @Metadata(required = "true") private String userPassword; @UriParam private OAuthSecureStorage secureStorage; @@ -51,10 +68,35 @@ public class LinkedInConfiguration { @UriParam(defaultValue = "true") private boolean lazyAuth = true; + public LinkedInApiName getApiName() { + return apiName; + } + + /** + * What kind of operation to perform + */ + public void setApiName(LinkedInApiName apiName) { + this.apiName = apiName; + } + + public String getMethodName() { + return methodName; + } + + /** + * What sub operation to use for the selected operation + */ + public void setMethodName(String methodName) { + this.methodName = methodName; + } + public String getUserName() { return userName; } + /** + * LinkedIn user account name, MUST be provided + */ public void setUserName(String userName) { this.userName = userName; } @@ -63,6 +105,9 @@ public class LinkedInConfiguration { return userPassword; } + /** + * LinkedIn account password + */ public void setUserPassword(String userPassword) { this.userPassword = userPassword; } @@ -71,6 +116,11 @@ public class LinkedInConfiguration { return secureStorage; } + /** + * Callback interface for providing an OAuth token or to store the token generated by the component. + * The callback should return null on the first call and then save the created token in the saveToken() callback. + * If the callback returns null the first time, a userPassword MUST be provided + */ public void setSecureStorage(OAuthSecureStorage secureStorage) { this.secureStorage = secureStorage; } @@ -79,6 +129,9 @@ public class LinkedInConfiguration { return clientId; } + /** + * LinkedIn application client ID + */ public void setClientId(String clientId) { this.clientId = clientId; } @@ -87,6 +140,9 @@ public class LinkedInConfiguration { return clientSecret; } + /** + * LinkedIn application client secret + */ public void setClientSecret(String clientSecret) { this.clientSecret = clientSecret; } @@ -95,6 +151,9 @@ public class LinkedInConfiguration { return scopes; } + /** + * List of LinkedIn scopes as specified at https://developer.linkedin.com/documents/authentication#granting + */ public void setScopes(OAuthScope[] scopes) { this.scopes = scopes; } @@ -103,6 +162,10 @@ public class LinkedInConfiguration { return redirectUri; } + /** + * Application redirect URI, although the component never redirects to this page to avoid having to have a functioning redirect server. + * So for testing one could use https://localhost + */ public void setRedirectUri(String redirectUri) { this.redirectUri = redirectUri; } @@ -111,6 +174,9 @@ public class LinkedInConfiguration { return httpParams; } + /** + * Custom HTTP params, for example proxy host and port, use constants from AllClientPNames + */ public void setHttpParams(Map<String, Object> httpParams) { this.httpParams = httpParams; } @@ -119,6 +185,9 @@ public class LinkedInConfiguration { return lazyAuth; } + /** + * Flag to enable/disable lazy OAuth, default is true. when enabled, OAuth token retrieval or generation is not done until the first REST call + */ public void setLazyAuth(boolean lazyAuth) { this.lazyAuth = lazyAuth; } http://git-wip-us.apache.org/repos/asf/camel/blob/02361967/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInEndpoint.java b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInEndpoint.java index 000b991..4200a06 100644 --- a/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInEndpoint.java +++ b/components/camel-linkedin/camel-linkedin-component/src/main/java/org/apache/camel/component/linkedin/LinkedInEndpoint.java @@ -35,10 +35,8 @@ import org.apache.camel.component.linkedin.internal.LinkedInApiCollection; import org.apache.camel.component.linkedin.internal.LinkedInApiName; import org.apache.camel.component.linkedin.internal.LinkedInConstants; import org.apache.camel.component.linkedin.internal.LinkedInPropertiesHelper; -import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; -import org.apache.camel.spi.UriPath; import org.apache.camel.util.component.AbstractApiEndpoint; import org.apache.camel.util.component.ApiMethod; import org.apache.camel.util.component.ApiMethodPropertiesHelper; @@ -54,10 +52,6 @@ public class LinkedInEndpoint extends AbstractApiEndpoint<LinkedInApiName, Linke protected static final String FIELDS_OPTION = "fields"; private static final String DEFAULT_FIELDS_SELECTOR = ""; - @UriPath @Metadata(required = "true") - private final LinkedInApiName apiName; - @UriPath @Metadata(required = "true") - private final String methodName; @UriParam private final LinkedInConfiguration configuration; @@ -70,8 +64,6 @@ public class LinkedInEndpoint extends AbstractApiEndpoint<LinkedInApiName, Linke public LinkedInEndpoint(String uri, LinkedInComponent component, LinkedInApiName apiName, String methodName, LinkedInConfiguration endpointConfiguration) { super(uri, component, apiName, methodName, LinkedInApiCollection.getCollection().getHelper(apiName), endpointConfiguration); - this.apiName = apiName; - this.methodName = methodName; this.configuration = endpointConfiguration; }