Module.java
2.52 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.sling.api.resource.Resource
* org.apache.sling.api.resource.ResourceUtil
* org.apache.sling.api.resource.ValueMap
*/
package com.adobe.granite.contexthub.api;
import com.adobe.granite.contexthub.impl.ClientLib;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceUtil;
import org.apache.sling.api.resource.ValueMap;
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
public class Module {
private boolean enabled;
private String theme;
private String name;
private String resourceType;
private ValueMap properties;
private Resource resource;
private String path;
private Set<String> runModes;
public Module(Resource resource) {
this.resource = resource;
this.path = resource.getPath();
this.properties = ResourceUtil.getValueMap((Resource)resource);
String[] runModesProperty = (String[])this.properties.get("runModes", String[].class);
this.enabled = (Boolean)this.properties.get("enabled", (Object)false);
this.name = (String)this.properties.get("moduleType", String.class);
this.theme = (String)this.properties.get("theme", String.class);
this.resourceType = resource.getResourceType();
this.runModes = new TreeSet<String>();
if (runModesProperty != null) {
this.runModes.addAll(Arrays.asList(runModesProperty));
}
}
public Set<String> getRunModes() {
return this.runModes;
}
public boolean isEnabled() {
return this.enabled;
}
public String getTheme() {
return this.theme;
}
public String getName() {
return this.name;
}
public String getResourceType() {
return this.resourceType;
}
public ValueMap getProperties() {
return this.properties;
}
public Resource getResource() {
return this.resource;
}
public String getPath() {
return this.path;
}
public List<String> getCategories() {
ArrayList<String> clientLibs = new ArrayList<String>();
clientLibs.add(ClientLib.buildClientlibName("module", this.getName()));
clientLibs.add(ClientLib.buildClientlibName("module", this.getName(), "override"));
return clientLibs;
}
}