Methods Summary |
---|
public void | destroy()
|
private javax.jdo.PersistenceManagerFactory | getPersistenceManagerFactoryFromJndi(java.lang.String jndiName)
Context ic = new InitialContext();
return (PersistenceManagerFactory) ic.lookup(jndiName);
|
private javax.jdo.PersistenceManagerFactory | getPersistenceManagerFactoryFromPath(java.lang.String path)
Properties props = new Properties();
InputStream in = ctx.getResourceAsStream(path);
props.load(in);
return JDOHelper.getPersistenceManagerFactory(props);
|
public void | init(org.apache.struts.action.ActionServlet servlet, org.apache.struts.config.ModuleConfig config)
ctx = servlet.getServletContext();
if (name == null || name.length() == 0) {
throw new ServletException
("You must specify name.");
}
try {
PersistenceManagerFactory pmf;
if (path != null) {
pmf = getPersistenceManagerFactoryFromPath(path);
} else if (jndiName != null) {
pmf = getPersistenceManagerFactoryFromJndi(jndiName);
} else {
throw new ServletException
("You must specify either path or jndiName.");
}
ctx.setAttribute(name, pmf);
} catch (Exception ex) {
throw new ServletException(
"Unable to load PMF: name:" + name +
", path: " + path +
", jndiName: " + jndiName,
ex);
}
|
public void | setJndiName(java.lang.String jndiName)
this.jndiName = jndiName;
|
public void | setName(java.lang.String name)
this.name = name;
|
public void | setPath(java.lang.String path)
this.path = path;
|