diff options
author | Henri Herscher <henri@oreka.org> | 2005-10-20 13:46:56 +0000 |
---|---|---|
committer | Henri Herscher <henri@oreka.org> | 2005-10-20 13:46:56 +0000 |
commit | 25c5446b5e0ab6d534203097b351699b1a769c6a (patch) | |
tree | 460bce79c944aa65151a358df5bd3c26af35513c /orkweb/src/net | |
parent | 7e1d63dd9fd149e4934bf77095c8610fac786b04 (diff) |
first checkin
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@3 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkweb/src/net')
26 files changed, 1727 insertions, 0 deletions
diff --git a/orkweb/src/net/sf/oreka/orkweb/ContextListener.java b/orkweb/src/net/sf/oreka/orkweb/ContextListener.java new file mode 100644 index 0000000..52ab577 --- /dev/null +++ b/orkweb/src/net/sf/oreka/orkweb/ContextListener.java @@ -0,0 +1,71 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +package net.sf.oreka.orkweb; + +import javax.servlet.ServletContext; +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; + +import net.sf.oreka.HibernateManager; + +import org.apache.log4j.Logger; + +public class ContextListener implements ServletContextListener { + + Logger log = null; + public static boolean debugSwitch = false; // Enables application debugging (e.g. no login phase) + + public void contextInitialized(ServletContextEvent servletContextEvent) { + + ServletContext context = servletContextEvent.getServletContext(); + String log4jConfigFile = context.getInitParameter("Log4jConfigFile"); + + if (log4jConfigFile == null) { + System.out.println("Log4jConfigFile context-param missing in web.xml"); + } + + LogManager.getInstance().configure(log4jConfigFile); + log = LogManager.getInstance().getRootLogger(); + log.info("========================================"); + log.info("orkweb starting ..."); + + String hibernateConfigFile = context.getInitParameter("HibernateConfigFile"); + if (hibernateConfigFile == null) { + log.error("HibernateConfigFile context-param missing in web.xml"); + } + + try { + HibernateManager.configure(hibernateConfigFile); + } + catch (Exception e) { + log.error("orkweb.ContextListener: Error configuring Hibernate: " + e.getMessage()); + } + + String debugSwitchParm = context.getInitParameter("Debug"); + if (debugSwitchParm != null) { + if(debugSwitchParm.equals("true")) { + debugSwitch = true; + log.warn("Running in debug mode"); + } + else { + debugSwitch = false; + } + } + } + + public void contextDestroyed(ServletContextEvent arg0) { + log.info("orkweb stopping ..."); + log.info("========================================"); + } +}
\ No newline at end of file diff --git a/orkweb/src/net/sf/oreka/orkweb/LogManager.java b/orkweb/src/net/sf/oreka/orkweb/LogManager.java new file mode 100644 index 0000000..4069100 --- /dev/null +++ b/orkweb/src/net/sf/oreka/orkweb/LogManager.java @@ -0,0 +1,75 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +package net.sf.oreka.orkweb; + +import java.io.File; + +import org.apache.log4j.BasicConfigurator; +import org.apache.log4j.Logger; +import org.apache.log4j.PropertyConfigurator; + +/** + * This singleton class manages all application log4j loggers + */ +public class LogManager { + + static LogManager logManager = null; + + Logger rootLogger = null; + + + private LogManager() + { + rootLogger = Logger.getRootLogger(); + + BasicConfigurator.configure(); // in case there is no properties file + } + + public static LogManager getInstance() + { + if (logManager == null) + { + logManager = new LogManager(); + } + return logManager; + } + + public void configure(String filename) { + + // Check wether filename is valid + File file = new File(filename); + if (file.exists()) { + // Attempt to configure log4j + PropertyConfigurator.configure(filename); + } + else { + rootLogger.warn("Log4j properties file does not exist:" + filename + " check your web.xml"); + } + } + + /** + * @return Returns the rootLogger. + */ + public Logger getRootLogger() { + return rootLogger; + } + + + /** + * @param rootLogger The rootLogger to set. + */ + public void setRootLogger(Logger rootLogger) { + this.rootLogger = rootLogger; + } +} diff --git a/orkweb/src/net/sf/oreka/pages/Home.java b/orkweb/src/net/sf/oreka/pages/Home.java new file mode 100644 index 0000000..ec6f4b6 --- /dev/null +++ b/orkweb/src/net/sf/oreka/pages/Home.java @@ -0,0 +1,52 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +package net.sf.oreka.pages; + +import net.sf.oreka.orkweb.ContextListener; + +import org.apache.tapestry.IRequestCycle; +import org.apache.tapestry.html.BasePage; + +public abstract class Home extends BasePage { + + public abstract String getUsername(); + public abstract void setUsername(String username); + + public abstract String getPassword(); + public abstract void setPassword(String password); + + //@Persist + public abstract String getErrorMessage(); + public abstract void setErrorMessage(String msg); + + public Home() { + + } + + public void formSubmit(IRequestCycle cycle) { + + if( getUsername() != null && getPassword() != null && + getUsername().equals("bruno") && + getPassword().equals("bru") ) + { + cycle.activate("RecSegments"); + } + else if(ContextListener.debugSwitch == true) { + cycle.activate("RecSegments"); + } + else { + setErrorMessage("Invalid login or password"); + } + } +} diff --git a/orkweb/src/net/sf/oreka/pages/RecSegmentsPage.java b/orkweb/src/net/sf/oreka/pages/RecSegmentsPage.java new file mode 100644 index 0000000..f431c3c --- /dev/null +++ b/orkweb/src/net/sf/oreka/pages/RecSegmentsPage.java @@ -0,0 +1,171 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +/** + * + */ +package net.sf.oreka.pages; + +import java.util.ArrayList; +import java.util.List; + +import net.sf.oreka.services.RecSegmentFilter; +import net.sf.oreka.services.RecSegmentResult; +import net.sf.oreka.services.RecSegmentServiceHbn; +import net.sf.oreka.tapestry.TableState; + +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.tapestry.IRequestCycle; +import org.apache.tapestry.event.PageEvent; +import org.apache.tapestry.event.PageRenderListener; +import org.apache.tapestry.html.BasePage; + +public abstract class RecSegmentsPage extends BasePage implements PageRenderListener { + + static Logger logger = Logger.getLogger(RecSegmentsPage.class); + + private String Foo = "page"; + + /** + * @return Returns the foo. + */ + public String getFoo() { + return Foo; + } + + /** + * @param foo The foo to set. + */ + public void setFoo(String foo) { + Foo = foo; + } + + public List getFields(){ + ArrayList list = new ArrayList(); + //list.add("recSegment.duration"); + //list.add("recSegment.localParty"); + list.add("ognl:foo"); + return list; + } + private String field; + + private int CurrentPage; + private int ResultsOffset; + private final int RESULTS_PER_PAGE = 4; + private int NumResults; + + + public abstract TableState getTableState(); + public abstract void setTableState(TableState state); + + public abstract RecSegmentFilter getRecSegmentFilter(); + public abstract void setRecSegmentFilter(RecSegmentFilter filter); + + public abstract RecSegmentResult getItem(); + public abstract void setItem(RecSegmentResult res); + + public abstract void setItems(List list); + public abstract List getItems(); + + public void formSubmit(IRequestCycle cycle) { + + //logger.debug("formSubmit"); + setRecSegmentFilter(getRecSegmentFilter()); + } + + public void pageBeginRender(PageEvent event) { + + updateResults(); + } + + public void pageFirstAction(IRequestCycle cycle) { + ResultsOffset = 0; + setRecSegmentFilter(getRecSegmentFilter()); + } + + public void pagePreviousAction(IRequestCycle cycle) { + ResultsOffset -= RESULTS_PER_PAGE; + if (ResultsOffset < 0) { + ResultsOffset = 0; + } + setRecSegmentFilter(getRecSegmentFilter()); + } + + public void pageNextAction(IRequestCycle cycle) { + ResultsOffset += RESULTS_PER_PAGE; + if (ResultsOffset >= NumResults) { + ResultsOffset = NumResults - RESULTS_PER_PAGE; + if (ResultsOffset < 0) { + ResultsOffset = 0; + } + } + logger.log(Level.INFO, "Next, new offset:" + ResultsOffset); + setRecSegmentFilter(getRecSegmentFilter()); + } + + public void pageLastAction(IRequestCycle cycle) { + ResultsOffset = NumResults - RESULTS_PER_PAGE; + if (ResultsOffset < 0) { + ResultsOffset = 0; + } + setRecSegmentFilter(getRecSegmentFilter()); + } + /** + * @return Returns the resultsOffset. + */ + public int getResultsOffset() { + return ResultsOffset; + } + + /** + * @param resultsOffset The resultsOffset to set. + */ + public void setResultsOffset(int resultsOffset) { + ResultsOffset = resultsOffset; + } + + private void updateResults() + { + logger.debug("UpdateResults: orderby:" + getTableState().getOrderBy()); + + RecSegmentServiceHbn srv = new RecSegmentServiceHbn(); + if (getRecSegmentFilter().isValid()) { + ArrayList results = new ArrayList(); + NumResults = srv.getResults(getRecSegmentFilter(), getTableState().getCurrentOffset(), getTableState().getResultsPerPage(), getTableState().getOrderBy(), getTableState().isAscending(), results); + getTableState().setNumResults(NumResults); + logger.debug("UpdateResults: Offset:" + ResultsOffset + " num results:" + NumResults); + setItems(results); + } + else { + logger.debug("UpdateResults: Invalid filter"); + } + } + /** + * @return Returns the field. + */ + public String getField() { + return field; + } + + /** + * @param field The field to set. + */ + public void setField(String field) { + this.field = field; + } + + + +} +
\ No newline at end of file diff --git a/orkweb/src/net/sf/oreka/services/FormFilter.java b/orkweb/src/net/sf/oreka/services/FormFilter.java new file mode 100644 index 0000000..94723d3 --- /dev/null +++ b/orkweb/src/net/sf/oreka/services/FormFilter.java @@ -0,0 +1,39 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +/** + * + */ +package net.sf.oreka.services; + +public abstract class FormFilter { + + boolean isValid = true; + + /** + * @return Returns the isValid. + */ + public boolean isValid() { + return isValid; + } + + + /** + * @param isValid The isValid to set. + */ + public void setValid(boolean isValid) { + this.isValid = isValid; + } + + +} diff --git a/orkweb/src/net/sf/oreka/services/RecSegmentFilter.java b/orkweb/src/net/sf/oreka/services/RecSegmentFilter.java new file mode 100644 index 0000000..20b12ef --- /dev/null +++ b/orkweb/src/net/sf/oreka/services/RecSegmentFilter.java @@ -0,0 +1,274 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +/** + * + */ +package net.sf.oreka.services; + +import java.util.Date; + +import net.sf.oreka.Direction; +import net.sf.oreka.orkweb.ContextListener; + +import org.apache.log4j.Logger; + +public class RecSegmentFilter extends FormFilter { + + static Logger logger = Logger.getLogger(RecSegmentFilter.class); + + private String minDuration = ""; + private String minDurationError; + private String maxDuration = ""; + private String maxDurationError; + private String localParty = ""; + private String localPartyError; + private String remoteParty = ""; + private String remotePartyError; + private Date startDate = null; + private Date endDate = null; + private Direction direction; + + private final String UNALLOWED_CHARACTER = "Unallowed character"; + private final String ENTER_A_NUMBER = "Enter a number"; + + private boolean isStringInvalidParty(String party) { + // See if there are any characters not listed here + return (party.matches(".*[^A-Za-z0-9#\\*@].*")); + } + + public String getErrorStyle(){ + return "error"; + } + public String getOkStyle(){ + return ""; + } + + /** + * @return Returns the durationError. + */ + public String getMinDurationError() { + return minDurationError; + } + + + + /** + * @param durationError The durationError to set. + */ + public void setMinDurationError(String durationError) { + this.minDurationError = durationError; + } + + + + /** + * @return Returns the localPartyError. + */ + public String getLocalPartyError() { + return localPartyError; + } + + + + /** + * @param localPartyError The localPartyError to set. + */ + public void setLocalPartyError(String localPartyError) { + this.localPartyError = localPartyError; + } + + + + /** + * @return Returns the localParty. + */ + public String getLocalParty() { + return localParty; + } + + + /** + * @param localParty The localParty to set. + */ + public void setLocalParty(String localParty) { + + if(localParty == null) { + this.localParty = ""; + } + else { + localParty.trim(); + this.localParty = localParty; + } + if (isStringInvalidParty(this.localParty)) { + setLocalPartyError(UNALLOWED_CHARACTER); + } + else { + setLocalPartyError(null); + } + } + + + public RecSegmentFilter() { + + minDuration = new String(); + localParty = new String(); + direction = Direction.ALL; + + long millisIn24hours = 24 * 3600 * 1000; + endDate = new Date(); + + // For now, retrieve 24 hours worth of records by default + if (ContextListener.debugSwitch == false) { + startDate = new Date(endDate.getTime() - millisIn24hours); + } + else { + startDate = new Date(0); + } + + /* + // Read properties file. + Properties properties = new Properties(); + try { + properties.load(new FileInputStream("RecSegmentFilter.properties")); + } catch (IOException e) { + System.out.println("@@@@@@@@@@"); + } + */ + + } + + + /** + * @return Returns the duration. + */ + public String getMinDuration() { + return minDuration; + } + + + + /** + * @param minDuration The duration to set. + */ + public void setMinDuration(String minDuration) { + + if(minDuration == null) { + this.minDuration = ""; + } + else { + minDuration.trim(); + this.minDuration = minDuration; + } + if (this.minDuration.matches(".*[^0-9].*")) { + // there is a funny character here ... + setMinDurationError(ENTER_A_NUMBER); + } + else { + setMinDurationError(null); + } + } + public Date getEndDate() { + return endDate; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + public Date getStartDate() { + return startDate; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public String getRemoteParty() { + return remoteParty; + } + + + public void setRemoteParty(String remoteParty) { + if(remoteParty == null) { + this.remoteParty = ""; + } + else { + remoteParty.trim(); + this.remoteParty = remoteParty; + } + if (isStringInvalidParty(this.remoteParty)) { + setRemotePartyError(UNALLOWED_CHARACTER); + } + else { + setRemotePartyError(null); + } + } + + + public String getRemotePartyError() { + return remotePartyError; + } + + + public void setRemotePartyError(String remotePartyError) { + this.remotePartyError = remotePartyError; + } + + public Direction getDirection() { + return direction; + } + + + public void setDirection(Direction direction) { + this.direction = direction; + } + + public String getMaxDuration() { + return maxDuration; + } + + + public void setMaxDuration(String maxDuration) { + if(maxDuration == null) { + this.maxDuration = ""; + } + else { + maxDuration.trim(); + this.maxDuration = maxDuration; + } + if (this.maxDuration.matches(".*[^0-9].*")) { + // there is a funny character here ... + setMaxDurationError(ENTER_A_NUMBER); + } + else { + setMaxDurationError(null); + } + } + + + public String getMaxDurationError() { + return maxDurationError; + } + + + public void setMaxDurationError(String maxDurationError) { + this.maxDurationError = maxDurationError; + } + + + + + + +} diff --git a/orkweb/src/net/sf/oreka/services/RecSegmentFilter.properties b/orkweb/src/net/sf/oreka/services/RecSegmentFilter.properties new file mode 100644 index 0000000..a6e5ec3 --- /dev/null +++ b/orkweb/src/net/sf/oreka/services/RecSegmentFilter.properties @@ -0,0 +1,2 @@ +duration=0 +localParty=8948
\ No newline at end of file diff --git a/orkweb/src/net/sf/oreka/services/RecSegmentResult.java b/orkweb/src/net/sf/oreka/services/RecSegmentResult.java new file mode 100644 index 0000000..fd43ad5 --- /dev/null +++ b/orkweb/src/net/sf/oreka/services/RecSegmentResult.java @@ -0,0 +1,83 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +/** + * + */ +package net.sf.oreka.services; + +import net.sf.oreka.persistent.*; + + +public class RecSegmentResult { + + private RecSegment RecSegment; + private RecTape RecTape; + + private String foo = "henri"; + + public RecSegmentResult() { + RecSegment = new RecSegment(); + RecTape = new RecTape(); + } + + /** + * @return Returns the recSegment. + */ + public RecSegment getRecSegment() { + return RecSegment; + } + + + /** + * @param recSegment The recSegment to set. + */ + public void setRecSegment(RecSegment recSegment) { + RecSegment = recSegment; + } + + /** + * @return Returns the recTape. + */ + public RecTape getRecTape() { + return RecTape; + } + + + /** + * @param recTape The recTape to set. + */ + public void setRecTape(RecTape recTape) { + RecTape = recTape; + } + + /** + * @return Returns the foo. + */ + public String getFoo() { + return foo; + } + + + /** + * @param foo The foo to set. + */ + public void setFoo(String foo) { + this.foo = foo; + } + + + + + +} diff --git a/orkweb/src/net/sf/oreka/services/RecSegmentService.java b/orkweb/src/net/sf/oreka/services/RecSegmentService.java new file mode 100644 index 0000000..cdaa6fc --- /dev/null +++ b/orkweb/src/net/sf/oreka/services/RecSegmentService.java @@ -0,0 +1,25 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +/** + * + */ +package net.sf.oreka.services; + +import java.util.*; + + +public interface RecSegmentService { + + public int getResults(RecSegmentFilter filter, int offset, int number, String orderBy, boolean ascending, List results); +} diff --git a/orkweb/src/net/sf/oreka/services/RecSegmentServiceHbn.java b/orkweb/src/net/sf/oreka/services/RecSegmentServiceHbn.java new file mode 100644 index 0000000..26a3746 --- /dev/null +++ b/orkweb/src/net/sf/oreka/services/RecSegmentServiceHbn.java @@ -0,0 +1,206 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +/** + * + */ +package net.sf.oreka.services; + +import java.text.SimpleDateFormat; +import java.util.List; + +import net.sf.oreka.Direction; +import net.sf.oreka.HibernateManager; +import net.sf.oreka.persistent.RecSegment; + +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.hibernate.HibernateException; +import org.hibernate.Query; +import org.hibernate.ScrollableResults; +import org.hibernate.Session; +import org.hibernate.Transaction; + +public class RecSegmentServiceHbn implements RecSegmentService{ + + private boolean firstCriterium = true; + + static Logger logger = Logger.getLogger(RecSegmentServiceHbn.class); + /** + * + */ + public RecSegmentServiceHbn() { + + } + +// private void addCriteriumPrefix (StringBuffer query) { +// if(firstCriterium){ +// query.append(" where "); +// firstCriterium = false; +// } +// else { +// query.append(" and "); +// } +// } + + public int getResults(RecSegmentFilter filter, int offset, int number, String orderBy, boolean ascending, List results) + { + firstCriterium = true; + int numResults = 0; + logger.log(Level.DEBUG, "Entering getResults"); + //logger.log(Level.INFO, System.getProperty("java.class.path")); + + //RecSegment seg1 = new RecSegment(); + //RecSegment seg2 = new RecSegment(); + + //RecTape tape1 = new RecTape(); + //RecTape tape2 = new RecTape(); + /* + RecSegmentResult result1 = new RecSegmentResult(); + RecSegmentResult result2 = new RecSegmentResult(); + + result1.getRecSegment().setDuration(10); + result1.getRecSegment().setLocalParty("01223"); + results.add(result1); + result2.getRecSegment().setDuration(11); + result2.getRecSegment().setLocalParty("01440"); + results.add(result2); +*/ + /* + for (int i=0; i<number; i++) + { + RecSegmentResult result = new RecSegmentResult(); + result.getRecSegment().setDuration(offset + i); + result.getRecSegment().setLocalParty(orderBy); + result.getRecTape().setId(ascending ? 0:1); + results.add(result); + } + numResults = 502; + */ + + Transaction tx = null; + Session session = null; + try + { + session = HibernateManager.getSession(); + + StringBuffer queryString = new StringBuffer("from RecSegment as seg left join seg.recTape as tape left join tape.service as srv "); + //StringBuffer queryString = new StringBuffer("from RecSegment as seg "); + + //boolean firstCriterium = false; + + queryString.append(" where seg.timestamp between :startDate and :endDate "); + + if(filter.getLocalParty().length() > 0) { + queryString.append(" and seg.localParty=:localParty "); + } + if(filter.getRemoteParty().length() > 0) { + queryString.append(" and seg.remoteParty=:remoteParty "); + } + if(filter.getMinDuration().length() > 0) { + queryString.append(" and seg.duration>:minDuration "); + } + if(filter.getMaxDuration().length() > 0) { + queryString.append(" and seg.duration<:maxDuration "); + } + if(filter.getDirection() != Direction.ALL){ + queryString.append(" and seg.direction=:direction "); + } + + if(orderBy.length() == 0) { + orderBy = "seg.timestamp"; + } + queryString.append(" order by "); + queryString.append(orderBy); + if (ascending) { + queryString.append(" asc"); + } + else { + queryString.append(" desc"); + } + + Query query = session.createQuery(queryString.toString()); + + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + logger.debug("Filter start date:" + dateFormat.format(filter.getStartDate())); + query.setTimestamp("startDate", filter.getStartDate()); + logger.debug("Filter end date:" + dateFormat.format(filter.getEndDate())); + query.setTimestamp("endDate", filter.getEndDate()); + + + if(filter.getLocalParty().length() > 0) { + query.setString("localParty", filter.getLocalParty()); + } + if(filter.getRemoteParty().length() > 0) { + query.setString("remoteParty", filter.getRemoteParty()); + } + if(filter.getMinDuration().length() > 0) { + query.setString("minDuration", filter.getMinDuration()); + } + if(filter.getMaxDuration().length() > 0) { + query.setString("maxDuration", filter.getMaxDuration()); + } + if(filter.getDirection() != Direction.ALL){ + query.setParameter( "direction", filter.getDirection().ordinal() ); + //query.setParameter( "direction", filter.getDirection().name() ); + } + +// Criteria crit = session.createCriteria(RecSegment.class); +// //crit.setFetchMode("RecTape",FetchMode.EAGER); +// crit.setFetchMode(null, FetchMode.LAZY); + + ScrollableResults scrollDocs = query.scroll(); + + + if ( scrollDocs.last() ) { + numResults = scrollDocs.getRowNumber()+1; + logger.debug("Num res:" + numResults); + } + + //scrollDocs.beforeFirst(); + scrollDocs.setRowNumber(offset); + int rowsSoFar = 0; + + while (scrollDocs.get()!= null && rowsSoFar<number) + { + rowsSoFar++; + RecSegment seg = (RecSegment)scrollDocs.get(0); + + //logger.log(Level.ERROR, seg.getRecTape().getUrl()); + + //RecTape tape = (RecTape)scrollDocs.get(1); + //RecTape tape = new RecTape(); + RecSegmentResult res = new RecSegmentResult(); + res.setRecSegment(seg); + //res.setRecTape(tape); + results.add(res); + scrollDocs.next(); + } + } + catch ( HibernateException he ) { + if ( tx != null ) tx.rollback(); + logger.log(Level.ERROR, he.toString()); + he.printStackTrace(); + } + catch (Exception e) + { + logger.error(e); + e.printStackTrace(); + } + finally { + session.close(); + } + return numResults; + } + +} diff --git a/orkweb/src/net/sf/oreka/services/Startup.java b/orkweb/src/net/sf/oreka/services/Startup.java new file mode 100644 index 0000000..337734f --- /dev/null +++ b/orkweb/src/net/sf/oreka/services/Startup.java @@ -0,0 +1,66 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +/** + * + */ +package net.sf.oreka.services; + +import java.util.*; +import java.io.*; +import org.apache.log4j.Level; +import org.apache.log4j.Logger; +import org.apache.log4j.PropertyConfigurator; + +public class Startup { + + static Logger logger = Logger.getLogger(Startup.class); + + public Startup() { + + logger.log(Level.WARN, "Initializing orkweb"); + + InputStream is = this.getClass().getClassLoader().getResourceAsStream("log4j.properties"); + if (is != null) + { + Properties properties = new Properties(); + try + { + properties.load(is); + PropertyConfigurator.configure(properties); + } + catch (IOException e) + { + logger.log(Level.INFO, "log4j.properties not found"); + } + } + + //PropertyConfigurator.configure("log4j.properties"); + + /* + //InputStream s = ClassLoader.getSystemResourceAsStream("toto.txt"); + InputStream s = this.getClass().getClassLoader().getResourceAsStream("toto.txt"); + if (s != null) + { + logger.log(Level.INFO, "~~~~~~~~ yes"); + } + else + { + logger.log(Level.INFO, "~~~~~~~~ no"); + } + */ + + + } + +} diff --git a/orkweb/src/net/sf/oreka/tapestry/MainMenu.html b/orkweb/src/net/sf/oreka/tapestry/MainMenu.html new file mode 100644 index 0000000..8873c57 --- /dev/null +++ b/orkweb/src/net/sf/oreka/tapestry/MainMenu.html @@ -0,0 +1,31 @@ +<!-- *** Main Menu *** --> +<link jwcid="@If" condition="false" href="orekastyle.css" rel="stylesheet" type="text/css"/> +<table width="100%" class="menuContainer"> + <tr> + <td align="left"> + <table class="menubuttons"> + <tr> + <td jwcid="@Any" class="ognl:pageName=='Home'? 'on' : ''"> + <a jwcid="@PageLink" page="Home"> + <span key="Home">Home</span> + </a> + </td> + <td jwcid="@Any" class="ognl:pageName=='RecSegments'? 'on' : ''"> + <a jwcid="@PageLink" page="RecSegments"> + <span key="RecSegments">Calls</span> + </a> + </td> + </tr> + </table> + </td> + <td align="right"> + <table class="menubuttons"> + <tr> + <td> + <span jwcid="@ServiceLink" service="ognl:@org.apache.tapestry.Tapestry@RESTART_SERVICE">Logout</span> + </td> + </tr> + </table> + </td> + </tr> +</table>
\ No newline at end of file diff --git a/orkweb/src/net/sf/oreka/tapestry/MainMenu.java b/orkweb/src/net/sf/oreka/tapestry/MainMenu.java new file mode 100644 index 0000000..2e4e49f --- /dev/null +++ b/orkweb/src/net/sf/oreka/tapestry/MainMenu.java @@ -0,0 +1,39 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +package net.sf.oreka.tapestry; + +import org.apache.tapestry.BaseComponent; +import org.apache.tapestry.IRequestCycle; +import org.apache.tapestry.annotations.ComponentClass; +import org.apache.tapestry.annotations.Parameter; +import org.apache.tapestry.annotations.Persist; + +@ComponentClass +public abstract class MainMenu extends BaseComponent { + + public void myAction(IRequestCycle cycle) { + + setHighlight(!getHighlight()); + cycle.activate("Home"); + } + + @Persist + public abstract boolean getHighlight(); + public abstract void setHighlight(boolean highlight); + + @Parameter + public abstract String getPageName(); + public abstract void setPageName(String name); + +} diff --git a/orkweb/src/net/sf/oreka/tapestry/MainMenu.jwc b/orkweb/src/net/sf/oreka/tapestry/MainMenu.jwc new file mode 100644 index 0000000..b7c6e90 --- /dev/null +++ b/orkweb/src/net/sf/oreka/tapestry/MainMenu.jwc @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE component-specification + PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN" + "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> + +<component-specification class="net.sf.oreka.tapestry.MainMenu" + allow-informal-parameters="no"> +</component-specification>
\ No newline at end of file diff --git a/orkweb/src/net/sf/oreka/tapestry/MainMenu.properties b/orkweb/src/net/sf/oreka/tapestry/MainMenu.properties new file mode 100644 index 0000000..22b8416 --- /dev/null +++ b/orkweb/src/net/sf/oreka/tapestry/MainMenu.properties @@ -0,0 +1,2 @@ +RecSegments=Browse +Home=Welcome
\ No newline at end of file diff --git a/orkweb/src/net/sf/oreka/tapestry/TableColumn.java b/orkweb/src/net/sf/oreka/tapestry/TableColumn.java new file mode 100644 index 0000000..29de8f3 --- /dev/null +++ b/orkweb/src/net/sf/oreka/tapestry/TableColumn.java @@ -0,0 +1,68 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +/** + * + */ +package net.sf.oreka.tapestry; + +public class TableColumn { + + String message; + String key; + boolean sortable; + /** + * @return Returns the isSortable. + */ + public boolean isSortable() { + return sortable; + } + + + /** + * @param isSortable The isSortable to set. + */ + public void setSortable(boolean sortable) { + this.sortable = sortable; + } + + + /** + * @return Returns the key. + */ + public String getKey() { + return key; + } + + /** + * @param key The key to set. + */ + public void setKey(String key) { + this.key = key; + } + + /** + * @return Returns the message. + */ + public String getMessage() { + return message; + } + + /** + * @param message The message to set. + */ + public void setMessage(String message) { + this.message = message; + } + +} diff --git a/orkweb/src/net/sf/oreka/tapestry/TableHeader.html b/orkweb/src/net/sf/oreka/tapestry/TableHeader.html new file mode 100644 index 0000000..149a662 --- /dev/null +++ b/orkweb/src/net/sf/oreka/tapestry/TableHeader.html @@ -0,0 +1,15 @@ +<tr class="header"> + <td jwcid="@Foreach" source="ognl:columns" value="ognl:column" element="td"> + <span jwcid="@If" condition="ognl:column.sortable"> + <a jwcid="@DirectLink" listener="ognl:listeners.columnClickAction" parameters="ognl:column.key"> + <span jwcid="@Insert" value="ognl:column.message">sortableColumn</span> + </a> + </span> + <span jwcid="@If" condition="ognl:!column.sortable"> + <span jwcid="@Insert" value="ognl:column.message">nonSortableColumn</span> + </span> + </td> +<tr> + + + diff --git a/orkweb/src/net/sf/oreka/tapestry/TableHeader.java b/orkweb/src/net/sf/oreka/tapestry/TableHeader.java new file mode 100644 index 0000000..6b8ccc2 --- /dev/null +++ b/orkweb/src/net/sf/oreka/tapestry/TableHeader.java @@ -0,0 +1,81 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +/** + * + */ +package net.sf.oreka.tapestry; + +import java.util.*; +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.*; +import org.apache.tapestry.*; + + +public abstract class TableHeader extends BaseComponent { + + static Logger logger = Logger.getLogger(TableHeader.class); + + public abstract TableState getTableState(); + public abstract void setTableState(TableState state); + + //private String columns; + public abstract String getColumnsCSV(); + public abstract void setColumnsCSV(String columns); + + + public List getColumns() { + String[] columnsArray = StringUtils.split(getColumnsCSV(),", "); + //logger.log(Level.INFO, "ColumnsCSV: "+getColumnsCSV()); + + List columns = new ArrayList(); + for (int i=0; i<columnsArray.length; i++) { + TableColumn column = new TableColumn(); + column.setSortable(true); + String columnKey = columnsArray[i]; + if (columnsArray[i].charAt(0) == '!') { + column.setSortable(false); + columnKey = columnsArray[i].substring(1); + } + column.setKey(columnKey); + String LocalizedMessage = getPage().getMessages().getMessage(columnKey); + column.setMessage(LocalizedMessage); + columns.add(column); + } + return columns; + } + + public abstract void setColumn(TableColumn col); + public abstract TableColumn getColumn(); + + /** + * + */ + public TableHeader() { + } + + public void columnClickAction(IRequestCycle cycle) { + + Object[] parameters = cycle.getServiceParameters(); + String column = (String)parameters[0]; + if (!column.equals(getTableState().getOrderBy())) { + getTableState().setOrderBy(column); + getTableState().setAscending(true); + } + else { + // Toggle direction + getTableState().setAscending(!getTableState().isAscending()); + } + setTableState(getTableState()); + } +} diff --git a/orkweb/src/net/sf/oreka/tapestry/TableHeader.jwc b/orkweb/src/net/sf/oreka/tapestry/TableHeader.jwc new file mode 100644 index 0000000..0755a7a --- /dev/null +++ b/orkweb/src/net/sf/oreka/tapestry/TableHeader.jwc @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE component-specification + PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN" + "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> + +<component-specification class="net.sf.oreka.tapestry.TableHeader" + allow-informal-parameters="no"> + + <parameter name="tableState" type="net.sf.oreka.tapestry.TableState" direction="auto" required="yes"/> + <parameter name="columnsCSV" type="java.lang.String" direction="auto" required="yes"/> + + <property-specification name="column" type="net.sf.oreka.tapestry.TableColumn"/> +</component-specification>
\ No newline at end of file diff --git a/orkweb/src/net/sf/oreka/tapestry/TablePaging.html b/orkweb/src/net/sf/oreka/tapestry/TablePaging.html new file mode 100644 index 0000000..9adc8d1 --- /dev/null +++ b/orkweb/src/net/sf/oreka/tapestry/TablePaging.html @@ -0,0 +1,90 @@ +<!--<style type="text/css"> + .cursor { + background-color: white; + text-align: right; + padding-right: 0; + } + + .cursor div { + border-top: solid 2px #930512; + background-color: #FD0D24; + border-bottom: solid 2px #930512; + text-align: right; + color: white; + float: left; + padding-top: 0; + height: 1em; + } + + .bar { + background-color: white; + text-align: right; + padding-right: 0; + } + + .bar div { + border-top: solid 2px #03144B; + background-color: #0930AC; + border-bottom: solid 2px #03144B; + text-align: right; + color: white; + float: left; + padding-top: 0; + height: 1em; + + +</style>--> + +<table width="100%" class="paging"> + <tr class="odd"> + <td align="left"> + <table> + <tr> + <td> + <a jwcid="@DirectLink" listener="ognl:listeners.firstPageAction"> + <img jwcid="@Image" image="asset:first" alt="First"/> + </a> + </td> + <td> + <a jwcid="@DirectLink" listener="ognl:listeners.previousPageAction"> + <img jwcid="@Image" image="asset:previous" alt="First"/> + </a> + </td> + <td> + <a jwcid="@DirectLink" listener="ognl:listeners.nextPageAction"> + <img jwcid="@Image" image="asset:next" alt="First"/> + </a> + </td> + <td> + <a jwcid="@DirectLink" listener="ognl:listeners.lastPageAction"> + <img jwcid="@Image" image="asset:last" alt="First"/> + </a> + </td> + <td nowrap="true"> + Page <span jwcid="@Insert" value="ognl:tableState.currentPage"/>/<span jwcid="@Insert" value="ognl:tableState.numPages"/> + </td> + <td nowrap="true"> + <span jwcid="@Insert" value="ognl:tableState.numResults"/> Results + </td> + </tr> + </table> + </td> + <td width="100%"> + + </td> + </tr> + <!--*** Slider ***--> + <tr> + <td colspan="2"> + <table width="100%"> + <tr> + <td jwcid="@Foreach" source="ognl:sliderPositions" value="ognl:sliderPosition" element="td" class="ognl:tableState.sliderPosition == sliderPosition ? 'cursor' : 'bar'"> + <a jwcid="@DirectLink" listener="ognl:listeners.sliderClickAction" parameters="ognl:sliderPosition"> + <div style="width: 100%"> </div> + </a> + </td> + </tr> + </table> + </td> + </tr> +</table> diff --git a/orkweb/src/net/sf/oreka/tapestry/TablePaging.java b/orkweb/src/net/sf/oreka/tapestry/TablePaging.java new file mode 100644 index 0000000..e401543 --- /dev/null +++ b/orkweb/src/net/sf/oreka/tapestry/TablePaging.java @@ -0,0 +1,106 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +/** + * + */ +package net.sf.oreka.tapestry; + +import java.util.*; +import org.apache.log4j.*; +import org.apache.tapestry.*; + + +public abstract class TablePaging extends BaseComponent { + + static Logger logger = Logger.getLogger(TablePaging.class); + + public abstract TableState getTableState(); + public abstract void setTableState(TableState state); + + Integer sliderPosition; + + public void firstPageAction(IRequestCycle cycle) { + getTableState().setNumResults(0); + setTableState(getTableState()); // persist ! + } + + public void previousPageAction(IRequestCycle cycle) { + TableState ps = getTableState(); + if ( (ps.getCurrentOffset() - ps.getResultsPerPage()) >= 0 ) { + ps.setCurrentOffset(ps.getCurrentOffset() - ps.getResultsPerPage()); + } + setTableState(getTableState()); // persist ! + } + + public void nextPageAction(IRequestCycle cycle) { + //logger.log(Level.INFO, "before:" + getPagingState().getCurrentPage()); + //getPagingState().setCurrentPage(getPagingState().getCurrentPage()+1); + //logger.log(Level.INFO, "after:" + getPagingState().getCurrentPage()); + + TableState ps = getTableState(); + if ( (ps.getCurrentOffset() + ps.getResultsPerPage()) < ps.getNumResults() ) { + ps.setCurrentOffset(ps.getCurrentOffset() + ps.getResultsPerPage()); + } + setTableState(getTableState()); // persist ! + } + + public void lastPageAction(IRequestCycle cycle) { + + TableState ps = getTableState(); + double numPages = (double)ps.getNumResults() / ps.getResultsPerPage(); + numPages = java.lang.Math.ceil(numPages); + //int numWholePages = ps.getNumResults() / ps.getResultsPerPage(); + //int remainder = ps.getNumResults() % ps.getResultsPerPage(); + //int lastPageOffset = 0; + //if (remainder > 0) { + // lastPageOffset = numWholePages * ps.getResultsPerPage(); + //} + //else if (numWholePages > 0){ + // lastPageOffset = (numWholePages - 1) * ps.getResultsPerPage(); + //} + int lastPageOffset = 0; + if (numPages >= 1) { + lastPageOffset = (int)(numPages-1) * ps.getResultsPerPage(); + } + ps.setCurrentOffset(lastPageOffset); + setTableState(getTableState()); // persist ! + } + + public void sliderClickAction(IRequestCycle cycle) { + + Object[] parameters = cycle.getServiceParameters(); + Integer sliderPosition = (Integer)parameters[0]; + + TableState ts = getTableState(); + ts.setSliderPosition(sliderPosition); + double newOffset = ((double)ts.getNumResults() / getSliderPositions().size()) * sliderPosition.intValue(); + ts.setCurrentOffset((int)newOffset); + logger.log(Level.INFO, "Slider: pos:" + sliderPosition.intValue() + " offset:" + newOffset); + setTableState(getTableState()); // persist ! + } + + /** + * @return Returns the sliderPositions. + */ + public List getSliderPositions() { + + ArrayList sliderPositions = new ArrayList(); + int numPositions = java.lang.Math.min(getTableState().getNumPages(), 20); + for(int i=0;i<numPositions;i++) { + sliderPositions.add(new Integer(i)); + } + return sliderPositions; + } + +} diff --git a/orkweb/src/net/sf/oreka/tapestry/TablePaging.jwc b/orkweb/src/net/sf/oreka/tapestry/TablePaging.jwc new file mode 100644 index 0000000..2e19947 --- /dev/null +++ b/orkweb/src/net/sf/oreka/tapestry/TablePaging.jwc @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE component-specification + PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN" + "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> + +<component-specification class="net.sf.oreka.tapestry.TablePaging" + allow-informal-parameters="no"> + + <parameter name="tableState" type="net.sf.oreka.tapestry.TableState" direction="auto" required="yes"/> + + <property-specification name="sliderPosition" type="java.lang.Integer"/> + + <context-asset name="first" path="/images/icon_pagefirst.gif"/> + <context-asset name="last" path="/images/icon_pagelast.gif"/> + <context-asset name="previous" path="/images/icon_pageprev.gif"/> + <context-asset name="next" path="/images/icon_pagenext.gif"/> +</component-specification>
\ No newline at end of file diff --git a/orkweb/src/net/sf/oreka/tapestry/TablePaging.properties b/orkweb/src/net/sf/oreka/tapestry/TablePaging.properties new file mode 100644 index 0000000..428a861 --- /dev/null +++ b/orkweb/src/net/sf/oreka/tapestry/TablePaging.properties @@ -0,0 +1,4 @@ +nextPage=> +previousPage=< +lastPage=>> +firstPage=<< diff --git a/orkweb/src/net/sf/oreka/tapestry/TableState.java b/orkweb/src/net/sf/oreka/tapestry/TableState.java new file mode 100644 index 0000000..0a1c44c --- /dev/null +++ b/orkweb/src/net/sf/oreka/tapestry/TableState.java @@ -0,0 +1,143 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +/** + * + */ +package net.sf.oreka.tapestry; + +import org.apache.log4j.Logger; + +public class TableState { + + static Logger logger = Logger.getLogger(TableState.class); + + public static int DEFAULT_RESULTS_PER_PAGE = 10; + + private int NumResults; + private int ResultsPerPage; + private int CurrentOffset; + private int sliderPosition; + private String OrderBy = new String(); + private boolean Ascending = false; + + /** + * @return Returns the ascending. + */ + public boolean isAscending() { + return Ascending; + } + + + /** + * @param ascending The ascending to set. + */ + public void setAscending(boolean ascending) { + Ascending = ascending; + } + + /** + * @return Returns the orderBy. + */ + public String getOrderBy() { + return OrderBy; + } + + + /** + * @param orderBy The orderBy to set. + */ + public void setOrderBy(String orderBy) { + OrderBy = orderBy; + } + + + /** + * + */ + public TableState() { + ResultsPerPage = DEFAULT_RESULTS_PER_PAGE; + } + + /** + * @return Returns the currentOffset. + */ + public int getCurrentOffset() { + return CurrentOffset; + } + + + /** + * @param currentOffset The currentOffset to set. + */ + public void setCurrentOffset(int currentOffset) { + CurrentOffset = currentOffset; + } + + + /** + * @return Returns the numResults. + */ + public int getNumResults() { + return NumResults; + } + + + /** + * @param numResults The numResults to set. + */ + public void setNumResults(int numResults) { + if (NumResults != numResults){ + NumResults = numResults; + CurrentOffset = 0; // reset the offset if different resultset + } + } + + + /** + * @return Returns the resultsPerPage. + */ + public int getResultsPerPage() { + return ResultsPerPage; + } + + + /** + * @param resultsPerPage The resultsPerPage to set. + */ + public void setResultsPerPage(int resultsPerPage) { + ResultsPerPage = resultsPerPage; + } + + public int getNumPages() { + double numPages = (double)getNumResults() / getResultsPerPage(); + return (int)java.lang.Math.ceil(numPages); + } + + public int getCurrentPage() { + return (getCurrentOffset() / getResultsPerPage())+1; + } + + + public int getSliderPosition() { + return sliderPosition; + } + + + + public void setSliderPosition(int sliderPosition) { + this.sliderPosition = sliderPosition; + } + + +} diff --git a/orkweb/src/net/sf/oreka/tapestry/my.library b/orkweb/src/net/sf/oreka/tapestry/my.library new file mode 100644 index 0000000..daadbfa --- /dev/null +++ b/orkweb/src/net/sf/oreka/tapestry/my.library @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library-specification + PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN" + "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd"> +<!-- generated by Spindle, http://spindle.sourceforge.net --> + + +<library-specification> + + <description>Project specific components</description> + + <library id="contrib" specification-path="/org/apache/tapestry/contrib/Contrib.library"/> +</library-specification> diff --git a/orkweb/src/net/sf/oreka/tcomponents/TestComponent.java b/orkweb/src/net/sf/oreka/tcomponents/TestComponent.java new file mode 100644 index 0000000..e2c5888 --- /dev/null +++ b/orkweb/src/net/sf/oreka/tcomponents/TestComponent.java @@ -0,0 +1,33 @@ +/* + * Oreka -- A media capture and retrieval platform + * + * Copyright (C) 2005, orecx LLC + * + * http://www.orecx.com + * + * This program is free software, distributed under the terms of + * the GNU General Public License. + * Please refer to http://www.gnu.org/copyleft/gpl.html + * + */ + +package net.sf.oreka.tcomponents; + +import org.apache.tapestry.BaseComponent; +import org.apache.tapestry.IRequestCycle; +import org.apache.tapestry.annotations.ComponentClass; +import org.apache.tapestry.annotations.Persist; + +@ComponentClass +public abstract class TestComponent extends BaseComponent { + + public void myAction(IRequestCycle cycle) { + + setHighlight(!getHighlight()); + cycle.activate("Home"); + } + + @Persist + public abstract boolean getHighlight(); + public abstract void setHighlight(boolean highlight); +} |