1 package org.tigris.scarab.services; 2 3 48 49 import org.apache.turbine.Turbine; 50 import org.apache.fulcrum.BaseService; 51 import org.apache.fulcrum.InitializationException; 52 import org.apache.torque.Torque; 53 import org.tigris.scarab.om.*; 54 import org.tigris.scarab.util.Log; 55 56 65 public class TorqueService 66 extends BaseService 67 { 68 71 public void init() 72 throws InitializationException 73 { 74 try 75 { 76 Torque.init(Turbine.getConfiguration()); 77 Log.get("org.apache.fulcrum").info(" Loading om instances via managers..."); 78 loadOM(); 79 Log.get("org.apache.fulcrum").info(" Done loading om instances."); 80 } 81 catch (Exception e) 82 { 83 throw new InitializationException("Can't initialize Torque!", e); } 85 86 setInit(true); 88 } 89 90 102 protected void loadOM() 103 throws Exception 104 { 105 ActivityManager.getInstance(); 106 ActivitySetManager.getInstance(); 107 ActivitySetTypeManager.getInstance(); 108 AttachmentManager.getInstance(); 109 AttachmentTypeManager.getInstance(); 110 AttributeClassManager.getInstance(); 111 AttributeGroupManager.getInstance(); 112 AttributeManager.getInstance(); 113 AttributeOptionManager.getInstance(); 114 AttributeTypeManager.getInstance(); 115 AttributeValueManager.getManager(); 117 Class.forName("org.tigris.scarab.om.AttributeValue"); 118 DependManager.getInstance(); 119 DependTypeManager.getInstance(); 120 FrequencyManager.getInstance(); 121 GlobalParameterManager.getInstance(); 122 IssueManager.getManager(); 124 Class.forName("org.tigris.scarab.om.Issue"); 125 IssueTemplateInfoManager.getInstance(); 126 IssueTypeManager.getInstance(); 127 IssueVoteManager.getInstance(); 128 MITListItemManager.getInstance(); 129 MITListManager.getInstance(); 130 ModificationManager.getInstance(); 131 ModuleManager.getInstance(); 132 OptionRelationshipManager.getInstance(); 133 PendingGroupUserRoleManager.getInstance(); 134 QueryManager.getInstance(); 135 RAttributeAttributeGroupManager.getInstance(); 136 ReportManager.getInstance(); 137 RIssueTypeAttributeManager.getInstance(); 138 RIssueTypeOptionManager.getInstance(); 139 RModuleAttributeManager.getInstance(); 140 RModuleIssueTypeManager.getInstance(); 141 RModuleOptionManager.getInstance(); 142 RModuleUserAttributeManager.getInstance(); 143 ROptionOptionManager.getManager(); 145 Class.forName("org.tigris.scarab.om.ROptionOption"); 146 RQueryUserManager.getInstance(); 147 ScarabUserManager.getInstance(); 148 ScopeManager.getInstance(); 149 UserPreferenceManager.getInstance(); 150 UserVoteManager.getInstance(); 151 } 152 153 159 public void shutdown() 160 { 161 Torque.shutdown(); 162 } 163 } 164 | Popular Tags |