/*
* Copyright 2008 - 2009 Lars Heuer (heuer[at]semagia.com). All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.semagia.atomico.server.impl;
import com.semagia.atomico.dm.IAuthor;
import com.semagia.atomico.dm.impl.Author;
import com.semagia.atomico.server.IConfiguration;
import com.semagia.atomico.server.storage.SortOrder;
/**
* Default, immutable configuration.
*
* @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
*/
public class DefaultConfiguration implements IConfiguration {
/**
*
*/
private final IAuthor _author;
/**
* Default configuration with a default author but no e-mail and IRI.
*/
public DefaultConfiguration() {
this("[unknown]");
}
/**
* Default configuration with an author.
*
* @param authorName The author's name.
*/
public DefaultConfiguration(final String authorName) {
this(authorName, null);
}
/**
* Default configuration with an author and the e-mail address of the author.
*
* @param authorName The author's name.
* @param authorEmail The author's e-mail address.
*/
public DefaultConfiguration(final String authorName, final String authorEmail) {
this(authorName, authorEmail, null);
}
/**
* Default configuration with an author and the e-mail address and IRI of
* the author.
*
* @param authorName The author's name.
* @param authorEmail The author's e-mail address.
* @param authorIRI The author's IRI.
*/
public DefaultConfiguration(final String authorName, final String authorEmail, final String authorIRI) {
_author = new Author(authorName, authorEmail, authorIRI);
}
/* (non-Javadoc)
* @see com.semagia.atomico.server.IConfiguration#getAuthor()
*/
@Override
public IAuthor getAuthor() {
return _author;
}
/* (non-Javadoc)
* @see com.semagia.atomico.server.IConfiguration#getAuthorName()
*/
@Override
public String getAuthorName() {
return _author.getName();
}
/* (non-Javadoc)
* @see com.semagia.atomico.server.IConfiguration#getAuthorEmail()
*/
@Override
public String getAuthorEmail() {
return _author.getEmail();
}
/* (non-Javadoc)
* @see com.semagia.atomico.server.IConfiguration#getAuthorIRI()
*/
@Override
public String getAuthorIRI() {
return _author.getIRI();
}
/* (non-Javadoc)
* @see com.semagia.atomico.server.IConfiguration#getFragmentSortOrder()
*/
@Override
public SortOrder getFragmentSortOrder() {
return SortOrder.UPDATED_DESC;
}
/* (non-Javadoc)
* @see com.semagia.atomico.server.IConfiguration#getSnapshotSortOrder()
*/
@Override
public SortOrder getSnapshotSortOrder() {
return SortOrder.UPDATED_DESC;
}
/* (non-Javadoc)
* @see com.semagia.atomico.server.IConfiguration#getOverviewFeedTitle()
*/
@Override
public String getOverviewFeedTitle() {
return "Overview Feed";
}
/* (non-Javadoc)
* @see com.semagia.atomico.server.IConfiguration#getCollectionSortOrder()
*/
@Override
public SortOrder getCollectionSortOrder() {
return SortOrder.TITLE_ASC;
}
/* (non-Javadoc)
* @see com.semagia.atomico.server.IConfiguration#getCollectionFeedTitle(java.lang.String)
*/
@Override
public String getCollectionFeedTitle(String collectionTitle) {
return "Collection Feed for " + collectionTitle;
}
/* (non-Javadoc)
* @see com.semagia.atomico.server.IConfiguration#getFragmentFeedTitle(java.lang.String)
*/
@Override
public String getFragmentFeedTitle(String collectionTitle) {
return "Fragments Feed for " + collectionTitle;
}
/* (non-Javadoc)
* @see com.semagia.atomico.server.IConfiguration#getSnapshotFeedTitle(java.lang.String)
*/
@Override
public String getSnapshotFeedTitle(String collectionTitle) {
return "Snapshots Feed for " + collectionTitle;
}
/* (non-Javadoc)
* @see com.semagia.atomico.server.IConfiguration#getFragmentsEntryTitle(java.lang.String)
*/
@Override
public String getFragmentsEntryTitle(String collectionTitle) {
return "Fragments";
}
/* (non-Javadoc)
* @see com.semagia.atomico.server.IConfiguration#getSnapshotsEntryTitle(java.lang.String)
*/
@Override
public String getSnapshotsEntryTitle(String collectionTitle) {
return "Snapshots";
}
}