View Javadoc

1   /*
2    * This file is a part of CAST project.
3    * (c) Copyright 2007, AGH University of Science & Technology
4    * https://caribou.iisg.agh.edu.pl/trac/cast
5    *
6    * Licensed under the Eclipse Public License, Version 1.0 (the "License").
7    * You may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    * http://www.eclipse.org/legal/epl-v10.html
10   */
11  /*
12   * File: AbstractPersistenceProviderFactory.java
13   * Created: 2009-09-15
14   * Author: tmilos
15   * $Id$
16   */
17  
18  package pl.edu.agh.cast.data.persistence;
19  
20  /**
21   * Abstract implementation of persistence provider factory.
22   *
23   * @author AGH CAST Team
24   */
25  public abstract class AbstractPersistenceProviderFactory implements IPersistenceProviderFactory {
26  
27  	private String providerId;
28  
29  	/**
30  	 * Constructor.
31  	 *
32  	 * @param providerId
33  	 *            the ID of the provider
34  	 */
35  	protected AbstractPersistenceProviderFactory(String providerId) {
36  		this.providerId = providerId;
37  	}
38  
39  	/**
40  	 * {@inheritDoc}
41  	 *
42  	 * @see pl.edu.agh.cast.data.persistence.IPersistenceProviderFactory#getPersistenceFilePath()
43  	 */
44  	@Override
45  	public String getPersistenceFilePath() {
46  		return String.format("%s.data", getProviderId()); //$NON-NLS-1$
47  	}
48  
49  	/**
50  	 * {@inheritDoc}
51  	 *
52  	 * @see pl.edu.agh.cast.data.persistence.IPersistenceProviderFactory#getProviderId()
53  	 */
54  	@Override
55  	public String getProviderId() {
56  		return providerId;
57  	}
58  
59  }