01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18: package org.apache.ivy.plugins.repository;
19:
20: import java.io.IOException;
21: import java.io.InputStream;
22:
23: public class BasicResource implements Resource {
24: private boolean local;
25:
26: private String name;
27:
28: private long lastModified;
29:
30: private long contentLength;
31:
32: private boolean exists;
33:
34: public BasicResource(String name, boolean exists,
35: long contentLength, long lastModified, boolean local) {
36: this .name = name;
37: this .exists = exists;
38: this .contentLength = contentLength;
39: this .lastModified = lastModified;
40: this .local = local;
41: }
42:
43: public Resource clone(String cloneName) {
44: throw new UnsupportedOperationException(
45: "basic resource do not support the clone method");
46: }
47:
48: public boolean exists() {
49: return this .exists;
50: }
51:
52: public long getContentLength() {
53: return this .contentLength;
54: }
55:
56: public long getLastModified() {
57: return this .lastModified;
58: }
59:
60: public String getName() {
61: return this .name;
62: }
63:
64: public boolean isLocal() {
65: return this .local;
66: }
67:
68: public InputStream openStream() throws IOException {
69: throw new UnsupportedOperationException(
70: "basic resource do not support the openStream method");
71: }
72:
73: public String toString() {
74: return getName();
75: }
76:
77: }
|