//{HEADER
/**
* This class is part of jnex 'Nexirius Application Framework for Java'
*
* Copyright (C) Nexirius GmbH, CH-4450 Sissach, Switzerland (www.nexirius.ch)
*
* <p>This library is free software; you can redistribute it and/or<br>
* modify it under the terms of the GNU Lesser General Public<br>
* License as published by the Free Software Foundation; either<br>
* version 2.1 of the License, or (at your option) any later version.</p>
*
* <p>This library is distributed in the hope that it will be useful,<br>
* but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU<br>
* Lesser General Public License for more details.</p>
*
* <p>You should have received a copy of the GNU Lesser General Public<br>
* License along with this library; if not, write to the Free Software<br>
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</p>
* </blockquote>
*
* <p>
* Nexirius GmbH, hereby disclaims all copyright interest in<br>
* the library jnex' 'Nexirius Application Framework for Java' written<br>
* by Marcel Baumann.</p>
*/
//}HEADER
/*
* Created by IntelliJ IDEA.
* User: F503219
* Date: 26.03.2004
* Time: 13:29:30
* To change template for new class use
* Code Style | Class Templates options (Tools | IDE Options).
*/
package com.nexirius.framework.datamodel.persistence;
import com.nexirius.util.StringVector;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
public class PersistenceEnvironmentTable extends HashMap {
void putEnvironment(PersistenceEnvironment e) {
if (!(e instanceof DirectoryEnvironment)) {
throw new RuntimeException("Only accepting subclasses of type DirectoryEnvironment but have type '" + e.getClass().getName() + "'");
}
put(e.getName(), e);
}
public PersistenceEnvironment getEnvironment(String name)
throws Exception {
PersistenceEnvironment ret = (PersistenceEnvironment) get(name);
if (ret == null) {
throw new Exception("No such environment '" + name + "'");
}
return ret;
}
public StringVector getEnvironmentNames() {
Iterator iter = this.keySet().iterator();
StringVector v = new StringVector();
while (iter.hasNext()) {
v.sortInsert((String) iter.next());
}
return v;
}
public Set getEnvironments() {
return entrySet();
}
}