MobileApplicationOperation.java
2.56 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.granite.ui.components.HtmlResponse
* com.day.cq.contentsync.config.Config
* javax.jcr.RepositoryException
* javax.jcr.Session
* org.apache.commons.lang3.StringUtils
* org.apache.sling.api.resource.PersistenceException
* org.apache.sling.api.resource.Resource
* org.apache.sling.api.resource.ResourceResolver
* org.apache.sling.api.resource.ValueMap
*/
package com.adobe.cq.mobile.platform.impl.operations;
import com.adobe.cq.mobile.appcache.impl.AppCacheManager;
import com.adobe.cq.mobile.appcache.impl.AppCacheManagerAdapterFactory;
import com.adobe.cq.mobile.platform.impl.operations.MobileAbstractOperation;
import com.adobe.cq.mobile.platform.impl.utils.MobileUtil;
import com.adobe.granite.ui.components.HtmlResponse;
import com.day.cq.contentsync.config.Config;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import org.apache.commons.lang3.StringUtils;
import org.apache.sling.api.resource.PersistenceException;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ValueMap;
public abstract class MobileApplicationOperation
extends MobileAbstractOperation {
protected Config getContentSyncBuildConfig(Resource appResource, boolean requestingDevConfig) {
Resource content = appResource.getChild("jcr:content");
ValueMap properties = content.getValueMap();
String configPN = requestingDevConfig ? "phonegap-build-exportTemplate-dev" : "phonegap-build-exportTemplate";
String exportConfigPath = (String)properties.get(configPN, String.class);
Config config = null;
if (StringUtils.isNotBlank((CharSequence)exportConfigPath)) {
exportConfigPath = MobileUtil.normalizePath(exportConfigPath, content);
config = (Config)appResource.getResourceResolver().getResource(exportConfigPath).adaptTo(Config.class);
}
return config;
}
protected void clearContentSyncBuildCache(HtmlResponse response, Resource appInstance, boolean requestingDevConfig) throws RepositoryException, PersistenceException {
Session session = (Session)appInstance.getResourceResolver().adaptTo(Session.class);
Config config = this.getContentSyncBuildConfig(appInstance, requestingDevConfig);
AppCacheManager appCacheManager = this.appCacheManagerAdapterFactory.getAdapter((Object)session, AppCacheManager.class);
appCacheManager.clearCache(config);
response.onDeleted(config.getPath());
}
}