/hostadmiral/trunk/src/ak/hostadmiral/core/config/Configurator.java |
---|
18,7 → 18,7 |
public class Configurator |
{ |
public static final int CONFIG_VERSION = 1; |
public static final int CONFIG_VERSION = 1; |
private static final Logger logger = Logger.getLogger(Configurator.class); |
123,14 → 123,14 |
private Digester createDigester() |
{ |
Digester digester = new Digester(); |
digester.setValidating(false); |
digester.addObjectCreate("hostadmiral", ConfigRoot.class); |
digester.addSetProperties("hostadmiral/version", "major", "versionMajor"); |
digester.addSetProperties("hostadmiral/version", "minor", "versionMinor"); |
digester.addObjectCreate("hostadmiral/datasource", ConfigDataSource.class); |
Digester digester = new Digester(); |
digester.setValidating(false); |
digester.addObjectCreate("hostadmiral", ConfigRoot.class); |
digester.addSetProperties("hostadmiral/version", "major", "versionMajor"); |
digester.addSetProperties("hostadmiral/version", "minor", "versionMinor"); |
digester.addObjectCreate("hostadmiral/datasource", ConfigDataSource.class); |
digester.addBeanPropertySetter("hostadmiral/datasource/type", "type"); |
digester.addBeanPropertySetter("hostadmiral/datasource/settings/driver", "driver"); |
digester.addBeanPropertySetter("hostadmiral/datasource/settings/username", "userName"); |
138,13 → 138,13 |
digester.addBeanPropertySetter("hostadmiral/datasource/settings/url", "url"); |
digester.addBeanPropertySetter("hostadmiral/datasource/settings/dialect", "dialect"); |
digester.addSetNext("hostadmiral/datasource", "setDataSource"); |
digester.addObjectCreate("hostadmiral/initializations/initialization", |
ConfigInitialization.class); |
digester.addBeanPropertySetter("hostadmiral/initializations/initialization/class", |
"className"); |
digester.addSetNext("hostadmiral/initializations/initialization", "addInitialization"); |
digester.addObjectCreate("hostadmiral/initializations/initialization/init-param", |
ConfigInitParam.class); |
digester.addBeanPropertySetter( |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/PageLinkTag.java |
---|
1,64 → 1,64 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.tagext.Tag; |
import org.apache.struts.taglib.html.LinkTag; |
import ak.backpath.BackPath; |
import ak.hostadmiral.util.CollectionInfo; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.tagext.Tag; |
import org.apache.struts.taglib.html.LinkTag; |
import ak.backpath.BackPath; |
import ak.hostadmiral.util.CollectionInfo; |
public class PageLinkTag |
extends LinkTag |
extends LinkTag |
{ |
public static String BACKPATH_KEY = BackPath.DEFAULT_KEY + "_list"; |
public static String PAGE_PARAM_NAME = "pg"; |
protected PageIterateTag parent; |
protected void findParent() |
throws JspException |
{ |
Tag p = getParent(); |
while(p != null && !(p instanceof PageIterateTag)) |
p = p.getParent(); |
if(p == null) |
throw new JspException("This tag must be inside PageIterateTag"); |
parent = (PageIterateTag)p; |
} |
protected BackPath findBackPath() |
throws JspException |
{ |
try { |
return BackPath.findBackPath((HttpServletRequest)pageContext.getRequest(), |
BACKPATH_KEY, BackPath.DEFAULT_PARAM, |
new String[] { "backpath", PAGE_PARAM_NAME }, |
BackPath.DEFAULT_ZIP); |
} |
catch(Exception ex) { |
throw new JspException(ex); |
} |
} |
protected String calculateURL() |
throws JspException |
{ |
String urlStr = findBackPath().getCurrentUrl(); |
if(urlStr == null) return "/"; |
StringBuffer url = new StringBuffer(urlStr); |
boolean hasParams = (url.indexOf("?") > 0); |
findParent(); |
if(hasParams) |
url.append("&").append(PAGE_PARAM_NAME + "=").append(parent.getDisplayPage()); |
else |
url.append("?").append(PAGE_PARAM_NAME + "=").append(parent.getDisplayPage()); |
return url.toString(); |
} |
protected PageIterateTag parent; |
protected void findParent() |
throws JspException |
{ |
Tag p = getParent(); |
while(p != null && !(p instanceof PageIterateTag)) |
p = p.getParent(); |
if(p == null) |
throw new JspException("This tag must be inside PageIterateTag"); |
parent = (PageIterateTag)p; |
} |
protected BackPath findBackPath() |
throws JspException |
{ |
try { |
return BackPath.findBackPath((HttpServletRequest)pageContext.getRequest(), |
BACKPATH_KEY, BackPath.DEFAULT_PARAM, |
new String[] { "backpath", PAGE_PARAM_NAME }, |
BackPath.DEFAULT_ZIP); |
} |
catch(Exception ex) { |
throw new JspException(ex); |
} |
} |
protected String calculateURL() |
throws JspException |
{ |
String urlStr = findBackPath().getCurrentUrl(); |
if(urlStr == null) return "/"; |
StringBuffer url = new StringBuffer(urlStr); |
boolean hasParams = (url.indexOf("?") > 0); |
findParent(); |
if(hasParams) |
url.append("&").append(PAGE_PARAM_NAME + "=").append(parent.getDisplayPage()); |
else |
url.append("?").append(PAGE_PARAM_NAME + "=").append(parent.getDisplayPage()); |
return url.toString(); |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/PageTagBase.java |
---|
1,10 → 1,10 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.jsp.JspException; |
import org.apache.struts.taglib.html.LinkTag; |
import org.apache.struts.util.RequestUtils; |
import ak.backpath.BackPath; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.jsp.JspException; |
import org.apache.struts.taglib.html.LinkTag; |
import org.apache.struts.util.RequestUtils; |
import ak.backpath.BackPath; |
import ak.hostadmiral.util.CollectionInfo; |
public abstract class PageTagBase |
13,56 → 13,56 |
public static String BACKPATH_KEY = BackPath.DEFAULT_KEY + "_list"; |
public static String PAGE_PARAM_NAME = "pg"; |
protected String infoBean = null; |
public String getInfoBean() |
{ |
return this.infoBean; |
} |
public void setInfoBean(String infoBean) |
{ |
this.infoBean = infoBean; |
} |
protected String infoProperty = null; |
public String getInfoProperty() |
{ |
return this.infoProperty; |
} |
public void setInfoProperty(String infoProperty) |
{ |
this.infoProperty = infoProperty; |
} |
protected String infoBean = null; |
public String getInfoBean() |
{ |
return this.infoBean; |
} |
public void setInfoBean(String infoBean) |
{ |
this.infoBean = infoBean; |
} |
protected String infoProperty = null; |
public String getInfoProperty() |
{ |
return this.infoProperty; |
} |
public void setInfoProperty(String infoProperty) |
{ |
this.infoProperty = infoProperty; |
} |
protected BackPath findBackPath() |
throws JspException |
{ |
try { |
return BackPath.findBackPath((HttpServletRequest)pageContext.getRequest(), |
throws JspException |
{ |
try { |
return BackPath.findBackPath((HttpServletRequest)pageContext.getRequest(), |
BACKPATH_KEY, BackPath.DEFAULT_PARAM, |
new String[] { "backpath", PAGE_PARAM_NAME }, |
BackPath.DEFAULT_ZIP); |
} |
catch(Exception ex) { |
throw new JspException(ex); |
} |
} |
BackPath.DEFAULT_ZIP); |
} |
catch(Exception ex) { |
throw new JspException(ex); |
} |
} |
protected String calculateURL() |
throws JspException |
{ |
String urlStr = findBackPath().getCurrentUrl(); |
if(urlStr == null) return "/"; |
throws JspException |
{ |
String urlStr = findBackPath().getCurrentUrl(); |
if(urlStr == null) return "/"; |
StringBuffer url = new StringBuffer(urlStr); |
boolean hasParams = (url.indexOf("?") > 0); |
if(hasParams) |
url.append("&").append(PAGE_PARAM_NAME + "=").append(getDisplayPage()); |
else |
if(hasParams) |
url.append("&").append(PAGE_PARAM_NAME + "=").append(getDisplayPage()); |
else |
url.append("?").append(PAGE_PARAM_NAME + "=").append(getDisplayPage()); |
return url.toString(); |
74,14 → 74,14 |
protected CollectionInfo getCollectionInfo() |
throws JspException |
{ |
return (CollectionInfo) |
RequestUtils.lookup(pageContext, infoBean, infoProperty, null); |
} |
return (CollectionInfo) |
RequestUtils.lookup(pageContext, infoBean, infoProperty, null); |
} |
public void release() |
{ |
super.release(); |
infoBean = null; |
infoProperty = null; |
} |
{ |
super.release(); |
infoBean = null; |
infoProperty = null; |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/PageIterateTag.java |
---|
1,119 → 1,119 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.tagext.BodyTagSupport; |
import org.apache.struts.util.RequestUtils; |
import org.apache.struts.util.ResponseUtils; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.tagext.BodyTagSupport; |
import org.apache.struts.util.RequestUtils; |
import org.apache.struts.util.ResponseUtils; |
import ak.hostadmiral.util.CollectionInfo; |
public class PageIterateTag |
extends BodyTagSupport |
{ |
protected String infoBean = null; |
public String getInfoBean() |
{ |
return this.infoBean; |
} |
public void setInfoBean(String infoBean) |
{ |
this.infoBean = infoBean; |
} |
protected String infoProperty = null; |
public String getInfoProperty() |
{ |
return this.infoProperty; |
} |
public void setInfoProperty(String infoProperty) |
{ |
this.infoProperty = infoProperty; |
} |
protected int max = 0; |
public String getMax() |
{ |
return Integer.toString(this.max); |
} |
public void setMax(String max) |
{ |
this.max = Integer.parseInt(max); |
} |
protected int displayPage; |
public int getDisplayPage() |
{ |
return this.displayPage; |
} |
protected CollectionInfo collectionInfo; |
public CollectionInfo getCollectionInfo() |
{ |
return this.collectionInfo; |
} |
public int doStartTag() throws JspException |
{ |
collectionInfo = findCollectionInfo(); |
displayPage = (max == 0) ? 0 |
: Math.max(0, collectionInfo.getCurrentPage() - max/2); |
if(collectionInfo == null) return SKIP_BODY; |
if(collectionInfo.getTotalPages() > 0) |
return EVAL_BODY_TAG; |
else |
return SKIP_BODY; |
} |
public int doAfterBody() throws JspException |
{ |
// Render the output from this iteration to the output stream |
if(bodyContent != null) { |
ResponseUtils.writePrevious(pageContext, bodyContent.getString()); |
bodyContent.clearBody(); |
} |
displayPage++; |
if(max == 0 && displayPage < collectionInfo.getTotalPages()) { |
return EVAL_BODY_TAG; |
} |
else if(max > 0 && displayPage < collectionInfo.getTotalPages() |
&& displayPage < collectionInfo.getCurrentPage() + max/2) |
{ |
return EVAL_BODY_TAG; |
} |
else { |
return SKIP_BODY; |
} |
} |
public int doEndTag() throws JspException |
{ |
return EVAL_PAGE; |
} |
public class PageIterateTag |
extends BodyTagSupport |
{ |
protected String infoBean = null; |
public String getInfoBean() |
{ |
return this.infoBean; |
} |
public void setInfoBean(String infoBean) |
{ |
this.infoBean = infoBean; |
} |
protected String infoProperty = null; |
public String getInfoProperty() |
{ |
return this.infoProperty; |
} |
public void setInfoProperty(String infoProperty) |
{ |
this.infoProperty = infoProperty; |
} |
protected int max = 0; |
public String getMax() |
{ |
return Integer.toString(this.max); |
} |
public void setMax(String max) |
{ |
this.max = Integer.parseInt(max); |
} |
protected int displayPage; |
public int getDisplayPage() |
{ |
return this.displayPage; |
} |
protected CollectionInfo collectionInfo; |
public CollectionInfo getCollectionInfo() |
{ |
return this.collectionInfo; |
} |
public int doStartTag() throws JspException |
{ |
collectionInfo = findCollectionInfo(); |
displayPage = (max == 0) ? 0 |
: Math.max(0, collectionInfo.getCurrentPage() - max/2); |
if(collectionInfo == null) return SKIP_BODY; |
if(collectionInfo.getTotalPages() > 0) |
return EVAL_BODY_TAG; |
else |
return SKIP_BODY; |
} |
public int doAfterBody() throws JspException |
{ |
// Render the output from this iteration to the output stream |
if(bodyContent != null) { |
ResponseUtils.writePrevious(pageContext, bodyContent.getString()); |
bodyContent.clearBody(); |
} |
displayPage++; |
if(max == 0 && displayPage < collectionInfo.getTotalPages()) { |
return EVAL_BODY_TAG; |
} |
else if(max > 0 && displayPage < collectionInfo.getTotalPages() |
&& displayPage < collectionInfo.getCurrentPage() + max/2) |
{ |
return EVAL_BODY_TAG; |
} |
else { |
return SKIP_BODY; |
} |
} |
public int doEndTag() throws JspException |
{ |
return EVAL_PAGE; |
} |
protected CollectionInfo findCollectionInfo() |
throws JspException |
{ |
return (CollectionInfo) |
RequestUtils.lookup(pageContext, infoBean, infoProperty, null); |
} |
return (CollectionInfo) |
RequestUtils.lookup(pageContext, infoBean, infoProperty, null); |
} |
public void release() |
{ |
super.release(); |
infoBean = null; |
infoProperty = null; |
max = 0; |
} |
} |
{ |
super.release(); |
infoBean = null; |
infoProperty = null; |
max = 0; |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/HasPrevPageTag.java |
---|
1,6 → 1,6 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.JspException; |
import ak.hostadmiral.util.CollectionInfo; |
public class HasPrevPageTag |
7,10 → 7,10 |
extends ExistTagBase |
{ |
protected boolean condition() |
throws JspException |
{ |
CollectionInfo info = getCollectionInfo(); |
return (info != null) && (info.getCurrentPage() > 0); |
} |
throws JspException |
{ |
CollectionInfo info = getCollectionInfo(); |
return (info != null) && (info.getCurrentPage() > 0); |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/NoPrevPageTag.java |
---|
1,13 → 1,13 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.JspException; |
public class NoPrevPageTag |
extends HasPrevPageTag |
{ |
protected boolean condition() |
throws JspException |
{ |
return !super.condition(); |
} |
throws JspException |
{ |
return !super.condition(); |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/HasNextPageTag.java |
---|
1,6 → 1,6 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.JspException; |
import ak.hostadmiral.util.CollectionInfo; |
public class HasNextPageTag |
7,10 → 7,10 |
extends ExistTagBase |
{ |
protected boolean condition() |
throws JspException |
{ |
CollectionInfo info = getCollectionInfo(); |
return (info != null) && (info.getCurrentPage() < info.getTotalPages() - 1); |
} |
throws JspException |
{ |
CollectionInfo info = getCollectionInfo(); |
return (info != null) && (info.getCurrentPage() < info.getTotalPages() - 1); |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/NoNextPageTag.java |
---|
1,13 → 1,13 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.JspException; |
public class NoNextPageTag |
extends HasNextPageTag |
{ |
protected boolean condition() |
throws JspException |
{ |
return !super.condition(); |
} |
throws JspException |
{ |
return !super.condition(); |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/PrevPageTag.java |
---|
1,6 → 1,6 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.JspException; |
import ak.hostadmiral.util.CollectionInfo; |
public class PrevPageTag |
7,13 → 7,13 |
extends PageTagBase |
{ |
protected int getDisplayPage() |
throws JspException |
{ |
CollectionInfo info = getCollectionInfo(); |
if(info == null) |
return 0; |
else |
return info.getPrevPage(); |
} |
throws JspException |
{ |
CollectionInfo info = getCollectionInfo(); |
if(info == null) |
return 0; |
else |
return info.getPrevPage(); |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/IsCurrentPageTag.java |
---|
1,22 → 1,22 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
public class IsCurrentPageTag |
extends IterateSubtagBase |
{ |
public int doStartTag() throws JspException |
{ |
findParent(); |
if(parent.getCollectionInfo().getCurrentPage() == parent.getDisplayPage()) |
return EVAL_BODY_INCLUDE; |
else |
return SKIP_BODY; |
} |
public int doEndTag() throws JspException |
{ |
return EVAL_PAGE; |
} |
} |
import javax.servlet.jsp.JspException; |
public class IsCurrentPageTag |
extends IterateSubtagBase |
{ |
public int doStartTag() throws JspException |
{ |
findParent(); |
if(parent.getCollectionInfo().getCurrentPage() == parent.getDisplayPage()) |
return EVAL_BODY_INCLUDE; |
else |
return SKIP_BODY; |
} |
public int doEndTag() throws JspException |
{ |
return EVAL_PAGE; |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/NextPageTag.java |
---|
1,6 → 1,6 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.JspException; |
import ak.hostadmiral.util.CollectionInfo; |
public class NextPageTag |
7,13 → 7,13 |
extends PageTagBase |
{ |
protected int getDisplayPage() |
throws JspException |
{ |
CollectionInfo info = getCollectionInfo(); |
if(info == null) |
return 0; |
else |
return info.getNextPage(); |
} |
throws JspException |
{ |
CollectionInfo info = getCollectionInfo(); |
if(info == null) |
return 0; |
else |
return info.getNextPage(); |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/CurrentPageTag.java |
---|
1,45 → 1,45 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.tagext.TagSupport; |
import org.apache.struts.util.ResponseUtils; |
import org.apache.struts.util.RequestUtils; |
import ak.hostadmiral.util.CollectionInfo; |
public class CurrentPageTag |
extends TagSupport |
{ |
protected String infoBean = null; |
public String getInfoBean() |
{ |
return this.infoBean; |
} |
public void setInfoBean(String infoBean) |
{ |
this.infoBean = infoBean; |
} |
protected String infoProperty = null; |
public String getInfoProperty() |
{ |
return this.infoProperty; |
} |
public void setInfoProperty(String infoProperty) |
{ |
this.infoProperty = infoProperty; |
} |
public int doStartTag() throws JspException |
{ |
CollectionInfo info = (CollectionInfo) |
RequestUtils.lookup(pageContext, infoBean, infoProperty, null); |
ResponseUtils.write(pageContext, Integer.toString(info.getCurrentPage() + 1)); |
return SKIP_BODY; |
} |
} |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.tagext.TagSupport; |
import org.apache.struts.util.ResponseUtils; |
import org.apache.struts.util.RequestUtils; |
import ak.hostadmiral.util.CollectionInfo; |
public class CurrentPageTag |
extends TagSupport |
{ |
protected String infoBean = null; |
public String getInfoBean() |
{ |
return this.infoBean; |
} |
public void setInfoBean(String infoBean) |
{ |
this.infoBean = infoBean; |
} |
protected String infoProperty = null; |
public String getInfoProperty() |
{ |
return this.infoProperty; |
} |
public void setInfoProperty(String infoProperty) |
{ |
this.infoProperty = infoProperty; |
} |
public int doStartTag() throws JspException |
{ |
CollectionInfo info = (CollectionInfo) |
RequestUtils.lookup(pageContext, infoBean, infoProperty, null); |
ResponseUtils.write(pageContext, Integer.toString(info.getCurrentPage() + 1)); |
return SKIP_BODY; |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/HasFirstPageTag.java |
---|
1,6 → 1,6 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.JspException; |
import ak.hostadmiral.util.CollectionInfo; |
public class HasFirstPageTag |
7,10 → 7,10 |
extends ExistTagBase |
{ |
protected boolean condition() |
throws JspException |
{ |
CollectionInfo info = getCollectionInfo(); |
return (info != null) && (info.getTotalPages() > 0); |
} |
throws JspException |
{ |
CollectionInfo info = getCollectionInfo(); |
return (info != null) && (info.getTotalPages() > 0); |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/NoFirstPageTag.java |
---|
1,13 → 1,13 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.JspException; |
public class NoFirstPageTag |
extends HasFirstPageTag |
{ |
protected boolean condition() |
throws JspException |
{ |
return !super.condition(); |
} |
throws JspException |
{ |
return !super.condition(); |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/FirstPageTag.java |
---|
1,6 → 1,6 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.JspException; |
import ak.hostadmiral.util.CollectionInfo; |
public class FirstPageTag |
7,8 → 7,8 |
extends PageTagBase |
{ |
protected int getDisplayPage() |
throws JspException |
{ |
return 0; |
} |
throws JspException |
{ |
return 0; |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/ExistTagBase.java |
---|
1,64 → 1,64 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.tagext.TagSupport; |
import org.apache.struts.util.RequestUtils; |
import javax.servlet.http.HttpServletRequest; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.tagext.TagSupport; |
import org.apache.struts.util.RequestUtils; |
import ak.hostadmiral.util.CollectionInfo; |
public abstract class ExistTagBase |
extends TagSupport |
{ |
protected String infoBean = null; |
public String getInfoBean() |
{ |
return this.infoBean; |
} |
public void setInfoBean(String infoBean) |
{ |
this.infoBean = infoBean; |
} |
protected String infoProperty = null; |
public String getInfoProperty() |
{ |
return this.infoProperty; |
} |
public void setInfoProperty(String infoProperty) |
{ |
this.infoProperty = infoProperty; |
} |
public int doStartTag() throws JspException |
{ |
if(condition()) |
return EVAL_BODY_INCLUDE; |
else |
return SKIP_BODY; |
} |
public int doEndTag() throws JspException |
{ |
return EVAL_PAGE; |
} |
protected abstract boolean condition() throws JspException; |
public abstract class ExistTagBase |
extends TagSupport |
{ |
protected String infoBean = null; |
public String getInfoBean() |
{ |
return this.infoBean; |
} |
public void setInfoBean(String infoBean) |
{ |
this.infoBean = infoBean; |
} |
protected String infoProperty = null; |
public String getInfoProperty() |
{ |
return this.infoProperty; |
} |
public void setInfoProperty(String infoProperty) |
{ |
this.infoProperty = infoProperty; |
} |
public int doStartTag() throws JspException |
{ |
if(condition()) |
return EVAL_BODY_INCLUDE; |
else |
return SKIP_BODY; |
} |
public int doEndTag() throws JspException |
{ |
return EVAL_PAGE; |
} |
protected abstract boolean condition() throws JspException; |
protected CollectionInfo getCollectionInfo() |
throws JspException |
{ |
return (CollectionInfo) |
RequestUtils.lookup(pageContext, infoBean, infoProperty, null); |
} |
return (CollectionInfo) |
RequestUtils.lookup(pageContext, infoBean, infoProperty, null); |
} |
public void release() |
{ |
super.release(); |
infoBean = null; |
infoProperty = null; |
} |
} |
{ |
super.release(); |
infoBean = null; |
infoProperty = null; |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/HasLastPageTag.java |
---|
1,6 → 1,6 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.JspException; |
import ak.hostadmiral.util.CollectionInfo; |
public class HasLastPageTag |
7,10 → 7,10 |
extends ExistTagBase |
{ |
protected boolean condition() |
throws JspException |
{ |
CollectionInfo info = getCollectionInfo(); |
return (info != null) && (info.getTotalPages() > 0); |
} |
throws JspException |
{ |
CollectionInfo info = getCollectionInfo(); |
return (info != null) && (info.getTotalPages() > 0); |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/NoLastPageTag.java |
---|
1,13 → 1,13 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.JspException; |
public class NoLastPageTag |
extends HasLastPageTag |
{ |
protected boolean condition() |
throws JspException |
{ |
return !super.condition(); |
} |
throws JspException |
{ |
return !super.condition(); |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/NotCurrentPageTag.java |
---|
1,22 → 1,22 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
public class NotCurrentPageTag |
extends IterateSubtagBase |
{ |
public int doStartTag() throws JspException |
{ |
findParent(); |
if(parent.getCollectionInfo().getCurrentPage() != parent.getDisplayPage()) |
return EVAL_BODY_INCLUDE; |
else |
return SKIP_BODY; |
} |
public int doEndTag() throws JspException |
{ |
return EVAL_PAGE; |
} |
} |
import javax.servlet.jsp.JspException; |
public class NotCurrentPageTag |
extends IterateSubtagBase |
{ |
public int doStartTag() throws JspException |
{ |
findParent(); |
if(parent.getCollectionInfo().getCurrentPage() != parent.getDisplayPage()) |
return EVAL_BODY_INCLUDE; |
else |
return SKIP_BODY; |
} |
public int doEndTag() throws JspException |
{ |
return EVAL_PAGE; |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/LastPageTag.java |
---|
1,6 → 1,6 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.JspException; |
import ak.hostadmiral.util.CollectionInfo; |
public class LastPageTag |
7,13 → 7,13 |
extends PageTagBase |
{ |
protected int getDisplayPage() |
throws JspException |
{ |
CollectionInfo info = getCollectionInfo(); |
if(info == null) |
return 0; |
else |
return info.getLastPage(); |
} |
throws JspException |
{ |
CollectionInfo info = getCollectionInfo(); |
if(info == null) |
return 0; |
else |
return info.getLastPage(); |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/IterateSubtagBase.java |
---|
1,25 → 1,25 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.tagext.Tag; |
import javax.servlet.jsp.tagext.TagSupport; |
public abstract class IterateSubtagBase |
extends TagSupport |
{ |
protected PageIterateTag parent; |
protected void findParent() |
throws JspException |
{ |
Tag p = getParent(); |
while(p != null && !(p instanceof PageIterateTag)) |
p = p.getParent(); |
if(p == null) |
throw new JspException("This tag must be inside PageIterateTag"); |
parent = (PageIterateTag)p; |
} |
} |
import javax.servlet.jsp.JspException; |
import javax.servlet.jsp.tagext.Tag; |
import javax.servlet.jsp.tagext.TagSupport; |
public abstract class IterateSubtagBase |
extends TagSupport |
{ |
protected PageIterateTag parent; |
protected void findParent() |
throws JspException |
{ |
Tag p = getParent(); |
while(p != null && !(p instanceof PageIterateTag)) |
p = p.getParent(); |
if(p == null) |
throw new JspException("This tag must be inside PageIterateTag"); |
parent = (PageIterateTag)p; |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/core/taglib/list/DisplayPageTag.java |
---|
1,17 → 1,17 |
package ak.hostadmiral.core.taglib.list; |
import javax.servlet.jsp.JspException; |
import org.apache.struts.util.ResponseUtils; |
public class DisplayPageTag |
extends IterateSubtagBase |
{ |
public int doStartTag() throws JspException |
{ |
findParent(); |
ResponseUtils.write(pageContext, Integer.toString(parent.getDisplayPage() + 1)); |
return SKIP_BODY; |
} |
} |
import javax.servlet.jsp.JspException; |
import org.apache.struts.util.ResponseUtils; |
public class DisplayPageTag |
extends IterateSubtagBase |
{ |
public int doStartTag() throws JspException |
{ |
findParent(); |
ResponseUtils.write(pageContext, Integer.toString(parent.getDisplayPage() + 1)); |
return SKIP_BODY; |
} |
} |
/hostadmiral/trunk/src/ak/hostadmiral/util/ConfigInit.java |
---|
1,14 → 1,14 |
package ak.hostadmiral.util; |
import java.util.Map; |
public interface ConfigInit |
{ |
/** |
* This method is called by initialization from config file. |
* |
* @param params map String -> String with pairs of param name -> value |
* from the initializaion file |
*/ |
public void init(Map params); |
} |
import java.util.Map; |
public interface ConfigInit |
{ |
/** |
* This method is called by initialization from config file. |
* |
* @param params map String -> String with pairs of param name -> value |
* from the initializaion file |
*/ |
public void init(Map params); |
} |
/hostadmiral/trunk/src/ak/hostadmiral/listener/file/FileListener.java |
---|
43,27 → 43,27 |
{ |
setFileName((String)params.get("fileName")); |
UserManager.getInstance().addCreatedListener(this); |
UserManager.getInstance().addModifiedListener(this); |
UserManager.getInstance().addDeletedListener(this); |
UserManager.getInstance().addCreatedListener(this); |
UserManager.getInstance().addModifiedListener(this); |
UserManager.getInstance().addDeletedListener(this); |
InetDomainManager.getInstance().addCreatedListener(this); |
InetDomainManager.getInstance().addModifiedListener(this); |
InetDomainManager.getInstance().addDeletedListener(this); |
InetDomainManager.getInstance().addCreatedListener(this); |
InetDomainManager.getInstance().addModifiedListener(this); |
InetDomainManager.getInstance().addDeletedListener(this); |
SystemUserManager.getInstance().addCreatedListener(this); |
SystemUserManager.getInstance().addModifiedListener(this); |
SystemUserManager.getInstance().addDeletedListener(this); |
SystemUserManager.getInstance().addCreatedListener(this); |
SystemUserManager.getInstance().addModifiedListener(this); |
SystemUserManager.getInstance().addDeletedListener(this); |
MailboxManager.getInstance().addCreatedListener(this); |
MailboxManager.getInstance().addModifiedListener(this); |
MailboxManager.getInstance().addDeletedListener(this); |
MailboxManager.getInstance().addCreatedListener(this); |
MailboxManager.getInstance().addModifiedListener(this); |
MailboxManager.getInstance().addDeletedListener(this); |
MailAliasManager.getInstance().addCreatedListener(this); |
MailAliasManager.getInstance().addModifiedListener(this); |
MailAliasManager.getInstance().addDeletedListener(this); |
MailAliasManager.getInstance().addCreatedListener(this); |
MailAliasManager.getInstance().addModifiedListener(this); |
MailAliasManager.getInstance().addDeletedListener(this); |
} |
public static String getFileName() |
{ |
return fileName; |
/hostadmiral/trunk/src/ak/hostadmiral/listener/dummy/DummyListener.java |
---|
26,27 → 26,27 |
{ |
public void init(Map params) |
{ |
UserManager.getInstance().addCreatedListener(this); |
UserManager.getInstance().addModifiedListener(this); |
UserManager.getInstance().addDeletedListener(this); |
UserManager.getInstance().addCreatedListener(this); |
UserManager.getInstance().addModifiedListener(this); |
UserManager.getInstance().addDeletedListener(this); |
InetDomainManager.getInstance().addCreatedListener(this); |
InetDomainManager.getInstance().addModifiedListener(this); |
InetDomainManager.getInstance().addDeletedListener(this); |
InetDomainManager.getInstance().addCreatedListener(this); |
InetDomainManager.getInstance().addModifiedListener(this); |
InetDomainManager.getInstance().addDeletedListener(this); |
SystemUserManager.getInstance().addCreatedListener(this); |
SystemUserManager.getInstance().addModifiedListener(this); |
SystemUserManager.getInstance().addDeletedListener(this); |
SystemUserManager.getInstance().addCreatedListener(this); |
SystemUserManager.getInstance().addModifiedListener(this); |
SystemUserManager.getInstance().addDeletedListener(this); |
MailboxManager.getInstance().addCreatedListener(this); |
MailboxManager.getInstance().addModifiedListener(this); |
MailboxManager.getInstance().addDeletedListener(this); |
MailboxManager.getInstance().addCreatedListener(this); |
MailboxManager.getInstance().addModifiedListener(this); |
MailboxManager.getInstance().addDeletedListener(this); |
MailAliasManager.getInstance().addCreatedListener(this); |
MailAliasManager.getInstance().addModifiedListener(this); |
MailAliasManager.getInstance().addDeletedListener(this); |
MailAliasManager.getInstance().addCreatedListener(this); |
MailAliasManager.getInstance().addModifiedListener(this); |
MailAliasManager.getInstance().addDeletedListener(this); |
} |
//=== user ==================================================================================== |
public void userCreated(User editor, User user) |