KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > virtual > plugins > context > AbstractURIHandler


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2006, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.virtual.plugins.context;
23
24 import java.io.IOException JavaDoc;
25 import java.io.InputStream JavaDoc;
26 import java.io.Serializable JavaDoc;
27 import java.net.URI JavaDoc;
28
29 import org.jboss.virtual.spi.VFSContext;
30 import org.jboss.virtual.spi.VirtualFileHandler;
31
32 /**
33  * URIHandler stub.
34  *
35  * @author <a HREF="adrian@jboss.com">Adrian Brock</a>
36  * @version $Revision: 1.1 $
37  */

38 public abstract class AbstractURIHandler extends AbstractVirtualFileHandler
39    implements Serializable JavaDoc
40 {
41    private static final long serialVersionUID = 1L;
42
43    /** The uri */
44    private final URI JavaDoc uri;
45    
46    /**
47     * Create a newURLHandler.
48     *
49     * @param context the context
50     * @param parent the parent
51     * @param uri the uri
52     * @param name the name
53     * @throws IllegalArgumentException for a null context, vfsPath or url
54     */

55    public AbstractURIHandler(VFSContext context, VirtualFileHandler parent, URI JavaDoc uri, String JavaDoc name)
56    {
57       super(context, parent, name);
58       if (uri == null)
59          throw new IllegalArgumentException JavaDoc("Null uri");
60       this.uri = uri;
61    }
62    
63    /**
64     * Get the uri
65     *
66     * @return the uri
67     */

68    public URI JavaDoc getURI()
69    {
70       return uri;
71    }
72
73    public long getLastModified() throws IOException JavaDoc
74    {
75       checkClosed();
76       return 0;
77    }
78
79    public long getSize() throws IOException JavaDoc
80    {
81       checkClosed();
82       return 0;
83    }
84
85    public boolean isHidden() throws IOException JavaDoc
86    {
87       checkClosed();
88       return false;
89    }
90
91    public InputStream JavaDoc openStream() throws IOException JavaDoc
92    {
93       checkClosed();
94       return null;
95    }
96
97    public URI JavaDoc toURI()
98    {
99       return uri;
100    }
101 }
102
Popular Tags