1 16 17 package org.apache.jetspeed.util.template; 18 19 import org.apache.jetspeed.util.template.JetspeedLink; 21 import org.apache.jetspeed.services.resources.JetspeedResources; 22 23 import org.apache.turbine.util.TurbineException; 25 import org.apache.turbine.services.factory.FactoryService; 26 import org.apache.turbine.services.pool.TurbinePool; 27 import org.apache.turbine.services.TurbineServices; 28 import org.apache.turbine.util.RunData; 29 30 36 public class JetspeedLinkFactory 37 { 38 43 private static String JETSPEEDLINK_CLASSNAME = JetspeedResources.getString("tool.request.jslink","org.apache.jetspeed.util.template.BaseJetspeedLink"); 44 private static FactoryService factoryService = (FactoryService) TurbineServices. 45 getInstance().getService(FactoryService.SERVICE_NAME); 46 47 48 58 static JetspeedLink getInstance() 59 throws TurbineException 60 { 61 JetspeedLink jsLink = (JetspeedLink) TurbinePool.getInstance( JETSPEEDLINK_CLASSNAME); 62 if (jsLink == null) 63 jsLink = (JetspeedLink) factoryService.getInstance(JETSPEEDLINK_CLASSNAME); 64 return jsLink; 65 } 66 67 76 public static JetspeedLink getInstance( RunData rundata) 77 throws TurbineException 78 { 79 JetspeedLink jsLink = getInstance(); 80 if (jsLink != null) 81 jsLink.init(rundata); 82 return jsLink; 83 } 84 85 90 public static void putInstance(JetspeedLink jetspeedLink) 91 { 92 if (jetspeedLink != null) 93 TurbinePool.putInstance( jetspeedLink); 94 return; 95 } 96 } 97 | Popular Tags |