1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.myfaces.shared.resource;
20
21
22
23
24 public class ResourceMetaImpl extends ResourceMeta
25 {
26
27 private final String _prefix;
28 private final String _libraryName;
29 private final String _libraryVersion;
30 private final String _resourceName;
31 private final String _resourceVersion;
32 private final String _contractName;
33
34 public ResourceMetaImpl(String prefix, String libraryName, String libraryVersion,
35 String resourceName, String resourceVersion)
36 {
37 this(prefix, libraryName, libraryVersion, resourceName, resourceVersion, null);
38 }
39
40 public ResourceMetaImpl(String prefix, String libraryName, String libraryVersion,
41 String resourceName, String resourceVersion, String contractName)
42 {
43 _prefix = prefix;
44 _libraryName = libraryName;
45 _libraryVersion = libraryVersion;
46 _resourceName = resourceName;
47 _resourceVersion = resourceVersion;
48 _contractName = contractName;
49 }
50
51 public String getLibraryName()
52 {
53 return _libraryName;
54 }
55
56 public String getResourceName()
57 {
58 return _resourceName;
59 }
60
61 public String getLocalePrefix()
62 {
63 return _prefix;
64 }
65
66 public String getLibraryVersion()
67 {
68 return _libraryVersion;
69 }
70
71 public String getResourceVersion()
72 {
73 return _resourceVersion;
74 }
75
76 public String getContractName()
77 {
78 return _contractName;
79 }
80
81 @Override
82 public String getResourceIdentifier()
83 {
84 StringBuilder builder = new StringBuilder();
85 boolean firstSlashAdded = false;
86 if (_prefix != null && _prefix.length() > 0)
87 {
88 builder.append(_prefix);
89 firstSlashAdded = true;
90 }
91 if (_libraryName != null)
92 {
93 if (firstSlashAdded)
94 {
95 builder.append('/');
96 }
97 builder.append(_libraryName);
98 firstSlashAdded = true;
99 }
100 if (_libraryVersion != null)
101 {
102 if (firstSlashAdded)
103 {
104 builder.append('/');
105 }
106 builder.append(_libraryVersion);
107 firstSlashAdded = true;
108 }
109 if (_resourceName != null)
110 {
111 if (firstSlashAdded)
112 {
113 builder.append('/');
114 }
115 builder.append(_resourceName);
116 firstSlashAdded = true;
117 }
118 if (_resourceVersion != null)
119 {
120 if (firstSlashAdded)
121 {
122 builder.append('/');
123 }
124 builder.append(_resourceVersion);
125 builder.append(
126 _resourceName.substring(_resourceName.lastIndexOf('.')));
127 firstSlashAdded = true;
128 }
129
130 return builder.toString();
131 }
132
133 @Override
134 public boolean couldResourceContainValueExpressions()
135 {
136 return false;
137 }
138
139 }