AbstractDPSClient.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
55
56
57
58
59
60
61
62
63
64
65
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.day.cq.wcm.webservicesupport.ConfigurationManager
* javax.jcr.Session
* org.apache.sling.api.adapter.AdapterManager
* org.apache.sling.commons.threads.ThreadPool
* org.osgi.service.event.EventAdmin
* org.slf4j.Logger
* org.slf4j.LoggerFactory
*/
package com.adobe.cq.mobile.dps.impl.service;
import com.adobe.cq.mobile.dps.DPSException;
import com.adobe.cq.mobile.dps.DPSObject;
import com.adobe.cq.mobile.dps.impl.service.DPSConnectionAdapterFactory;
import com.day.cq.wcm.webservicesupport.ConfigurationManager;
import javax.jcr.Session;
import org.apache.sling.api.adapter.AdapterManager;
import org.apache.sling.commons.threads.ThreadPool;
import org.osgi.service.event.EventAdmin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AbstractDPSClient {
protected Logger LOGGER = LoggerFactory.getLogger(AbstractDPSClient.class);
protected Session userSession = null;
protected ConfigurationManager configurationManagerService = null;
protected AdapterManager adapterManager = null;
protected EventAdmin eventAdminService = null;
protected DPSConnectionAdapterFactory dpsConnectionAdapterFactory = null;
protected ThreadPool threadPool;
protected AbstractDPSClient(Session userSession, DPSConnectionAdapterFactory dpsConnectionAdapterFactory, ConfigurationManager configurationManagerService, EventAdmin eventAdminService, AdapterManager adapterManager, ThreadPool threadPool) {
this.userSession = userSession;
this.configurationManagerService = configurationManagerService;
this.eventAdminService = eventAdminService;
this.adapterManager = adapterManager;
this.dpsConnectionAdapterFactory = dpsConnectionAdapterFactory;
this.threadPool = threadPool;
this.LOGGER = LoggerFactory.getLogger(this.getClass());
}
protected String getSharedContentURI(String projectId) {
String entityName = "SHARED_HTML_RESOURCES";
return "/publication/" + projectId + "/sharedContent/" + entityName;
}
public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
if (Session.class == type) {
return (AdapterType)this.userSession;
}
return null;
}
protected String getAndAssertProjectId(DPSObject dpsObject) throws DPSException {
String projectId = dpsObject.getProjectId();
if (projectId == null) {
throw new DPSException("Project not set for " + dpsObject.getPath());
}
return projectId;
}
}