本文整理汇总了Java中bruma.master.MasterFactory类的典型用法代码示例。如果您正苦于以下问题:Java MasterFactory类的具体用法?Java MasterFactory怎么用?Java MasterFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MasterFactory类属于bruma.master包,在下文中一共展示了MasterFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import bruma.master.MasterFactory; //导入依赖的package包/类
public static void main(final String[] args) {
System.out.println("version:" + MasterFactory.VERSION + "\n");
System.out.println("bruma.tools.lupa.Lupa - graphical database browser");
System.out.println("bruma.examples.DumpDbIII - dumps the database records");
System.out.println("bruma.tools.CopyMaster - copy a master file");
System.out.println("bruma.tools.Isis2Mongo - export a database to MongoDb");
System.out.println("bruma.tools.Isis2Couch - export a database to CouchDb");
System.out.println("bruma.tools.ExportMaster - export a master file to other formats");
System.out.println("bruma.tools.ImportMaster - import a master file from other formats");
System.out.println("bruma.tools.RegExpImportMaster - import a master file using regular expressions");
System.out.println("bruma.tools.Statistics - show statistics of a master file");
System.out.println("bruma.tools.lupa.Search - search a regular expression in records");
System.out.println("");
System.out.println("");
System.out.println("");
}
示例2: main
import bruma.master.MasterFactory; //导入依赖的package包/类
/**
* @param args <dbname> [<encoding>]
* @throws BrumaException
*/
public static void main(final String[] args) throws BrumaException {
if (args.length < 1) {
usage();
}
final String encoding = Master.GUESS_ISO_IBM_ENCODING;/*(args.length > 1) ? args[1]
: Master.DEFAULT_ENCODING;*/
final Master mst = MasterFactory.getInstance(args[0])
.setEncoding(encoding)
.open();
boolean first = true;
for (Record rec : mst) {
if (rec.getStatus() == Record.Status.ACTIVE) {
if (first) {
first = false;
} else {
System.out.println(",");
}
System.out.print(rec.toJSON3(0, null));
}
}
System.out.println();
mst.close();
}
示例3: main
import bruma.master.MasterFactory; //导入依赖的package包/类
/**
* @param args
* @throws BrumaException
*/
public static void main(final String[] args) throws BrumaException {
if (args.length != 3) {
usage();
}
final Master from = MasterFactory.getInstance(args[0])
.setEncoding(args[1])
.open();
final Master to = (Master)MasterFactory.getInstance(args[2])
.asAnotherMaster(from)
.create();
for (Record rec : from) {
to.writeRecord(rec);
}
from.close();
to.close();
}
示例4: main
import bruma.master.MasterFactory; //导入依赖的package包/类
public static void main(final String[] args) throws BrumaException {
if (args.length != 1) {
usage();
}
final Master mst = MasterFactory.getInstance(args[0])
.setEncoding("ISO8859-1").open();
final XrfFile xrf = mst.getXrf();
final int nxtmfn = mst.getControlRecord().getNxtmfn();
for (int mfn = 1; mfn < nxtmfn; mfn++) {
System.out.println(xrf.readXrfInfo(mfn));
}
mst.close();
}
示例5: RepRec
import bruma.master.MasterFactory; //导入依赖的package包/类
/**
*
* @param mstName nome da base de dados de entrada
* @param encoding encoding da base de dados
* @param outFile nome do arquivo no qual serão escritos os mfns dos
* registros repetidos
* @throws BrumaException
*/
public RepRec(final String mstName,
final String encoding,
final String outFile) throws BrumaException {
if (mstName == null) {
throw new BrumaException("null mstName");
}
if (encoding == null) {
throw new BrumaException("null encoding");
}
if (outFile == null) {
throw new BrumaException("null outFile");
}
mst = MasterFactory.getInstance(mstName)
.setEncoding(encoding).open();
map = new HashMap<String,Integer>();
try {
out = new BufferedWriter(new FileWriter(outFile));
} catch(IOException ioe) {
throw new BrumaException(ioe);
}
}
示例6: main
import bruma.master.MasterFactory; //导入依赖的package包/类
public static void main(String[] args) throws BrumaException {
if (args.length < 1) {
usage();
}
final Master master = MasterFactory.getInstance(args[0]).open();
final Control control = master.getControlRecord();
System.out.println("Ctlmfn: " + control.getCtlmfn());
System.out.println("Mfcxx1: " + control.getMfcxx1());
System.out.println("Mfcxx2: " + control.getMfcxx2());
System.out.println("Mfcxx3: " + control.getMfcxx3());
System.out.println("Mftype: " + control.getMftype());
System.out.println("Nxtmfb: " + control.getNxtmfb());
System.out.println("Nxtmfn: " + control.getNxtmfn());
System.out.println("Nxtmfp: " + control.getNxtmfp());
System.out.println("Reccnt: " + control.getReccnt());
System.out.println("FFI: " + master.isFFI());
System.out.println("Shift: " + master.getShift());
System.out.println("GigaSize: " + master.getGigaSize());
System.out.println("Swapped: " + master.isSwapped());
System.out.println();
master.close();
}
示例7: clearFrame
import bruma.master.MasterFactory; //导入依赖的package包/类
private void clearFrame() {
jScrollBarMfn.setMinimum(0);
jScrollBarMfn.setMaximum(0);
jScrollBarMfn.setValue(0);
jLabelMfnBegin.setText("0");
jLabelMfnEnd.setText("0");
jLabelCurMfn.setText("0");
jLabelStatus.setText("deleted");
jLabelLock.setVisible(false);
jLabelDbEncoding.setText("");
jLabelIsisType.setText("");
jLabelDataAlignment.setText("");
jLabelSwapped.setText("");
jLabelMaxSize.setText("");
openProf = new OpenProfile();
lastOpenProf = null;
//openProf.setEncoding(Master.DEFAULT_ENCODING);
openProf.setEncoding(Master.GUESS_ISO_IBM_ENCODING);
jTextAreaDump.setText("");
jCheckBoxShowAll.setSelected(true);
this.setTitle("Lupa (" + MasterFactory.VERSION + ")");
}
示例8: main
import bruma.master.MasterFactory; //导入依赖的package包/类
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
if (GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) {
System.out.println("\n Bruma version:" + MasterFactory.VERSION + "\n");
System.out.println(" use: java -cp <BrumaDir>/Bruma.jar <option>\n");
System.out.println(" bruma.tools.lupa.Lupa - not available in this environment");
System.out.println(" bruma.examples.DumpDbIII - dump database records");
System.out.println(" bruma.tools.CopyMaster - copy a master file");
System.out.println(" bruma.tools.Isis2Couch - export a database to CouchDb");
System.out.println(" bruma.tools.ExportMaster - export a master file to other formats");
System.out.println(" bruma.tools.ImportMaster - import a master file from other formats");
System.out.println(" bruma.tools.Statistics - show statistics of a master file");
System.out.println(" bruma.tools.lupa.Search - search a regular expression in records");
System.out.println("");
System.out.println("");
System.out.println("");
} else {
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new Lupa().setVisible(true);
}
});
}
}
示例9: IsisRecordIterator
import bruma.master.MasterFactory; //导入依赖的package包/类
public IsisRecordIterator(final String dbName,
final String encoding) {
super();
try {
String encod = (encoding == null) ? Master.GUESS_ISO_IBM_ENCODING
: encoding;
id = 0;
master = MasterFactory.getInstance(dbName)
.setEncoding(encod)
.open();
last = master.getControlRecord().getNxtmfn() - 1;
getNextRecord();
} catch (BrumaException ex) {
Logger.getLogger(IsisRecordIterator.class.getName()).
log(Level.SEVERE, null, ex);
}
}
示例10: Isis2Json
import bruma.master.MasterFactory; //导入依赖的package包/类
public Isis2Json(final String mstname,
final String encoding,
final List<Integer> tags,
final int from,
final int to,
final String convTableFile) throws BrumaException,
IOException {
if (mstname == null) {
throw new NullPointerException("mstname");
}
if (encoding == null) {
throw new NullPointerException("encoding");
}
if (from < 1) {
throw new IllegalArgumentException("from[" + from + "] < 1");
}
if (to < from) {
throw new IllegalArgumentException("to[" + to + "] <= from[" + from
+ "]");
}
this.from = from;
this.to = to;
this.tags = tags;
this.convTable = (convTableFile == null) ? null
: getConvTable(convTableFile);
this.mst = MasterFactory.getInstance(mstname).setEncoding(encoding)
.open();
current = from;
next = getNext();
}
示例11: exportDocuments
import bruma.master.MasterFactory; //导入依赖的package包/类
@Override
public void exportDocuments(final Iterable<JSONObject> it,
final int tell) {
if (it == null) {
throw new NullPointerException("it");
}
if (tell <= 0) {
throw new IllegalArgumentException("tell <= 0");
}
try {
final MasterFactory minterf = MasterFactory.getInstance(mstName)
.setEncoding(encoding)
.setFFI(ffi);
final Master mst = (Master) (append ? minterf.open()
: minterf.forceCreate());
int tot = 0;
for (JSONObject obj : it) {
if (++tot % tell == 0) {
System.out.println("+++" + tot);
}
mst.writeRecord(convertToRecord(obj));
}
mst.close();
} catch (BrumaException ex) {
Logger.getLogger(Json2Isis.class.getName())
.log(Level.SEVERE, null, ex);
}
}
示例12: export
import bruma.master.MasterFactory; //导入依赖的package包/类
@Override
public void export(final int tell) throws BrumaException {
final int xtell = (tell <= 0) ? Integer.MAX_VALUE : tell;
final Master fromMst = MasterFactory.getInstance(mst.getMasterName())
.setDataAlignment(mst.getDataAlignment())
.setEncoding(mst.getEncoding())
.setFFI(mst.isFFI())
.setMaxGigaSize(mst.getGigaSize())
.setSwapped(mst.isSwapped())
.open();
final Master toMst = (Master)MasterFactory.getInstance(toMstName)
.setFFI(isToFFI)
.setDataAlignment(toDataAlignment)
.setEncoding(toEncoding)
.setMaxGigaSize(toMaxGigaSize)
.setSwapped(isToSwapped)
.create();
int mfn = 0;
int cur = 0;
for (Record rec : fromMst) {
if (++cur % xtell == 0) {
System.out.println("++" + cur);
}
if (exportDeleted) {
toMst.writeRecord(rec);
} else {
if (rec.getStatus() == Record.Status.ACTIVE) {
rec.setMfn(++mfn);
toMst.writeRecord(rec);
}
}
}
fromMst.close();
toMst.close();
}
示例13: main
import bruma.master.MasterFactory; //导入依赖的package包/类
/**
* @param args <dbname> [<encoding>]
* @throws BrumaException
*/
public static void main(final String[] args) throws BrumaException {
if (args.length < 1) {
usage();
}
final String encoding = (args.length > 1) ? args[1]
: Master.GUESS_ISO_IBM_ENCODING;
final Master mst = MasterFactory.getInstance(args[0])
.setEncoding(encoding)
.open();
for (Record rec : mst) {
if (rec.getStatus() == Record.Status.ACTIVE) {
System.out.println("mfn=" + rec.getMfn());
for (Field field : rec) {
System.out.println("tag=" + field.getId());
for (Subfield subfield : field) {
System.out.println("sub id=" + subfield.getId());
System.out.println("sub content="
+ subfield.getContent());
}
}
System.out.println();
}
}
mst.close();
}
示例14: main
import bruma.master.MasterFactory; //导入依赖的package包/类
/**
*
* @param args {isis|iso|id}=<filename> <encoding> <toDbname>
* @throws BrumaException
*/
public static void main(final String[] args) throws BrumaException {
if (args.length != 3) {
usage();
}
AbstractRecordIterator iterator = null;
if (args[0].startsWith("isis=")) {
iterator = new IsisRecordIterator(args[0].substring(5), args[1]);
} else if (args[0].startsWith("iso=")) {
iterator = new ISO2709RecordIterator(args[0].substring(4), args[1]);
} else if (args[0].startsWith("id=")) {
iterator = new IdFileRecordIterator(
new File(args[0].substring(3)), args[1]);
} else {
usage();
}
final Master to = (Master)MasterFactory.getInstance(args[2])
.setEncoding(args[1])
.create();
for (Record rec : iterator) {
to.writeRecord(rec);
}
iterator.close();
}
示例15: guessEncoding
import bruma.master.MasterFactory; //导入依赖的package包/类
public String guessEncoding() throws BrumaException {
final Master mst = MasterFactory.getInstance(mstName)
.setEncoding(Master.DEFAULT_ENCODING)
.open();
Charset encoding;
count_rec = 0;
for (Record rec : mst) {
if (rec == null) {
throw new BrumaException("master possible corrupted");
}
if (rec.getStatus() == Record.Status.ACTIVE) {
if (smart) {
count_rec++;
}
for (Field fld : rec) {
addText(fld.getContent());
}
}
if (smart && canGuess()) {
break;
}
}
mst.close();
encoding = guessResult();
return (encoding == null ? null : encoding.displayName());
}