001/*
002 * Copyright (C) 2014 Jörg Prante
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.xbib.elasticsearch.plugin.jdbc.classloader;
017
018import java.net.URL;
019
020public abstract class AbstractURLResourceLocation implements ResourceLocation {
021
022    private final URL codeSource;
023
024    public AbstractURLResourceLocation(URL codeSource) {
025        this.codeSource = codeSource;
026    }
027
028    public final URL getCodeSource() {
029        return codeSource;
030    }
031
032    public void close() {
033    }
034
035    public final boolean equals(Object o) {
036        if (this == o) {
037            return true;
038        }
039        if (o == null || getClass() != o.getClass()) {
040            return false;
041        }
042        AbstractURLResourceLocation that = (AbstractURLResourceLocation) o;
043        return codeSource.equals(that.codeSource);
044    }
045
046    public final int hashCode() {
047        return codeSource.hashCode();
048    }
049
050    public final String toString() {
051        return "[" + getClass().getName() + ": " + codeSource + "]";
052    }
053}