KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ofbiz > entity > config > DelegatorInfo


1 /*
2  * $Id: DelegatorInfo.java 5462 2005-08-05 18:35:48Z jonesde $
3  *
4  * Copyright (c) 2001-2005 The Open For Business Project - www.ofbiz.org
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included
14  * in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
21  * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
22  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  */

25 package org.ofbiz.entity.config;
26
27 import java.util.HashMap JavaDoc;
28 import java.util.Iterator JavaDoc;
29 import java.util.List JavaDoc;
30 import java.util.Map JavaDoc;
31
32 import org.ofbiz.base.util.UtilValidate;
33 import org.ofbiz.base.util.UtilXml;
34 import org.w3c.dom.Element JavaDoc;
35
36 /**
37  * Misc. utility method for dealing with the entityengine.xml file
38  *
39  * @author <a HREF="mailto:jonesde@ofbiz.org">David E. Jones</a>
40  * @author <a HREF="mailto:jaz@ofbiz.org">Andy Zeneski</a>
41  * @version $Rev: 5462 $
42  * @since 2.0
43  */

44 public class DelegatorInfo extends NamedInfo {
45
46     public String JavaDoc entityModelReader;
47     public String JavaDoc entityGroupReader;
48     public String JavaDoc entityEcaReader;
49     public boolean useEntityEca;
50     public String JavaDoc entityEcaHandlerClassName;
51     public boolean useDistributedCacheClear;
52     public String JavaDoc distributedCacheClearClassName;
53     public String JavaDoc distributedCacheClearUserLoginId;
54     public String JavaDoc sequencedIdPrefix;
55     public Map JavaDoc groupMap = new HashMap JavaDoc();
56
57     public DelegatorInfo(Element JavaDoc element) {
58         super(element);
59         this.entityModelReader = element.getAttribute("entity-model-reader");
60         this.entityGroupReader = element.getAttribute("entity-group-reader");
61         this.entityEcaReader = element.getAttribute("entity-eca-reader");
62
63         // this defaults to true, ie anything but false is true
64
this.useEntityEca = !"false".equalsIgnoreCase(element.getAttribute("entity-eca-enabled"));
65         this.entityEcaHandlerClassName = element.getAttribute("entity-eca-handler-class-name");
66
67         // this defaults to false, ie anything but true is false
68
this.useDistributedCacheClear = "true".equalsIgnoreCase(element.getAttribute("distributed-cache-clear-enabled"));
69         this.distributedCacheClearClassName = element.getAttribute("distributed-cache-clear-class-name");
70         if (UtilValidate.isEmpty(this.distributedCacheClearClassName)) this.distributedCacheClearClassName = "org.ofbiz.entityext.cache.EntityCacheServices";
71         
72         this.distributedCacheClearUserLoginId = element.getAttribute("distributed-cache-clear-user-login-id");
73         if (UtilValidate.isEmpty(this.distributedCacheClearUserLoginId)) this.distributedCacheClearUserLoginId= "admin";
74
75         this.sequencedIdPrefix = element.getAttribute("sequenced-id-prefix");
76         
77         List JavaDoc groupMapList = UtilXml.childElementList(element, "group-map");
78         Iterator JavaDoc groupMapIter = groupMapList.iterator();
79
80         while (groupMapIter.hasNext()) {
81             Element JavaDoc groupMapElement = (Element JavaDoc) groupMapIter.next();
82             groupMap.put(groupMapElement.getAttribute("group-name"), groupMapElement.getAttribute("datasource-name"));
83         }
84     }
85 }
86
Popular Tags