01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/content/tags/sakai_2-4-1/content-impl/impl/src/java/org/sakaiproject/content/impl/BasicMultiFileUploadPipe.java $
03: * $Id: BasicMultiFileUploadPipe.java 20824 2007-01-31 04:22:47Z jimeng@umich.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2007 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.content.impl;
21:
22: import java.util.List;
23: import java.util.Vector;
24:
25: import org.sakaiproject.component.cover.ComponentManager;
26: import org.sakaiproject.content.api.MultiFileUploadPipe;
27: import org.sakaiproject.content.api.ResourceToolAction;
28: import org.sakaiproject.content.api.ResourceToolActionPipe;
29: import org.sakaiproject.content.api.ResourceTypeRegistry;
30:
31: /**
32: * BasicMultiFileUploadPipe
33: *
34: */
35: public class BasicMultiFileUploadPipe extends
36: BasicResourceToolActionPipe implements MultiFileUploadPipe {
37: /* */
38: protected List<ResourceToolActionPipe> pipes = new Vector<ResourceToolActionPipe>();
39:
40: /* */
41: protected ResourceTypeRegistry registry = (ResourceTypeRegistry) ComponentManager
42: .get("org.sakaiproject.content.api.ResourceTypeRegistry");
43:
44: /**
45: * @param interactionId
46: * @param action
47: */
48: public BasicMultiFileUploadPipe(String interactionId,
49: ResourceToolAction action) {
50: super (interactionId, action);
51: pipes.add(this );
52: // TODO Auto-generated constructor stub
53: }
54:
55: /* (non-Javadoc)
56: * @see org.sakaiproject.content.api.MultiFileUploadPipe#addFile()
57: */
58: public ResourceToolActionPipe addFile() {
59: ResourceToolActionPipe newPipe = registry.newPipe(
60: initializationId, action);
61: pipes.add(newPipe);
62: return newPipe;
63: }
64:
65: /* (non-Javadoc)
66: * @see org.sakaiproject.content.api.MultiFileUploadPipe#getPipes()
67: */
68: public List<ResourceToolActionPipe> getPipes() {
69: return new Vector(pipes);
70: }
71:
72: /* (non-Javadoc)
73: * @see org.sakaiproject.content.api.MultiFileUploadPipe#setFileCount(int)
74: */
75: public void setFileCount(int count) {
76: while (pipes.size() < count) {
77: ResourceToolActionPipe newPipe = registry.newPipe(
78: initializationId, action);
79: pipes.add(newPipe);
80: }
81:
82: while (pipes.size() > count) {
83: pipes.remove(pipes.size() - 1);
84: }
85: }
86:
87: }
|