id
stringlengths 36
36
| text
stringlengths 1
1.25M
|
---|---|
c105fbb2-932d-4fab-aafa-c857edd2256a | @Test(expected = NotEnoughMoneyInATM.class)
public void checkMoneyEnoughInATMThrowsException()
throws NotEnoughMoneyInATM, NotEnoughMoneyInAccount {
double ammount = 500;
double moneyInATM = 200;
double accountBalance = 1000;
Account acc = mock(Account.class);
Card card = mock(Card.class);
ATM atm = new ATM(acc, card);
when(acc.getBalance()).thenReturn(accountBalance);
atm.getCash(ammount, accountBalance, moneyInATM);
assertEquals(ammount, moneyInATM, 0.01);
} |
89a0bd51-5784-43b1-9521-44b3cdffc9b4 | @Test
public void getInCorrectOrderCashMethod() throws NotEnoughMoneyInAccount,
NotEnoughMoneyInATM {
Account acc = mock(Account.class);
Card card = mock(Card.class);
ATM atm = new ATM(acc, card);
double ammount = 500.0;
double accountBalance = 700;
double moneyFromATM = 1000;
when(acc.getBalance()).thenReturn(accountBalance);
atm.getCash(ammount, accountBalance, moneyFromATM);
InOrder order = inOrder(acc);
order.verify(acc, times(1)).getBalance();
order.verify(acc, times(1)).withdraw(anyDouble());
} |
bbdd11f4-60c0-4f47-b5fd-a9610eecea60 | public void f() throws NotEnoughMoneyInATM {
System.out.println(
"Throwing NotEnoughMoneyInATM");
throw new NotEnoughMoneyInATM ();
} |
de783539-d430-4673-a628-02e9abaa41b3 | public static void main(String[] args) {
NotEnoughMoneyInATMDemo sed =
new NotEnoughMoneyInATMDemo();
try {
sed.f();
} catch(NotEnoughMoneyInATM e) {
System.err.println("Caught it!");
}
} |
61604f5a-a742-4909-af12-631adb4c7c4a | public void f() throws NotEnoughMoneyInAccount {
System.out.println(
"Throwing NotEnoughMoneyInAccount");
throw new NotEnoughMoneyInAccount ();
} |
81f052e3-9f9b-4382-a7f0-1177570c792b | public static void main(String[] args) {
NotEnoughMoneyInAccountDemo sed =
new NotEnoughMoneyInAccountDemo();
try {
sed.f();
} catch(NotEnoughMoneyInAccount e) {
System.err.println("Caught it!");
}
} |
027f12f1-1c33-480a-bf9d-b5fa11e73aaa | public void f() throws NoCardInserted {
System.out.println(
"Throwing NoCardInserted");
throw new NoCardInserted ();
} |
9d30768a-7b2c-457e-8d8c-f706e5faed5a | public static void main(String[] args) {
NoCardInsertedDemo sed =
new NoCardInsertedDemo();
try {
sed.f();
} catch(NoCardInserted e) {
System.err.println("Caught it!");
}
} |
045685ff-fd56-410b-872a-afd440215523 | public ISAACAlgorithm() {
mem = new int[SIZE];
rsl = new int[SIZE];
init(false);
} |
40848f26-df75-4aa4-a515-7c8bc805db38 | public ISAACAlgorithm(int[] seed) {
mem = new int[SIZE];
rsl = new int[SIZE];
// This is slow and throws an ArrayIndexOutOfBoundsException if
// seed.length > rsl.length ...
/* for (int i = 0; i < seed.length; ++i) rsl[i] = seed[i]; */
// ... this is faster and safe:
System.arraycopy(seed, 0, rsl, 0,
seed.length <= rsl.length ? seed.length : rsl.length);
init(true);
} |
127bb504-4504-40e7-b6c5-8f9ca51d3b72 | private final void isaac() {
int i, x, y;
b += ++c;
for (i = 0; i < SIZE; ++i) {
x = mem[i];
switch (i & 3) {
case 0:
a ^= a << 13;
break;
case 1:
a ^= a >>> 6;
break;
case 2:
a ^= a << 2;
break;
case 3:
a ^= a >>> 16;
break;
}
a += mem[i + SIZE / 2 & SIZE - 1];
mem[i] = y = mem[(x & MASK) >> 2] + a + b;
rsl[i] = b = mem[(y >> SIZEL & MASK) >> 2] + x;
}
} |
6a85daa7-f845-49cd-b126-e08595e902ba | private final void init(boolean flag) {
int i;
int a, b, c, d, e, f, g, h;
a = b = c = d = e = f = g = h = 0x9e3779b9; // The golden ratio
for (i = 0; i < 4; ++i) {
a ^= b << 11;
d += a;
b += c;
b ^= c >>> 2;
e += b;
c += d;
c ^= d << 8;
f += c;
d += e;
d ^= e >>> 16;
g += d;
e += f;
e ^= f << 10;
h += e;
f += g;
f ^= g >>> 4;
a += f;
g += h;
g ^= h << 8;
b += g;
h += a;
h ^= a >>> 9;
c += h;
a += b;
}
for (i = 0; i < SIZE; i += 8) { // Fill in mem[] with messy stuff
if (flag) {
a += rsl[i];
b += rsl[i + 1];
c += rsl[i + 2];
d += rsl[i + 3];
e += rsl[i + 4];
f += rsl[i + 5];
g += rsl[i + 6];
h += rsl[i + 7];
}
a ^= b << 11;
d += a;
b += c;
b ^= c >>> 2;
e += b;
c += d;
c ^= d << 8;
f += c;
d += e;
d ^= e >>> 16;
g += d;
e += f;
e ^= f << 10;
h += e;
f += g;
f ^= g >>> 4;
a += f;
g += h;
g ^= h << 8;
b += g;
h += a;
h ^= a >>> 9;
c += h;
a += b;
mem[i] = a;
mem[i + 1] = b;
mem[i + 2] = c;
mem[i + 3] = d;
mem[i + 4] = e;
mem[i + 5] = f;
mem[i + 6] = g;
mem[i + 7] = h;
}
if (flag) { // Second pass: makes all of seed affect all of mem[]
for (i = 0; i < SIZE; i += 8) {
a += mem[i];
b += mem[i + 1];
c += mem[i + 2];
d += mem[i + 3];
e += mem[i + 4];
f += mem[i + 5];
g += mem[i + 6];
h += mem[i + 7];
a ^= b << 11;
d += a;
b += c;
b ^= c >>> 2;
e += b;
c += d;
c ^= d << 8;
f += c;
d += e;
d ^= e >>> 16;
g += d;
e += f;
e ^= f << 10;
h += e;
f += g;
f ^= g >>> 4;
a += f;
g += h;
g ^= h << 8;
b += g;
h += a;
h ^= a >>> 9;
c += h;
a += b;
mem[i] = a;
mem[i + 1] = b;
mem[i + 2] = c;
mem[i + 3] = d;
mem[i + 4] = e;
mem[i + 5] = f;
mem[i + 6] = g;
mem[i + 7] = h;
}
}
isaac();
count = SIZE;
} |
d7e6f4b6-3ab0-4e90-b2a4-9f26acb4a03e | public final int nextInt() {
if (0 == count--) {
isaac();
count = SIZE - 1;
}
return rsl[count];
} |
67321ca2-6f04-4432-94ec-bbb841fc2159 | final void supplementSeed(int[] seed) {
for (int i = 0; i < seed.length; i++)
mem[i % mem.length] ^= seed[i];
} |
2b4bece4-2bcb-4017-8d80-edada86787d0 | public static void main(String[] args) {
logger.info("Starting the server application...");
// we load the networking related stuff now
try {
new GameServerBootstrap().bind();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
5f326bfc-2d32-4cc6-a306-a7025134c0e9 | @Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline p = Channels.pipeline();
return p;
} |
25af8dde-5938-454f-82ed-33ffe0e1c16a | public GameServerBootstrap() throws IOException {
} |
d3e9d1bc-bc9d-484e-8b8f-883e5b476757 | public void bind() {
logger.info("Starting the networking...");
// We set the netty up now
bootstrap.setFactory(new NioServerSocketChannelFactory(executor, executor));
bootstrap.setPipelineFactory(new GameServerPipelineFactory());
// The address the server will be listening too
SocketAddress game = new InetSocketAddress(GameConstants.PORT);
logger.info("The game server is now listening to " +GameConstants.PORT+ ".");
// we now are listening on this port
bootstrap.bind(game);
} |
e2d681be-0bd0-4fc9-afac-1a94d6efd929 | public Entity(int index) {
this.index = index;
} |
813f403c-0f4e-41ff-8178-25da652f8fb1 | public final int getIndex() {
return index;
} |
862f8d15-aec5-4c19-8a55-80ae58d15ef4 | public Position getPosition() {
return position;
} |
76169eb1-1b76-4b7e-aa68-2ee6252c1b2d | public void setPosition(Position position) {
this.position = position;
} |
4a909cd2-67ef-40a2-886f-9f84657de692 | private GameConstants() {
} |
e278d895-60af-436d-8b93-67a1d0f6c91d | public Position(int x, int y, int z) {
this.x = (short)x;
this.y = (short)y;
this.z = (byte)z;
} |
1788a314-169d-4069-b1f1-6bad33f319e9 | public short getX() {
return x;
} |
aca81606-dbbf-448d-b91d-d877c2e0b594 | public short getY() {
return y;
} |
cd528e01-412d-40c7-a124-809abd359371 | public byte getZ() {
return z;
} |
9f8424e2-296a-4e1b-bcde-0f63bde72095 | public boolean isUpdateRequired() {
return !flags.isEmpty();
} |
dc1dabca-edc4-4a0c-81c0-60357c97ae72 | public Combatable(int index) {
super(index);
// TODO Auto-generated constructor stub
} |
7f990212-1147-4adc-aa0f-46f97e26d4bb | public Actor(int index) {
super(index);
// TODO Auto-generated constructor stub
} |
5b7bab8e-82bb-4949-8a3c-1bf7bf753a2d | public Player(int index) {
super(index);
// TODO Auto-generated constructor stub
} |
920a0684-fe74-4e34-96fe-e433a67774a9 | public Mob(int index) {
super(index);
// TODO Auto-generated constructor stub
} |
6a45d01b-25f1-49f7-9273-c85c97fd48a5 | public CombatableMob(int index) {
super(index);
// TODO Auto-generated constructor stub
} |
57194d5d-1db0-40dc-8e51-6d761b722c3f | public static void main(String[] args) {
// TODO Auto-generated method stub
ClientLoginFrame clientLoginFrame=new ClientLoginFrame();
clientLoginFrame.setSize(450,300);
clientLoginFrame.setVisible(true);
clientLoginFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
} |
e869ea8a-65e3-4b3c-b14a-e268d52bcaa3 | public ClientLoginFrame() {
getContentPane().setLayout(null);
System.out.println("Want to connect to Server?");
panel = new JPanel();
panel.setBounds(40, 41, 349, 186);
getContentPane().add(panel);
panel.setLayout(null);
JLabel lblIpAddress = new JLabel("Ip Address");
lblIpAddress.setBounds(31, 36, 81, 14);
panel.add(lblIpAddress);
JLabel lblPort = new JLabel("Port");
lblPort.setBounds(31, 67, 46, 14);
panel.add(lblPort);
tfPort = new JTextField();
tfPort.setBounds(139, 64, 169, 20);
panel.add(tfPort);
tfPort.setColumns(10);
textField = new JTextField();
textField.setText("127.0.0.1");
textField.setBounds(139, 33, 169, 20);
panel.add(textField);
textField.setColumns(10);
JLabel lblYourName = new JLabel("Your Roll");
lblYourName.setBounds(31, 101, 81, 14);
panel.add(lblYourName);
txtRakin = new JTextField();
txtRakin.setText("201005009");
txtRakin.setColumns(10);
txtRakin.setBounds(139, 95, 169, 20);
panel.add(txtRakin);
JButton btnConnect = new JButton("Connect");
btnConnect.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String ipAddress = textField.getText();
String name = txtRakin.getText();
int port = Integer.parseInt(tfPort.getText());
try {
System.out.println("Trying to connect to Server.");
Socket socket = new Socket(ipAddress, port);
System.out.println("Connected to Server.");
InputStream is = socket.getInputStream();
OutputStream os = socket.getOutputStream();
byte[] bytes = name.getBytes();
os.write(bytes);
DataInputStream dis = new DataInputStream(is);
while (dis.available() == 0) {
}
String response = dis.readUTF();
if (response.equals("ValidStudentId")) {
ClientFrame clientFrame = new ClientFrame(socket);
clientFrame.setSize(450, 300);
clientFrame
.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
clientFrame.setVisible(true);
dispose();
} else {
String errorMessage="";
if (response.equals("InvalidIpAddress"))
{
errorMessage="The ip address for you device is not allowed to connect with the given Student Id.";
}
else if(response.equals("InvalidStudentId"))
{
errorMessage="The student id you provided is invalid. Please re-enter a valid student id.";
}
JOptionPane.showMessageDialog(null, errorMessage);
socket.close();
}
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// new ClientThread().start();
}
});
btnConnect.setBounds(113, 152, 89, 23);
panel.add(btnConnect);
lblwarning = new JLabel("");
lblwarning.setFont(new Font("Arial", Font.BOLD, 14));
lblwarning.setForeground(Color.RED);
lblwarning.setBounds(31, 11, 308, 14);
panel.add(lblwarning);
} |
b327a187-66e2-4172-8cb5-a301eea4060c | public void actionPerformed(ActionEvent arg0) {
String ipAddress = textField.getText();
String name = txtRakin.getText();
int port = Integer.parseInt(tfPort.getText());
try {
System.out.println("Trying to connect to Server.");
Socket socket = new Socket(ipAddress, port);
System.out.println("Connected to Server.");
InputStream is = socket.getInputStream();
OutputStream os = socket.getOutputStream();
byte[] bytes = name.getBytes();
os.write(bytes);
DataInputStream dis = new DataInputStream(is);
while (dis.available() == 0) {
}
String response = dis.readUTF();
if (response.equals("ValidStudentId")) {
ClientFrame clientFrame = new ClientFrame(socket);
clientFrame.setSize(450, 300);
clientFrame
.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
clientFrame.setVisible(true);
dispose();
} else {
String errorMessage="";
if (response.equals("InvalidIpAddress"))
{
errorMessage="The ip address for you device is not allowed to connect with the given Student Id.";
}
else if(response.equals("InvalidStudentId"))
{
errorMessage="The student id you provided is invalid. Please re-enter a valid student id.";
}
JOptionPane.showMessageDialog(null, errorMessage);
socket.close();
}
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// new ClientThread().start();
} |
6fc3fd82-fcff-4048-8e86-4efa020e167f | public ClientFrame(final Socket socket) {
getContentPane().setLayout(null);
this.socket = socket;
fileChooser = new JFileChooser();
fileChooser.setMultiSelectionEnabled(true);
folderChooser = new JFileChooser();
folderChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
folderChooser.setMultiSelectionEnabled(true);
JPanel panel = new JPanel();
panel.setName("Client");
panel.setBorder(new TitledBorder(UIManager
.getBorder("TitledBorder.border"), "File Sender",
TitledBorder.LEADING, TitledBorder.TOP, null, new Color(70,
130, 180)));
panel.setForeground(new Color(0, 0, 0));
panel.setBounds(40, 28, 351, 204);
getContentPane().add(panel);
panel.setLayout(null);
tfFilePath = new JTextField();
tfFilePath.setBounds(10, 41, 239, 20);
tfFilePath
.setText("E:\\Android Workplace\\Server-Client-Architecture\\src\\Client\\ClientFrame.java");
panel.add(tfFilePath);
tfFilePath.setColumns(10);
JLabel lblFilePath = new JLabel("File Path");
lblFilePath.setBounds(10, 16, 81, 14);
panel.add(lblFilePath);
JButton btnSendAFile = new JButton("Send A File");
btnSendAFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String[] paths = tfFilePath.getText().split(";");
try {
for (String path : paths) {
OutputStream os = socket.getOutputStream();
DataOutputStream dos = new DataOutputStream(os);
dos.writeUTF("ConfigurationRequest");
DataInputStream dis = new DataInputStream(socket
.getInputStream());
while (dis.available() == 0) {
}
configurations = new Configurations();
int length = dis.readInt();
String[] extensions = new String[length];
for (int i = 0; i < length; i++) {
extensions[i] = dis.readUTF();
}
configurations.setExtensions(extensions);
configurations.setNumberOfFiles(dis.readInt());
configurations.setMaximumSize(dis.readLong());
configurations.setMinId(dis.readLong());
configurations.setMaxId(dis.readLong());
configurations.setFolderAllowed(dis.readBoolean());
File file = new File(path);
if (configurations.isValidExtension(file.getName())
&& configurations.isValidSize(file.length())) {
dos.writeUTF("FileCount");
int count=dis.readInt();
if(configurations.isValidFileCount(count))
{
dos.writeUTF("Valid");
transmitFile(path);
JOptionPane.showMessageDialog(null,
"Successfully Transfered.");
}
else{
dos.writeUTF("Invalid");
String msg="More Than Allowed Number Of Files!!!!";
JOptionPane.showMessageDialog(null, msg);
}
} else {
dos.writeUTF("Invalid");
String msg = "";
if (!configurations.isValidExtension(file.getName())) {
msg+="Invalid Extension!!!!";
}
if (!configurations.isValidSize(file.length())) {
msg+="Very Large File!!!!";
}
JOptionPane.showMessageDialog(null, msg);
}
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});
btnSendAFile.setBounds(89, 72, 152, 23);
panel.add(btnSendAFile);
JLabel lblDirectiry = new JLabel("Directory");
lblDirectiry.setBounds(10, 103, 166, 14);
panel.add(lblDirectiry);
tfFolderPath = new JTextField();
tfFolderPath.setBounds(10, 128, 239, 20);
tfFolderPath
.setText("E:\\Android Workplace\\Server-Client-Architecture\\src");
panel.add(tfFolderPath);
tfFolderPath.setColumns(10);
JButton btnSendAFolder = new JButton("Send A Folder");
btnSendAFolder.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String path = tfFolderPath.getText();
// FileInputStream fis = null;
try {
OutputStream os = socket.getOutputStream();
DataOutputStream dos = new DataOutputStream(os);
dos.writeUTF("ConfigurationRequest");
DataInputStream dis = new DataInputStream(socket
.getInputStream());
while (dis.available() == 0) {
}
configurations = new Configurations();
int length = dis.readInt();
String[] extensions = new String[length];
for (int i = 0; i < length; i++) {
extensions[i] = dis.readUTF();
}
configurations.setExtensions(extensions);
configurations.setNumberOfFiles(dis.readInt());
configurations.setMaximumSize(dis.readLong());
configurations.setMinId(dis.readLong());
configurations.setMaxId(dis.readLong());
configurations.setFolderAllowed(dis.readBoolean());
// System.out.println(configurations.toString());
File file = new File(path);
if (configurations.isValidSize(file.length())
&& configurations.isFolderAllowed()) {
dos.writeUTF("Valid");
// lblWarning.setText("Success");
transmitFolder(path);
JOptionPane.showMessageDialog(null,
"Successfully Transfered.");
} else {
String msg = "";
dos.writeUTF("Invalid");
if (configurations.isValidExtension(file.getName())) {
msg += "Invalid Extension!!!!";
}
if (configurations.isValidSize(file.length())) {
msg += "Very Large File!!!!";
}
if (configurations.isFolderAllowed()) {
msg += "Folder Not Allowed!!!!";
}
// lblWarning.setText(msg);
JOptionPane.showMessageDialog(null, msg);
}
System.out.println("end");
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
System.out.println("end");
}
});
btnSendAFolder.setBounds(89, 159, 152, 23);
panel.add(btnSendAFolder);
JButton btnBrowseFile = new JButton("Browse");
btnBrowseFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if (fileChooser.showOpenDialog(getFrames()[0]) == JFileChooser.APPROVE_OPTION) {
tfFilePath.setText(getAllFileName(fileChooser.getSelectedFiles()));
}
}
});
btnBrowseFile.setBounds(252, 40, 89, 23);
panel.add(btnBrowseFile);
JButton btnBrowseFolder = new JButton("Browse");
btnBrowseFolder.setBounds(252, 127, 89, 23);
panel.add(btnBrowseFolder);
btnBrowseFolder.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
if (folderChooser.showOpenDialog(getFrames()[0]) == JFileChooser.APPROVE_OPTION) {
tfFolderPath.setText(folderChooser.getSelectedFile()
.getAbsolutePath());
}
}
});
} |
c0f5495d-d076-41ae-a869-eecc8e7b303e | public void actionPerformed(ActionEvent e) {
String[] paths = tfFilePath.getText().split(";");
try {
for (String path : paths) {
OutputStream os = socket.getOutputStream();
DataOutputStream dos = new DataOutputStream(os);
dos.writeUTF("ConfigurationRequest");
DataInputStream dis = new DataInputStream(socket
.getInputStream());
while (dis.available() == 0) {
}
configurations = new Configurations();
int length = dis.readInt();
String[] extensions = new String[length];
for (int i = 0; i < length; i++) {
extensions[i] = dis.readUTF();
}
configurations.setExtensions(extensions);
configurations.setNumberOfFiles(dis.readInt());
configurations.setMaximumSize(dis.readLong());
configurations.setMinId(dis.readLong());
configurations.setMaxId(dis.readLong());
configurations.setFolderAllowed(dis.readBoolean());
File file = new File(path);
if (configurations.isValidExtension(file.getName())
&& configurations.isValidSize(file.length())) {
dos.writeUTF("FileCount");
int count=dis.readInt();
if(configurations.isValidFileCount(count))
{
dos.writeUTF("Valid");
transmitFile(path);
JOptionPane.showMessageDialog(null,
"Successfully Transfered.");
}
else{
dos.writeUTF("Invalid");
String msg="More Than Allowed Number Of Files!!!!";
JOptionPane.showMessageDialog(null, msg);
}
} else {
dos.writeUTF("Invalid");
String msg = "";
if (!configurations.isValidExtension(file.getName())) {
msg+="Invalid Extension!!!!";
}
if (!configurations.isValidSize(file.length())) {
msg+="Very Large File!!!!";
}
JOptionPane.showMessageDialog(null, msg);
}
}
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
} |
eb9d9010-fe0c-47d8-b5d2-1ed9f53d3576 | public void actionPerformed(ActionEvent arg0) {
String path = tfFolderPath.getText();
// FileInputStream fis = null;
try {
OutputStream os = socket.getOutputStream();
DataOutputStream dos = new DataOutputStream(os);
dos.writeUTF("ConfigurationRequest");
DataInputStream dis = new DataInputStream(socket
.getInputStream());
while (dis.available() == 0) {
}
configurations = new Configurations();
int length = dis.readInt();
String[] extensions = new String[length];
for (int i = 0; i < length; i++) {
extensions[i] = dis.readUTF();
}
configurations.setExtensions(extensions);
configurations.setNumberOfFiles(dis.readInt());
configurations.setMaximumSize(dis.readLong());
configurations.setMinId(dis.readLong());
configurations.setMaxId(dis.readLong());
configurations.setFolderAllowed(dis.readBoolean());
// System.out.println(configurations.toString());
File file = new File(path);
if (configurations.isValidSize(file.length())
&& configurations.isFolderAllowed()) {
dos.writeUTF("Valid");
// lblWarning.setText("Success");
transmitFolder(path);
JOptionPane.showMessageDialog(null,
"Successfully Transfered.");
} else {
String msg = "";
dos.writeUTF("Invalid");
if (configurations.isValidExtension(file.getName())) {
msg += "Invalid Extension!!!!";
}
if (configurations.isValidSize(file.length())) {
msg += "Very Large File!!!!";
}
if (configurations.isFolderAllowed()) {
msg += "Folder Not Allowed!!!!";
}
// lblWarning.setText(msg);
JOptionPane.showMessageDialog(null, msg);
}
System.out.println("end");
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
System.out.println("end");
} |
5f7dbbce-1476-471d-a3d1-c6c0cc2b9899 | public void actionPerformed(ActionEvent arg0) {
if (fileChooser.showOpenDialog(getFrames()[0]) == JFileChooser.APPROVE_OPTION) {
tfFilePath.setText(getAllFileName(fileChooser.getSelectedFiles()));
}
} |
0e8fd0c1-1946-40df-b010-53721d9760e7 | public void actionPerformed(ActionEvent arg0) {
if (folderChooser.showOpenDialog(getFrames()[0]) == JFileChooser.APPROVE_OPTION) {
tfFolderPath.setText(folderChooser.getSelectedFile()
.getAbsolutePath());
}
} |
50f01eec-fe43-4543-a30f-348aa300345c | private void transmitFile(String path) throws Exception {
// TODO Auto-generated method stub
int read = 0, firstByte = 0;
File file = new File(path);
FileInputStream fis = new FileInputStream(file);
BufferedInputStream bufStream = new BufferedInputStream(fis);
OutputStream os = socket.getOutputStream();
DataOutputStream dos = new DataOutputStream(os);
DataInputStream dis = new DataInputStream(socket.getInputStream());
dos.writeUTF("File");
// checking over-writing
dos.writeUTF(file.getName());
while (dis.available() == 0) {
}
if (dis.readUTF().equals("Exists")) {
if (JOptionPane
.showOptionDialog(
null,
"The file you want to transfer already exists in the server directory.\nDo you want to overwrite?",
"Over Write ?", JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE, null, null, null)!=JOptionPane.YES_OPTION)
{
dos.writeUTF("DoNotOverWrite");
return;
}else dos.writeUTF("Overwrite");
}
System.out.println("File");
byte[] bytes = new byte[512];
while (true) {
read = bufStream.read(bytes);
dos.writeUTF(file.getName());
System.out.println(file.getName());
dos.writeInt(firstByte);
System.out.println(firstByte);
if (read == -1)
read = 0;
dos.writeInt(read);
System.out.println(read);
dos.write(bytes, 0, read);
// System.out.println(new String(bytes,0,read));
while (dis.available() == 0) {
}
if (dis.readUTF().equals("Acknowledgement")) {
System.out.println("Acknowledgement");
if (read < 512) {
System.out.println("loop broken");
break;
}
firstByte += read;
}
}
dos.writeUTF("CheckSum");
dos.writeUTF(Checksum.md5(bufStream));
bufStream.close();
} |
00db772e-b9a9-4e50-9606-38201f3633fd | private void transmitFolder(String path) throws Exception {
File fileOrDir = new File(path);
// System.out.println(path);
DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
String absolutePath = fileOrDir.getAbsolutePath();
if (fileOrDir.isDirectory()) {
dos.writeUTF("Folder");
dos.writeUTF(fileOrDir.getName());
dos.writeInt(fileOrDir.list().length);
System.out.println("Folder");
System.out.println(fileOrDir.getName());
System.out.println(fileOrDir.list().length);
for (String s : fileOrDir.list()) {
// System.out.println(absolutePath + s);
transmitFolder(absolutePath + File.separator + s);
}
} else {
if (configurations.isValidExtension(fileOrDir.getName())
&& configurations.isValidSize(fileOrDir.length())) {
transmitFile(path);
} else
JOptionPane.showMessageDialog(null, "This File Named "
+ fileOrDir.getName()
+ " Is Not Allowed. Send Another File");
}
} |
5c568ec1-10a9-4777-af8f-76cd6ee34c99 | private String getAllFileName(File[] selectedFiles) {
// TODO Auto-generated method stub
String allNames="";
int count=0;
for (File f : selectedFiles) {
allNames+=f.getAbsolutePath();
if(count!=selectedFiles.length)allNames+=";";
count++;
}
return allNames;
} |
ed5992ac-abe8-4088-af53-1e8359a76fc5 | public ClientThread(String ipAddress, String name) {
super();
this.ipAddress = ipAddress;
this.name = name;
} |
1bb4d0b6-1d2e-4494-bf8d-483d7fdf3c52 | @Override
public void run() {
// TODO Auto-generated method stub
} |
8dff6258-3106-4dbd-997f-f0714da90674 | public Configurations() {
} |
f3131ce4-058a-4034-a343-d8eb7089fcba | public String getRootPath() {
return rootPath;
} |
d542902c-f567-4f8b-8479-55938f6e6eea | public void setRootPath(String rootPath) {
this.rootPath = rootPath;
} |
d84560c9-147c-4467-b655-064625c7a4ef | public String[] getExtensions() {
return extensions;
} |
d070686e-c13c-42c5-81bf-308d91d25338 | public void setExtensions(String[] extensions) {
this.extensions = extensions;
} |
00808b1e-b5c8-40ed-803d-535cb412027e | public int getNumberOfFiles() {
return numberOfFiles;
} |
be1ae64d-e173-4f21-92dc-a10e4ea3f71a | public void setNumberOfFiles(int numberOfFiles) {
this.numberOfFiles = numberOfFiles;
} |
dcdd0687-3a00-452d-ab50-f642e1c13567 | public Long getMaximumSize() {
return maximumSize;
} |
85603d0a-4d86-4185-8679-4af8e5acfeeb | public void setMaximumSize(Long maximumSize) {
this.maximumSize = maximumSize;
} |
49e79313-98cf-4aed-ba68-c7741c280a01 | public Long getMinId() {
return minId;
} |
7578fbb6-fa23-407a-820e-05a2f1746465 | public void setMinId(Long minId) {
this.minId = minId;
} |
3fa5dc53-5151-49f8-87c9-0e2ee0ba21b4 | public Long getMaxId() {
return maxId;
} |
08ad646f-ae28-4e7a-bd57-e17d2ee65181 | public void setMaxId(Long maxId) {
this.maxId = maxId;
} |
0512345d-fa7d-4bc9-b42e-82f81dfe908c | public boolean isFolderAllowed() {
return folderAllowed;
} |
6f7bb7d1-a5c8-4a15-ad0e-23eeb1bd0fae | public void setFolderAllowed(boolean folderAllowed) {
this.folderAllowed = folderAllowed;
} |
caa317ec-da3f-4ecd-baa4-c3cc4360b5ed | public Configurations(String rootPath, String[] extensions,
int numberOfFiles, Long maximumSize, Long minId, Long maxId,
boolean folderAllowed) {
super();
this.rootPath = rootPath;
this.extensions = extensions;
this.numberOfFiles = numberOfFiles;
this.maximumSize = maximumSize;
this.minId = minId;
this.maxId = maxId;
this.folderAllowed = folderAllowed;
} |
3b682c25-04c1-4943-b2ff-d0dd373708ae | @Override
public String toString() {
return "Configurations [rootPath=" + rootPath + ", extensions="
+ Arrays.toString(extensions) + ", numberOfFiles="
+ numberOfFiles + ", maximumSize=" + maximumSize + ", minId="
+ minId + ", maxId=" + maxId + ", folderAllowed="
+ folderAllowed + "]";
} |
d646942c-4797-4b2b-9518-b33305543ad7 | public boolean isValidExtension(String fileName)
{
for (String s : extensions) {
if(fileName.endsWith(s)) return true;
}
return false;
} |
8bc430c8-85a3-484c-a217-33f508e81a25 | public boolean isValidSize(Long fileSize)
{
if(fileSize<=maximumSize)return true;
return false;
} |
8b5fdde5-9df8-4dea-aaa4-915b310498fa | public boolean isValidStudentId(Long studentId)
{
if(studentId>=minId && studentId<=maxId)return true;
return false;
} |
c47692b8-2c6b-4f19-891d-f4288486db56 | public boolean isValidIpAddress(Long studentId,InetAddress ipAddress)
{
InetAddress requiredIpAddress= (InetAddress)ServerRunningFrame.ipIdMap.get(studentId);
if(requiredIpAddress==null)
{
return false;
}
else if(requiredIpAddress.equals(ipAddress))
{
return true;
}
return false;
} |
09ce6ab5-7dd0-491c-b3b9-ca377ed6992c | public void insertNewIdIpMap(Long studentId,InetAddress inetAddress)
{
if(ServerRunningFrame.ipIdMap.containsValue(inetAddress))
{
return;
}
else
{
ServerRunningFrame.ipIdMap.put(studentId, inetAddress);
ServerRunningFrame.idNumOfFilesMap.put(studentId,0);
}
} |
d85a2cd7-104f-4771-bd38-746998ada622 | public boolean isValidFileCount(int count)
{
return count<numberOfFiles;
} |
c3b38c20-e649-49fd-abf8-50d46bb59573 | public static String md5(InputStream is) throws IOException {
String md5 = "";
try {
byte[] bytes = new byte[4096];
int read = 0;
MessageDigest digest = MessageDigest.getInstance("MD5");
while ((read = is.read(bytes)) != -1) {
digest.update(bytes, 0, read);
}
byte[] messageDigest = digest.digest();
StringBuilder sb = new StringBuilder(32);
for (byte b : messageDigest) {
sb.append(hexDigits[(b >> 4) & 0x0f]);
sb.append(hexDigits[b & 0x0f]);
}
md5 = sb.toString();
} catch (Exception e) {
e.printStackTrace();
}
return md5;
} |
8ab1c7e7-bd52-4372-a5b4-91dca0438ca6 | public FileOrFolderRecieverThread(Socket socket, Long studentId,
Configurations configurations) throws Exception {
this.configurations = configurations;
this.studentId = studentId;
this.socket = socket;
bufStream = new BufferedInputStream(socket.getInputStream());
dis = new DataInputStream(bufStream);
} |
479ebfe1-6f45-42d5-86bb-52b7e759a145 | @Override
public void run() {
// TODO Auto-generated method stub
try {
while (true) {
while (bufStream.available() == 0) {
}
String configreq = dis.readUTF();
ServerRunningFrame.println(configreq);
if (configreq.equals("ConfigurationRequest")) {
DataOutputStream dOutputStream = new DataOutputStream(
socket.getOutputStream());
String[] extensions = configurations.getExtensions();
dOutputStream.writeInt(extensions.length);
for (String s : extensions) {
dOutputStream.writeUTF(s);
}
dOutputStream.writeInt(configurations.numberOfFiles);
dOutputStream.writeLong(configurations.maximumSize);
dOutputStream.writeLong(configurations.minId);
dOutputStream.writeLong(configurations.maxId);
dOutputStream.writeBoolean(configurations.folderAllowed);
while (dis.available() == 0) {
}
dis.readUTF();
dOutputStream.writeInt(ServerRunningFrame.idNumOfFilesMap.get(studentId));
if (dis.readUTF().equals("Valid"))
recieveFolder(configurations.rootPath + File.separator
+ studentId.toString());
}
/*
* String fileNameString= dis.readUTF(); FileOutputStream
* fos=new FileOutputStream(fileNameString);
* BufferedOutputStream bufoutStream = new
* BufferedOutputStream(fos);
*
* int available = dis.readInt();
*
* byte[] buffer = new byte[available];
* dis.readFully(buffer,0,buffer.length);
* bufoutStream.write(buffer, 0, buffer.length);
* bufoutStream.flush(); System.out.println(new
* String(buffer,0,buffer.length)); bufoutStream.close();
* bufStream.close();
*/
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
611c80a4-99df-4bfc-9391-6ea45388a452 | private void recieveFile(String abstractPath) throws Exception {
// TODO Auto-generated method stub
DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
// check overwrite
String fileNameString = dis.readUTF();
if (fileExists(abstractPath, fileNameString)) {
dos.writeUTF("Exists");
while (dis.available() == 0) {
}
String choice = dis.readUTF();
System.out.println("choice :" + choice);
if (!choice.equals("Overwrite"))
return;
} else
dos.writeUTF("DoesNotExists");
while (dis.available() == 0) {
}
fileNameString = dis.readUTF();
System.out.println(fileNameString);
FileOutputStream fos = new FileOutputStream(abstractPath
+ File.separator + fileNameString);
BufferedOutputStream bufoutStream = new BufferedOutputStream(fos);
while (bufStream.available() == 0) {
}
byte[] bytes = new byte[512000];
int firstByte = dis.readInt();
int segmentSize = dis.readInt();
System.out.println(firstByte);
System.out.println(segmentSize);
while (true) {
dis.read(bytes, 0, segmentSize);
String s = new String(bytes, 0, 512);
bufoutStream.write(bytes, 0, segmentSize);
bufoutStream.flush();
dos.writeUTF("Acknowledgement");
if (segmentSize < 512) {
break;
}
while (dis.available() == 0) {
}
fileNameString = dis.readUTF();
firstByte = dis.readInt();
segmentSize = dis.readInt();
System.out.println(fileNameString);
System.out.println(firstByte);
System.out.println(segmentSize);
}
System.out.println("loop break");
bufoutStream.flush();
bufoutStream.close();
fos.close();
dis.readUTF();
File file = new File(abstractPath + File.separator + fileNameString);
FileInputStream fis = new FileInputStream(file);
String checksum = dis.readUTF();
if (!isEqualChecksum(fis, checksum))
JOptionPane
.showMessageDialog(null,
"The checksums of the recieved and sent file are not equal.");
else
JOptionPane
.showMessageDialog(null,
"Both the checksum of the recieved and sent files are equal.");
ServerRunningFrame.idNumOfFilesMap.put(studentId,
ServerRunningFrame.idNumOfFilesMap.get(studentId) + 1);
System.out.println("Recieved A File:" + fileNameString);
} |
4962b09a-37e7-48ee-8e64-f88204b9c2a9 | private boolean isEqualChecksum(InputStream fos, String checkSum)
throws Exception {
// TODO Auto-generated method stub
String curCheckSum = Checksum.md5(fos);
System.out.println(checkSum);
System.out.println(curCheckSum);
return curCheckSum.equals(checkSum);
} |
2189f910-17dd-4d2c-a406-972ca31c16b8 | private void recieveFolder(String abstractPath) throws Exception {
// TODO Auto-generated method stub
while (bufStream.available() == 0) {
}
String choice = dis.readUTF();
System.out.println(choice);
if (choice.equals("Folder")) {
String folderName = dis.readUTF();
System.out.println(folderName);
File directory = new File(abstractPath + File.separator
+ folderName);
directory.mkdir();
int numDir = dis.readInt();
System.out.println(numDir);
for (int i = 0; i < numDir; i++) {
while (bufStream.available() == 0) {
}
recieveFolder(abstractPath + File.separator + folderName);
}
System.out.println("Recieved A Folder:" + folderName);
} else {
recieveFile(abstractPath);
}
} |
279e44a3-4e01-4afe-87f4-67a3939a34c0 | public boolean fileExists(String abstractpath, String fileName) {
File directory = new File(abstractpath + File.separator + fileName);
return directory.exists();
} |
caed1707-763a-4b99-8f54-0001a64a34c4 | public ServerRunningFrame(Configurations configurations) {
getContentPane().setLayout(null);
this.configurations = configurations;
setSize(500, 500);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
thread = new Thread(this);
JPanel panel = new JPanel();
panel.setBorder(new EmptyBorder(5, 5, 5, 5));
panel.setBackground(Color.WHITE);
panel.setForeground(Color.BLACK);
panel.setBounds(10, 11, 414, 239);
getContentPane().add(panel);
panel.setLayout(null);
textArea = new JTextArea();
textArea.setBackground(Color.PINK);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.setBounds(10, 11, 394, 217);
panel.add(textArea);
thread.start();
} |
c84da801-d3c7-46f9-aafd-b75fff7f873c | @Override
public void run() {
// TODO Auto-generated method stub
ipIdMap = new HashMap<Long, InetAddress>();
idNumOfFilesMap= new HashMap<Long, Integer>();
Random random = new Random();
int port = random.nextInt(64000);
try {
System.out.println("Connecting to server socket at port " + port);
textArea.append("Connecting to server socket at port " + port
+ "\n");
// repaint();
serverSocket = new ServerSocket(port);
System.out.println("Waiting for socket");
textArea.append("Waiting for socket\n");
while (true) {
Socket socket = serverSocket.accept();
InputStream is = socket.getInputStream();
OutputStream os = socket.getOutputStream();
byte[] bytes = new byte[100];
int readBytes = is.read(bytes);
studentId = new Long(new String(bytes, 0, readBytes));
DataOutputStream dos = new DataOutputStream(os);
//System.out.println(configurations.toString());
if (configurations.isValidStudentId(studentId)) {
if (!ipIdMap.containsKey(studentId))
configurations.insertNewIdIpMap(studentId, socket.getInetAddress());
if (configurations.isValidIpAddress(studentId,
socket.getInetAddress())) {
System.out.println("valid ip + id");
dos.writeUTF("ValidStudentId");
File directory = new File(configurations.rootPath
+ File.separator + studentId.toString());
directory.mkdir();
new FileOrFolderRecieverThread(socket, studentId,
configurations).start();
} else {
int selection = JOptionPane
.showOptionDialog(
null,
"The student wants to connect from a different ip adress.Do you want to accept the connection?",
"Allow Connection",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE, null,
null, null);
if (selection == JOptionPane.OK_OPTION) {
System.out.println("valid id not ip allowed ip");
dos.writeUTF("ValidStudentId");
File directory = new File(configurations.rootPath
+ File.separator + studentId.toString());
directory.mkdir();
new FileOrFolderRecieverThread(socket, studentId,
configurations).start();
}
else
{
dos.writeUTF("InvalidIpAddress");
socket.close();
}
}
} else {
dos.writeUTF("InvalidStudentId");
socket.close();
}
// userName=new String(bytes,0,readBytes);
// System.out.println(userName);
println(studentId.toString());
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
b61fb356-c6f3-44dc-98e8-f3f69b415859 | public static void println(String s) {
textArea.append(s + "\n");
} |
43333bad-3ef0-4c7b-a71c-5ebf23c30dcd | public ServerConfigurationFrame() {
getContentPane().setLayout(null);
jFileChooser= new JFileChooser();
jFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
JPanel panel = new JPanel();
panel.setBounds(10, 11, 464, 313);
getContentPane().add(panel);
panel.setLayout(null);
JLabel lblNewLabel = new JLabel("Root Directory :");
lblNewLabel.setBounds(10, 11, 97, 14);
panel.add(lblNewLabel);
tfRootDirectory = new JTextField();
tfRootDirectory.setBounds(117, 8, 241, 20);
panel.add(tfRootDirectory);
tfRootDirectory.setText("C:\\Users\\Rakin Haider\\Desktop\\New folder");
tfRootDirectory.setColumns(10);
JLabel lblNewLabel_1 = new JLabel("File Types :");
lblNewLabel_1.setBounds(9, 36, 78, 14);
panel.add(lblNewLabel_1);
tfFileTypes = new JTextField();
tfFileTypes.setBounds(117, 33, 241, 20);
tfFileTypes.setEditable(false);
panel.add(tfFileTypes);
tfFileTypes.setColumns(10);
JButton btnBrowse = new JButton("Browse");
btnBrowse.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (jFileChooser.showOpenDialog(getFrames()[0]) == JFileChooser.APPROVE_OPTION) {
tfRootDirectory.setText(jFileChooser.getSelectedFile()
.getAbsolutePath());
}
}
});
btnBrowse.setBounds(368, 7, 86, 23);
panel.add(btnBrowse);
JButton btnAdd = new JButton("Add");
btnAdd.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if(tfFileTypes.getText().equals(""))
tfFileTypes.setText(tfNewType.getText());
else tfFileTypes.setText(tfFileTypes.getText()+";"+tfNewType.getText());
tfNewType.setText("");
}
});
btnAdd.setBounds(368, 66, 86, 23);
panel.add(btnAdd);
JLabel lblNumberOfFiles = new JLabel("Number Of FIles");
lblNumberOfFiles.setBounds(10, 103, 78, 14);
panel.add(lblNumberOfFiles);
tfNumbeOfFiles = new JTextField();
tfNumbeOfFiles.setText("10");
tfNumbeOfFiles.setBounds(117, 100, 241, 20);
panel.add(tfNumbeOfFiles);
tfNumbeOfFiles.setColumns(10);
JLabel lblFolderAllowed = new JLabel("Folder Allowed ?");
lblFolderAllowed.setBounds(10, 148, 78, 14);
panel.add(lblFolderAllowed);
final JCheckBox chckbxYes = new JCheckBox("Yes");
chckbxYes.setSelected(true);
chckbxYes.setBounds(117, 144, 97, 23);
panel.add(chckbxYes);
JLabel lblMaximumSize = new JLabel("Maximum Size :");
lblMaximumSize.setBounds(10, 189, 78, 14);
panel.add(lblMaximumSize);
tfFileSize = new JTextField();
tfFileSize.setText("2097152");
tfFileSize.setBounds(128, 186, 86, 20);
panel.add(tfFileSize);
tfFileSize.setColumns(10);
JLabel lblIdRange = new JLabel("Id Range :");
lblIdRange.setBounds(10, 233, 78, 14);
panel.add(lblIdRange);
tfMinId = new JTextField();
tfMinId.setText("201005001");
tfMinId.setBounds(128, 230, 86, 20);
panel.add(tfMinId);
tfMinId.setColumns(10);
tfMaxId = new JTextField();
tfMaxId.setText("201005120");
tfMaxId.setBounds(249, 230, 86, 20);
panel.add(tfMaxId);
tfMaxId.setColumns(10);
JLabel label = new JLabel("-");
label.setFont(new Font("Tahoma", Font.BOLD, 13));
label.setBounds(227, 232, 46, 14);
panel.add(label);
JButton btnStartServer = new JButton("Start Server");
btnStartServer.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String rootPath=tfRootDirectory.getText();
String fileType=tfFileTypes.getText();
String[] extensions=fileType.split(";");
int numberOfFiles=Integer.parseInt(tfNumbeOfFiles.getText());
long maxFileSize= Long.parseLong(tfFileSize.getText());
long maxId =Long.parseLong(tfMaxId.getText());
long minId= Long.parseLong(tfMinId.getText());
Configurations configurations=
new Configurations(
rootPath,
extensions,
numberOfFiles,
maxFileSize,
minId,
maxId,
chckbxYes.isSelected()
);
dispose();
ServerRunningFrame serverRunningFrame=new ServerRunningFrame(configurations);
}
});
btnStartServer.setBounds(182, 279, 106, 23);
panel.add(btnStartServer);
JLabel lblNewType = new JLabel("New Type :");
lblNewType.setBounds(10, 70, 68, 14);
panel.add(lblNewType);
tfNewType = new JTextField();
tfNewType.setBounds(117, 67, 241, 20);
panel.add(tfNewType);
tfNewType.setColumns(10);
} |
e36f6ac6-4a84-43a7-b9e9-deaf8839f5e8 | public void actionPerformed(ActionEvent e) {
if (jFileChooser.showOpenDialog(getFrames()[0]) == JFileChooser.APPROVE_OPTION) {
tfRootDirectory.setText(jFileChooser.getSelectedFile()
.getAbsolutePath());
}
} |
e7091de5-b243-4b6b-a8c1-c5fe6febeb9c | public void actionPerformed(ActionEvent e) {
if(tfFileTypes.getText().equals(""))
tfFileTypes.setText(tfNewType.getText());
else tfFileTypes.setText(tfFileTypes.getText()+";"+tfNewType.getText());
tfNewType.setText("");
} |
fcf2cd2b-35a0-4209-bc32-4f4246af32c9 | public void actionPerformed(ActionEvent arg0) {
String rootPath=tfRootDirectory.getText();
String fileType=tfFileTypes.getText();
String[] extensions=fileType.split(";");
int numberOfFiles=Integer.parseInt(tfNumbeOfFiles.getText());
long maxFileSize= Long.parseLong(tfFileSize.getText());
long maxId =Long.parseLong(tfMaxId.getText());
long minId= Long.parseLong(tfMinId.getText());
Configurations configurations=
new Configurations(
rootPath,
extensions,
numberOfFiles,
maxFileSize,
minId,
maxId,
chckbxYes.isSelected()
);
dispose();
ServerRunningFrame serverRunningFrame=new ServerRunningFrame(configurations);
} |
e1144b95-52ad-4f57-a7d5-5e65ff706090 | public static void main(String[] args) {
// TODO Auto-generated method stub
ServerConfigurationFrame serverConfigurationFrame= new ServerConfigurationFrame();
serverConfigurationFrame.setSize(500,400);
serverConfigurationFrame.setVisible(true);
serverConfigurationFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
/*
*/
} |
81b6e791-a3ce-4960-9b6a-94387fe08f77 | void conversationCreated(Conversation conversation); |
1e0bc4b1-bb4c-4216-99c1-628cbf0bd8ba | void conversationResuming(Conversation conversation, HttpServletRequest request); |
50deb7ce-5433-4ecf-bc5f-87692e7e2ce5 | void conversationPausing(Conversation conversation); |
6dc93e37-77c6-43c9-8580-f2d66fab0801 | void conversationEnding(Conversation conversation); |
5fe9ed91-2d15-41a6-abb9-aa0e85be5e41 | public ConversationCallBack() {
} |
5470c0cd-e10b-4edf-80a9-94210f0fc062 | public final String ok(T entity) {
incrementPopContextOnNextPauseCounter();
onOk(entity);
return nextView();
} |
eccf660d-a7ee-423c-ba6a-6d5c3b701d38 | protected void onOk(T entity) {
} |
abebb10f-ed34-47bb-bbff-bf1076d98a34 | public final String selected(T entity) {
incrementPopContextOnNextPauseCounter();
onSelected(entity);
return nextView();
} |
1f2acef5-8308-48dd-af15-832fdf2f3737 | public final String selected(T... entities) {
incrementPopContextOnNextPauseCounter();
for (T entity : entities) {
onSelected(entity);
}
return nextView();
} |
8e818f2c-aac4-4526-8cc5-4f9214b92f13 | protected void onSelected(T entity) {
} |
62d5f6ce-4847-4b95-a5a4-bd8c211d72bf | public final String saved(T entity) {
incrementPopContextOnNextPauseCounter();
onSaved(entity);
return nextView();
} |
f68d3d83-84dc-4f0d-b167-66b21db7a54b | protected void onSaved(T entity) {
} |
cc3596f4-75c7-4994-a649-aa0eef2075b0 | public final String notSaved(T entity) {
incrementPopContextOnNextPauseCounter();
onNotSaved(entity);
return nextView();
} |
8e40be65-c326-40dd-8a6a-1d2dc2b93190 | protected void onNotSaved(T entity) {
} |
6a5b22ac-09dd-4ddc-a8a6-1da47c265b0a | public final String deleted(T entity) {
incrementPopContextOnNextPauseCounter();
onDeleted(entity);
return nextView();
} |
ae87a7f8-0e55-407d-8e1c-10f158b88527 | protected void onDeleted(T entity) {
} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.