This repository has been archived by the owner on Nov 22, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
183 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** | ||
* @license | ||
* Copyright 2017 JBoss Inc | ||
* | ||
* Licensed 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. | ||
*/ | ||
|
||
export class PathUtils { | ||
|
||
/** | ||
* Get the connection name from the supplied source path | ||
* @param {string} sourcePath | ||
* @returns {string} the connection name | ||
*/ | ||
public static getConnectionName(sourcePath: string): string { | ||
const fqnArray = sourcePath.split("/", 10); | ||
|
||
const arrayLength = fqnArray.length; | ||
const connectionSegment = fqnArray[0]; | ||
let parts = connectionSegment.split("=", 2); | ||
const connName = parts[1]; | ||
|
||
return connName; | ||
} | ||
|
||
/** | ||
* Get the source name from the supplied source path | ||
* @param {string} sourcePath | ||
* @returns {string} the source name | ||
*/ | ||
public static getSourceName(sourcePath: string): string { | ||
const fqnArray = sourcePath.split("/", 10); | ||
|
||
const arrayLength = fqnArray.length; | ||
const nodeSeqment = fqnArray[arrayLength - 1]; | ||
let parts = nodeSeqment.split("=", 2); | ||
const nodeName = parts[1]; | ||
|
||
return nodeName; | ||
} | ||
|
||
/** | ||
* Get the source type from the supplied source path | ||
* @param {string} sourcePath | ||
* @returns {string} the source type | ||
*/ | ||
public static getSourceType(sourcePath: string): string { | ||
const fqnArray = sourcePath.split("/", 10); | ||
|
||
const arrayLength = fqnArray.length; | ||
const nodeSeqment = fqnArray[arrayLength - 1]; | ||
let parts = nodeSeqment.split("=", 2); | ||
const nodeType = parts[0]; | ||
|
||
return nodeType; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.