[
https://issues.apache.org/jira/browse/STORM-2016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15413050#comment-15413050
]
ASF GitHub Bot commented on STORM-2016:
---------------------------------------
Github user HeartSaVioR commented on a diff in the pull request:
https://github.com/apache/storm/pull/1608#discussion_r74005665
--- Diff:
external/storm-submit/src/main/java/org/apache/storm/submit/dependency/AetherUtils.java
---
@@ -0,0 +1,81 @@
+/**
+ * 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.storm.submit.dependency;
+
+import org.sonatype.aether.artifact.Artifact;
+import org.sonatype.aether.graph.Dependency;
+import org.sonatype.aether.graph.Exclusion;
+import org.sonatype.aether.util.artifact.DefaultArtifact;
+import org.sonatype.aether.util.artifact.JavaScopes;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+public class AetherUtils {
+ private AetherUtils() {
+ }
+
+ public static Dependency parseDependency(String dependency) {
+ List<String> dependencyAndExclusions =
Arrays.asList(dependency.split("!"));
+ Collection<Exclusion> exclusions = new ArrayList<>();
+ for (int idx = 1 ; idx < dependencyAndExclusions.size() ; idx++) {
+
exclusions.add(AetherUtils.createExclusion(dependencyAndExclusions.get(idx)));
+ }
+
+ Artifact artifact = new
DefaultArtifact(dependencyAndExclusions.get(0));
+ return new Dependency(artifact, JavaScopes.COMPILE, false,
exclusions);
+ }
+
+ public static Exclusion createExclusion(String exclusionString) {
+ String[] parts = exclusionString.split(":");
+
+ // length of parts should be greater than 0
+ String groupId = parts[0];
+
+ String artifactId = "*";
+ String classifier = "*";
+ String extension = "*";
+
+ int len = parts.length;
+ if (len > 1) {
+ artifactId = parts[1];
+ }
+ if (len > 2) {
+ classifier = parts[2];
+ }
+ if (len > 3) {
+ extension = parts[3];
+ }
+
+ return new Exclusion(groupId, artifactId, classifier, extension);
+ }
+
+ public static String artifactToString(Artifact artifact) {
+ StringBuilder buffer = new StringBuilder(128);
+ buffer.append(artifact.getGroupId());
+ buffer.append(':').append(artifact.getArtifactId());
+ buffer.append(':').append(artifact.getExtension());
+ if(artifact.getClassifier().length() > 0) {
--- End diff --
OK will address.
> Topology submission improvement: support adding local jars and maven
> artifacts on submission
> --------------------------------------------------------------------------------------------
>
> Key: STORM-2016
> URL: https://issues.apache.org/jira/browse/STORM-2016
> Project: Apache Storm
> Issue Type: Improvement
> Components: storm-core
> Reporter: Jungtaek Lim
> Assignee: Jungtaek Lim
>
> This JIRA tracks actual work on below proposal / design document.
> https://cwiki.apache.org/confluence/display/STORM/A.+Design+doc%3A+adding+jars+and+maven+artifacts+at+submission
> Proposal discussion thread is here:
> http://mail-archives.apache.org/mod_mbox/storm-dev/201608.mbox/%3ccaf5108i9+tjanz0lgrktmkvqel7f+53k9uyzxct6zhsu6oh...@mail.gmail.com%3E
> Let's post on discussion thread if we have any opinions / ideas on this
> instead of leaving comments on this issue.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)