1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portal.dao.shard;
16  
17  import com.liferay.portal.kernel.dao.shard.Shard;
18  
19  import javax.sql.DataSource;
20  
21  /**
22   * <a href="ShardImpl.java.html"><b><i>View Source</i></b></a>
23   *
24   * @author Alexander Chow
25   */
26  public class ShardImpl implements Shard {
27  
28      public String getCurrentShardName() {
29          return _shardAdvice.getCurrentShardName();
30      }
31  
32      public DataSource getDataSource() {
33          return _shardAdvice.getDataSource();
34      }
35  
36      public boolean isEnabled() {
37          if (_shardAdvice != null) {
38              return true;
39          }
40          else {
41              return false;
42          }
43      }
44  
45      public String popCompanyService() {
46          String value = null;
47  
48          if (_shardAdvice != null) {
49              value = _shardAdvice.popCompanyService();
50          }
51  
52          return value;
53      }
54  
55      public void pushCompanyService(long companyId) {
56          if (_shardAdvice != null) {
57              _shardAdvice.pushCompanyService(companyId);
58          }
59      }
60  
61      public void pushCompanyService(String shardName) {
62          if (_shardAdvice != null) {
63              _shardAdvice.pushCompanyService(shardName);
64          }
65      }
66  
67      public void setShardAdvice(ShardAdvice shardAdvice) {
68          _shardAdvice = shardAdvice;
69      }
70  
71      private static ShardAdvice _shardAdvice;
72  
73  }