001 /** 002 * =========================================================== 003 * LibRepository : a free Java content repository access layer 004 * =========================================================== 005 * 006 * Project Info: http://jfreereport.pentaho.org/librepository/ 007 * 008 * (C) Copyright 2006, by Pentaho Corporation and Contributors. 009 * 010 * This library is free software; you can redistribute it and/or modify it under the terms 011 * of the GNU Lesser General Public License as published by the Free Software Foundation; 012 * either version 2.1 of the License, or (at your option) any later version. 013 * 014 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 015 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 016 * See the GNU Lesser General Public License for more details. 017 * 018 * You should have received a copy of the GNU Lesser General Public License along with this 019 * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, 020 * Boston, MA 02111-1307, USA. 021 * 022 * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 023 * in the United States and other countries.] 024 * 025 * ------------ 026 * DummyContentLocation.java 027 * ------------ 028 * (C) Copyright 2006, by Pentaho Corporation. 029 */ 030 031 package org.jfree.repository.dummy; 032 033 import org.jfree.repository.ContentLocation; 034 import org.jfree.repository.ContentEntity; 035 import org.jfree.repository.ContentIOException; 036 import org.jfree.repository.ContentItem; 037 import org.jfree.repository.ContentCreationException; 038 import org.jfree.repository.Repository; 039 040 /** 041 * Creation-Date: 13.11.2006, 17:13:14 042 * 043 * @author Thomas Morgner 044 */ 045 public class DummyContentLocation implements ContentLocation 046 { 047 private String name; 048 private ContentLocation parent; 049 private Repository repository; 050 private static final ContentEntity[] EMPTY_CONTENT_ENTITY = new ContentEntity[0]; 051 052 public DummyContentLocation(final ContentLocation parent, final String name) 053 { 054 this.repository = parent.getRepository(); 055 this.parent = parent; 056 this.name = name; 057 } 058 059 public DummyContentLocation(final Repository repository, final String name) 060 { 061 this.repository = repository; 062 this.name = name; 063 } 064 065 public ContentEntity[] listContents() throws ContentIOException 066 { 067 return EMPTY_CONTENT_ENTITY; 068 } 069 070 public ContentEntity getEntry(final String name) throws ContentIOException 071 { 072 throw new ContentIOException(); 073 } 074 075 public ContentItem createItem(final String name) throws ContentCreationException 076 { 077 throw new ContentCreationException("Cannot create item"); 078 } 079 080 public ContentLocation createLocation(final String name) 081 throws ContentCreationException 082 { 083 return new DummyContentLocation(this, name); 084 } 085 086 public boolean exists(final String name) 087 { 088 return false; 089 } 090 091 public String getName() 092 { 093 return name; 094 } 095 096 public Object getContentId() 097 { 098 return name; 099 } 100 101 public Object getAttribute(final String domain, final String key) 102 { 103 return null; 104 } 105 106 public boolean setAttribute(final String domain, final String key, final Object value) 107 { 108 return false; 109 } 110 111 public ContentLocation getParent() 112 { 113 return parent; 114 } 115 116 public Repository getRepository() 117 { 118 return repository; 119 } 120 121 public boolean delete() 122 { 123 return false; 124 } 125 }