Commit cd4f99df authored by akwizgran's avatar akwizgran
Browse files

Initial commit with new directory structure.

parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="ui"/>
<classpathentry kind="src" path="i18n"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="src" path="api"/>
<classpathentry kind="src" path="components"/>
<classpathentry kind="src" path="util"/>
<classpathentry kind="src" path="installer"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="lib" path="lib/h2small-1.3.154.jar"/>
<classpathentry kind="lib" path="lib/guice-3.0-no_aop.jar"/>
<classpathentry kind="lib" path="lib/javax.inject-1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
/windows-jre
/Briar
/bin
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>briar-prototype</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
#Wed Apr 13 15:01:36 BST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
<project name='api' default='compile'>
<import file='../build-common.xml'/>
</project>
package net.sf.briar.api.crypto;
public interface Password {
char[] getPassword();
}
package net.sf.briar.api.db;
import java.util.Set;
import net.sf.briar.api.protocol.AuthorId;
import net.sf.briar.api.protocol.Bundle;
import net.sf.briar.api.protocol.GroupId;
import net.sf.briar.api.protocol.Message;
public interface DatabaseComponent {
static final long MEGABYTES = 1024L * 1024L;
static final long GIGABYTES = 1024L * MEGABYTES;
static final long MAX_DB_SIZE = 2L * GIGABYTES;
static final long MIN_FREE_SPACE = 300L * MEGABYTES;
static final long CRITICAL_FREE_SPACE = 100L * MEGABYTES;
static final long MAX_BYTES_BETWEEN_SPACE_CHECKS = 5L * MEGABYTES;
static final long MAX_MS_BETWEEN_SPACE_CHECKS = 60L * 1000L; // 1 min
static final long BYTES_PER_SWEEP = 5L * MEGABYTES;
static final int CLEANER_SLEEP_MS = 1000; // 1 sec
static final int RETRANSMIT_THRESHOLD = 3;
void close() throws DbException;
void addLocallyGeneratedMessage(Message m) throws DbException;
void addNeighbour(NeighbourId n) throws DbException;
void generateBundle(NeighbourId n, Bundle b) throws DbException;
Rating getRating(AuthorId a) throws DbException;
Set<GroupId> getSubscriptions() throws DbException;
void receiveBundle(NeighbourId n, Bundle b) throws DbException;
void setRating(AuthorId a, Rating r) throws DbException;
void subscribe(GroupId g) throws DbException;
void unsubscribe(GroupId g) throws DbException;
}
package net.sf.briar.api.db;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import com.google.inject.BindingAnnotation;
@BindingAnnotation
@Target({ PARAMETER })
@Retention(RUNTIME)
public @interface DatabasePassword {}
package net.sf.briar.api.db;
public class DbException extends Exception {
private static final long serialVersionUID = 3706581789209939441L;
public DbException(Throwable t) {
super(t);
}
}
package net.sf.briar.api.db;
public class NeighbourId {
private final int id;
public NeighbourId(int id) {
this.id = id;
}
public int getInt() {
return id;
}
@Override
public boolean equals(Object o) {
if(o instanceof NeighbourId) return id == ((NeighbourId) o).id;
return false;
}
@Override
public int hashCode() {
return id;
}
@Override
public String toString() {
return String.valueOf(id);
}
}
package net.sf.briar.api.db;
public enum Rating {
BAD, UNRATED, GOOD
}
package net.sf.briar.api.db;
public enum Status {
NEW, SENT, SEEN
}
package net.sf.briar.api.i18n;
import java.awt.Font;
import java.io.IOException;
import java.util.Locale;
public interface FontManager {
void initialize(Locale locale) throws IOException;
String[] getBundledFontFilenames();
Font getFontForLanguage(String language);
Font getUiFont();
void setUiFontForLanguage(String language);
}
\ No newline at end of file
package net.sf.briar.api.i18n;
import java.awt.ComponentOrientation;
import java.awt.Font;
import java.io.File;
import java.io.IOException;
import java.util.Locale;
public interface I18n {
String tr(String name);
Locale getLocale();
void setLocale(Locale locale);
void loadLocale() throws IOException;
void saveLocale() throws IOException;
void saveLocale(File dir) throws IOException;
ComponentOrientation getComponentOrientation();
void addListener(Listener l);
void removeListener(Listener l);
public interface Listener {
void localeChanged(Font uiFont);
}
}
\ No newline at end of file
package net.sf.briar.api.i18n;
public class Stri18ng {
private static final String HTML_OPEN_LEFT = "<html><body align='left'>";
private static final String HTML_OPEN_RIGHT = "<html><body align='right'>";
private static final String HTML_CLOSE = "</body></html>";
private static final String PARAGRAPH = "<p><p>"; // Yes, two of them
private final String name;
private final I18n i18n;
public Stri18ng(String name, I18n i18n) {
this.name = name;
this.i18n = i18n;
}
public String tr() {
return i18n.tr(name);
}
public String html() {
if(i18n.getComponentOrientation().isLeftToRight())
return HTML_OPEN_LEFT + i18n.tr(name) + HTML_CLOSE;
else return HTML_OPEN_RIGHT + i18n.tr(name) + HTML_CLOSE;
}
public String html(String... paras) {
StringBuilder s = new StringBuilder();
if(i18n.getComponentOrientation().isLeftToRight())
s.append(HTML_OPEN_LEFT);
else s.append(HTML_OPEN_RIGHT);
s.append(tr());
for(String para : paras) {
s.append(PARAGRAPH);
s.append(para);
}
s.append(HTML_CLOSE);
return s.toString();
}
}
package net.sf.briar.api.invitation;
import java.io.File;
import java.util.List;
public interface InvitationCallback {
boolean isCancelled();
void copyingFile(File f);
void encryptingFile(File f);
void created(List<File> files);
void error(String message);
void notFound(File f);
void notDirectory(File f);
void notAllowed(File f);
}
package net.sf.briar.api.invitation;
import java.io.File;
public interface InvitationParameters {
boolean shouldCreateExe();
boolean shouldCreateJar();
char[] getPassword();
File getChosenLocation();
String[] getBundledFontFilenames();
}
package net.sf.briar.api.invitation;
public interface InvitationWorkerFactory {
Runnable createWorker(InvitationCallback callback,
InvitationParameters parameters);
}
package net.sf.briar.api.protocol;
import java.util.Arrays;
public class AuthorId {
public static final int LENGTH = 32;
public static final AuthorId SELF = new AuthorId(new byte[] {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
});
private final byte[] id;
public AuthorId(byte[] id) {
assert id.length == LENGTH;
this.id = id;
}
public byte[] getBytes() {
return id;
}
@Override
public boolean equals(Object o) {
if(o instanceof AuthorId)
return Arrays.equals(id, ((AuthorId) o).id);
return false;
}
@Override
public int hashCode() {
return Arrays.hashCode(id);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment