1 /* 2 * Copyright 2004 the original author or authors. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.nordija.tapestry.bayeux.stream; 17 18 import org.apache.tapestry.IRequestCycle; 19 import org.apache.tapestry.engine.IEngineService; 20 import org.apache.tapestry.engine.ILink; 21 import org.apache.tapestry.link.AbstractLinkComponent; 22 import org.apache.tapestry.link.DirectLink; 23 24 /** 25 * Renders a link to the stream service. 26 * <p/> 27 * The link acts much like the {@link DirectLink} but renders a link to the {@link StreamService} an id for the resource to be streamed. 28 * 29 * @author Jacob von Eyben www.nordija.com 30 * @version $Id: StreamLink.java 131 2007-06-05 19:31:21Z jeyben $ 31 * @see com.nordija.tapestry.bayeux.stream.StreamService 32 */ 33 public abstract class StreamLink extends AbstractLinkComponent implements IStream { 34 35 /** 36 * The parameters passed to the StreamService and further to the specified StreamResourceSourceExtention. 37 * 38 * @return 39 */ 40 public abstract Object getParameters(); 41 42 /** 43 * todo: document 44 * 45 * @return 46 */ 47 public abstract String getStreamResourceSourceExtentionName(); 48 49 /** 50 * todo: document 51 * 52 * @return 53 */ 54 public abstract IEngineService getStreamService(); 55 56 /** 57 * todo: document 58 * 59 * @param cycle 60 * @return 61 */ 62 public ILink getLink(IRequestCycle cycle) { 63 Object[] serviceParameters = DirectLink.constructServiceParameters(getParameters()); 64 StreamServiceParameter ssp = new StreamServiceParameter(this, getStreamResourceSourceExtentionName(), serviceParameters); 65 return getStreamService().getLink(isStateful(), ssp); 66 } 67 }