1
22
23 package com.liferay.portal.lar;
24
25 import javax.portlet.PortletPreferences;
26
27
33 public class InvokerPortletDataHandler implements PortletDataHandler {
34
35 public InvokerPortletDataHandler(
36 PortletDataHandler portletDataHandler, ClassLoader classLoader) {
37
38 _portletDataHandler = portletDataHandler;
39 _classLoader = classLoader;
40 }
41
42 public PortletPreferences deleteData(
43 PortletDataContext context, String portletId,
44 PortletPreferences preferences)
45 throws PortletDataException {
46
47 Thread currentThread = Thread.currentThread();
48
49 ClassLoader contextClassLoader = currentThread.getContextClassLoader();
50
51 try {
52 currentThread.setContextClassLoader(_classLoader);
53
54 return _portletDataHandler.deleteData(
55 context, portletId, preferences);
56 }
57 finally {
58 currentThread.setContextClassLoader(contextClassLoader);
59 }
60 }
61
62 public String exportData(
63 PortletDataContext context, String portletId,
64 PortletPreferences preferences)
65 throws PortletDataException {
66
67 Thread currentThread = Thread.currentThread();
68
69 ClassLoader contextClassLoader = currentThread.getContextClassLoader();
70
71 try {
72 currentThread.setContextClassLoader(_classLoader);
73
74 return _portletDataHandler.exportData(
75 context, portletId, preferences);
76 }
77 finally {
78 currentThread.setContextClassLoader(contextClassLoader);
79 }
80 }
81
82 public PortletDataHandlerControl[] getExportControls()
83 throws PortletDataException {
84
85 Thread currentThread = Thread.currentThread();
86
87 ClassLoader contextClassLoader = currentThread.getContextClassLoader();
88
89 try {
90 currentThread.setContextClassLoader(_classLoader);
91
92 return _portletDataHandler.getExportControls();
93 }
94 finally {
95 currentThread.setContextClassLoader(contextClassLoader);
96 }
97 }
98
99 public PortletDataHandlerControl[] getImportControls()
100 throws PortletDataException {
101
102 Thread currentThread = Thread.currentThread();
103
104 ClassLoader contextClassLoader = currentThread.getContextClassLoader();
105
106 try {
107 currentThread.setContextClassLoader(_classLoader);
108
109 return _portletDataHandler.getImportControls();
110 }
111 finally {
112 currentThread.setContextClassLoader(contextClassLoader);
113 }
114 }
115
116 public PortletPreferences importData(
117 PortletDataContext context, String portletId,
118 PortletPreferences preferences, String data)
119 throws PortletDataException {
120
121 Thread currentThread = Thread.currentThread();
122
123 ClassLoader contextClassLoader = currentThread.getContextClassLoader();
124
125 try {
126 currentThread.setContextClassLoader(_classLoader);
127
128 return _portletDataHandler.importData(
129 context, portletId, preferences, data);
130 }
131 finally {
132 currentThread.setContextClassLoader(contextClassLoader);
133 }
134 }
135
136 public boolean isPublishToLiveByDefault() {
137 Thread currentThread = Thread.currentThread();
138
139 ClassLoader contextClassLoader = currentThread.getContextClassLoader();
140
141 try {
142 currentThread.setContextClassLoader(_classLoader);
143
144 return _portletDataHandler.isPublishToLiveByDefault();
145 }
146 finally {
147 currentThread.setContextClassLoader(contextClassLoader);
148 }
149 }
150
151 private PortletDataHandler _portletDataHandler;
152 private ClassLoader _classLoader;
153
154 }