com.googlecode.aaw.init.Reset Maven / Gradle / Ivy
The newest version!
/**
* Copyright © 2012, 2013 dr. ir. Jeroen M. Valk
*
* This file is part of Badgerfish CPX. Badgerfish CPX is free software:
* you can redistribute it and/or modify it under the terms of the GNU Lesser
* General Public License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version. Badgerfish
* CPX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more details. You
* should have received a copy of the GNU Lesser General Public License along
* with Badgerfish CPX. If not, see .
*/
package com.googlecode.aaw.init;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import com.googlecode.aaw.arche.Arche;
import com.googlecode.aaw.badgerfish.SAXHandler;
public class Reset extends SAXHandler {
static final private Arche arche = Arche.getArche(Reset.class);
static final private Logger logger = (Logger) arche.getInstance();
final private List catalogs = new ArrayList();
private File workspace = null;
@Override
protected void onDocumentStart() {
logger.info("RESET");
}
@Override
protected void onDocumentEnd() {
logger.info("OK");
}
@Override
protected void onElementStart(String tagname) {
switch (getDepth()) {
case 0:
assert tagname.equals("reset");
break;
default:
assert false;
}
}
@Override
protected void onElementEnd(String tagname, String content) {
assert content.equals("");
switch (getDepth()) {
case 0:
assert tagname.equals("reset");
break;
default:
assert false;
}
}
@Override
protected void onElement(String tagname, String value) {
if (tagname.equals("workspace")) {
workspace = new File(value);
assert workspace.isDirectory();
} else if (tagname.equals("catalog")) {
catalogs.add(value);
} else {
assert false;
}
}
public File getWorkspace() {
return workspace;
}
}