View Javadoc

1   /*
2    * Copyright 2006 - 2012 Christina Bohk and Roland Ewald
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" BASIS,
12   * 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 p3j.pppm.readerwriter.database;
17  
18  import james.core.data.model.IModelReader;
19  import james.core.data.model.read.plugintype.IMIMEType;
20  import james.core.data.model.read.plugintype.ModelReaderFactory;
21  import james.core.model.IModel;
22  import james.core.model.symbolic.ISymbolicModel;
23  import james.core.parameters.ParameterBlock;
24  
25  import java.net.URI;
26  
27  import p3j.pppm.ProjectionModel;
28  import p3j.pppm.SymbolicProjectionModel;
29  
30  /**
31   * Factory for reader/writer of PPPM files.
32   * 
33   * @author Christina Bohk
34   * @author Roland Ewald
35   * 
36   */
37  public class PPPModelDatabaseReaderWriterFactory extends ModelReaderFactory {
38  
39  	/** Serialization ID. */
40  	private static final long serialVersionUID = 2423298767414579313L;
41  
42  	@Override
43  	public IModelReader create(ParameterBlock params) {
44  		return new PPPMDatabaseReader();
45  	}
46  
47  	@Override
48  	public boolean supportsModel(IModel model) {
49  		return model instanceof ProjectionModel;
50  	}
51  
52  	@Override
53  	public boolean supportsModel(ISymbolicModel<?> model) {
54  		return model instanceof SymbolicProjectionModel;
55  	}
56  
57  	@Override
58  	public boolean supportsURI(URI uri) {
59  		return uri.getScheme().equals("db-p3j");
60  	}
61  
62  	@Override
63  	public boolean supportsMIMEType(IMIMEType mime) {
64  		return false;
65  	}
66  
67  }