1 /*
2 * Copyright 2007 Hippo
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"
12 * BASIS, 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 package nl.hippo.portal.cms.source;
17
18 import org.apache.commons.lang.StringUtils;
19
20 /***
21 * @author <a href="mailto:d.dam@hippo.nl">Dennis Dam</a>
22 *
23 * @version $Id: AbstractSourceFactory.java 8564 2007-10-18 15:30:09Z ddam $
24 */
25 public abstract class AbstractSourceFactory implements SourceFactory {
26
27 private String name;
28
29 /* (non-Javadoc)
30 * @see nl.hippo.portal.cms.source.SourceFactory#getName()
31 */
32 public String getName() {
33 return this.name;
34 }
35
36 public void setName(String name){
37 this.name=name;
38 }
39
40 protected String getUrlPath(String url) throws SourceException {
41 String path = StringUtils.substringAfter(url, "://");
42 if (path == null){
43 throw new SourceException("Invalid url: "+url);
44 }
45 return path;
46 }
47
48
49 }