0
# Liferay Portal Implementation
1
2
Core implementation module containing the fundamental services, utilities, and infrastructure components for the Liferay Digital Experience Platform. This module provides essential backend functionality including user management, authentication, authorization, database access layers, service implementations, and integration points for the broader Liferay ecosystem.
3
4
## Package Information
5
6
- **Package Name**: com.liferay.portal.impl
7
- **Package Type**: maven
8
- **Language**: Java
9
- **Installation**: Maven dependency or OSGi bundle deployment
10
- **Bundle Symbolic Name**: com.liferay.portal.impl
11
- **Bundle Version**: 113.1.2
12
13
## Core Imports
14
15
For dependency injection and bean access:
16
17
```java
18
import com.liferay.portal.bean.BeanLocatorImpl;
19
import com.liferay.portal.bean.BeanPropertiesImpl;
20
import java.util.Map;
21
```
22
23
For database and Hibernate integration:
24
25
```java
26
import com.liferay.portal.dao.orm.hibernate.SessionFactoryImpl;
27
import com.liferay.portal.dao.orm.hibernate.SessionImpl;
28
import com.liferay.portal.dao.orm.hibernate.DynamicQueryFactoryImpl;
29
```
30
31
For lifecycle and event handling:
32
33
```java
34
import com.liferay.portal.events.GlobalStartupAction;
35
import com.liferay.portal.events.LoginPreAction;
36
import com.liferay.portal.events.ServicePreAction;
37
```
38
39
## Basic Usage
40
41
```java
42
// Bean location and property access
43
BeanLocatorImpl beanLocator = new BeanLocatorImpl();
44
Object bean = beanLocator.locate("myBeanName");
45
46
BeanPropertiesImpl beanProps = new BeanPropertiesImpl();
47
String value = beanProps.getString(bean, "propertyName");
48
49
// Database operations using Hibernate integration
50
SessionFactoryImpl sessionFactory = new SessionFactoryImpl();
51
SessionImpl session = (SessionImpl) sessionFactory.openSession();
52
53
DynamicQueryFactoryImpl queryFactory = new DynamicQueryFactoryImpl();
54
DynamicQueryImpl query = (DynamicQueryImpl) queryFactory.forClass(MyEntity.class);
55
56
// Template processing with FreeMarker
57
// Template engine integration for dynamic content generation
58
59
// Service layer operations
60
// Access to portal services through standardized interfaces
61
```
62
63
## Architecture
64
65
The Liferay portal-impl module is structured around several key architectural patterns:
66
67
- **Interface Implementation Pattern**: Concrete implementations of portal-kernel interfaces providing the actual functionality
68
- **Factory Pattern**: Extensive use of factory classes for creating service objects and maintaining loose coupling
69
- **Spring Integration**: Heavy dependency injection and lifecycle management through Spring Framework
70
- **Hibernate ORM**: Comprehensive database abstraction with custom types, dialects, and property accessors
71
- **Event-Driven Architecture**: Lifecycle events and actions for portal startup, shutdown, authentication, and request processing
72
- **OSGi Bundle**: Modular architecture with clearly defined exported packages and service boundaries
73
74
## Capabilities
75
76
### Bean Management & Dependency Injection
77
78
Spring-based dependency injection system providing bean location, property access, and Velocity template integration for the portal framework.
79
80
```java { .api }
81
public class BeanLocatorImpl implements BeanLocator {
82
public Object locate(String name) throws BeanLocatorException;
83
public <T> Map<String, T> locate(Class<T> clazz) throws BeanLocatorException;
84
public String[] getNames();
85
public Class<?> getType(String name);
86
public ClassLoader getClassLoader();
87
public ApplicationContext getApplicationContext();
88
public void destroy();
89
}
90
91
public class BeanPropertiesImpl implements BeanProperties {
92
// Property getters with default values
93
public boolean getBoolean(Object bean, String param);
94
public boolean getBoolean(Object bean, String param, boolean defaultValue);
95
public String getString(Object bean, String param);
96
public String getString(Object bean, String param, String defaultValue);
97
public int getInteger(Object bean, String param);
98
public int getInteger(Object bean, String param, int defaultValue);
99
public long getLong(Object bean, String param);
100
public double getDouble(Object bean, String param);
101
public float getFloat(Object bean, String param);
102
public Object getObject(Object bean, String param);
103
104
// Silent variants (no logging on errors)
105
public boolean getBooleanSilent(Object bean, String param);
106
public String getStringSilent(Object bean, String param);
107
public int getIntegerSilent(Object bean, String param);
108
// ... more silent variants
109
110
// Property manipulation
111
public void copyProperties(Object source, Object target);
112
public <T> T deepCopyProperties(Object source) throws Exception;
113
public void setProperty(Object bean, String param, Object value);
114
public void setPropertySilent(Object bean, String param, Object value);
115
public void setProperties(Object bean, HttpServletRequest request);
116
}
117
```
118
119
[Bean Management](./bean-management.md)
120
121
### Database & ORM Layer
122
123
Comprehensive Hibernate ORM integration with custom types, property accessors, database dialects, and dynamic query building capabilities.
124
125
```java { .api }
126
public class SessionFactoryImpl implements SessionFactory {
127
public Session openSession();
128
public Session getCurrentSession();
129
}
130
131
public class DynamicQueryFactoryImpl implements DynamicQueryFactory {
132
public DynamicQuery forClass(Class<?> clazz);
133
public DynamicQuery forClass(Class<?> clazz, ClassLoader classLoader);
134
}
135
136
public interface DynamicQuery {
137
public DynamicQuery add(Criterion criterion);
138
public DynamicQuery addOrder(Order order);
139
public List<Object> list();
140
}
141
```
142
143
[Database & ORM](./database-orm.md)
144
145
### Lifecycle Events & Actions
146
147
Event-driven system handling portal startup, shutdown, authentication, session management, and service request processing.
148
149
```java { .api }
150
public class GlobalStartupAction extends Action {
151
public void run(HttpServletRequest request, HttpServletResponse response);
152
}
153
154
public class LoginPreAction extends Action {
155
public void run(HttpServletRequest request, HttpServletResponse response);
156
}
157
158
public class SessionCreateAction extends SessionAction {
159
public void run(HttpSession session);
160
}
161
```
162
163
[Lifecycle Events](./lifecycle-events.md)
164
165
### Service Layer
166
167
Core portal services providing business logic implementations, HTTP endpoints, and permission checking capabilities.
168
169
```java { .api }
170
// Service implementations for portal entities
171
// HTTP-specific service endpoints and utilities
172
// Permission checking implementations for security
173
```
174
175
[Service Layer](./service-layer.md)
176
177
### Web Layer & Security
178
179
Servlet implementations, request filters, authentication verification, and security utilities for web request processing.
180
181
```java { .api }
182
// Core servlet implementations and utilities
183
// Request processing filters
184
// Authentication verification filters
185
// Security-related language and utility classes
186
```
187
188
[Web Layer & Security](./web-security.md)
189
190
### Template Processing
191
192
Template engine integrations including FreeMarker support and generic template processing utilities for dynamic content generation.
193
194
```java { .api }
195
// FreeMarker template engine integration
196
// Generic template processing utilities
197
```
198
199
[Template Processing](./template-processing.md)
200
201
### Utility Services
202
203
Core utilities including formatting, minification, file operations, XML processing, and portal-specific utility implementations.
204
205
```java { .api }
206
// Configuration management, file operations, localization
207
// Text and content formatting utilities
208
// CSS and JavaScript minification
209
// File upload processing
210
// XML processing and manipulation
211
```
212
213
[Utility Services](./utility-services.md)
214
215
### Portlet Framework
216
217
Complete portlet framework implementation including containers, request/response handling, asset management, and document library functionality.
218
219
```java { .api }
220
// Core portlet framework implementations
221
// Asset framework implementations
222
// Document Library portlet implementations
223
// Expando (custom fields) implementations
224
```
225
226
[Portlet Framework](./portlet-framework.md)
227
228
### Database Upgrades
229
230
Version-specific database migration utilities supporting upgrades between Liferay 7.x versions with schema transformation capabilities.
231
232
```java { .api }
233
// Utilities for database schema upgrades
234
// Version-specific upgrade implementations
235
```
236
237
[Database Upgrades](./database-upgrades.md)
238
239
### Framework Integration
240
241
Spring Framework configuration, development tools, plugin management, and hot deployment capabilities.
242
243
```java { .api }
244
// Spring Framework integration and configuration
245
// Development and build tools
246
// Hot deployment functionality for plugins
247
// Plugin management and deployment utilities
248
```
249
250
[Framework Integration](./framework-integration.md)
251
252
## Database Support
253
254
The portal-impl module provides comprehensive database support through custom Hibernate dialects:
255
256
- **IBM DB2** - Enterprise database support with optimized dialect
257
- **HSQL Database** - Embedded database support for development and testing
258
- **MariaDB/MySQL** - Open source database support with MariaDB-specific optimizations
259
- **Oracle 10g+** - Enterprise Oracle support with version-specific features
260
- **Microsoft SQL Server 2005/2008+** - Microsoft database support with multiple version compatibility
261
262
## Integration Points
263
264
The exported API provides extensive integration capabilities for:
265
266
- **Authentication Systems** - Custom authentication mechanisms and security providers
267
- **Template Engines** - FreeMarker integration and generic template processing
268
- **Database Connectivity** - Multiple database backend support with custom dialects
269
- **Plugin Systems** - Hot deployment and plugin lifecycle management
270
- **Asset Management** - Content and media asset handling with storage backends
271
- **Document Storage** - Flexible document storage implementations
272
- **Search Functionality** - Content indexing and search capabilities
273
- **Upgrade Procedures** - Database schema migration and version upgrade support
274
- **Enterprise Integration** - Spring Framework, web services, and enterprise patterns
275
276
## Error Handling
277
278
The portal-impl module handles various types of exceptions and errors:
279
280
- **Database Exceptions** - Hibernate-specific exceptions and transaction management
281
- **Authentication Errors** - Login failures, permission denied, session timeouts
282
- **Template Errors** - FreeMarker processing exceptions and template compilation errors
283
- **Plugin Deployment Errors** - Hot deployment failures and plugin lifecycle exceptions
284
- **Service Exceptions** - Business logic exceptions and validation errors
285
286
Common error handling patterns include comprehensive logging, exception transformation, and graceful degradation for non-critical failures.