FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
ConnectionReference.java
1/*
2 A RDP connection reference. References can use bookmark ids or hostnames to connect to a RDP
3 server.
4
5 Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
6
7 This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
8 If a copy of the MPL was not distributed with this file, You can obtain one at
9 http://mozilla.org/MPL/2.0/.
10*/
11
12package com.freerdp.freerdpcore.domain;
13
15{
16 public static final String PATH_MANUAL_BOOKMARK_ID = "MBMID/";
17 public static final String PATH_HOSTNAME = "HOST/";
18 public static final String PATH_PLACEHOLDER = "PLCHLD/";
19 public static final String PATH_FILE = "FILE/";
20
21 public static String getManualBookmarkReference(long bookmarkId)
22 {
23 return (PATH_MANUAL_BOOKMARK_ID + bookmarkId);
24 }
25
26 public static String getHostnameReference(String hostname)
27 {
28 return (PATH_HOSTNAME + hostname);
29 }
30
31 public static String getPlaceholderReference(String name)
32 {
33 return (PATH_PLACEHOLDER + name);
34 }
35
36 public static String getFileReference(String uri)
37 {
38 return (PATH_FILE + uri);
39 }
40
41 public static boolean isBookmarkReference(String refStr)
42 {
43 return refStr.startsWith(PATH_MANUAL_BOOKMARK_ID);
44 }
45
46 public static boolean isManualBookmarkReference(String refStr)
47 {
48 return refStr.startsWith(PATH_MANUAL_BOOKMARK_ID);
49 }
50
51 public static boolean isHostnameReference(String refStr)
52 {
53 return refStr.startsWith(PATH_HOSTNAME);
54 }
55
56 public static boolean isPlaceholderReference(String refStr)
57 {
58 return refStr.startsWith(PATH_PLACEHOLDER);
59 }
60
61 public static boolean isFileReference(String refStr)
62 {
63 return refStr.startsWith(PATH_FILE);
64 }
65
66 public static long getManualBookmarkId(String refStr)
67 {
68 return Integer.parseInt(refStr.substring(PATH_MANUAL_BOOKMARK_ID.length()));
69 }
70
71 public static String getHostname(String refStr)
72 {
73 return refStr.substring(PATH_HOSTNAME.length());
74 }
75
76 public static String getPlaceholder(String refStr)
77 {
78 return refStr.substring(PATH_PLACEHOLDER.length());
79 }
80
81 public static String getFile(String refStr)
82 {
83 return refStr.substring(PATH_FILE.length());
84 }
85}