CQProductInfoProvider.java
4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.granite.license.ProductInfo
* com.adobe.granite.license.ProductInfoProvider
* org.apache.felix.scr.annotations.Activate
* org.apache.felix.scr.annotations.Component
* org.apache.felix.scr.annotations.Service
* org.apache.sling.api.resource.ValueMap
* org.apache.sling.api.wrappers.ValueMapDecorator
* org.osgi.framework.Version
* org.osgi.service.component.ComponentContext
*/
package com.adobe.cq.product.info.impl;
import com.adobe.granite.license.ProductInfo;
import com.adobe.granite.license.ProductInfoProvider;
import java.util.HashMap;
import java.util.Map;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.api.wrappers.ValueMapDecorator;
import org.osgi.framework.Version;
import org.osgi.service.component.ComponentContext;
@Component(metatype=0)
@Service
public class CQProductInfoProvider
implements ProductInfoProvider {
private static final String prodName = "Adobe Experience Manager";
private static final String prodShortName = "AEM";
private static final String prodVersion = "6.2.0";
private static final String prodShortVersion = "6.2";
private static final String prodYear = "2015";
private static final String prodUrl = "http://adobe.com/aem";
private static final String prodVendor = "Adobe Systems Incorporated";
private static final String prodVendorUrl = "http://www.adobe.com";
private static final String PN_NAME = "name";
private static final String PN_SHORT_NAME = "shortName";
private static final String PN_VERSION = "version";
private static final String PN_SHORT_VERSION = "shortVersion";
private static final String PN_YEAR = "year";
private static final String PN_URL = "url";
private static final String PN_VENDOR = "vendor";
private static final String PN_VENDOR_URL = "vendorUrl";
private ProductInfo info;
public ProductInfo getProductInfo() {
return this.info;
}
@Activate
private void activate(ComponentContext ctx) {
if (this.info == null) {
HashMap<String, String> props = new HashMap<String, String>();
props.put("name", "Adobe Experience Manager");
props.put("shortName", "AEM");
props.put("shortVersion", "6.2");
props.put("url", "http://adobe.com/aem");
props.put("vendor", "Adobe Systems Incorporated");
props.put("vendorUrl", "http://www.adobe.com");
props.put("version", "6.2.0");
props.put("year", "2015");
this.info = new InfoImpl((ValueMap)new ValueMapDecorator(props));
}
}
private static class InfoImpl
implements ProductInfo {
private final ValueMap props;
private InfoImpl(ValueMap props) {
this.props = props;
}
public String getName() {
return (String)this.props.get("name", (Object)"");
}
public String getShortName() {
return (String)this.props.get("shortName", (Object)"");
}
public Version getVersion() {
String s = (String)this.props.get("version", (Object)"");
return new Version(s.replace("SNAPSHOT.", "SNAPSHOT-"));
}
public String getShortVersion() {
return (String)this.props.get("shortVersion", (Object)"");
}
public String getYear() {
return (String)this.props.get("year", (Object)"");
}
public String getVendor() {
return (String)this.props.get("vendor", (Object)"");
}
public String getVendorUrl() {
return (String)this.props.get("vendorUrl", (Object)"");
}
public String getUrl() {
return (String)this.props.get("url", (Object)"");
}
public ValueMap getProperties() {
return this.props;
}
}
}