KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > cms > publishing > AbstractFilePublisher


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
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  */

17
18 /* $Id: AbstractFilePublisher.java 42598 2004-03-01 16:18:28Z gregor $ */
19
20 package org.apache.lenya.cms.publishing;
21
22 import java.io.File JavaDoc;
23 import java.io.FileNotFoundException JavaDoc;
24 import java.io.IOException JavaDoc;
25
26
27 /**
28  * @deprecated use the publish ant task instead.
29  */

30 public abstract class AbstractFilePublisher extends AbstractPublisher {
31     /**
32      * Utility function to copy a source file to destination
33      *
34      * @param source a <code>File</code> value
35      * @param destination a <code>File</code> value
36      *
37      * @exception IOException if an error occurs
38      * @throws FileNotFoundException DOCUMENT ME!
39      */

40     protected void copyFile(File JavaDoc source, File JavaDoc destination)
41         throws IOException JavaDoc, FileNotFoundException JavaDoc {
42         if (!source.exists()) {
43             throw new FileNotFoundException JavaDoc();
44         }
45
46         File JavaDoc parentDestination = new File JavaDoc(destination.getParent());
47
48         if (!parentDestination.exists()) {
49             parentDestination.mkdirs();
50         }
51
52         org.apache.avalon.excalibur.io.FileUtil.copyFile(source, destination);
53     }
54 }
55
Popular Tags