001    package railo.runtime.video;
002    
003    import railo.commons.io.res.Resource;
004    import railo.commons.lang.StringUtil;
005    import railo.runtime.exp.PageException;
006    import railo.runtime.exp.PageRuntimeException;
007    import railo.runtime.type.List;
008    
009    public class VideoInputImpl implements VideoInput {
010    
011            private Resource resource;
012            private String args="";
013            private String path;
014    
015            /**
016             * Constructor of the class
017             * @param resource
018             */
019            public VideoInputImpl(Resource resource) {
020                    this.resource=resource;
021            }
022    
023            /**
024             * @see railo.runtime.video.VideoInput#getResource()
025             */
026            public Resource getResource() {
027                    return resource;
028            }
029            
030            /**
031             * @see railo.runtime.video.VideoInput#setCommand(java.lang.String, java.util.List)
032             */
033            public void setCommand(String path,java.util.List args) {
034                    this.path=path;
035                    try {
036                            addArgs(List.listToList(args, " "));
037                    } catch (PageException pe) {
038                            throw new PageRuntimeException(pe);
039                    }
040            }
041            
042            public void setCommand(String path,String[] args) {
043                    this.path=path;
044                    addArgs(List.arrayToList(args, " "));
045            }
046            
047            /**
048             * @see railo.runtime.video.VideoInput#getCommandAsString()
049             */
050            public String getCommandAsString() {
051                    return path+" "+args;
052            }
053            
054            private void addArgs(String args) {
055                    if(StringUtil.isEmpty(this.args,true))
056                            this.args=args;
057                    else 
058                            this.args+="; "+args;
059                    
060            }
061    }