001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.impl;
016    
017    import com.liferay.portal.kernel.exception.SystemException;
018    import com.liferay.portal.kernel.log.Log;
019    import com.liferay.portal.kernel.log.LogFactoryUtil;
020    import com.liferay.portal.kernel.util.PropsKeys;
021    import com.liferay.portal.kernel.util.ReleaseInfo;
022    import com.liferay.portal.service.base.PortalServiceBaseImpl;
023    import com.liferay.portal.util.PrefsPropsUtil;
024    import com.liferay.portal.util.PropsValues;
025    
026    /**
027     * @author Brian Wing Shun Chan
028     */
029    public class PortalServiceImpl extends PortalServiceBaseImpl {
030    
031            public String getAutoDeployDirectory() throws SystemException {
032                    return PrefsPropsUtil.getString(
033                            PropsKeys.AUTO_DEPLOY_DEPLOY_DIR,
034                            PropsValues.AUTO_DEPLOY_DEPLOY_DIR);
035            }
036    
037            public int getBuildNumber() {
038                    return ReleaseInfo.getBuildNumber();
039            }
040    
041            public void test() {
042                    long userId = 0;
043    
044                    try {
045                            userId = getUserId();
046                    }
047                    catch (Exception e) {
048                            e.printStackTrace();
049                    }
050    
051                    if (_log.isInfoEnabled()) {
052                            _log.info("User id " + userId);
053                    }
054            }
055    
056            public void testCounterRollback() throws SystemException {
057                    int counterIncrement = PropsValues.COUNTER_INCREMENT;
058    
059                    for (int i = 0; i < counterIncrement * 2; i++) {
060                            counterLocalService.increment();
061                    }
062    
063                    throw new SystemException();
064            }
065    
066            private static Log _log = LogFactoryUtil.getLog(PortalServiceImpl.class);
067    
068    }