repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
in28minutes/SpringIn28Minutes
1.BasicExample/src/test/java/com/in28minutes/example/spring/dataservice/stub/TodoDataServiceDummyImpl.java
// Path: 1.BasicExample/src/main/java/com/in28minutes/example/spring/data/api/TodoDataService.java // public interface TodoDataService { // List<Todo> retrieveTodos(String userName); // } // // Path: 1.BasicExample/src/main/java/com/in28minutes/example/spring/model/Todo.java // public class Todo { // // private String desc; // private Date date; // private boolean isDone; // // public Todo() { // super(); // } // // public Todo(String desc, Date date, boolean isDone) { // this(); // this.desc = desc; // this.date = date; // this.isDone = isDone; // } // // public String getDesc() { // return desc; // } // // public void setDesc(String desc) { // this.desc = desc; // } // // public Date getDate() { // return date; // } // // public void setDate(Date date) { // this.date = date; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return String.format("Todo [desc=%s, date=%s, isDone=%s]", desc, date, // isDone); // } // // }
import java.util.Arrays; import java.util.Date; import java.util.List; import org.springframework.stereotype.Component; import com.in28minutes.example.spring.data.api.TodoDataService; import com.in28minutes.example.spring.model.Todo;
package com.in28minutes.example.spring.dataservice.stub; @Component public class TodoDataServiceDummyImpl implements TodoDataService { private static final int ONE_DAY_IN_MILLISECONDS = 24 * 60 * 1000;
// Path: 1.BasicExample/src/main/java/com/in28minutes/example/spring/data/api/TodoDataService.java // public interface TodoDataService { // List<Todo> retrieveTodos(String userName); // } // // Path: 1.BasicExample/src/main/java/com/in28minutes/example/spring/model/Todo.java // public class Todo { // // private String desc; // private Date date; // private boolean isDone; // // public Todo() { // super(); // } // // public Todo(String desc, Date date, boolean isDone) { // this(); // this.desc = desc; // this.date = date; // this.isDone = isDone; // } // // public String getDesc() { // return desc; // } // // public void setDesc(String desc) { // this.desc = desc; // } // // public Date getDate() { // return date; // } // // public void setDate(Date date) { // this.date = date; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return String.format("Todo [desc=%s, date=%s, isDone=%s]", desc, date, // isDone); // } // // } // Path: 1.BasicExample/src/test/java/com/in28minutes/example/spring/dataservice/stub/TodoDataServiceDummyImpl.java import java.util.Arrays; import java.util.Date; import java.util.List; import org.springframework.stereotype.Component; import com.in28minutes.example.spring.data.api.TodoDataService; import com.in28minutes.example.spring.model.Todo; package com.in28minutes.example.spring.dataservice.stub; @Component public class TodoDataServiceDummyImpl implements TodoDataService { private static final int ONE_DAY_IN_MILLISECONDS = 24 * 60 * 1000;
public List<Todo> retrieveTodos(String userName) {
in28minutes/SpringIn28Minutes
1.BasicExample/src/test/java/com/in28minutes/example/spring/business/examples/javacontext/DependencyInjectionJavaContextExamples.java
// Path: 1.BasicExample/src/test/java/com/in28minutes/example/spring/business/examples/HiService.java // public interface HiService { // public String sayHi(); // }
import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.in28minutes.example.spring.business.examples.HiService;
package com.in28minutes.example.spring.business.examples.javacontext; //Top Spring Annotations //Component/Service, Autowired, Configuration, ComponentScan //RunWith, ContextConfiguration @Configuration @ComponentScan(basePackages = "com.in28minutes.example.spring.business.examples") class JavaTestContext { } @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = JavaTestContext.class) public class DependencyInjectionJavaContextExamples { @Autowired
// Path: 1.BasicExample/src/test/java/com/in28minutes/example/spring/business/examples/HiService.java // public interface HiService { // public String sayHi(); // } // Path: 1.BasicExample/src/test/java/com/in28minutes/example/spring/business/examples/javacontext/DependencyInjectionJavaContextExamples.java import static org.junit.Assert.assertEquals; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.in28minutes.example.spring.business.examples.HiService; package com.in28minutes.example.spring.business.examples.javacontext; //Top Spring Annotations //Component/Service, Autowired, Configuration, ComponentScan //RunWith, ContextConfiguration @Configuration @ComponentScan(basePackages = "com.in28minutes.example.spring.business.examples") class JavaTestContext { } @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = JavaTestContext.class) public class DependencyInjectionJavaContextExamples { @Autowired
private HiService service;
in28minutes/SpringIn28Minutes
6.ExamplesToUnderstandMore/src/main/java/com/in28minutes/spring/example1/businessservice/TodoBusinessService.java
// Path: 6.ExamplesToUnderstandMore/src/main/java/com/in28minutes/spring/example1/dataservice/api/TodoDataService.java // public interface TodoDataService { // List<String> retrieveTodos(String user); // }
import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.in28minutes.spring.example1.dataservice.api.TodoDataService;
package com.in28minutes.spring.example1.businessservice; @Component public class TodoBusinessService { @Autowired
// Path: 6.ExamplesToUnderstandMore/src/main/java/com/in28minutes/spring/example1/dataservice/api/TodoDataService.java // public interface TodoDataService { // List<String> retrieveTodos(String user); // } // Path: 6.ExamplesToUnderstandMore/src/main/java/com/in28minutes/spring/example1/businessservice/TodoBusinessService.java import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.in28minutes.spring.example1.dataservice.api.TodoDataService; package com.in28minutes.spring.example1.businessservice; @Component public class TodoBusinessService { @Autowired
TodoDataService dataService;// = new TodoDataServiceStub()
in28minutes/SpringIn28Minutes
2.RealWorldExample/business/impl/src/test/java/com/in28minutes/example/layering/business/TodoBusinessServiceTest.java
// Path: 2.RealWorldExample/business/api/src/main/java/com/in28minutes/example/layering/business/api/TodoBusinessService.java // public interface TodoBusinessService { // List<Todo> retrieveTodosRelatedToSpring(String user); // } // // Path: 2.RealWorldExample/model/src/main/java/com/in28minutes/example/layering/model/api/client/Todo.java // public class Todo { // // private String desc; // private Date date; // private boolean isDone; // // public Todo(String desc, Date date, boolean isDone) { // super(); // this.desc = desc; // this.date = date; // this.isDone = isDone; // } // // public String getDesc() { // return desc; // } // // public void setDesc(String desc) { // this.desc = desc; // } // // public Date getDate() { // return date; // } // // public void setDate(Date date) { // this.date = date; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return String.format("Todo [desc=%s, date=%s, isDone=%s]", desc, date, // isDone); // } // // }
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.in28minutes.example.layering.business.api.TodoBusinessService; import com.in28minutes.example.layering.model.api.client.Todo;
package com.in28minutes.example.layering.business; //Application Context - java //Business Impl - com.in28minutes.example.layering.business.impl //Stub - com.in28minutes.example.layering.data.stub @Configuration @ComponentScan(basePackages = { "com.in28minutes.example.layering.business.impl", "com.in28minutes.example.layering.data.stub" }) class SpringApplicationContextTest { } // Spring @RunWith(SpringJUnit4ClassRunner.class) // Application Context @ContextConfiguration(classes = SpringApplicationContextTest.class) public class TodoBusinessServiceTest { @Autowired
// Path: 2.RealWorldExample/business/api/src/main/java/com/in28minutes/example/layering/business/api/TodoBusinessService.java // public interface TodoBusinessService { // List<Todo> retrieveTodosRelatedToSpring(String user); // } // // Path: 2.RealWorldExample/model/src/main/java/com/in28minutes/example/layering/model/api/client/Todo.java // public class Todo { // // private String desc; // private Date date; // private boolean isDone; // // public Todo(String desc, Date date, boolean isDone) { // super(); // this.desc = desc; // this.date = date; // this.isDone = isDone; // } // // public String getDesc() { // return desc; // } // // public void setDesc(String desc) { // this.desc = desc; // } // // public Date getDate() { // return date; // } // // public void setDate(Date date) { // this.date = date; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return String.format("Todo [desc=%s, date=%s, isDone=%s]", desc, date, // isDone); // } // // } // Path: 2.RealWorldExample/business/impl/src/test/java/com/in28minutes/example/layering/business/TodoBusinessServiceTest.java import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.in28minutes.example.layering.business.api.TodoBusinessService; import com.in28minutes.example.layering.model.api.client.Todo; package com.in28minutes.example.layering.business; //Application Context - java //Business Impl - com.in28minutes.example.layering.business.impl //Stub - com.in28minutes.example.layering.data.stub @Configuration @ComponentScan(basePackages = { "com.in28minutes.example.layering.business.impl", "com.in28minutes.example.layering.data.stub" }) class SpringApplicationContextTest { } // Spring @RunWith(SpringJUnit4ClassRunner.class) // Application Context @ContextConfiguration(classes = SpringApplicationContextTest.class) public class TodoBusinessServiceTest { @Autowired
TodoBusinessService businessService;
in28minutes/SpringIn28Minutes
2.RealWorldExample/business/impl/src/test/java/com/in28minutes/example/layering/business/TodoBusinessServiceTest.java
// Path: 2.RealWorldExample/business/api/src/main/java/com/in28minutes/example/layering/business/api/TodoBusinessService.java // public interface TodoBusinessService { // List<Todo> retrieveTodosRelatedToSpring(String user); // } // // Path: 2.RealWorldExample/model/src/main/java/com/in28minutes/example/layering/model/api/client/Todo.java // public class Todo { // // private String desc; // private Date date; // private boolean isDone; // // public Todo(String desc, Date date, boolean isDone) { // super(); // this.desc = desc; // this.date = date; // this.isDone = isDone; // } // // public String getDesc() { // return desc; // } // // public void setDesc(String desc) { // this.desc = desc; // } // // public Date getDate() { // return date; // } // // public void setDate(Date date) { // this.date = date; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return String.format("Todo [desc=%s, date=%s, isDone=%s]", desc, date, // isDone); // } // // }
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.in28minutes.example.layering.business.api.TodoBusinessService; import com.in28minutes.example.layering.model.api.client.Todo;
package com.in28minutes.example.layering.business; //Application Context - java //Business Impl - com.in28minutes.example.layering.business.impl //Stub - com.in28minutes.example.layering.data.stub @Configuration @ComponentScan(basePackages = { "com.in28minutes.example.layering.business.impl", "com.in28minutes.example.layering.data.stub" }) class SpringApplicationContextTest { } // Spring @RunWith(SpringJUnit4ClassRunner.class) // Application Context @ContextConfiguration(classes = SpringApplicationContextTest.class) public class TodoBusinessServiceTest { @Autowired TodoBusinessService businessService; @Test public void testRetrieveTodosRelatedToSpring() {
// Path: 2.RealWorldExample/business/api/src/main/java/com/in28minutes/example/layering/business/api/TodoBusinessService.java // public interface TodoBusinessService { // List<Todo> retrieveTodosRelatedToSpring(String user); // } // // Path: 2.RealWorldExample/model/src/main/java/com/in28minutes/example/layering/model/api/client/Todo.java // public class Todo { // // private String desc; // private Date date; // private boolean isDone; // // public Todo(String desc, Date date, boolean isDone) { // super(); // this.desc = desc; // this.date = date; // this.isDone = isDone; // } // // public String getDesc() { // return desc; // } // // public void setDesc(String desc) { // this.desc = desc; // } // // public Date getDate() { // return date; // } // // public void setDate(Date date) { // this.date = date; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return String.format("Todo [desc=%s, date=%s, isDone=%s]", desc, date, // isDone); // } // // } // Path: 2.RealWorldExample/business/impl/src/test/java/com/in28minutes/example/layering/business/TodoBusinessServiceTest.java import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.in28minutes.example.layering.business.api.TodoBusinessService; import com.in28minutes.example.layering.model.api.client.Todo; package com.in28minutes.example.layering.business; //Application Context - java //Business Impl - com.in28minutes.example.layering.business.impl //Stub - com.in28minutes.example.layering.data.stub @Configuration @ComponentScan(basePackages = { "com.in28minutes.example.layering.business.impl", "com.in28minutes.example.layering.data.stub" }) class SpringApplicationContextTest { } // Spring @RunWith(SpringJUnit4ClassRunner.class) // Application Context @ContextConfiguration(classes = SpringApplicationContextTest.class) public class TodoBusinessServiceTest { @Autowired TodoBusinessService businessService; @Test public void testRetrieveTodosRelatedToSpring() {
List<Todo> todos = businessService
in28minutes/SpringIn28Minutes
2.RealWorldExample/data/impl/src/main/java/com/in28minutes/example/layering/data/database/Database.java
// Path: 2.RealWorldExample/model/src/main/java/com/in28minutes/example/layering/model/api/client/Todo.java // public class Todo { // // private String desc; // private Date date; // private boolean isDone; // // public Todo(String desc, Date date, boolean isDone) { // super(); // this.desc = desc; // this.date = date; // this.isDone = isDone; // } // // public String getDesc() { // return desc; // } // // public void setDesc(String desc) { // this.desc = desc; // } // // public Date getDate() { // return date; // } // // public void setDate(Date date) { // this.date = date; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return String.format("Todo [desc=%s, date=%s, isDone=%s]", desc, date, // isDone); // } // // }
import java.util.Arrays; import java.util.Date; import java.util.List; import org.springframework.stereotype.Component; import com.in28minutes.example.layering.model.api.client.Todo;
package com.in28minutes.example.layering.data.database; //TODO : Ideally should use jdbc interfacing or an ORM // A Dummy database just to quickly work something out @Component public class Database {
// Path: 2.RealWorldExample/model/src/main/java/com/in28minutes/example/layering/model/api/client/Todo.java // public class Todo { // // private String desc; // private Date date; // private boolean isDone; // // public Todo(String desc, Date date, boolean isDone) { // super(); // this.desc = desc; // this.date = date; // this.isDone = isDone; // } // // public String getDesc() { // return desc; // } // // public void setDesc(String desc) { // this.desc = desc; // } // // public Date getDate() { // return date; // } // // public void setDate(Date date) { // this.date = date; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return String.format("Todo [desc=%s, date=%s, isDone=%s]", desc, date, // isDone); // } // // } // Path: 2.RealWorldExample/data/impl/src/main/java/com/in28minutes/example/layering/data/database/Database.java import java.util.Arrays; import java.util.Date; import java.util.List; import org.springframework.stereotype.Component; import com.in28minutes.example.layering.model.api.client.Todo; package com.in28minutes.example.layering.data.database; //TODO : Ideally should use jdbc interfacing or an ORM // A Dummy database just to quickly work something out @Component public class Database {
public List<Todo> retrieveTodos(String userName) {
in28minutes/SpringIn28Minutes
4.SpringJDBC/src/main/java/com/in28minutes/jdbc/data/service/TodoDataService.java
// Path: 4.SpringJDBC/src/main/java/com/in28minutes/jdbc/hsql/HsqlDatabase.java // public class HsqlDatabase { // public Connection conn; // // // Connecting to database => // // Executing Query // public HsqlDatabase() { // try { // loadJdbcDriverForHsqlDb(); // setupConnection(); // } catch (ClassNotFoundException e) { // e.printStackTrace(); // } catch (SQLException e) { // e.printStackTrace(); // } // // } // // private void setupConnection() throws SQLException { // conn = DriverManager.getConnection("jdbc:hsqldb:db_file", "sa", ""); // } // // private void loadJdbcDriverForHsqlDb() throws ClassNotFoundException { // Class.forName("org.hsqldb.jdbcDriver"); // } // // private void shutdownHsqlDatabase() throws SQLException { // Statement st = conn.createStatement(); // st.execute("SHUTDOWN"); // } // // public void closeConnection() throws SQLException { // shutdownHsqlDatabase(); // conn.close(); // if there are no other open connection // } // } // // Path: 4.SpringJDBC/src/main/java/com/in28minutes/jdbc/model/Todo.java // public class Todo { // // private int id; // private String description; // private boolean isDone; // // public Todo() { // super(); // } // // public Todo(int id, String description, boolean isDone) { // super(); // this.id = id; // this.description = description; // this.isDone = isDone; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return "Todo [id=" + id + ", description=" + description + ", isDone=" // + isDone + "]"; // } // // }
import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import com.in28minutes.jdbc.hsql.HsqlDatabase; import com.in28minutes.jdbc.model.Todo;
package com.in28minutes.jdbc.data.service; public class TodoDataService { private static final String INSERT_TODO_QUERY = "INSERT INTO TODO(DESCRIPTION,IS_DONE) VALUES(?, ?)"; private static final String DELETE_TODO_QUERY = "DELETE FROM TODO WHERE ID=?";
// Path: 4.SpringJDBC/src/main/java/com/in28minutes/jdbc/hsql/HsqlDatabase.java // public class HsqlDatabase { // public Connection conn; // // // Connecting to database => // // Executing Query // public HsqlDatabase() { // try { // loadJdbcDriverForHsqlDb(); // setupConnection(); // } catch (ClassNotFoundException e) { // e.printStackTrace(); // } catch (SQLException e) { // e.printStackTrace(); // } // // } // // private void setupConnection() throws SQLException { // conn = DriverManager.getConnection("jdbc:hsqldb:db_file", "sa", ""); // } // // private void loadJdbcDriverForHsqlDb() throws ClassNotFoundException { // Class.forName("org.hsqldb.jdbcDriver"); // } // // private void shutdownHsqlDatabase() throws SQLException { // Statement st = conn.createStatement(); // st.execute("SHUTDOWN"); // } // // public void closeConnection() throws SQLException { // shutdownHsqlDatabase(); // conn.close(); // if there are no other open connection // } // } // // Path: 4.SpringJDBC/src/main/java/com/in28minutes/jdbc/model/Todo.java // public class Todo { // // private int id; // private String description; // private boolean isDone; // // public Todo() { // super(); // } // // public Todo(int id, String description, boolean isDone) { // super(); // this.id = id; // this.description = description; // this.isDone = isDone; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return "Todo [id=" + id + ", description=" + description + ", isDone=" // + isDone + "]"; // } // // } // Path: 4.SpringJDBC/src/main/java/com/in28minutes/jdbc/data/service/TodoDataService.java import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import com.in28minutes.jdbc.hsql.HsqlDatabase; import com.in28minutes.jdbc.model.Todo; package com.in28minutes.jdbc.data.service; public class TodoDataService { private static final String INSERT_TODO_QUERY = "INSERT INTO TODO(DESCRIPTION,IS_DONE) VALUES(?, ?)"; private static final String DELETE_TODO_QUERY = "DELETE FROM TODO WHERE ID=?";
HsqlDatabase db = new HsqlDatabase();
in28minutes/SpringIn28Minutes
4.SpringJDBC/src/main/java/com/in28minutes/jdbc/data/service/TodoDataService.java
// Path: 4.SpringJDBC/src/main/java/com/in28minutes/jdbc/hsql/HsqlDatabase.java // public class HsqlDatabase { // public Connection conn; // // // Connecting to database => // // Executing Query // public HsqlDatabase() { // try { // loadJdbcDriverForHsqlDb(); // setupConnection(); // } catch (ClassNotFoundException e) { // e.printStackTrace(); // } catch (SQLException e) { // e.printStackTrace(); // } // // } // // private void setupConnection() throws SQLException { // conn = DriverManager.getConnection("jdbc:hsqldb:db_file", "sa", ""); // } // // private void loadJdbcDriverForHsqlDb() throws ClassNotFoundException { // Class.forName("org.hsqldb.jdbcDriver"); // } // // private void shutdownHsqlDatabase() throws SQLException { // Statement st = conn.createStatement(); // st.execute("SHUTDOWN"); // } // // public void closeConnection() throws SQLException { // shutdownHsqlDatabase(); // conn.close(); // if there are no other open connection // } // } // // Path: 4.SpringJDBC/src/main/java/com/in28minutes/jdbc/model/Todo.java // public class Todo { // // private int id; // private String description; // private boolean isDone; // // public Todo() { // super(); // } // // public Todo(int id, String description, boolean isDone) { // super(); // this.id = id; // this.description = description; // this.isDone = isDone; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return "Todo [id=" + id + ", description=" + description + ", isDone=" // + isDone + "]"; // } // // }
import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import com.in28minutes.jdbc.hsql.HsqlDatabase; import com.in28minutes.jdbc.model.Todo;
package com.in28minutes.jdbc.data.service; public class TodoDataService { private static final String INSERT_TODO_QUERY = "INSERT INTO TODO(DESCRIPTION,IS_DONE) VALUES(?, ?)"; private static final String DELETE_TODO_QUERY = "DELETE FROM TODO WHERE ID=?"; HsqlDatabase db = new HsqlDatabase(); public static Logger logger = LogManager.getLogger(TodoDataService.class);
// Path: 4.SpringJDBC/src/main/java/com/in28minutes/jdbc/hsql/HsqlDatabase.java // public class HsqlDatabase { // public Connection conn; // // // Connecting to database => // // Executing Query // public HsqlDatabase() { // try { // loadJdbcDriverForHsqlDb(); // setupConnection(); // } catch (ClassNotFoundException e) { // e.printStackTrace(); // } catch (SQLException e) { // e.printStackTrace(); // } // // } // // private void setupConnection() throws SQLException { // conn = DriverManager.getConnection("jdbc:hsqldb:db_file", "sa", ""); // } // // private void loadJdbcDriverForHsqlDb() throws ClassNotFoundException { // Class.forName("org.hsqldb.jdbcDriver"); // } // // private void shutdownHsqlDatabase() throws SQLException { // Statement st = conn.createStatement(); // st.execute("SHUTDOWN"); // } // // public void closeConnection() throws SQLException { // shutdownHsqlDatabase(); // conn.close(); // if there are no other open connection // } // } // // Path: 4.SpringJDBC/src/main/java/com/in28minutes/jdbc/model/Todo.java // public class Todo { // // private int id; // private String description; // private boolean isDone; // // public Todo() { // super(); // } // // public Todo(int id, String description, boolean isDone) { // super(); // this.id = id; // this.description = description; // this.isDone = isDone; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return "Todo [id=" + id + ", description=" + description + ", isDone=" // + isDone + "]"; // } // // } // Path: 4.SpringJDBC/src/main/java/com/in28minutes/jdbc/data/service/TodoDataService.java import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import com.in28minutes.jdbc.hsql.HsqlDatabase; import com.in28minutes.jdbc.model.Todo; package com.in28minutes.jdbc.data.service; public class TodoDataService { private static final String INSERT_TODO_QUERY = "INSERT INTO TODO(DESCRIPTION,IS_DONE) VALUES(?, ?)"; private static final String DELETE_TODO_QUERY = "DELETE FROM TODO WHERE ID=?"; HsqlDatabase db = new HsqlDatabase(); public static Logger logger = LogManager.getLogger(TodoDataService.class);
public void insertTodos(List<Todo> todos) {
in28minutes/SpringIn28Minutes
6.ExamplesToUnderstandMore/src/test/java/com/in28minutes/spring/example1/TodoBusinessTest.java
// Path: 6.ExamplesToUnderstandMore/src/main/java/com/in28minutes/spring/example1/businessservice/TodoBusinessService.java // @Component // public class TodoBusinessService { // // @Autowired // TodoDataService dataService;// = new TodoDataServiceStub() // // public List<String> retrieveTodosRelatedToSpring(String user) { // List<String> todosRelatedToSpring = new ArrayList<String>(); // // List<String> todos = dataService.retrieveTodos(user); // // for (String todo : todos) { // if (todo.contains("Spring")) { // todosRelatedToSpring.add(todo); // } // } // return todosRelatedToSpring; // } // // }
import static org.junit.Assert.assertEquals; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.in28minutes.spring.example1.businessservice.TodoBusinessService;
package com.in28minutes.spring.example1; @Configuration @ComponentScan(basePackages = { "com.in28minutes.spring.example1.businessservice", "com.in28minutes.spring.example1.dataservice.stub" }) class SpringContext { } @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = SpringContext.class) public class TodoBusinessTest { @Autowired
// Path: 6.ExamplesToUnderstandMore/src/main/java/com/in28minutes/spring/example1/businessservice/TodoBusinessService.java // @Component // public class TodoBusinessService { // // @Autowired // TodoDataService dataService;// = new TodoDataServiceStub() // // public List<String> retrieveTodosRelatedToSpring(String user) { // List<String> todosRelatedToSpring = new ArrayList<String>(); // // List<String> todos = dataService.retrieveTodos(user); // // for (String todo : todos) { // if (todo.contains("Spring")) { // todosRelatedToSpring.add(todo); // } // } // return todosRelatedToSpring; // } // // } // Path: 6.ExamplesToUnderstandMore/src/test/java/com/in28minutes/spring/example1/TodoBusinessTest.java import static org.junit.Assert.assertEquals; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.in28minutes.spring.example1.businessservice.TodoBusinessService; package com.in28minutes.spring.example1; @Configuration @ComponentScan(basePackages = { "com.in28minutes.spring.example1.businessservice", "com.in28minutes.spring.example1.dataservice.stub" }) class SpringContext { } @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = SpringContext.class) public class TodoBusinessTest { @Autowired
TodoBusinessService businessService;
in28minutes/SpringIn28Minutes
2.RealWorldExample/business/impl/src/test/java/com/in28minutes/example/layering/business/TodoBusinessServiceXmlStubTest.java
// Path: 2.RealWorldExample/business/api/src/main/java/com/in28minutes/example/layering/business/api/TodoBusinessService.java // public interface TodoBusinessService { // List<Todo> retrieveTodosRelatedToSpring(String user); // } // // Path: 2.RealWorldExample/model/src/main/java/com/in28minutes/example/layering/model/api/client/Todo.java // public class Todo { // // private String desc; // private Date date; // private boolean isDone; // // public Todo(String desc, Date date, boolean isDone) { // super(); // this.desc = desc; // this.date = date; // this.isDone = isDone; // } // // public String getDesc() { // return desc; // } // // public void setDesc(String desc) { // this.desc = desc; // } // // public Date getDate() { // return date; // } // // public void setDate(Date date) { // this.date = date; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return String.format("Todo [desc=%s, date=%s, isDone=%s]", desc, date, // isDone); // } // // }
import static org.junit.Assert.assertEquals; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.in28minutes.example.layering.business.api.TodoBusinessService; import com.in28minutes.example.layering.model.api.client.Todo;
package com.in28minutes.example.layering.business; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "/BusinessApplicationContext.xml" }) public class TodoBusinessServiceXmlStubTest { @Autowired
// Path: 2.RealWorldExample/business/api/src/main/java/com/in28minutes/example/layering/business/api/TodoBusinessService.java // public interface TodoBusinessService { // List<Todo> retrieveTodosRelatedToSpring(String user); // } // // Path: 2.RealWorldExample/model/src/main/java/com/in28minutes/example/layering/model/api/client/Todo.java // public class Todo { // // private String desc; // private Date date; // private boolean isDone; // // public Todo(String desc, Date date, boolean isDone) { // super(); // this.desc = desc; // this.date = date; // this.isDone = isDone; // } // // public String getDesc() { // return desc; // } // // public void setDesc(String desc) { // this.desc = desc; // } // // public Date getDate() { // return date; // } // // public void setDate(Date date) { // this.date = date; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return String.format("Todo [desc=%s, date=%s, isDone=%s]", desc, date, // isDone); // } // // } // Path: 2.RealWorldExample/business/impl/src/test/java/com/in28minutes/example/layering/business/TodoBusinessServiceXmlStubTest.java import static org.junit.Assert.assertEquals; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.in28minutes.example.layering.business.api.TodoBusinessService; import com.in28minutes.example.layering.model.api.client.Todo; package com.in28minutes.example.layering.business; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "/BusinessApplicationContext.xml" }) public class TodoBusinessServiceXmlStubTest { @Autowired
private TodoBusinessService todoBusinessService;
in28minutes/SpringIn28Minutes
2.RealWorldExample/business/impl/src/test/java/com/in28minutes/example/layering/business/TodoBusinessServiceXmlStubTest.java
// Path: 2.RealWorldExample/business/api/src/main/java/com/in28minutes/example/layering/business/api/TodoBusinessService.java // public interface TodoBusinessService { // List<Todo> retrieveTodosRelatedToSpring(String user); // } // // Path: 2.RealWorldExample/model/src/main/java/com/in28minutes/example/layering/model/api/client/Todo.java // public class Todo { // // private String desc; // private Date date; // private boolean isDone; // // public Todo(String desc, Date date, boolean isDone) { // super(); // this.desc = desc; // this.date = date; // this.isDone = isDone; // } // // public String getDesc() { // return desc; // } // // public void setDesc(String desc) { // this.desc = desc; // } // // public Date getDate() { // return date; // } // // public void setDate(Date date) { // this.date = date; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return String.format("Todo [desc=%s, date=%s, isDone=%s]", desc, date, // isDone); // } // // }
import static org.junit.Assert.assertEquals; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.in28minutes.example.layering.business.api.TodoBusinessService; import com.in28minutes.example.layering.model.api.client.Todo;
package com.in28minutes.example.layering.business; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "/BusinessApplicationContext.xml" }) public class TodoBusinessServiceXmlStubTest { @Autowired private TodoBusinessService todoBusinessService; @Test public void testClientProductSum() {
// Path: 2.RealWorldExample/business/api/src/main/java/com/in28minutes/example/layering/business/api/TodoBusinessService.java // public interface TodoBusinessService { // List<Todo> retrieveTodosRelatedToSpring(String user); // } // // Path: 2.RealWorldExample/model/src/main/java/com/in28minutes/example/layering/model/api/client/Todo.java // public class Todo { // // private String desc; // private Date date; // private boolean isDone; // // public Todo(String desc, Date date, boolean isDone) { // super(); // this.desc = desc; // this.date = date; // this.isDone = isDone; // } // // public String getDesc() { // return desc; // } // // public void setDesc(String desc) { // this.desc = desc; // } // // public Date getDate() { // return date; // } // // public void setDate(Date date) { // this.date = date; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return String.format("Todo [desc=%s, date=%s, isDone=%s]", desc, date, // isDone); // } // // } // Path: 2.RealWorldExample/business/impl/src/test/java/com/in28minutes/example/layering/business/TodoBusinessServiceXmlStubTest.java import static org.junit.Assert.assertEquals; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.in28minutes.example.layering.business.api.TodoBusinessService; import com.in28minutes.example.layering.model.api.client.Todo; package com.in28minutes.example.layering.business; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "/BusinessApplicationContext.xml" }) public class TodoBusinessServiceXmlStubTest { @Autowired private TodoBusinessService todoBusinessService; @Test public void testClientProductSum() {
List<Todo> todos = todoBusinessService
in28minutes/SpringIn28Minutes
7.SpringMvc/in28minutes-services-springmvc/src/main/java/com/in28minutes/springmvc/services/web/controller/AddressBookController.java
// Path: 7.SpringMvc/in28minutes-services-springmvc/src/main/java/com/in28minutes/springmvc/services/web/model/AddressBook.java // public class AddressBook { // // private long id; // private String firstName; // private String lastName; // private String phone; // private String email; // // public long getId() { // return id; // } // // public void setId(long id) { // this.id = id; // } // // public String getFirstName() { // return firstName; // } // // public void setFirstName(String firstName) { // this.firstName = firstName; // } // // public String getLastName() { // return lastName; // } // // public void setLastName(String lastName) { // this.lastName = lastName; // } // // public String getPhone() { // return phone; // } // // public void setPhone(String phone) { // this.phone = phone; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // } // // Path: 7.SpringMvc/in28minutes-services-springmvc/src/main/java/com/in28minutes/springmvc/services/web/service/api/AddressBookService.java // public interface AddressBookService { // List<AddressBook> viewAllAddressBook(); // // void createAddressBook(AddressBook addressBook); // // void updateAddressBook(int pos, AddressBook updateAddressBook); // // void deleteAddressBook(int id); // // void deleteAllAddressBook(); // // AddressBook findAddressBook(int id); // }
import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.in28minutes.springmvc.services.web.model.AddressBook; import com.in28minutes.springmvc.services.web.service.api.AddressBookService;
package com.in28minutes.springmvc.services.web.controller; @Controller @RequestMapping("/address") public class AddressBookController { @Autowired
// Path: 7.SpringMvc/in28minutes-services-springmvc/src/main/java/com/in28minutes/springmvc/services/web/model/AddressBook.java // public class AddressBook { // // private long id; // private String firstName; // private String lastName; // private String phone; // private String email; // // public long getId() { // return id; // } // // public void setId(long id) { // this.id = id; // } // // public String getFirstName() { // return firstName; // } // // public void setFirstName(String firstName) { // this.firstName = firstName; // } // // public String getLastName() { // return lastName; // } // // public void setLastName(String lastName) { // this.lastName = lastName; // } // // public String getPhone() { // return phone; // } // // public void setPhone(String phone) { // this.phone = phone; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // } // // Path: 7.SpringMvc/in28minutes-services-springmvc/src/main/java/com/in28minutes/springmvc/services/web/service/api/AddressBookService.java // public interface AddressBookService { // List<AddressBook> viewAllAddressBook(); // // void createAddressBook(AddressBook addressBook); // // void updateAddressBook(int pos, AddressBook updateAddressBook); // // void deleteAddressBook(int id); // // void deleteAllAddressBook(); // // AddressBook findAddressBook(int id); // } // Path: 7.SpringMvc/in28minutes-services-springmvc/src/main/java/com/in28minutes/springmvc/services/web/controller/AddressBookController.java import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.in28minutes.springmvc.services.web.model.AddressBook; import com.in28minutes.springmvc.services.web.service.api.AddressBookService; package com.in28minutes.springmvc.services.web.controller; @Controller @RequestMapping("/address") public class AddressBookController { @Autowired
AddressBookService addressBookService;
in28minutes/SpringIn28Minutes
7.SpringMvc/in28minutes-services-springmvc/src/main/java/com/in28minutes/springmvc/services/web/controller/AddressBookController.java
// Path: 7.SpringMvc/in28minutes-services-springmvc/src/main/java/com/in28minutes/springmvc/services/web/model/AddressBook.java // public class AddressBook { // // private long id; // private String firstName; // private String lastName; // private String phone; // private String email; // // public long getId() { // return id; // } // // public void setId(long id) { // this.id = id; // } // // public String getFirstName() { // return firstName; // } // // public void setFirstName(String firstName) { // this.firstName = firstName; // } // // public String getLastName() { // return lastName; // } // // public void setLastName(String lastName) { // this.lastName = lastName; // } // // public String getPhone() { // return phone; // } // // public void setPhone(String phone) { // this.phone = phone; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // } // // Path: 7.SpringMvc/in28minutes-services-springmvc/src/main/java/com/in28minutes/springmvc/services/web/service/api/AddressBookService.java // public interface AddressBookService { // List<AddressBook> viewAllAddressBook(); // // void createAddressBook(AddressBook addressBook); // // void updateAddressBook(int pos, AddressBook updateAddressBook); // // void deleteAddressBook(int id); // // void deleteAllAddressBook(); // // AddressBook findAddressBook(int id); // }
import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.in28minutes.springmvc.services.web.model.AddressBook; import com.in28minutes.springmvc.services.web.service.api.AddressBookService;
package com.in28minutes.springmvc.services.web.controller; @Controller @RequestMapping("/address") public class AddressBookController { @Autowired AddressBookService addressBookService; @RequestMapping(value = "/all.json", method = RequestMethod.GET)
// Path: 7.SpringMvc/in28minutes-services-springmvc/src/main/java/com/in28minutes/springmvc/services/web/model/AddressBook.java // public class AddressBook { // // private long id; // private String firstName; // private String lastName; // private String phone; // private String email; // // public long getId() { // return id; // } // // public void setId(long id) { // this.id = id; // } // // public String getFirstName() { // return firstName; // } // // public void setFirstName(String firstName) { // this.firstName = firstName; // } // // public String getLastName() { // return lastName; // } // // public void setLastName(String lastName) { // this.lastName = lastName; // } // // public String getPhone() { // return phone; // } // // public void setPhone(String phone) { // this.phone = phone; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // } // // Path: 7.SpringMvc/in28minutes-services-springmvc/src/main/java/com/in28minutes/springmvc/services/web/service/api/AddressBookService.java // public interface AddressBookService { // List<AddressBook> viewAllAddressBook(); // // void createAddressBook(AddressBook addressBook); // // void updateAddressBook(int pos, AddressBook updateAddressBook); // // void deleteAddressBook(int id); // // void deleteAllAddressBook(); // // AddressBook findAddressBook(int id); // } // Path: 7.SpringMvc/in28minutes-services-springmvc/src/main/java/com/in28minutes/springmvc/services/web/controller/AddressBookController.java import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.in28minutes.springmvc.services.web.model.AddressBook; import com.in28minutes.springmvc.services.web.service.api.AddressBookService; package com.in28minutes.springmvc.services.web.controller; @Controller @RequestMapping("/address") public class AddressBookController { @Autowired AddressBookService addressBookService; @RequestMapping(value = "/all.json", method = RequestMethod.GET)
public @ResponseBody List<AddressBook> viewAllAddressBook() {
in28minutes/SpringIn28Minutes
7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/controller/TodoController.java
// Path: 7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/util/SessionData.java // public class SessionData implements Serializable { // // public SessionData() { // super(); // } // // private User user; // // private Locale locale; // // public User getUser() { // return user; // } // // public void setUser(User user) { // this.user = user; // } // // public Locale getLocale() { // return locale; // } // // public void setLocale(Locale locale) { // this.locale = locale; // } // } // // Path: 7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/util/TodoPriorityPropertyEditor.java // public class TodoPriorityPropertyEditor extends PropertyEditorSupport { // // @Override // public String getAsText() { // Priority value = (Priority) getValue(); // return value.toString(); // } // // @Override // public void setAsText(String text) throws IllegalArgumentException { // setValue(Priority.valueOf(text)); // } // }
import java.text.SimpleDateFormat; import java.util.Date; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.context.MessageSource; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import com.in28minutes.domain.Priority; import com.in28minutes.domain.TodoItem; import com.in28minutes.domain.TodoItemList; import com.in28minutes.domain.User; import com.in28minutes.service.api.TodoService; import com.in28minutes.springmvc.web.util.SessionData; import com.in28minutes.springmvc.web.util.TodoPriorityPropertyEditor; import com.in28minutes.web.common.util.TodoListUtils;
package com.in28minutes.springmvc.web.controller; @Controller public class TodoController extends AbstractController { private final Logger LOGGER = LoggerFactory.getLogger(this.getClass() .getName()); @Autowired
// Path: 7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/util/SessionData.java // public class SessionData implements Serializable { // // public SessionData() { // super(); // } // // private User user; // // private Locale locale; // // public User getUser() { // return user; // } // // public void setUser(User user) { // this.user = user; // } // // public Locale getLocale() { // return locale; // } // // public void setLocale(Locale locale) { // this.locale = locale; // } // } // // Path: 7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/util/TodoPriorityPropertyEditor.java // public class TodoPriorityPropertyEditor extends PropertyEditorSupport { // // @Override // public String getAsText() { // Priority value = (Priority) getValue(); // return value.toString(); // } // // @Override // public void setAsText(String text) throws IllegalArgumentException { // setValue(Priority.valueOf(text)); // } // } // Path: 7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/controller/TodoController.java import java.text.SimpleDateFormat; import java.util.Date; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.context.MessageSource; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import com.in28minutes.domain.Priority; import com.in28minutes.domain.TodoItem; import com.in28minutes.domain.TodoItemList; import com.in28minutes.domain.User; import com.in28minutes.service.api.TodoService; import com.in28minutes.springmvc.web.util.SessionData; import com.in28minutes.springmvc.web.util.TodoPriorityPropertyEditor; import com.in28minutes.web.common.util.TodoListUtils; package com.in28minutes.springmvc.web.controller; @Controller public class TodoController extends AbstractController { private final Logger LOGGER = LoggerFactory.getLogger(this.getClass() .getName()); @Autowired
private SessionData sessionData;
in28minutes/SpringIn28Minutes
7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/controller/TodoController.java
// Path: 7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/util/SessionData.java // public class SessionData implements Serializable { // // public SessionData() { // super(); // } // // private User user; // // private Locale locale; // // public User getUser() { // return user; // } // // public void setUser(User user) { // this.user = user; // } // // public Locale getLocale() { // return locale; // } // // public void setLocale(Locale locale) { // this.locale = locale; // } // } // // Path: 7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/util/TodoPriorityPropertyEditor.java // public class TodoPriorityPropertyEditor extends PropertyEditorSupport { // // @Override // public String getAsText() { // Priority value = (Priority) getValue(); // return value.toString(); // } // // @Override // public void setAsText(String text) throws IllegalArgumentException { // setValue(Priority.valueOf(text)); // } // }
import java.text.SimpleDateFormat; import java.util.Date; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.context.MessageSource; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import com.in28minutes.domain.Priority; import com.in28minutes.domain.TodoItem; import com.in28minutes.domain.TodoItemList; import com.in28minutes.domain.User; import com.in28minutes.service.api.TodoService; import com.in28minutes.springmvc.web.util.SessionData; import com.in28minutes.springmvc.web.util.TodoPriorityPropertyEditor; import com.in28minutes.web.common.util.TodoListUtils;
package com.in28minutes.springmvc.web.controller; @Controller public class TodoController extends AbstractController { private final Logger LOGGER = LoggerFactory.getLogger(this.getClass() .getName()); @Autowired private SessionData sessionData; @Autowired private MessageSource messageSource; @Autowired private TodoService todoService; @InitBinder public void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat( TodoListUtils.DATE_FORMAT); binder.registerCustomEditor(Date.class, new CustomDateEditor( dateFormat, false)); binder.registerCustomEditor(Priority.class,
// Path: 7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/util/SessionData.java // public class SessionData implements Serializable { // // public SessionData() { // super(); // } // // private User user; // // private Locale locale; // // public User getUser() { // return user; // } // // public void setUser(User user) { // this.user = user; // } // // public Locale getLocale() { // return locale; // } // // public void setLocale(Locale locale) { // this.locale = locale; // } // } // // Path: 7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/util/TodoPriorityPropertyEditor.java // public class TodoPriorityPropertyEditor extends PropertyEditorSupport { // // @Override // public String getAsText() { // Priority value = (Priority) getValue(); // return value.toString(); // } // // @Override // public void setAsText(String text) throws IllegalArgumentException { // setValue(Priority.valueOf(text)); // } // } // Path: 7.SpringMvc/in28minutes-web-springmvc/src/main/java/com/in28minutes/springmvc/web/controller/TodoController.java import java.text.SimpleDateFormat; import java.util.Date; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.propertyeditors.CustomDateEditor; import org.springframework.context.MessageSource; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import com.in28minutes.domain.Priority; import com.in28minutes.domain.TodoItem; import com.in28minutes.domain.TodoItemList; import com.in28minutes.domain.User; import com.in28minutes.service.api.TodoService; import com.in28minutes.springmvc.web.util.SessionData; import com.in28minutes.springmvc.web.util.TodoPriorityPropertyEditor; import com.in28minutes.web.common.util.TodoListUtils; package com.in28minutes.springmvc.web.controller; @Controller public class TodoController extends AbstractController { private final Logger LOGGER = LoggerFactory.getLogger(this.getClass() .getName()); @Autowired private SessionData sessionData; @Autowired private MessageSource messageSource; @Autowired private TodoService todoService; @InitBinder public void initBinder(WebDataBinder binder) { SimpleDateFormat dateFormat = new SimpleDateFormat( TodoListUtils.DATE_FORMAT); binder.registerCustomEditor(Date.class, new CustomDateEditor( dateFormat, false)); binder.registerCustomEditor(Priority.class,
new TodoPriorityPropertyEditor());
in28minutes/SpringIn28Minutes
2.RealWorldExample/business/impl/src/test/java/com/in28minutes/example/layering/data/stub/TodoDataServiceStub.java
// Path: 2.RealWorldExample/data/api/src/main/java/com/in28minutes/example/layering/data/api/TodoDataService.java // public interface TodoDataService { // List<Todo> retrieveTodos(String userName); // } // // Path: 2.RealWorldExample/model/src/main/java/com/in28minutes/example/layering/model/api/client/Todo.java // public class Todo { // // private String desc; // private Date date; // private boolean isDone; // // public Todo(String desc, Date date, boolean isDone) { // super(); // this.desc = desc; // this.date = date; // this.isDone = isDone; // } // // public String getDesc() { // return desc; // } // // public void setDesc(String desc) { // this.desc = desc; // } // // public Date getDate() { // return date; // } // // public void setDate(Date date) { // this.date = date; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return String.format("Todo [desc=%s, date=%s, isDone=%s]", desc, date, // isDone); // } // // }
import java.util.Arrays; import java.util.Date; import java.util.List; import org.springframework.stereotype.Component; import com.in28minutes.example.layering.data.api.TodoDataService; import com.in28minutes.example.layering.model.api.client.Todo;
package com.in28minutes.example.layering.data.stub; @Component public class TodoDataServiceStub implements TodoDataService { @Override
// Path: 2.RealWorldExample/data/api/src/main/java/com/in28minutes/example/layering/data/api/TodoDataService.java // public interface TodoDataService { // List<Todo> retrieveTodos(String userName); // } // // Path: 2.RealWorldExample/model/src/main/java/com/in28minutes/example/layering/model/api/client/Todo.java // public class Todo { // // private String desc; // private Date date; // private boolean isDone; // // public Todo(String desc, Date date, boolean isDone) { // super(); // this.desc = desc; // this.date = date; // this.isDone = isDone; // } // // public String getDesc() { // return desc; // } // // public void setDesc(String desc) { // this.desc = desc; // } // // public Date getDate() { // return date; // } // // public void setDate(Date date) { // this.date = date; // } // // public boolean isDone() { // return isDone; // } // // public void setDone(boolean isDone) { // this.isDone = isDone; // } // // @Override // public String toString() { // return String.format("Todo [desc=%s, date=%s, isDone=%s]", desc, date, // isDone); // } // // } // Path: 2.RealWorldExample/business/impl/src/test/java/com/in28minutes/example/layering/data/stub/TodoDataServiceStub.java import java.util.Arrays; import java.util.Date; import java.util.List; import org.springframework.stereotype.Component; import com.in28minutes.example.layering.data.api.TodoDataService; import com.in28minutes.example.layering.model.api.client.Todo; package com.in28minutes.example.layering.data.stub; @Component public class TodoDataServiceStub implements TodoDataService { @Override
public List<Todo> retrieveTodos(String userName) {
ChristopherMann/2FactorWallet
desktop_wallet/src/main/java/de/uni_bonn/bit/PairingDialog.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/IPairingProtocol.java // public interface IPairingProtocol { // // public PairingMessage pair(PairingMessage pairingMessage); // }
import com.google.zxing.WriterException; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import com.intellij.uiDesigner.core.Spacer; import de.uni_bonn.bit.wallet_protocol.IPairingProtocol; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.IOException; import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException;
/* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This dialog is displayed when executing the pairing protocol to pair the desktop wallet with a phone wallet. In the * beginning, it displays a QR code which can be scanned with the */ public class PairingDialog extends JDialog { private JPanel contentPane; private JButton buttonOK; private JTextPane infoTextPane; private JLabel qrCodeLabel; private KeyShareWalletExtension walletExtension; private Result result = Result.FAIL; private ProtocolServer server;
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/IPairingProtocol.java // public interface IPairingProtocol { // // public PairingMessage pair(PairingMessage pairingMessage); // } // Path: desktop_wallet/src/main/java/de/uni_bonn/bit/PairingDialog.java import com.google.zxing.WriterException; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import com.intellij.uiDesigner.core.Spacer; import de.uni_bonn.bit.wallet_protocol.IPairingProtocol; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.IOException; import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException; /* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This dialog is displayed when executing the pairing protocol to pair the desktop wallet with a phone wallet. In the * beginning, it displays a QR code which can be scanned with the */ public class PairingDialog extends JDialog { private JPanel contentPane; private JButton buttonOK; private JTextPane infoTextPane; private JLabel qrCodeLabel; private KeyShareWalletExtension walletExtension; private Result result = Result.FAIL; private ProtocolServer server;
private IPairingProtocol pairingProtocolImpl;
ChristopherMann/2FactorWallet
wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/ZKProofInit.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/ProtocolException.java // public class ProtocolException extends RuntimeException { // // public ProtocolException(String message) { // super(message); // } // }
import de.uni_bonn.bit.BCParameters; import de.uni_bonn.bit.ProtocolException; import org.apache.avro.reflect.Stringable; import org.spongycastle.pqc.math.ntru.euclid.BigIntEuclidean; import java.math.BigInteger;
/* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit.wallet_protocol; public class ZKProofInit { @Stringable private BigInteger gRoot; @Stringable private BigInteger hRoot; /** * Generates a zero-knowledge proof which proves that bcParameters.g and bcParameters.h are quadratic residues, * which is implies that they are part of the same cyclic sub group. * @param bcParameters * @param id An id which identifies the proof instance. The result should depend on the proof it is used for to * prevent replay attacks. * @return */ public static ZKProofInit generate(BCParameters bcParameters, String id){ ZKProofInit result = new ZKProofInit(); result.gRoot = squareRoot(bcParameters.getH(), bcParameters.getP(), bcParameters.getQ()); result.hRoot = squareRoot(bcParameters.getG(), bcParameters.getP(), bcParameters.getQ()); return result; } /** * Verifies this zk proof for the given bcParameters. * @param bcParameters * @param id */ public void verify(BCParameters bcParameters, String id){ BigInteger gRootSquared = gRoot.pow(2).mod(bcParameters.getN()); BigInteger hRootSquared = hRoot.pow(2).mod(bcParameters.getN()); if(! bcParameters.getH().equals(gRootSquared) || ! bcParameters.getG().equals(hRootSquared)){
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/ProtocolException.java // public class ProtocolException extends RuntimeException { // // public ProtocolException(String message) { // super(message); // } // } // Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/ZKProofInit.java import de.uni_bonn.bit.BCParameters; import de.uni_bonn.bit.ProtocolException; import org.apache.avro.reflect.Stringable; import org.spongycastle.pqc.math.ntru.euclid.BigIntEuclidean; import java.math.BigInteger; /* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit.wallet_protocol; public class ZKProofInit { @Stringable private BigInteger gRoot; @Stringable private BigInteger hRoot; /** * Generates a zero-knowledge proof which proves that bcParameters.g and bcParameters.h are quadratic residues, * which is implies that they are part of the same cyclic sub group. * @param bcParameters * @param id An id which identifies the proof instance. The result should depend on the proof it is used for to * prevent replay attacks. * @return */ public static ZKProofInit generate(BCParameters bcParameters, String id){ ZKProofInit result = new ZKProofInit(); result.gRoot = squareRoot(bcParameters.getH(), bcParameters.getP(), bcParameters.getQ()); result.hRoot = squareRoot(bcParameters.getG(), bcParameters.getP(), bcParameters.getQ()); return result; } /** * Verifies this zk proof for the given bcParameters. * @param bcParameters * @param id */ public void verify(BCParameters bcParameters, String id){ BigInteger gRootSquared = gRoot.pow(2).mod(bcParameters.getN()); BigInteger hRootSquared = hRoot.pow(2).mod(bcParameters.getN()); if(! bcParameters.getH().equals(gRootSquared) || ! bcParameters.getG().equals(hRootSquared)){
throw new ProtocolException("Verification of ZKProof init with id " + id + " failed.");
ChristopherMann/2FactorWallet
wallet_lib/src/test/java/de/uni_bonn/bit/ProtocolAttackTest.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/EncryptedSignatureWithProof.java // public class EncryptedSignatureWithProof { // // @Stringable // private BigInteger sigma; // @Stringable // private BigInteger alphaPhone; // private ZKProofPhone proof; // // public EncryptedSignatureWithProof(){} // // public EncryptedSignatureWithProof(BigInteger sigma, BigInteger alphaPhone, ZKProofPhone proof) { // this.sigma = sigma; // this.alphaPhone = alphaPhone; // this.proof = proof; // } // // public BigInteger getSigma() { // return sigma; // } // // public BigInteger getAlphaPhone() { // return alphaPhone; // } // // public ZKProofPhone getProof() { // return proof; // } // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/EphemeralPublicValueWithProof.java // public class EphemeralPublicValueWithProof { // private byte[] R; // private ZKProofDesktop proof; // // private EphemeralPublicValueWithProof(){ } // // public EphemeralPublicValueWithProof(ECPoint R, ZKProofDesktop proof) { // this.R = R.getEncoded(true); // this.proof = proof; // } // // public ECPoint getR() { // return ECKey.CURVE.getCurve().decodePoint(this.R); // } // // public ZKProofDesktop getProof() { // return proof; // } // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/EphemeralValueShare.java // public class EphemeralValueShare { // private byte[] RPhone; // // // private EphemeralValueShare(){ } // // public EphemeralValueShare(ECPoint RPhone){ // setRPhone(RPhone); // } // // public ECPoint getRPhone() { // return ECKey.CURVE.getCurve().decodePoint(this.RPhone); // } // // public void setRPhone(ECPoint RPhone) { // this.RPhone = RPhone.getEncoded(true); // } // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/SignatureParts.java // public class SignatureParts { // // @Stringable // BigInteger alphaDesktop; // @Stringable // BigInteger beta; // // public SignatureParts() {} // public SignatureParts(BigInteger alphaDesktop, BigInteger beta) { // this.alphaDesktop = alphaDesktop; // this.beta = beta; // } // // public BigInteger getAlphaDesktop() { // return alphaDesktop; // } // // public void setAlphaDesktop(BigInteger alphaDesktop) { // this.alphaDesktop = alphaDesktop; // } // // public BigInteger getBeta() { // return beta; // } // // public void setBeta(BigInteger beta) { // this.beta = beta; // } // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // }
import org.bitcoinj.core.ECKey; import org.bitcoinj.core.Sha256Hash; import com.google.common.collect.Lists; import com.google.common.math.DoubleMath; import de.uni_bonn.bit.wallet_protocol.EncryptedSignatureWithProof; import de.uni_bonn.bit.wallet_protocol.EphemeralPublicValueWithProof; import de.uni_bonn.bit.wallet_protocol.EphemeralValueShare; import de.uni_bonn.bit.wallet_protocol.SignatureParts; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.spongycastle.math.ec.ECPoint; import org.spongycastle.pqc.math.linearalgebra.IntegerFunctions; import java.math.BigInteger; import java.util.List; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey;
/* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This class contains the implementations of two basic attacks on the two-party ECDSA signature protocol. The attacks * must not succeed if the protocol is correctly implemented. */ public class ProtocolAttackTest { ECKey desktopKeyShare = convertBigIntToPrivKey(new BigInteger("41")); ECKey phoneKeyShare = convertBigIntToPrivKey(new BigInteger("42")); ECKey commonPublicKey; BCParameters desktopBCParameters; BCParameters phoneBCParameters; @Before public void setUp() {
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/EncryptedSignatureWithProof.java // public class EncryptedSignatureWithProof { // // @Stringable // private BigInteger sigma; // @Stringable // private BigInteger alphaPhone; // private ZKProofPhone proof; // // public EncryptedSignatureWithProof(){} // // public EncryptedSignatureWithProof(BigInteger sigma, BigInteger alphaPhone, ZKProofPhone proof) { // this.sigma = sigma; // this.alphaPhone = alphaPhone; // this.proof = proof; // } // // public BigInteger getSigma() { // return sigma; // } // // public BigInteger getAlphaPhone() { // return alphaPhone; // } // // public ZKProofPhone getProof() { // return proof; // } // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/EphemeralPublicValueWithProof.java // public class EphemeralPublicValueWithProof { // private byte[] R; // private ZKProofDesktop proof; // // private EphemeralPublicValueWithProof(){ } // // public EphemeralPublicValueWithProof(ECPoint R, ZKProofDesktop proof) { // this.R = R.getEncoded(true); // this.proof = proof; // } // // public ECPoint getR() { // return ECKey.CURVE.getCurve().decodePoint(this.R); // } // // public ZKProofDesktop getProof() { // return proof; // } // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/EphemeralValueShare.java // public class EphemeralValueShare { // private byte[] RPhone; // // // private EphemeralValueShare(){ } // // public EphemeralValueShare(ECPoint RPhone){ // setRPhone(RPhone); // } // // public ECPoint getRPhone() { // return ECKey.CURVE.getCurve().decodePoint(this.RPhone); // } // // public void setRPhone(ECPoint RPhone) { // this.RPhone = RPhone.getEncoded(true); // } // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/SignatureParts.java // public class SignatureParts { // // @Stringable // BigInteger alphaDesktop; // @Stringable // BigInteger beta; // // public SignatureParts() {} // public SignatureParts(BigInteger alphaDesktop, BigInteger beta) { // this.alphaDesktop = alphaDesktop; // this.beta = beta; // } // // public BigInteger getAlphaDesktop() { // return alphaDesktop; // } // // public void setAlphaDesktop(BigInteger alphaDesktop) { // this.alphaDesktop = alphaDesktop; // } // // public BigInteger getBeta() { // return beta; // } // // public void setBeta(BigInteger beta) { // this.beta = beta; // } // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // } // Path: wallet_lib/src/test/java/de/uni_bonn/bit/ProtocolAttackTest.java import org.bitcoinj.core.ECKey; import org.bitcoinj.core.Sha256Hash; import com.google.common.collect.Lists; import com.google.common.math.DoubleMath; import de.uni_bonn.bit.wallet_protocol.EncryptedSignatureWithProof; import de.uni_bonn.bit.wallet_protocol.EphemeralPublicValueWithProof; import de.uni_bonn.bit.wallet_protocol.EphemeralValueShare; import de.uni_bonn.bit.wallet_protocol.SignatureParts; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.spongycastle.math.ec.ECPoint; import org.spongycastle.pqc.math.linearalgebra.IntegerFunctions; import java.math.BigInteger; import java.util.List; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey; /* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This class contains the implementations of two basic attacks on the two-party ECDSA signature protocol. The attacks * must not succeed if the protocol is correctly implemented. */ public class ProtocolAttackTest { ECKey desktopKeyShare = convertBigIntToPrivKey(new BigInteger("41")); ECKey phoneKeyShare = convertBigIntToPrivKey(new BigInteger("42")); ECKey commonPublicKey; BCParameters desktopBCParameters; BCParameters phoneBCParameters; @Before public void setUp() {
commonPublicKey = convertPointToPubKEy(
ChristopherMann/2FactorWallet
desktop_wallet/src/main/java/de/uni_bonn/bit/TransactionDialog.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/IWalletProtocol.java // public interface IWalletProtocol { // // public TransactionInfo fetchTransactionInfo(); // // public SignatureParts[] getSignatureParts(); // // public EphemeralPublicValueWithProof[] getEphemeralPublicValuesWithProof(EphemeralValueShare[] ephemeralValueShares); // // public boolean sendEncryptedSignatures(EncryptedSignatureWithProof[] encryptedSignatures); // }
import ca.odell.glazedlists.BasicEventList; import ca.odell.glazedlists.EventList; import ca.odell.glazedlists.swing.GlazedListsSwing; import org.bitcoinj.core.*; import org.bitcoinj.params.RegTestParams; import com.google.zxing.WriterException; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import com.intellij.uiDesigner.core.Spacer; import de.uni_bonn.bit.wallet_protocol.IWalletProtocol; import javax.swing.*; import javax.swing.text.DefaultFormatterFactory; import javax.swing.text.NumberFormatter; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.IOException; import java.net.UnknownHostException; import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException; import java.text.DecimalFormat; import java.util.List; import org.apache.log4j.Logger;
public void generateTransactionButton_Clicked(ActionEvent e) { try { //Close the old server, so the port is free again if (server != null) { server.close(); } KeyShareWalletExtension walletEx = ((KeyShareWalletExtension) wallet.addOrGetExistingExtension(new KeyShareWalletExtension())); Address receiverAddress = new Address(TransactionHelper.netParams, addressTextField.getText()); Double amountDouble = (Double) amountTextField.getValue(); Coin amount = Coin.valueOf(Math.round(amountDouble * 100000000)); Wallet.SendRequest sendRequest = Wallet.SendRequest.to(receiverAddress, amount); sendRequest.changeAddress = walletEx.getAddress(); sendRequest.missingSigsMode = Wallet.MissingSigsMode.USE_DUMMY_SIG; wallet.completeTx(sendRequest); tblOutputs.setModel(GlazedListsSwing.eventTableModel(createOutputsList(sendRequest.tx), new String[]{"address", "amount"}, new String[]{"Address", "BTC"}, new boolean[]{false, false})); //hack to ensure correct column sizes. Real columns sizes are proportions of the preferred width. tblOutputs.getColumnModel().getColumn(0).setPreferredWidth(800); tblOutputs.getColumnModel().getColumn(1).setPreferredWidth(200); tblOutputsPane.setVisible(true); List<String> ipAddresses = IPAddressHelper.getAllUsableIPAddresses(); WalletProtocolImpl walletProtocolImpl = new WalletProtocolImpl(sendRequest.tx, new MyWalletProtocolListener(), walletEx.getPrivateKey(), walletEx.getOtherPublicKey(), walletEx.getPkpDesktop(), walletEx.getPkpPhone(), walletEx.getDesktopBCParameters(), walletEx.getPhoneBCParameters());
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/IWalletProtocol.java // public interface IWalletProtocol { // // public TransactionInfo fetchTransactionInfo(); // // public SignatureParts[] getSignatureParts(); // // public EphemeralPublicValueWithProof[] getEphemeralPublicValuesWithProof(EphemeralValueShare[] ephemeralValueShares); // // public boolean sendEncryptedSignatures(EncryptedSignatureWithProof[] encryptedSignatures); // } // Path: desktop_wallet/src/main/java/de/uni_bonn/bit/TransactionDialog.java import ca.odell.glazedlists.BasicEventList; import ca.odell.glazedlists.EventList; import ca.odell.glazedlists.swing.GlazedListsSwing; import org.bitcoinj.core.*; import org.bitcoinj.params.RegTestParams; import com.google.zxing.WriterException; import com.intellij.uiDesigner.core.GridConstraints; import com.intellij.uiDesigner.core.GridLayoutManager; import com.intellij.uiDesigner.core.Spacer; import de.uni_bonn.bit.wallet_protocol.IWalletProtocol; import javax.swing.*; import javax.swing.text.DefaultFormatterFactory; import javax.swing.text.NumberFormatter; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.IOException; import java.net.UnknownHostException; import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException; import java.text.DecimalFormat; import java.util.List; import org.apache.log4j.Logger; public void generateTransactionButton_Clicked(ActionEvent e) { try { //Close the old server, so the port is free again if (server != null) { server.close(); } KeyShareWalletExtension walletEx = ((KeyShareWalletExtension) wallet.addOrGetExistingExtension(new KeyShareWalletExtension())); Address receiverAddress = new Address(TransactionHelper.netParams, addressTextField.getText()); Double amountDouble = (Double) amountTextField.getValue(); Coin amount = Coin.valueOf(Math.round(amountDouble * 100000000)); Wallet.SendRequest sendRequest = Wallet.SendRequest.to(receiverAddress, amount); sendRequest.changeAddress = walletEx.getAddress(); sendRequest.missingSigsMode = Wallet.MissingSigsMode.USE_DUMMY_SIG; wallet.completeTx(sendRequest); tblOutputs.setModel(GlazedListsSwing.eventTableModel(createOutputsList(sendRequest.tx), new String[]{"address", "amount"}, new String[]{"Address", "BTC"}, new boolean[]{false, false})); //hack to ensure correct column sizes. Real columns sizes are proportions of the preferred width. tblOutputs.getColumnModel().getColumn(0).setPreferredWidth(800); tblOutputs.getColumnModel().getColumn(1).setPreferredWidth(200); tblOutputsPane.setVisible(true); List<String> ipAddresses = IPAddressHelper.getAllUsableIPAddresses(); WalletProtocolImpl walletProtocolImpl = new WalletProtocolImpl(sendRequest.tx, new MyWalletProtocolListener(), walletEx.getPrivateKey(), walletEx.getOtherPublicKey(), walletEx.getPkpDesktop(), walletEx.getPkpPhone(), walletEx.getDesktopBCParameters(), walletEx.getPhoneBCParameters());
server = new ProtocolServer(IWalletProtocol.class, walletProtocolImpl);
ChristopherMann/2FactorWallet
wallet_lib/src/test/java/de/uni_bonn/bit/ProtocolBaseTest.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // }
import org.bitcoinj.core.ECKey; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.math.BigInteger; import java.util.Collection; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey;
/* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * The base class for the protocol tests. This class only contains the setup for some parameters. */ @RunWith(Parameterized.class) @Ignore public class ProtocolBaseTest { @Parameterized.Parameters public static Collection<ECKey[]> data(){ BigInteger nEC = ECKey.CURVE.getN(); return Lists.newArrayList(
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // } // Path: wallet_lib/src/test/java/de/uni_bonn/bit/ProtocolBaseTest.java import org.bitcoinj.core.ECKey; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.math.BigInteger; import java.util.Collection; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey; /* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * The base class for the protocol tests. This class only contains the setup for some parameters. */ @RunWith(Parameterized.class) @Ignore public class ProtocolBaseTest { @Parameterized.Parameters public static Collection<ECKey[]> data(){ BigInteger nEC = ECKey.CURVE.getN(); return Lists.newArrayList(
new ECKey[]{ convertBigIntToPrivKey(new BigInteger("1")), convertBigIntToPrivKey(new BigInteger("2"))},
ChristopherMann/2FactorWallet
wallet_lib/src/test/java/de/uni_bonn/bit/ProtocolBaseTest.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // }
import org.bitcoinj.core.ECKey; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.math.BigInteger; import java.util.Collection; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey;
/* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * The base class for the protocol tests. This class only contains the setup for some parameters. */ @RunWith(Parameterized.class) @Ignore public class ProtocolBaseTest { @Parameterized.Parameters public static Collection<ECKey[]> data(){ BigInteger nEC = ECKey.CURVE.getN(); return Lists.newArrayList( new ECKey[]{ convertBigIntToPrivKey(new BigInteger("1")), convertBigIntToPrivKey(new BigInteger("2"))}, new ECKey[]{ convertBigIntToPrivKey(nEC.subtract(new BigInteger("1"))), convertBigIntToPrivKey(nEC.subtract(new BigInteger("2")))} ); } @Parameterized.Parameter(0) public ECKey desktopKeyShare; @Parameterized.Parameter(1) public ECKey phoneKeyShare; public ECKey commonPublicKey; /** * Hard coded BCParameters as the generation is very expensive!!! */ BCParameters desktopBCParameters; BCParameters phoneBCParameters; @Before public void setUp() throws Exception {
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // } // Path: wallet_lib/src/test/java/de/uni_bonn/bit/ProtocolBaseTest.java import org.bitcoinj.core.ECKey; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.math.BigInteger; import java.util.Collection; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey; /* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * The base class for the protocol tests. This class only contains the setup for some parameters. */ @RunWith(Parameterized.class) @Ignore public class ProtocolBaseTest { @Parameterized.Parameters public static Collection<ECKey[]> data(){ BigInteger nEC = ECKey.CURVE.getN(); return Lists.newArrayList( new ECKey[]{ convertBigIntToPrivKey(new BigInteger("1")), convertBigIntToPrivKey(new BigInteger("2"))}, new ECKey[]{ convertBigIntToPrivKey(nEC.subtract(new BigInteger("1"))), convertBigIntToPrivKey(nEC.subtract(new BigInteger("2")))} ); } @Parameterized.Parameter(0) public ECKey desktopKeyShare; @Parameterized.Parameter(1) public ECKey phoneKeyShare; public ECKey commonPublicKey; /** * Hard coded BCParameters as the generation is very expensive!!! */ BCParameters desktopBCParameters; BCParameters phoneBCParameters; @Before public void setUp() throws Exception {
commonPublicKey = convertPointToPubKEy(
ChristopherMann/2FactorWallet
wallet_lib/src/test/java/de/uni_bonn/bit/ProtocolBaseTest.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // }
import org.bitcoinj.core.ECKey; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.math.BigInteger; import java.util.Collection; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey;
/* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * The base class for the protocol tests. This class only contains the setup for some parameters. */ @RunWith(Parameterized.class) @Ignore public class ProtocolBaseTest { @Parameterized.Parameters public static Collection<ECKey[]> data(){ BigInteger nEC = ECKey.CURVE.getN(); return Lists.newArrayList( new ECKey[]{ convertBigIntToPrivKey(new BigInteger("1")), convertBigIntToPrivKey(new BigInteger("2"))}, new ECKey[]{ convertBigIntToPrivKey(nEC.subtract(new BigInteger("1"))), convertBigIntToPrivKey(nEC.subtract(new BigInteger("2")))} ); } @Parameterized.Parameter(0) public ECKey desktopKeyShare; @Parameterized.Parameter(1) public ECKey phoneKeyShare; public ECKey commonPublicKey; /** * Hard coded BCParameters as the generation is very expensive!!! */ BCParameters desktopBCParameters; BCParameters phoneBCParameters; @Before public void setUp() throws Exception { commonPublicKey = convertPointToPubKEy(
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // } // Path: wallet_lib/src/test/java/de/uni_bonn/bit/ProtocolBaseTest.java import org.bitcoinj.core.ECKey; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.math.BigInteger; import java.util.Collection; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey; /* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * The base class for the protocol tests. This class only contains the setup for some parameters. */ @RunWith(Parameterized.class) @Ignore public class ProtocolBaseTest { @Parameterized.Parameters public static Collection<ECKey[]> data(){ BigInteger nEC = ECKey.CURVE.getN(); return Lists.newArrayList( new ECKey[]{ convertBigIntToPrivKey(new BigInteger("1")), convertBigIntToPrivKey(new BigInteger("2"))}, new ECKey[]{ convertBigIntToPrivKey(nEC.subtract(new BigInteger("1"))), convertBigIntToPrivKey(nEC.subtract(new BigInteger("2")))} ); } @Parameterized.Parameter(0) public ECKey desktopKeyShare; @Parameterized.Parameter(1) public ECKey phoneKeyShare; public ECKey commonPublicKey; /** * Hard coded BCParameters as the generation is very expensive!!! */ BCParameters desktopBCParameters; BCParameters phoneBCParameters; @Before public void setUp() throws Exception { commonPublicKey = convertPointToPubKEy(
convertPubKeyToPoint(desktopKeyShare).multiply(convertPrivKeyToBigInt(phoneKeyShare)));
ChristopherMann/2FactorWallet
wallet_lib/src/test/java/de/uni_bonn/bit/ProtocolBaseTest.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // }
import org.bitcoinj.core.ECKey; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.math.BigInteger; import java.util.Collection; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey;
/* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * The base class for the protocol tests. This class only contains the setup for some parameters. */ @RunWith(Parameterized.class) @Ignore public class ProtocolBaseTest { @Parameterized.Parameters public static Collection<ECKey[]> data(){ BigInteger nEC = ECKey.CURVE.getN(); return Lists.newArrayList( new ECKey[]{ convertBigIntToPrivKey(new BigInteger("1")), convertBigIntToPrivKey(new BigInteger("2"))}, new ECKey[]{ convertBigIntToPrivKey(nEC.subtract(new BigInteger("1"))), convertBigIntToPrivKey(nEC.subtract(new BigInteger("2")))} ); } @Parameterized.Parameter(0) public ECKey desktopKeyShare; @Parameterized.Parameter(1) public ECKey phoneKeyShare; public ECKey commonPublicKey; /** * Hard coded BCParameters as the generation is very expensive!!! */ BCParameters desktopBCParameters; BCParameters phoneBCParameters; @Before public void setUp() throws Exception { commonPublicKey = convertPointToPubKEy(
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // } // Path: wallet_lib/src/test/java/de/uni_bonn/bit/ProtocolBaseTest.java import org.bitcoinj.core.ECKey; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.math.BigInteger; import java.util.Collection; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey; /* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * The base class for the protocol tests. This class only contains the setup for some parameters. */ @RunWith(Parameterized.class) @Ignore public class ProtocolBaseTest { @Parameterized.Parameters public static Collection<ECKey[]> data(){ BigInteger nEC = ECKey.CURVE.getN(); return Lists.newArrayList( new ECKey[]{ convertBigIntToPrivKey(new BigInteger("1")), convertBigIntToPrivKey(new BigInteger("2"))}, new ECKey[]{ convertBigIntToPrivKey(nEC.subtract(new BigInteger("1"))), convertBigIntToPrivKey(nEC.subtract(new BigInteger("2")))} ); } @Parameterized.Parameter(0) public ECKey desktopKeyShare; @Parameterized.Parameter(1) public ECKey phoneKeyShare; public ECKey commonPublicKey; /** * Hard coded BCParameters as the generation is very expensive!!! */ BCParameters desktopBCParameters; BCParameters phoneBCParameters; @Before public void setUp() throws Exception { commonPublicKey = convertPointToPubKEy(
convertPubKeyToPoint(desktopKeyShare).multiply(convertPrivKeyToBigInt(phoneKeyShare)));
ChristopherMann/2FactorWallet
wallet_lib/src/test/java/de/uni_bonn/bit/TransactionSignerBaseTest.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // }
import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey; import org.bitcoinj.core.AbstractBlockChain; import org.bitcoinj.core.Coin; import org.bitcoinj.core.ECKey; import org.bitcoinj.testing.TestWithWallet; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.math.BigInteger; import java.util.*; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt;
/* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This is the base class for the transaction signer tests. It uses the * {@link org.bitcoinj.testing.TestWithWallet} class from bitcoinj to setup test transactions. Additionally, * it performs the setup for several parameters. */ @RunWith(Parameterized.class) public class TransactionSignerBaseTest extends TestWithWallet { @Parameterized.Parameters public static Collection<ECKey[]> data(){ BigInteger nEC = ECKey.CURVE.getN(); return Lists.newArrayList( new ECKey[]{
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // } // Path: wallet_lib/src/test/java/de/uni_bonn/bit/TransactionSignerBaseTest.java import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey; import org.bitcoinj.core.AbstractBlockChain; import org.bitcoinj.core.Coin; import org.bitcoinj.core.ECKey; import org.bitcoinj.testing.TestWithWallet; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.math.BigInteger; import java.util.*; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt; /* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This is the base class for the transaction signer tests. It uses the * {@link org.bitcoinj.testing.TestWithWallet} class from bitcoinj to setup test transactions. Additionally, * it performs the setup for several parameters. */ @RunWith(Parameterized.class) public class TransactionSignerBaseTest extends TestWithWallet { @Parameterized.Parameters public static Collection<ECKey[]> data(){ BigInteger nEC = ECKey.CURVE.getN(); return Lists.newArrayList( new ECKey[]{
convertBigIntToPrivKey(new BigInteger("1")), convertBigIntToPrivKey(new BigInteger("2"))
ChristopherMann/2FactorWallet
wallet_lib/src/test/java/de/uni_bonn/bit/TransactionSignerBaseTest.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // }
import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey; import org.bitcoinj.core.AbstractBlockChain; import org.bitcoinj.core.Coin; import org.bitcoinj.core.ECKey; import org.bitcoinj.testing.TestWithWallet; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.math.BigInteger; import java.util.*; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt;
/* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This is the base class for the transaction signer tests. It uses the * {@link org.bitcoinj.testing.TestWithWallet} class from bitcoinj to setup test transactions. Additionally, * it performs the setup for several parameters. */ @RunWith(Parameterized.class) public class TransactionSignerBaseTest extends TestWithWallet { @Parameterized.Parameters public static Collection<ECKey[]> data(){ BigInteger nEC = ECKey.CURVE.getN(); return Lists.newArrayList( new ECKey[]{ convertBigIntToPrivKey(new BigInteger("1")), convertBigIntToPrivKey(new BigInteger("2")) }, new ECKey[]{ convertBigIntToPrivKey(nEC.subtract(new BigInteger("1"))), convertBigIntToPrivKey(nEC.subtract(new BigInteger("2"))) }); } @Parameterized.Parameter(0) public ECKey desktopKeyShare; @Parameterized.Parameter(1) public ECKey phoneKeyShare; public ECKey commonPublicKey; public BCParameters desktopBCParameters; public BCParameters phoneBCParameters; @Before public void setUp() throws Exception { super.setUp(); //setup key material
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // } // Path: wallet_lib/src/test/java/de/uni_bonn/bit/TransactionSignerBaseTest.java import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey; import org.bitcoinj.core.AbstractBlockChain; import org.bitcoinj.core.Coin; import org.bitcoinj.core.ECKey; import org.bitcoinj.testing.TestWithWallet; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.math.BigInteger; import java.util.*; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt; /* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This is the base class for the transaction signer tests. It uses the * {@link org.bitcoinj.testing.TestWithWallet} class from bitcoinj to setup test transactions. Additionally, * it performs the setup for several parameters. */ @RunWith(Parameterized.class) public class TransactionSignerBaseTest extends TestWithWallet { @Parameterized.Parameters public static Collection<ECKey[]> data(){ BigInteger nEC = ECKey.CURVE.getN(); return Lists.newArrayList( new ECKey[]{ convertBigIntToPrivKey(new BigInteger("1")), convertBigIntToPrivKey(new BigInteger("2")) }, new ECKey[]{ convertBigIntToPrivKey(nEC.subtract(new BigInteger("1"))), convertBigIntToPrivKey(nEC.subtract(new BigInteger("2"))) }); } @Parameterized.Parameter(0) public ECKey desktopKeyShare; @Parameterized.Parameter(1) public ECKey phoneKeyShare; public ECKey commonPublicKey; public BCParameters desktopBCParameters; public BCParameters phoneBCParameters; @Before public void setUp() throws Exception { super.setUp(); //setup key material
commonPublicKey = convertPointToPubKEy(
ChristopherMann/2FactorWallet
wallet_lib/src/test/java/de/uni_bonn/bit/TransactionSignerBaseTest.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // }
import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey; import org.bitcoinj.core.AbstractBlockChain; import org.bitcoinj.core.Coin; import org.bitcoinj.core.ECKey; import org.bitcoinj.testing.TestWithWallet; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.math.BigInteger; import java.util.*; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt;
/* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This is the base class for the transaction signer tests. It uses the * {@link org.bitcoinj.testing.TestWithWallet} class from bitcoinj to setup test transactions. Additionally, * it performs the setup for several parameters. */ @RunWith(Parameterized.class) public class TransactionSignerBaseTest extends TestWithWallet { @Parameterized.Parameters public static Collection<ECKey[]> data(){ BigInteger nEC = ECKey.CURVE.getN(); return Lists.newArrayList( new ECKey[]{ convertBigIntToPrivKey(new BigInteger("1")), convertBigIntToPrivKey(new BigInteger("2")) }, new ECKey[]{ convertBigIntToPrivKey(nEC.subtract(new BigInteger("1"))), convertBigIntToPrivKey(nEC.subtract(new BigInteger("2"))) }); } @Parameterized.Parameter(0) public ECKey desktopKeyShare; @Parameterized.Parameter(1) public ECKey phoneKeyShare; public ECKey commonPublicKey; public BCParameters desktopBCParameters; public BCParameters phoneBCParameters; @Before public void setUp() throws Exception { super.setUp(); //setup key material commonPublicKey = convertPointToPubKEy(
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // } // Path: wallet_lib/src/test/java/de/uni_bonn/bit/TransactionSignerBaseTest.java import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey; import org.bitcoinj.core.AbstractBlockChain; import org.bitcoinj.core.Coin; import org.bitcoinj.core.ECKey; import org.bitcoinj.testing.TestWithWallet; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.math.BigInteger; import java.util.*; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt; /* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This is the base class for the transaction signer tests. It uses the * {@link org.bitcoinj.testing.TestWithWallet} class from bitcoinj to setup test transactions. Additionally, * it performs the setup for several parameters. */ @RunWith(Parameterized.class) public class TransactionSignerBaseTest extends TestWithWallet { @Parameterized.Parameters public static Collection<ECKey[]> data(){ BigInteger nEC = ECKey.CURVE.getN(); return Lists.newArrayList( new ECKey[]{ convertBigIntToPrivKey(new BigInteger("1")), convertBigIntToPrivKey(new BigInteger("2")) }, new ECKey[]{ convertBigIntToPrivKey(nEC.subtract(new BigInteger("1"))), convertBigIntToPrivKey(nEC.subtract(new BigInteger("2"))) }); } @Parameterized.Parameter(0) public ECKey desktopKeyShare; @Parameterized.Parameter(1) public ECKey phoneKeyShare; public ECKey commonPublicKey; public BCParameters desktopBCParameters; public BCParameters phoneBCParameters; @Before public void setUp() throws Exception { super.setUp(); //setup key material commonPublicKey = convertPointToPubKEy(
convertPubKeyToPoint(desktopKeyShare).multiply(convertPrivKeyToBigInt(phoneKeyShare)));
ChristopherMann/2FactorWallet
wallet_lib/src/test/java/de/uni_bonn/bit/TransactionSignerBaseTest.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // }
import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey; import org.bitcoinj.core.AbstractBlockChain; import org.bitcoinj.core.Coin; import org.bitcoinj.core.ECKey; import org.bitcoinj.testing.TestWithWallet; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.math.BigInteger; import java.util.*; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt;
/* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This is the base class for the transaction signer tests. It uses the * {@link org.bitcoinj.testing.TestWithWallet} class from bitcoinj to setup test transactions. Additionally, * it performs the setup for several parameters. */ @RunWith(Parameterized.class) public class TransactionSignerBaseTest extends TestWithWallet { @Parameterized.Parameters public static Collection<ECKey[]> data(){ BigInteger nEC = ECKey.CURVE.getN(); return Lists.newArrayList( new ECKey[]{ convertBigIntToPrivKey(new BigInteger("1")), convertBigIntToPrivKey(new BigInteger("2")) }, new ECKey[]{ convertBigIntToPrivKey(nEC.subtract(new BigInteger("1"))), convertBigIntToPrivKey(nEC.subtract(new BigInteger("2"))) }); } @Parameterized.Parameter(0) public ECKey desktopKeyShare; @Parameterized.Parameter(1) public ECKey phoneKeyShare; public ECKey commonPublicKey; public BCParameters desktopBCParameters; public BCParameters phoneBCParameters; @Before public void setUp() throws Exception { super.setUp(); //setup key material commonPublicKey = convertPointToPubKEy(
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertPointToPubKEy(ECPoint point){ // return ECKey.fromPublicOnly(point); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static BigInteger convertPrivKeyToBigInt(ECKey ecKey){ // checkArgument(ecKey.hasPrivKey(), "Private key expected, but ecKey only contains a public key."); // return new BigInteger(1, ecKey.getPrivKeyBytes()); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECPoint convertPubKeyToPoint(ECKey ecKey){ // return ECKey.CURVE.getCurve().decodePoint(ecKey.getPubKey()).normalize(); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // } // Path: wallet_lib/src/test/java/de/uni_bonn/bit/TransactionSignerBaseTest.java import static de.uni_bonn.bit.BitcoinECMathHelper.convertPubKeyToPoint; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey; import org.bitcoinj.core.AbstractBlockChain; import org.bitcoinj.core.Coin; import org.bitcoinj.core.ECKey; import org.bitcoinj.testing.TestWithWallet; import com.google.common.collect.Lists; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import java.math.BigInteger; import java.util.*; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPointToPubKEy; import static de.uni_bonn.bit.BitcoinECMathHelper.convertPrivKeyToBigInt; /* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This is the base class for the transaction signer tests. It uses the * {@link org.bitcoinj.testing.TestWithWallet} class from bitcoinj to setup test transactions. Additionally, * it performs the setup for several parameters. */ @RunWith(Parameterized.class) public class TransactionSignerBaseTest extends TestWithWallet { @Parameterized.Parameters public static Collection<ECKey[]> data(){ BigInteger nEC = ECKey.CURVE.getN(); return Lists.newArrayList( new ECKey[]{ convertBigIntToPrivKey(new BigInteger("1")), convertBigIntToPrivKey(new BigInteger("2")) }, new ECKey[]{ convertBigIntToPrivKey(nEC.subtract(new BigInteger("1"))), convertBigIntToPrivKey(nEC.subtract(new BigInteger("2"))) }); } @Parameterized.Parameter(0) public ECKey desktopKeyShare; @Parameterized.Parameter(1) public ECKey phoneKeyShare; public ECKey commonPublicKey; public BCParameters desktopBCParameters; public BCParameters phoneBCParameters; @Before public void setUp() throws Exception { super.setUp(); //setup key material commonPublicKey = convertPointToPubKEy(
convertPubKeyToPoint(desktopKeyShare).multiply(convertPrivKeyToBigInt(phoneKeyShare)));
ChristopherMann/2FactorWallet
desktop_wallet/src/main/java/de/uni_bonn/bit/PairingProtocolImpl.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/ZKProofInit.java // public class ZKProofInit { // // @Stringable // private BigInteger gRoot; // @Stringable // private BigInteger hRoot; // /** // * Generates a zero-knowledge proof which proves that bcParameters.g and bcParameters.h are quadratic residues, // * which is implies that they are part of the same cyclic sub group. // * @param bcParameters // * @param id An id which identifies the proof instance. The result should depend on the proof it is used for to // * prevent replay attacks. // * @return // */ // public static ZKProofInit generate(BCParameters bcParameters, String id){ // ZKProofInit result = new ZKProofInit(); // result.gRoot = squareRoot(bcParameters.getH(), bcParameters.getP(), bcParameters.getQ()); // result.hRoot = squareRoot(bcParameters.getG(), bcParameters.getP(), bcParameters.getQ()); // return result; // } // // /** // * Verifies this zk proof for the given bcParameters. // * @param bcParameters // * @param id // */ // public void verify(BCParameters bcParameters, String id){ // BigInteger gRootSquared = gRoot.pow(2).mod(bcParameters.getN()); // BigInteger hRootSquared = hRoot.pow(2).mod(bcParameters.getN()); // // if(! bcParameters.getH().equals(gRootSquared) || ! bcParameters.getG().equals(hRootSquared)){ // throw new ProtocolException("Verification of ZKProof init with id " + id + " failed."); // } // } // // private static BigInteger squareRoot(BigInteger x, BigInteger p, BigInteger q){ // BigInteger four = new BigInteger("4"); // BigInteger rp = x.modPow(p.add(BigInteger.ONE).divide(four), p); // BigInteger rq = x.modPow(q.add(BigInteger.ONE).divide(four), q); // // BigIntEuclidean euclidp = BigIntEuclidean.calculate(p, q); // BigIntEuclidean euclidq = BigIntEuclidean.calculate(q, p); // // BigInteger ep = euclidp.y.multiply(q); // BigInteger eq = euclidq.y.multiply(p); // // BigInteger r = rp.multiply(ep).add(rq.multiply(eq)).mod(p.multiply(q)); // // return r; // } // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/IPairingProtocol.java // public interface IPairingProtocol { // // public PairingMessage pair(PairingMessage pairingMessage); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/PairingMessage.java // public class PairingMessage { // PaillierKeyPair pkp; // byte[] otherPublicKey; // BCParameters bcParameters; // ZKProofInit zkProofInit; // // private PairingMessage(){ } // // public PairingMessage(ECPoint otherPublicKey, PaillierKeyPair pkp, BCParameters bcParameters, // ZKProofInit zkProofInit) { // if(pkp.containsPrivateKey()){ // throw new RuntimeException("Non null private key in PaillierKeyPair. This must not be the case for a pairing message!"); // } // this.pkp = pkp; // this.otherPublicKey = otherPublicKey.normalize().getEncoded(true); // if(bcParameters.containsPrivateSecrets()){ // throw new RuntimeException("Non null private key in PaillierKeyPair. This must not be the case for a pairing message!"); // } // this.bcParameters = bcParameters; // this.zkProofInit = zkProofInit; // } // // public ECPoint getOtherPublicKey() { // return ECKey.CURVE.getCurve().decodePoint(otherPublicKey); // } // // public PaillierKeyPair getPkp() { // return pkp; // } // // public BCParameters getBcParameters() { // return bcParameters; // } // // public ZKProofInit getZkProofInit() { // return zkProofInit; // } // }
import de.uni_bonn.bit.wallet_protocol.ZKProofInit; import org.bitcoinj.core.ECKey; import de.uni_bonn.bit.wallet_protocol.IPairingProtocol; import de.uni_bonn.bit.wallet_protocol.PairingMessage; import org.spongycastle.math.ec.ECPoint; import org.spongycastle.pqc.math.linearalgebra.IntegerFunctions; import java.math.BigInteger;
/* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This class implements the {@link de.uni_bonn.bit.wallet_protocol.IPairingProtocol}. It contains the desktop's logic * for the pairing protocol. This class is used to create an avro server. */ public class PairingProtocolImpl implements IPairingProtocol{ private BigInteger keyShare; private String address; private PairingProtocolListener listener; private KeyShareWalletExtension walletExtension; private static final BigInteger nEC = ECKey.CURVE.getN(); public PairingProtocolImpl(PairingProtocolListener listener, KeyShareWalletExtension walletExtension) { this.listener = listener; this.keyShare = IntegerFunctions.randomize(nEC.subtract(BigInteger.ONE)).add(BigInteger.ONE); this.walletExtension = walletExtension; } @Override
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/ZKProofInit.java // public class ZKProofInit { // // @Stringable // private BigInteger gRoot; // @Stringable // private BigInteger hRoot; // /** // * Generates a zero-knowledge proof which proves that bcParameters.g and bcParameters.h are quadratic residues, // * which is implies that they are part of the same cyclic sub group. // * @param bcParameters // * @param id An id which identifies the proof instance. The result should depend on the proof it is used for to // * prevent replay attacks. // * @return // */ // public static ZKProofInit generate(BCParameters bcParameters, String id){ // ZKProofInit result = new ZKProofInit(); // result.gRoot = squareRoot(bcParameters.getH(), bcParameters.getP(), bcParameters.getQ()); // result.hRoot = squareRoot(bcParameters.getG(), bcParameters.getP(), bcParameters.getQ()); // return result; // } // // /** // * Verifies this zk proof for the given bcParameters. // * @param bcParameters // * @param id // */ // public void verify(BCParameters bcParameters, String id){ // BigInteger gRootSquared = gRoot.pow(2).mod(bcParameters.getN()); // BigInteger hRootSquared = hRoot.pow(2).mod(bcParameters.getN()); // // if(! bcParameters.getH().equals(gRootSquared) || ! bcParameters.getG().equals(hRootSquared)){ // throw new ProtocolException("Verification of ZKProof init with id " + id + " failed."); // } // } // // private static BigInteger squareRoot(BigInteger x, BigInteger p, BigInteger q){ // BigInteger four = new BigInteger("4"); // BigInteger rp = x.modPow(p.add(BigInteger.ONE).divide(four), p); // BigInteger rq = x.modPow(q.add(BigInteger.ONE).divide(four), q); // // BigIntEuclidean euclidp = BigIntEuclidean.calculate(p, q); // BigIntEuclidean euclidq = BigIntEuclidean.calculate(q, p); // // BigInteger ep = euclidp.y.multiply(q); // BigInteger eq = euclidq.y.multiply(p); // // BigInteger r = rp.multiply(ep).add(rq.multiply(eq)).mod(p.multiply(q)); // // return r; // } // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/IPairingProtocol.java // public interface IPairingProtocol { // // public PairingMessage pair(PairingMessage pairingMessage); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/PairingMessage.java // public class PairingMessage { // PaillierKeyPair pkp; // byte[] otherPublicKey; // BCParameters bcParameters; // ZKProofInit zkProofInit; // // private PairingMessage(){ } // // public PairingMessage(ECPoint otherPublicKey, PaillierKeyPair pkp, BCParameters bcParameters, // ZKProofInit zkProofInit) { // if(pkp.containsPrivateKey()){ // throw new RuntimeException("Non null private key in PaillierKeyPair. This must not be the case for a pairing message!"); // } // this.pkp = pkp; // this.otherPublicKey = otherPublicKey.normalize().getEncoded(true); // if(bcParameters.containsPrivateSecrets()){ // throw new RuntimeException("Non null private key in PaillierKeyPair. This must not be the case for a pairing message!"); // } // this.bcParameters = bcParameters; // this.zkProofInit = zkProofInit; // } // // public ECPoint getOtherPublicKey() { // return ECKey.CURVE.getCurve().decodePoint(otherPublicKey); // } // // public PaillierKeyPair getPkp() { // return pkp; // } // // public BCParameters getBcParameters() { // return bcParameters; // } // // public ZKProofInit getZkProofInit() { // return zkProofInit; // } // } // Path: desktop_wallet/src/main/java/de/uni_bonn/bit/PairingProtocolImpl.java import de.uni_bonn.bit.wallet_protocol.ZKProofInit; import org.bitcoinj.core.ECKey; import de.uni_bonn.bit.wallet_protocol.IPairingProtocol; import de.uni_bonn.bit.wallet_protocol.PairingMessage; import org.spongycastle.math.ec.ECPoint; import org.spongycastle.pqc.math.linearalgebra.IntegerFunctions; import java.math.BigInteger; /* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This class implements the {@link de.uni_bonn.bit.wallet_protocol.IPairingProtocol}. It contains the desktop's logic * for the pairing protocol. This class is used to create an avro server. */ public class PairingProtocolImpl implements IPairingProtocol{ private BigInteger keyShare; private String address; private PairingProtocolListener listener; private KeyShareWalletExtension walletExtension; private static final BigInteger nEC = ECKey.CURVE.getN(); public PairingProtocolImpl(PairingProtocolListener listener, KeyShareWalletExtension walletExtension) { this.listener = listener; this.keyShare = IntegerFunctions.randomize(nEC.subtract(BigInteger.ONE)).add(BigInteger.ONE); this.walletExtension = walletExtension; } @Override
public PairingMessage pair(PairingMessage message) {
ChristopherMann/2FactorWallet
desktop_wallet/src/main/java/de/uni_bonn/bit/PairingProtocolImpl.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/ZKProofInit.java // public class ZKProofInit { // // @Stringable // private BigInteger gRoot; // @Stringable // private BigInteger hRoot; // /** // * Generates a zero-knowledge proof which proves that bcParameters.g and bcParameters.h are quadratic residues, // * which is implies that they are part of the same cyclic sub group. // * @param bcParameters // * @param id An id which identifies the proof instance. The result should depend on the proof it is used for to // * prevent replay attacks. // * @return // */ // public static ZKProofInit generate(BCParameters bcParameters, String id){ // ZKProofInit result = new ZKProofInit(); // result.gRoot = squareRoot(bcParameters.getH(), bcParameters.getP(), bcParameters.getQ()); // result.hRoot = squareRoot(bcParameters.getG(), bcParameters.getP(), bcParameters.getQ()); // return result; // } // // /** // * Verifies this zk proof for the given bcParameters. // * @param bcParameters // * @param id // */ // public void verify(BCParameters bcParameters, String id){ // BigInteger gRootSquared = gRoot.pow(2).mod(bcParameters.getN()); // BigInteger hRootSquared = hRoot.pow(2).mod(bcParameters.getN()); // // if(! bcParameters.getH().equals(gRootSquared) || ! bcParameters.getG().equals(hRootSquared)){ // throw new ProtocolException("Verification of ZKProof init with id " + id + " failed."); // } // } // // private static BigInteger squareRoot(BigInteger x, BigInteger p, BigInteger q){ // BigInteger four = new BigInteger("4"); // BigInteger rp = x.modPow(p.add(BigInteger.ONE).divide(four), p); // BigInteger rq = x.modPow(q.add(BigInteger.ONE).divide(four), q); // // BigIntEuclidean euclidp = BigIntEuclidean.calculate(p, q); // BigIntEuclidean euclidq = BigIntEuclidean.calculate(q, p); // // BigInteger ep = euclidp.y.multiply(q); // BigInteger eq = euclidq.y.multiply(p); // // BigInteger r = rp.multiply(ep).add(rq.multiply(eq)).mod(p.multiply(q)); // // return r; // } // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/IPairingProtocol.java // public interface IPairingProtocol { // // public PairingMessage pair(PairingMessage pairingMessage); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/PairingMessage.java // public class PairingMessage { // PaillierKeyPair pkp; // byte[] otherPublicKey; // BCParameters bcParameters; // ZKProofInit zkProofInit; // // private PairingMessage(){ } // // public PairingMessage(ECPoint otherPublicKey, PaillierKeyPair pkp, BCParameters bcParameters, // ZKProofInit zkProofInit) { // if(pkp.containsPrivateKey()){ // throw new RuntimeException("Non null private key in PaillierKeyPair. This must not be the case for a pairing message!"); // } // this.pkp = pkp; // this.otherPublicKey = otherPublicKey.normalize().getEncoded(true); // if(bcParameters.containsPrivateSecrets()){ // throw new RuntimeException("Non null private key in PaillierKeyPair. This must not be the case for a pairing message!"); // } // this.bcParameters = bcParameters; // this.zkProofInit = zkProofInit; // } // // public ECPoint getOtherPublicKey() { // return ECKey.CURVE.getCurve().decodePoint(otherPublicKey); // } // // public PaillierKeyPair getPkp() { // return pkp; // } // // public BCParameters getBcParameters() { // return bcParameters; // } // // public ZKProofInit getZkProofInit() { // return zkProofInit; // } // }
import de.uni_bonn.bit.wallet_protocol.ZKProofInit; import org.bitcoinj.core.ECKey; import de.uni_bonn.bit.wallet_protocol.IPairingProtocol; import de.uni_bonn.bit.wallet_protocol.PairingMessage; import org.spongycastle.math.ec.ECPoint; import org.spongycastle.pqc.math.linearalgebra.IntegerFunctions; import java.math.BigInteger;
/* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This class implements the {@link de.uni_bonn.bit.wallet_protocol.IPairingProtocol}. It contains the desktop's logic * for the pairing protocol. This class is used to create an avro server. */ public class PairingProtocolImpl implements IPairingProtocol{ private BigInteger keyShare; private String address; private PairingProtocolListener listener; private KeyShareWalletExtension walletExtension; private static final BigInteger nEC = ECKey.CURVE.getN(); public PairingProtocolImpl(PairingProtocolListener listener, KeyShareWalletExtension walletExtension) { this.listener = listener; this.keyShare = IntegerFunctions.randomize(nEC.subtract(BigInteger.ONE)).add(BigInteger.ONE); this.walletExtension = walletExtension; } @Override public PairingMessage pair(PairingMessage message) { message.getZkProofInit().verify(message.getBcParameters(), "Phone Init Proof"); ECPoint publicKey = ECKey.CURVE.getG().multiply(keyShare).normalize(); PaillierKeyPair pkp = PaillierKeyPair.generatePaillierKeyPair(); BCParameters desktopBCParameters = BCParameters.generateBCParameters();
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/ZKProofInit.java // public class ZKProofInit { // // @Stringable // private BigInteger gRoot; // @Stringable // private BigInteger hRoot; // /** // * Generates a zero-knowledge proof which proves that bcParameters.g and bcParameters.h are quadratic residues, // * which is implies that they are part of the same cyclic sub group. // * @param bcParameters // * @param id An id which identifies the proof instance. The result should depend on the proof it is used for to // * prevent replay attacks. // * @return // */ // public static ZKProofInit generate(BCParameters bcParameters, String id){ // ZKProofInit result = new ZKProofInit(); // result.gRoot = squareRoot(bcParameters.getH(), bcParameters.getP(), bcParameters.getQ()); // result.hRoot = squareRoot(bcParameters.getG(), bcParameters.getP(), bcParameters.getQ()); // return result; // } // // /** // * Verifies this zk proof for the given bcParameters. // * @param bcParameters // * @param id // */ // public void verify(BCParameters bcParameters, String id){ // BigInteger gRootSquared = gRoot.pow(2).mod(bcParameters.getN()); // BigInteger hRootSquared = hRoot.pow(2).mod(bcParameters.getN()); // // if(! bcParameters.getH().equals(gRootSquared) || ! bcParameters.getG().equals(hRootSquared)){ // throw new ProtocolException("Verification of ZKProof init with id " + id + " failed."); // } // } // // private static BigInteger squareRoot(BigInteger x, BigInteger p, BigInteger q){ // BigInteger four = new BigInteger("4"); // BigInteger rp = x.modPow(p.add(BigInteger.ONE).divide(four), p); // BigInteger rq = x.modPow(q.add(BigInteger.ONE).divide(four), q); // // BigIntEuclidean euclidp = BigIntEuclidean.calculate(p, q); // BigIntEuclidean euclidq = BigIntEuclidean.calculate(q, p); // // BigInteger ep = euclidp.y.multiply(q); // BigInteger eq = euclidq.y.multiply(p); // // BigInteger r = rp.multiply(ep).add(rq.multiply(eq)).mod(p.multiply(q)); // // return r; // } // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/IPairingProtocol.java // public interface IPairingProtocol { // // public PairingMessage pair(PairingMessage pairingMessage); // } // // Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/PairingMessage.java // public class PairingMessage { // PaillierKeyPair pkp; // byte[] otherPublicKey; // BCParameters bcParameters; // ZKProofInit zkProofInit; // // private PairingMessage(){ } // // public PairingMessage(ECPoint otherPublicKey, PaillierKeyPair pkp, BCParameters bcParameters, // ZKProofInit zkProofInit) { // if(pkp.containsPrivateKey()){ // throw new RuntimeException("Non null private key in PaillierKeyPair. This must not be the case for a pairing message!"); // } // this.pkp = pkp; // this.otherPublicKey = otherPublicKey.normalize().getEncoded(true); // if(bcParameters.containsPrivateSecrets()){ // throw new RuntimeException("Non null private key in PaillierKeyPair. This must not be the case for a pairing message!"); // } // this.bcParameters = bcParameters; // this.zkProofInit = zkProofInit; // } // // public ECPoint getOtherPublicKey() { // return ECKey.CURVE.getCurve().decodePoint(otherPublicKey); // } // // public PaillierKeyPair getPkp() { // return pkp; // } // // public BCParameters getBcParameters() { // return bcParameters; // } // // public ZKProofInit getZkProofInit() { // return zkProofInit; // } // } // Path: desktop_wallet/src/main/java/de/uni_bonn/bit/PairingProtocolImpl.java import de.uni_bonn.bit.wallet_protocol.ZKProofInit; import org.bitcoinj.core.ECKey; import de.uni_bonn.bit.wallet_protocol.IPairingProtocol; import de.uni_bonn.bit.wallet_protocol.PairingMessage; import org.spongycastle.math.ec.ECPoint; import org.spongycastle.pqc.math.linearalgebra.IntegerFunctions; import java.math.BigInteger; /* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This class implements the {@link de.uni_bonn.bit.wallet_protocol.IPairingProtocol}. It contains the desktop's logic * for the pairing protocol. This class is used to create an avro server. */ public class PairingProtocolImpl implements IPairingProtocol{ private BigInteger keyShare; private String address; private PairingProtocolListener listener; private KeyShareWalletExtension walletExtension; private static final BigInteger nEC = ECKey.CURVE.getN(); public PairingProtocolImpl(PairingProtocolListener listener, KeyShareWalletExtension walletExtension) { this.listener = listener; this.keyShare = IntegerFunctions.randomize(nEC.subtract(BigInteger.ONE)).add(BigInteger.ONE); this.walletExtension = walletExtension; } @Override public PairingMessage pair(PairingMessage message) { message.getZkProofInit().verify(message.getBcParameters(), "Phone Init Proof"); ECPoint publicKey = ECKey.CURVE.getG().multiply(keyShare).normalize(); PaillierKeyPair pkp = PaillierKeyPair.generatePaillierKeyPair(); BCParameters desktopBCParameters = BCParameters.generateBCParameters();
ZKProofInit myZKProof = ZKProofInit.generate(desktopBCParameters, "Desktop Init Proof");
ChristopherMann/2FactorWallet
desktop_wallet/src/main/java/de/uni_bonn/bit/QRCodeHelper.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/QRCodeData.java // public class QRCodeData{ // List<String> ipAddresses; // byte[] publicKey; // // public QRCodeData() {} //for serialization // // public QRCodeData(List<String> ipAddresses, PublicKey publicKey) { // this.ipAddresses = ipAddresses; // setPublicKey(publicKey); // } // // public List<String> getIpAddresses() { // return ipAddresses; // } // // public void setIpAddresses(List<String> ipAddresses) { // this.ipAddresses = ipAddresses; // } // // public PublicKey getPublicKey() throws NoSuchAlgorithmException, InvalidKeySpecException { // return KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(this.publicKey)); // } // // public void setPublicKey(PublicKey publicKey) { // this.publicKey = publicKey.getEncoded(); // } // }
import org.bitcoinj.core.Base58; import com.google.zxing.BarcodeFormat; import com.google.zxing.MultiFormatWriter; import com.google.zxing.WriterException; import com.google.zxing.client.j2se.MatrixToImageWriter; import de.uni_bonn.bit.wallet_protocol.QRCodeData; import org.apache.avro.io.Encoder; import org.apache.avro.io.EncoderFactory; import org.apache.avro.reflect.ReflectDatumWriter; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.security.PublicKey; import java.util.List;
/* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This class contains some helper methods to create a QRCode which contains some given data. */ public class QRCodeHelper { /** * This methods creates a QRCode which contains a list of IP addresses and a public key for a TLS connection. The * data is serialized with avro and then Base58 encoded. The resulting string is then stored inside the QR code which * is returned as a {@link java.awt.image.BufferedImage}. */ public static BufferedImage CreateQRCodeForTLSSetup(List<String> ipAddresses, PublicKey publicKey) throws IOException, WriterException {
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/wallet_protocol/QRCodeData.java // public class QRCodeData{ // List<String> ipAddresses; // byte[] publicKey; // // public QRCodeData() {} //for serialization // // public QRCodeData(List<String> ipAddresses, PublicKey publicKey) { // this.ipAddresses = ipAddresses; // setPublicKey(publicKey); // } // // public List<String> getIpAddresses() { // return ipAddresses; // } // // public void setIpAddresses(List<String> ipAddresses) { // this.ipAddresses = ipAddresses; // } // // public PublicKey getPublicKey() throws NoSuchAlgorithmException, InvalidKeySpecException { // return KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(this.publicKey)); // } // // public void setPublicKey(PublicKey publicKey) { // this.publicKey = publicKey.getEncoded(); // } // } // Path: desktop_wallet/src/main/java/de/uni_bonn/bit/QRCodeHelper.java import org.bitcoinj.core.Base58; import com.google.zxing.BarcodeFormat; import com.google.zxing.MultiFormatWriter; import com.google.zxing.WriterException; import com.google.zxing.client.j2se.MatrixToImageWriter; import de.uni_bonn.bit.wallet_protocol.QRCodeData; import org.apache.avro.io.Encoder; import org.apache.avro.io.EncoderFactory; import org.apache.avro.reflect.ReflectDatumWriter; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.security.PublicKey; import java.util.List; /* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This class contains some helper methods to create a QRCode which contains some given data. */ public class QRCodeHelper { /** * This methods creates a QRCode which contains a list of IP addresses and a public key for a TLS connection. The * data is serialized with avro and then Base58 encoded. The resulting string is then stored inside the QR code which * is returned as a {@link java.awt.image.BufferedImage}. */ public static BufferedImage CreateQRCodeForTLSSetup(List<String> ipAddresses, PublicKey publicKey) throws IOException, WriterException {
ReflectDatumWriter<QRCodeData> specificDatumWriter = new ReflectDatumWriter<>(QRCodeData.class);
ChristopherMann/2FactorWallet
wallet_lib/src/test/java/de/uni_bonn/bit/TransactionSignerTests.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // }
import org.bitcoinj.core.*; import org.bitcoinj.params.UnitTestParams; import de.uni_bonn.bit.wallet_protocol.*; import org.junit.Test; import java.math.BigInteger; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey;
/* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This class tests the classes {@link de.uni_bonn.bit.DesktopTransactionSigner} and * {@link de.uni_bonn.bit.PhoneTransactionSigner} which contains the Bitcoin specific logic * for signing Bitcoin transactions with the two-party ECDSA signature protocol. */ public class TransactionSignerTests extends TransactionSignerBaseTest { /** * This test signs a Bitcoin transaction with the two-party ECDSA signature protocol. * @throws InsufficientMoneyException */ @Test public void testTheTransactionSigners() throws InsufficientMoneyException {
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // } // Path: wallet_lib/src/test/java/de/uni_bonn/bit/TransactionSignerTests.java import org.bitcoinj.core.*; import org.bitcoinj.params.UnitTestParams; import de.uni_bonn.bit.wallet_protocol.*; import org.junit.Test; import java.math.BigInteger; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey; /* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This class tests the classes {@link de.uni_bonn.bit.DesktopTransactionSigner} and * {@link de.uni_bonn.bit.PhoneTransactionSigner} which contains the Bitcoin specific logic * for signing Bitcoin transactions with the two-party ECDSA signature protocol. */ public class TransactionSignerTests extends TransactionSignerBaseTest { /** * This test signs a Bitcoin transaction with the two-party ECDSA signature protocol. * @throws InsufficientMoneyException */ @Test public void testTheTransactionSigners() throws InsufficientMoneyException {
ECKey receiverKey = convertBigIntToPrivKey(new BigInteger("100"));
ChristopherMann/2FactorWallet
wallet_lib/src/test/java/de/uni_bonn/bit/TransactionSignerSerializationTests.java
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // }
import org.bitcoinj.core.*; import org.bitcoinj.params.UnitTestParams; import de.uni_bonn.bit.wallet_protocol.*; import org.apache.avro.ipc.NettyServer; import org.apache.avro.ipc.NettyTransceiver; import org.apache.avro.ipc.reflect.ReflectRequestor; import org.apache.avro.ipc.reflect.ReflectResponder; import org.junit.Test; import java.io.IOException; import java.math.BigInteger; import java.net.InetSocketAddress; import java.util.Map; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey;
/* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This class performs the same tests as {@link de.uni_bonn.bit.TransactionSignerTests}, but all messages * are exchanged via serialization. This class primarily checks that the Avro serialization used for the * communication between desktop and phone can successfully (de)serialize all objects required for the * protocol. */ public class TransactionSignerSerializationTests extends TransactionSignerBaseTest { /** * Similar to {@link TransactionSignerTests#testTheTransactionSigners()}, this test signs a * Bitcoin transaction with the two-party ECDSA signature protocol. All messages exchanged between * the {@link de.uni_bonn.bit.DesktopTransactionSigner} and the {@link de.uni_bonn.bit.PhoneTransactionSigner} * are serialized and sent over the local loopback. This test primarily exists to check that the * (de)serialization with avro works correctly. * @throws InsufficientMoneyException */ @Test public void testTheTransactionSigners() throws InsufficientMoneyException, IOException, InterruptedException {
// Path: wallet_lib/src/main/java/de/uni_bonn/bit/BitcoinECMathHelper.java // public static ECKey convertBigIntToPrivKey(BigInteger bigInt){ // checkArgument(bigInt.compareTo(BigInteger.ONE) >= 0, "A private key must be >= 1"); // checkArgument(bigInt.compareTo(ECKey.CURVE.getN()) < 0, "A private key must be <= N_EC"); // return ECKey.fromPrivate(bigInt); // } // Path: wallet_lib/src/test/java/de/uni_bonn/bit/TransactionSignerSerializationTests.java import org.bitcoinj.core.*; import org.bitcoinj.params.UnitTestParams; import de.uni_bonn.bit.wallet_protocol.*; import org.apache.avro.ipc.NettyServer; import org.apache.avro.ipc.NettyTransceiver; import org.apache.avro.ipc.reflect.ReflectRequestor; import org.apache.avro.ipc.reflect.ReflectResponder; import org.junit.Test; import java.io.IOException; import java.math.BigInteger; import java.net.InetSocketAddress; import java.util.Map; import static de.uni_bonn.bit.BitcoinECMathHelper.convertBigIntToPrivKey; /* * Copyright 2014 Christopher Mann * * 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 de.uni_bonn.bit; /** * This class performs the same tests as {@link de.uni_bonn.bit.TransactionSignerTests}, but all messages * are exchanged via serialization. This class primarily checks that the Avro serialization used for the * communication between desktop and phone can successfully (de)serialize all objects required for the * protocol. */ public class TransactionSignerSerializationTests extends TransactionSignerBaseTest { /** * Similar to {@link TransactionSignerTests#testTheTransactionSigners()}, this test signs a * Bitcoin transaction with the two-party ECDSA signature protocol. All messages exchanged between * the {@link de.uni_bonn.bit.DesktopTransactionSigner} and the {@link de.uni_bonn.bit.PhoneTransactionSigner} * are serialized and sent over the local loopback. This test primarily exists to check that the * (de)serialization with avro works correctly. * @throws InsufficientMoneyException */ @Test public void testTheTransactionSigners() throws InsufficientMoneyException, IOException, InterruptedException {
ECKey receiverKey = convertBigIntToPrivKey(new BigInteger("100"));
jenkinsci/global-build-stats-plugin
src/main/java/hudson/plugins/global_build_stats/model/BuildStatConfiguration.java
// Path: src/main/java/hudson/plugins/global_build_stats/FieldFilter.java // public interface FieldFilter { // // boolean isFieldValueValid(String fieldValue); // // public static final FieldFilter ALL = new FieldFilter() { // @Override // public boolean isFieldValueValid(String fieldValue) { // return true; // } // }; // } // // Path: src/main/java/hudson/plugins/global_build_stats/FieldFilterFactory.java // public class FieldFilterFactory { // // /** // * @deprecated Use REGEX_FIELD_FILTER_LABEL instead of this field (since v5 GlobalBuildStats file format) // */ // @Deprecated // public static final String OLD_JOB_NAME_REGEX_LABEL = "jobNameRegex"; // public static final String ALL_VALUES_FILTER_LABEL = "ALL"; // public static final String REGEX_FIELD_FILTER_LABEL = "fieldRegex"; // // private static final Pattern REGEX_FIELD_FILTER_PATTERN = Pattern.compile(REGEX_FIELD_FILTER_LABEL+"\\((.*)\\)"); // private static final Pattern ALL_VALUES_FILTER_PATTERN = Pattern.compile(ALL_VALUES_FILTER_LABEL); // // public static FieldFilter createFieldFilter(String fieldFilter){ // if(fieldFilter == null || ALL_VALUES_FILTER_PATTERN.matcher(fieldFilter).matches()){ // return FieldFilter.ALL; // } else { // Matcher fieldFilterMatcher = REGEX_FIELD_FILTER_PATTERN.matcher(fieldFilter); // if(fieldFilterMatcher.matches()){ // return new RegexFieldFilter(fieldFilterMatcher.group(1)); // } else { // return FieldFilter.ALL; // } // } // } // }
import hudson.plugins.global_build_stats.FieldFilter; import hudson.plugins.global_build_stats.FieldFilterFactory; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.commons.lang.builder.EqualsBuilder; import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.ExportedBean;
package hudson.plugins.global_build_stats.model; /** * Data persisted for every build stat configuration allowing to create charts * on build results * WARNING : if any change is made to this class, don't miss to create a new * data migrator in the hudson.plugins.global_build_stats.xstream.migration package ! * @author fcamblor */ @ExportedBean public class BuildStatConfiguration implements Serializable { private static final long serialVersionUID = -2962124739645932894L; private String id; // Chart configuration private String buildStatTitle; private int buildStatWidth=400, buildStatHeight=300; private int historicLength; private HistoricScale historicScale; private YAxisChartType yAxisChartType = YAxisChartType.COUNT; private YAxisChartDimension[] dimensionsShown; // Filters on jobs private BuildSearchCriteria buildFilters; /** * @deprecated Use buildFilters.jobFilter instead ! */ @Deprecated
// Path: src/main/java/hudson/plugins/global_build_stats/FieldFilter.java // public interface FieldFilter { // // boolean isFieldValueValid(String fieldValue); // // public static final FieldFilter ALL = new FieldFilter() { // @Override // public boolean isFieldValueValid(String fieldValue) { // return true; // } // }; // } // // Path: src/main/java/hudson/plugins/global_build_stats/FieldFilterFactory.java // public class FieldFilterFactory { // // /** // * @deprecated Use REGEX_FIELD_FILTER_LABEL instead of this field (since v5 GlobalBuildStats file format) // */ // @Deprecated // public static final String OLD_JOB_NAME_REGEX_LABEL = "jobNameRegex"; // public static final String ALL_VALUES_FILTER_LABEL = "ALL"; // public static final String REGEX_FIELD_FILTER_LABEL = "fieldRegex"; // // private static final Pattern REGEX_FIELD_FILTER_PATTERN = Pattern.compile(REGEX_FIELD_FILTER_LABEL+"\\((.*)\\)"); // private static final Pattern ALL_VALUES_FILTER_PATTERN = Pattern.compile(ALL_VALUES_FILTER_LABEL); // // public static FieldFilter createFieldFilter(String fieldFilter){ // if(fieldFilter == null || ALL_VALUES_FILTER_PATTERN.matcher(fieldFilter).matches()){ // return FieldFilter.ALL; // } else { // Matcher fieldFilterMatcher = REGEX_FIELD_FILTER_PATTERN.matcher(fieldFilter); // if(fieldFilterMatcher.matches()){ // return new RegexFieldFilter(fieldFilterMatcher.group(1)); // } else { // return FieldFilter.ALL; // } // } // } // } // Path: src/main/java/hudson/plugins/global_build_stats/model/BuildStatConfiguration.java import hudson.plugins.global_build_stats.FieldFilter; import hudson.plugins.global_build_stats.FieldFilterFactory; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.commons.lang.builder.EqualsBuilder; import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.ExportedBean; package hudson.plugins.global_build_stats.model; /** * Data persisted for every build stat configuration allowing to create charts * on build results * WARNING : if any change is made to this class, don't miss to create a new * data migrator in the hudson.plugins.global_build_stats.xstream.migration package ! * @author fcamblor */ @ExportedBean public class BuildStatConfiguration implements Serializable { private static final long serialVersionUID = -2962124739645932894L; private String id; // Chart configuration private String buildStatTitle; private int buildStatWidth=400, buildStatHeight=300; private int historicLength; private HistoricScale historicScale; private YAxisChartType yAxisChartType = YAxisChartType.COUNT; private YAxisChartDimension[] dimensionsShown; // Filters on jobs private BuildSearchCriteria buildFilters; /** * @deprecated Use buildFilters.jobFilter instead ! */ @Deprecated
transient private String jobFilter = FieldFilterFactory.ALL_VALUES_FILTER_LABEL;
jenkinsci/global-build-stats-plugin
src/main/java/hudson/plugins/global_build_stats/model/BuildStatConfiguration.java
// Path: src/main/java/hudson/plugins/global_build_stats/FieldFilter.java // public interface FieldFilter { // // boolean isFieldValueValid(String fieldValue); // // public static final FieldFilter ALL = new FieldFilter() { // @Override // public boolean isFieldValueValid(String fieldValue) { // return true; // } // }; // } // // Path: src/main/java/hudson/plugins/global_build_stats/FieldFilterFactory.java // public class FieldFilterFactory { // // /** // * @deprecated Use REGEX_FIELD_FILTER_LABEL instead of this field (since v5 GlobalBuildStats file format) // */ // @Deprecated // public static final String OLD_JOB_NAME_REGEX_LABEL = "jobNameRegex"; // public static final String ALL_VALUES_FILTER_LABEL = "ALL"; // public static final String REGEX_FIELD_FILTER_LABEL = "fieldRegex"; // // private static final Pattern REGEX_FIELD_FILTER_PATTERN = Pattern.compile(REGEX_FIELD_FILTER_LABEL+"\\((.*)\\)"); // private static final Pattern ALL_VALUES_FILTER_PATTERN = Pattern.compile(ALL_VALUES_FILTER_LABEL); // // public static FieldFilter createFieldFilter(String fieldFilter){ // if(fieldFilter == null || ALL_VALUES_FILTER_PATTERN.matcher(fieldFilter).matches()){ // return FieldFilter.ALL; // } else { // Matcher fieldFilterMatcher = REGEX_FIELD_FILTER_PATTERN.matcher(fieldFilter); // if(fieldFilterMatcher.matches()){ // return new RegexFieldFilter(fieldFilterMatcher.group(1)); // } else { // return FieldFilter.ALL; // } // } // } // }
import hudson.plugins.global_build_stats.FieldFilter; import hudson.plugins.global_build_stats.FieldFilterFactory; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.commons.lang.builder.EqualsBuilder; import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.ExportedBean;
package hudson.plugins.global_build_stats.model; /** * Data persisted for every build stat configuration allowing to create charts * on build results * WARNING : if any change is made to this class, don't miss to create a new * data migrator in the hudson.plugins.global_build_stats.xstream.migration package ! * @author fcamblor */ @ExportedBean public class BuildStatConfiguration implements Serializable { private static final long serialVersionUID = -2962124739645932894L; private String id; // Chart configuration private String buildStatTitle; private int buildStatWidth=400, buildStatHeight=300; private int historicLength; private HistoricScale historicScale; private YAxisChartType yAxisChartType = YAxisChartType.COUNT; private YAxisChartDimension[] dimensionsShown; // Filters on jobs private BuildSearchCriteria buildFilters; /** * @deprecated Use buildFilters.jobFilter instead ! */ @Deprecated transient private String jobFilter = FieldFilterFactory.ALL_VALUES_FILTER_LABEL;
// Path: src/main/java/hudson/plugins/global_build_stats/FieldFilter.java // public interface FieldFilter { // // boolean isFieldValueValid(String fieldValue); // // public static final FieldFilter ALL = new FieldFilter() { // @Override // public boolean isFieldValueValid(String fieldValue) { // return true; // } // }; // } // // Path: src/main/java/hudson/plugins/global_build_stats/FieldFilterFactory.java // public class FieldFilterFactory { // // /** // * @deprecated Use REGEX_FIELD_FILTER_LABEL instead of this field (since v5 GlobalBuildStats file format) // */ // @Deprecated // public static final String OLD_JOB_NAME_REGEX_LABEL = "jobNameRegex"; // public static final String ALL_VALUES_FILTER_LABEL = "ALL"; // public static final String REGEX_FIELD_FILTER_LABEL = "fieldRegex"; // // private static final Pattern REGEX_FIELD_FILTER_PATTERN = Pattern.compile(REGEX_FIELD_FILTER_LABEL+"\\((.*)\\)"); // private static final Pattern ALL_VALUES_FILTER_PATTERN = Pattern.compile(ALL_VALUES_FILTER_LABEL); // // public static FieldFilter createFieldFilter(String fieldFilter){ // if(fieldFilter == null || ALL_VALUES_FILTER_PATTERN.matcher(fieldFilter).matches()){ // return FieldFilter.ALL; // } else { // Matcher fieldFilterMatcher = REGEX_FIELD_FILTER_PATTERN.matcher(fieldFilter); // if(fieldFilterMatcher.matches()){ // return new RegexFieldFilter(fieldFilterMatcher.group(1)); // } else { // return FieldFilter.ALL; // } // } // } // } // Path: src/main/java/hudson/plugins/global_build_stats/model/BuildStatConfiguration.java import hudson.plugins.global_build_stats.FieldFilter; import hudson.plugins.global_build_stats.FieldFilterFactory; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.commons.lang.builder.EqualsBuilder; import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.ExportedBean; package hudson.plugins.global_build_stats.model; /** * Data persisted for every build stat configuration allowing to create charts * on build results * WARNING : if any change is made to this class, don't miss to create a new * data migrator in the hudson.plugins.global_build_stats.xstream.migration package ! * @author fcamblor */ @ExportedBean public class BuildStatConfiguration implements Serializable { private static final long serialVersionUID = -2962124739645932894L; private String id; // Chart configuration private String buildStatTitle; private int buildStatWidth=400, buildStatHeight=300; private int historicLength; private HistoricScale historicScale; private YAxisChartType yAxisChartType = YAxisChartType.COUNT; private YAxisChartDimension[] dimensionsShown; // Filters on jobs private BuildSearchCriteria buildFilters; /** * @deprecated Use buildFilters.jobFilter instead ! */ @Deprecated transient private String jobFilter = FieldFilterFactory.ALL_VALUES_FILTER_LABEL;
transient FieldFilter calculatedJobFilter = null; // For calcul optimizations only
jenkinsci/global-build-stats-plugin
src/main/java/hudson/plugins/global_build_stats/model/BuildSearchCriteria.java
// Path: src/main/java/hudson/plugins/global_build_stats/FieldFilter.java // public interface FieldFilter { // // boolean isFieldValueValid(String fieldValue); // // public static final FieldFilter ALL = new FieldFilter() { // @Override // public boolean isFieldValueValid(String fieldValue) { // return true; // } // }; // } // // Path: src/main/java/hudson/plugins/global_build_stats/FieldFilterFactory.java // public class FieldFilterFactory { // // /** // * @deprecated Use REGEX_FIELD_FILTER_LABEL instead of this field (since v5 GlobalBuildStats file format) // */ // @Deprecated // public static final String OLD_JOB_NAME_REGEX_LABEL = "jobNameRegex"; // public static final String ALL_VALUES_FILTER_LABEL = "ALL"; // public static final String REGEX_FIELD_FILTER_LABEL = "fieldRegex"; // // private static final Pattern REGEX_FIELD_FILTER_PATTERN = Pattern.compile(REGEX_FIELD_FILTER_LABEL+"\\((.*)\\)"); // private static final Pattern ALL_VALUES_FILTER_PATTERN = Pattern.compile(ALL_VALUES_FILTER_LABEL); // // public static FieldFilter createFieldFilter(String fieldFilter){ // if(fieldFilter == null || ALL_VALUES_FILTER_PATTERN.matcher(fieldFilter).matches()){ // return FieldFilter.ALL; // } else { // Matcher fieldFilterMatcher = REGEX_FIELD_FILTER_PATTERN.matcher(fieldFilter); // if(fieldFilterMatcher.matches()){ // return new RegexFieldFilter(fieldFilterMatcher.group(1)); // } else { // return FieldFilter.ALL; // } // } // } // }
import hudson.plugins.global_build_stats.FieldFilter; import hudson.plugins.global_build_stats.FieldFilterFactory; import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.ExportedBean;
package hudson.plugins.global_build_stats.model; @ExportedBean public class BuildSearchCriteria {
// Path: src/main/java/hudson/plugins/global_build_stats/FieldFilter.java // public interface FieldFilter { // // boolean isFieldValueValid(String fieldValue); // // public static final FieldFilter ALL = new FieldFilter() { // @Override // public boolean isFieldValueValid(String fieldValue) { // return true; // } // }; // } // // Path: src/main/java/hudson/plugins/global_build_stats/FieldFilterFactory.java // public class FieldFilterFactory { // // /** // * @deprecated Use REGEX_FIELD_FILTER_LABEL instead of this field (since v5 GlobalBuildStats file format) // */ // @Deprecated // public static final String OLD_JOB_NAME_REGEX_LABEL = "jobNameRegex"; // public static final String ALL_VALUES_FILTER_LABEL = "ALL"; // public static final String REGEX_FIELD_FILTER_LABEL = "fieldRegex"; // // private static final Pattern REGEX_FIELD_FILTER_PATTERN = Pattern.compile(REGEX_FIELD_FILTER_LABEL+"\\((.*)\\)"); // private static final Pattern ALL_VALUES_FILTER_PATTERN = Pattern.compile(ALL_VALUES_FILTER_LABEL); // // public static FieldFilter createFieldFilter(String fieldFilter){ // if(fieldFilter == null || ALL_VALUES_FILTER_PATTERN.matcher(fieldFilter).matches()){ // return FieldFilter.ALL; // } else { // Matcher fieldFilterMatcher = REGEX_FIELD_FILTER_PATTERN.matcher(fieldFilter); // if(fieldFilterMatcher.matches()){ // return new RegexFieldFilter(fieldFilterMatcher.group(1)); // } else { // return FieldFilter.ALL; // } // } // } // } // Path: src/main/java/hudson/plugins/global_build_stats/model/BuildSearchCriteria.java import hudson.plugins.global_build_stats.FieldFilter; import hudson.plugins.global_build_stats.FieldFilterFactory; import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.ExportedBean; package hudson.plugins.global_build_stats.model; @ExportedBean public class BuildSearchCriteria {
private String jobFilter = FieldFilterFactory.ALL_VALUES_FILTER_LABEL;
jenkinsci/global-build-stats-plugin
src/main/java/hudson/plugins/global_build_stats/model/BuildSearchCriteria.java
// Path: src/main/java/hudson/plugins/global_build_stats/FieldFilter.java // public interface FieldFilter { // // boolean isFieldValueValid(String fieldValue); // // public static final FieldFilter ALL = new FieldFilter() { // @Override // public boolean isFieldValueValid(String fieldValue) { // return true; // } // }; // } // // Path: src/main/java/hudson/plugins/global_build_stats/FieldFilterFactory.java // public class FieldFilterFactory { // // /** // * @deprecated Use REGEX_FIELD_FILTER_LABEL instead of this field (since v5 GlobalBuildStats file format) // */ // @Deprecated // public static final String OLD_JOB_NAME_REGEX_LABEL = "jobNameRegex"; // public static final String ALL_VALUES_FILTER_LABEL = "ALL"; // public static final String REGEX_FIELD_FILTER_LABEL = "fieldRegex"; // // private static final Pattern REGEX_FIELD_FILTER_PATTERN = Pattern.compile(REGEX_FIELD_FILTER_LABEL+"\\((.*)\\)"); // private static final Pattern ALL_VALUES_FILTER_PATTERN = Pattern.compile(ALL_VALUES_FILTER_LABEL); // // public static FieldFilter createFieldFilter(String fieldFilter){ // if(fieldFilter == null || ALL_VALUES_FILTER_PATTERN.matcher(fieldFilter).matches()){ // return FieldFilter.ALL; // } else { // Matcher fieldFilterMatcher = REGEX_FIELD_FILTER_PATTERN.matcher(fieldFilter); // if(fieldFilterMatcher.matches()){ // return new RegexFieldFilter(fieldFilterMatcher.group(1)); // } else { // return FieldFilter.ALL; // } // } // } // }
import hudson.plugins.global_build_stats.FieldFilter; import hudson.plugins.global_build_stats.FieldFilterFactory; import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.ExportedBean;
package hudson.plugins.global_build_stats.model; @ExportedBean public class BuildSearchCriteria { private String jobFilter = FieldFilterFactory.ALL_VALUES_FILTER_LABEL;
// Path: src/main/java/hudson/plugins/global_build_stats/FieldFilter.java // public interface FieldFilter { // // boolean isFieldValueValid(String fieldValue); // // public static final FieldFilter ALL = new FieldFilter() { // @Override // public boolean isFieldValueValid(String fieldValue) { // return true; // } // }; // } // // Path: src/main/java/hudson/plugins/global_build_stats/FieldFilterFactory.java // public class FieldFilterFactory { // // /** // * @deprecated Use REGEX_FIELD_FILTER_LABEL instead of this field (since v5 GlobalBuildStats file format) // */ // @Deprecated // public static final String OLD_JOB_NAME_REGEX_LABEL = "jobNameRegex"; // public static final String ALL_VALUES_FILTER_LABEL = "ALL"; // public static final String REGEX_FIELD_FILTER_LABEL = "fieldRegex"; // // private static final Pattern REGEX_FIELD_FILTER_PATTERN = Pattern.compile(REGEX_FIELD_FILTER_LABEL+"\\((.*)\\)"); // private static final Pattern ALL_VALUES_FILTER_PATTERN = Pattern.compile(ALL_VALUES_FILTER_LABEL); // // public static FieldFilter createFieldFilter(String fieldFilter){ // if(fieldFilter == null || ALL_VALUES_FILTER_PATTERN.matcher(fieldFilter).matches()){ // return FieldFilter.ALL; // } else { // Matcher fieldFilterMatcher = REGEX_FIELD_FILTER_PATTERN.matcher(fieldFilter); // if(fieldFilterMatcher.matches()){ // return new RegexFieldFilter(fieldFilterMatcher.group(1)); // } else { // return FieldFilter.ALL; // } // } // } // } // Path: src/main/java/hudson/plugins/global_build_stats/model/BuildSearchCriteria.java import hudson.plugins.global_build_stats.FieldFilter; import hudson.plugins.global_build_stats.FieldFilterFactory; import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.ExportedBean; package hudson.plugins.global_build_stats.model; @ExportedBean public class BuildSearchCriteria { private String jobFilter = FieldFilterFactory.ALL_VALUES_FILTER_LABEL;
transient FieldFilter calculatedJobFilter = null; // For calcul optimizations only
pabloo99/xmlsoccer
src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetMatchLineupsByFixtureMatchIdResponse.java
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetMatchLineupsXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "matchLineup", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // public class GetMatchLineupsXML { // // @XmlElement(name = "MatchLineup") // protected List<GetMatchLineupsXML.MatchLineup> matchLineup; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<GetMatchLineupsXML.MatchLineup> getMatchLineup() { // if (matchLineup == null) { // matchLineup = new ArrayList<GetMatchLineupsXML.MatchLineup>(); // } // return this.matchLineup; // } // // public String getAccountInformation() { // return accountInformation; // } // // public void setAccountInformation(String value) { // this.accountInformation = value; // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "fixtureMatchId", // "lineupType", // "participantName", // "teamId", // "teamName" // }) // @Data // public static class MatchLineup { // // @XmlElement(name = "FixtureMatchId") // protected int fixtureMatchId; // @XmlElement(name = "LineupType", required = true) // protected String lineupType; // @XmlElement(name = "ParticipantName", required = true) // protected String participantName; // @XmlElement(name = "TeamId") // protected short teamId; // @XmlElement(name = "TeamName", required = true) // protected String teamName; // } // }
import com.github.pabloo99.xmlsoccer.model.xml.GetMatchLineupsXML; import javax.xml.bind.annotation.*;
package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getMatchLineupsByFixtureMatchIdResult" }) @XmlRootElement(name = "GetMatchLineupsByFixtureMatchIdResponse", namespace = "http://xmlsoccer.com/") public class GetMatchLineupsByFixtureMatchIdResponse { @XmlElement(name = "GetMatchLineupsByFixtureMatchIdResult", namespace = "http://xmlsoccer.com/") protected GetMatchLineupsByFixtureMatchIdResponse.GetMatchLineupsByFixtureMatchIdResult getMatchLineupsByFixtureMatchIdResult; /** * Gets the value of the getMatchLineupsByFixtureMatchIdResult property. * * @return * possible object is * {@link GetMatchLineupsByFixtureMatchIdResponse.GetMatchLineupsByFixtureMatchIdResult } * */ public GetMatchLineupsByFixtureMatchIdResponse.GetMatchLineupsByFixtureMatchIdResult getGetMatchLineupsByFixtureMatchIdResult() { return getMatchLineupsByFixtureMatchIdResult; } /** * Sets the value of the getMatchLineupsByFixtureMatchIdResult property. * * @param value * allowed object is * {@link GetMatchLineupsByFixtureMatchIdResponse.GetMatchLineupsByFixtureMatchIdResult } * */ public void setGetMatchLineupsByFixtureMatchIdResult(GetMatchLineupsByFixtureMatchIdResponse.GetMatchLineupsByFixtureMatchIdResult value) { this.getMatchLineupsByFixtureMatchIdResult = value; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) public static class GetMatchLineupsByFixtureMatchIdResult {
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetMatchLineupsXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "matchLineup", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // public class GetMatchLineupsXML { // // @XmlElement(name = "MatchLineup") // protected List<GetMatchLineupsXML.MatchLineup> matchLineup; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<GetMatchLineupsXML.MatchLineup> getMatchLineup() { // if (matchLineup == null) { // matchLineup = new ArrayList<GetMatchLineupsXML.MatchLineup>(); // } // return this.matchLineup; // } // // public String getAccountInformation() { // return accountInformation; // } // // public void setAccountInformation(String value) { // this.accountInformation = value; // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "fixtureMatchId", // "lineupType", // "participantName", // "teamId", // "teamName" // }) // @Data // public static class MatchLineup { // // @XmlElement(name = "FixtureMatchId") // protected int fixtureMatchId; // @XmlElement(name = "LineupType", required = true) // protected String lineupType; // @XmlElement(name = "ParticipantName", required = true) // protected String participantName; // @XmlElement(name = "TeamId") // protected short teamId; // @XmlElement(name = "TeamName", required = true) // protected String teamName; // } // } // Path: src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetMatchLineupsByFixtureMatchIdResponse.java import com.github.pabloo99.xmlsoccer.model.xml.GetMatchLineupsXML; import javax.xml.bind.annotation.*; package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getMatchLineupsByFixtureMatchIdResult" }) @XmlRootElement(name = "GetMatchLineupsByFixtureMatchIdResponse", namespace = "http://xmlsoccer.com/") public class GetMatchLineupsByFixtureMatchIdResponse { @XmlElement(name = "GetMatchLineupsByFixtureMatchIdResult", namespace = "http://xmlsoccer.com/") protected GetMatchLineupsByFixtureMatchIdResponse.GetMatchLineupsByFixtureMatchIdResult getMatchLineupsByFixtureMatchIdResult; /** * Gets the value of the getMatchLineupsByFixtureMatchIdResult property. * * @return * possible object is * {@link GetMatchLineupsByFixtureMatchIdResponse.GetMatchLineupsByFixtureMatchIdResult } * */ public GetMatchLineupsByFixtureMatchIdResponse.GetMatchLineupsByFixtureMatchIdResult getGetMatchLineupsByFixtureMatchIdResult() { return getMatchLineupsByFixtureMatchIdResult; } /** * Sets the value of the getMatchLineupsByFixtureMatchIdResult property. * * @param value * allowed object is * {@link GetMatchLineupsByFixtureMatchIdResponse.GetMatchLineupsByFixtureMatchIdResult } * */ public void setGetMatchLineupsByFixtureMatchIdResult(GetMatchLineupsByFixtureMatchIdResponse.GetMatchLineupsByFixtureMatchIdResult value) { this.getMatchLineupsByFixtureMatchIdResult = value; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) public static class GetMatchLineupsByFixtureMatchIdResult {
@XmlElementRef(name="XMLSOCCER.COM", type=GetMatchLineupsXML.class)
pabloo99/xmlsoccer
src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetAllLeaguesResponse.java
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetAllLeaguesResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "league", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetAllLeaguesResultXML { // // @XmlElement(name = "League") // protected List<League> league; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<League> getLeague() { // return Optional.ofNullable(this.league). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "id", // "name", // "country", // "historicalData", // "fixtures", // "livescore", // "numberOfMatches", // "latestMatch" // }) // @Data // public static class League { // // @XmlElement(name = "Id") // protected int id; // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "Country", required = true) // protected String country; // @XmlElement(name = "Historical_Data", required = true) // protected String historicalData; // @XmlElement(name = "Fixtures", required = true) // protected String fixtures; // @XmlElement(name = "Livescore", required = true) // protected String livescore; // @XmlElement(name = "NumberOfMatches") // protected int numberOfMatches; // @XmlElement(name = "LatestMatch", required = true) // @XmlSchemaType(name = "dateTime") // protected Date latestMatch; // } // }
import com.github.pabloo99.xmlsoccer.model.xml.GetAllLeaguesResultXML; import javax.xml.bind.annotation.*;
package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getAllLeaguesResult" }) @XmlRootElement(name = "GetAllLeaguesResponse") public class GetAllLeaguesResponse { @XmlElement(name = "GetAllLeaguesResult") protected GetAllLeaguesResponse.GetAllLeaguesResult getAllLeaguesResult; /** * Gets the value of the getAllLeaguesResult property. * * @return * possible object is * {@link GetAllLeaguesResponse.GetAllLeaguesResult } * */ public GetAllLeaguesResponse.GetAllLeaguesResult getGetAllLeaguesResult() { return getAllLeaguesResult; } /** * Sets the value of the getAllLeaguesResult property. * * @param value * allowed object is * {@link GetAllLeaguesResponse.GetAllLeaguesResult } * */ public void setGetAllLeaguesResult(GetAllLeaguesResponse.GetAllLeaguesResult value) { this.getAllLeaguesResult = value; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) // @XmlRootElement(name = "League") // @XmlSeeAlso(GetAllLeaguesResultXML.class) public static class GetAllLeaguesResult { //@XmlMixed //@XmlAnyElement(lax = true)
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetAllLeaguesResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "league", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetAllLeaguesResultXML { // // @XmlElement(name = "League") // protected List<League> league; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<League> getLeague() { // return Optional.ofNullable(this.league). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "id", // "name", // "country", // "historicalData", // "fixtures", // "livescore", // "numberOfMatches", // "latestMatch" // }) // @Data // public static class League { // // @XmlElement(name = "Id") // protected int id; // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "Country", required = true) // protected String country; // @XmlElement(name = "Historical_Data", required = true) // protected String historicalData; // @XmlElement(name = "Fixtures", required = true) // protected String fixtures; // @XmlElement(name = "Livescore", required = true) // protected String livescore; // @XmlElement(name = "NumberOfMatches") // protected int numberOfMatches; // @XmlElement(name = "LatestMatch", required = true) // @XmlSchemaType(name = "dateTime") // protected Date latestMatch; // } // } // Path: src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetAllLeaguesResponse.java import com.github.pabloo99.xmlsoccer.model.xml.GetAllLeaguesResultXML; import javax.xml.bind.annotation.*; package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getAllLeaguesResult" }) @XmlRootElement(name = "GetAllLeaguesResponse") public class GetAllLeaguesResponse { @XmlElement(name = "GetAllLeaguesResult") protected GetAllLeaguesResponse.GetAllLeaguesResult getAllLeaguesResult; /** * Gets the value of the getAllLeaguesResult property. * * @return * possible object is * {@link GetAllLeaguesResponse.GetAllLeaguesResult } * */ public GetAllLeaguesResponse.GetAllLeaguesResult getGetAllLeaguesResult() { return getAllLeaguesResult; } /** * Sets the value of the getAllLeaguesResult property. * * @param value * allowed object is * {@link GetAllLeaguesResponse.GetAllLeaguesResult } * */ public void setGetAllLeaguesResult(GetAllLeaguesResponse.GetAllLeaguesResult value) { this.getAllLeaguesResult = value; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) // @XmlRootElement(name = "League") // @XmlSeeAlso(GetAllLeaguesResultXML.class) public static class GetAllLeaguesResult { //@XmlMixed //@XmlAnyElement(lax = true)
@XmlElementRef(name="XMLSOCCER.COM", type=GetAllLeaguesResultXML.class)
pabloo99/xmlsoccer
src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetMatchEventsByFixtureMatchIdResponse.java
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetMatchEventsXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "matchEvent", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // public class GetMatchEventsXML { // // @XmlElement(name = "MatchEvent") // protected List<GetMatchEventsXML.MatchEvent> matchEvent; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<GetMatchEventsXML.MatchEvent> getMatchEvent() { // if (matchEvent == null) { // matchEvent = new ArrayList<MatchEvent>(); // } // return this.matchEvent; // } // // public String getAccountInformation() { // return accountInformation; // } // // public void setAccountInformation(String value) { // this.accountInformation = value; // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "fixtureMatchId", // "participantName", // "eventName", // "teamId", // "teamName", // "elapsedTime", // "id" // }) // @Data // public static class MatchEvent { // // @XmlElement(name = "FixtureMatchId") // protected int fixtureMatchId; // @XmlElement(name = "ParticipantName") // protected String participantName; // @XmlElement(name = "EventName", required = true) // protected String eventName; // @XmlElement(name = "TeamId") // protected int teamId; // @XmlElement(name = "TeamName", required = true) // protected String teamName; // @XmlElement(name = "ElapsedTime") // protected int elapsedTime; // @XmlElement(name = "Id") // protected int id; // } // }
import com.github.pabloo99.xmlsoccer.model.xml.GetMatchEventsXML; import javax.xml.bind.annotation.*;
package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getMatchEventsByFixtureMatchIdResult" }) @XmlRootElement(name = "GetMatchEventsByFixtureMatchIdResponse") public class GetMatchEventsByFixtureMatchIdResponse { @XmlElement(name = "GetMatchEventsByFixtureMatchIdResult") protected GetMatchEventsByFixtureMatchIdResponse.GetMatchEventsByFixtureMatchIdResult getMatchEventsByFixtureMatchIdResult; /** * Gets the value of the getMatchEventsByFixtureMatchIdResult property. * * @return * possible object is * {@link GetMatchEventsByFixtureMatchIdResponse.GetMatchEventsByFixtureMatchIdResult } * */ public GetMatchEventsByFixtureMatchIdResponse.GetMatchEventsByFixtureMatchIdResult getGetMatchEventsByFixtureMatchIdResult() { return getMatchEventsByFixtureMatchIdResult; } /** * Sets the value of the getMatchEventsByFixtureMatchIdResult property. * * @param value * allowed object is * {@link GetMatchEventsByFixtureMatchIdResponse.GetMatchEventsByFixtureMatchIdResult } * */ public void setGetMatchEventsByFixtureMatchIdResult(GetMatchEventsByFixtureMatchIdResponse.GetMatchEventsByFixtureMatchIdResult value) { this.getMatchEventsByFixtureMatchIdResult = value; } /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;any/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) public static class GetMatchEventsByFixtureMatchIdResult {
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetMatchEventsXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "matchEvent", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // public class GetMatchEventsXML { // // @XmlElement(name = "MatchEvent") // protected List<GetMatchEventsXML.MatchEvent> matchEvent; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<GetMatchEventsXML.MatchEvent> getMatchEvent() { // if (matchEvent == null) { // matchEvent = new ArrayList<MatchEvent>(); // } // return this.matchEvent; // } // // public String getAccountInformation() { // return accountInformation; // } // // public void setAccountInformation(String value) { // this.accountInformation = value; // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "fixtureMatchId", // "participantName", // "eventName", // "teamId", // "teamName", // "elapsedTime", // "id" // }) // @Data // public static class MatchEvent { // // @XmlElement(name = "FixtureMatchId") // protected int fixtureMatchId; // @XmlElement(name = "ParticipantName") // protected String participantName; // @XmlElement(name = "EventName", required = true) // protected String eventName; // @XmlElement(name = "TeamId") // protected int teamId; // @XmlElement(name = "TeamName", required = true) // protected String teamName; // @XmlElement(name = "ElapsedTime") // protected int elapsedTime; // @XmlElement(name = "Id") // protected int id; // } // } // Path: src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetMatchEventsByFixtureMatchIdResponse.java import com.github.pabloo99.xmlsoccer.model.xml.GetMatchEventsXML; import javax.xml.bind.annotation.*; package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getMatchEventsByFixtureMatchIdResult" }) @XmlRootElement(name = "GetMatchEventsByFixtureMatchIdResponse") public class GetMatchEventsByFixtureMatchIdResponse { @XmlElement(name = "GetMatchEventsByFixtureMatchIdResult") protected GetMatchEventsByFixtureMatchIdResponse.GetMatchEventsByFixtureMatchIdResult getMatchEventsByFixtureMatchIdResult; /** * Gets the value of the getMatchEventsByFixtureMatchIdResult property. * * @return * possible object is * {@link GetMatchEventsByFixtureMatchIdResponse.GetMatchEventsByFixtureMatchIdResult } * */ public GetMatchEventsByFixtureMatchIdResponse.GetMatchEventsByFixtureMatchIdResult getGetMatchEventsByFixtureMatchIdResult() { return getMatchEventsByFixtureMatchIdResult; } /** * Sets the value of the getMatchEventsByFixtureMatchIdResult property. * * @param value * allowed object is * {@link GetMatchEventsByFixtureMatchIdResponse.GetMatchEventsByFixtureMatchIdResult } * */ public void setGetMatchEventsByFixtureMatchIdResult(GetMatchEventsByFixtureMatchIdResponse.GetMatchEventsByFixtureMatchIdResult value) { this.getMatchEventsByFixtureMatchIdResult = value; } /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;any/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) public static class GetMatchEventsByFixtureMatchIdResult {
@XmlElementRef(name="XMLSOCCER.COM", type=GetMatchEventsXML.class)
pabloo99/xmlsoccer
src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetTopScorersByLeagueAndSeasonResponse.java
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetTopScorersResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "topscorer", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetTopScorersResultXML { // // @XmlElement(name = "Topscorer") // protected List<Topscorer> topscorer; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<Topscorer> getTopscorer() { // return Optional.ofNullable(topscorer). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "rank", // "name", // "teamName", // "teamId", // "nationality", // "goals", // "firstScorer", // "penalties", // "missedPenalties" // }) // @Data // public static class Topscorer { // // @XmlElement(name = "Rank") // protected int rank; // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "TeamName", required = true) // protected String teamName; // @XmlElement(name = "Team_Id") // protected int teamId; // @XmlElement(name = "Nationality", required = true) // protected String nationality; // @XmlElement(name = "Goals") // protected int goals; // @XmlElement(name = "FirstScorer") // protected int firstScorer; // @XmlElement(name = "Penalties") // protected int penalties; // @XmlElement(name = "MissedPenalties") // protected int missedPenalties; // @XmlTransient // protected String leagueName; // @XmlTransient // protected String season; // @XmlTransient // protected int id; // } // }
import com.github.pabloo99.xmlsoccer.model.xml.GetTopScorersResultXML; import javax.xml.bind.annotation.*;
package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getTopScorersByLeagueAndSeasonResult" }) @XmlRootElement(name = "GetTopScorersByLeagueAndSeasonResponse") public class GetTopScorersByLeagueAndSeasonResponse { @XmlElement(name = "GetTopScorersByLeagueAndSeasonResult") protected GetTopScorersByLeagueAndSeasonResponse.GetTopScorersByLeagueAndSeasonResult getTopScorersByLeagueAndSeasonResult; /** * Gets the value of the getTopScorersByLeagueAndSeasonResult property. * * @return * possible object is * {@link GetTopScorersByLeagueAndSeasonResponse.GetTopScorersByLeagueAndSeasonResult } * */ public GetTopScorersByLeagueAndSeasonResponse.GetTopScorersByLeagueAndSeasonResult getGetTopScorersByLeagueAndSeasonResult() { return getTopScorersByLeagueAndSeasonResult; } /** * Sets the value of the getTopScorersByLeagueAndSeasonResult property. * * @param value * allowed object is * {@link GetTopScorersByLeagueAndSeasonResponse.GetTopScorersByLeagueAndSeasonResult } * */ public void setGetTopScorersByLeagueAndSeasonResult(GetTopScorersByLeagueAndSeasonResponse.GetTopScorersByLeagueAndSeasonResult value) { this.getTopScorersByLeagueAndSeasonResult = value; } public static class GetTopScorersByLeagueAndSeasonResult {
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetTopScorersResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "topscorer", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetTopScorersResultXML { // // @XmlElement(name = "Topscorer") // protected List<Topscorer> topscorer; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<Topscorer> getTopscorer() { // return Optional.ofNullable(topscorer). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "rank", // "name", // "teamName", // "teamId", // "nationality", // "goals", // "firstScorer", // "penalties", // "missedPenalties" // }) // @Data // public static class Topscorer { // // @XmlElement(name = "Rank") // protected int rank; // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "TeamName", required = true) // protected String teamName; // @XmlElement(name = "Team_Id") // protected int teamId; // @XmlElement(name = "Nationality", required = true) // protected String nationality; // @XmlElement(name = "Goals") // protected int goals; // @XmlElement(name = "FirstScorer") // protected int firstScorer; // @XmlElement(name = "Penalties") // protected int penalties; // @XmlElement(name = "MissedPenalties") // protected int missedPenalties; // @XmlTransient // protected String leagueName; // @XmlTransient // protected String season; // @XmlTransient // protected int id; // } // } // Path: src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetTopScorersByLeagueAndSeasonResponse.java import com.github.pabloo99.xmlsoccer.model.xml.GetTopScorersResultXML; import javax.xml.bind.annotation.*; package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getTopScorersByLeagueAndSeasonResult" }) @XmlRootElement(name = "GetTopScorersByLeagueAndSeasonResponse") public class GetTopScorersByLeagueAndSeasonResponse { @XmlElement(name = "GetTopScorersByLeagueAndSeasonResult") protected GetTopScorersByLeagueAndSeasonResponse.GetTopScorersByLeagueAndSeasonResult getTopScorersByLeagueAndSeasonResult; /** * Gets the value of the getTopScorersByLeagueAndSeasonResult property. * * @return * possible object is * {@link GetTopScorersByLeagueAndSeasonResponse.GetTopScorersByLeagueAndSeasonResult } * */ public GetTopScorersByLeagueAndSeasonResponse.GetTopScorersByLeagueAndSeasonResult getGetTopScorersByLeagueAndSeasonResult() { return getTopScorersByLeagueAndSeasonResult; } /** * Sets the value of the getTopScorersByLeagueAndSeasonResult property. * * @param value * allowed object is * {@link GetTopScorersByLeagueAndSeasonResponse.GetTopScorersByLeagueAndSeasonResult } * */ public void setGetTopScorersByLeagueAndSeasonResult(GetTopScorersByLeagueAndSeasonResponse.GetTopScorersByLeagueAndSeasonResult value) { this.getTopScorersByLeagueAndSeasonResult = value; } public static class GetTopScorersByLeagueAndSeasonResult {
@XmlElementRef(name="XMLSOCCER.COM", type=GetTopScorersResultXML.class)
pabloo99/xmlsoccer
src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetAllTeamsByLeagueAndSeasonResponse.java
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetAllTeamsByLeagueAndSeasonResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "team", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetAllTeamsByLeagueAndSeasonResultXML { // // @XmlElement(name = "Team", namespace = "http://xmlsoccer.com/Team") // protected List<Team> team; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<Team> getTeam() { // return Optional.ofNullable(team). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "teamId", // "name", // "country", // "stadium", // "homePageURL", // "wikiLink" // }) // @Data // public static class Team { // // @XmlElement(name = "Team_Id", namespace = "http://xmlsoccer.com/Team") // protected int teamId; // @XmlElement(name = "Name", required = true, namespace = "http://xmlsoccer.com/Team") // protected String name; // @XmlElement(name = "Country", required = true, namespace = "http://xmlsoccer.com/Team") // protected String country; // @XmlElement(name = "Stadium", required = true, namespace = "http://xmlsoccer.com/Team") // protected String stadium; // @XmlElement(name = "HomePageURL", required = true, namespace = "http://xmlsoccer.com/Team") // protected String homePageURL; // @XmlElement(name = "WIKILink", required = true, namespace = "http://xmlsoccer.com/Team") // protected String wikiLink; // } // } // // Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetAllTeamsResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "team", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetAllTeamsResultXML { // // @XmlElement(name = "Team") // protected List<Team> team; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<Team> getTeam() { // return Optional.ofNullable(team). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "teamId", // "name", // "country", // "stadium", // "homePageURL", // "wikiLink" // }) // @Data // public static class Team { // // @XmlElement(name = "Team_Id") // protected int teamId; // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "Country", required = true) // protected String country; // @XmlElement(name = "Stadium", required = true) // protected String stadium; // @XmlElement(name = "HomePageURL", required = true) // protected String homePageURL; // @XmlElement(name = "WIKILink", required = true) // protected String wikiLink; // } // }
import com.github.pabloo99.xmlsoccer.model.xml.GetAllTeamsByLeagueAndSeasonResultXML; import com.github.pabloo99.xmlsoccer.model.xml.GetAllTeamsResultXML; import javax.xml.bind.annotation.*;
package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getAllTeamsByLeagueAndSeasonResult" }) @XmlRootElement(name = "GetAllTeamsByLeagueAndSeasonResponse") public class GetAllTeamsByLeagueAndSeasonResponse { @XmlElement(name = "GetAllTeamsByLeagueAndSeasonResult") protected GetAllTeamsByLeagueAndSeasonResponse.GetAllTeamsByLeagueAndSeasonResult getAllTeamsByLeagueAndSeasonResult; /** * Gets the value of the getAllTeamsByLeagueAndSeasonResult property. * * @return * possible object is * {@link GetAllTeamsByLeagueAndSeasonResponse.GetAllTeamsByLeagueAndSeasonResult } * */ public GetAllTeamsByLeagueAndSeasonResponse.GetAllTeamsByLeagueAndSeasonResult getGetAllTeamsByLeagueAndSeasonResult() { return getAllTeamsByLeagueAndSeasonResult; } /** * Sets the value of the getAllTeamsByLeagueAndSeasonResult property. * * @param value * allowed object is * {@link GetAllTeamsByLeagueAndSeasonResponse.GetAllTeamsByLeagueAndSeasonResult } * */ public void setGetAllTeamsByLeagueAndSeasonResult(GetAllTeamsByLeagueAndSeasonResponse.GetAllTeamsByLeagueAndSeasonResult value) { this.getAllTeamsByLeagueAndSeasonResult = value; } public static class GetAllTeamsByLeagueAndSeasonResult {
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetAllTeamsByLeagueAndSeasonResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "team", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetAllTeamsByLeagueAndSeasonResultXML { // // @XmlElement(name = "Team", namespace = "http://xmlsoccer.com/Team") // protected List<Team> team; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<Team> getTeam() { // return Optional.ofNullable(team). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "teamId", // "name", // "country", // "stadium", // "homePageURL", // "wikiLink" // }) // @Data // public static class Team { // // @XmlElement(name = "Team_Id", namespace = "http://xmlsoccer.com/Team") // protected int teamId; // @XmlElement(name = "Name", required = true, namespace = "http://xmlsoccer.com/Team") // protected String name; // @XmlElement(name = "Country", required = true, namespace = "http://xmlsoccer.com/Team") // protected String country; // @XmlElement(name = "Stadium", required = true, namespace = "http://xmlsoccer.com/Team") // protected String stadium; // @XmlElement(name = "HomePageURL", required = true, namespace = "http://xmlsoccer.com/Team") // protected String homePageURL; // @XmlElement(name = "WIKILink", required = true, namespace = "http://xmlsoccer.com/Team") // protected String wikiLink; // } // } // // Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetAllTeamsResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "team", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetAllTeamsResultXML { // // @XmlElement(name = "Team") // protected List<Team> team; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<Team> getTeam() { // return Optional.ofNullable(team). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "teamId", // "name", // "country", // "stadium", // "homePageURL", // "wikiLink" // }) // @Data // public static class Team { // // @XmlElement(name = "Team_Id") // protected int teamId; // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "Country", required = true) // protected String country; // @XmlElement(name = "Stadium", required = true) // protected String stadium; // @XmlElement(name = "HomePageURL", required = true) // protected String homePageURL; // @XmlElement(name = "WIKILink", required = true) // protected String wikiLink; // } // } // Path: src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetAllTeamsByLeagueAndSeasonResponse.java import com.github.pabloo99.xmlsoccer.model.xml.GetAllTeamsByLeagueAndSeasonResultXML; import com.github.pabloo99.xmlsoccer.model.xml.GetAllTeamsResultXML; import javax.xml.bind.annotation.*; package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getAllTeamsByLeagueAndSeasonResult" }) @XmlRootElement(name = "GetAllTeamsByLeagueAndSeasonResponse") public class GetAllTeamsByLeagueAndSeasonResponse { @XmlElement(name = "GetAllTeamsByLeagueAndSeasonResult") protected GetAllTeamsByLeagueAndSeasonResponse.GetAllTeamsByLeagueAndSeasonResult getAllTeamsByLeagueAndSeasonResult; /** * Gets the value of the getAllTeamsByLeagueAndSeasonResult property. * * @return * possible object is * {@link GetAllTeamsByLeagueAndSeasonResponse.GetAllTeamsByLeagueAndSeasonResult } * */ public GetAllTeamsByLeagueAndSeasonResponse.GetAllTeamsByLeagueAndSeasonResult getGetAllTeamsByLeagueAndSeasonResult() { return getAllTeamsByLeagueAndSeasonResult; } /** * Sets the value of the getAllTeamsByLeagueAndSeasonResult property. * * @param value * allowed object is * {@link GetAllTeamsByLeagueAndSeasonResponse.GetAllTeamsByLeagueAndSeasonResult } * */ public void setGetAllTeamsByLeagueAndSeasonResult(GetAllTeamsByLeagueAndSeasonResponse.GetAllTeamsByLeagueAndSeasonResult value) { this.getAllTeamsByLeagueAndSeasonResult = value; } public static class GetAllTeamsByLeagueAndSeasonResult {
@XmlElementRef(name="XMLSOCCER.COM", type=GetAllTeamsByLeagueAndSeasonResultXML.class)
pabloo99/xmlsoccer
src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetAllTeamsResponse.java
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetAllTeamsResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "team", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetAllTeamsResultXML { // // @XmlElement(name = "Team") // protected List<Team> team; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<Team> getTeam() { // return Optional.ofNullable(team). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "teamId", // "name", // "country", // "stadium", // "homePageURL", // "wikiLink" // }) // @Data // public static class Team { // // @XmlElement(name = "Team_Id") // protected int teamId; // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "Country", required = true) // protected String country; // @XmlElement(name = "Stadium", required = true) // protected String stadium; // @XmlElement(name = "HomePageURL", required = true) // protected String homePageURL; // @XmlElement(name = "WIKILink", required = true) // protected String wikiLink; // } // }
import com.github.pabloo99.xmlsoccer.model.xml.GetAllTeamsResultXML; import javax.xml.bind.annotation.*;
package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getAllTeamsResult" }) @XmlRootElement(name = "GetAllTeamsResponse") public class GetAllTeamsResponse { @XmlElement(name = "GetAllTeamsResult") protected GetAllTeamsResponse.GetAllTeamsResult getAllTeamsResult; /** * Gets the value of the getAllTeamsResult property. * * @return * possible object is * {@link GetAllTeamsResponse.GetAllTeamsResult } * */ public GetAllTeamsResponse.GetAllTeamsResult getGetAllTeamsResult() { return getAllTeamsResult; } /** * Sets the value of the getAllTeamsResult property. * * @param value * allowed object is * {@link GetAllTeamsResponse.GetAllTeamsResult } * */ public void setGetAllTeamsResult(GetAllTeamsResponse.GetAllTeamsResult value) { this.getAllTeamsResult = value; } public static class GetAllTeamsResult {
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetAllTeamsResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "team", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetAllTeamsResultXML { // // @XmlElement(name = "Team") // protected List<Team> team; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<Team> getTeam() { // return Optional.ofNullable(team). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "teamId", // "name", // "country", // "stadium", // "homePageURL", // "wikiLink" // }) // @Data // public static class Team { // // @XmlElement(name = "Team_Id") // protected int teamId; // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "Country", required = true) // protected String country; // @XmlElement(name = "Stadium", required = true) // protected String stadium; // @XmlElement(name = "HomePageURL", required = true) // protected String homePageURL; // @XmlElement(name = "WIKILink", required = true) // protected String wikiLink; // } // } // Path: src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetAllTeamsResponse.java import com.github.pabloo99.xmlsoccer.model.xml.GetAllTeamsResultXML; import javax.xml.bind.annotation.*; package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getAllTeamsResult" }) @XmlRootElement(name = "GetAllTeamsResponse") public class GetAllTeamsResponse { @XmlElement(name = "GetAllTeamsResult") protected GetAllTeamsResponse.GetAllTeamsResult getAllTeamsResult; /** * Gets the value of the getAllTeamsResult property. * * @return * possible object is * {@link GetAllTeamsResponse.GetAllTeamsResult } * */ public GetAllTeamsResponse.GetAllTeamsResult getGetAllTeamsResult() { return getAllTeamsResult; } /** * Sets the value of the getAllTeamsResult property. * * @param value * allowed object is * {@link GetAllTeamsResponse.GetAllTeamsResult } * */ public void setGetAllTeamsResult(GetAllTeamsResponse.GetAllTeamsResult value) { this.getAllTeamsResult = value; } public static class GetAllTeamsResult {
@XmlElementRef(name="XMLSOCCER.COM", type=GetAllTeamsResultXML.class)
pabloo99/xmlsoccer
src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetPlayerByIdResponse.java
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetPlayersByTeamResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "player", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetPlayersByTeamResultXML { // // @XmlElement(name = "Player") // protected List<Player> player; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<Player> getPlayer() { // return Optional.ofNullable(player). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "id", // "name", // "height", // "weight", // "nationality", // "position", // "teamId", // "loanTo", // "playerNumber", // "dateOfBirth", // "dateOfSigning", // "signing" // }) // @Data // public static class Player { // // @XmlElement(name = "Id") // protected Integer id; // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "Height") // protected Double height; // @XmlElement(name = "Weight") // protected Double weight; // @XmlElement(name = "Nationality", required = true) // protected String nationality; // @XmlElement(name = "Position", required = true) // protected String position; // @XmlElement(name = "Team_Id") // protected Integer teamId; // @XmlElement(name = "LoadTo") // protected Integer loanTo; // @XmlElement(name = "PlayerNumber") // protected Integer playerNumber; // @XmlElement(name = "DateOfBirth", required = true) // @XmlSchemaType(name = "dateTime") // protected Date dateOfBirth; // @XmlElement(name = "DateOfSigning", required = true) // @XmlSchemaType(name = "dateTime") // protected Date dateOfSigning; // @XmlElement(name = "Signing", required = true) // protected String signing; // } // }
import com.github.pabloo99.xmlsoccer.model.xml.GetPlayersByTeamResultXML; import javax.xml.bind.annotation.*; import java.util.Collections; import java.util.Optional;
package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getPlayerByIdResult" }) @XmlRootElement(name = "GetPlayerByIdResponse") public class GetPlayerByIdResponse { @XmlElement(name = "GetPlayerByIdResult") protected GetPlayerByIdResponse.GetPlayerByIdResult getPlayerByIdResult; /** * Gets the value of the getPlayerByIdResult property. * * @return possible object is * {@link GetPlayerByIdResponse.GetPlayerByIdResult } */ public GetPlayerByIdResponse.GetPlayerByIdResult getGetPlayerByIdResult() { return getPlayerByIdResult; } /** * Sets the value of the getPlayerByIdResult property. * * @param value allowed object is * {@link GetPlayerByIdResponse.GetPlayerByIdResult } */ public void setGetPlayerByIdResult(GetPlayerByIdResponse.GetPlayerByIdResult value) { this.getPlayerByIdResult = value; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) public static class GetPlayerByIdResult {
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetPlayersByTeamResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "player", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetPlayersByTeamResultXML { // // @XmlElement(name = "Player") // protected List<Player> player; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<Player> getPlayer() { // return Optional.ofNullable(player). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "id", // "name", // "height", // "weight", // "nationality", // "position", // "teamId", // "loanTo", // "playerNumber", // "dateOfBirth", // "dateOfSigning", // "signing" // }) // @Data // public static class Player { // // @XmlElement(name = "Id") // protected Integer id; // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "Height") // protected Double height; // @XmlElement(name = "Weight") // protected Double weight; // @XmlElement(name = "Nationality", required = true) // protected String nationality; // @XmlElement(name = "Position", required = true) // protected String position; // @XmlElement(name = "Team_Id") // protected Integer teamId; // @XmlElement(name = "LoadTo") // protected Integer loanTo; // @XmlElement(name = "PlayerNumber") // protected Integer playerNumber; // @XmlElement(name = "DateOfBirth", required = true) // @XmlSchemaType(name = "dateTime") // protected Date dateOfBirth; // @XmlElement(name = "DateOfSigning", required = true) // @XmlSchemaType(name = "dateTime") // protected Date dateOfSigning; // @XmlElement(name = "Signing", required = true) // protected String signing; // } // } // Path: src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetPlayerByIdResponse.java import com.github.pabloo99.xmlsoccer.model.xml.GetPlayersByTeamResultXML; import javax.xml.bind.annotation.*; import java.util.Collections; import java.util.Optional; package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getPlayerByIdResult" }) @XmlRootElement(name = "GetPlayerByIdResponse") public class GetPlayerByIdResponse { @XmlElement(name = "GetPlayerByIdResult") protected GetPlayerByIdResponse.GetPlayerByIdResult getPlayerByIdResult; /** * Gets the value of the getPlayerByIdResult property. * * @return possible object is * {@link GetPlayerByIdResponse.GetPlayerByIdResult } */ public GetPlayerByIdResponse.GetPlayerByIdResult getGetPlayerByIdResult() { return getPlayerByIdResult; } /** * Sets the value of the getPlayerByIdResult property. * * @param value allowed object is * {@link GetPlayerByIdResponse.GetPlayerByIdResult } */ public void setGetPlayerByIdResult(GetPlayerByIdResponse.GetPlayerByIdResult value) { this.getPlayerByIdResult = value; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) public static class GetPlayerByIdResult {
@XmlElementRef(name = "XMLSOCCER.COM", type = GetPlayersByTeamResultXML.class)
pabloo99/xmlsoccer
src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetPlayersByTeamResponse.java
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetPlayersByTeamResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "player", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetPlayersByTeamResultXML { // // @XmlElement(name = "Player") // protected List<Player> player; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<Player> getPlayer() { // return Optional.ofNullable(player). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "id", // "name", // "height", // "weight", // "nationality", // "position", // "teamId", // "loanTo", // "playerNumber", // "dateOfBirth", // "dateOfSigning", // "signing" // }) // @Data // public static class Player { // // @XmlElement(name = "Id") // protected Integer id; // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "Height") // protected Double height; // @XmlElement(name = "Weight") // protected Double weight; // @XmlElement(name = "Nationality", required = true) // protected String nationality; // @XmlElement(name = "Position", required = true) // protected String position; // @XmlElement(name = "Team_Id") // protected Integer teamId; // @XmlElement(name = "LoadTo") // protected Integer loanTo; // @XmlElement(name = "PlayerNumber") // protected Integer playerNumber; // @XmlElement(name = "DateOfBirth", required = true) // @XmlSchemaType(name = "dateTime") // protected Date dateOfBirth; // @XmlElement(name = "DateOfSigning", required = true) // @XmlSchemaType(name = "dateTime") // protected Date dateOfSigning; // @XmlElement(name = "Signing", required = true) // protected String signing; // } // }
import com.github.pabloo99.xmlsoccer.model.xml.GetPlayersByTeamResultXML; import javax.xml.bind.annotation.*;
package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getPlayersByTeamResult" }) @XmlRootElement(name = "GetPlayersByTeamResponse") public class GetPlayersByTeamResponse { @XmlElement(name = "GetPlayersByTeamResult") protected GetPlayersByTeamResponse.GetPlayersByTeamResult getPlayersByTeamResult; /** * Gets the value of the getPlayersByTeamResult property. * * @return * possible object is * {@link GetPlayersByTeamResponse.GetPlayersByTeamResult } * */ public GetPlayersByTeamResponse.GetPlayersByTeamResult getGetPlayersByTeamResult() { return getPlayersByTeamResult; } /** * Sets the value of the getPlayersByTeamResult property. * * @param value * allowed object is * {@link GetPlayersByTeamResponse.GetPlayersByTeamResult } * */ public void setGetPlayersByTeamResult(GetPlayersByTeamResponse.GetPlayersByTeamResult value) { this.getPlayersByTeamResult = value; } public static class GetPlayersByTeamResult {
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetPlayersByTeamResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "player", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetPlayersByTeamResultXML { // // @XmlElement(name = "Player") // protected List<Player> player; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<Player> getPlayer() { // return Optional.ofNullable(player). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "id", // "name", // "height", // "weight", // "nationality", // "position", // "teamId", // "loanTo", // "playerNumber", // "dateOfBirth", // "dateOfSigning", // "signing" // }) // @Data // public static class Player { // // @XmlElement(name = "Id") // protected Integer id; // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "Height") // protected Double height; // @XmlElement(name = "Weight") // protected Double weight; // @XmlElement(name = "Nationality", required = true) // protected String nationality; // @XmlElement(name = "Position", required = true) // protected String position; // @XmlElement(name = "Team_Id") // protected Integer teamId; // @XmlElement(name = "LoadTo") // protected Integer loanTo; // @XmlElement(name = "PlayerNumber") // protected Integer playerNumber; // @XmlElement(name = "DateOfBirth", required = true) // @XmlSchemaType(name = "dateTime") // protected Date dateOfBirth; // @XmlElement(name = "DateOfSigning", required = true) // @XmlSchemaType(name = "dateTime") // protected Date dateOfSigning; // @XmlElement(name = "Signing", required = true) // protected String signing; // } // } // Path: src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetPlayersByTeamResponse.java import com.github.pabloo99.xmlsoccer.model.xml.GetPlayersByTeamResultXML; import javax.xml.bind.annotation.*; package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getPlayersByTeamResult" }) @XmlRootElement(name = "GetPlayersByTeamResponse") public class GetPlayersByTeamResponse { @XmlElement(name = "GetPlayersByTeamResult") protected GetPlayersByTeamResponse.GetPlayersByTeamResult getPlayersByTeamResult; /** * Gets the value of the getPlayersByTeamResult property. * * @return * possible object is * {@link GetPlayersByTeamResponse.GetPlayersByTeamResult } * */ public GetPlayersByTeamResponse.GetPlayersByTeamResult getGetPlayersByTeamResult() { return getPlayersByTeamResult; } /** * Sets the value of the getPlayersByTeamResult property. * * @param value * allowed object is * {@link GetPlayersByTeamResponse.GetPlayersByTeamResult } * */ public void setGetPlayersByTeamResult(GetPlayersByTeamResponse.GetPlayersByTeamResult value) { this.getPlayersByTeamResult = value; } public static class GetPlayersByTeamResult {
@XmlElementRef(name="XMLSOCCER.COM", type=GetPlayersByTeamResultXML.class)
pabloo99/xmlsoccer
src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetTeamResponse.java
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetTeamResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "team", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetTeamResultXML { // // @XmlElement(name = "Team", required = true) // protected GetTeamResultXML.Team team; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "id", // "name", // "stadium", // "website", // "wikiPageUrl", // "country", // "capacity", // "manager" // }) // @Data // public static class Team { // // @XmlElement(name = "Id") // protected short id; // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "Stadium", required = true) // protected String stadium; // @XmlElement(name = "Website", required = true) // @XmlSchemaType(name = "anyURI") // protected String website; // @XmlElement(name = "WikiPageUrl", required = true) // @XmlSchemaType(name = "anyURI") // protected String wikiPageUrl; // @XmlElement(name = "Country", required = true) // protected String country; // @XmlElement(name = "Capacity") // protected Integer capacity; // @XmlElement(name = "Manager") // protected String manager; // } // }
import com.github.pabloo99.xmlsoccer.model.xml.GetTeamResultXML; import javax.xml.bind.annotation.*; import java.util.Collections; import java.util.Optional;
package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getTeamResult" }) @XmlRootElement(name = "GetTeamResponse") public class GetTeamResponse { @XmlElement(name = "GetTeamResult") protected GetTeamResponse.GetTeamResult getTeamResult; /** * Gets the value of the getTeamResult property. * * @return possible object is * {@link GetTeamResponse.GetTeamResult } */ public GetTeamResponse.GetTeamResult getGetTeamResult() { return getTeamResult; } /** * Sets the value of the getTeamResult property. * * @param value allowed object is * {@link GetTeamResponse.GetTeamResult } */ public void setGetTeamResult(GetTeamResponse.GetTeamResult value) { this.getTeamResult = value; } public static class GetTeamResult {
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetTeamResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "team", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetTeamResultXML { // // @XmlElement(name = "Team", required = true) // protected GetTeamResultXML.Team team; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "id", // "name", // "stadium", // "website", // "wikiPageUrl", // "country", // "capacity", // "manager" // }) // @Data // public static class Team { // // @XmlElement(name = "Id") // protected short id; // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "Stadium", required = true) // protected String stadium; // @XmlElement(name = "Website", required = true) // @XmlSchemaType(name = "anyURI") // protected String website; // @XmlElement(name = "WikiPageUrl", required = true) // @XmlSchemaType(name = "anyURI") // protected String wikiPageUrl; // @XmlElement(name = "Country", required = true) // protected String country; // @XmlElement(name = "Capacity") // protected Integer capacity; // @XmlElement(name = "Manager") // protected String manager; // } // } // Path: src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetTeamResponse.java import com.github.pabloo99.xmlsoccer.model.xml.GetTeamResultXML; import javax.xml.bind.annotation.*; import java.util.Collections; import java.util.Optional; package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getTeamResult" }) @XmlRootElement(name = "GetTeamResponse") public class GetTeamResponse { @XmlElement(name = "GetTeamResult") protected GetTeamResponse.GetTeamResult getTeamResult; /** * Gets the value of the getTeamResult property. * * @return possible object is * {@link GetTeamResponse.GetTeamResult } */ public GetTeamResponse.GetTeamResult getGetTeamResult() { return getTeamResult; } /** * Sets the value of the getTeamResult property. * * @param value allowed object is * {@link GetTeamResponse.GetTeamResult } */ public void setGetTeamResult(GetTeamResponse.GetTeamResult value) { this.getTeamResult = value; } public static class GetTeamResult {
@XmlElementRef(name = "XMLSOCCER.COM", type = GetTeamResultXML.class)
pabloo99/xmlsoccer
src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetNextMatchOddsByLeagueResponse.java
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetNextMatchOddsByLeagueResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "odds", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // public class GetNextMatchOddsByLeagueResultXML { // // @XmlElement(name = "Odds", required = true) // protected List<Odds> odds; // @XmlElement(name = "AccountInformation", required = true) // protected List<String> accountInformation; // // public List<Odds> getOdds() { // if (odds == null) { // odds = new ArrayList<>(); // } // return this.odds; // } // // public List<String> getAccountInformation() { // if (accountInformation == null) { // accountInformation = new ArrayList<>(); // } // return this.accountInformation; // } // // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "fixtureMatchId", // "dateCreate", // "bookmaker" // }) // @Data // public static class Odds { // // @XmlElement(name = "FixtureMatch_Id") // protected int fixtureMatchId; // @XmlElement(name = "Date_Create", required = true) // protected String dateCreate; // @XmlElement(name = "Bookmaker", required = true) // protected List<Odds.Bookmaker> bookmaker; // // public List<Odds.Bookmaker> getBookmaker() { // if (bookmaker == null) { // bookmaker = new ArrayList<>(); // } // return this.bookmaker; // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "name", // "url", // "home", // "draw", // "away" // }) // @Data // public static class Bookmaker { // // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "URL", required = true) // protected String url; // @XmlElement(name = "Home") // protected double home; // @XmlElement(name = "Draw") // protected double draw; // @XmlElement(name = "Away") // protected double away; // } // // } // // }
import com.github.pabloo99.xmlsoccer.model.xml.GetNextMatchOddsByLeagueResultXML; import javax.xml.bind.annotation.*;
package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getNextMatchOddsByLeagueResult" }) @XmlRootElement(name = "GetNextMatchOddsByLeagueResponse") public class GetNextMatchOddsByLeagueResponse { @XmlElement(name = "GetNextMatchOddsByLeagueResult") protected GetNextMatchOddsByLeagueResponse.GetNextMatchOddsByLeagueResult getNextMatchOddsByLeagueResult; /** * Gets the value of the getNextMatchOddsByLeagueResult property. * * @return * possible object is * {@link GetNextMatchOddsByLeagueResponse.GetNextMatchOddsByLeagueResult } * */ public GetNextMatchOddsByLeagueResponse.GetNextMatchOddsByLeagueResult getGetNextMatchOddsByLeagueResult() { return getNextMatchOddsByLeagueResult; } /** * Sets the value of the getNextMatchOddsByLeagueResult property. * * @param value * allowed object is * {@link GetNextMatchOddsByLeagueResponse.GetNextMatchOddsByLeagueResult } * */ public void setGetNextMatchOddsByLeagueResult(GetNextMatchOddsByLeagueResponse.GetNextMatchOddsByLeagueResult value) { this.getNextMatchOddsByLeagueResult = value; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) public static class GetNextMatchOddsByLeagueResult {
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetNextMatchOddsByLeagueResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "odds", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // public class GetNextMatchOddsByLeagueResultXML { // // @XmlElement(name = "Odds", required = true) // protected List<Odds> odds; // @XmlElement(name = "AccountInformation", required = true) // protected List<String> accountInformation; // // public List<Odds> getOdds() { // if (odds == null) { // odds = new ArrayList<>(); // } // return this.odds; // } // // public List<String> getAccountInformation() { // if (accountInformation == null) { // accountInformation = new ArrayList<>(); // } // return this.accountInformation; // } // // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "fixtureMatchId", // "dateCreate", // "bookmaker" // }) // @Data // public static class Odds { // // @XmlElement(name = "FixtureMatch_Id") // protected int fixtureMatchId; // @XmlElement(name = "Date_Create", required = true) // protected String dateCreate; // @XmlElement(name = "Bookmaker", required = true) // protected List<Odds.Bookmaker> bookmaker; // // public List<Odds.Bookmaker> getBookmaker() { // if (bookmaker == null) { // bookmaker = new ArrayList<>(); // } // return this.bookmaker; // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "name", // "url", // "home", // "draw", // "away" // }) // @Data // public static class Bookmaker { // // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "URL", required = true) // protected String url; // @XmlElement(name = "Home") // protected double home; // @XmlElement(name = "Draw") // protected double draw; // @XmlElement(name = "Away") // protected double away; // } // // } // // } // Path: src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetNextMatchOddsByLeagueResponse.java import com.github.pabloo99.xmlsoccer.model.xml.GetNextMatchOddsByLeagueResultXML; import javax.xml.bind.annotation.*; package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getNextMatchOddsByLeagueResult" }) @XmlRootElement(name = "GetNextMatchOddsByLeagueResponse") public class GetNextMatchOddsByLeagueResponse { @XmlElement(name = "GetNextMatchOddsByLeagueResult") protected GetNextMatchOddsByLeagueResponse.GetNextMatchOddsByLeagueResult getNextMatchOddsByLeagueResult; /** * Gets the value of the getNextMatchOddsByLeagueResult property. * * @return * possible object is * {@link GetNextMatchOddsByLeagueResponse.GetNextMatchOddsByLeagueResult } * */ public GetNextMatchOddsByLeagueResponse.GetNextMatchOddsByLeagueResult getGetNextMatchOddsByLeagueResult() { return getNextMatchOddsByLeagueResult; } /** * Sets the value of the getNextMatchOddsByLeagueResult property. * * @param value * allowed object is * {@link GetNextMatchOddsByLeagueResponse.GetNextMatchOddsByLeagueResult } * */ public void setGetNextMatchOddsByLeagueResult(GetNextMatchOddsByLeagueResponse.GetNextMatchOddsByLeagueResult value) { this.getNextMatchOddsByLeagueResult = value; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) public static class GetNextMatchOddsByLeagueResult {
@XmlElementRef(name="XMLSOCCER.COM", type=GetNextMatchOddsByLeagueResultXML.class)
pabloo99/xmlsoccer
src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetEarliestMatchDatePerLeagueResponse.java
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetEarliestMatchDatePerLeagueXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "leagueInformation", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetEarliestMatchDatePerLeagueXML { // // @XmlElement(name = "LeagueInformation", required = true) // protected GetEarliestMatchDatePerLeagueXML.LeagueInformation leagueInformation; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "date" // }) // @Data // public static class LeagueInformation { // // @XmlElement(name = "Date", required = true) // @XmlSchemaType(name = "dateTime") // protected XMLGregorianCalendar date; // } // // }
import com.github.pabloo99.xmlsoccer.model.xml.GetEarliestMatchDatePerLeagueXML; import javax.xml.bind.annotation.*;
package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getEarliestMatchDatePerLeagueResult" }) @XmlRootElement(name = "GetEarliestMatchDatePerLeagueResponse") public class GetEarliestMatchDatePerLeagueResponse { @XmlElement(name = "GetEarliestMatchDatePerLeagueResult") protected GetEarliestMatchDatePerLeagueResponse.GetEarliestMatchDatePerLeagueResult getEarliestMatchDatePerLeagueResult; /** * Gets the value of the getEarliestMatchDatePerLeagueResult property. * * @return * possible object is * {@link GetEarliestMatchDatePerLeagueResponse.GetEarliestMatchDatePerLeagueResult } * */ public GetEarliestMatchDatePerLeagueResponse.GetEarliestMatchDatePerLeagueResult getGetEarliestMatchDatePerLeagueResult() { return getEarliestMatchDatePerLeagueResult; } /** * Sets the value of the getEarliestMatchDatePerLeagueResult property. * * @param value * allowed object is * {@link GetEarliestMatchDatePerLeagueResponse.GetEarliestMatchDatePerLeagueResult } * */ public void setGetEarliestMatchDatePerLeagueResult(GetEarliestMatchDatePerLeagueResponse.GetEarliestMatchDatePerLeagueResult value) { this.getEarliestMatchDatePerLeagueResult = value; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) public static class GetEarliestMatchDatePerLeagueResult {
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetEarliestMatchDatePerLeagueXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "leagueInformation", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetEarliestMatchDatePerLeagueXML { // // @XmlElement(name = "LeagueInformation", required = true) // protected GetEarliestMatchDatePerLeagueXML.LeagueInformation leagueInformation; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "date" // }) // @Data // public static class LeagueInformation { // // @XmlElement(name = "Date", required = true) // @XmlSchemaType(name = "dateTime") // protected XMLGregorianCalendar date; // } // // } // Path: src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetEarliestMatchDatePerLeagueResponse.java import com.github.pabloo99.xmlsoccer.model.xml.GetEarliestMatchDatePerLeagueXML; import javax.xml.bind.annotation.*; package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getEarliestMatchDatePerLeagueResult" }) @XmlRootElement(name = "GetEarliestMatchDatePerLeagueResponse") public class GetEarliestMatchDatePerLeagueResponse { @XmlElement(name = "GetEarliestMatchDatePerLeagueResult") protected GetEarliestMatchDatePerLeagueResponse.GetEarliestMatchDatePerLeagueResult getEarliestMatchDatePerLeagueResult; /** * Gets the value of the getEarliestMatchDatePerLeagueResult property. * * @return * possible object is * {@link GetEarliestMatchDatePerLeagueResponse.GetEarliestMatchDatePerLeagueResult } * */ public GetEarliestMatchDatePerLeagueResponse.GetEarliestMatchDatePerLeagueResult getGetEarliestMatchDatePerLeagueResult() { return getEarliestMatchDatePerLeagueResult; } /** * Sets the value of the getEarliestMatchDatePerLeagueResult property. * * @param value * allowed object is * {@link GetEarliestMatchDatePerLeagueResponse.GetEarliestMatchDatePerLeagueResult } * */ public void setGetEarliestMatchDatePerLeagueResult(GetEarliestMatchDatePerLeagueResponse.GetEarliestMatchDatePerLeagueResult value) { this.getEarliestMatchDatePerLeagueResult = value; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) public static class GetEarliestMatchDatePerLeagueResult {
@XmlElementRef(name="XMLSOCCER.COM", type=GetEarliestMatchDatePerLeagueXML.class)
pabloo99/xmlsoccer
src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetAllOddsByFixtureMatchIdResponse.java
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetAllOddsXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "oddsList", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetAllOddsXML { // // @XmlElement(name = "OddsList", required = true) // protected OddsList oddsList; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public OddsList getOddsList() { // return Optional.ofNullable(oddsList). // orElse(new OddsList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "odds" // }) // public static class OddsList { // // @XmlElement(name = "Odds") // protected List<Odds> odds; // // public List<Odds> getOdds() { // return Optional.ofNullable(odds). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "fixtureMatchId", // "bookmaker", // "updatedDate", // "type", // "homeOdds", // "drawOdds", // "awayOdds", // "handicap" // }) // @Data // public static class Odds { // // @XmlElement(name = "FixtureMatch_Id") // protected int fixtureMatchId; // @XmlElement(name = "Bookmaker", required = true) // protected String bookmaker; // @XmlElement(name = "UpdatedDate", required = true) // @XmlSchemaType(name = "dateTime") // protected XMLGregorianCalendar updatedDate; // @XmlElement(name = "Type", required = true) // protected String type; // @XmlElement(name = "HomeOdds") // protected float homeOdds; // @XmlElement(name = "DrawOdds") // protected float drawOdds; // @XmlElement(name = "AwayOdds") // protected float awayOdds; // @XmlElement(name = "Handicap") // protected float handicap; // } // // } // // }
import com.github.pabloo99.xmlsoccer.model.xml.GetAllOddsXML; import javax.xml.bind.annotation.*; import java.util.Optional;
package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getAllOddsByFixtureMatchIdResult" }) @XmlRootElement(name = "GetAllOddsByFixtureMatchIdResponse") public class GetAllOddsByFixtureMatchIdResponse { @XmlElement(name = "GetAllOddsByFixtureMatchIdResult") protected GetAllOddsByFixtureMatchIdResponse.GetAllOddsByFixtureMatchIdResult getAllOddsByFixtureMatchIdResult; /** * Gets the value of the getAllOddsByFixtureMatchIdResult property. * * @return * possible object is * {@link GetAllOddsByFixtureMatchIdResponse.GetAllOddsByFixtureMatchIdResult } * */ public GetAllOddsByFixtureMatchIdResponse.GetAllOddsByFixtureMatchIdResult getGetAllOddsByFixtureMatchIdResult() { return getAllOddsByFixtureMatchIdResult; } /** * Sets the value of the getAllOddsByFixtureMatchIdResult property. * * @param value * allowed object is * {@link GetAllOddsByFixtureMatchIdResponse.GetAllOddsByFixtureMatchIdResult } * */ public void setGetAllOddsByFixtureMatchIdResult(GetAllOddsByFixtureMatchIdResponse.GetAllOddsByFixtureMatchIdResult value) { this.getAllOddsByFixtureMatchIdResult = value; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) public static class GetAllOddsByFixtureMatchIdResult {
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetAllOddsXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "oddsList", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetAllOddsXML { // // @XmlElement(name = "OddsList", required = true) // protected OddsList oddsList; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public OddsList getOddsList() { // return Optional.ofNullable(oddsList). // orElse(new OddsList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "odds" // }) // public static class OddsList { // // @XmlElement(name = "Odds") // protected List<Odds> odds; // // public List<Odds> getOdds() { // return Optional.ofNullable(odds). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "fixtureMatchId", // "bookmaker", // "updatedDate", // "type", // "homeOdds", // "drawOdds", // "awayOdds", // "handicap" // }) // @Data // public static class Odds { // // @XmlElement(name = "FixtureMatch_Id") // protected int fixtureMatchId; // @XmlElement(name = "Bookmaker", required = true) // protected String bookmaker; // @XmlElement(name = "UpdatedDate", required = true) // @XmlSchemaType(name = "dateTime") // protected XMLGregorianCalendar updatedDate; // @XmlElement(name = "Type", required = true) // protected String type; // @XmlElement(name = "HomeOdds") // protected float homeOdds; // @XmlElement(name = "DrawOdds") // protected float drawOdds; // @XmlElement(name = "AwayOdds") // protected float awayOdds; // @XmlElement(name = "Handicap") // protected float handicap; // } // // } // // } // Path: src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetAllOddsByFixtureMatchIdResponse.java import com.github.pabloo99.xmlsoccer.model.xml.GetAllOddsXML; import javax.xml.bind.annotation.*; import java.util.Optional; package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getAllOddsByFixtureMatchIdResult" }) @XmlRootElement(name = "GetAllOddsByFixtureMatchIdResponse") public class GetAllOddsByFixtureMatchIdResponse { @XmlElement(name = "GetAllOddsByFixtureMatchIdResult") protected GetAllOddsByFixtureMatchIdResponse.GetAllOddsByFixtureMatchIdResult getAllOddsByFixtureMatchIdResult; /** * Gets the value of the getAllOddsByFixtureMatchIdResult property. * * @return * possible object is * {@link GetAllOddsByFixtureMatchIdResponse.GetAllOddsByFixtureMatchIdResult } * */ public GetAllOddsByFixtureMatchIdResponse.GetAllOddsByFixtureMatchIdResult getGetAllOddsByFixtureMatchIdResult() { return getAllOddsByFixtureMatchIdResult; } /** * Sets the value of the getAllOddsByFixtureMatchIdResult property. * * @param value * allowed object is * {@link GetAllOddsByFixtureMatchIdResponse.GetAllOddsByFixtureMatchIdResult } * */ public void setGetAllOddsByFixtureMatchIdResult(GetAllOddsByFixtureMatchIdResponse.GetAllOddsByFixtureMatchIdResult value) { this.getAllOddsByFixtureMatchIdResult = value; } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "content" }) public static class GetAllOddsByFixtureMatchIdResult {
@XmlElementRef(name="XMLSOCCER.COM", type=GetAllOddsXML.class)
pabloo99/xmlsoccer
src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetTopScorersByGroupIdResponse.java
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetTopScorersResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "topscorer", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetTopScorersResultXML { // // @XmlElement(name = "Topscorer") // protected List<Topscorer> topscorer; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<Topscorer> getTopscorer() { // return Optional.ofNullable(topscorer). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "rank", // "name", // "teamName", // "teamId", // "nationality", // "goals", // "firstScorer", // "penalties", // "missedPenalties" // }) // @Data // public static class Topscorer { // // @XmlElement(name = "Rank") // protected int rank; // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "TeamName", required = true) // protected String teamName; // @XmlElement(name = "Team_Id") // protected int teamId; // @XmlElement(name = "Nationality", required = true) // protected String nationality; // @XmlElement(name = "Goals") // protected int goals; // @XmlElement(name = "FirstScorer") // protected int firstScorer; // @XmlElement(name = "Penalties") // protected int penalties; // @XmlElement(name = "MissedPenalties") // protected int missedPenalties; // @XmlTransient // protected String leagueName; // @XmlTransient // protected String season; // @XmlTransient // protected int id; // } // }
import com.github.pabloo99.xmlsoccer.model.xml.GetTopScorersResultXML; import javax.xml.bind.annotation.*;
package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getTopScorersByGroupIdResult" }) @XmlRootElement(name = "GetTopScorersByGroupIdResponse") public class GetTopScorersByGroupIdResponse { @XmlElement(name = "GetTopScorersByGroupIdResult") protected GetTopScorersByGroupIdResponse.GetTopScorersByGroupIdResult getTopScorersByGroupIdResult; /** * Gets the value of the getTopScorersByGroupIdResult property. * * @return * possible object is * {@link GetTopScorersByGroupIdResponse.GetTopScorersByGroupIdResult } * */ public GetTopScorersByGroupIdResponse.GetTopScorersByGroupIdResult getGetTopScorersByGroupIdResult() { return getTopScorersByGroupIdResult; } /** * Sets the value of the getTopScorersByGroupIdResult property. * * @param value * allowed object is * {@link GetTopScorersByGroupIdResponse.GetTopScorersByGroupIdResult } * */ public void setGetTopScorersByGroupIdResult(GetTopScorersByGroupIdResponse.GetTopScorersByGroupIdResult value) { this.getTopScorersByGroupIdResult = value; } public static class GetTopScorersByGroupIdResult {
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetTopScorersResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "topscorer", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetTopScorersResultXML { // // @XmlElement(name = "Topscorer") // protected List<Topscorer> topscorer; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<Topscorer> getTopscorer() { // return Optional.ofNullable(topscorer). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "rank", // "name", // "teamName", // "teamId", // "nationality", // "goals", // "firstScorer", // "penalties", // "missedPenalties" // }) // @Data // public static class Topscorer { // // @XmlElement(name = "Rank") // protected int rank; // @XmlElement(name = "Name", required = true) // protected String name; // @XmlElement(name = "TeamName", required = true) // protected String teamName; // @XmlElement(name = "Team_Id") // protected int teamId; // @XmlElement(name = "Nationality", required = true) // protected String nationality; // @XmlElement(name = "Goals") // protected int goals; // @XmlElement(name = "FirstScorer") // protected int firstScorer; // @XmlElement(name = "Penalties") // protected int penalties; // @XmlElement(name = "MissedPenalties") // protected int missedPenalties; // @XmlTransient // protected String leagueName; // @XmlTransient // protected String season; // @XmlTransient // protected int id; // } // } // Path: src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetTopScorersByGroupIdResponse.java import com.github.pabloo99.xmlsoccer.model.xml.GetTopScorersResultXML; import javax.xml.bind.annotation.*; package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getTopScorersByGroupIdResult" }) @XmlRootElement(name = "GetTopScorersByGroupIdResponse") public class GetTopScorersByGroupIdResponse { @XmlElement(name = "GetTopScorersByGroupIdResult") protected GetTopScorersByGroupIdResponse.GetTopScorersByGroupIdResult getTopScorersByGroupIdResult; /** * Gets the value of the getTopScorersByGroupIdResult property. * * @return * possible object is * {@link GetTopScorersByGroupIdResponse.GetTopScorersByGroupIdResult } * */ public GetTopScorersByGroupIdResponse.GetTopScorersByGroupIdResult getGetTopScorersByGroupIdResult() { return getTopScorersByGroupIdResult; } /** * Sets the value of the getTopScorersByGroupIdResult property. * * @param value * allowed object is * {@link GetTopScorersByGroupIdResponse.GetTopScorersByGroupIdResult } * */ public void setGetTopScorersByGroupIdResult(GetTopScorersByGroupIdResponse.GetTopScorersByGroupIdResult value) { this.getTopScorersByGroupIdResult = value; } public static class GetTopScorersByGroupIdResult {
@XmlElementRef(name="XMLSOCCER.COM", type=GetTopScorersResultXML.class)
pabloo99/xmlsoccer
src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetLeagueStandingsBySeasonResponse.java
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetLeagueStandingsBySeasonResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "teamLeagueStanding", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetLeagueStandingsBySeasonResultXML { // // @XmlElement(name = "TeamLeagueStanding", required = true, namespace = "http://xmlsoccer.com/LeagueStanding") // protected List<TeamLeagueStanding> teamLeagueStanding; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<TeamLeagueStanding> getTeamLeagueStanding() { // return Optional.ofNullable(teamLeagueStanding). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "team", // "teamId", // "played", // "playedAtHome", // "playedAway", // "won", // "draw", // "lost", // "numberOfShots", // "yellowCards", // "redCards", // "goalsFor", // "goalsAgainst", // "goalDifference", // "points" // }) // @Data // public static class TeamLeagueStanding { // // @XmlElement(name = "Team", namespace = "http://xmlsoccer.com/LeagueStanding") // protected String team; // @XmlElement(name = "Team_Id", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int teamId; // @XmlElement(name = "Played", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int played; // @XmlElement(name = "PlayedAtHome", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int playedAtHome; // @XmlElement(name = "PlayedAway", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int playedAway; // @XmlElement(name = "Won", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int won; // @XmlElement(name = "Draw", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int draw; // @XmlElement(name = "Lost", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int lost; // @XmlElement(name = "NumberOfShots", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int numberOfShots; // @XmlElement(name = "YellowCards", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int yellowCards; // @XmlElement(name = "RedCards", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int redCards; // @XmlElement(name = "Goals_For", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int goalsFor; // @XmlElement(name = "Goals_Against", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int goalsAgainst; // @XmlElement(name = "Goal_Difference", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int goalDifference; // @XmlElement(name = "Points", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int points; // } // }
import com.github.pabloo99.xmlsoccer.model.xml.GetLeagueStandingsBySeasonResultXML; import javax.xml.bind.annotation.*;
package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getLeagueStandingsBySeasonResult" }) @XmlRootElement(name = "GetLeagueStandingsBySeasonResponse") public class GetLeagueStandingsBySeasonResponse { @XmlElement(name = "GetLeagueStandingsBySeasonResult") protected GetLeagueStandingsBySeasonResponse.GetLeagueStandingsBySeasonResult getLeagueStandingsBySeasonResult; /** * Gets the value of the getLeagueStandingsBySeasonResult property. * * @return * possible object is * {@link GetLeagueStandingsBySeasonResponse.GetLeagueStandingsBySeasonResult } * */ public GetLeagueStandingsBySeasonResponse.GetLeagueStandingsBySeasonResult getGetLeagueStandingsBySeasonResult() { return getLeagueStandingsBySeasonResult; } /** * Sets the value of the getLeagueStandingsBySeasonResult property. * * @param value * allowed object is * {@link GetLeagueStandingsBySeasonResponse.GetLeagueStandingsBySeasonResult } * */ public void setGetLeagueStandingsBySeasonResult(GetLeagueStandingsBySeasonResponse.GetLeagueStandingsBySeasonResult value) { this.getLeagueStandingsBySeasonResult = value; } //@XmlRootElement(name = "TeamLeagueStanding") //@XmlSeeAlso(GetLeagueStandingsBySeasonResultXML.class) public static class GetLeagueStandingsBySeasonResult { //@XmlMixed //@XmlAnyElement(lax = true) //@XmlElement(name = "content")
// Path: src/main/java/com/github/pabloo99/xmlsoccer/model/xml/GetLeagueStandingsBySeasonResultXML.java // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "teamLeagueStanding", // "accountInformation" // }) // @XmlRootElement(name = "XMLSOCCER.COM") // @Data // public class GetLeagueStandingsBySeasonResultXML { // // @XmlElement(name = "TeamLeagueStanding", required = true, namespace = "http://xmlsoccer.com/LeagueStanding") // protected List<TeamLeagueStanding> teamLeagueStanding; // @XmlElement(name = "AccountInformation", required = true) // protected String accountInformation; // // public List<TeamLeagueStanding> getTeamLeagueStanding() { // return Optional.ofNullable(teamLeagueStanding). // orElse(Collections.emptyList()); // } // // @XmlAccessorType(XmlAccessType.FIELD) // @XmlType(name = "", propOrder = { // "team", // "teamId", // "played", // "playedAtHome", // "playedAway", // "won", // "draw", // "lost", // "numberOfShots", // "yellowCards", // "redCards", // "goalsFor", // "goalsAgainst", // "goalDifference", // "points" // }) // @Data // public static class TeamLeagueStanding { // // @XmlElement(name = "Team", namespace = "http://xmlsoccer.com/LeagueStanding") // protected String team; // @XmlElement(name = "Team_Id", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int teamId; // @XmlElement(name = "Played", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int played; // @XmlElement(name = "PlayedAtHome", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int playedAtHome; // @XmlElement(name = "PlayedAway", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int playedAway; // @XmlElement(name = "Won", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int won; // @XmlElement(name = "Draw", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int draw; // @XmlElement(name = "Lost", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int lost; // @XmlElement(name = "NumberOfShots", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int numberOfShots; // @XmlElement(name = "YellowCards", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int yellowCards; // @XmlElement(name = "RedCards", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int redCards; // @XmlElement(name = "Goals_For", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int goalsFor; // @XmlElement(name = "Goals_Against", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int goalsAgainst; // @XmlElement(name = "Goal_Difference", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int goalDifference; // @XmlElement(name = "Points", namespace = "http://xmlsoccer.com/LeagueStanding") // protected int points; // } // } // Path: src/main/java/com/github/pabloo99/xmlsoccer/webservice/GetLeagueStandingsBySeasonResponse.java import com.github.pabloo99.xmlsoccer.model.xml.GetLeagueStandingsBySeasonResultXML; import javax.xml.bind.annotation.*; package com.github.pabloo99.xmlsoccer.webservice; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getLeagueStandingsBySeasonResult" }) @XmlRootElement(name = "GetLeagueStandingsBySeasonResponse") public class GetLeagueStandingsBySeasonResponse { @XmlElement(name = "GetLeagueStandingsBySeasonResult") protected GetLeagueStandingsBySeasonResponse.GetLeagueStandingsBySeasonResult getLeagueStandingsBySeasonResult; /** * Gets the value of the getLeagueStandingsBySeasonResult property. * * @return * possible object is * {@link GetLeagueStandingsBySeasonResponse.GetLeagueStandingsBySeasonResult } * */ public GetLeagueStandingsBySeasonResponse.GetLeagueStandingsBySeasonResult getGetLeagueStandingsBySeasonResult() { return getLeagueStandingsBySeasonResult; } /** * Sets the value of the getLeagueStandingsBySeasonResult property. * * @param value * allowed object is * {@link GetLeagueStandingsBySeasonResponse.GetLeagueStandingsBySeasonResult } * */ public void setGetLeagueStandingsBySeasonResult(GetLeagueStandingsBySeasonResponse.GetLeagueStandingsBySeasonResult value) { this.getLeagueStandingsBySeasonResult = value; } //@XmlRootElement(name = "TeamLeagueStanding") //@XmlSeeAlso(GetLeagueStandingsBySeasonResultXML.class) public static class GetLeagueStandingsBySeasonResult { //@XmlMixed //@XmlAnyElement(lax = true) //@XmlElement(name = "content")
@XmlElementRef(name="XMLSOCCER.COM", type=GetLeagueStandingsBySeasonResultXML.class)
agolinko/pdfparse
pdfparse-lib/src/main/java/org/pdfparse/model/PDFDocCatalog.java
// Path: pdfparse-lib/src/main/java/org/pdfparse/parser/Diagnostics.java // public class Diagnostics { // ParserSettings settings; // // public Diagnostics(ParserSettings settings) { // this.settings = settings; // } // // // private static void checkAndLog(boolean canContinue, String message) { // if (canContinue) // System.err.println(message); // else // throw new EParseError(message); // } // // public static boolean softAssertSyntaxCompliance(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreSyntaxCompliance, message); // return condition; // } // // public static boolean softAssertSupportedFeatures(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreNonSupportedFeatures, message); // return condition; // } // // public static boolean softAssertDataIntegrity(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreDataIntegrityErrors, message); // return condition; // } // // public static boolean softAssertStructure(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreStructureErrors, message); // return condition; // } // // public static void debugMessage(ParserSettings settings, String msg) { // if (settings.debugMessages) { // System.out.println(msg); // } // } // // // public static void debugMessage(ParserSettings settings, String msg, Object... args) { // if (settings.debugMessages) { // System.out.println(String.format(msg, args)); // } // } // } // // Path: pdfparse-lib/src/main/java/org/pdfparse/parser/ObjectRetriever.java // public interface ObjectRetriever { // COSObject getObject(COSReference ref); // // COSDictionary getDictionary(COSReference ref); // // COSStream getStream(COSReference ref); // // } // // Path: pdfparse-lib/src/main/java/org/pdfparse/parser/ParserSettings.java // public class ParserSettings { // public static final boolean PRETTY_PRINT = true; // public static final int MIN_PDF_RAW_CONTENT_LENGTH = 10; // public static final int MAX_SCAN_RANGE = 100; // // public boolean debugMessages = true; // public boolean ignoreSyntaxCompliance = true; // public boolean ignoreStructureErrors = true; // public boolean ignoreDataIntegrityErrors = false; // public boolean ignoreNonSupportedFeatures = true; // // public boolean allowScan = true; // public int headerLookupRange = 100; // public int eofLookupRange = 1024; // Same as Acrobat implementation // // // public void setSyntaxComplianceChecks(boolean value) { // ignoreSyntaxCompliance = !value; // } // }
import org.pdfparse.cos.*; import org.pdfparse.exception.EParseError; import org.pdfparse.parser.Diagnostics; import org.pdfparse.parser.ObjectRetriever; import org.pdfparse.parser.ParserSettings; import java.util.ArrayList;
/* * Copyright (c) 2013 Anton Golinko * * This library 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 2.1 of the License, or (at your option) any later version. * * This library 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 this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ package org.pdfparse.model; public class PDFDocCatalog { private COSDictionary dRoot; private COSDictionary dPages;
// Path: pdfparse-lib/src/main/java/org/pdfparse/parser/Diagnostics.java // public class Diagnostics { // ParserSettings settings; // // public Diagnostics(ParserSettings settings) { // this.settings = settings; // } // // // private static void checkAndLog(boolean canContinue, String message) { // if (canContinue) // System.err.println(message); // else // throw new EParseError(message); // } // // public static boolean softAssertSyntaxCompliance(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreSyntaxCompliance, message); // return condition; // } // // public static boolean softAssertSupportedFeatures(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreNonSupportedFeatures, message); // return condition; // } // // public static boolean softAssertDataIntegrity(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreDataIntegrityErrors, message); // return condition; // } // // public static boolean softAssertStructure(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreStructureErrors, message); // return condition; // } // // public static void debugMessage(ParserSettings settings, String msg) { // if (settings.debugMessages) { // System.out.println(msg); // } // } // // // public static void debugMessage(ParserSettings settings, String msg, Object... args) { // if (settings.debugMessages) { // System.out.println(String.format(msg, args)); // } // } // } // // Path: pdfparse-lib/src/main/java/org/pdfparse/parser/ObjectRetriever.java // public interface ObjectRetriever { // COSObject getObject(COSReference ref); // // COSDictionary getDictionary(COSReference ref); // // COSStream getStream(COSReference ref); // // } // // Path: pdfparse-lib/src/main/java/org/pdfparse/parser/ParserSettings.java // public class ParserSettings { // public static final boolean PRETTY_PRINT = true; // public static final int MIN_PDF_RAW_CONTENT_LENGTH = 10; // public static final int MAX_SCAN_RANGE = 100; // // public boolean debugMessages = true; // public boolean ignoreSyntaxCompliance = true; // public boolean ignoreStructureErrors = true; // public boolean ignoreDataIntegrityErrors = false; // public boolean ignoreNonSupportedFeatures = true; // // public boolean allowScan = true; // public int headerLookupRange = 100; // public int eofLookupRange = 1024; // Same as Acrobat implementation // // // public void setSyntaxComplianceChecks(boolean value) { // ignoreSyntaxCompliance = !value; // } // } // Path: pdfparse-lib/src/main/java/org/pdfparse/model/PDFDocCatalog.java import org.pdfparse.cos.*; import org.pdfparse.exception.EParseError; import org.pdfparse.parser.Diagnostics; import org.pdfparse.parser.ObjectRetriever; import org.pdfparse.parser.ParserSettings; import java.util.ArrayList; /* * Copyright (c) 2013 Anton Golinko * * This library 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 2.1 of the License, or (at your option) any later version. * * This library 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 this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ package org.pdfparse.model; public class PDFDocCatalog { private COSDictionary dRoot; private COSDictionary dPages;
private ObjectRetriever retriever;
agolinko/pdfparse
pdfparse-lib/src/main/java/org/pdfparse/model/PDFDocCatalog.java
// Path: pdfparse-lib/src/main/java/org/pdfparse/parser/Diagnostics.java // public class Diagnostics { // ParserSettings settings; // // public Diagnostics(ParserSettings settings) { // this.settings = settings; // } // // // private static void checkAndLog(boolean canContinue, String message) { // if (canContinue) // System.err.println(message); // else // throw new EParseError(message); // } // // public static boolean softAssertSyntaxCompliance(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreSyntaxCompliance, message); // return condition; // } // // public static boolean softAssertSupportedFeatures(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreNonSupportedFeatures, message); // return condition; // } // // public static boolean softAssertDataIntegrity(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreDataIntegrityErrors, message); // return condition; // } // // public static boolean softAssertStructure(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreStructureErrors, message); // return condition; // } // // public static void debugMessage(ParserSettings settings, String msg) { // if (settings.debugMessages) { // System.out.println(msg); // } // } // // // public static void debugMessage(ParserSettings settings, String msg, Object... args) { // if (settings.debugMessages) { // System.out.println(String.format(msg, args)); // } // } // } // // Path: pdfparse-lib/src/main/java/org/pdfparse/parser/ObjectRetriever.java // public interface ObjectRetriever { // COSObject getObject(COSReference ref); // // COSDictionary getDictionary(COSReference ref); // // COSStream getStream(COSReference ref); // // } // // Path: pdfparse-lib/src/main/java/org/pdfparse/parser/ParserSettings.java // public class ParserSettings { // public static final boolean PRETTY_PRINT = true; // public static final int MIN_PDF_RAW_CONTENT_LENGTH = 10; // public static final int MAX_SCAN_RANGE = 100; // // public boolean debugMessages = true; // public boolean ignoreSyntaxCompliance = true; // public boolean ignoreStructureErrors = true; // public boolean ignoreDataIntegrityErrors = false; // public boolean ignoreNonSupportedFeatures = true; // // public boolean allowScan = true; // public int headerLookupRange = 100; // public int eofLookupRange = 1024; // Same as Acrobat implementation // // // public void setSyntaxComplianceChecks(boolean value) { // ignoreSyntaxCompliance = !value; // } // }
import org.pdfparse.cos.*; import org.pdfparse.exception.EParseError; import org.pdfparse.parser.Diagnostics; import org.pdfparse.parser.ObjectRetriever; import org.pdfparse.parser.ParserSettings; import java.util.ArrayList;
/* * Copyright (c) 2013 Anton Golinko * * This library 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 2.1 of the License, or (at your option) any later version. * * This library 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 this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ package org.pdfparse.model; public class PDFDocCatalog { private COSDictionary dRoot; private COSDictionary dPages; private ObjectRetriever retriever; private ArrayList<PDFPage> pages;
// Path: pdfparse-lib/src/main/java/org/pdfparse/parser/Diagnostics.java // public class Diagnostics { // ParserSettings settings; // // public Diagnostics(ParserSettings settings) { // this.settings = settings; // } // // // private static void checkAndLog(boolean canContinue, String message) { // if (canContinue) // System.err.println(message); // else // throw new EParseError(message); // } // // public static boolean softAssertSyntaxCompliance(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreSyntaxCompliance, message); // return condition; // } // // public static boolean softAssertSupportedFeatures(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreNonSupportedFeatures, message); // return condition; // } // // public static boolean softAssertDataIntegrity(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreDataIntegrityErrors, message); // return condition; // } // // public static boolean softAssertStructure(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreStructureErrors, message); // return condition; // } // // public static void debugMessage(ParserSettings settings, String msg) { // if (settings.debugMessages) { // System.out.println(msg); // } // } // // // public static void debugMessage(ParserSettings settings, String msg, Object... args) { // if (settings.debugMessages) { // System.out.println(String.format(msg, args)); // } // } // } // // Path: pdfparse-lib/src/main/java/org/pdfparse/parser/ObjectRetriever.java // public interface ObjectRetriever { // COSObject getObject(COSReference ref); // // COSDictionary getDictionary(COSReference ref); // // COSStream getStream(COSReference ref); // // } // // Path: pdfparse-lib/src/main/java/org/pdfparse/parser/ParserSettings.java // public class ParserSettings { // public static final boolean PRETTY_PRINT = true; // public static final int MIN_PDF_RAW_CONTENT_LENGTH = 10; // public static final int MAX_SCAN_RANGE = 100; // // public boolean debugMessages = true; // public boolean ignoreSyntaxCompliance = true; // public boolean ignoreStructureErrors = true; // public boolean ignoreDataIntegrityErrors = false; // public boolean ignoreNonSupportedFeatures = true; // // public boolean allowScan = true; // public int headerLookupRange = 100; // public int eofLookupRange = 1024; // Same as Acrobat implementation // // // public void setSyntaxComplianceChecks(boolean value) { // ignoreSyntaxCompliance = !value; // } // } // Path: pdfparse-lib/src/main/java/org/pdfparse/model/PDFDocCatalog.java import org.pdfparse.cos.*; import org.pdfparse.exception.EParseError; import org.pdfparse.parser.Diagnostics; import org.pdfparse.parser.ObjectRetriever; import org.pdfparse.parser.ParserSettings; import java.util.ArrayList; /* * Copyright (c) 2013 Anton Golinko * * This library 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 2.1 of the License, or (at your option) any later version. * * This library 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 this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ package org.pdfparse.model; public class PDFDocCatalog { private COSDictionary dRoot; private COSDictionary dPages; private ObjectRetriever retriever; private ArrayList<PDFPage> pages;
private ParserSettings settings;
agolinko/pdfparse
pdfparse-lib/src/main/java/org/pdfparse/model/PDFDocCatalog.java
// Path: pdfparse-lib/src/main/java/org/pdfparse/parser/Diagnostics.java // public class Diagnostics { // ParserSettings settings; // // public Diagnostics(ParserSettings settings) { // this.settings = settings; // } // // // private static void checkAndLog(boolean canContinue, String message) { // if (canContinue) // System.err.println(message); // else // throw new EParseError(message); // } // // public static boolean softAssertSyntaxCompliance(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreSyntaxCompliance, message); // return condition; // } // // public static boolean softAssertSupportedFeatures(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreNonSupportedFeatures, message); // return condition; // } // // public static boolean softAssertDataIntegrity(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreDataIntegrityErrors, message); // return condition; // } // // public static boolean softAssertStructure(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreStructureErrors, message); // return condition; // } // // public static void debugMessage(ParserSettings settings, String msg) { // if (settings.debugMessages) { // System.out.println(msg); // } // } // // // public static void debugMessage(ParserSettings settings, String msg, Object... args) { // if (settings.debugMessages) { // System.out.println(String.format(msg, args)); // } // } // } // // Path: pdfparse-lib/src/main/java/org/pdfparse/parser/ObjectRetriever.java // public interface ObjectRetriever { // COSObject getObject(COSReference ref); // // COSDictionary getDictionary(COSReference ref); // // COSStream getStream(COSReference ref); // // } // // Path: pdfparse-lib/src/main/java/org/pdfparse/parser/ParserSettings.java // public class ParserSettings { // public static final boolean PRETTY_PRINT = true; // public static final int MIN_PDF_RAW_CONTENT_LENGTH = 10; // public static final int MAX_SCAN_RANGE = 100; // // public boolean debugMessages = true; // public boolean ignoreSyntaxCompliance = true; // public boolean ignoreStructureErrors = true; // public boolean ignoreDataIntegrityErrors = false; // public boolean ignoreNonSupportedFeatures = true; // // public boolean allowScan = true; // public int headerLookupRange = 100; // public int eofLookupRange = 1024; // Same as Acrobat implementation // // // public void setSyntaxComplianceChecks(boolean value) { // ignoreSyntaxCompliance = !value; // } // }
import org.pdfparse.cos.*; import org.pdfparse.exception.EParseError; import org.pdfparse.parser.Diagnostics; import org.pdfparse.parser.ObjectRetriever; import org.pdfparse.parser.ParserSettings; import java.util.ArrayList;
/* * Copyright (c) 2013 Anton Golinko * * This library 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 2.1 of the License, or (at your option) any later version. * * This library 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 this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ package org.pdfparse.model; public class PDFDocCatalog { private COSDictionary dRoot; private COSDictionary dPages; private ObjectRetriever retriever; private ArrayList<PDFPage> pages; private ParserSettings settings; public PDFDocCatalog(ObjectRetriever retriever, ParserSettings settings, COSDictionary dic) { dRoot = dic; this.retriever = retriever; this.settings = settings;
// Path: pdfparse-lib/src/main/java/org/pdfparse/parser/Diagnostics.java // public class Diagnostics { // ParserSettings settings; // // public Diagnostics(ParserSettings settings) { // this.settings = settings; // } // // // private static void checkAndLog(boolean canContinue, String message) { // if (canContinue) // System.err.println(message); // else // throw new EParseError(message); // } // // public static boolean softAssertSyntaxCompliance(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreSyntaxCompliance, message); // return condition; // } // // public static boolean softAssertSupportedFeatures(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreNonSupportedFeatures, message); // return condition; // } // // public static boolean softAssertDataIntegrity(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreDataIntegrityErrors, message); // return condition; // } // // public static boolean softAssertStructure(ParserSettings settings, boolean condition, String message) { // if (!condition) // checkAndLog(settings.ignoreStructureErrors, message); // return condition; // } // // public static void debugMessage(ParserSettings settings, String msg) { // if (settings.debugMessages) { // System.out.println(msg); // } // } // // // public static void debugMessage(ParserSettings settings, String msg, Object... args) { // if (settings.debugMessages) { // System.out.println(String.format(msg, args)); // } // } // } // // Path: pdfparse-lib/src/main/java/org/pdfparse/parser/ObjectRetriever.java // public interface ObjectRetriever { // COSObject getObject(COSReference ref); // // COSDictionary getDictionary(COSReference ref); // // COSStream getStream(COSReference ref); // // } // // Path: pdfparse-lib/src/main/java/org/pdfparse/parser/ParserSettings.java // public class ParserSettings { // public static final boolean PRETTY_PRINT = true; // public static final int MIN_PDF_RAW_CONTENT_LENGTH = 10; // public static final int MAX_SCAN_RANGE = 100; // // public boolean debugMessages = true; // public boolean ignoreSyntaxCompliance = true; // public boolean ignoreStructureErrors = true; // public boolean ignoreDataIntegrityErrors = false; // public boolean ignoreNonSupportedFeatures = true; // // public boolean allowScan = true; // public int headerLookupRange = 100; // public int eofLookupRange = 1024; // Same as Acrobat implementation // // // public void setSyntaxComplianceChecks(boolean value) { // ignoreSyntaxCompliance = !value; // } // } // Path: pdfparse-lib/src/main/java/org/pdfparse/model/PDFDocCatalog.java import org.pdfparse.cos.*; import org.pdfparse.exception.EParseError; import org.pdfparse.parser.Diagnostics; import org.pdfparse.parser.ObjectRetriever; import org.pdfparse.parser.ParserSettings; import java.util.ArrayList; /* * Copyright (c) 2013 Anton Golinko * * This library 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 2.1 of the License, or (at your option) any later version. * * This library 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 this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ package org.pdfparse.model; public class PDFDocCatalog { private COSDictionary dRoot; private COSDictionary dPages; private ObjectRetriever retriever; private ArrayList<PDFPage> pages; private ParserSettings settings; public PDFDocCatalog(ObjectRetriever retriever, ParserSettings settings, COSDictionary dic) { dRoot = dic; this.retriever = retriever; this.settings = settings;
Diagnostics.softAssertSyntaxCompliance(settings,
agolinko/pdfparse
pdfparse-lib/src/main/java/org/pdfparse/parser/ParsingEvent.java
// Path: pdfparse-lib/src/main/java/org/pdfparse/cos/COSReference.java // public class COSReference extends COSId implements COSObject { // public COSReference(int id, int gen) { // super(id, gen); // } // // public COSReference(IdGenPair from) { // super(from.id, from.gen); // } // // @Override // public void parse(PDFRawData src, PDFParser pdfFile) throws EParseError { // if (!tryReadId(src, this, Token.R)) { // throw new EParseError("Failed to read object reference"); // } // } // // @Override // public void produce(OutputStream dst, PDFParser pdfFile) throws IOException { // String s = String.format("%d %d R", id, gen); // dst.write(s.getBytes(Charset.defaultCharset())); // } // // @Override // public String toString() { // return String.format("%d %d R", id, gen); // } // // }
import org.pdfparse.cos.COSReference;
/* * Copyright (c) 2013 Anton Golinko * * This library 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 2.1 of the License, or (at your option) any later version. * * This library 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 this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ package org.pdfparse.parser; public interface ParsingEvent { void onDocumentVersionFound(int majorVersion, int minorVersion);
// Path: pdfparse-lib/src/main/java/org/pdfparse/cos/COSReference.java // public class COSReference extends COSId implements COSObject { // public COSReference(int id, int gen) { // super(id, gen); // } // // public COSReference(IdGenPair from) { // super(from.id, from.gen); // } // // @Override // public void parse(PDFRawData src, PDFParser pdfFile) throws EParseError { // if (!tryReadId(src, this, Token.R)) { // throw new EParseError("Failed to read object reference"); // } // } // // @Override // public void produce(OutputStream dst, PDFParser pdfFile) throws IOException { // String s = String.format("%d %d R", id, gen); // dst.write(s.getBytes(Charset.defaultCharset())); // } // // @Override // public String toString() { // return String.format("%d %d R", id, gen); // } // // } // Path: pdfparse-lib/src/main/java/org/pdfparse/parser/ParsingEvent.java import org.pdfparse.cos.COSReference; /* * Copyright (c) 2013 Anton Golinko * * This library 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 2.1 of the License, or (at your option) any later version. * * This library 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 this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ package org.pdfparse.parser; public interface ParsingEvent { void onDocumentVersionFound(int majorVersion, int minorVersion);
void onDocumentLoaded(COSReference rootId, COSReference infoId, COSReference encryptionId);
agolinko/pdfparse
pdfparse-lib/src/main/java/org/pdfparse/parser/XRefTable.java
// Path: pdfparse-lib/src/main/java/org/pdfparse/exception/EGenericException.java // public class EGenericException extends RuntimeException { // /** // * Creates a new instance of // * <code>EGenericException</code> without detail message. // */ // public EGenericException() { // super(); // } // // /** // * Constructs an instance of // * <code>EGenericException</code> with the specified detail message. // * // * @param msg the detail message. // */ // public EGenericException(String msg) { // super(msg); // } // // public EGenericException(Throwable cause) { // super(cause); // } // // public EGenericException(String message, Throwable cause) { // super(message, cause); // } // // public EGenericException(String msg, Object... args) { // super(String.format(msg, args)); // } // }
import org.pdfparse.cos.*; import org.pdfparse.exception.EGenericException; import org.pdfparse.exception.EParseError; import org.pdfparse.utils.IntObjHashtable;
} else { Diagnostics.debugMessage(settings, "XREF: Got containerId which is zero. Assumed that this was a free object (%d 0 R)", id); } } public void setParser(ObjectParser parser) { this.parser = parser; } @Override public COSObject getObject(COSReference ref) { XRefEntry x = this.get(ref.id); if (x == null) { Diagnostics.debugMessage(settings, "No XRef entry for object %d %d R. Used COSNull instead", ref.id, ref.gen); return new COSNull(); } if (x.gen != ref.gen) { Diagnostics.debugMessage(settings, "Object %s not found. But there is object with %d generation number", ref, x.gen); } if (x.cachedObject != null) { return x.cachedObject; } if (parser != null) { return parser.getObject(x); }
// Path: pdfparse-lib/src/main/java/org/pdfparse/exception/EGenericException.java // public class EGenericException extends RuntimeException { // /** // * Creates a new instance of // * <code>EGenericException</code> without detail message. // */ // public EGenericException() { // super(); // } // // /** // * Constructs an instance of // * <code>EGenericException</code> with the specified detail message. // * // * @param msg the detail message. // */ // public EGenericException(String msg) { // super(msg); // } // // public EGenericException(Throwable cause) { // super(cause); // } // // public EGenericException(String message, Throwable cause) { // super(message, cause); // } // // public EGenericException(String msg, Object... args) { // super(String.format(msg, args)); // } // } // Path: pdfparse-lib/src/main/java/org/pdfparse/parser/XRefTable.java import org.pdfparse.cos.*; import org.pdfparse.exception.EGenericException; import org.pdfparse.exception.EParseError; import org.pdfparse.utils.IntObjHashtable; } else { Diagnostics.debugMessage(settings, "XREF: Got containerId which is zero. Assumed that this was a free object (%d 0 R)", id); } } public void setParser(ObjectParser parser) { this.parser = parser; } @Override public COSObject getObject(COSReference ref) { XRefEntry x = this.get(ref.id); if (x == null) { Diagnostics.debugMessage(settings, "No XRef entry for object %d %d R. Used COSNull instead", ref.id, ref.gen); return new COSNull(); } if (x.gen != ref.gen) { Diagnostics.debugMessage(settings, "Object %s not found. But there is object with %d generation number", ref, x.gen); } if (x.cachedObject != null) { return x.cachedObject; } if (parser != null) { return parser.getObject(x); }
throw new EGenericException("Trying to access %s. Object is not loaded/parsed yet", ref);
agolinko/pdfparse
pdfparse-lib/src/main/java/org/pdfparse/parser/XRefEntry.java
// Path: pdfparse-lib/src/main/java/org/pdfparse/cos/COSObject.java // public interface COSObject { // void parse(PDFRawData src, PDFParser pdfFile) throws EParseError; // // void produce(OutputStream dst, PDFParser pdfFile) throws IOException; // }
import org.pdfparse.cos.COSObject; import org.pdfparse.exception.EParseError;
/* * Copyright (c) 2013 Anton Golinko * * This library 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 2.1 of the License, or (at your option) any later version. * * This library 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 this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ package org.pdfparse.parser; public class XRefEntry { public int id; public int gen; public int fileOffset; public int containerObjId; public int indexWithinContainer; public boolean isCompressed;
// Path: pdfparse-lib/src/main/java/org/pdfparse/cos/COSObject.java // public interface COSObject { // void parse(PDFRawData src, PDFParser pdfFile) throws EParseError; // // void produce(OutputStream dst, PDFParser pdfFile) throws IOException; // } // Path: pdfparse-lib/src/main/java/org/pdfparse/parser/XRefEntry.java import org.pdfparse.cos.COSObject; import org.pdfparse.exception.EParseError; /* * Copyright (c) 2013 Anton Golinko * * This library 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 2.1 of the License, or (at your option) any later version. * * This library 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 this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ package org.pdfparse.parser; public class XRefEntry { public int id; public int gen; public int fileOffset; public int containerObjId; public int indexWithinContainer; public boolean isCompressed;
public COSObject cachedObject;
Lambda-3/Graphene
graphene-core/src/main/java/org/lambda3/graphene/core/coreference/CoreferenceResolver.java
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/coreference/model/CoreferenceContent.java // public class CoreferenceContent extends Content { // // private String originalText; // private String substitutedText; // // public CoreferenceContent() { // } // // public CoreferenceContent(String originalText, String substitutedText) { // this.originalText = originalText; // this.substitutedText = substitutedText; // } // // public String getOriginalText() { // return originalText; // } // // public void setOriginalText(String originalText) { // this.originalText = originalText; // } // // public String getSubstitutedText() { // return substitutedText; // } // // public void setSubstitutedText(String substitutedText) { // this.substitutedText = substitutedText; // } // // @Override // public boolean equals(Object other) { // if (other != null && other instanceof CoreferenceContent) { // CoreferenceContent otherContent = (CoreferenceContent) other; // // return new EqualsBuilder() // .append(getOriginalText(), otherContent.getOriginalText()) // .append(getSubstitutedText(), otherContent.getSubstitutedText()) // .isEquals(); // } // return false; // } // // @Override // public String toString() { // return "CoreferenceContent{" + // "originalText='" + originalText + '\'' + // ", substitutedText='" + substitutedText + '\'' + // '}'; // } // }
import com.typesafe.config.Config; import org.lambda3.graphene.core.coreference.model.CoreferenceContent;
package org.lambda3.graphene.core.coreference; public abstract class CoreferenceResolver { protected Config config; public CoreferenceResolver(Config config) { this.config = config; }
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/coreference/model/CoreferenceContent.java // public class CoreferenceContent extends Content { // // private String originalText; // private String substitutedText; // // public CoreferenceContent() { // } // // public CoreferenceContent(String originalText, String substitutedText) { // this.originalText = originalText; // this.substitutedText = substitutedText; // } // // public String getOriginalText() { // return originalText; // } // // public void setOriginalText(String originalText) { // this.originalText = originalText; // } // // public String getSubstitutedText() { // return substitutedText; // } // // public void setSubstitutedText(String substitutedText) { // this.substitutedText = substitutedText; // } // // @Override // public boolean equals(Object other) { // if (other != null && other instanceof CoreferenceContent) { // CoreferenceContent otherContent = (CoreferenceContent) other; // // return new EqualsBuilder() // .append(getOriginalText(), otherContent.getOriginalText()) // .append(getSubstitutedText(), otherContent.getSubstitutedText()) // .isEquals(); // } // return false; // } // // @Override // public String toString() { // return "CoreferenceContent{" + // "originalText='" + originalText + '\'' + // ", substitutedText='" + substitutedText + '\'' + // '}'; // } // } // Path: graphene-core/src/main/java/org/lambda3/graphene/core/coreference/CoreferenceResolver.java import com.typesafe.config.Config; import org.lambda3.graphene.core.coreference.model.CoreferenceContent; package org.lambda3.graphene.core.coreference; public abstract class CoreferenceResolver { protected Config config; public CoreferenceResolver(Config config) { this.config = config; }
public abstract CoreferenceContent doCoreferenceResolution(String text);
Lambda-3/Graphene
graphene-core/src/main/java/org/lambda3/graphene/core/coreference/impl/stanford/StanfordCoref.java
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/coreference/CoreferenceResolver.java // public abstract class CoreferenceResolver { // protected Config config; // // public CoreferenceResolver(Config config) { // this.config = config; // } // // public abstract CoreferenceContent doCoreferenceResolution(String text); // } // // Path: graphene-core/src/main/java/org/lambda3/graphene/core/coreference/model/CoreferenceContent.java // public class CoreferenceContent extends Content { // // private String originalText; // private String substitutedText; // // public CoreferenceContent() { // } // // public CoreferenceContent(String originalText, String substitutedText) { // this.originalText = originalText; // this.substitutedText = substitutedText; // } // // public String getOriginalText() { // return originalText; // } // // public void setOriginalText(String originalText) { // this.originalText = originalText; // } // // public String getSubstitutedText() { // return substitutedText; // } // // public void setSubstitutedText(String substitutedText) { // this.substitutedText = substitutedText; // } // // @Override // public boolean equals(Object other) { // if (other != null && other instanceof CoreferenceContent) { // CoreferenceContent otherContent = (CoreferenceContent) other; // // return new EqualsBuilder() // .append(getOriginalText(), otherContent.getOriginalText()) // .append(getSubstitutedText(), otherContent.getSubstitutedText()) // .isEquals(); // } // return false; // } // // @Override // public String toString() { // return "CoreferenceContent{" + // "originalText='" + originalText + '\'' + // ", substitutedText='" + substitutedText + '\'' + // '}'; // } // }
import com.typesafe.config.Config; import edu.stanford.nlp.coref.CorefCoreAnnotations; import edu.stanford.nlp.coref.data.CorefChain; import edu.stanford.nlp.ling.CoreAnnotations; import edu.stanford.nlp.ling.CoreLabel; import edu.stanford.nlp.pipeline.Annotation; import edu.stanford.nlp.pipeline.StanfordCoreNLP; import edu.stanford.nlp.util.CoreMap; import org.lambda3.graphene.core.coreference.CoreferenceResolver; import org.lambda3.graphene.core.coreference.model.CoreferenceContent; import java.util.ArrayList; import java.util.List; import java.util.Properties; import java.util.stream.Collectors;
return words.stream() .filter(w -> w.keep) .map(w -> w.text) .collect(Collectors.joining(" ")); } } private static final Properties PROPS = new Properties(); static { PROPS.setProperty("annotators", "tokenize,ssplit,pos,lemma,ner,depparse,mention,parse,coref"); } private static final StanfordCoreNLP PIPELINE = new StanfordCoreNLP(PROPS); public StanfordCoref(Config config) { super(config); } private static String getReplacement(String corefMention, String coreMention) { if (corefMention.trim().toLowerCase().matches("his|her")) { return coreMention + "'s"; } if (corefMention.trim().toLowerCase().matches("their|our")) { return coreMention + "s'"; } return coreMention; } @Override
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/coreference/CoreferenceResolver.java // public abstract class CoreferenceResolver { // protected Config config; // // public CoreferenceResolver(Config config) { // this.config = config; // } // // public abstract CoreferenceContent doCoreferenceResolution(String text); // } // // Path: graphene-core/src/main/java/org/lambda3/graphene/core/coreference/model/CoreferenceContent.java // public class CoreferenceContent extends Content { // // private String originalText; // private String substitutedText; // // public CoreferenceContent() { // } // // public CoreferenceContent(String originalText, String substitutedText) { // this.originalText = originalText; // this.substitutedText = substitutedText; // } // // public String getOriginalText() { // return originalText; // } // // public void setOriginalText(String originalText) { // this.originalText = originalText; // } // // public String getSubstitutedText() { // return substitutedText; // } // // public void setSubstitutedText(String substitutedText) { // this.substitutedText = substitutedText; // } // // @Override // public boolean equals(Object other) { // if (other != null && other instanceof CoreferenceContent) { // CoreferenceContent otherContent = (CoreferenceContent) other; // // return new EqualsBuilder() // .append(getOriginalText(), otherContent.getOriginalText()) // .append(getSubstitutedText(), otherContent.getSubstitutedText()) // .isEquals(); // } // return false; // } // // @Override // public String toString() { // return "CoreferenceContent{" + // "originalText='" + originalText + '\'' + // ", substitutedText='" + substitutedText + '\'' + // '}'; // } // } // Path: graphene-core/src/main/java/org/lambda3/graphene/core/coreference/impl/stanford/StanfordCoref.java import com.typesafe.config.Config; import edu.stanford.nlp.coref.CorefCoreAnnotations; import edu.stanford.nlp.coref.data.CorefChain; import edu.stanford.nlp.ling.CoreAnnotations; import edu.stanford.nlp.ling.CoreLabel; import edu.stanford.nlp.pipeline.Annotation; import edu.stanford.nlp.pipeline.StanfordCoreNLP; import edu.stanford.nlp.util.CoreMap; import org.lambda3.graphene.core.coreference.CoreferenceResolver; import org.lambda3.graphene.core.coreference.model.CoreferenceContent; import java.util.ArrayList; import java.util.List; import java.util.Properties; import java.util.stream.Collectors; return words.stream() .filter(w -> w.keep) .map(w -> w.text) .collect(Collectors.joining(" ")); } } private static final Properties PROPS = new Properties(); static { PROPS.setProperty("annotators", "tokenize,ssplit,pos,lemma,ner,depparse,mention,parse,coref"); } private static final StanfordCoreNLP PIPELINE = new StanfordCoreNLP(PROPS); public StanfordCoref(Config config) { super(config); } private static String getReplacement(String corefMention, String coreMention) { if (corefMention.trim().toLowerCase().matches("his|her")) { return coreMention + "'s"; } if (corefMention.trim().toLowerCase().matches("their|our")) { return coreMention + "s'"; } return coreMention; } @Override
public CoreferenceContent doCoreferenceResolution(String text) {
Lambda-3/Graphene
graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/RelationExtractionRunner.java
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/discourse_simplification/model/DiscourseSimplificationContent.java // public class DiscourseSimplificationContent extends SimplificationContent { // private boolean coreferenced; // // // for deserialization // public DiscourseSimplificationContent() { // super(); // this.coreferenced = false; // } // // public DiscourseSimplificationContent(SimplificationContent simplificationContent) { // for (OutSentence outSentence : simplificationContent.getSentences()) { // this.addSentence(outSentence); // } // } // // public boolean isCoreferenced() { // return coreferenced; // } // // public void setCoreferenced(boolean coreferenced) { // this.coreferenced = coreferenced; // } // } // // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/model/LinkedContext.java // public class LinkedContext { // private String targetID; // private Relation classification; // // // for deserialization // public LinkedContext() { // } // // public LinkedContext(String targetID, Relation classification) { // this.targetID = targetID; // this.classification = classification; // } // // public String getTargetID() { // return targetID; // } // // public Extraction getTargetExtraction(RelationExtractionContent content) { // return content.getExtraction(targetID); // } // // public Relation getClassification() { // return classification; // } // // @Override // public boolean equals(Object o) { // return ((o instanceof LinkedContext) // && (((LinkedContext) o).targetID.equals(targetID)) // && (((LinkedContext) o).classification.equals(classification))); // } // } // // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/model/SimpleContext.java // public class SimpleContext { // private String text; // private Relation classification; // private TimeInformation timeInformation; // optional // // // for deserialization // public SimpleContext() { // } // // public SimpleContext(String text, Relation classification) { // this.text = text; // this.classification = classification; // this.timeInformation = null; // } // // public String getText() { // return text; // } // // public Relation getClassification() { // return classification; // } // // public Optional<TimeInformation> getTimeInformation() { // return Optional.ofNullable(timeInformation); // } // // public void setTimeInformation(TimeInformation timeInformation) { // this.timeInformation = timeInformation; // } // }
import com.typesafe.config.Config; import com.typesafe.config.ConfigException; import edu.stanford.nlp.ling.Word; import edu.stanford.nlp.trees.Tree; import edu.stanford.nlp.trees.tregex.TregexMatcher; import edu.stanford.nlp.trees.tregex.TregexPattern; import org.lambda3.graphene.core.discourse_simplification.model.DiscourseSimplificationContent; import org.lambda3.graphene.core.relation_extraction.model.*; import org.lambda3.graphene.core.relation_extraction.model.LinkedContext; import org.lambda3.graphene.core.relation_extraction.model.SimpleContext; import org.lambda3.text.simplification.discourse.model.Element; import org.lambda3.text.simplification.discourse.model.OutSentence; import org.lambda3.text.simplification.discourse.runner.discourse_tree.Relation; import org.lambda3.text.simplification.discourse.utils.parseTree.ParseTreeExtractionUtils; import org.lambda3.text.simplification.discourse.utils.words.WordsUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List;
ex.getConfidence().orElse(null), sentenceIdx, -1, ex.getRelation(), ex.getArg1(), ex.getArg2() )); } private void processElement(Element element, List<Extraction> coreExtractions, List<NewExtraction> newExtractions) { for (BinaryExtraction ex : extractor.extract(element.getParseTree())) { if (ex.isCoreExtraction()) { coreExtractions.add( new Extraction( ExtractionType.VERB_BASED, ex.getConfidence().orElse(null), element.getSentenceIdx(), element.getContextLayer(), ex.getRelation(), ex.getArg1(), ex.getArg2() ) ); } else if (exploitCore) { // yield additional extractions newExtractions.add(createYieldedExtraction(element.getSentenceIdx(), ex)); } } }
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/discourse_simplification/model/DiscourseSimplificationContent.java // public class DiscourseSimplificationContent extends SimplificationContent { // private boolean coreferenced; // // // for deserialization // public DiscourseSimplificationContent() { // super(); // this.coreferenced = false; // } // // public DiscourseSimplificationContent(SimplificationContent simplificationContent) { // for (OutSentence outSentence : simplificationContent.getSentences()) { // this.addSentence(outSentence); // } // } // // public boolean isCoreferenced() { // return coreferenced; // } // // public void setCoreferenced(boolean coreferenced) { // this.coreferenced = coreferenced; // } // } // // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/model/LinkedContext.java // public class LinkedContext { // private String targetID; // private Relation classification; // // // for deserialization // public LinkedContext() { // } // // public LinkedContext(String targetID, Relation classification) { // this.targetID = targetID; // this.classification = classification; // } // // public String getTargetID() { // return targetID; // } // // public Extraction getTargetExtraction(RelationExtractionContent content) { // return content.getExtraction(targetID); // } // // public Relation getClassification() { // return classification; // } // // @Override // public boolean equals(Object o) { // return ((o instanceof LinkedContext) // && (((LinkedContext) o).targetID.equals(targetID)) // && (((LinkedContext) o).classification.equals(classification))); // } // } // // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/model/SimpleContext.java // public class SimpleContext { // private String text; // private Relation classification; // private TimeInformation timeInformation; // optional // // // for deserialization // public SimpleContext() { // } // // public SimpleContext(String text, Relation classification) { // this.text = text; // this.classification = classification; // this.timeInformation = null; // } // // public String getText() { // return text; // } // // public Relation getClassification() { // return classification; // } // // public Optional<TimeInformation> getTimeInformation() { // return Optional.ofNullable(timeInformation); // } // // public void setTimeInformation(TimeInformation timeInformation) { // this.timeInformation = timeInformation; // } // } // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/RelationExtractionRunner.java import com.typesafe.config.Config; import com.typesafe.config.ConfigException; import edu.stanford.nlp.ling.Word; import edu.stanford.nlp.trees.Tree; import edu.stanford.nlp.trees.tregex.TregexMatcher; import edu.stanford.nlp.trees.tregex.TregexPattern; import org.lambda3.graphene.core.discourse_simplification.model.DiscourseSimplificationContent; import org.lambda3.graphene.core.relation_extraction.model.*; import org.lambda3.graphene.core.relation_extraction.model.LinkedContext; import org.lambda3.graphene.core.relation_extraction.model.SimpleContext; import org.lambda3.text.simplification.discourse.model.Element; import org.lambda3.text.simplification.discourse.model.OutSentence; import org.lambda3.text.simplification.discourse.runner.discourse_tree.Relation; import org.lambda3.text.simplification.discourse.utils.parseTree.ParseTreeExtractionUtils; import org.lambda3.text.simplification.discourse.utils.words.WordsUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; ex.getConfidence().orElse(null), sentenceIdx, -1, ex.getRelation(), ex.getArg1(), ex.getArg2() )); } private void processElement(Element element, List<Extraction> coreExtractions, List<NewExtraction> newExtractions) { for (BinaryExtraction ex : extractor.extract(element.getParseTree())) { if (ex.isCoreExtraction()) { coreExtractions.add( new Extraction( ExtractionType.VERB_BASED, ex.getConfidence().orElse(null), element.getSentenceIdx(), element.getContextLayer(), ex.getRelation(), ex.getArg1(), ex.getArg2() ) ); } else if (exploitCore) { // yield additional extractions newExtractions.add(createYieldedExtraction(element.getSentenceIdx(), ex)); } } }
private void processSimpleContext(Element element, org.lambda3.text.simplification.discourse.model.SimpleContext simpleContext, List<NewExtraction> newExtractions, List<SimpleContext> simpleContexts) {
Lambda-3/Graphene
graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/RelationExtractionRunner.java
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/discourse_simplification/model/DiscourseSimplificationContent.java // public class DiscourseSimplificationContent extends SimplificationContent { // private boolean coreferenced; // // // for deserialization // public DiscourseSimplificationContent() { // super(); // this.coreferenced = false; // } // // public DiscourseSimplificationContent(SimplificationContent simplificationContent) { // for (OutSentence outSentence : simplificationContent.getSentences()) { // this.addSentence(outSentence); // } // } // // public boolean isCoreferenced() { // return coreferenced; // } // // public void setCoreferenced(boolean coreferenced) { // this.coreferenced = coreferenced; // } // } // // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/model/LinkedContext.java // public class LinkedContext { // private String targetID; // private Relation classification; // // // for deserialization // public LinkedContext() { // } // // public LinkedContext(String targetID, Relation classification) { // this.targetID = targetID; // this.classification = classification; // } // // public String getTargetID() { // return targetID; // } // // public Extraction getTargetExtraction(RelationExtractionContent content) { // return content.getExtraction(targetID); // } // // public Relation getClassification() { // return classification; // } // // @Override // public boolean equals(Object o) { // return ((o instanceof LinkedContext) // && (((LinkedContext) o).targetID.equals(targetID)) // && (((LinkedContext) o).classification.equals(classification))); // } // } // // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/model/SimpleContext.java // public class SimpleContext { // private String text; // private Relation classification; // private TimeInformation timeInformation; // optional // // // for deserialization // public SimpleContext() { // } // // public SimpleContext(String text, Relation classification) { // this.text = text; // this.classification = classification; // this.timeInformation = null; // } // // public String getText() { // return text; // } // // public Relation getClassification() { // return classification; // } // // public Optional<TimeInformation> getTimeInformation() { // return Optional.ofNullable(timeInformation); // } // // public void setTimeInformation(TimeInformation timeInformation) { // this.timeInformation = timeInformation; // } // }
import com.typesafe.config.Config; import com.typesafe.config.ConfigException; import edu.stanford.nlp.ling.Word; import edu.stanford.nlp.trees.Tree; import edu.stanford.nlp.trees.tregex.TregexMatcher; import edu.stanford.nlp.trees.tregex.TregexPattern; import org.lambda3.graphene.core.discourse_simplification.model.DiscourseSimplificationContent; import org.lambda3.graphene.core.relation_extraction.model.*; import org.lambda3.graphene.core.relation_extraction.model.LinkedContext; import org.lambda3.graphene.core.relation_extraction.model.SimpleContext; import org.lambda3.text.simplification.discourse.model.Element; import org.lambda3.text.simplification.discourse.model.OutSentence; import org.lambda3.text.simplification.discourse.runner.discourse_tree.Relation; import org.lambda3.text.simplification.discourse.utils.parseTree.ParseTreeExtractionUtils; import org.lambda3.text.simplification.discourse.utils.words.WordsUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List;
Tree arg2 = arg2Matcher.getNode("arg2"); arg1Words = ParseTreeExtractionUtils.getContainingWords(arg1); relationWords = ParseTreeExtractionUtils.getWordsInBetween(simpleContext.getPhrase(), vp, arg2, true, false); } else { arg1Words = ParseTreeExtractionUtils.getContainingWords(arg1); relationWords = ParseTreeExtractionUtils.getContainingWords(vp); } newExtractions.add(new NewExtraction(true, simpleContext.getRelation(), new Extraction( ExtractionType.VERB_BASED, null, element.getSentenceIdx(), element.getContextLayer() + 1, WordsUtils.wordsToString(relationWords), WordsUtils.wordsToString(arg1Words), element.getText() ))); } } else { // add as simple context SimpleContext c = new SimpleContext( WordsUtils.wordsToString(ParseTreeExtractionUtils.getContainingWords(simpleContext.getPhrase())), simpleContext.getRelation() ); simpleContext.getTimeInformation().ifPresent(t -> c.setTimeInformation(t)); simpleContexts.add(c); } }
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/discourse_simplification/model/DiscourseSimplificationContent.java // public class DiscourseSimplificationContent extends SimplificationContent { // private boolean coreferenced; // // // for deserialization // public DiscourseSimplificationContent() { // super(); // this.coreferenced = false; // } // // public DiscourseSimplificationContent(SimplificationContent simplificationContent) { // for (OutSentence outSentence : simplificationContent.getSentences()) { // this.addSentence(outSentence); // } // } // // public boolean isCoreferenced() { // return coreferenced; // } // // public void setCoreferenced(boolean coreferenced) { // this.coreferenced = coreferenced; // } // } // // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/model/LinkedContext.java // public class LinkedContext { // private String targetID; // private Relation classification; // // // for deserialization // public LinkedContext() { // } // // public LinkedContext(String targetID, Relation classification) { // this.targetID = targetID; // this.classification = classification; // } // // public String getTargetID() { // return targetID; // } // // public Extraction getTargetExtraction(RelationExtractionContent content) { // return content.getExtraction(targetID); // } // // public Relation getClassification() { // return classification; // } // // @Override // public boolean equals(Object o) { // return ((o instanceof LinkedContext) // && (((LinkedContext) o).targetID.equals(targetID)) // && (((LinkedContext) o).classification.equals(classification))); // } // } // // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/model/SimpleContext.java // public class SimpleContext { // private String text; // private Relation classification; // private TimeInformation timeInformation; // optional // // // for deserialization // public SimpleContext() { // } // // public SimpleContext(String text, Relation classification) { // this.text = text; // this.classification = classification; // this.timeInformation = null; // } // // public String getText() { // return text; // } // // public Relation getClassification() { // return classification; // } // // public Optional<TimeInformation> getTimeInformation() { // return Optional.ofNullable(timeInformation); // } // // public void setTimeInformation(TimeInformation timeInformation) { // this.timeInformation = timeInformation; // } // } // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/RelationExtractionRunner.java import com.typesafe.config.Config; import com.typesafe.config.ConfigException; import edu.stanford.nlp.ling.Word; import edu.stanford.nlp.trees.Tree; import edu.stanford.nlp.trees.tregex.TregexMatcher; import edu.stanford.nlp.trees.tregex.TregexPattern; import org.lambda3.graphene.core.discourse_simplification.model.DiscourseSimplificationContent; import org.lambda3.graphene.core.relation_extraction.model.*; import org.lambda3.graphene.core.relation_extraction.model.LinkedContext; import org.lambda3.graphene.core.relation_extraction.model.SimpleContext; import org.lambda3.text.simplification.discourse.model.Element; import org.lambda3.text.simplification.discourse.model.OutSentence; import org.lambda3.text.simplification.discourse.runner.discourse_tree.Relation; import org.lambda3.text.simplification.discourse.utils.parseTree.ParseTreeExtractionUtils; import org.lambda3.text.simplification.discourse.utils.words.WordsUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; Tree arg2 = arg2Matcher.getNode("arg2"); arg1Words = ParseTreeExtractionUtils.getContainingWords(arg1); relationWords = ParseTreeExtractionUtils.getWordsInBetween(simpleContext.getPhrase(), vp, arg2, true, false); } else { arg1Words = ParseTreeExtractionUtils.getContainingWords(arg1); relationWords = ParseTreeExtractionUtils.getContainingWords(vp); } newExtractions.add(new NewExtraction(true, simpleContext.getRelation(), new Extraction( ExtractionType.VERB_BASED, null, element.getSentenceIdx(), element.getContextLayer() + 1, WordsUtils.wordsToString(relationWords), WordsUtils.wordsToString(arg1Words), element.getText() ))); } } else { // add as simple context SimpleContext c = new SimpleContext( WordsUtils.wordsToString(ParseTreeExtractionUtils.getContainingWords(simpleContext.getPhrase())), simpleContext.getRelation() ); simpleContext.getTimeInformation().ifPresent(t -> c.setTimeInformation(t)); simpleContexts.add(c); } }
private void processLinkedContext(Element element, org.lambda3.text.simplification.discourse.model.LinkedContext linkedContext, List<LinkedContext> linkedContexts, DiscourseSimplificationContent discourseSimplificationContent, RelationExtractionContent relationExtractionContent) {
Lambda-3/Graphene
graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/RelationExtractionRunner.java
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/discourse_simplification/model/DiscourseSimplificationContent.java // public class DiscourseSimplificationContent extends SimplificationContent { // private boolean coreferenced; // // // for deserialization // public DiscourseSimplificationContent() { // super(); // this.coreferenced = false; // } // // public DiscourseSimplificationContent(SimplificationContent simplificationContent) { // for (OutSentence outSentence : simplificationContent.getSentences()) { // this.addSentence(outSentence); // } // } // // public boolean isCoreferenced() { // return coreferenced; // } // // public void setCoreferenced(boolean coreferenced) { // this.coreferenced = coreferenced; // } // } // // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/model/LinkedContext.java // public class LinkedContext { // private String targetID; // private Relation classification; // // // for deserialization // public LinkedContext() { // } // // public LinkedContext(String targetID, Relation classification) { // this.targetID = targetID; // this.classification = classification; // } // // public String getTargetID() { // return targetID; // } // // public Extraction getTargetExtraction(RelationExtractionContent content) { // return content.getExtraction(targetID); // } // // public Relation getClassification() { // return classification; // } // // @Override // public boolean equals(Object o) { // return ((o instanceof LinkedContext) // && (((LinkedContext) o).targetID.equals(targetID)) // && (((LinkedContext) o).classification.equals(classification))); // } // } // // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/model/SimpleContext.java // public class SimpleContext { // private String text; // private Relation classification; // private TimeInformation timeInformation; // optional // // // for deserialization // public SimpleContext() { // } // // public SimpleContext(String text, Relation classification) { // this.text = text; // this.classification = classification; // this.timeInformation = null; // } // // public String getText() { // return text; // } // // public Relation getClassification() { // return classification; // } // // public Optional<TimeInformation> getTimeInformation() { // return Optional.ofNullable(timeInformation); // } // // public void setTimeInformation(TimeInformation timeInformation) { // this.timeInformation = timeInformation; // } // }
import com.typesafe.config.Config; import com.typesafe.config.ConfigException; import edu.stanford.nlp.ling.Word; import edu.stanford.nlp.trees.Tree; import edu.stanford.nlp.trees.tregex.TregexMatcher; import edu.stanford.nlp.trees.tregex.TregexPattern; import org.lambda3.graphene.core.discourse_simplification.model.DiscourseSimplificationContent; import org.lambda3.graphene.core.relation_extraction.model.*; import org.lambda3.graphene.core.relation_extraction.model.LinkedContext; import org.lambda3.graphene.core.relation_extraction.model.SimpleContext; import org.lambda3.text.simplification.discourse.model.Element; import org.lambda3.text.simplification.discourse.model.OutSentence; import org.lambda3.text.simplification.discourse.runner.discourse_tree.Relation; import org.lambda3.text.simplification.discourse.utils.parseTree.ParseTreeExtractionUtils; import org.lambda3.text.simplification.discourse.utils.words.WordsUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List;
Tree arg2 = arg2Matcher.getNode("arg2"); arg1Words = ParseTreeExtractionUtils.getContainingWords(arg1); relationWords = ParseTreeExtractionUtils.getWordsInBetween(simpleContext.getPhrase(), vp, arg2, true, false); } else { arg1Words = ParseTreeExtractionUtils.getContainingWords(arg1); relationWords = ParseTreeExtractionUtils.getContainingWords(vp); } newExtractions.add(new NewExtraction(true, simpleContext.getRelation(), new Extraction( ExtractionType.VERB_BASED, null, element.getSentenceIdx(), element.getContextLayer() + 1, WordsUtils.wordsToString(relationWords), WordsUtils.wordsToString(arg1Words), element.getText() ))); } } else { // add as simple context SimpleContext c = new SimpleContext( WordsUtils.wordsToString(ParseTreeExtractionUtils.getContainingWords(simpleContext.getPhrase())), simpleContext.getRelation() ); simpleContext.getTimeInformation().ifPresent(t -> c.setTimeInformation(t)); simpleContexts.add(c); } }
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/discourse_simplification/model/DiscourseSimplificationContent.java // public class DiscourseSimplificationContent extends SimplificationContent { // private boolean coreferenced; // // // for deserialization // public DiscourseSimplificationContent() { // super(); // this.coreferenced = false; // } // // public DiscourseSimplificationContent(SimplificationContent simplificationContent) { // for (OutSentence outSentence : simplificationContent.getSentences()) { // this.addSentence(outSentence); // } // } // // public boolean isCoreferenced() { // return coreferenced; // } // // public void setCoreferenced(boolean coreferenced) { // this.coreferenced = coreferenced; // } // } // // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/model/LinkedContext.java // public class LinkedContext { // private String targetID; // private Relation classification; // // // for deserialization // public LinkedContext() { // } // // public LinkedContext(String targetID, Relation classification) { // this.targetID = targetID; // this.classification = classification; // } // // public String getTargetID() { // return targetID; // } // // public Extraction getTargetExtraction(RelationExtractionContent content) { // return content.getExtraction(targetID); // } // // public Relation getClassification() { // return classification; // } // // @Override // public boolean equals(Object o) { // return ((o instanceof LinkedContext) // && (((LinkedContext) o).targetID.equals(targetID)) // && (((LinkedContext) o).classification.equals(classification))); // } // } // // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/model/SimpleContext.java // public class SimpleContext { // private String text; // private Relation classification; // private TimeInformation timeInformation; // optional // // // for deserialization // public SimpleContext() { // } // // public SimpleContext(String text, Relation classification) { // this.text = text; // this.classification = classification; // this.timeInformation = null; // } // // public String getText() { // return text; // } // // public Relation getClassification() { // return classification; // } // // public Optional<TimeInformation> getTimeInformation() { // return Optional.ofNullable(timeInformation); // } // // public void setTimeInformation(TimeInformation timeInformation) { // this.timeInformation = timeInformation; // } // } // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/RelationExtractionRunner.java import com.typesafe.config.Config; import com.typesafe.config.ConfigException; import edu.stanford.nlp.ling.Word; import edu.stanford.nlp.trees.Tree; import edu.stanford.nlp.trees.tregex.TregexMatcher; import edu.stanford.nlp.trees.tregex.TregexPattern; import org.lambda3.graphene.core.discourse_simplification.model.DiscourseSimplificationContent; import org.lambda3.graphene.core.relation_extraction.model.*; import org.lambda3.graphene.core.relation_extraction.model.LinkedContext; import org.lambda3.graphene.core.relation_extraction.model.SimpleContext; import org.lambda3.text.simplification.discourse.model.Element; import org.lambda3.text.simplification.discourse.model.OutSentence; import org.lambda3.text.simplification.discourse.runner.discourse_tree.Relation; import org.lambda3.text.simplification.discourse.utils.parseTree.ParseTreeExtractionUtils; import org.lambda3.text.simplification.discourse.utils.words.WordsUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; Tree arg2 = arg2Matcher.getNode("arg2"); arg1Words = ParseTreeExtractionUtils.getContainingWords(arg1); relationWords = ParseTreeExtractionUtils.getWordsInBetween(simpleContext.getPhrase(), vp, arg2, true, false); } else { arg1Words = ParseTreeExtractionUtils.getContainingWords(arg1); relationWords = ParseTreeExtractionUtils.getContainingWords(vp); } newExtractions.add(new NewExtraction(true, simpleContext.getRelation(), new Extraction( ExtractionType.VERB_BASED, null, element.getSentenceIdx(), element.getContextLayer() + 1, WordsUtils.wordsToString(relationWords), WordsUtils.wordsToString(arg1Words), element.getText() ))); } } else { // add as simple context SimpleContext c = new SimpleContext( WordsUtils.wordsToString(ParseTreeExtractionUtils.getContainingWords(simpleContext.getPhrase())), simpleContext.getRelation() ); simpleContext.getTimeInformation().ifPresent(t -> c.setTimeInformation(t)); simpleContexts.add(c); } }
private void processLinkedContext(Element element, org.lambda3.text.simplification.discourse.model.LinkedContext linkedContext, List<LinkedContext> linkedContexts, DiscourseSimplificationContent discourseSimplificationContent, RelationExtractionContent relationExtractionContent) {
Lambda-3/Graphene
graphene-core/src/test/java/org/lambda3/graphene/core/coreference/PyCobaltCorefTest.java
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/coreference/model/CoreferenceContent.java // public class CoreferenceContent extends Content { // // private String originalText; // private String substitutedText; // // public CoreferenceContent() { // } // // public CoreferenceContent(String originalText, String substitutedText) { // this.originalText = originalText; // this.substitutedText = substitutedText; // } // // public String getOriginalText() { // return originalText; // } // // public void setOriginalText(String originalText) { // this.originalText = originalText; // } // // public String getSubstitutedText() { // return substitutedText; // } // // public void setSubstitutedText(String substitutedText) { // this.substitutedText = substitutedText; // } // // @Override // public boolean equals(Object other) { // if (other != null && other instanceof CoreferenceContent) { // CoreferenceContent otherContent = (CoreferenceContent) other; // // return new EqualsBuilder() // .append(getOriginalText(), otherContent.getOriginalText()) // .append(getSubstitutedText(), otherContent.getSubstitutedText()) // .isEquals(); // } // return false; // } // // @Override // public String toString() { // return "CoreferenceContent{" + // "originalText='" + originalText + '\'' + // ", substitutedText='" + substitutedText + '\'' + // '}'; // } // }
import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; import org.lambda3.graphene.core.coreference.model.CoreferenceContent; import org.lambda3.graphene.core.coreference.impl.pycobalt.PyCobaltCoref; import org.slf4j.Logger; import org.slf4j.LoggerFactory;
package org.lambda3.graphene.core.coreference; /*- * ==========================License-Start============================= * PyCobaltCorefTest.java - Graphene Core - Lambda^3 - 2017 * Graphene * %% * Copyright (C) 2017 Lambda^3 * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. * ==========================License-End=============================== */ public class PyCobaltCorefTest { private static final Logger LOG = LoggerFactory.getLogger(PyCobaltCorefTest.class); private static CoreferenceResolver coreference; @BeforeClass public static void beforeAll() { Config config = ConfigFactory .load("reference.local") .withFallback(ConfigFactory.load("reference")); coreference = new PyCobaltCoref(config.getConfig("graphene.coreference.settings")); } @Test public void testSubstituteCoreferencesInText() { String sentence = "Bernhard is working in two projects. He works for MARIO and PACE.";
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/coreference/model/CoreferenceContent.java // public class CoreferenceContent extends Content { // // private String originalText; // private String substitutedText; // // public CoreferenceContent() { // } // // public CoreferenceContent(String originalText, String substitutedText) { // this.originalText = originalText; // this.substitutedText = substitutedText; // } // // public String getOriginalText() { // return originalText; // } // // public void setOriginalText(String originalText) { // this.originalText = originalText; // } // // public String getSubstitutedText() { // return substitutedText; // } // // public void setSubstitutedText(String substitutedText) { // this.substitutedText = substitutedText; // } // // @Override // public boolean equals(Object other) { // if (other != null && other instanceof CoreferenceContent) { // CoreferenceContent otherContent = (CoreferenceContent) other; // // return new EqualsBuilder() // .append(getOriginalText(), otherContent.getOriginalText()) // .append(getSubstitutedText(), otherContent.getSubstitutedText()) // .isEquals(); // } // return false; // } // // @Override // public String toString() { // return "CoreferenceContent{" + // "originalText='" + originalText + '\'' + // ", substitutedText='" + substitutedText + '\'' + // '}'; // } // } // Path: graphene-core/src/test/java/org/lambda3/graphene/core/coreference/PyCobaltCorefTest.java import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; import org.lambda3.graphene.core.coreference.model.CoreferenceContent; import org.lambda3.graphene.core.coreference.impl.pycobalt.PyCobaltCoref; import org.slf4j.Logger; import org.slf4j.LoggerFactory; package org.lambda3.graphene.core.coreference; /*- * ==========================License-Start============================= * PyCobaltCorefTest.java - Graphene Core - Lambda^3 - 2017 * Graphene * %% * Copyright (C) 2017 Lambda^3 * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. * ==========================License-End=============================== */ public class PyCobaltCorefTest { private static final Logger LOG = LoggerFactory.getLogger(PyCobaltCorefTest.class); private static CoreferenceResolver coreference; @BeforeClass public static void beforeAll() { Config config = ConfigFactory .load("reference.local") .withFallback(ConfigFactory.load("reference")); coreference = new PyCobaltCoref(config.getConfig("graphene.coreference.settings")); } @Test public void testSubstituteCoreferencesInText() { String sentence = "Bernhard is working in two projects. He works for MARIO and PACE.";
CoreferenceContent expected = new CoreferenceContent(sentence, "Bernhard is working in two projects.\nBernhard works for MARIO and PACE.");
Lambda-3/Graphene
graphene-server/src/main/java/org/lambda3/graphene/server/GrapheneRESTServer.java
// Path: graphene-server/src/main/java/org/lambda3/graphene/server/filter/CORSFilter.java // @Provider // public class CORSFilter implements ContainerResponseFilter { // // // @Override // public void filter( // ContainerRequestContext containerRequestContext, // ContainerResponseContext containerResponseContext) throws IOException { // // MultivaluedMap<String, Object> headers = containerResponseContext.getHeaders(); // // headers.add( // "Access-Control-Allow-Origin", // "*"); // headers.add( // "Access-Control-Allow-Methods", // "GET, POST, OPTIONS"); // headers.add( // "Access-Control-Allow-Headers", // "Cache-Control, X-Requested-With, Origin, Content-Type, Accept, Authorization"); // } // }
import org.lambda3.graphene.core.Graphene; import org.lambda3.graphene.server.filter.CORSFilter; import org.lambda3.graphene.server.resources.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.net.URI; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; import org.eclipse.jetty.server.Server; import org.glassfish.jersey.jackson.JacksonFeature; import org.glassfish.jersey.jetty.JettyHttpContainerFactory; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.server.ServerProperties; import org.glassfish.jersey.server.validation.ValidationFeature;
/* * ==========================License-Start============================= * graphene-server : GrapheneRESTServer * * Copyright © 2017 Lambda³ * * GNU General Public License 3 * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. * ==========================License-End============================== */ package org.lambda3.graphene.server; class GrapheneRESTServer { private final Logger log = LoggerFactory.getLogger(getClass()); private final Server server; GrapheneRESTServer() { Config config = ConfigFactory.load() .withFallback(ConfigFactory.load("reference")) .withFallback(ConfigFactory.load("application")); log.debug("initializing Graphene"); Graphene graphene = new Graphene(config); log.debug("Graphene initialized"); ResourceConfig rc = generateResourceConfig(config, graphene); String uri = "http://" + config.getString("graphene.server.host-name"); uri += config.hasPath("graphene.server.port") ? ":" + config.getInt("graphene.server.port") : ""; uri += "/"; uri += config.hasPath("graphene.server.path") ? config.getString("graphene.server.path") : ""; log.info("Server will run at: '{}'", uri); server = JettyHttpContainerFactory.createServer( URI.create(uri), rc, false); log.info("Server successfully initialized, waiting for start."); } static ResourceConfig generateResourceConfig(Config config, Graphene graphene) { ResourceConfig rc = new ResourceConfig(); // settings rc.property(ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true); rc.property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true); // TODO: remove in production // basic features
// Path: graphene-server/src/main/java/org/lambda3/graphene/server/filter/CORSFilter.java // @Provider // public class CORSFilter implements ContainerResponseFilter { // // // @Override // public void filter( // ContainerRequestContext containerRequestContext, // ContainerResponseContext containerResponseContext) throws IOException { // // MultivaluedMap<String, Object> headers = containerResponseContext.getHeaders(); // // headers.add( // "Access-Control-Allow-Origin", // "*"); // headers.add( // "Access-Control-Allow-Methods", // "GET, POST, OPTIONS"); // headers.add( // "Access-Control-Allow-Headers", // "Cache-Control, X-Requested-With, Origin, Content-Type, Accept, Authorization"); // } // } // Path: graphene-server/src/main/java/org/lambda3/graphene/server/GrapheneRESTServer.java import org.lambda3.graphene.core.Graphene; import org.lambda3.graphene.server.filter.CORSFilter; import org.lambda3.graphene.server.resources.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.net.URI; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; import org.eclipse.jetty.server.Server; import org.glassfish.jersey.jackson.JacksonFeature; import org.glassfish.jersey.jetty.JettyHttpContainerFactory; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.server.ServerProperties; import org.glassfish.jersey.server.validation.ValidationFeature; /* * ==========================License-Start============================= * graphene-server : GrapheneRESTServer * * Copyright © 2017 Lambda³ * * GNU General Public License 3 * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see http://www.gnu.org/licenses/. * ==========================License-End============================== */ package org.lambda3.graphene.server; class GrapheneRESTServer { private final Logger log = LoggerFactory.getLogger(getClass()); private final Server server; GrapheneRESTServer() { Config config = ConfigFactory.load() .withFallback(ConfigFactory.load("reference")) .withFallback(ConfigFactory.load("application")); log.debug("initializing Graphene"); Graphene graphene = new Graphene(config); log.debug("Graphene initialized"); ResourceConfig rc = generateResourceConfig(config, graphene); String uri = "http://" + config.getString("graphene.server.host-name"); uri += config.hasPath("graphene.server.port") ? ":" + config.getInt("graphene.server.port") : ""; uri += "/"; uri += config.hasPath("graphene.server.path") ? config.getString("graphene.server.path") : ""; log.info("Server will run at: '{}'", uri); server = JettyHttpContainerFactory.createServer( URI.create(uri), rc, false); log.info("Server successfully initialized, waiting for start."); } static ResourceConfig generateResourceConfig(Config config, Graphene graphene) { ResourceConfig rc = new ResourceConfig(); // settings rc.property(ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true); rc.property(ServerProperties.BV_SEND_ERROR_IN_RESPONSE, true); // TODO: remove in production // basic features
rc.register(CORSFilter.class);
Lambda-3/Graphene
graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/impl/NestedRelationExtractor.java
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/BinaryExtraction.java // public class BinaryExtraction { // private Double confidence; //optional // private String relation; // private String arg1; // private String arg2; // private boolean isCoreExtraction; // // public BinaryExtraction(Double confidence, String relation, String arg1, String arg2) { // this.confidence = confidence; // this.relation = relation; // this.arg1 = arg1; // this.arg2 = arg2; // this.isCoreExtraction = false; // } // // public void setConfidence(double confidence) { // this.confidence = confidence; // } // // public Optional<Double> getConfidence() { // return Optional.ofNullable(confidence); // } // // public String getRelation() { // return relation; // } // // public String getArg1() { // return arg1; // } // // public String getArg2() { // return arg2; // } // // public void setCoreExtraction(boolean coreExtraction) { // isCoreExtraction = coreExtraction; // } // // public boolean isCoreExtraction() { // return isCoreExtraction; // } // } // // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/RelationExtractor.java // public abstract class RelationExtractor { // private final Logger logger = LoggerFactory.getLogger(getClass()); // private static final HeadVerbFinder HEAD_VERB_FINDER = new HeadVerbFinder(); // // protected abstract List<BinaryExtraction> doExtraction(Tree parseTree); // // public List<BinaryExtraction> extract(Tree parseTree) { // Optional<String> headVerb = HEAD_VERB_FINDER.findHeadVerb(parseTree); // // List<BinaryExtraction> extractions = doExtraction(parseTree); // extractions.stream().forEach(e -> { // if (headVerb.isPresent()) { // e.setCoreExtraction(e.getRelation().contains(headVerb.get()) || e.getArg2().equals(headVerb.get())); // } else { // e.setCoreExtraction(false); // } // }); // // return extractions; // } // }
import org.lambda3.text.simplification.discourse.utils.parseTree.ParseTreeExtractionUtils; import org.lambda3.text.simplification.discourse.utils.words.WordsUtils; import java.util.ArrayList; import java.util.List; import edu.stanford.nlp.ling.Word; import edu.stanford.nlp.trees.Tree; import edu.stanford.nlp.trees.tregex.TregexMatcher; import edu.stanford.nlp.trees.tregex.TregexPattern; import org.lambda3.graphene.core.relation_extraction.BinaryExtraction; import org.lambda3.graphene.core.relation_extraction.RelationExtractor;
package org.lambda3.graphene.core.relation_extraction.impl; /*- * ==========================License-Start============================= * NestedRelationExtractor.java - Graphene Core - Lambda^3 - 2017 * Graphene * %% * Copyright (C) 2017 Lambda^3 * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. * ==========================License-End=============================== */ /** * */ public class NestedRelationExtractor extends RelationExtractor { @Override
// Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/BinaryExtraction.java // public class BinaryExtraction { // private Double confidence; //optional // private String relation; // private String arg1; // private String arg2; // private boolean isCoreExtraction; // // public BinaryExtraction(Double confidence, String relation, String arg1, String arg2) { // this.confidence = confidence; // this.relation = relation; // this.arg1 = arg1; // this.arg2 = arg2; // this.isCoreExtraction = false; // } // // public void setConfidence(double confidence) { // this.confidence = confidence; // } // // public Optional<Double> getConfidence() { // return Optional.ofNullable(confidence); // } // // public String getRelation() { // return relation; // } // // public String getArg1() { // return arg1; // } // // public String getArg2() { // return arg2; // } // // public void setCoreExtraction(boolean coreExtraction) { // isCoreExtraction = coreExtraction; // } // // public boolean isCoreExtraction() { // return isCoreExtraction; // } // } // // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/RelationExtractor.java // public abstract class RelationExtractor { // private final Logger logger = LoggerFactory.getLogger(getClass()); // private static final HeadVerbFinder HEAD_VERB_FINDER = new HeadVerbFinder(); // // protected abstract List<BinaryExtraction> doExtraction(Tree parseTree); // // public List<BinaryExtraction> extract(Tree parseTree) { // Optional<String> headVerb = HEAD_VERB_FINDER.findHeadVerb(parseTree); // // List<BinaryExtraction> extractions = doExtraction(parseTree); // extractions.stream().forEach(e -> { // if (headVerb.isPresent()) { // e.setCoreExtraction(e.getRelation().contains(headVerb.get()) || e.getArg2().equals(headVerb.get())); // } else { // e.setCoreExtraction(false); // } // }); // // return extractions; // } // } // Path: graphene-core/src/main/java/org/lambda3/graphene/core/relation_extraction/impl/NestedRelationExtractor.java import org.lambda3.text.simplification.discourse.utils.parseTree.ParseTreeExtractionUtils; import org.lambda3.text.simplification.discourse.utils.words.WordsUtils; import java.util.ArrayList; import java.util.List; import edu.stanford.nlp.ling.Word; import edu.stanford.nlp.trees.Tree; import edu.stanford.nlp.trees.tregex.TregexMatcher; import edu.stanford.nlp.trees.tregex.TregexPattern; import org.lambda3.graphene.core.relation_extraction.BinaryExtraction; import org.lambda3.graphene.core.relation_extraction.RelationExtractor; package org.lambda3.graphene.core.relation_extraction.impl; /*- * ==========================License-Start============================= * NestedRelationExtractor.java - Graphene Core - Lambda^3 - 2017 * Graphene * %% * Copyright (C) 2017 Lambda^3 * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. * ==========================License-End=============================== */ /** * */ public class NestedRelationExtractor extends RelationExtractor { @Override
public List<BinaryExtraction> doExtraction(Tree parseTree) {
myunimol/webapp
src/java/rocks/teammolise/myunimol/webapp/ConfigureServlet.java
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // }
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler;
package rocks.teammolise.myunimol.webapp; /** * Servlet implementation class Startup */ @WebServlet(name="config", urlPatterns={"/config"}, loadOnStartup=0) public class ConfigureServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public ConfigureServlet() { super(); } @Override public void init() throws ServletException { super.init(); String configPath = this.getServletContext().getRealPath("/META-INF/config.properties");
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // } // Path: src/java/rocks/teammolise/myunimol/webapp/ConfigureServlet.java import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler; package rocks.teammolise.myunimol.webapp; /** * Servlet implementation class Startup */ @WebServlet(name="config", urlPatterns={"/config"}, loadOnStartup=0) public class ConfigureServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public ConfigureServlet() { super(); } @Override public void init() throws ServletException { super.init(); String configPath = this.getServletContext().getRealPath("/META-INF/config.properties");
ConfigurationManagerHandler.setConfigurationFilename(configPath);
myunimol/webapp
src/java/rocks/teammolise/myunimol/stubs/GetRecordBookExam.java
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // }
import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler;
package rocks.teammolise.myunimol.stubs; /** * * @author Vincenzo */ @WebServlet(name = "getRecordBookExam", urlPatterns = {"/getRecordBookExam"}) public class GetRecordBookExam extends HttpServlet { private static final long serialVersionUID = 973581641895155357L; protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); response.setContentType("application/json"); PrintWriter out = response.getWriter(); String token = request.getParameter("token"); String id = request.getParameter("id");
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // } // Path: src/java/rocks/teammolise/myunimol/stubs/GetRecordBookExam.java import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler; package rocks.teammolise.myunimol.stubs; /** * * @author Vincenzo */ @WebServlet(name = "getRecordBookExam", urlPatterns = {"/getRecordBookExam"}) public class GetRecordBookExam extends HttpServlet { private static final long serialVersionUID = 973581641895155357L; protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); response.setContentType("application/json"); PrintWriter out = response.getWriter(); String token = request.getParameter("token"); String id = request.getParameter("id");
String realToken = ConfigurationManagerHandler.getInstance().getToken();
myunimol/webapp
src/java/rocks/teammolise/myunimol/stubs/GetAddressBookStub.java
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // }
import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler;
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package rocks.teammolise.myunimol.stubs; /** * * @author emilio */ @WebServlet(name = "getAddressBook", urlPatterns = {"/getAddressBook"}) public class GetAddressBookStub extends HttpServlet { private static final long serialVersionUID = 6182573943289145857L; /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String token = request.getParameter("token");
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // } // Path: src/java/rocks/teammolise/myunimol/stubs/GetAddressBookStub.java import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package rocks.teammolise.myunimol.stubs; /** * * @author emilio */ @WebServlet(name = "getAddressBook", urlPatterns = {"/getAddressBook"}) public class GetAddressBookStub extends HttpServlet { private static final long serialVersionUID = 6182573943289145857L; /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String token = request.getParameter("token");
String realToken = ConfigurationManagerHandler.getInstance().getToken();
myunimol/webapp
src/java/rocks/teammolise/myunimol/jsputils/JspUtils.java
// Path: src/java/rocks/teammolise/myunimol/webapp/UserInfo.java // public class UserInfo { // private String name; // private String surname; // private String studentId; // private String studentClass; // private String username; // private String password; // private String taxes; // private String careerPlan; // private int availableExams; // private int enrolledExams; // // private String course; // private String department; // private String coursePath; // private int courseLength; // private String registrationDate; // // public String getTaxes() { // return taxes; // } // // public void setTaxes(String taxes) { // this.taxes = taxes; // } // // public String getCareerPlan() { // return careerPlan; // } // // public void setCareerPlan(String careerPlan) { // this.careerPlan = careerPlan; // } // // public int getAvailableExams() { // return availableExams; // } // // public void setAvailableExams(int availableExams) { // this.availableExams = availableExams; // } // // public int getEnrolledExams() { // return enrolledExams; // } // // public void setEnrolledExams(int enrolledExams) { // this.enrolledExams = enrolledExams; // } // public UserInfo(){ // // } // // public String getUsername() { // return username; // } // // public void setUsername(String username) { // this.username = username; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getSurname() { // return surname; // } // // public void setSurname(String surname) { // this.surname = surname; // } // // public String getStudentId() { // return studentId; // } // // public void setStudentId(String userId) { // this.studentId = userId; // } // // public String getStudentClass() { // return studentClass; // } // // public void setStudentClass(String studentClass) { // this.studentClass = studentClass; // } // // public String getCourse() { // return course; // } // // public void setCourse(String course) { // this.course = course; // } // // public String getDepartment() { // return department; // } // // public void setDepartment(String department) { // this.department = department; // } // // public String getCoursePath() { // return coursePath; // } // // public void setCoursePath(String coursePath) { // this.coursePath = coursePath; // } // // public int getCourseLength() { // return courseLength; // } // // public void setCourseLength(int courseLength) { // this.courseLength = courseLength; // } // // public String getRegistrationDate() { // return registrationDate; // } // // public void setRegistrationDate(String registrationDate) { // this.registrationDate = registrationDate; // } // // public int getTotalCFU() { // return this.courseLength * 60; // } // }
import java.io.File; import java.io.FileReader; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Paths; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.servlet.jsp.JspWriter; import rocks.teammolise.myunimol.webapp.UserInfo;
package rocks.teammolise.myunimol.jsputils; public class JspUtils { @SuppressWarnings("unused") private HttpServletRequest request; private HttpServletResponse response; private HttpSession session; private JspWriter out;
// Path: src/java/rocks/teammolise/myunimol/webapp/UserInfo.java // public class UserInfo { // private String name; // private String surname; // private String studentId; // private String studentClass; // private String username; // private String password; // private String taxes; // private String careerPlan; // private int availableExams; // private int enrolledExams; // // private String course; // private String department; // private String coursePath; // private int courseLength; // private String registrationDate; // // public String getTaxes() { // return taxes; // } // // public void setTaxes(String taxes) { // this.taxes = taxes; // } // // public String getCareerPlan() { // return careerPlan; // } // // public void setCareerPlan(String careerPlan) { // this.careerPlan = careerPlan; // } // // public int getAvailableExams() { // return availableExams; // } // // public void setAvailableExams(int availableExams) { // this.availableExams = availableExams; // } // // public int getEnrolledExams() { // return enrolledExams; // } // // public void setEnrolledExams(int enrolledExams) { // this.enrolledExams = enrolledExams; // } // public UserInfo(){ // // } // // public String getUsername() { // return username; // } // // public void setUsername(String username) { // this.username = username; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getSurname() { // return surname; // } // // public void setSurname(String surname) { // this.surname = surname; // } // // public String getStudentId() { // return studentId; // } // // public void setStudentId(String userId) { // this.studentId = userId; // } // // public String getStudentClass() { // return studentClass; // } // // public void setStudentClass(String studentClass) { // this.studentClass = studentClass; // } // // public String getCourse() { // return course; // } // // public void setCourse(String course) { // this.course = course; // } // // public String getDepartment() { // return department; // } // // public void setDepartment(String department) { // this.department = department; // } // // public String getCoursePath() { // return coursePath; // } // // public void setCoursePath(String coursePath) { // this.coursePath = coursePath; // } // // public int getCourseLength() { // return courseLength; // } // // public void setCourseLength(int courseLength) { // this.courseLength = courseLength; // } // // public String getRegistrationDate() { // return registrationDate; // } // // public void setRegistrationDate(String registrationDate) { // this.registrationDate = registrationDate; // } // // public int getTotalCFU() { // return this.courseLength * 60; // } // } // Path: src/java/rocks/teammolise/myunimol/jsputils/JspUtils.java import java.io.File; import java.io.FileReader; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Paths; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.servlet.jsp.JspWriter; import rocks.teammolise.myunimol.webapp.UserInfo; package rocks.teammolise.myunimol.jsputils; public class JspUtils { @SuppressWarnings("unused") private HttpServletRequest request; private HttpServletResponse response; private HttpSession session; private JspWriter out;
private UserInfo user;
myunimol/webapp
src/java/rocks/teammolise/myunimol/stubs/SearchContactsStub.java
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // }
import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler;
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package rocks.teammolise.myunimol.stubs; /** * * @author emilio */ @WebServlet(name = "searchContacts", urlPatterns = {"/searchContacts"}) public class SearchContactsStub extends HttpServlet { private static final long serialVersionUID = 6182573943289145857L; /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String token = request.getParameter("token");
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // } // Path: src/java/rocks/teammolise/myunimol/stubs/SearchContactsStub.java import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package rocks.teammolise.myunimol.stubs; /** * * @author emilio */ @WebServlet(name = "searchContacts", urlPatterns = {"/searchContacts"}) public class SearchContactsStub extends HttpServlet { private static final long serialVersionUID = 6182573943289145857L; /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String token = request.getParameter("token");
String realToken = ConfigurationManagerHandler.getInstance().getToken();
myunimol/webapp
src/java/rocks/teammolise/myunimol/stubs/GetRecordBook.java
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // }
import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler;
package rocks.teammolise.myunimol.stubs; /** * * @author Vincenzo */ @WebServlet(name = "getRecordBook", urlPatterns = {"/getRecordBook"}) public class GetRecordBook extends HttpServlet { private static final long serialVersionUID = -4285059319469387107L; protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); response.setContentType("application/json"); PrintWriter out = response.getWriter(); String token = request.getParameter("token");
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // } // Path: src/java/rocks/teammolise/myunimol/stubs/GetRecordBook.java import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler; package rocks.teammolise.myunimol.stubs; /** * * @author Vincenzo */ @WebServlet(name = "getRecordBook", urlPatterns = {"/getRecordBook"}) public class GetRecordBook extends HttpServlet { private static final long serialVersionUID = -4285059319469387107L; protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); response.setContentType("application/json"); PrintWriter out = response.getWriter(); String token = request.getParameter("token");
String realToken = ConfigurationManagerHandler.getInstance().getToken();
myunimol/webapp
src/java/rocks/teammolise/myunimol/stubs/EnrollExamStub.java
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManager.java // public class ConfigurationManager implements ConfigurationManagerInterface{ // private File file; // // public ConfigurationManager(String pFilename) { // this.file = new File(pFilename); // } // // public Properties loadProperties() throws IOException { // // Properties properties = new Properties(); // // /** // * Carico il file config.properties in un File con il suo absolute path **TO FIX** // */ // // FileInputStream input = new FileInputStream(file); // // properties.load(input); // // input.close(); // // return properties; // } // // @Override // public String getWebAppURL() throws IOException { // // String URL = loadProperties().getProperty("URL"); // // return URL; // } // // @Override // public String getWebServicesRoot() throws IOException { // // String root = loadProperties().getProperty("root"); // // return root; // } // // @Override // public String getToken() throws IOException { // // String token = loadProperties().getProperty("token"); // // return token; // } // // @Override // public boolean isAllowed(String pUsername) throws IOException { // String betatest = loadProperties().getProperty("betatest"); // // if (!betatest.equals("true")) // return true; // // String allowedsStringList = loadProperties().getProperty("allowed"); // String[] alloweds = allowedsStringList.split(";"); // for (String allowed : alloweds) { // if (pUsername.equals(allowed)) // return true; // } // // return false; // } // // public boolean checkAdminPassword(String pPassword) { // try { // String adminPassword = loadProperties().getProperty("admin"); // return pPassword.equals(adminPassword); // } catch (IOException e) { // return false; // } // } // // @Override // public void allowUser(String pUsername) throws IOException { // Properties properties = loadProperties(); // // properties.put("allowed", properties.get("allowed") + ";" + pUsername); // // FileOutputStream stream = new FileOutputStream(this.file); // // properties.store(stream, ""); // // stream.close(); // } // // @Override // public String showConfig() { // try { // return new String(Files.readAllBytes(this.file.toPath()), StandardCharsets.UTF_8); // } catch (IOException e) { // return "???"; // } // } // // @Override // public String getMongoDbUri() throws IOException { // String mdburi = loadProperties().getProperty("mongodburi"); // return mdburi; // } // } // // Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // }
import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManager; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler;
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package rocks.teammolise.myunimol.stubs; /** * * @author Silvio */ @WebServlet(name = "enrollExam", urlPatterns = {"/enrollExam"}) public class EnrollExamStub extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String enrollID = "19#10010#3130517#1579806#2011#10019#9998#2011#2#2"; String token = request.getParameter("token"); String reqEnrollId = request.getParameter("id");
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManager.java // public class ConfigurationManager implements ConfigurationManagerInterface{ // private File file; // // public ConfigurationManager(String pFilename) { // this.file = new File(pFilename); // } // // public Properties loadProperties() throws IOException { // // Properties properties = new Properties(); // // /** // * Carico il file config.properties in un File con il suo absolute path **TO FIX** // */ // // FileInputStream input = new FileInputStream(file); // // properties.load(input); // // input.close(); // // return properties; // } // // @Override // public String getWebAppURL() throws IOException { // // String URL = loadProperties().getProperty("URL"); // // return URL; // } // // @Override // public String getWebServicesRoot() throws IOException { // // String root = loadProperties().getProperty("root"); // // return root; // } // // @Override // public String getToken() throws IOException { // // String token = loadProperties().getProperty("token"); // // return token; // } // // @Override // public boolean isAllowed(String pUsername) throws IOException { // String betatest = loadProperties().getProperty("betatest"); // // if (!betatest.equals("true")) // return true; // // String allowedsStringList = loadProperties().getProperty("allowed"); // String[] alloweds = allowedsStringList.split(";"); // for (String allowed : alloweds) { // if (pUsername.equals(allowed)) // return true; // } // // return false; // } // // public boolean checkAdminPassword(String pPassword) { // try { // String adminPassword = loadProperties().getProperty("admin"); // return pPassword.equals(adminPassword); // } catch (IOException e) { // return false; // } // } // // @Override // public void allowUser(String pUsername) throws IOException { // Properties properties = loadProperties(); // // properties.put("allowed", properties.get("allowed") + ";" + pUsername); // // FileOutputStream stream = new FileOutputStream(this.file); // // properties.store(stream, ""); // // stream.close(); // } // // @Override // public String showConfig() { // try { // return new String(Files.readAllBytes(this.file.toPath()), StandardCharsets.UTF_8); // } catch (IOException e) { // return "???"; // } // } // // @Override // public String getMongoDbUri() throws IOException { // String mdburi = loadProperties().getProperty("mongodburi"); // return mdburi; // } // } // // Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // } // Path: src/java/rocks/teammolise/myunimol/stubs/EnrollExamStub.java import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManager; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package rocks.teammolise.myunimol.stubs; /** * * @author Silvio */ @WebServlet(name = "enrollExam", urlPatterns = {"/enrollExam"}) public class EnrollExamStub extends HttpServlet { /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String enrollID = "19#10010#3130517#1579806#2011#10019#9998#2011#2#2"; String token = request.getParameter("token"); String reqEnrollId = request.getParameter("id");
String realToken = ConfigurationManagerHandler.getInstance().getToken();
myunimol/webapp
src/java/rocks/teammolise/myunimol/stubs/TestCredentialsStub.java
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // }
import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler;
package rocks.teammolise.myunimol.stubs; @WebServlet(name = "testCredentials", urlPatterns = {"/testCredentials"}) public class TestCredentialsStub extends HttpServlet { private static final long serialVersionUID = 1L; /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setCharacterEncoding("UTF-8"); response.setContentType("application/json"); PrintWriter out = response.getWriter(); try { if (request.getParameter("token") != null
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // } // Path: src/java/rocks/teammolise/myunimol/stubs/TestCredentialsStub.java import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler; package rocks.teammolise.myunimol.stubs; @WebServlet(name = "testCredentials", urlPatterns = {"/testCredentials"}) public class TestCredentialsStub extends HttpServlet { private static final long serialVersionUID = 1L; /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setCharacterEncoding("UTF-8"); response.setContentType("application/json"); PrintWriter out = response.getWriter(); try { if (request.getParameter("token") != null
&& request.getParameter("token").equals(ConfigurationManagerHandler.getInstance().getToken())
myunimol/webapp
src/java/rocks/teammolise/myunimol/stubs/GetEnrolledExamsStub.java
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // }
import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler;
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package rocks.teammolise.myunimol.stubs; /** * * @author Silvio */ @WebServlet(name = "getEnrolledExams", urlPatterns = {"/getEnrolledExams"}) public class GetEnrolledExamsStub extends HttpServlet { private static final long serialVersionUID = -2680278555148466285L; /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String token = request.getParameter("token");
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // } // Path: src/java/rocks/teammolise/myunimol/stubs/GetEnrolledExamsStub.java import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package rocks.teammolise.myunimol.stubs; /** * * @author Silvio */ @WebServlet(name = "getEnrolledExams", urlPatterns = {"/getEnrolledExams"}) public class GetEnrolledExamsStub extends HttpServlet { private static final long serialVersionUID = -2680278555148466285L; /** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String token = request.getParameter("token");
String realToken = ConfigurationManagerHandler.getInstance().getToken();
myunimol/webapp
src/java/rocks/teammolise/myunimol/api/APIConsumer.java
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManager.java // public class ConfigurationManager implements ConfigurationManagerInterface{ // private File file; // // public ConfigurationManager(String pFilename) { // this.file = new File(pFilename); // } // // public Properties loadProperties() throws IOException { // // Properties properties = new Properties(); // // /** // * Carico il file config.properties in un File con il suo absolute path **TO FIX** // */ // // FileInputStream input = new FileInputStream(file); // // properties.load(input); // // input.close(); // // return properties; // } // // @Override // public String getWebAppURL() throws IOException { // // String URL = loadProperties().getProperty("URL"); // // return URL; // } // // @Override // public String getWebServicesRoot() throws IOException { // // String root = loadProperties().getProperty("root"); // // return root; // } // // @Override // public String getToken() throws IOException { // // String token = loadProperties().getProperty("token"); // // return token; // } // // @Override // public boolean isAllowed(String pUsername) throws IOException { // String betatest = loadProperties().getProperty("betatest"); // // if (!betatest.equals("true")) // return true; // // String allowedsStringList = loadProperties().getProperty("allowed"); // String[] alloweds = allowedsStringList.split(";"); // for (String allowed : alloweds) { // if (pUsername.equals(allowed)) // return true; // } // // return false; // } // // public boolean checkAdminPassword(String pPassword) { // try { // String adminPassword = loadProperties().getProperty("admin"); // return pPassword.equals(adminPassword); // } catch (IOException e) { // return false; // } // } // // @Override // public void allowUser(String pUsername) throws IOException { // Properties properties = loadProperties(); // // properties.put("allowed", properties.get("allowed") + ";" + pUsername); // // FileOutputStream stream = new FileOutputStream(this.file); // // properties.store(stream, ""); // // stream.close(); // } // // @Override // public String showConfig() { // try { // return new String(Files.readAllBytes(this.file.toPath()), StandardCharsets.UTF_8); // } catch (IOException e) { // return "???"; // } // } // // @Override // public String getMongoDbUri() throws IOException { // String mdburi = loadProperties().getProperty("mongodburi"); // return mdburi; // } // } // // Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // }
import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.json.JSONObject; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManager; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler; import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; import com.mashape.unirest.http.exceptions.UnirestException; import com.mashape.unirest.request.HttpRequestWithBody; import com.mashape.unirest.request.body.MultipartBody;
package rocks.teammolise.myunimol.api; /** * Permette di consumare le API * * @author simone */ public class APIConsumer { private JSONObject consume(String pAPI, Map<String, Object> pParameters) throws UnirestException, IOException {
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManager.java // public class ConfigurationManager implements ConfigurationManagerInterface{ // private File file; // // public ConfigurationManager(String pFilename) { // this.file = new File(pFilename); // } // // public Properties loadProperties() throws IOException { // // Properties properties = new Properties(); // // /** // * Carico il file config.properties in un File con il suo absolute path **TO FIX** // */ // // FileInputStream input = new FileInputStream(file); // // properties.load(input); // // input.close(); // // return properties; // } // // @Override // public String getWebAppURL() throws IOException { // // String URL = loadProperties().getProperty("URL"); // // return URL; // } // // @Override // public String getWebServicesRoot() throws IOException { // // String root = loadProperties().getProperty("root"); // // return root; // } // // @Override // public String getToken() throws IOException { // // String token = loadProperties().getProperty("token"); // // return token; // } // // @Override // public boolean isAllowed(String pUsername) throws IOException { // String betatest = loadProperties().getProperty("betatest"); // // if (!betatest.equals("true")) // return true; // // String allowedsStringList = loadProperties().getProperty("allowed"); // String[] alloweds = allowedsStringList.split(";"); // for (String allowed : alloweds) { // if (pUsername.equals(allowed)) // return true; // } // // return false; // } // // public boolean checkAdminPassword(String pPassword) { // try { // String adminPassword = loadProperties().getProperty("admin"); // return pPassword.equals(adminPassword); // } catch (IOException e) { // return false; // } // } // // @Override // public void allowUser(String pUsername) throws IOException { // Properties properties = loadProperties(); // // properties.put("allowed", properties.get("allowed") + ";" + pUsername); // // FileOutputStream stream = new FileOutputStream(this.file); // // properties.store(stream, ""); // // stream.close(); // } // // @Override // public String showConfig() { // try { // return new String(Files.readAllBytes(this.file.toPath()), StandardCharsets.UTF_8); // } catch (IOException e) { // return "???"; // } // } // // @Override // public String getMongoDbUri() throws IOException { // String mdburi = loadProperties().getProperty("mongodburi"); // return mdburi; // } // } // // Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // } // Path: src/java/rocks/teammolise/myunimol/api/APIConsumer.java import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.json.JSONObject; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManager; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler; import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; import com.mashape.unirest.http.exceptions.UnirestException; import com.mashape.unirest.request.HttpRequestWithBody; import com.mashape.unirest.request.body.MultipartBody; package rocks.teammolise.myunimol.api; /** * Permette di consumare le API * * @author simone */ public class APIConsumer { private JSONObject consume(String pAPI, Map<String, Object> pParameters) throws UnirestException, IOException {
ConfigurationManager config = ConfigurationManagerHandler.getInstance();
myunimol/webapp
src/java/rocks/teammolise/myunimol/api/APIConsumer.java
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManager.java // public class ConfigurationManager implements ConfigurationManagerInterface{ // private File file; // // public ConfigurationManager(String pFilename) { // this.file = new File(pFilename); // } // // public Properties loadProperties() throws IOException { // // Properties properties = new Properties(); // // /** // * Carico il file config.properties in un File con il suo absolute path **TO FIX** // */ // // FileInputStream input = new FileInputStream(file); // // properties.load(input); // // input.close(); // // return properties; // } // // @Override // public String getWebAppURL() throws IOException { // // String URL = loadProperties().getProperty("URL"); // // return URL; // } // // @Override // public String getWebServicesRoot() throws IOException { // // String root = loadProperties().getProperty("root"); // // return root; // } // // @Override // public String getToken() throws IOException { // // String token = loadProperties().getProperty("token"); // // return token; // } // // @Override // public boolean isAllowed(String pUsername) throws IOException { // String betatest = loadProperties().getProperty("betatest"); // // if (!betatest.equals("true")) // return true; // // String allowedsStringList = loadProperties().getProperty("allowed"); // String[] alloweds = allowedsStringList.split(";"); // for (String allowed : alloweds) { // if (pUsername.equals(allowed)) // return true; // } // // return false; // } // // public boolean checkAdminPassword(String pPassword) { // try { // String adminPassword = loadProperties().getProperty("admin"); // return pPassword.equals(adminPassword); // } catch (IOException e) { // return false; // } // } // // @Override // public void allowUser(String pUsername) throws IOException { // Properties properties = loadProperties(); // // properties.put("allowed", properties.get("allowed") + ";" + pUsername); // // FileOutputStream stream = new FileOutputStream(this.file); // // properties.store(stream, ""); // // stream.close(); // } // // @Override // public String showConfig() { // try { // return new String(Files.readAllBytes(this.file.toPath()), StandardCharsets.UTF_8); // } catch (IOException e) { // return "???"; // } // } // // @Override // public String getMongoDbUri() throws IOException { // String mdburi = loadProperties().getProperty("mongodburi"); // return mdburi; // } // } // // Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // }
import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.json.JSONObject; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManager; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler; import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; import com.mashape.unirest.http.exceptions.UnirestException; import com.mashape.unirest.request.HttpRequestWithBody; import com.mashape.unirest.request.body.MultipartBody;
package rocks.teammolise.myunimol.api; /** * Permette di consumare le API * * @author simone */ public class APIConsumer { private JSONObject consume(String pAPI, Map<String, Object> pParameters) throws UnirestException, IOException {
// Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManager.java // public class ConfigurationManager implements ConfigurationManagerInterface{ // private File file; // // public ConfigurationManager(String pFilename) { // this.file = new File(pFilename); // } // // public Properties loadProperties() throws IOException { // // Properties properties = new Properties(); // // /** // * Carico il file config.properties in un File con il suo absolute path **TO FIX** // */ // // FileInputStream input = new FileInputStream(file); // // properties.load(input); // // input.close(); // // return properties; // } // // @Override // public String getWebAppURL() throws IOException { // // String URL = loadProperties().getProperty("URL"); // // return URL; // } // // @Override // public String getWebServicesRoot() throws IOException { // // String root = loadProperties().getProperty("root"); // // return root; // } // // @Override // public String getToken() throws IOException { // // String token = loadProperties().getProperty("token"); // // return token; // } // // @Override // public boolean isAllowed(String pUsername) throws IOException { // String betatest = loadProperties().getProperty("betatest"); // // if (!betatest.equals("true")) // return true; // // String allowedsStringList = loadProperties().getProperty("allowed"); // String[] alloweds = allowedsStringList.split(";"); // for (String allowed : alloweds) { // if (pUsername.equals(allowed)) // return true; // } // // return false; // } // // public boolean checkAdminPassword(String pPassword) { // try { // String adminPassword = loadProperties().getProperty("admin"); // return pPassword.equals(adminPassword); // } catch (IOException e) { // return false; // } // } // // @Override // public void allowUser(String pUsername) throws IOException { // Properties properties = loadProperties(); // // properties.put("allowed", properties.get("allowed") + ";" + pUsername); // // FileOutputStream stream = new FileOutputStream(this.file); // // properties.store(stream, ""); // // stream.close(); // } // // @Override // public String showConfig() { // try { // return new String(Files.readAllBytes(this.file.toPath()), StandardCharsets.UTF_8); // } catch (IOException e) { // return "???"; // } // } // // @Override // public String getMongoDbUri() throws IOException { // String mdburi = loadProperties().getProperty("mongodburi"); // return mdburi; // } // } // // Path: src/java/rocks/teammolise/myunimol/webapp/configuration/ConfigurationManagerHandler.java // public class ConfigurationManagerHandler { // // private static String filename; // // public static ConfigurationManager getInstance(){ // // ConfigurationManager confManager = new ConfigurationManager(filename); // // return confManager; // } // // public static void setConfigurationFilename(String pFilename) { // filename = pFilename; // } // } // Path: src/java/rocks/teammolise/myunimol/api/APIConsumer.java import java.io.IOException; import java.util.HashMap; import java.util.Map; import org.json.JSONObject; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManager; import rocks.teammolise.myunimol.webapp.configuration.ConfigurationManagerHandler; import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; import com.mashape.unirest.http.exceptions.UnirestException; import com.mashape.unirest.request.HttpRequestWithBody; import com.mashape.unirest.request.body.MultipartBody; package rocks.teammolise.myunimol.api; /** * Permette di consumare le API * * @author simone */ public class APIConsumer { private JSONObject consume(String pAPI, Map<String, Object> pParameters) throws UnirestException, IOException {
ConfigurationManager config = ConfigurationManagerHandler.getInstance();
CreativeMD/EnhancedVisuals
src/main/java/com/charles445/simpledifficulty/api/SDCapabilities.java
// Path: src/main/java/com/charles445/simpledifficulty/api/temperature/ITemperatureCapability.java // public interface ITemperatureCapability // { // public int getTemperatureLevel(); // public int getTemperatureTickTimer(); // public ImmutableMap<String, TemporaryModifier> getTemporaryModifiers(); // // public void setTemperatureLevel(int temperature); // public void setTemperatureTickTimer(int ticktimer); // public void setTemporaryModifier(String name, float temperature, int duration); // // public void addTemperatureLevel(int temperature); // public void addTemperatureTickTimer(int ticktimer); // // public void clearTemporaryModifiers(); // // /** // * Returns the capability's matching TemperatureEnum enum // * @return TemperatureEnum for the temperature // */ // public TemperatureEnum getTemperatureEnum(); // // /** // * (Don't use this!) <br> // * Runs a tick update for the player's temperature capability // * @param player // * @param world // * @param phase // */ // public void tickUpdate(EntityPlayer player, World world, TickEvent.Phase phase); // // /** // * (Don't use this!) <br> // * Checks if the capability needs an update // * @return boolean has temperature changed // */ // public boolean isDirty(); // /** // * (Don't use this!) <br> // * Sets the capability as updated // */ // public void setClean(); // // /** // * (Don't use this!) <br> // * Gets the current tick of the packet timer // * @return int packetTimer // */ // public int getPacketTimer(); // } // // Path: src/main/java/com/charles445/simpledifficulty/api/thirst/IThirstCapability.java // public interface IThirstCapability // { // public float getThirstExhaustion(); // public int getThirstLevel(); // public float getThirstSaturation(); // public int getThirstTickTimer(); // // public void setThirstExhaustion(float exhaustion); // public void setThirstLevel(int thirst); // public void setThirstSaturation(float saturation); // public void setThirstTickTimer(int ticktimer); // // public void addThirstExhaustion(float exhaustion); // public void addThirstLevel(int thirst); // public void addThirstSaturation(float saturation); // public void addThirstTickTimer(int ticktimer); // // /** // * Check whether the thirst level isn't maximum // * <br> // * Not to be confused with the "Thirsty" effect! // * @return boolean thirst isn't maximum // */ // public boolean isThirsty(); // // /** // * (Don't use this!) <br> // * Checks if the capability needs an update // * @return boolean has thirst changed // */ // public boolean isDirty(); // // /** // * (Don't use this!) <br> // * Sets the capability as updated // */ // public void setClean(); // // /** // * (Don't use this!) <br> // * Runs a tick update for the player's thirst capability // * @param player // * @param world // * @param phase // */ // public void tickUpdate(EntityPlayer player, World world, TickEvent.Phase phase); // // // /** // * (Don't use this!) <br> // * Gets the current tick of the packet timer // * @return int packetTimer // */ // public int getPacketTimer(); // }
import com.charles445.simpledifficulty.api.temperature.ITemperatureCapability; import com.charles445.simpledifficulty.api.thirst.IThirstCapability; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject;
package com.charles445.simpledifficulty.api; public class SDCapabilities {
// Path: src/main/java/com/charles445/simpledifficulty/api/temperature/ITemperatureCapability.java // public interface ITemperatureCapability // { // public int getTemperatureLevel(); // public int getTemperatureTickTimer(); // public ImmutableMap<String, TemporaryModifier> getTemporaryModifiers(); // // public void setTemperatureLevel(int temperature); // public void setTemperatureTickTimer(int ticktimer); // public void setTemporaryModifier(String name, float temperature, int duration); // // public void addTemperatureLevel(int temperature); // public void addTemperatureTickTimer(int ticktimer); // // public void clearTemporaryModifiers(); // // /** // * Returns the capability's matching TemperatureEnum enum // * @return TemperatureEnum for the temperature // */ // public TemperatureEnum getTemperatureEnum(); // // /** // * (Don't use this!) <br> // * Runs a tick update for the player's temperature capability // * @param player // * @param world // * @param phase // */ // public void tickUpdate(EntityPlayer player, World world, TickEvent.Phase phase); // // /** // * (Don't use this!) <br> // * Checks if the capability needs an update // * @return boolean has temperature changed // */ // public boolean isDirty(); // /** // * (Don't use this!) <br> // * Sets the capability as updated // */ // public void setClean(); // // /** // * (Don't use this!) <br> // * Gets the current tick of the packet timer // * @return int packetTimer // */ // public int getPacketTimer(); // } // // Path: src/main/java/com/charles445/simpledifficulty/api/thirst/IThirstCapability.java // public interface IThirstCapability // { // public float getThirstExhaustion(); // public int getThirstLevel(); // public float getThirstSaturation(); // public int getThirstTickTimer(); // // public void setThirstExhaustion(float exhaustion); // public void setThirstLevel(int thirst); // public void setThirstSaturation(float saturation); // public void setThirstTickTimer(int ticktimer); // // public void addThirstExhaustion(float exhaustion); // public void addThirstLevel(int thirst); // public void addThirstSaturation(float saturation); // public void addThirstTickTimer(int ticktimer); // // /** // * Check whether the thirst level isn't maximum // * <br> // * Not to be confused with the "Thirsty" effect! // * @return boolean thirst isn't maximum // */ // public boolean isThirsty(); // // /** // * (Don't use this!) <br> // * Checks if the capability needs an update // * @return boolean has thirst changed // */ // public boolean isDirty(); // // /** // * (Don't use this!) <br> // * Sets the capability as updated // */ // public void setClean(); // // /** // * (Don't use this!) <br> // * Runs a tick update for the player's thirst capability // * @param player // * @param world // * @param phase // */ // public void tickUpdate(EntityPlayer player, World world, TickEvent.Phase phase); // // // /** // * (Don't use this!) <br> // * Gets the current tick of the packet timer // * @return int packetTimer // */ // public int getPacketTimer(); // } // Path: src/main/java/com/charles445/simpledifficulty/api/SDCapabilities.java import com.charles445.simpledifficulty.api.temperature.ITemperatureCapability; import com.charles445.simpledifficulty.api.thirst.IThirstCapability; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; package com.charles445.simpledifficulty.api; public class SDCapabilities {
@CapabilityInject(ITemperatureCapability.class)
CreativeMD/EnhancedVisuals
src/main/java/com/charles445/simpledifficulty/api/SDCapabilities.java
// Path: src/main/java/com/charles445/simpledifficulty/api/temperature/ITemperatureCapability.java // public interface ITemperatureCapability // { // public int getTemperatureLevel(); // public int getTemperatureTickTimer(); // public ImmutableMap<String, TemporaryModifier> getTemporaryModifiers(); // // public void setTemperatureLevel(int temperature); // public void setTemperatureTickTimer(int ticktimer); // public void setTemporaryModifier(String name, float temperature, int duration); // // public void addTemperatureLevel(int temperature); // public void addTemperatureTickTimer(int ticktimer); // // public void clearTemporaryModifiers(); // // /** // * Returns the capability's matching TemperatureEnum enum // * @return TemperatureEnum for the temperature // */ // public TemperatureEnum getTemperatureEnum(); // // /** // * (Don't use this!) <br> // * Runs a tick update for the player's temperature capability // * @param player // * @param world // * @param phase // */ // public void tickUpdate(EntityPlayer player, World world, TickEvent.Phase phase); // // /** // * (Don't use this!) <br> // * Checks if the capability needs an update // * @return boolean has temperature changed // */ // public boolean isDirty(); // /** // * (Don't use this!) <br> // * Sets the capability as updated // */ // public void setClean(); // // /** // * (Don't use this!) <br> // * Gets the current tick of the packet timer // * @return int packetTimer // */ // public int getPacketTimer(); // } // // Path: src/main/java/com/charles445/simpledifficulty/api/thirst/IThirstCapability.java // public interface IThirstCapability // { // public float getThirstExhaustion(); // public int getThirstLevel(); // public float getThirstSaturation(); // public int getThirstTickTimer(); // // public void setThirstExhaustion(float exhaustion); // public void setThirstLevel(int thirst); // public void setThirstSaturation(float saturation); // public void setThirstTickTimer(int ticktimer); // // public void addThirstExhaustion(float exhaustion); // public void addThirstLevel(int thirst); // public void addThirstSaturation(float saturation); // public void addThirstTickTimer(int ticktimer); // // /** // * Check whether the thirst level isn't maximum // * <br> // * Not to be confused with the "Thirsty" effect! // * @return boolean thirst isn't maximum // */ // public boolean isThirsty(); // // /** // * (Don't use this!) <br> // * Checks if the capability needs an update // * @return boolean has thirst changed // */ // public boolean isDirty(); // // /** // * (Don't use this!) <br> // * Sets the capability as updated // */ // public void setClean(); // // /** // * (Don't use this!) <br> // * Runs a tick update for the player's thirst capability // * @param player // * @param world // * @param phase // */ // public void tickUpdate(EntityPlayer player, World world, TickEvent.Phase phase); // // // /** // * (Don't use this!) <br> // * Gets the current tick of the packet timer // * @return int packetTimer // */ // public int getPacketTimer(); // }
import com.charles445.simpledifficulty.api.temperature.ITemperatureCapability; import com.charles445.simpledifficulty.api.thirst.IThirstCapability; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject;
package com.charles445.simpledifficulty.api; public class SDCapabilities { @CapabilityInject(ITemperatureCapability.class) public static final Capability<ITemperatureCapability> TEMPERATURE = null; public static final String TEMPERATURE_IDENTIFIER = "temperature";
// Path: src/main/java/com/charles445/simpledifficulty/api/temperature/ITemperatureCapability.java // public interface ITemperatureCapability // { // public int getTemperatureLevel(); // public int getTemperatureTickTimer(); // public ImmutableMap<String, TemporaryModifier> getTemporaryModifiers(); // // public void setTemperatureLevel(int temperature); // public void setTemperatureTickTimer(int ticktimer); // public void setTemporaryModifier(String name, float temperature, int duration); // // public void addTemperatureLevel(int temperature); // public void addTemperatureTickTimer(int ticktimer); // // public void clearTemporaryModifiers(); // // /** // * Returns the capability's matching TemperatureEnum enum // * @return TemperatureEnum for the temperature // */ // public TemperatureEnum getTemperatureEnum(); // // /** // * (Don't use this!) <br> // * Runs a tick update for the player's temperature capability // * @param player // * @param world // * @param phase // */ // public void tickUpdate(EntityPlayer player, World world, TickEvent.Phase phase); // // /** // * (Don't use this!) <br> // * Checks if the capability needs an update // * @return boolean has temperature changed // */ // public boolean isDirty(); // /** // * (Don't use this!) <br> // * Sets the capability as updated // */ // public void setClean(); // // /** // * (Don't use this!) <br> // * Gets the current tick of the packet timer // * @return int packetTimer // */ // public int getPacketTimer(); // } // // Path: src/main/java/com/charles445/simpledifficulty/api/thirst/IThirstCapability.java // public interface IThirstCapability // { // public float getThirstExhaustion(); // public int getThirstLevel(); // public float getThirstSaturation(); // public int getThirstTickTimer(); // // public void setThirstExhaustion(float exhaustion); // public void setThirstLevel(int thirst); // public void setThirstSaturation(float saturation); // public void setThirstTickTimer(int ticktimer); // // public void addThirstExhaustion(float exhaustion); // public void addThirstLevel(int thirst); // public void addThirstSaturation(float saturation); // public void addThirstTickTimer(int ticktimer); // // /** // * Check whether the thirst level isn't maximum // * <br> // * Not to be confused with the "Thirsty" effect! // * @return boolean thirst isn't maximum // */ // public boolean isThirsty(); // // /** // * (Don't use this!) <br> // * Checks if the capability needs an update // * @return boolean has thirst changed // */ // public boolean isDirty(); // // /** // * (Don't use this!) <br> // * Sets the capability as updated // */ // public void setClean(); // // /** // * (Don't use this!) <br> // * Runs a tick update for the player's thirst capability // * @param player // * @param world // * @param phase // */ // public void tickUpdate(EntityPlayer player, World world, TickEvent.Phase phase); // // // /** // * (Don't use this!) <br> // * Gets the current tick of the packet timer // * @return int packetTimer // */ // public int getPacketTimer(); // } // Path: src/main/java/com/charles445/simpledifficulty/api/SDCapabilities.java import com.charles445.simpledifficulty.api.temperature.ITemperatureCapability; import com.charles445.simpledifficulty.api.thirst.IThirstCapability; import net.minecraft.entity.player.EntityPlayer; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; package com.charles445.simpledifficulty.api; public class SDCapabilities { @CapabilityInject(ITemperatureCapability.class) public static final Capability<ITemperatureCapability> TEMPERATURE = null; public static final String TEMPERATURE_IDENTIFIER = "temperature";
@CapabilityInject(IThirstCapability.class)
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/common/addon/toughasnails/ToughAsNailsAddon.java
// Path: src/main/java/team/creative/enhancedvisuals/EnhancedVisuals.java // @Mod(modid = EnhancedVisuals.MODID, name = EnhancedVisuals.NAME, version = EnhancedVisuals.VERSION, acceptedMinecraftVersions = "", dependencies = "required-after:creativecore", guiFactory = "team.creative.enhancedvisuals.client.EVSettings") // public class EnhancedVisuals { // // public static final String MODID = "enhancedvisuals"; // public static final String NAME = "Enhanced Visuals"; // public static final String VERSION = "1.3.0"; // // public static final Logger LOGGER = LogManager.getLogger(EnhancedVisuals.MODID); // public static EVEvents EVENTS; // public static DeathMessages MESSAGES; // public static EnhancedVisualsConfig CONFIG; // // @SidedProxy(clientSide = "team.creative.enhancedvisuals.client.EVClient", serverSide = "team.creative.enhancedvisuals.server.EVServer") // public static EVServer proxy; // // @EventHandler // public void load(FMLInitializationEvent event) { // CreativeCorePacket.registerPacket(ExplosionPacket.class); // CreativeCorePacket.registerPacket(DamagePacket.class); // CreativeCorePacket.registerPacket(PotionPacket.class); // // MinecraftForge.EVENT_BUS.register(EVENTS = new EVEvents()); // // VisualHandlers.init(); // MESSAGES = new DeathMessages(); // CONFIG = new EnhancedVisualsConfig(); // // if (Loader.isModLoaded("toughasnails")) // ToughAsNailsAddon.load(); // // if (Loader.isModLoaded("simpledifficulty")) // SimpleDifficultyAddon.load(); // // proxy.load(event); // // ConfigHolderDynamic root = CreativeConfigRegistry.ROOT.registerFolder(MODID); // root.registerValue("general", CONFIG, ConfigSynchronization.CLIENT, false); // root.registerValue("messages", MESSAGES); // ConfigHolderDynamic handlers = root.registerFolder("handlers", ConfigSynchronization.CLIENT); // for (Entry<ResourceLocation, VisualHandler> entry : VisualRegistry.entrySet()) // handlers.registerValue(entry.getKey().getResourcePath(), entry.getValue()); // // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/common/visual/VisualRegistry.java // public class VisualRegistry { // // private static LinkedHashMap<ResourceLocation, VisualHandler> handlers = new LinkedHashMap<>(); // // public static void registerHandler(ResourceLocation location, VisualHandler handler) { // handlers.put(location, handler); // } // // public static Collection<VisualHandler> handlers() { // return handlers.values(); // } // // public static Set<Entry<ResourceLocation, VisualHandler>> entrySet() { // return handlers.entrySet(); // } // // }
import net.minecraft.util.ResourceLocation; import team.creative.enhancedvisuals.EnhancedVisuals; import team.creative.enhancedvisuals.common.visual.VisualRegistry;
package team.creative.enhancedvisuals.common.addon.toughasnails; public class ToughAsNailsAddon { public static ThirstHandler thirst; public static TemperatureHandler temperature; public static void load() {
// Path: src/main/java/team/creative/enhancedvisuals/EnhancedVisuals.java // @Mod(modid = EnhancedVisuals.MODID, name = EnhancedVisuals.NAME, version = EnhancedVisuals.VERSION, acceptedMinecraftVersions = "", dependencies = "required-after:creativecore", guiFactory = "team.creative.enhancedvisuals.client.EVSettings") // public class EnhancedVisuals { // // public static final String MODID = "enhancedvisuals"; // public static final String NAME = "Enhanced Visuals"; // public static final String VERSION = "1.3.0"; // // public static final Logger LOGGER = LogManager.getLogger(EnhancedVisuals.MODID); // public static EVEvents EVENTS; // public static DeathMessages MESSAGES; // public static EnhancedVisualsConfig CONFIG; // // @SidedProxy(clientSide = "team.creative.enhancedvisuals.client.EVClient", serverSide = "team.creative.enhancedvisuals.server.EVServer") // public static EVServer proxy; // // @EventHandler // public void load(FMLInitializationEvent event) { // CreativeCorePacket.registerPacket(ExplosionPacket.class); // CreativeCorePacket.registerPacket(DamagePacket.class); // CreativeCorePacket.registerPacket(PotionPacket.class); // // MinecraftForge.EVENT_BUS.register(EVENTS = new EVEvents()); // // VisualHandlers.init(); // MESSAGES = new DeathMessages(); // CONFIG = new EnhancedVisualsConfig(); // // if (Loader.isModLoaded("toughasnails")) // ToughAsNailsAddon.load(); // // if (Loader.isModLoaded("simpledifficulty")) // SimpleDifficultyAddon.load(); // // proxy.load(event); // // ConfigHolderDynamic root = CreativeConfigRegistry.ROOT.registerFolder(MODID); // root.registerValue("general", CONFIG, ConfigSynchronization.CLIENT, false); // root.registerValue("messages", MESSAGES); // ConfigHolderDynamic handlers = root.registerFolder("handlers", ConfigSynchronization.CLIENT); // for (Entry<ResourceLocation, VisualHandler> entry : VisualRegistry.entrySet()) // handlers.registerValue(entry.getKey().getResourcePath(), entry.getValue()); // // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/common/visual/VisualRegistry.java // public class VisualRegistry { // // private static LinkedHashMap<ResourceLocation, VisualHandler> handlers = new LinkedHashMap<>(); // // public static void registerHandler(ResourceLocation location, VisualHandler handler) { // handlers.put(location, handler); // } // // public static Collection<VisualHandler> handlers() { // return handlers.values(); // } // // public static Set<Entry<ResourceLocation, VisualHandler>> entrySet() { // return handlers.entrySet(); // } // // } // Path: src/main/java/team/creative/enhancedvisuals/common/addon/toughasnails/ToughAsNailsAddon.java import net.minecraft.util.ResourceLocation; import team.creative.enhancedvisuals.EnhancedVisuals; import team.creative.enhancedvisuals.common.visual.VisualRegistry; package team.creative.enhancedvisuals.common.addon.toughasnails; public class ToughAsNailsAddon { public static ThirstHandler thirst; public static TemperatureHandler temperature; public static void load() {
VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "thirst"), thirst = new ThirstHandler());
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/common/addon/toughasnails/ToughAsNailsAddon.java
// Path: src/main/java/team/creative/enhancedvisuals/EnhancedVisuals.java // @Mod(modid = EnhancedVisuals.MODID, name = EnhancedVisuals.NAME, version = EnhancedVisuals.VERSION, acceptedMinecraftVersions = "", dependencies = "required-after:creativecore", guiFactory = "team.creative.enhancedvisuals.client.EVSettings") // public class EnhancedVisuals { // // public static final String MODID = "enhancedvisuals"; // public static final String NAME = "Enhanced Visuals"; // public static final String VERSION = "1.3.0"; // // public static final Logger LOGGER = LogManager.getLogger(EnhancedVisuals.MODID); // public static EVEvents EVENTS; // public static DeathMessages MESSAGES; // public static EnhancedVisualsConfig CONFIG; // // @SidedProxy(clientSide = "team.creative.enhancedvisuals.client.EVClient", serverSide = "team.creative.enhancedvisuals.server.EVServer") // public static EVServer proxy; // // @EventHandler // public void load(FMLInitializationEvent event) { // CreativeCorePacket.registerPacket(ExplosionPacket.class); // CreativeCorePacket.registerPacket(DamagePacket.class); // CreativeCorePacket.registerPacket(PotionPacket.class); // // MinecraftForge.EVENT_BUS.register(EVENTS = new EVEvents()); // // VisualHandlers.init(); // MESSAGES = new DeathMessages(); // CONFIG = new EnhancedVisualsConfig(); // // if (Loader.isModLoaded("toughasnails")) // ToughAsNailsAddon.load(); // // if (Loader.isModLoaded("simpledifficulty")) // SimpleDifficultyAddon.load(); // // proxy.load(event); // // ConfigHolderDynamic root = CreativeConfigRegistry.ROOT.registerFolder(MODID); // root.registerValue("general", CONFIG, ConfigSynchronization.CLIENT, false); // root.registerValue("messages", MESSAGES); // ConfigHolderDynamic handlers = root.registerFolder("handlers", ConfigSynchronization.CLIENT); // for (Entry<ResourceLocation, VisualHandler> entry : VisualRegistry.entrySet()) // handlers.registerValue(entry.getKey().getResourcePath(), entry.getValue()); // // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/common/visual/VisualRegistry.java // public class VisualRegistry { // // private static LinkedHashMap<ResourceLocation, VisualHandler> handlers = new LinkedHashMap<>(); // // public static void registerHandler(ResourceLocation location, VisualHandler handler) { // handlers.put(location, handler); // } // // public static Collection<VisualHandler> handlers() { // return handlers.values(); // } // // public static Set<Entry<ResourceLocation, VisualHandler>> entrySet() { // return handlers.entrySet(); // } // // }
import net.minecraft.util.ResourceLocation; import team.creative.enhancedvisuals.EnhancedVisuals; import team.creative.enhancedvisuals.common.visual.VisualRegistry;
package team.creative.enhancedvisuals.common.addon.toughasnails; public class ToughAsNailsAddon { public static ThirstHandler thirst; public static TemperatureHandler temperature; public static void load() {
// Path: src/main/java/team/creative/enhancedvisuals/EnhancedVisuals.java // @Mod(modid = EnhancedVisuals.MODID, name = EnhancedVisuals.NAME, version = EnhancedVisuals.VERSION, acceptedMinecraftVersions = "", dependencies = "required-after:creativecore", guiFactory = "team.creative.enhancedvisuals.client.EVSettings") // public class EnhancedVisuals { // // public static final String MODID = "enhancedvisuals"; // public static final String NAME = "Enhanced Visuals"; // public static final String VERSION = "1.3.0"; // // public static final Logger LOGGER = LogManager.getLogger(EnhancedVisuals.MODID); // public static EVEvents EVENTS; // public static DeathMessages MESSAGES; // public static EnhancedVisualsConfig CONFIG; // // @SidedProxy(clientSide = "team.creative.enhancedvisuals.client.EVClient", serverSide = "team.creative.enhancedvisuals.server.EVServer") // public static EVServer proxy; // // @EventHandler // public void load(FMLInitializationEvent event) { // CreativeCorePacket.registerPacket(ExplosionPacket.class); // CreativeCorePacket.registerPacket(DamagePacket.class); // CreativeCorePacket.registerPacket(PotionPacket.class); // // MinecraftForge.EVENT_BUS.register(EVENTS = new EVEvents()); // // VisualHandlers.init(); // MESSAGES = new DeathMessages(); // CONFIG = new EnhancedVisualsConfig(); // // if (Loader.isModLoaded("toughasnails")) // ToughAsNailsAddon.load(); // // if (Loader.isModLoaded("simpledifficulty")) // SimpleDifficultyAddon.load(); // // proxy.load(event); // // ConfigHolderDynamic root = CreativeConfigRegistry.ROOT.registerFolder(MODID); // root.registerValue("general", CONFIG, ConfigSynchronization.CLIENT, false); // root.registerValue("messages", MESSAGES); // ConfigHolderDynamic handlers = root.registerFolder("handlers", ConfigSynchronization.CLIENT); // for (Entry<ResourceLocation, VisualHandler> entry : VisualRegistry.entrySet()) // handlers.registerValue(entry.getKey().getResourcePath(), entry.getValue()); // // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/common/visual/VisualRegistry.java // public class VisualRegistry { // // private static LinkedHashMap<ResourceLocation, VisualHandler> handlers = new LinkedHashMap<>(); // // public static void registerHandler(ResourceLocation location, VisualHandler handler) { // handlers.put(location, handler); // } // // public static Collection<VisualHandler> handlers() { // return handlers.values(); // } // // public static Set<Entry<ResourceLocation, VisualHandler>> entrySet() { // return handlers.entrySet(); // } // // } // Path: src/main/java/team/creative/enhancedvisuals/common/addon/toughasnails/ToughAsNailsAddon.java import net.minecraft.util.ResourceLocation; import team.creative.enhancedvisuals.EnhancedVisuals; import team.creative.enhancedvisuals.common.visual.VisualRegistry; package team.creative.enhancedvisuals.common.addon.toughasnails; public class ToughAsNailsAddon { public static ThirstHandler thirst; public static TemperatureHandler temperature; public static void load() {
VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "thirst"), thirst = new ThirstHandler());
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/common/handler/VisualHandlers.java
// Path: src/main/java/team/creative/enhancedvisuals/EnhancedVisuals.java // @Mod(modid = EnhancedVisuals.MODID, name = EnhancedVisuals.NAME, version = EnhancedVisuals.VERSION, acceptedMinecraftVersions = "", dependencies = "required-after:creativecore", guiFactory = "team.creative.enhancedvisuals.client.EVSettings") // public class EnhancedVisuals { // // public static final String MODID = "enhancedvisuals"; // public static final String NAME = "Enhanced Visuals"; // public static final String VERSION = "1.3.0"; // // public static final Logger LOGGER = LogManager.getLogger(EnhancedVisuals.MODID); // public static EVEvents EVENTS; // public static DeathMessages MESSAGES; // public static EnhancedVisualsConfig CONFIG; // // @SidedProxy(clientSide = "team.creative.enhancedvisuals.client.EVClient", serverSide = "team.creative.enhancedvisuals.server.EVServer") // public static EVServer proxy; // // @EventHandler // public void load(FMLInitializationEvent event) { // CreativeCorePacket.registerPacket(ExplosionPacket.class); // CreativeCorePacket.registerPacket(DamagePacket.class); // CreativeCorePacket.registerPacket(PotionPacket.class); // // MinecraftForge.EVENT_BUS.register(EVENTS = new EVEvents()); // // VisualHandlers.init(); // MESSAGES = new DeathMessages(); // CONFIG = new EnhancedVisualsConfig(); // // if (Loader.isModLoaded("toughasnails")) // ToughAsNailsAddon.load(); // // if (Loader.isModLoaded("simpledifficulty")) // SimpleDifficultyAddon.load(); // // proxy.load(event); // // ConfigHolderDynamic root = CreativeConfigRegistry.ROOT.registerFolder(MODID); // root.registerValue("general", CONFIG, ConfigSynchronization.CLIENT, false); // root.registerValue("messages", MESSAGES); // ConfigHolderDynamic handlers = root.registerFolder("handlers", ConfigSynchronization.CLIENT); // for (Entry<ResourceLocation, VisualHandler> entry : VisualRegistry.entrySet()) // handlers.registerValue(entry.getKey().getResourcePath(), entry.getValue()); // // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/common/visual/VisualRegistry.java // public class VisualRegistry { // // private static LinkedHashMap<ResourceLocation, VisualHandler> handlers = new LinkedHashMap<>(); // // public static void registerHandler(ResourceLocation location, VisualHandler handler) { // handlers.put(location, handler); // } // // public static Collection<VisualHandler> handlers() { // return handlers.values(); // } // // public static Set<Entry<ResourceLocation, VisualHandler>> entrySet() { // return handlers.entrySet(); // } // // }
import net.minecraft.util.ResourceLocation; import team.creative.enhancedvisuals.EnhancedVisuals; import team.creative.enhancedvisuals.common.visual.VisualRegistry;
package team.creative.enhancedvisuals.common.handler; public class VisualHandlers { public static ExplosionHandler EXPLOSION; public static PotionHandler POTION; public static SandSplatHandler SAND; public static SplashHandler SPLASH; public static DamageHandler DAMAGE; public static SlenderHandler SLENDER; public static SaturationHandler SATURATION; public static HeartbeatHandler HEARTBEAT; public static void init() {
// Path: src/main/java/team/creative/enhancedvisuals/EnhancedVisuals.java // @Mod(modid = EnhancedVisuals.MODID, name = EnhancedVisuals.NAME, version = EnhancedVisuals.VERSION, acceptedMinecraftVersions = "", dependencies = "required-after:creativecore", guiFactory = "team.creative.enhancedvisuals.client.EVSettings") // public class EnhancedVisuals { // // public static final String MODID = "enhancedvisuals"; // public static final String NAME = "Enhanced Visuals"; // public static final String VERSION = "1.3.0"; // // public static final Logger LOGGER = LogManager.getLogger(EnhancedVisuals.MODID); // public static EVEvents EVENTS; // public static DeathMessages MESSAGES; // public static EnhancedVisualsConfig CONFIG; // // @SidedProxy(clientSide = "team.creative.enhancedvisuals.client.EVClient", serverSide = "team.creative.enhancedvisuals.server.EVServer") // public static EVServer proxy; // // @EventHandler // public void load(FMLInitializationEvent event) { // CreativeCorePacket.registerPacket(ExplosionPacket.class); // CreativeCorePacket.registerPacket(DamagePacket.class); // CreativeCorePacket.registerPacket(PotionPacket.class); // // MinecraftForge.EVENT_BUS.register(EVENTS = new EVEvents()); // // VisualHandlers.init(); // MESSAGES = new DeathMessages(); // CONFIG = new EnhancedVisualsConfig(); // // if (Loader.isModLoaded("toughasnails")) // ToughAsNailsAddon.load(); // // if (Loader.isModLoaded("simpledifficulty")) // SimpleDifficultyAddon.load(); // // proxy.load(event); // // ConfigHolderDynamic root = CreativeConfigRegistry.ROOT.registerFolder(MODID); // root.registerValue("general", CONFIG, ConfigSynchronization.CLIENT, false); // root.registerValue("messages", MESSAGES); // ConfigHolderDynamic handlers = root.registerFolder("handlers", ConfigSynchronization.CLIENT); // for (Entry<ResourceLocation, VisualHandler> entry : VisualRegistry.entrySet()) // handlers.registerValue(entry.getKey().getResourcePath(), entry.getValue()); // // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/common/visual/VisualRegistry.java // public class VisualRegistry { // // private static LinkedHashMap<ResourceLocation, VisualHandler> handlers = new LinkedHashMap<>(); // // public static void registerHandler(ResourceLocation location, VisualHandler handler) { // handlers.put(location, handler); // } // // public static Collection<VisualHandler> handlers() { // return handlers.values(); // } // // public static Set<Entry<ResourceLocation, VisualHandler>> entrySet() { // return handlers.entrySet(); // } // // } // Path: src/main/java/team/creative/enhancedvisuals/common/handler/VisualHandlers.java import net.minecraft.util.ResourceLocation; import team.creative.enhancedvisuals.EnhancedVisuals; import team.creative.enhancedvisuals.common.visual.VisualRegistry; package team.creative.enhancedvisuals.common.handler; public class VisualHandlers { public static ExplosionHandler EXPLOSION; public static PotionHandler POTION; public static SandSplatHandler SAND; public static SplashHandler SPLASH; public static DamageHandler DAMAGE; public static SlenderHandler SLENDER; public static SaturationHandler SATURATION; public static HeartbeatHandler HEARTBEAT; public static void init() {
VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "explosion"), EXPLOSION = new ExplosionHandler());
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/common/handler/VisualHandlers.java
// Path: src/main/java/team/creative/enhancedvisuals/EnhancedVisuals.java // @Mod(modid = EnhancedVisuals.MODID, name = EnhancedVisuals.NAME, version = EnhancedVisuals.VERSION, acceptedMinecraftVersions = "", dependencies = "required-after:creativecore", guiFactory = "team.creative.enhancedvisuals.client.EVSettings") // public class EnhancedVisuals { // // public static final String MODID = "enhancedvisuals"; // public static final String NAME = "Enhanced Visuals"; // public static final String VERSION = "1.3.0"; // // public static final Logger LOGGER = LogManager.getLogger(EnhancedVisuals.MODID); // public static EVEvents EVENTS; // public static DeathMessages MESSAGES; // public static EnhancedVisualsConfig CONFIG; // // @SidedProxy(clientSide = "team.creative.enhancedvisuals.client.EVClient", serverSide = "team.creative.enhancedvisuals.server.EVServer") // public static EVServer proxy; // // @EventHandler // public void load(FMLInitializationEvent event) { // CreativeCorePacket.registerPacket(ExplosionPacket.class); // CreativeCorePacket.registerPacket(DamagePacket.class); // CreativeCorePacket.registerPacket(PotionPacket.class); // // MinecraftForge.EVENT_BUS.register(EVENTS = new EVEvents()); // // VisualHandlers.init(); // MESSAGES = new DeathMessages(); // CONFIG = new EnhancedVisualsConfig(); // // if (Loader.isModLoaded("toughasnails")) // ToughAsNailsAddon.load(); // // if (Loader.isModLoaded("simpledifficulty")) // SimpleDifficultyAddon.load(); // // proxy.load(event); // // ConfigHolderDynamic root = CreativeConfigRegistry.ROOT.registerFolder(MODID); // root.registerValue("general", CONFIG, ConfigSynchronization.CLIENT, false); // root.registerValue("messages", MESSAGES); // ConfigHolderDynamic handlers = root.registerFolder("handlers", ConfigSynchronization.CLIENT); // for (Entry<ResourceLocation, VisualHandler> entry : VisualRegistry.entrySet()) // handlers.registerValue(entry.getKey().getResourcePath(), entry.getValue()); // // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/common/visual/VisualRegistry.java // public class VisualRegistry { // // private static LinkedHashMap<ResourceLocation, VisualHandler> handlers = new LinkedHashMap<>(); // // public static void registerHandler(ResourceLocation location, VisualHandler handler) { // handlers.put(location, handler); // } // // public static Collection<VisualHandler> handlers() { // return handlers.values(); // } // // public static Set<Entry<ResourceLocation, VisualHandler>> entrySet() { // return handlers.entrySet(); // } // // }
import net.minecraft.util.ResourceLocation; import team.creative.enhancedvisuals.EnhancedVisuals; import team.creative.enhancedvisuals.common.visual.VisualRegistry;
package team.creative.enhancedvisuals.common.handler; public class VisualHandlers { public static ExplosionHandler EXPLOSION; public static PotionHandler POTION; public static SandSplatHandler SAND; public static SplashHandler SPLASH; public static DamageHandler DAMAGE; public static SlenderHandler SLENDER; public static SaturationHandler SATURATION; public static HeartbeatHandler HEARTBEAT; public static void init() {
// Path: src/main/java/team/creative/enhancedvisuals/EnhancedVisuals.java // @Mod(modid = EnhancedVisuals.MODID, name = EnhancedVisuals.NAME, version = EnhancedVisuals.VERSION, acceptedMinecraftVersions = "", dependencies = "required-after:creativecore", guiFactory = "team.creative.enhancedvisuals.client.EVSettings") // public class EnhancedVisuals { // // public static final String MODID = "enhancedvisuals"; // public static final String NAME = "Enhanced Visuals"; // public static final String VERSION = "1.3.0"; // // public static final Logger LOGGER = LogManager.getLogger(EnhancedVisuals.MODID); // public static EVEvents EVENTS; // public static DeathMessages MESSAGES; // public static EnhancedVisualsConfig CONFIG; // // @SidedProxy(clientSide = "team.creative.enhancedvisuals.client.EVClient", serverSide = "team.creative.enhancedvisuals.server.EVServer") // public static EVServer proxy; // // @EventHandler // public void load(FMLInitializationEvent event) { // CreativeCorePacket.registerPacket(ExplosionPacket.class); // CreativeCorePacket.registerPacket(DamagePacket.class); // CreativeCorePacket.registerPacket(PotionPacket.class); // // MinecraftForge.EVENT_BUS.register(EVENTS = new EVEvents()); // // VisualHandlers.init(); // MESSAGES = new DeathMessages(); // CONFIG = new EnhancedVisualsConfig(); // // if (Loader.isModLoaded("toughasnails")) // ToughAsNailsAddon.load(); // // if (Loader.isModLoaded("simpledifficulty")) // SimpleDifficultyAddon.load(); // // proxy.load(event); // // ConfigHolderDynamic root = CreativeConfigRegistry.ROOT.registerFolder(MODID); // root.registerValue("general", CONFIG, ConfigSynchronization.CLIENT, false); // root.registerValue("messages", MESSAGES); // ConfigHolderDynamic handlers = root.registerFolder("handlers", ConfigSynchronization.CLIENT); // for (Entry<ResourceLocation, VisualHandler> entry : VisualRegistry.entrySet()) // handlers.registerValue(entry.getKey().getResourcePath(), entry.getValue()); // // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/common/visual/VisualRegistry.java // public class VisualRegistry { // // private static LinkedHashMap<ResourceLocation, VisualHandler> handlers = new LinkedHashMap<>(); // // public static void registerHandler(ResourceLocation location, VisualHandler handler) { // handlers.put(location, handler); // } // // public static Collection<VisualHandler> handlers() { // return handlers.values(); // } // // public static Set<Entry<ResourceLocation, VisualHandler>> entrySet() { // return handlers.entrySet(); // } // // } // Path: src/main/java/team/creative/enhancedvisuals/common/handler/VisualHandlers.java import net.minecraft.util.ResourceLocation; import team.creative.enhancedvisuals.EnhancedVisuals; import team.creative.enhancedvisuals.common.visual.VisualRegistry; package team.creative.enhancedvisuals.common.handler; public class VisualHandlers { public static ExplosionHandler EXPLOSION; public static PotionHandler POTION; public static SandSplatHandler SAND; public static SplashHandler SPLASH; public static DamageHandler DAMAGE; public static SlenderHandler SLENDER; public static SaturationHandler SATURATION; public static HeartbeatHandler HEARTBEAT; public static void init() {
VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "explosion"), EXPLOSION = new ExplosionHandler());
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/api/type/VisualTypeSaturation.java
// Path: src/main/java/team/creative/enhancedvisuals/api/Visual.java // public class Visual { // // public final VisualType type; // public final VisualHandler handler; // // private float opacity; // // public final boolean endless; // public final Curve animation; // // private boolean displayed = false; // private int tick = 0; // // public Color color; // // public int variant; // // public Visual(VisualType type, VisualHandler handler, Curve animation, int variant) { // this.type = type; // this.handler = handler; // this.animation = animation; // this.variant = variant; // this.endless = false; // this.color = type.getColor(); // } // // public Visual(VisualType type, VisualHandler handler, int variant) { // this.type = type; // this.handler = handler; // this.animation = null; // this.variant = variant; // this.endless = true; // this.color = type.getColor(); // } // // public void setOpacityInternal(float opacity) { // this.opacity = opacity; // } // // public float getOpacityInternal() { // return opacity; // } // // public float getOpacity() { // return handler.opacity * opacity * type.opacity; // } // // public boolean displayed() { // return displayed; // } // // public void addToDisplay() { // displayed = true; // } // // public void removeFromDisplay() { // displayed = false; // } // // public VisualCategory getCategory() { // return type.cat; // } // // @SideOnly(Side.CLIENT) // public void render(TextureManager manager, int screenWidth, int screenHeight, float partialTicks) { // type.render(handler, this, manager, screenWidth, screenHeight, partialTicks); // } // // public boolean isVisible() { // return type.isVisible(handler, this); // } // // public boolean tick() { // if (endless) // return true; // opacity = (float) animation.valueAt(tick++); // return opacity > 0; // } // // public int getWidth(int screenWidth) { // return screenWidth; // } // // public int getHeight(int screenHeight) { // return screenHeight; // } // // public boolean isAffectedByWater() { // return type.isAffectedByWater(); // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/api/VisualHandler.java // public class VisualHandler implements ICreativeConfig { // // @CreativeConfig // public boolean enabled = true; // // @CreativeConfig // @CreativeConfig.DecimalRange(max = 1, min = 0) // public float opacity = 1; // // @Override // public void configured() { // // } // // public void tick(@Nullable EntityPlayer player) { // // } // // public boolean isEnabled(@Nullable EntityPlayer player) { // return enabled && opacity > 0; // } // // @SideOnly(Side.CLIENT) // public synchronized void playSound(ResourceLocation location) { // playSound(location, null, 1.0F); // } // // @SideOnly(Side.CLIENT) // public synchronized void playSound(ResourceLocation location, BlockPos pos) { // playSound(location, pos, 1.0F); // } // // @SideOnly(Side.CLIENT) // public synchronized void playSound(ResourceLocation location, float volume) { // playSound(location, null, volume); // } // // @SideOnly(Side.CLIENT) // public synchronized void playSound(ResourceLocation location, BlockPos pos, float volume) { // if (!EVClient.shouldRender()) // return; // if (pos != null) // Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSound(location, SoundCategory.MASTER, volume, 1, pos)); // else // Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSound(location, SoundCategory.MASTER, volume, 1)); // } // // @SideOnly(Side.CLIENT) // public synchronized void playSoundFadeOut(ResourceLocation location, BlockPos pos, DecimalCurve volume) { // if (!EVClient.shouldRender()) // return; // if (pos != null) // Minecraft.getMinecraft().getSoundHandler().playSound(new TickedSound(location, SoundCategory.MASTER, 1, pos, volume)); // else // Minecraft.getMinecraft().getSoundHandler().playSound(new TickedSound(location, SoundCategory.MASTER, 1, volume)); // } // // }
import net.minecraft.client.shader.Shader; import net.minecraft.client.shader.ShaderUniform; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import team.creative.enhancedvisuals.api.Visual; import team.creative.enhancedvisuals.api.VisualHandler;
package team.creative.enhancedvisuals.api.type; public class VisualTypeSaturation extends VisualTypeShader { public VisualTypeSaturation(String name) { super(name, new ResourceLocation("shaders/post/desaturate.json")); } @Override @SideOnly(Side.CLIENT) public void changeProperties(float intensity) { for (Shader mcShader : shaderGroup.getShaders()) { ShaderUniform shaderuniform = mcShader.getShaderManager().getShaderUniform("Saturation"); if (shaderuniform != null) shaderuniform.set(intensity); } } @Override
// Path: src/main/java/team/creative/enhancedvisuals/api/Visual.java // public class Visual { // // public final VisualType type; // public final VisualHandler handler; // // private float opacity; // // public final boolean endless; // public final Curve animation; // // private boolean displayed = false; // private int tick = 0; // // public Color color; // // public int variant; // // public Visual(VisualType type, VisualHandler handler, Curve animation, int variant) { // this.type = type; // this.handler = handler; // this.animation = animation; // this.variant = variant; // this.endless = false; // this.color = type.getColor(); // } // // public Visual(VisualType type, VisualHandler handler, int variant) { // this.type = type; // this.handler = handler; // this.animation = null; // this.variant = variant; // this.endless = true; // this.color = type.getColor(); // } // // public void setOpacityInternal(float opacity) { // this.opacity = opacity; // } // // public float getOpacityInternal() { // return opacity; // } // // public float getOpacity() { // return handler.opacity * opacity * type.opacity; // } // // public boolean displayed() { // return displayed; // } // // public void addToDisplay() { // displayed = true; // } // // public void removeFromDisplay() { // displayed = false; // } // // public VisualCategory getCategory() { // return type.cat; // } // // @SideOnly(Side.CLIENT) // public void render(TextureManager manager, int screenWidth, int screenHeight, float partialTicks) { // type.render(handler, this, manager, screenWidth, screenHeight, partialTicks); // } // // public boolean isVisible() { // return type.isVisible(handler, this); // } // // public boolean tick() { // if (endless) // return true; // opacity = (float) animation.valueAt(tick++); // return opacity > 0; // } // // public int getWidth(int screenWidth) { // return screenWidth; // } // // public int getHeight(int screenHeight) { // return screenHeight; // } // // public boolean isAffectedByWater() { // return type.isAffectedByWater(); // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/api/VisualHandler.java // public class VisualHandler implements ICreativeConfig { // // @CreativeConfig // public boolean enabled = true; // // @CreativeConfig // @CreativeConfig.DecimalRange(max = 1, min = 0) // public float opacity = 1; // // @Override // public void configured() { // // } // // public void tick(@Nullable EntityPlayer player) { // // } // // public boolean isEnabled(@Nullable EntityPlayer player) { // return enabled && opacity > 0; // } // // @SideOnly(Side.CLIENT) // public synchronized void playSound(ResourceLocation location) { // playSound(location, null, 1.0F); // } // // @SideOnly(Side.CLIENT) // public synchronized void playSound(ResourceLocation location, BlockPos pos) { // playSound(location, pos, 1.0F); // } // // @SideOnly(Side.CLIENT) // public synchronized void playSound(ResourceLocation location, float volume) { // playSound(location, null, volume); // } // // @SideOnly(Side.CLIENT) // public synchronized void playSound(ResourceLocation location, BlockPos pos, float volume) { // if (!EVClient.shouldRender()) // return; // if (pos != null) // Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSound(location, SoundCategory.MASTER, volume, 1, pos)); // else // Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSound(location, SoundCategory.MASTER, volume, 1)); // } // // @SideOnly(Side.CLIENT) // public synchronized void playSoundFadeOut(ResourceLocation location, BlockPos pos, DecimalCurve volume) { // if (!EVClient.shouldRender()) // return; // if (pos != null) // Minecraft.getMinecraft().getSoundHandler().playSound(new TickedSound(location, SoundCategory.MASTER, 1, pos, volume)); // else // Minecraft.getMinecraft().getSoundHandler().playSound(new TickedSound(location, SoundCategory.MASTER, 1, volume)); // } // // } // Path: src/main/java/team/creative/enhancedvisuals/api/type/VisualTypeSaturation.java import net.minecraft.client.shader.Shader; import net.minecraft.client.shader.ShaderUniform; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import team.creative.enhancedvisuals.api.Visual; import team.creative.enhancedvisuals.api.VisualHandler; package team.creative.enhancedvisuals.api.type; public class VisualTypeSaturation extends VisualTypeShader { public VisualTypeSaturation(String name) { super(name, new ResourceLocation("shaders/post/desaturate.json")); } @Override @SideOnly(Side.CLIENT) public void changeProperties(float intensity) { for (Shader mcShader : shaderGroup.getShaders()) { ShaderUniform shaderuniform = mcShader.getShaderManager().getShaderUniform("Saturation"); if (shaderuniform != null) shaderuniform.set(intensity); } } @Override
public boolean isVisible(VisualHandler handler, Visual visual) {
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/api/type/VisualTypeSaturation.java
// Path: src/main/java/team/creative/enhancedvisuals/api/Visual.java // public class Visual { // // public final VisualType type; // public final VisualHandler handler; // // private float opacity; // // public final boolean endless; // public final Curve animation; // // private boolean displayed = false; // private int tick = 0; // // public Color color; // // public int variant; // // public Visual(VisualType type, VisualHandler handler, Curve animation, int variant) { // this.type = type; // this.handler = handler; // this.animation = animation; // this.variant = variant; // this.endless = false; // this.color = type.getColor(); // } // // public Visual(VisualType type, VisualHandler handler, int variant) { // this.type = type; // this.handler = handler; // this.animation = null; // this.variant = variant; // this.endless = true; // this.color = type.getColor(); // } // // public void setOpacityInternal(float opacity) { // this.opacity = opacity; // } // // public float getOpacityInternal() { // return opacity; // } // // public float getOpacity() { // return handler.opacity * opacity * type.opacity; // } // // public boolean displayed() { // return displayed; // } // // public void addToDisplay() { // displayed = true; // } // // public void removeFromDisplay() { // displayed = false; // } // // public VisualCategory getCategory() { // return type.cat; // } // // @SideOnly(Side.CLIENT) // public void render(TextureManager manager, int screenWidth, int screenHeight, float partialTicks) { // type.render(handler, this, manager, screenWidth, screenHeight, partialTicks); // } // // public boolean isVisible() { // return type.isVisible(handler, this); // } // // public boolean tick() { // if (endless) // return true; // opacity = (float) animation.valueAt(tick++); // return opacity > 0; // } // // public int getWidth(int screenWidth) { // return screenWidth; // } // // public int getHeight(int screenHeight) { // return screenHeight; // } // // public boolean isAffectedByWater() { // return type.isAffectedByWater(); // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/api/VisualHandler.java // public class VisualHandler implements ICreativeConfig { // // @CreativeConfig // public boolean enabled = true; // // @CreativeConfig // @CreativeConfig.DecimalRange(max = 1, min = 0) // public float opacity = 1; // // @Override // public void configured() { // // } // // public void tick(@Nullable EntityPlayer player) { // // } // // public boolean isEnabled(@Nullable EntityPlayer player) { // return enabled && opacity > 0; // } // // @SideOnly(Side.CLIENT) // public synchronized void playSound(ResourceLocation location) { // playSound(location, null, 1.0F); // } // // @SideOnly(Side.CLIENT) // public synchronized void playSound(ResourceLocation location, BlockPos pos) { // playSound(location, pos, 1.0F); // } // // @SideOnly(Side.CLIENT) // public synchronized void playSound(ResourceLocation location, float volume) { // playSound(location, null, volume); // } // // @SideOnly(Side.CLIENT) // public synchronized void playSound(ResourceLocation location, BlockPos pos, float volume) { // if (!EVClient.shouldRender()) // return; // if (pos != null) // Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSound(location, SoundCategory.MASTER, volume, 1, pos)); // else // Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSound(location, SoundCategory.MASTER, volume, 1)); // } // // @SideOnly(Side.CLIENT) // public synchronized void playSoundFadeOut(ResourceLocation location, BlockPos pos, DecimalCurve volume) { // if (!EVClient.shouldRender()) // return; // if (pos != null) // Minecraft.getMinecraft().getSoundHandler().playSound(new TickedSound(location, SoundCategory.MASTER, 1, pos, volume)); // else // Minecraft.getMinecraft().getSoundHandler().playSound(new TickedSound(location, SoundCategory.MASTER, 1, volume)); // } // // }
import net.minecraft.client.shader.Shader; import net.minecraft.client.shader.ShaderUniform; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import team.creative.enhancedvisuals.api.Visual; import team.creative.enhancedvisuals.api.VisualHandler;
package team.creative.enhancedvisuals.api.type; public class VisualTypeSaturation extends VisualTypeShader { public VisualTypeSaturation(String name) { super(name, new ResourceLocation("shaders/post/desaturate.json")); } @Override @SideOnly(Side.CLIENT) public void changeProperties(float intensity) { for (Shader mcShader : shaderGroup.getShaders()) { ShaderUniform shaderuniform = mcShader.getShaderManager().getShaderUniform("Saturation"); if (shaderuniform != null) shaderuniform.set(intensity); } } @Override
// Path: src/main/java/team/creative/enhancedvisuals/api/Visual.java // public class Visual { // // public final VisualType type; // public final VisualHandler handler; // // private float opacity; // // public final boolean endless; // public final Curve animation; // // private boolean displayed = false; // private int tick = 0; // // public Color color; // // public int variant; // // public Visual(VisualType type, VisualHandler handler, Curve animation, int variant) { // this.type = type; // this.handler = handler; // this.animation = animation; // this.variant = variant; // this.endless = false; // this.color = type.getColor(); // } // // public Visual(VisualType type, VisualHandler handler, int variant) { // this.type = type; // this.handler = handler; // this.animation = null; // this.variant = variant; // this.endless = true; // this.color = type.getColor(); // } // // public void setOpacityInternal(float opacity) { // this.opacity = opacity; // } // // public float getOpacityInternal() { // return opacity; // } // // public float getOpacity() { // return handler.opacity * opacity * type.opacity; // } // // public boolean displayed() { // return displayed; // } // // public void addToDisplay() { // displayed = true; // } // // public void removeFromDisplay() { // displayed = false; // } // // public VisualCategory getCategory() { // return type.cat; // } // // @SideOnly(Side.CLIENT) // public void render(TextureManager manager, int screenWidth, int screenHeight, float partialTicks) { // type.render(handler, this, manager, screenWidth, screenHeight, partialTicks); // } // // public boolean isVisible() { // return type.isVisible(handler, this); // } // // public boolean tick() { // if (endless) // return true; // opacity = (float) animation.valueAt(tick++); // return opacity > 0; // } // // public int getWidth(int screenWidth) { // return screenWidth; // } // // public int getHeight(int screenHeight) { // return screenHeight; // } // // public boolean isAffectedByWater() { // return type.isAffectedByWater(); // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/api/VisualHandler.java // public class VisualHandler implements ICreativeConfig { // // @CreativeConfig // public boolean enabled = true; // // @CreativeConfig // @CreativeConfig.DecimalRange(max = 1, min = 0) // public float opacity = 1; // // @Override // public void configured() { // // } // // public void tick(@Nullable EntityPlayer player) { // // } // // public boolean isEnabled(@Nullable EntityPlayer player) { // return enabled && opacity > 0; // } // // @SideOnly(Side.CLIENT) // public synchronized void playSound(ResourceLocation location) { // playSound(location, null, 1.0F); // } // // @SideOnly(Side.CLIENT) // public synchronized void playSound(ResourceLocation location, BlockPos pos) { // playSound(location, pos, 1.0F); // } // // @SideOnly(Side.CLIENT) // public synchronized void playSound(ResourceLocation location, float volume) { // playSound(location, null, volume); // } // // @SideOnly(Side.CLIENT) // public synchronized void playSound(ResourceLocation location, BlockPos pos, float volume) { // if (!EVClient.shouldRender()) // return; // if (pos != null) // Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSound(location, SoundCategory.MASTER, volume, 1, pos)); // else // Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSound(location, SoundCategory.MASTER, volume, 1)); // } // // @SideOnly(Side.CLIENT) // public synchronized void playSoundFadeOut(ResourceLocation location, BlockPos pos, DecimalCurve volume) { // if (!EVClient.shouldRender()) // return; // if (pos != null) // Minecraft.getMinecraft().getSoundHandler().playSound(new TickedSound(location, SoundCategory.MASTER, 1, pos, volume)); // else // Minecraft.getMinecraft().getSoundHandler().playSound(new TickedSound(location, SoundCategory.MASTER, 1, volume)); // } // // } // Path: src/main/java/team/creative/enhancedvisuals/api/type/VisualTypeSaturation.java import net.minecraft.client.shader.Shader; import net.minecraft.client.shader.ShaderUniform; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import team.creative.enhancedvisuals.api.Visual; import team.creative.enhancedvisuals.api.VisualHandler; package team.creative.enhancedvisuals.api.type; public class VisualTypeSaturation extends VisualTypeShader { public VisualTypeSaturation(String name) { super(name, new ResourceLocation("shaders/post/desaturate.json")); } @Override @SideOnly(Side.CLIENT) public void changeProperties(float intensity) { for (Shader mcShader : shaderGroup.getShaders()) { ShaderUniform shaderuniform = mcShader.getShaderManager().getShaderUniform("Saturation"); if (shaderuniform != null) shaderuniform.set(intensity); } } @Override
public boolean isVisible(VisualHandler handler, Visual visual) {
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/api/VisualHandler.java
// Path: src/main/java/team/creative/enhancedvisuals/client/EVClient.java // @SideOnly(Side.CLIENT) // public class EVClient extends EVServer { // // private static Minecraft mc = Minecraft.getMinecraft(); // // @Override // public void load(FMLInitializationEvent event) { // ((IReloadableResourceManager) mc.getResourceManager()).registerReloadListener(new IResourceManagerReloadListener() { // // @Override // public void onResourceManagerReload(IResourceManager resourceManager) { // VisualManager.clearParticles(); // // for (VisualType type : VisualType.getTypes()) { // type.loadResources(resourceManager); // } // } // }); // // IResourceManager manager = mc.getResourceManager(); // for (VisualType type : VisualType.getTypes()) // type.loadResources(manager); // // MinecraftForge.EVENT_BUS.register(EVRenderer.class); // } // // public static boolean shouldRender() { // return mc.player != null ? (!mc.player.isSpectator() && (!mc.player.isCreative() || EnhancedVisuals.CONFIG.doEffectsInCreative)) : true; // } // // public static boolean shouldTick() { // return true; // } // } // // Path: src/main/java/team/creative/enhancedvisuals/client/sound/PositionedSound.java // public class PositionedSound extends net.minecraft.client.audio.PositionedSound { // // public PositionedSound(ResourceLocation location, SoundCategory category, float volume, float pitch) { // super(location, category); // this.volume = volume; // this.pitch = pitch; // this.attenuationType = AttenuationType.NONE; // } // // public PositionedSound(ResourceLocation location, SoundCategory category, float volume, float pitch, BlockPos pos) { // this(location, category, volume, pitch); // this.xPosF = pos.getX(); // this.yPosF = pos.getY(); // this.zPosF = pos.getZ(); // this.attenuationType = AttenuationType.LINEAR; // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/client/sound/TickedSound.java // public class TickedSound extends PositionedSound implements ITickableSound { // // public int tick = 0; // public DecimalCurve volumeGraph; // // public TickedSound(ResourceLocation location, SoundCategory category, float pitch, DecimalCurve volumeGraph) { // super(location, category, (float) volumeGraph.valueAt(0), pitch); // this.volumeGraph = volumeGraph; // this.repeat = true; // } // // public TickedSound(ResourceLocation location, SoundCategory category, float pitch, BlockPos pos, DecimalCurve volumeGraph) { // super(location, category, (float) volumeGraph.valueAt(0), pitch, pos); // this.volumeGraph = volumeGraph; // this.repeat = true; // } // // @Override // public boolean isDonePlaying() { // return volume == 0; // } // // @Override // public void update() { // tick++; // volume = (float) volumeGraph.valueAt(tick); // } // // }
import javax.annotation.Nullable; import com.creativemd.creativecore.common.config.api.CreativeConfig; import com.creativemd.creativecore.common.config.api.ICreativeConfig; import com.creativemd.creativecore.common.config.premade.curve.DecimalCurve; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import team.creative.enhancedvisuals.client.EVClient; import team.creative.enhancedvisuals.client.sound.PositionedSound; import team.creative.enhancedvisuals.client.sound.TickedSound;
package team.creative.enhancedvisuals.api; public class VisualHandler implements ICreativeConfig { @CreativeConfig public boolean enabled = true; @CreativeConfig @CreativeConfig.DecimalRange(max = 1, min = 0) public float opacity = 1; @Override public void configured() { } public void tick(@Nullable EntityPlayer player) { } public boolean isEnabled(@Nullable EntityPlayer player) { return enabled && opacity > 0; } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location) { playSound(location, null, 1.0F); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, BlockPos pos) { playSound(location, pos, 1.0F); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, float volume) { playSound(location, null, volume); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, BlockPos pos, float volume) {
// Path: src/main/java/team/creative/enhancedvisuals/client/EVClient.java // @SideOnly(Side.CLIENT) // public class EVClient extends EVServer { // // private static Minecraft mc = Minecraft.getMinecraft(); // // @Override // public void load(FMLInitializationEvent event) { // ((IReloadableResourceManager) mc.getResourceManager()).registerReloadListener(new IResourceManagerReloadListener() { // // @Override // public void onResourceManagerReload(IResourceManager resourceManager) { // VisualManager.clearParticles(); // // for (VisualType type : VisualType.getTypes()) { // type.loadResources(resourceManager); // } // } // }); // // IResourceManager manager = mc.getResourceManager(); // for (VisualType type : VisualType.getTypes()) // type.loadResources(manager); // // MinecraftForge.EVENT_BUS.register(EVRenderer.class); // } // // public static boolean shouldRender() { // return mc.player != null ? (!mc.player.isSpectator() && (!mc.player.isCreative() || EnhancedVisuals.CONFIG.doEffectsInCreative)) : true; // } // // public static boolean shouldTick() { // return true; // } // } // // Path: src/main/java/team/creative/enhancedvisuals/client/sound/PositionedSound.java // public class PositionedSound extends net.minecraft.client.audio.PositionedSound { // // public PositionedSound(ResourceLocation location, SoundCategory category, float volume, float pitch) { // super(location, category); // this.volume = volume; // this.pitch = pitch; // this.attenuationType = AttenuationType.NONE; // } // // public PositionedSound(ResourceLocation location, SoundCategory category, float volume, float pitch, BlockPos pos) { // this(location, category, volume, pitch); // this.xPosF = pos.getX(); // this.yPosF = pos.getY(); // this.zPosF = pos.getZ(); // this.attenuationType = AttenuationType.LINEAR; // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/client/sound/TickedSound.java // public class TickedSound extends PositionedSound implements ITickableSound { // // public int tick = 0; // public DecimalCurve volumeGraph; // // public TickedSound(ResourceLocation location, SoundCategory category, float pitch, DecimalCurve volumeGraph) { // super(location, category, (float) volumeGraph.valueAt(0), pitch); // this.volumeGraph = volumeGraph; // this.repeat = true; // } // // public TickedSound(ResourceLocation location, SoundCategory category, float pitch, BlockPos pos, DecimalCurve volumeGraph) { // super(location, category, (float) volumeGraph.valueAt(0), pitch, pos); // this.volumeGraph = volumeGraph; // this.repeat = true; // } // // @Override // public boolean isDonePlaying() { // return volume == 0; // } // // @Override // public void update() { // tick++; // volume = (float) volumeGraph.valueAt(tick); // } // // } // Path: src/main/java/team/creative/enhancedvisuals/api/VisualHandler.java import javax.annotation.Nullable; import com.creativemd.creativecore.common.config.api.CreativeConfig; import com.creativemd.creativecore.common.config.api.ICreativeConfig; import com.creativemd.creativecore.common.config.premade.curve.DecimalCurve; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import team.creative.enhancedvisuals.client.EVClient; import team.creative.enhancedvisuals.client.sound.PositionedSound; import team.creative.enhancedvisuals.client.sound.TickedSound; package team.creative.enhancedvisuals.api; public class VisualHandler implements ICreativeConfig { @CreativeConfig public boolean enabled = true; @CreativeConfig @CreativeConfig.DecimalRange(max = 1, min = 0) public float opacity = 1; @Override public void configured() { } public void tick(@Nullable EntityPlayer player) { } public boolean isEnabled(@Nullable EntityPlayer player) { return enabled && opacity > 0; } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location) { playSound(location, null, 1.0F); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, BlockPos pos) { playSound(location, pos, 1.0F); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, float volume) { playSound(location, null, volume); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, BlockPos pos, float volume) {
if (!EVClient.shouldRender())
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/api/VisualHandler.java
// Path: src/main/java/team/creative/enhancedvisuals/client/EVClient.java // @SideOnly(Side.CLIENT) // public class EVClient extends EVServer { // // private static Minecraft mc = Minecraft.getMinecraft(); // // @Override // public void load(FMLInitializationEvent event) { // ((IReloadableResourceManager) mc.getResourceManager()).registerReloadListener(new IResourceManagerReloadListener() { // // @Override // public void onResourceManagerReload(IResourceManager resourceManager) { // VisualManager.clearParticles(); // // for (VisualType type : VisualType.getTypes()) { // type.loadResources(resourceManager); // } // } // }); // // IResourceManager manager = mc.getResourceManager(); // for (VisualType type : VisualType.getTypes()) // type.loadResources(manager); // // MinecraftForge.EVENT_BUS.register(EVRenderer.class); // } // // public static boolean shouldRender() { // return mc.player != null ? (!mc.player.isSpectator() && (!mc.player.isCreative() || EnhancedVisuals.CONFIG.doEffectsInCreative)) : true; // } // // public static boolean shouldTick() { // return true; // } // } // // Path: src/main/java/team/creative/enhancedvisuals/client/sound/PositionedSound.java // public class PositionedSound extends net.minecraft.client.audio.PositionedSound { // // public PositionedSound(ResourceLocation location, SoundCategory category, float volume, float pitch) { // super(location, category); // this.volume = volume; // this.pitch = pitch; // this.attenuationType = AttenuationType.NONE; // } // // public PositionedSound(ResourceLocation location, SoundCategory category, float volume, float pitch, BlockPos pos) { // this(location, category, volume, pitch); // this.xPosF = pos.getX(); // this.yPosF = pos.getY(); // this.zPosF = pos.getZ(); // this.attenuationType = AttenuationType.LINEAR; // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/client/sound/TickedSound.java // public class TickedSound extends PositionedSound implements ITickableSound { // // public int tick = 0; // public DecimalCurve volumeGraph; // // public TickedSound(ResourceLocation location, SoundCategory category, float pitch, DecimalCurve volumeGraph) { // super(location, category, (float) volumeGraph.valueAt(0), pitch); // this.volumeGraph = volumeGraph; // this.repeat = true; // } // // public TickedSound(ResourceLocation location, SoundCategory category, float pitch, BlockPos pos, DecimalCurve volumeGraph) { // super(location, category, (float) volumeGraph.valueAt(0), pitch, pos); // this.volumeGraph = volumeGraph; // this.repeat = true; // } // // @Override // public boolean isDonePlaying() { // return volume == 0; // } // // @Override // public void update() { // tick++; // volume = (float) volumeGraph.valueAt(tick); // } // // }
import javax.annotation.Nullable; import com.creativemd.creativecore.common.config.api.CreativeConfig; import com.creativemd.creativecore.common.config.api.ICreativeConfig; import com.creativemd.creativecore.common.config.premade.curve.DecimalCurve; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import team.creative.enhancedvisuals.client.EVClient; import team.creative.enhancedvisuals.client.sound.PositionedSound; import team.creative.enhancedvisuals.client.sound.TickedSound;
} public void tick(@Nullable EntityPlayer player) { } public boolean isEnabled(@Nullable EntityPlayer player) { return enabled && opacity > 0; } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location) { playSound(location, null, 1.0F); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, BlockPos pos) { playSound(location, pos, 1.0F); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, float volume) { playSound(location, null, volume); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, BlockPos pos, float volume) { if (!EVClient.shouldRender()) return; if (pos != null)
// Path: src/main/java/team/creative/enhancedvisuals/client/EVClient.java // @SideOnly(Side.CLIENT) // public class EVClient extends EVServer { // // private static Minecraft mc = Minecraft.getMinecraft(); // // @Override // public void load(FMLInitializationEvent event) { // ((IReloadableResourceManager) mc.getResourceManager()).registerReloadListener(new IResourceManagerReloadListener() { // // @Override // public void onResourceManagerReload(IResourceManager resourceManager) { // VisualManager.clearParticles(); // // for (VisualType type : VisualType.getTypes()) { // type.loadResources(resourceManager); // } // } // }); // // IResourceManager manager = mc.getResourceManager(); // for (VisualType type : VisualType.getTypes()) // type.loadResources(manager); // // MinecraftForge.EVENT_BUS.register(EVRenderer.class); // } // // public static boolean shouldRender() { // return mc.player != null ? (!mc.player.isSpectator() && (!mc.player.isCreative() || EnhancedVisuals.CONFIG.doEffectsInCreative)) : true; // } // // public static boolean shouldTick() { // return true; // } // } // // Path: src/main/java/team/creative/enhancedvisuals/client/sound/PositionedSound.java // public class PositionedSound extends net.minecraft.client.audio.PositionedSound { // // public PositionedSound(ResourceLocation location, SoundCategory category, float volume, float pitch) { // super(location, category); // this.volume = volume; // this.pitch = pitch; // this.attenuationType = AttenuationType.NONE; // } // // public PositionedSound(ResourceLocation location, SoundCategory category, float volume, float pitch, BlockPos pos) { // this(location, category, volume, pitch); // this.xPosF = pos.getX(); // this.yPosF = pos.getY(); // this.zPosF = pos.getZ(); // this.attenuationType = AttenuationType.LINEAR; // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/client/sound/TickedSound.java // public class TickedSound extends PositionedSound implements ITickableSound { // // public int tick = 0; // public DecimalCurve volumeGraph; // // public TickedSound(ResourceLocation location, SoundCategory category, float pitch, DecimalCurve volumeGraph) { // super(location, category, (float) volumeGraph.valueAt(0), pitch); // this.volumeGraph = volumeGraph; // this.repeat = true; // } // // public TickedSound(ResourceLocation location, SoundCategory category, float pitch, BlockPos pos, DecimalCurve volumeGraph) { // super(location, category, (float) volumeGraph.valueAt(0), pitch, pos); // this.volumeGraph = volumeGraph; // this.repeat = true; // } // // @Override // public boolean isDonePlaying() { // return volume == 0; // } // // @Override // public void update() { // tick++; // volume = (float) volumeGraph.valueAt(tick); // } // // } // Path: src/main/java/team/creative/enhancedvisuals/api/VisualHandler.java import javax.annotation.Nullable; import com.creativemd.creativecore.common.config.api.CreativeConfig; import com.creativemd.creativecore.common.config.api.ICreativeConfig; import com.creativemd.creativecore.common.config.premade.curve.DecimalCurve; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import team.creative.enhancedvisuals.client.EVClient; import team.creative.enhancedvisuals.client.sound.PositionedSound; import team.creative.enhancedvisuals.client.sound.TickedSound; } public void tick(@Nullable EntityPlayer player) { } public boolean isEnabled(@Nullable EntityPlayer player) { return enabled && opacity > 0; } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location) { playSound(location, null, 1.0F); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, BlockPos pos) { playSound(location, pos, 1.0F); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, float volume) { playSound(location, null, volume); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, BlockPos pos, float volume) { if (!EVClient.shouldRender()) return; if (pos != null)
Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSound(location, SoundCategory.MASTER, volume, 1, pos));
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/api/VisualHandler.java
// Path: src/main/java/team/creative/enhancedvisuals/client/EVClient.java // @SideOnly(Side.CLIENT) // public class EVClient extends EVServer { // // private static Minecraft mc = Minecraft.getMinecraft(); // // @Override // public void load(FMLInitializationEvent event) { // ((IReloadableResourceManager) mc.getResourceManager()).registerReloadListener(new IResourceManagerReloadListener() { // // @Override // public void onResourceManagerReload(IResourceManager resourceManager) { // VisualManager.clearParticles(); // // for (VisualType type : VisualType.getTypes()) { // type.loadResources(resourceManager); // } // } // }); // // IResourceManager manager = mc.getResourceManager(); // for (VisualType type : VisualType.getTypes()) // type.loadResources(manager); // // MinecraftForge.EVENT_BUS.register(EVRenderer.class); // } // // public static boolean shouldRender() { // return mc.player != null ? (!mc.player.isSpectator() && (!mc.player.isCreative() || EnhancedVisuals.CONFIG.doEffectsInCreative)) : true; // } // // public static boolean shouldTick() { // return true; // } // } // // Path: src/main/java/team/creative/enhancedvisuals/client/sound/PositionedSound.java // public class PositionedSound extends net.minecraft.client.audio.PositionedSound { // // public PositionedSound(ResourceLocation location, SoundCategory category, float volume, float pitch) { // super(location, category); // this.volume = volume; // this.pitch = pitch; // this.attenuationType = AttenuationType.NONE; // } // // public PositionedSound(ResourceLocation location, SoundCategory category, float volume, float pitch, BlockPos pos) { // this(location, category, volume, pitch); // this.xPosF = pos.getX(); // this.yPosF = pos.getY(); // this.zPosF = pos.getZ(); // this.attenuationType = AttenuationType.LINEAR; // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/client/sound/TickedSound.java // public class TickedSound extends PositionedSound implements ITickableSound { // // public int tick = 0; // public DecimalCurve volumeGraph; // // public TickedSound(ResourceLocation location, SoundCategory category, float pitch, DecimalCurve volumeGraph) { // super(location, category, (float) volumeGraph.valueAt(0), pitch); // this.volumeGraph = volumeGraph; // this.repeat = true; // } // // public TickedSound(ResourceLocation location, SoundCategory category, float pitch, BlockPos pos, DecimalCurve volumeGraph) { // super(location, category, (float) volumeGraph.valueAt(0), pitch, pos); // this.volumeGraph = volumeGraph; // this.repeat = true; // } // // @Override // public boolean isDonePlaying() { // return volume == 0; // } // // @Override // public void update() { // tick++; // volume = (float) volumeGraph.valueAt(tick); // } // // }
import javax.annotation.Nullable; import com.creativemd.creativecore.common.config.api.CreativeConfig; import com.creativemd.creativecore.common.config.api.ICreativeConfig; import com.creativemd.creativecore.common.config.premade.curve.DecimalCurve; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import team.creative.enhancedvisuals.client.EVClient; import team.creative.enhancedvisuals.client.sound.PositionedSound; import team.creative.enhancedvisuals.client.sound.TickedSound;
@SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location) { playSound(location, null, 1.0F); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, BlockPos pos) { playSound(location, pos, 1.0F); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, float volume) { playSound(location, null, volume); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, BlockPos pos, float volume) { if (!EVClient.shouldRender()) return; if (pos != null) Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSound(location, SoundCategory.MASTER, volume, 1, pos)); else Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSound(location, SoundCategory.MASTER, volume, 1)); } @SideOnly(Side.CLIENT) public synchronized void playSoundFadeOut(ResourceLocation location, BlockPos pos, DecimalCurve volume) { if (!EVClient.shouldRender()) return; if (pos != null)
// Path: src/main/java/team/creative/enhancedvisuals/client/EVClient.java // @SideOnly(Side.CLIENT) // public class EVClient extends EVServer { // // private static Minecraft mc = Minecraft.getMinecraft(); // // @Override // public void load(FMLInitializationEvent event) { // ((IReloadableResourceManager) mc.getResourceManager()).registerReloadListener(new IResourceManagerReloadListener() { // // @Override // public void onResourceManagerReload(IResourceManager resourceManager) { // VisualManager.clearParticles(); // // for (VisualType type : VisualType.getTypes()) { // type.loadResources(resourceManager); // } // } // }); // // IResourceManager manager = mc.getResourceManager(); // for (VisualType type : VisualType.getTypes()) // type.loadResources(manager); // // MinecraftForge.EVENT_BUS.register(EVRenderer.class); // } // // public static boolean shouldRender() { // return mc.player != null ? (!mc.player.isSpectator() && (!mc.player.isCreative() || EnhancedVisuals.CONFIG.doEffectsInCreative)) : true; // } // // public static boolean shouldTick() { // return true; // } // } // // Path: src/main/java/team/creative/enhancedvisuals/client/sound/PositionedSound.java // public class PositionedSound extends net.minecraft.client.audio.PositionedSound { // // public PositionedSound(ResourceLocation location, SoundCategory category, float volume, float pitch) { // super(location, category); // this.volume = volume; // this.pitch = pitch; // this.attenuationType = AttenuationType.NONE; // } // // public PositionedSound(ResourceLocation location, SoundCategory category, float volume, float pitch, BlockPos pos) { // this(location, category, volume, pitch); // this.xPosF = pos.getX(); // this.yPosF = pos.getY(); // this.zPosF = pos.getZ(); // this.attenuationType = AttenuationType.LINEAR; // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/client/sound/TickedSound.java // public class TickedSound extends PositionedSound implements ITickableSound { // // public int tick = 0; // public DecimalCurve volumeGraph; // // public TickedSound(ResourceLocation location, SoundCategory category, float pitch, DecimalCurve volumeGraph) { // super(location, category, (float) volumeGraph.valueAt(0), pitch); // this.volumeGraph = volumeGraph; // this.repeat = true; // } // // public TickedSound(ResourceLocation location, SoundCategory category, float pitch, BlockPos pos, DecimalCurve volumeGraph) { // super(location, category, (float) volumeGraph.valueAt(0), pitch, pos); // this.volumeGraph = volumeGraph; // this.repeat = true; // } // // @Override // public boolean isDonePlaying() { // return volume == 0; // } // // @Override // public void update() { // tick++; // volume = (float) volumeGraph.valueAt(tick); // } // // } // Path: src/main/java/team/creative/enhancedvisuals/api/VisualHandler.java import javax.annotation.Nullable; import com.creativemd.creativecore.common.config.api.CreativeConfig; import com.creativemd.creativecore.common.config.api.ICreativeConfig; import com.creativemd.creativecore.common.config.premade.curve.DecimalCurve; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import team.creative.enhancedvisuals.client.EVClient; import team.creative.enhancedvisuals.client.sound.PositionedSound; import team.creative.enhancedvisuals.client.sound.TickedSound; @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location) { playSound(location, null, 1.0F); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, BlockPos pos) { playSound(location, pos, 1.0F); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, float volume) { playSound(location, null, volume); } @SideOnly(Side.CLIENT) public synchronized void playSound(ResourceLocation location, BlockPos pos, float volume) { if (!EVClient.shouldRender()) return; if (pos != null) Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSound(location, SoundCategory.MASTER, volume, 1, pos)); else Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSound(location, SoundCategory.MASTER, volume, 1)); } @SideOnly(Side.CLIENT) public synchronized void playSoundFadeOut(ResourceLocation location, BlockPos pos, DecimalCurve volume) { if (!EVClient.shouldRender()) return; if (pos != null)
Minecraft.getMinecraft().getSoundHandler().playSound(new TickedSound(location, SoundCategory.MASTER, 1, pos, volume));
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/api/type/VisualTypeOverlay.java
// Path: src/main/java/team/creative/enhancedvisuals/api/VisualCategory.java // public enum VisualCategory { // // overlay { // // @Override // public boolean isAffectedByWater() { // return false; // } // }, // particle { // // @Override // public boolean isAffectedByWater() { // return true; // } // // }, // shader { // @Override // public boolean isAffectedByWater() { // return false; // } // }; // // public abstract boolean isAffectedByWater(); // }
import team.creative.enhancedvisuals.api.VisualCategory;
package team.creative.enhancedvisuals.api.type; public class VisualTypeOverlay extends VisualTypeTexture { public VisualTypeOverlay(String name, int animationSpeed) {
// Path: src/main/java/team/creative/enhancedvisuals/api/VisualCategory.java // public enum VisualCategory { // // overlay { // // @Override // public boolean isAffectedByWater() { // return false; // } // }, // particle { // // @Override // public boolean isAffectedByWater() { // return true; // } // // }, // shader { // @Override // public boolean isAffectedByWater() { // return false; // } // }; // // public abstract boolean isAffectedByWater(); // } // Path: src/main/java/team/creative/enhancedvisuals/api/type/VisualTypeOverlay.java import team.creative.enhancedvisuals.api.VisualCategory; package team.creative.enhancedvisuals.api.type; public class VisualTypeOverlay extends VisualTypeTexture { public VisualTypeOverlay(String name, int animationSpeed) {
super(VisualCategory.overlay, name, animationSpeed);
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/api/Particle.java
// Path: src/main/java/team/creative/enhancedvisuals/api/type/VisualType.java // public abstract class VisualType implements ICreativeConfig { // // private static List<VisualType> types = new ArrayList<>(); // // public static Collection<VisualType> getTypes() { // return types; // } // // @CreativeConfig // public boolean disabled = false; // // private boolean isEffectedByWater = true; // // @CreativeConfig // @CreativeConfig.DecimalRange(max = 1, min = 0) // public float opacity = 1; // // public final String name; // public final VisualCategory cat; // // public VisualType(String name, VisualCategory cat) { // this.name = name; // this.cat = cat; // // types.add(this); // } // // public VisualType setIgnoreWater() { // isEffectedByWater = false; // return this; // } // // public boolean isAffectedByWater() { // return cat.isAffectedByWater() && isEffectedByWater; // } // // @SideOnly(Side.CLIENT) // public abstract void loadResources(IResourceManager manager); // // @SideOnly(Side.CLIENT) // public abstract void render(VisualHandler handler, Visual visual, TextureManager manager, int screenWidth, int screenHeight, float partialTicks); // // @Override // public void configured() { // // } // // @SideOnly(Side.CLIENT) // public int getVariantAmount() { // return 1; // } // // public Color getColor() { // return null; // } // // @SideOnly(Side.CLIENT) // public void resize(Framebuffer buffer) { // // } // // public boolean canRotate() { // return true; // } // // public boolean isVisible(VisualHandler handler, Visual visual) { // return visual.getOpacity() > 0; // } // // public boolean scaleVariants() { // return false; // } // // public double randomScale(Random rand) { // return 1; // } // // public int getWidth(int screenWidth) { // return screenWidth; // } // // public int getHeight(int screenHeight) { // return screenHeight; // } // // }
import com.creativemd.creativecore.common.config.premade.curve.Curve; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.TextureManager; import team.creative.enhancedvisuals.api.type.VisualType;
package team.creative.enhancedvisuals.api; public class Particle extends Visual { public int x; public int y; public int width; public int height; public float rotation;
// Path: src/main/java/team/creative/enhancedvisuals/api/type/VisualType.java // public abstract class VisualType implements ICreativeConfig { // // private static List<VisualType> types = new ArrayList<>(); // // public static Collection<VisualType> getTypes() { // return types; // } // // @CreativeConfig // public boolean disabled = false; // // private boolean isEffectedByWater = true; // // @CreativeConfig // @CreativeConfig.DecimalRange(max = 1, min = 0) // public float opacity = 1; // // public final String name; // public final VisualCategory cat; // // public VisualType(String name, VisualCategory cat) { // this.name = name; // this.cat = cat; // // types.add(this); // } // // public VisualType setIgnoreWater() { // isEffectedByWater = false; // return this; // } // // public boolean isAffectedByWater() { // return cat.isAffectedByWater() && isEffectedByWater; // } // // @SideOnly(Side.CLIENT) // public abstract void loadResources(IResourceManager manager); // // @SideOnly(Side.CLIENT) // public abstract void render(VisualHandler handler, Visual visual, TextureManager manager, int screenWidth, int screenHeight, float partialTicks); // // @Override // public void configured() { // // } // // @SideOnly(Side.CLIENT) // public int getVariantAmount() { // return 1; // } // // public Color getColor() { // return null; // } // // @SideOnly(Side.CLIENT) // public void resize(Framebuffer buffer) { // // } // // public boolean canRotate() { // return true; // } // // public boolean isVisible(VisualHandler handler, Visual visual) { // return visual.getOpacity() > 0; // } // // public boolean scaleVariants() { // return false; // } // // public double randomScale(Random rand) { // return 1; // } // // public int getWidth(int screenWidth) { // return screenWidth; // } // // public int getHeight(int screenHeight) { // return screenHeight; // } // // } // Path: src/main/java/team/creative/enhancedvisuals/api/Particle.java import com.creativemd.creativecore.common.config.premade.curve.Curve; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.TextureManager; import team.creative.enhancedvisuals.api.type.VisualType; package team.creative.enhancedvisuals.api; public class Particle extends Visual { public int x; public int y; public int width; public int height; public float rotation;
public Particle(VisualType type, VisualHandler handler, Curve animation, int x, int y, int width, int height, float rotation, int variant) {
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/common/packet/DamagePacket.java
// Path: src/main/java/team/creative/enhancedvisuals/common/handler/VisualHandlers.java // public class VisualHandlers { // // public static ExplosionHandler EXPLOSION; // public static PotionHandler POTION; // // public static SandSplatHandler SAND; // public static SplashHandler SPLASH; // public static DamageHandler DAMAGE; // // public static SlenderHandler SLENDER; // public static SaturationHandler SATURATION; // public static HeartbeatHandler HEARTBEAT; // // public static void init() { // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "explosion"), EXPLOSION = new ExplosionHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "potion"), POTION = new PotionHandler()); // // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "sand"), SAND = new SandSplatHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "splash"), SPLASH = new SplashHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "damage"), DAMAGE = new DamageHandler()); // // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "slender"), SLENDER = new SlenderHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "saturation"), SATURATION = new SaturationHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "heartbeat"), HEARTBEAT = new HeartbeatHandler()); // } // // }
import com.creativemd.creativecore.common.packet.CreativeCorePacket; import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.living.LivingDamageEvent; import team.creative.enhancedvisuals.common.handler.VisualHandlers;
writeString(buf, attackerClass); } else buf.writeBoolean(false); if (stack != null) { buf.writeBoolean(true); writeItemStack(buf, stack); } else buf.writeBoolean(false); buf.writeFloat(damage); buf.writeFloat(distance); writeString(buf, source); buf.writeBoolean(fire); } @Override public void readBytes(ByteBuf buf) { if (buf.readBoolean()) attackerClass = readString(buf); if (buf.readBoolean()) stack = readItemStack(buf); damage = buf.readFloat(); distance = buf.readFloat(); source = readString(buf); fire = buf.readBoolean(); } @Override public void executeClient(EntityPlayer player) {
// Path: src/main/java/team/creative/enhancedvisuals/common/handler/VisualHandlers.java // public class VisualHandlers { // // public static ExplosionHandler EXPLOSION; // public static PotionHandler POTION; // // public static SandSplatHandler SAND; // public static SplashHandler SPLASH; // public static DamageHandler DAMAGE; // // public static SlenderHandler SLENDER; // public static SaturationHandler SATURATION; // public static HeartbeatHandler HEARTBEAT; // // public static void init() { // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "explosion"), EXPLOSION = new ExplosionHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "potion"), POTION = new PotionHandler()); // // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "sand"), SAND = new SandSplatHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "splash"), SPLASH = new SplashHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "damage"), DAMAGE = new DamageHandler()); // // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "slender"), SLENDER = new SlenderHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "saturation"), SATURATION = new SaturationHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "heartbeat"), HEARTBEAT = new HeartbeatHandler()); // } // // } // Path: src/main/java/team/creative/enhancedvisuals/common/packet/DamagePacket.java import com.creativemd.creativecore.common.packet.CreativeCorePacket; import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.living.LivingDamageEvent; import team.creative.enhancedvisuals.common.handler.VisualHandlers; writeString(buf, attackerClass); } else buf.writeBoolean(false); if (stack != null) { buf.writeBoolean(true); writeItemStack(buf, stack); } else buf.writeBoolean(false); buf.writeFloat(damage); buf.writeFloat(distance); writeString(buf, source); buf.writeBoolean(fire); } @Override public void readBytes(ByteBuf buf) { if (buf.readBoolean()) attackerClass = readString(buf); if (buf.readBoolean()) stack = readItemStack(buf); damage = buf.readFloat(); distance = buf.readFloat(); source = readString(buf); fire = buf.readBoolean(); } @Override public void executeClient(EntityPlayer player) {
if (VisualHandlers.DAMAGE.isEnabled(player))
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/common/addon/simpledifficulty/SimpleDifficultyAddon.java
// Path: src/main/java/team/creative/enhancedvisuals/EnhancedVisuals.java // @Mod(modid = EnhancedVisuals.MODID, name = EnhancedVisuals.NAME, version = EnhancedVisuals.VERSION, acceptedMinecraftVersions = "", dependencies = "required-after:creativecore", guiFactory = "team.creative.enhancedvisuals.client.EVSettings") // public class EnhancedVisuals { // // public static final String MODID = "enhancedvisuals"; // public static final String NAME = "Enhanced Visuals"; // public static final String VERSION = "1.3.0"; // // public static final Logger LOGGER = LogManager.getLogger(EnhancedVisuals.MODID); // public static EVEvents EVENTS; // public static DeathMessages MESSAGES; // public static EnhancedVisualsConfig CONFIG; // // @SidedProxy(clientSide = "team.creative.enhancedvisuals.client.EVClient", serverSide = "team.creative.enhancedvisuals.server.EVServer") // public static EVServer proxy; // // @EventHandler // public void load(FMLInitializationEvent event) { // CreativeCorePacket.registerPacket(ExplosionPacket.class); // CreativeCorePacket.registerPacket(DamagePacket.class); // CreativeCorePacket.registerPacket(PotionPacket.class); // // MinecraftForge.EVENT_BUS.register(EVENTS = new EVEvents()); // // VisualHandlers.init(); // MESSAGES = new DeathMessages(); // CONFIG = new EnhancedVisualsConfig(); // // if (Loader.isModLoaded("toughasnails")) // ToughAsNailsAddon.load(); // // if (Loader.isModLoaded("simpledifficulty")) // SimpleDifficultyAddon.load(); // // proxy.load(event); // // ConfigHolderDynamic root = CreativeConfigRegistry.ROOT.registerFolder(MODID); // root.registerValue("general", CONFIG, ConfigSynchronization.CLIENT, false); // root.registerValue("messages", MESSAGES); // ConfigHolderDynamic handlers = root.registerFolder("handlers", ConfigSynchronization.CLIENT); // for (Entry<ResourceLocation, VisualHandler> entry : VisualRegistry.entrySet()) // handlers.registerValue(entry.getKey().getResourcePath(), entry.getValue()); // // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/common/visual/VisualRegistry.java // public class VisualRegistry { // // private static LinkedHashMap<ResourceLocation, VisualHandler> handlers = new LinkedHashMap<>(); // // public static void registerHandler(ResourceLocation location, VisualHandler handler) { // handlers.put(location, handler); // } // // public static Collection<VisualHandler> handlers() { // return handlers.values(); // } // // public static Set<Entry<ResourceLocation, VisualHandler>> entrySet() { // return handlers.entrySet(); // } // // }
import net.minecraft.util.ResourceLocation; import team.creative.enhancedvisuals.EnhancedVisuals; import team.creative.enhancedvisuals.common.visual.VisualRegistry;
package team.creative.enhancedvisuals.common.addon.simpledifficulty; public class SimpleDifficultyAddon { public static ThirstHandler thirst; public static TemperatureHandler temperature; public static void load() {
// Path: src/main/java/team/creative/enhancedvisuals/EnhancedVisuals.java // @Mod(modid = EnhancedVisuals.MODID, name = EnhancedVisuals.NAME, version = EnhancedVisuals.VERSION, acceptedMinecraftVersions = "", dependencies = "required-after:creativecore", guiFactory = "team.creative.enhancedvisuals.client.EVSettings") // public class EnhancedVisuals { // // public static final String MODID = "enhancedvisuals"; // public static final String NAME = "Enhanced Visuals"; // public static final String VERSION = "1.3.0"; // // public static final Logger LOGGER = LogManager.getLogger(EnhancedVisuals.MODID); // public static EVEvents EVENTS; // public static DeathMessages MESSAGES; // public static EnhancedVisualsConfig CONFIG; // // @SidedProxy(clientSide = "team.creative.enhancedvisuals.client.EVClient", serverSide = "team.creative.enhancedvisuals.server.EVServer") // public static EVServer proxy; // // @EventHandler // public void load(FMLInitializationEvent event) { // CreativeCorePacket.registerPacket(ExplosionPacket.class); // CreativeCorePacket.registerPacket(DamagePacket.class); // CreativeCorePacket.registerPacket(PotionPacket.class); // // MinecraftForge.EVENT_BUS.register(EVENTS = new EVEvents()); // // VisualHandlers.init(); // MESSAGES = new DeathMessages(); // CONFIG = new EnhancedVisualsConfig(); // // if (Loader.isModLoaded("toughasnails")) // ToughAsNailsAddon.load(); // // if (Loader.isModLoaded("simpledifficulty")) // SimpleDifficultyAddon.load(); // // proxy.load(event); // // ConfigHolderDynamic root = CreativeConfigRegistry.ROOT.registerFolder(MODID); // root.registerValue("general", CONFIG, ConfigSynchronization.CLIENT, false); // root.registerValue("messages", MESSAGES); // ConfigHolderDynamic handlers = root.registerFolder("handlers", ConfigSynchronization.CLIENT); // for (Entry<ResourceLocation, VisualHandler> entry : VisualRegistry.entrySet()) // handlers.registerValue(entry.getKey().getResourcePath(), entry.getValue()); // // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/common/visual/VisualRegistry.java // public class VisualRegistry { // // private static LinkedHashMap<ResourceLocation, VisualHandler> handlers = new LinkedHashMap<>(); // // public static void registerHandler(ResourceLocation location, VisualHandler handler) { // handlers.put(location, handler); // } // // public static Collection<VisualHandler> handlers() { // return handlers.values(); // } // // public static Set<Entry<ResourceLocation, VisualHandler>> entrySet() { // return handlers.entrySet(); // } // // } // Path: src/main/java/team/creative/enhancedvisuals/common/addon/simpledifficulty/SimpleDifficultyAddon.java import net.minecraft.util.ResourceLocation; import team.creative.enhancedvisuals.EnhancedVisuals; import team.creative.enhancedvisuals.common.visual.VisualRegistry; package team.creative.enhancedvisuals.common.addon.simpledifficulty; public class SimpleDifficultyAddon { public static ThirstHandler thirst; public static TemperatureHandler temperature; public static void load() {
VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "simple-thirst"), thirst = new ThirstHandler());
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/common/addon/simpledifficulty/SimpleDifficultyAddon.java
// Path: src/main/java/team/creative/enhancedvisuals/EnhancedVisuals.java // @Mod(modid = EnhancedVisuals.MODID, name = EnhancedVisuals.NAME, version = EnhancedVisuals.VERSION, acceptedMinecraftVersions = "", dependencies = "required-after:creativecore", guiFactory = "team.creative.enhancedvisuals.client.EVSettings") // public class EnhancedVisuals { // // public static final String MODID = "enhancedvisuals"; // public static final String NAME = "Enhanced Visuals"; // public static final String VERSION = "1.3.0"; // // public static final Logger LOGGER = LogManager.getLogger(EnhancedVisuals.MODID); // public static EVEvents EVENTS; // public static DeathMessages MESSAGES; // public static EnhancedVisualsConfig CONFIG; // // @SidedProxy(clientSide = "team.creative.enhancedvisuals.client.EVClient", serverSide = "team.creative.enhancedvisuals.server.EVServer") // public static EVServer proxy; // // @EventHandler // public void load(FMLInitializationEvent event) { // CreativeCorePacket.registerPacket(ExplosionPacket.class); // CreativeCorePacket.registerPacket(DamagePacket.class); // CreativeCorePacket.registerPacket(PotionPacket.class); // // MinecraftForge.EVENT_BUS.register(EVENTS = new EVEvents()); // // VisualHandlers.init(); // MESSAGES = new DeathMessages(); // CONFIG = new EnhancedVisualsConfig(); // // if (Loader.isModLoaded("toughasnails")) // ToughAsNailsAddon.load(); // // if (Loader.isModLoaded("simpledifficulty")) // SimpleDifficultyAddon.load(); // // proxy.load(event); // // ConfigHolderDynamic root = CreativeConfigRegistry.ROOT.registerFolder(MODID); // root.registerValue("general", CONFIG, ConfigSynchronization.CLIENT, false); // root.registerValue("messages", MESSAGES); // ConfigHolderDynamic handlers = root.registerFolder("handlers", ConfigSynchronization.CLIENT); // for (Entry<ResourceLocation, VisualHandler> entry : VisualRegistry.entrySet()) // handlers.registerValue(entry.getKey().getResourcePath(), entry.getValue()); // // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/common/visual/VisualRegistry.java // public class VisualRegistry { // // private static LinkedHashMap<ResourceLocation, VisualHandler> handlers = new LinkedHashMap<>(); // // public static void registerHandler(ResourceLocation location, VisualHandler handler) { // handlers.put(location, handler); // } // // public static Collection<VisualHandler> handlers() { // return handlers.values(); // } // // public static Set<Entry<ResourceLocation, VisualHandler>> entrySet() { // return handlers.entrySet(); // } // // }
import net.minecraft.util.ResourceLocation; import team.creative.enhancedvisuals.EnhancedVisuals; import team.creative.enhancedvisuals.common.visual.VisualRegistry;
package team.creative.enhancedvisuals.common.addon.simpledifficulty; public class SimpleDifficultyAddon { public static ThirstHandler thirst; public static TemperatureHandler temperature; public static void load() {
// Path: src/main/java/team/creative/enhancedvisuals/EnhancedVisuals.java // @Mod(modid = EnhancedVisuals.MODID, name = EnhancedVisuals.NAME, version = EnhancedVisuals.VERSION, acceptedMinecraftVersions = "", dependencies = "required-after:creativecore", guiFactory = "team.creative.enhancedvisuals.client.EVSettings") // public class EnhancedVisuals { // // public static final String MODID = "enhancedvisuals"; // public static final String NAME = "Enhanced Visuals"; // public static final String VERSION = "1.3.0"; // // public static final Logger LOGGER = LogManager.getLogger(EnhancedVisuals.MODID); // public static EVEvents EVENTS; // public static DeathMessages MESSAGES; // public static EnhancedVisualsConfig CONFIG; // // @SidedProxy(clientSide = "team.creative.enhancedvisuals.client.EVClient", serverSide = "team.creative.enhancedvisuals.server.EVServer") // public static EVServer proxy; // // @EventHandler // public void load(FMLInitializationEvent event) { // CreativeCorePacket.registerPacket(ExplosionPacket.class); // CreativeCorePacket.registerPacket(DamagePacket.class); // CreativeCorePacket.registerPacket(PotionPacket.class); // // MinecraftForge.EVENT_BUS.register(EVENTS = new EVEvents()); // // VisualHandlers.init(); // MESSAGES = new DeathMessages(); // CONFIG = new EnhancedVisualsConfig(); // // if (Loader.isModLoaded("toughasnails")) // ToughAsNailsAddon.load(); // // if (Loader.isModLoaded("simpledifficulty")) // SimpleDifficultyAddon.load(); // // proxy.load(event); // // ConfigHolderDynamic root = CreativeConfigRegistry.ROOT.registerFolder(MODID); // root.registerValue("general", CONFIG, ConfigSynchronization.CLIENT, false); // root.registerValue("messages", MESSAGES); // ConfigHolderDynamic handlers = root.registerFolder("handlers", ConfigSynchronization.CLIENT); // for (Entry<ResourceLocation, VisualHandler> entry : VisualRegistry.entrySet()) // handlers.registerValue(entry.getKey().getResourcePath(), entry.getValue()); // // } // // } // // Path: src/main/java/team/creative/enhancedvisuals/common/visual/VisualRegistry.java // public class VisualRegistry { // // private static LinkedHashMap<ResourceLocation, VisualHandler> handlers = new LinkedHashMap<>(); // // public static void registerHandler(ResourceLocation location, VisualHandler handler) { // handlers.put(location, handler); // } // // public static Collection<VisualHandler> handlers() { // return handlers.values(); // } // // public static Set<Entry<ResourceLocation, VisualHandler>> entrySet() { // return handlers.entrySet(); // } // // } // Path: src/main/java/team/creative/enhancedvisuals/common/addon/simpledifficulty/SimpleDifficultyAddon.java import net.minecraft.util.ResourceLocation; import team.creative.enhancedvisuals.EnhancedVisuals; import team.creative.enhancedvisuals.common.visual.VisualRegistry; package team.creative.enhancedvisuals.common.addon.simpledifficulty; public class SimpleDifficultyAddon { public static ThirstHandler thirst; public static TemperatureHandler temperature; public static void load() {
VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "simple-thirst"), thirst = new ThirstHandler());
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/common/packet/PotionPacket.java
// Path: src/main/java/team/creative/enhancedvisuals/common/handler/VisualHandlers.java // public class VisualHandlers { // // public static ExplosionHandler EXPLOSION; // public static PotionHandler POTION; // // public static SandSplatHandler SAND; // public static SplashHandler SPLASH; // public static DamageHandler DAMAGE; // // public static SlenderHandler SLENDER; // public static SaturationHandler SATURATION; // public static HeartbeatHandler HEARTBEAT; // // public static void init() { // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "explosion"), EXPLOSION = new ExplosionHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "potion"), POTION = new PotionHandler()); // // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "sand"), SAND = new SandSplatHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "splash"), SPLASH = new SplashHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "damage"), DAMAGE = new DamageHandler()); // // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "slender"), SLENDER = new SlenderHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "saturation"), SATURATION = new SaturationHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "heartbeat"), HEARTBEAT = new HeartbeatHandler()); // } // // }
import com.creativemd.creativecore.common.packet.CreativeCorePacket; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import team.creative.enhancedvisuals.common.handler.VisualHandlers;
package team.creative.enhancedvisuals.common.packet; public class PotionPacket extends CreativeCorePacket { public double distance; public ItemStack stack; public PotionPacket() { } public PotionPacket(double distance, ItemStack stack) { this.distance = distance; this.stack = stack; } @Override public void writeBytes(ByteBuf buf) { buf.writeDouble(distance); writeItemStack(buf, stack); } @Override public void readBytes(ByteBuf buf) { distance = buf.readDouble(); stack = readItemStack(buf); } @Override public void executeClient(EntityPlayer player) {
// Path: src/main/java/team/creative/enhancedvisuals/common/handler/VisualHandlers.java // public class VisualHandlers { // // public static ExplosionHandler EXPLOSION; // public static PotionHandler POTION; // // public static SandSplatHandler SAND; // public static SplashHandler SPLASH; // public static DamageHandler DAMAGE; // // public static SlenderHandler SLENDER; // public static SaturationHandler SATURATION; // public static HeartbeatHandler HEARTBEAT; // // public static void init() { // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "explosion"), EXPLOSION = new ExplosionHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "potion"), POTION = new PotionHandler()); // // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "sand"), SAND = new SandSplatHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "splash"), SPLASH = new SplashHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "damage"), DAMAGE = new DamageHandler()); // // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "slender"), SLENDER = new SlenderHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "saturation"), SATURATION = new SaturationHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "heartbeat"), HEARTBEAT = new HeartbeatHandler()); // } // // } // Path: src/main/java/team/creative/enhancedvisuals/common/packet/PotionPacket.java import com.creativemd.creativecore.common.packet.CreativeCorePacket; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import team.creative.enhancedvisuals.common.handler.VisualHandlers; package team.creative.enhancedvisuals.common.packet; public class PotionPacket extends CreativeCorePacket { public double distance; public ItemStack stack; public PotionPacket() { } public PotionPacket(double distance, ItemStack stack) { this.distance = distance; this.stack = stack; } @Override public void writeBytes(ByteBuf buf) { buf.writeDouble(distance); writeItemStack(buf, stack); } @Override public void readBytes(ByteBuf buf) { distance = buf.readDouble(); stack = readItemStack(buf); } @Override public void executeClient(EntityPlayer player) {
if (VisualHandlers.POTION.isEnabled(player))
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/client/EVSettings.java
// Path: src/main/java/team/creative/enhancedvisuals/EnhancedVisuals.java // @Mod(modid = EnhancedVisuals.MODID, name = EnhancedVisuals.NAME, version = EnhancedVisuals.VERSION, acceptedMinecraftVersions = "", dependencies = "required-after:creativecore", guiFactory = "team.creative.enhancedvisuals.client.EVSettings") // public class EnhancedVisuals { // // public static final String MODID = "enhancedvisuals"; // public static final String NAME = "Enhanced Visuals"; // public static final String VERSION = "1.3.0"; // // public static final Logger LOGGER = LogManager.getLogger(EnhancedVisuals.MODID); // public static EVEvents EVENTS; // public static DeathMessages MESSAGES; // public static EnhancedVisualsConfig CONFIG; // // @SidedProxy(clientSide = "team.creative.enhancedvisuals.client.EVClient", serverSide = "team.creative.enhancedvisuals.server.EVServer") // public static EVServer proxy; // // @EventHandler // public void load(FMLInitializationEvent event) { // CreativeCorePacket.registerPacket(ExplosionPacket.class); // CreativeCorePacket.registerPacket(DamagePacket.class); // CreativeCorePacket.registerPacket(PotionPacket.class); // // MinecraftForge.EVENT_BUS.register(EVENTS = new EVEvents()); // // VisualHandlers.init(); // MESSAGES = new DeathMessages(); // CONFIG = new EnhancedVisualsConfig(); // // if (Loader.isModLoaded("toughasnails")) // ToughAsNailsAddon.load(); // // if (Loader.isModLoaded("simpledifficulty")) // SimpleDifficultyAddon.load(); // // proxy.load(event); // // ConfigHolderDynamic root = CreativeConfigRegistry.ROOT.registerFolder(MODID); // root.registerValue("general", CONFIG, ConfigSynchronization.CLIENT, false); // root.registerValue("messages", MESSAGES); // ConfigHolderDynamic handlers = root.registerFolder("handlers", ConfigSynchronization.CLIENT); // for (Entry<ResourceLocation, VisualHandler> entry : VisualRegistry.entrySet()) // handlers.registerValue(entry.getKey().getResourcePath(), entry.getValue()); // // } // // }
import com.creativemd.creativecore.common.config.ConfigModGuiFactory; import team.creative.enhancedvisuals.EnhancedVisuals;
package team.creative.enhancedvisuals.client; public class EVSettings extends ConfigModGuiFactory { @Override public String modid() {
// Path: src/main/java/team/creative/enhancedvisuals/EnhancedVisuals.java // @Mod(modid = EnhancedVisuals.MODID, name = EnhancedVisuals.NAME, version = EnhancedVisuals.VERSION, acceptedMinecraftVersions = "", dependencies = "required-after:creativecore", guiFactory = "team.creative.enhancedvisuals.client.EVSettings") // public class EnhancedVisuals { // // public static final String MODID = "enhancedvisuals"; // public static final String NAME = "Enhanced Visuals"; // public static final String VERSION = "1.3.0"; // // public static final Logger LOGGER = LogManager.getLogger(EnhancedVisuals.MODID); // public static EVEvents EVENTS; // public static DeathMessages MESSAGES; // public static EnhancedVisualsConfig CONFIG; // // @SidedProxy(clientSide = "team.creative.enhancedvisuals.client.EVClient", serverSide = "team.creative.enhancedvisuals.server.EVServer") // public static EVServer proxy; // // @EventHandler // public void load(FMLInitializationEvent event) { // CreativeCorePacket.registerPacket(ExplosionPacket.class); // CreativeCorePacket.registerPacket(DamagePacket.class); // CreativeCorePacket.registerPacket(PotionPacket.class); // // MinecraftForge.EVENT_BUS.register(EVENTS = new EVEvents()); // // VisualHandlers.init(); // MESSAGES = new DeathMessages(); // CONFIG = new EnhancedVisualsConfig(); // // if (Loader.isModLoaded("toughasnails")) // ToughAsNailsAddon.load(); // // if (Loader.isModLoaded("simpledifficulty")) // SimpleDifficultyAddon.load(); // // proxy.load(event); // // ConfigHolderDynamic root = CreativeConfigRegistry.ROOT.registerFolder(MODID); // root.registerValue("general", CONFIG, ConfigSynchronization.CLIENT, false); // root.registerValue("messages", MESSAGES); // ConfigHolderDynamic handlers = root.registerFolder("handlers", ConfigSynchronization.CLIENT); // for (Entry<ResourceLocation, VisualHandler> entry : VisualRegistry.entrySet()) // handlers.registerValue(entry.getKey().getResourcePath(), entry.getValue()); // // } // // } // Path: src/main/java/team/creative/enhancedvisuals/client/EVSettings.java import com.creativemd.creativecore.common.config.ConfigModGuiFactory; import team.creative.enhancedvisuals.EnhancedVisuals; package team.creative.enhancedvisuals.client; public class EVSettings extends ConfigModGuiFactory { @Override public String modid() {
return EnhancedVisuals.MODID;
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/api/type/VisualTypeParticle.java
// Path: src/main/java/team/creative/enhancedvisuals/api/VisualCategory.java // public enum VisualCategory { // // overlay { // // @Override // public boolean isAffectedByWater() { // return false; // } // }, // particle { // // @Override // public boolean isAffectedByWater() { // return true; // } // // }, // shader { // @Override // public boolean isAffectedByWater() { // return false; // } // }; // // public abstract boolean isAffectedByWater(); // }
import java.util.Random; import com.creativemd.creativecore.common.config.api.CreativeConfig; import com.creativemd.creativecore.common.config.premade.DecimalMinMax; import team.creative.enhancedvisuals.api.VisualCategory;
package team.creative.enhancedvisuals.api.type; public class VisualTypeParticle extends VisualTypeTexture { @CreativeConfig public DecimalMinMax scale; public VisualTypeParticle(String name, int animationSpeed, DecimalMinMax scale) {
// Path: src/main/java/team/creative/enhancedvisuals/api/VisualCategory.java // public enum VisualCategory { // // overlay { // // @Override // public boolean isAffectedByWater() { // return false; // } // }, // particle { // // @Override // public boolean isAffectedByWater() { // return true; // } // // }, // shader { // @Override // public boolean isAffectedByWater() { // return false; // } // }; // // public abstract boolean isAffectedByWater(); // } // Path: src/main/java/team/creative/enhancedvisuals/api/type/VisualTypeParticle.java import java.util.Random; import com.creativemd.creativecore.common.config.api.CreativeConfig; import com.creativemd.creativecore.common.config.premade.DecimalMinMax; import team.creative.enhancedvisuals.api.VisualCategory; package team.creative.enhancedvisuals.api.type; public class VisualTypeParticle extends VisualTypeTexture { @CreativeConfig public DecimalMinMax scale; public VisualTypeParticle(String name, int animationSpeed, DecimalMinMax scale) {
super(VisualCategory.particle, name, animationSpeed);
CreativeMD/EnhancedVisuals
src/main/java/team/creative/enhancedvisuals/common/packet/ExplosionPacket.java
// Path: src/main/java/team/creative/enhancedvisuals/common/handler/VisualHandlers.java // public class VisualHandlers { // // public static ExplosionHandler EXPLOSION; // public static PotionHandler POTION; // // public static SandSplatHandler SAND; // public static SplashHandler SPLASH; // public static DamageHandler DAMAGE; // // public static SlenderHandler SLENDER; // public static SaturationHandler SATURATION; // public static HeartbeatHandler HEARTBEAT; // // public static void init() { // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "explosion"), EXPLOSION = new ExplosionHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "potion"), POTION = new PotionHandler()); // // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "sand"), SAND = new SandSplatHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "splash"), SPLASH = new SplashHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "damage"), DAMAGE = new DamageHandler()); // // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "slender"), SLENDER = new SlenderHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "saturation"), SATURATION = new SaturationHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "heartbeat"), HEARTBEAT = new HeartbeatHandler()); // } // // }
import com.creativemd.creativecore.common.packet.CreativeCorePacket; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.Vec3d; import team.creative.enhancedvisuals.common.handler.VisualHandlers;
package team.creative.enhancedvisuals.common.packet; public class ExplosionPacket extends CreativeCorePacket { public Vec3d pos; public float size; public int sourceEntity; public ExplosionPacket(Vec3d pos, float size, int sourceEntity) { this.pos = pos; this.size = size; this.sourceEntity = sourceEntity; } public ExplosionPacket() { } @Override public void writeBytes(ByteBuf buf) { writeVec3d(pos, buf); buf.writeFloat(size); buf.writeInt(sourceEntity); } @Override public void readBytes(ByteBuf buf) { pos = readVec3d(buf); size = buf.readFloat(); sourceEntity = buf.readInt(); } @Override public void executeClient(EntityPlayer player) {
// Path: src/main/java/team/creative/enhancedvisuals/common/handler/VisualHandlers.java // public class VisualHandlers { // // public static ExplosionHandler EXPLOSION; // public static PotionHandler POTION; // // public static SandSplatHandler SAND; // public static SplashHandler SPLASH; // public static DamageHandler DAMAGE; // // public static SlenderHandler SLENDER; // public static SaturationHandler SATURATION; // public static HeartbeatHandler HEARTBEAT; // // public static void init() { // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "explosion"), EXPLOSION = new ExplosionHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "potion"), POTION = new PotionHandler()); // // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "sand"), SAND = new SandSplatHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "splash"), SPLASH = new SplashHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "damage"), DAMAGE = new DamageHandler()); // // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "slender"), SLENDER = new SlenderHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "saturation"), SATURATION = new SaturationHandler()); // VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "heartbeat"), HEARTBEAT = new HeartbeatHandler()); // } // // } // Path: src/main/java/team/creative/enhancedvisuals/common/packet/ExplosionPacket.java import com.creativemd.creativecore.common.packet.CreativeCorePacket; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.Vec3d; import team.creative.enhancedvisuals.common.handler.VisualHandlers; package team.creative.enhancedvisuals.common.packet; public class ExplosionPacket extends CreativeCorePacket { public Vec3d pos; public float size; public int sourceEntity; public ExplosionPacket(Vec3d pos, float size, int sourceEntity) { this.pos = pos; this.size = size; this.sourceEntity = sourceEntity; } public ExplosionPacket() { } @Override public void writeBytes(ByteBuf buf) { writeVec3d(pos, buf); buf.writeFloat(size); buf.writeInt(sourceEntity); } @Override public void readBytes(ByteBuf buf) { pos = readVec3d(buf); size = buf.readFloat(); sourceEntity = buf.readInt(); } @Override public void executeClient(EntityPlayer player) {
if (VisualHandlers.EXPLOSION.isEnabled(player))
irengrig/fossil4idea
src/org/github/irengrig/fossil4idea/repository/FossilContentRevision.java
// Path: src/org/github/irengrig/fossil4idea/FossilException.java // public class FossilException extends VcsException { // public FossilException(final String message) { // super(message); // } // // public FossilException(final Throwable throwable, final boolean isWarning) { // super(throwable, isWarning); // } // // public FossilException(final Throwable throwable) { // super(throwable); // } // // public FossilException(final String message, final Throwable cause) { // super(message, cause); // } // // public FossilException(final String message, final boolean isWarning) { // super(message, isWarning); // } // // public FossilException(final Collection<String> messages) { // super(messages); // } // } // // Path: src/org/github/irengrig/fossil4idea/FossilVcs.java // public class FossilVcs extends AbstractVcs { // public static String NAME = "fossil"; // public static String DISPLAY_NAME = "Fossil"; // private FossilChangeProvider myChangeProvider; // private static final VcsKey ourKey = createKey(NAME); // private FossilVfsListener myVfsListener; // private UiManager uiManager; // private FossilCheckinEnvironment fossilCheckinEnvironment; // // public FossilVcs(Project project) { // super(project, NAME); // } // // @Override // public String getDisplayName() { // return DISPLAY_NAME; // } // // @Override // public Configurable getConfigurable() { // return new FossilConfigurable(myProject); // } // // @Override // protected void activate() { // myVfsListener = new FossilVfsListener(myProject); // uiManager = new UiManager(myProject); // } // // @Override // protected void deactivate() { // if (myVfsListener != null) { // Disposer.dispose(myVfsListener); // myVfsListener = null; // uiManager.stop(); // } // } // // public UiManager getUiManager() { // return uiManager; // } // // @Nullable // @Override // public ChangeProvider getChangeProvider() { // if (myChangeProvider == null) { // myChangeProvider = new FossilChangeProvider(myProject); // } // return myChangeProvider; // } // // @Nullable // @Override // protected CheckinEnvironment createCheckinEnvironment() { // if (fossilCheckinEnvironment == null) { // fossilCheckinEnvironment = new FossilCheckinEnvironment(this); // } // return fossilCheckinEnvironment; // } // // @Nullable // @Override // protected RollbackEnvironment createRollbackEnvironment() { // return new FossilRollbackEnvironment(this); // } // // @Nullable // @Override // public VcsHistoryProvider getVcsHistoryProvider() { // return new FossilHistoryProvider(this); // } // // @Nullable // @Override // protected UpdateEnvironment createUpdateEnvironment() { // return new FossilUpdateEnvironment(this); // } // // @Override // public List<CommitExecutor> getCommitExecutors() { // return Collections.<CommitExecutor>singletonList(new FossilCommitAndPushExecutor(myProject)); // } // // public void checkVersion() { // //todo // } // // @Nullable // @Override // public DiffProvider getDiffProvider() { // return new FossilDiffProvider(this); // } // // public static FossilVcs getInstance(final Project project) { // return (FossilVcs) ProjectLevelVcsManager.getInstance(project).findVcsByName(NAME); // } // // public static VcsKey getVcsKey() { // return ourKey; // } // // @Nullable // @Override // public AnnotationProvider getAnnotationProvider() { // return new FossilAnnotationProvider(this); // } // } // // Path: src/org/github/irengrig/fossil4idea/log/CatWorker.java // public class CatWorker { // private final Project myProject; // // public CatWorker(final Project project) { // myProject = project; // } // // public String cat(final File file, @Nullable final String revNum) throws VcsException { // final FossilSimpleCommand command = new FossilSimpleCommand(myProject, MoveWorker.findParent(file), FCommandName.finfo); // command.addParameters("-p"); // if (revNum != null && ! "HEAD".equals(revNum)) { // command.addParameters("-r", revNum); // } // command.addParameters(file.getPath()); // return command.run(); // } // }
import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Throwable2Computable; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.changes.ContentRevision; import com.intellij.openapi.vcs.impl.ContentRevisionCache; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.github.irengrig.fossil4idea.FossilException; import org.github.irengrig.fossil4idea.FossilVcs; import org.github.irengrig.fossil4idea.log.CatWorker; import java.io.IOException;
package org.github.irengrig.fossil4idea.repository; /** * Created with IntelliJ IDEA. * User: Irina.Chernushina * Date: 2/13/13 * Time: 11:02 PM */ public class FossilContentRevision implements ContentRevision { private final Project myProject; private final FilePath myFilePath; private final FossilRevisionNumber myNumber; public FossilContentRevision(final Project project, final FilePath filePath, final FossilRevisionNumber number) { myProject = project; myFilePath = filePath; myNumber = number; } @Nullable @Override public String getContent() throws VcsException { try {
// Path: src/org/github/irengrig/fossil4idea/FossilException.java // public class FossilException extends VcsException { // public FossilException(final String message) { // super(message); // } // // public FossilException(final Throwable throwable, final boolean isWarning) { // super(throwable, isWarning); // } // // public FossilException(final Throwable throwable) { // super(throwable); // } // // public FossilException(final String message, final Throwable cause) { // super(message, cause); // } // // public FossilException(final String message, final boolean isWarning) { // super(message, isWarning); // } // // public FossilException(final Collection<String> messages) { // super(messages); // } // } // // Path: src/org/github/irengrig/fossil4idea/FossilVcs.java // public class FossilVcs extends AbstractVcs { // public static String NAME = "fossil"; // public static String DISPLAY_NAME = "Fossil"; // private FossilChangeProvider myChangeProvider; // private static final VcsKey ourKey = createKey(NAME); // private FossilVfsListener myVfsListener; // private UiManager uiManager; // private FossilCheckinEnvironment fossilCheckinEnvironment; // // public FossilVcs(Project project) { // super(project, NAME); // } // // @Override // public String getDisplayName() { // return DISPLAY_NAME; // } // // @Override // public Configurable getConfigurable() { // return new FossilConfigurable(myProject); // } // // @Override // protected void activate() { // myVfsListener = new FossilVfsListener(myProject); // uiManager = new UiManager(myProject); // } // // @Override // protected void deactivate() { // if (myVfsListener != null) { // Disposer.dispose(myVfsListener); // myVfsListener = null; // uiManager.stop(); // } // } // // public UiManager getUiManager() { // return uiManager; // } // // @Nullable // @Override // public ChangeProvider getChangeProvider() { // if (myChangeProvider == null) { // myChangeProvider = new FossilChangeProvider(myProject); // } // return myChangeProvider; // } // // @Nullable // @Override // protected CheckinEnvironment createCheckinEnvironment() { // if (fossilCheckinEnvironment == null) { // fossilCheckinEnvironment = new FossilCheckinEnvironment(this); // } // return fossilCheckinEnvironment; // } // // @Nullable // @Override // protected RollbackEnvironment createRollbackEnvironment() { // return new FossilRollbackEnvironment(this); // } // // @Nullable // @Override // public VcsHistoryProvider getVcsHistoryProvider() { // return new FossilHistoryProvider(this); // } // // @Nullable // @Override // protected UpdateEnvironment createUpdateEnvironment() { // return new FossilUpdateEnvironment(this); // } // // @Override // public List<CommitExecutor> getCommitExecutors() { // return Collections.<CommitExecutor>singletonList(new FossilCommitAndPushExecutor(myProject)); // } // // public void checkVersion() { // //todo // } // // @Nullable // @Override // public DiffProvider getDiffProvider() { // return new FossilDiffProvider(this); // } // // public static FossilVcs getInstance(final Project project) { // return (FossilVcs) ProjectLevelVcsManager.getInstance(project).findVcsByName(NAME); // } // // public static VcsKey getVcsKey() { // return ourKey; // } // // @Nullable // @Override // public AnnotationProvider getAnnotationProvider() { // return new FossilAnnotationProvider(this); // } // } // // Path: src/org/github/irengrig/fossil4idea/log/CatWorker.java // public class CatWorker { // private final Project myProject; // // public CatWorker(final Project project) { // myProject = project; // } // // public String cat(final File file, @Nullable final String revNum) throws VcsException { // final FossilSimpleCommand command = new FossilSimpleCommand(myProject, MoveWorker.findParent(file), FCommandName.finfo); // command.addParameters("-p"); // if (revNum != null && ! "HEAD".equals(revNum)) { // command.addParameters("-r", revNum); // } // command.addParameters(file.getPath()); // return command.run(); // } // } // Path: src/org/github/irengrig/fossil4idea/repository/FossilContentRevision.java import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Throwable2Computable; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.changes.ContentRevision; import com.intellij.openapi.vcs.impl.ContentRevisionCache; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.github.irengrig.fossil4idea.FossilException; import org.github.irengrig.fossil4idea.FossilVcs; import org.github.irengrig.fossil4idea.log.CatWorker; import java.io.IOException; package org.github.irengrig.fossil4idea.repository; /** * Created with IntelliJ IDEA. * User: Irina.Chernushina * Date: 2/13/13 * Time: 11:02 PM */ public class FossilContentRevision implements ContentRevision { private final Project myProject; private final FilePath myFilePath; private final FossilRevisionNumber myNumber; public FossilContentRevision(final Project project, final FilePath filePath, final FossilRevisionNumber number) { myProject = project; myFilePath = filePath; myNumber = number; } @Nullable @Override public String getContent() throws VcsException { try {
return ContentRevisionCache.getOrLoadAsString(myProject, myFilePath, myNumber, FossilVcs.getVcsKey(),
irengrig/fossil4idea
src/org/github/irengrig/fossil4idea/repository/FossilContentRevision.java
// Path: src/org/github/irengrig/fossil4idea/FossilException.java // public class FossilException extends VcsException { // public FossilException(final String message) { // super(message); // } // // public FossilException(final Throwable throwable, final boolean isWarning) { // super(throwable, isWarning); // } // // public FossilException(final Throwable throwable) { // super(throwable); // } // // public FossilException(final String message, final Throwable cause) { // super(message, cause); // } // // public FossilException(final String message, final boolean isWarning) { // super(message, isWarning); // } // // public FossilException(final Collection<String> messages) { // super(messages); // } // } // // Path: src/org/github/irengrig/fossil4idea/FossilVcs.java // public class FossilVcs extends AbstractVcs { // public static String NAME = "fossil"; // public static String DISPLAY_NAME = "Fossil"; // private FossilChangeProvider myChangeProvider; // private static final VcsKey ourKey = createKey(NAME); // private FossilVfsListener myVfsListener; // private UiManager uiManager; // private FossilCheckinEnvironment fossilCheckinEnvironment; // // public FossilVcs(Project project) { // super(project, NAME); // } // // @Override // public String getDisplayName() { // return DISPLAY_NAME; // } // // @Override // public Configurable getConfigurable() { // return new FossilConfigurable(myProject); // } // // @Override // protected void activate() { // myVfsListener = new FossilVfsListener(myProject); // uiManager = new UiManager(myProject); // } // // @Override // protected void deactivate() { // if (myVfsListener != null) { // Disposer.dispose(myVfsListener); // myVfsListener = null; // uiManager.stop(); // } // } // // public UiManager getUiManager() { // return uiManager; // } // // @Nullable // @Override // public ChangeProvider getChangeProvider() { // if (myChangeProvider == null) { // myChangeProvider = new FossilChangeProvider(myProject); // } // return myChangeProvider; // } // // @Nullable // @Override // protected CheckinEnvironment createCheckinEnvironment() { // if (fossilCheckinEnvironment == null) { // fossilCheckinEnvironment = new FossilCheckinEnvironment(this); // } // return fossilCheckinEnvironment; // } // // @Nullable // @Override // protected RollbackEnvironment createRollbackEnvironment() { // return new FossilRollbackEnvironment(this); // } // // @Nullable // @Override // public VcsHistoryProvider getVcsHistoryProvider() { // return new FossilHistoryProvider(this); // } // // @Nullable // @Override // protected UpdateEnvironment createUpdateEnvironment() { // return new FossilUpdateEnvironment(this); // } // // @Override // public List<CommitExecutor> getCommitExecutors() { // return Collections.<CommitExecutor>singletonList(new FossilCommitAndPushExecutor(myProject)); // } // // public void checkVersion() { // //todo // } // // @Nullable // @Override // public DiffProvider getDiffProvider() { // return new FossilDiffProvider(this); // } // // public static FossilVcs getInstance(final Project project) { // return (FossilVcs) ProjectLevelVcsManager.getInstance(project).findVcsByName(NAME); // } // // public static VcsKey getVcsKey() { // return ourKey; // } // // @Nullable // @Override // public AnnotationProvider getAnnotationProvider() { // return new FossilAnnotationProvider(this); // } // } // // Path: src/org/github/irengrig/fossil4idea/log/CatWorker.java // public class CatWorker { // private final Project myProject; // // public CatWorker(final Project project) { // myProject = project; // } // // public String cat(final File file, @Nullable final String revNum) throws VcsException { // final FossilSimpleCommand command = new FossilSimpleCommand(myProject, MoveWorker.findParent(file), FCommandName.finfo); // command.addParameters("-p"); // if (revNum != null && ! "HEAD".equals(revNum)) { // command.addParameters("-r", revNum); // } // command.addParameters(file.getPath()); // return command.run(); // } // }
import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Throwable2Computable; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.changes.ContentRevision; import com.intellij.openapi.vcs.impl.ContentRevisionCache; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.github.irengrig.fossil4idea.FossilException; import org.github.irengrig.fossil4idea.FossilVcs; import org.github.irengrig.fossil4idea.log.CatWorker; import java.io.IOException;
package org.github.irengrig.fossil4idea.repository; /** * Created with IntelliJ IDEA. * User: Irina.Chernushina * Date: 2/13/13 * Time: 11:02 PM */ public class FossilContentRevision implements ContentRevision { private final Project myProject; private final FilePath myFilePath; private final FossilRevisionNumber myNumber; public FossilContentRevision(final Project project, final FilePath filePath, final FossilRevisionNumber number) { myProject = project; myFilePath = filePath; myNumber = number; } @Nullable @Override public String getContent() throws VcsException { try { return ContentRevisionCache.getOrLoadAsString(myProject, myFilePath, myNumber, FossilVcs.getVcsKey(), ContentRevisionCache.UniqueType.REPOSITORY_CONTENT, new Throwable2Computable<byte[], VcsException, IOException>() { @Override public byte[] compute() throws VcsException, IOException {
// Path: src/org/github/irengrig/fossil4idea/FossilException.java // public class FossilException extends VcsException { // public FossilException(final String message) { // super(message); // } // // public FossilException(final Throwable throwable, final boolean isWarning) { // super(throwable, isWarning); // } // // public FossilException(final Throwable throwable) { // super(throwable); // } // // public FossilException(final String message, final Throwable cause) { // super(message, cause); // } // // public FossilException(final String message, final boolean isWarning) { // super(message, isWarning); // } // // public FossilException(final Collection<String> messages) { // super(messages); // } // } // // Path: src/org/github/irengrig/fossil4idea/FossilVcs.java // public class FossilVcs extends AbstractVcs { // public static String NAME = "fossil"; // public static String DISPLAY_NAME = "Fossil"; // private FossilChangeProvider myChangeProvider; // private static final VcsKey ourKey = createKey(NAME); // private FossilVfsListener myVfsListener; // private UiManager uiManager; // private FossilCheckinEnvironment fossilCheckinEnvironment; // // public FossilVcs(Project project) { // super(project, NAME); // } // // @Override // public String getDisplayName() { // return DISPLAY_NAME; // } // // @Override // public Configurable getConfigurable() { // return new FossilConfigurable(myProject); // } // // @Override // protected void activate() { // myVfsListener = new FossilVfsListener(myProject); // uiManager = new UiManager(myProject); // } // // @Override // protected void deactivate() { // if (myVfsListener != null) { // Disposer.dispose(myVfsListener); // myVfsListener = null; // uiManager.stop(); // } // } // // public UiManager getUiManager() { // return uiManager; // } // // @Nullable // @Override // public ChangeProvider getChangeProvider() { // if (myChangeProvider == null) { // myChangeProvider = new FossilChangeProvider(myProject); // } // return myChangeProvider; // } // // @Nullable // @Override // protected CheckinEnvironment createCheckinEnvironment() { // if (fossilCheckinEnvironment == null) { // fossilCheckinEnvironment = new FossilCheckinEnvironment(this); // } // return fossilCheckinEnvironment; // } // // @Nullable // @Override // protected RollbackEnvironment createRollbackEnvironment() { // return new FossilRollbackEnvironment(this); // } // // @Nullable // @Override // public VcsHistoryProvider getVcsHistoryProvider() { // return new FossilHistoryProvider(this); // } // // @Nullable // @Override // protected UpdateEnvironment createUpdateEnvironment() { // return new FossilUpdateEnvironment(this); // } // // @Override // public List<CommitExecutor> getCommitExecutors() { // return Collections.<CommitExecutor>singletonList(new FossilCommitAndPushExecutor(myProject)); // } // // public void checkVersion() { // //todo // } // // @Nullable // @Override // public DiffProvider getDiffProvider() { // return new FossilDiffProvider(this); // } // // public static FossilVcs getInstance(final Project project) { // return (FossilVcs) ProjectLevelVcsManager.getInstance(project).findVcsByName(NAME); // } // // public static VcsKey getVcsKey() { // return ourKey; // } // // @Nullable // @Override // public AnnotationProvider getAnnotationProvider() { // return new FossilAnnotationProvider(this); // } // } // // Path: src/org/github/irengrig/fossil4idea/log/CatWorker.java // public class CatWorker { // private final Project myProject; // // public CatWorker(final Project project) { // myProject = project; // } // // public String cat(final File file, @Nullable final String revNum) throws VcsException { // final FossilSimpleCommand command = new FossilSimpleCommand(myProject, MoveWorker.findParent(file), FCommandName.finfo); // command.addParameters("-p"); // if (revNum != null && ! "HEAD".equals(revNum)) { // command.addParameters("-r", revNum); // } // command.addParameters(file.getPath()); // return command.run(); // } // } // Path: src/org/github/irengrig/fossil4idea/repository/FossilContentRevision.java import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Throwable2Computable; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.changes.ContentRevision; import com.intellij.openapi.vcs.impl.ContentRevisionCache; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.github.irengrig.fossil4idea.FossilException; import org.github.irengrig.fossil4idea.FossilVcs; import org.github.irengrig.fossil4idea.log.CatWorker; import java.io.IOException; package org.github.irengrig.fossil4idea.repository; /** * Created with IntelliJ IDEA. * User: Irina.Chernushina * Date: 2/13/13 * Time: 11:02 PM */ public class FossilContentRevision implements ContentRevision { private final Project myProject; private final FilePath myFilePath; private final FossilRevisionNumber myNumber; public FossilContentRevision(final Project project, final FilePath filePath, final FossilRevisionNumber number) { myProject = project; myFilePath = filePath; myNumber = number; } @Nullable @Override public String getContent() throws VcsException { try { return ContentRevisionCache.getOrLoadAsString(myProject, myFilePath, myNumber, FossilVcs.getVcsKey(), ContentRevisionCache.UniqueType.REPOSITORY_CONTENT, new Throwable2Computable<byte[], VcsException, IOException>() { @Override public byte[] compute() throws VcsException, IOException {
return new CatWorker(myProject).cat(myFilePath.getIOFile(), myNumber.getHash()).getBytes();
irengrig/fossil4idea
src/org/github/irengrig/fossil4idea/commandLine/FossilCommand.java
// Path: src/org/github/irengrig/fossil4idea/FossilVcs.java // public class FossilVcs extends AbstractVcs { // public static String NAME = "fossil"; // public static String DISPLAY_NAME = "Fossil"; // private FossilChangeProvider myChangeProvider; // private static final VcsKey ourKey = createKey(NAME); // private FossilVfsListener myVfsListener; // private UiManager uiManager; // private FossilCheckinEnvironment fossilCheckinEnvironment; // // public FossilVcs(Project project) { // super(project, NAME); // } // // @Override // public String getDisplayName() { // return DISPLAY_NAME; // } // // @Override // public Configurable getConfigurable() { // return new FossilConfigurable(myProject); // } // // @Override // protected void activate() { // myVfsListener = new FossilVfsListener(myProject); // uiManager = new UiManager(myProject); // } // // @Override // protected void deactivate() { // if (myVfsListener != null) { // Disposer.dispose(myVfsListener); // myVfsListener = null; // uiManager.stop(); // } // } // // public UiManager getUiManager() { // return uiManager; // } // // @Nullable // @Override // public ChangeProvider getChangeProvider() { // if (myChangeProvider == null) { // myChangeProvider = new FossilChangeProvider(myProject); // } // return myChangeProvider; // } // // @Nullable // @Override // protected CheckinEnvironment createCheckinEnvironment() { // if (fossilCheckinEnvironment == null) { // fossilCheckinEnvironment = new FossilCheckinEnvironment(this); // } // return fossilCheckinEnvironment; // } // // @Nullable // @Override // protected RollbackEnvironment createRollbackEnvironment() { // return new FossilRollbackEnvironment(this); // } // // @Nullable // @Override // public VcsHistoryProvider getVcsHistoryProvider() { // return new FossilHistoryProvider(this); // } // // @Nullable // @Override // protected UpdateEnvironment createUpdateEnvironment() { // return new FossilUpdateEnvironment(this); // } // // @Override // public List<CommitExecutor> getCommitExecutors() { // return Collections.<CommitExecutor>singletonList(new FossilCommitAndPushExecutor(myProject)); // } // // public void checkVersion() { // //todo // } // // @Nullable // @Override // public DiffProvider getDiffProvider() { // return new FossilDiffProvider(this); // } // // public static FossilVcs getInstance(final Project project) { // return (FossilVcs) ProjectLevelVcsManager.getInstance(project).findVcsByName(NAME); // } // // public static VcsKey getVcsKey() { // return ourKey; // } // // @Nullable // @Override // public AnnotationProvider getAnnotationProvider() { // return new FossilAnnotationProvider(this); // } // } // // Path: src/org/github/irengrig/fossil4idea/FossilConfiguration.java // @State( // name = "FossilConfiguration", // storages = { // @Storage(file = StoragePathMacros.WORKSPACE_FILE) // } // ) // public class FossilConfiguration implements PersistentStateComponent<Element> { // public String FOSSIL_PATH = ""; // private final Map<File, String> myRemoteUrls = new HashMap<File, String>(); // // @Nullable // public Element getState() { // Element element = new Element("state"); // element.setAttribute("FOSSIL_PATH", FOSSIL_PATH); // return element; // } // // public void loadState(Element element) { // final Attribute fossilPath = element.getAttribute("FOSSIL_PATH"); // if (fossilPath != null) { // FOSSIL_PATH = fossilPath.getValue(); // } // } // // public static FossilConfiguration getInstance(final Project project) { // return ServiceManager.getService(project, FossilConfiguration.class); // } // // public void setRemoteUrls(final Map<File, String> urls) { // myRemoteUrls.clear(); // myRemoteUrls.putAll(urls); // } // // public Map<File, String> getRemoteUrls() { // return myRemoteUrls; // } // }
import com.intellij.execution.ExecutionException; import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.ProcessEventListener; import com.intellij.util.EventDispatcher; import com.intellij.util.Processor; import org.github.irengrig.fossil4idea.FossilVcs; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.github.irengrig.fossil4idea.FossilConfiguration; import java.io.File; import java.io.OutputStream; import java.util.List;
package org.github.irengrig.fossil4idea.commandLine; /** * Created with IntelliJ IDEA. * User: Irina.Chernushina * Date: 2/12/13 * Time: 12:17 PM */ public abstract class FossilCommand { private static final Logger LOG = Logger.getInstance(FossilCommand.class.getName()); protected final Project myProject; protected final GeneralCommandLine myCommandLine; private final File myWorkingDirectory; protected Process myProcess; private final Object myLock; private Integer myExitCode; // exit code or null if exit code is not yet available private boolean myCanceled; private final EventDispatcher<ProcessEventListener> myListeners = EventDispatcher.create(ProcessEventListener.class); private Processor<OutputStream> myInputProcessor; // The processor for stdin public FossilCommand(Project project, File workingDirectory, @NotNull FCommandName commandName) { myLock = new Object(); myProject = project; myCommandLine = new GeneralCommandLine(); myWorkingDirectory = workingDirectory;
// Path: src/org/github/irengrig/fossil4idea/FossilVcs.java // public class FossilVcs extends AbstractVcs { // public static String NAME = "fossil"; // public static String DISPLAY_NAME = "Fossil"; // private FossilChangeProvider myChangeProvider; // private static final VcsKey ourKey = createKey(NAME); // private FossilVfsListener myVfsListener; // private UiManager uiManager; // private FossilCheckinEnvironment fossilCheckinEnvironment; // // public FossilVcs(Project project) { // super(project, NAME); // } // // @Override // public String getDisplayName() { // return DISPLAY_NAME; // } // // @Override // public Configurable getConfigurable() { // return new FossilConfigurable(myProject); // } // // @Override // protected void activate() { // myVfsListener = new FossilVfsListener(myProject); // uiManager = new UiManager(myProject); // } // // @Override // protected void deactivate() { // if (myVfsListener != null) { // Disposer.dispose(myVfsListener); // myVfsListener = null; // uiManager.stop(); // } // } // // public UiManager getUiManager() { // return uiManager; // } // // @Nullable // @Override // public ChangeProvider getChangeProvider() { // if (myChangeProvider == null) { // myChangeProvider = new FossilChangeProvider(myProject); // } // return myChangeProvider; // } // // @Nullable // @Override // protected CheckinEnvironment createCheckinEnvironment() { // if (fossilCheckinEnvironment == null) { // fossilCheckinEnvironment = new FossilCheckinEnvironment(this); // } // return fossilCheckinEnvironment; // } // // @Nullable // @Override // protected RollbackEnvironment createRollbackEnvironment() { // return new FossilRollbackEnvironment(this); // } // // @Nullable // @Override // public VcsHistoryProvider getVcsHistoryProvider() { // return new FossilHistoryProvider(this); // } // // @Nullable // @Override // protected UpdateEnvironment createUpdateEnvironment() { // return new FossilUpdateEnvironment(this); // } // // @Override // public List<CommitExecutor> getCommitExecutors() { // return Collections.<CommitExecutor>singletonList(new FossilCommitAndPushExecutor(myProject)); // } // // public void checkVersion() { // //todo // } // // @Nullable // @Override // public DiffProvider getDiffProvider() { // return new FossilDiffProvider(this); // } // // public static FossilVcs getInstance(final Project project) { // return (FossilVcs) ProjectLevelVcsManager.getInstance(project).findVcsByName(NAME); // } // // public static VcsKey getVcsKey() { // return ourKey; // } // // @Nullable // @Override // public AnnotationProvider getAnnotationProvider() { // return new FossilAnnotationProvider(this); // } // } // // Path: src/org/github/irengrig/fossil4idea/FossilConfiguration.java // @State( // name = "FossilConfiguration", // storages = { // @Storage(file = StoragePathMacros.WORKSPACE_FILE) // } // ) // public class FossilConfiguration implements PersistentStateComponent<Element> { // public String FOSSIL_PATH = ""; // private final Map<File, String> myRemoteUrls = new HashMap<File, String>(); // // @Nullable // public Element getState() { // Element element = new Element("state"); // element.setAttribute("FOSSIL_PATH", FOSSIL_PATH); // return element; // } // // public void loadState(Element element) { // final Attribute fossilPath = element.getAttribute("FOSSIL_PATH"); // if (fossilPath != null) { // FOSSIL_PATH = fossilPath.getValue(); // } // } // // public static FossilConfiguration getInstance(final Project project) { // return ServiceManager.getService(project, FossilConfiguration.class); // } // // public void setRemoteUrls(final Map<File, String> urls) { // myRemoteUrls.clear(); // myRemoteUrls.putAll(urls); // } // // public Map<File, String> getRemoteUrls() { // return myRemoteUrls; // } // } // Path: src/org/github/irengrig/fossil4idea/commandLine/FossilCommand.java import com.intellij.execution.ExecutionException; import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.ProcessEventListener; import com.intellij.util.EventDispatcher; import com.intellij.util.Processor; import org.github.irengrig.fossil4idea.FossilVcs; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.github.irengrig.fossil4idea.FossilConfiguration; import java.io.File; import java.io.OutputStream; import java.util.List; package org.github.irengrig.fossil4idea.commandLine; /** * Created with IntelliJ IDEA. * User: Irina.Chernushina * Date: 2/12/13 * Time: 12:17 PM */ public abstract class FossilCommand { private static final Logger LOG = Logger.getInstance(FossilCommand.class.getName()); protected final Project myProject; protected final GeneralCommandLine myCommandLine; private final File myWorkingDirectory; protected Process myProcess; private final Object myLock; private Integer myExitCode; // exit code or null if exit code is not yet available private boolean myCanceled; private final EventDispatcher<ProcessEventListener> myListeners = EventDispatcher.create(ProcessEventListener.class); private Processor<OutputStream> myInputProcessor; // The processor for stdin public FossilCommand(Project project, File workingDirectory, @NotNull FCommandName commandName) { myLock = new Object(); myProject = project; myCommandLine = new GeneralCommandLine(); myWorkingDirectory = workingDirectory;
final FossilConfiguration configuration = FossilConfiguration.getInstance(project);
irengrig/fossil4idea
src/org/github/irengrig/fossil4idea/commandLine/FossilCommand.java
// Path: src/org/github/irengrig/fossil4idea/FossilVcs.java // public class FossilVcs extends AbstractVcs { // public static String NAME = "fossil"; // public static String DISPLAY_NAME = "Fossil"; // private FossilChangeProvider myChangeProvider; // private static final VcsKey ourKey = createKey(NAME); // private FossilVfsListener myVfsListener; // private UiManager uiManager; // private FossilCheckinEnvironment fossilCheckinEnvironment; // // public FossilVcs(Project project) { // super(project, NAME); // } // // @Override // public String getDisplayName() { // return DISPLAY_NAME; // } // // @Override // public Configurable getConfigurable() { // return new FossilConfigurable(myProject); // } // // @Override // protected void activate() { // myVfsListener = new FossilVfsListener(myProject); // uiManager = new UiManager(myProject); // } // // @Override // protected void deactivate() { // if (myVfsListener != null) { // Disposer.dispose(myVfsListener); // myVfsListener = null; // uiManager.stop(); // } // } // // public UiManager getUiManager() { // return uiManager; // } // // @Nullable // @Override // public ChangeProvider getChangeProvider() { // if (myChangeProvider == null) { // myChangeProvider = new FossilChangeProvider(myProject); // } // return myChangeProvider; // } // // @Nullable // @Override // protected CheckinEnvironment createCheckinEnvironment() { // if (fossilCheckinEnvironment == null) { // fossilCheckinEnvironment = new FossilCheckinEnvironment(this); // } // return fossilCheckinEnvironment; // } // // @Nullable // @Override // protected RollbackEnvironment createRollbackEnvironment() { // return new FossilRollbackEnvironment(this); // } // // @Nullable // @Override // public VcsHistoryProvider getVcsHistoryProvider() { // return new FossilHistoryProvider(this); // } // // @Nullable // @Override // protected UpdateEnvironment createUpdateEnvironment() { // return new FossilUpdateEnvironment(this); // } // // @Override // public List<CommitExecutor> getCommitExecutors() { // return Collections.<CommitExecutor>singletonList(new FossilCommitAndPushExecutor(myProject)); // } // // public void checkVersion() { // //todo // } // // @Nullable // @Override // public DiffProvider getDiffProvider() { // return new FossilDiffProvider(this); // } // // public static FossilVcs getInstance(final Project project) { // return (FossilVcs) ProjectLevelVcsManager.getInstance(project).findVcsByName(NAME); // } // // public static VcsKey getVcsKey() { // return ourKey; // } // // @Nullable // @Override // public AnnotationProvider getAnnotationProvider() { // return new FossilAnnotationProvider(this); // } // } // // Path: src/org/github/irengrig/fossil4idea/FossilConfiguration.java // @State( // name = "FossilConfiguration", // storages = { // @Storage(file = StoragePathMacros.WORKSPACE_FILE) // } // ) // public class FossilConfiguration implements PersistentStateComponent<Element> { // public String FOSSIL_PATH = ""; // private final Map<File, String> myRemoteUrls = new HashMap<File, String>(); // // @Nullable // public Element getState() { // Element element = new Element("state"); // element.setAttribute("FOSSIL_PATH", FOSSIL_PATH); // return element; // } // // public void loadState(Element element) { // final Attribute fossilPath = element.getAttribute("FOSSIL_PATH"); // if (fossilPath != null) { // FOSSIL_PATH = fossilPath.getValue(); // } // } // // public static FossilConfiguration getInstance(final Project project) { // return ServiceManager.getService(project, FossilConfiguration.class); // } // // public void setRemoteUrls(final Map<File, String> urls) { // myRemoteUrls.clear(); // myRemoteUrls.putAll(urls); // } // // public Map<File, String> getRemoteUrls() { // return myRemoteUrls; // } // }
import com.intellij.execution.ExecutionException; import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.ProcessEventListener; import com.intellij.util.EventDispatcher; import com.intellij.util.Processor; import org.github.irengrig.fossil4idea.FossilVcs; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.github.irengrig.fossil4idea.FossilConfiguration; import java.io.File; import java.io.OutputStream; import java.util.List;
private final Object myLock; private Integer myExitCode; // exit code or null if exit code is not yet available private boolean myCanceled; private final EventDispatcher<ProcessEventListener> myListeners = EventDispatcher.create(ProcessEventListener.class); private Processor<OutputStream> myInputProcessor; // The processor for stdin public FossilCommand(Project project, File workingDirectory, @NotNull FCommandName commandName) { myLock = new Object(); myProject = project; myCommandLine = new GeneralCommandLine(); myWorkingDirectory = workingDirectory; final FossilConfiguration configuration = FossilConfiguration.getInstance(project); final String path = StringUtil.isEmptyOrSpaces(configuration.FOSSIL_PATH) ? "fossil" : configuration.FOSSIL_PATH; myCommandLine.setExePath(path); myCommandLine.setWorkDirectory(workingDirectory); myCommandLine.addParameter(commandName.getName()); } public void start() { synchronized (myLock) { checkNotStarted(); try { myProcess = startProcess(); if (myProcess != null) { startHandlingStreams(); } else {
// Path: src/org/github/irengrig/fossil4idea/FossilVcs.java // public class FossilVcs extends AbstractVcs { // public static String NAME = "fossil"; // public static String DISPLAY_NAME = "Fossil"; // private FossilChangeProvider myChangeProvider; // private static final VcsKey ourKey = createKey(NAME); // private FossilVfsListener myVfsListener; // private UiManager uiManager; // private FossilCheckinEnvironment fossilCheckinEnvironment; // // public FossilVcs(Project project) { // super(project, NAME); // } // // @Override // public String getDisplayName() { // return DISPLAY_NAME; // } // // @Override // public Configurable getConfigurable() { // return new FossilConfigurable(myProject); // } // // @Override // protected void activate() { // myVfsListener = new FossilVfsListener(myProject); // uiManager = new UiManager(myProject); // } // // @Override // protected void deactivate() { // if (myVfsListener != null) { // Disposer.dispose(myVfsListener); // myVfsListener = null; // uiManager.stop(); // } // } // // public UiManager getUiManager() { // return uiManager; // } // // @Nullable // @Override // public ChangeProvider getChangeProvider() { // if (myChangeProvider == null) { // myChangeProvider = new FossilChangeProvider(myProject); // } // return myChangeProvider; // } // // @Nullable // @Override // protected CheckinEnvironment createCheckinEnvironment() { // if (fossilCheckinEnvironment == null) { // fossilCheckinEnvironment = new FossilCheckinEnvironment(this); // } // return fossilCheckinEnvironment; // } // // @Nullable // @Override // protected RollbackEnvironment createRollbackEnvironment() { // return new FossilRollbackEnvironment(this); // } // // @Nullable // @Override // public VcsHistoryProvider getVcsHistoryProvider() { // return new FossilHistoryProvider(this); // } // // @Nullable // @Override // protected UpdateEnvironment createUpdateEnvironment() { // return new FossilUpdateEnvironment(this); // } // // @Override // public List<CommitExecutor> getCommitExecutors() { // return Collections.<CommitExecutor>singletonList(new FossilCommitAndPushExecutor(myProject)); // } // // public void checkVersion() { // //todo // } // // @Nullable // @Override // public DiffProvider getDiffProvider() { // return new FossilDiffProvider(this); // } // // public static FossilVcs getInstance(final Project project) { // return (FossilVcs) ProjectLevelVcsManager.getInstance(project).findVcsByName(NAME); // } // // public static VcsKey getVcsKey() { // return ourKey; // } // // @Nullable // @Override // public AnnotationProvider getAnnotationProvider() { // return new FossilAnnotationProvider(this); // } // } // // Path: src/org/github/irengrig/fossil4idea/FossilConfiguration.java // @State( // name = "FossilConfiguration", // storages = { // @Storage(file = StoragePathMacros.WORKSPACE_FILE) // } // ) // public class FossilConfiguration implements PersistentStateComponent<Element> { // public String FOSSIL_PATH = ""; // private final Map<File, String> myRemoteUrls = new HashMap<File, String>(); // // @Nullable // public Element getState() { // Element element = new Element("state"); // element.setAttribute("FOSSIL_PATH", FOSSIL_PATH); // return element; // } // // public void loadState(Element element) { // final Attribute fossilPath = element.getAttribute("FOSSIL_PATH"); // if (fossilPath != null) { // FOSSIL_PATH = fossilPath.getValue(); // } // } // // public static FossilConfiguration getInstance(final Project project) { // return ServiceManager.getService(project, FossilConfiguration.class); // } // // public void setRemoteUrls(final Map<File, String> urls) { // myRemoteUrls.clear(); // myRemoteUrls.putAll(urls); // } // // public Map<File, String> getRemoteUrls() { // return myRemoteUrls; // } // } // Path: src/org/github/irengrig/fossil4idea/commandLine/FossilCommand.java import com.intellij.execution.ExecutionException; import com.intellij.execution.configurations.GeneralCommandLine; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.ProcessEventListener; import com.intellij.util.EventDispatcher; import com.intellij.util.Processor; import org.github.irengrig.fossil4idea.FossilVcs; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.github.irengrig.fossil4idea.FossilConfiguration; import java.io.File; import java.io.OutputStream; import java.util.List; private final Object myLock; private Integer myExitCode; // exit code or null if exit code is not yet available private boolean myCanceled; private final EventDispatcher<ProcessEventListener> myListeners = EventDispatcher.create(ProcessEventListener.class); private Processor<OutputStream> myInputProcessor; // The processor for stdin public FossilCommand(Project project, File workingDirectory, @NotNull FCommandName commandName) { myLock = new Object(); myProject = project; myCommandLine = new GeneralCommandLine(); myWorkingDirectory = workingDirectory; final FossilConfiguration configuration = FossilConfiguration.getInstance(project); final String path = StringUtil.isEmptyOrSpaces(configuration.FOSSIL_PATH) ? "fossil" : configuration.FOSSIL_PATH; myCommandLine.setExePath(path); myCommandLine.setWorkDirectory(workingDirectory); myCommandLine.addParameter(commandName.getName()); } public void start() { synchronized (myLock) { checkNotStarted(); try { myProcess = startProcess(); if (myProcess != null) { startHandlingStreams(); } else {
FossilVcs.getInstance(myProject).checkVersion();