
os.rio-core.0.6.0.source-code.GentooUpgradeBuilderPojo Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2014 Objectos, Fábrica de Software LTDA.
*
* 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 br.com.objectos.rio;
import static com.google.common.collect.Lists.newArrayList;
import java.util.List;
import br.com.objectos.way.core.io.Directory;
/**
* @author [email protected] (Marcio Endo)
*/
class GentooUpgradeBuilderPojo
implements
GentooSetupBuilder,
GentooUpgradeBuilder,
GentooUpgradeBuilder.TempDirBuilder,
GentooUpgradeBuilder.MountDirBuilder,
GentooUpgradeBuilder.ResourcesAtBuilder,
GentooUpgradeBuilder.ServerBuilder,
GentooUpgradeBuilder.Stage3Builder,
GentooUpgradeBuilder.DeviceBuilder,
GentooUpgradeBuilder.OptionalsBuilder {
final AbstractRioCommand> command;
private final List fsList = newArrayList();
private final List mountList = newArrayList();
private final List mkdirList = newArrayList();
private final List symlinkList = newArrayList();
private Directory tempDir;
private Directory mountDir;
private String resources;
private HttpServer server;
private String stage3;
private String device;
private String model;
private String sfdisk;
public GentooUpgradeBuilderPojo(AbstractRioCommand> command) {
this.command = command;
}
@Override
public GentooUpgrade build() {
return new GentooUpgrade(this);
}
@Override
public TempDirBuilder tempDirAt(Directory tempDir) {
this.tempDir = tempDir;
return this;
}
@Override
public MountDirBuilder mountDirAt(Directory mountDir) {
this.mountDir = mountDir;
return this;
}
@Override
public ResourcesAtBuilder resourcesAt(String resources) {
this.resources = resources;
return this;
}
@Override
public ServerBuilder serverAt(HttpServer server) {
this.server = server;
return this;
}
@Override
public Stage3Builder stage3(String stage3) {
this.stage3 = stage3;
return this;
}
@Override
public DeviceBuilder toDevice(String device) {
this.device = device;
return this;
}
@Override
public MountBuilder mount() {
return new MountBuilderPojo();
}
@Override
public OptionalsBuilder mkdir(String dir) {
this.mkdirList.add(new GentooMkdir(dir));
return this;
}
@Override
public SymlinkBuilder symlink(String source) {
return new GentooUpgradeBuilderSymlinkPojo(this, source);
}
@Override
public List getFsList() {
return fsList;
}
@Override
public List getMountList() {
return mountList;
}
@Override
public List getMkdirList() {
return mkdirList;
}
@Override
public List getSymlinkList() {
return symlinkList;
}
@Override
public Directory getTempDir() {
return tempDir;
}
@Override
public Directory getMountDir() {
return mountDir;
}
@Override
public String getResources() {
return resources;
}
@Override
public HttpServer getServer() {
return server;
}
@Override
public String getStage3() {
return stage3;
}
@Override
public String getDevice() {
return device;
}
public String getModel() {
return model;
}
@Override
public String getSfdisk() {
return sfdisk;
}
void addSymlink(GentooSymlink gentooSymlink) {
symlinkList.add(gentooSymlink);
}
private class MountBuilderPojo
implements
MountBuilder,
MountBuilderDev {
private int dev;
private String mountPoint;
@Override
public MountBuilderDev dev(int dev) {
this.dev = dev;
return this;
}
@Override
public MountBuilder at() {
this.mountPoint = null;
return add();
}
@Override
public MountBuilder at(String mountPoint) {
this.mountPoint = mountPoint;
return add();
}
@Override
public OptionalsBuilder done() {
return GentooUpgradeBuilderPojo.this;
}
private MountBuilder add() {
String dev = device + this.dev;
mountList.add(new GentooMount(dev, mountPoint));
return this;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy