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 |
|---|---|---|---|---|---|---|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/rest/ContextRestEndpoint.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
| package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class ContextRestEndpoint {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping(value = "/rest/context", method = RequestMethod.GET)
@ResponseBody
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
// Path: camelwatch-web/src/main/java/camelwatch/rest/ContextRestEndpoint.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class ContextRestEndpoint {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping(value = "/rest/context", method = RequestMethod.GET)
@ResponseBody
| public List<CamelBean> getConsumer() throws Exception {
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/web/RouteController.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/route/RouteOperations.java
// public interface RouteOperations {
//
// String dumpRouteAsXml() throws Exception;
//
// void remove();
//
// void reset();
//
// void resume() throws Exception;
//
// void setStatisticsEnabled(boolean enabled);
//
// void start() throws Exception;
//
// void stop() throws Exception;
//
// void suspend() throws Exception;
//
// void updateRouteFromXml(String xml) throws Exception;
//
// void setTracing(boolean enable) throws Exception;
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.route.RouteOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
| package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("route/{routeId}")
public class RouteController {
@Autowired
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/route/RouteOperations.java
// public interface RouteOperations {
//
// String dumpRouteAsXml() throws Exception;
//
// void remove();
//
// void reset();
//
// void resume() throws Exception;
//
// void setStatisticsEnabled(boolean enabled);
//
// void start() throws Exception;
//
// void stop() throws Exception;
//
// void suspend() throws Exception;
//
// void updateRouteFromXml(String xml) throws Exception;
//
// void setTracing(boolean enable) throws Exception;
// }
// Path: camelwatch-web/src/main/java/camelwatch/web/RouteController.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.route.RouteOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("route/{routeId}")
public class RouteController {
@Autowired
| private CamelConnectionFactory connectionFactory;
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/web/RouteController.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/route/RouteOperations.java
// public interface RouteOperations {
//
// String dumpRouteAsXml() throws Exception;
//
// void remove();
//
// void reset();
//
// void resume() throws Exception;
//
// void setStatisticsEnabled(boolean enabled);
//
// void start() throws Exception;
//
// void stop() throws Exception;
//
// void suspend() throws Exception;
//
// void updateRouteFromXml(String xml) throws Exception;
//
// void setTracing(boolean enable) throws Exception;
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.route.RouteOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
| package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("route/{routeId}")
public class RouteController {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping(value = "dump", produces = MediaType.TEXT_XML_VALUE)
@ResponseBody
public String dump(@PathVariable("routeId") String routeId) throws Exception {
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/route/RouteOperations.java
// public interface RouteOperations {
//
// String dumpRouteAsXml() throws Exception;
//
// void remove();
//
// void reset();
//
// void resume() throws Exception;
//
// void setStatisticsEnabled(boolean enabled);
//
// void start() throws Exception;
//
// void stop() throws Exception;
//
// void suspend() throws Exception;
//
// void updateRouteFromXml(String xml) throws Exception;
//
// void setTracing(boolean enable) throws Exception;
// }
// Path: camelwatch-web/src/main/java/camelwatch/web/RouteController.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.route.RouteOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("route/{routeId}")
public class RouteController {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping(value = "dump", produces = MediaType.TEXT_XML_VALUE)
@ResponseBody
public String dump(@PathVariable("routeId") String routeId) throws Exception {
| CamelConnection conn = connectionFactory.getConnection();
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/web/RouteController.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/route/RouteOperations.java
// public interface RouteOperations {
//
// String dumpRouteAsXml() throws Exception;
//
// void remove();
//
// void reset();
//
// void resume() throws Exception;
//
// void setStatisticsEnabled(boolean enabled);
//
// void start() throws Exception;
//
// void stop() throws Exception;
//
// void suspend() throws Exception;
//
// void updateRouteFromXml(String xml) throws Exception;
//
// void setTracing(boolean enable) throws Exception;
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.route.RouteOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
| package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("route/{routeId}")
public class RouteController {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping(value = "dump", produces = MediaType.TEXT_XML_VALUE)
@ResponseBody
public String dump(@PathVariable("routeId") String routeId) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/route/RouteOperations.java
// public interface RouteOperations {
//
// String dumpRouteAsXml() throws Exception;
//
// void remove();
//
// void reset();
//
// void resume() throws Exception;
//
// void setStatisticsEnabled(boolean enabled);
//
// void start() throws Exception;
//
// void stop() throws Exception;
//
// void suspend() throws Exception;
//
// void updateRouteFromXml(String xml) throws Exception;
//
// void setTracing(boolean enable) throws Exception;
// }
// Path: camelwatch-web/src/main/java/camelwatch/web/RouteController.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.route.RouteOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("route/{routeId}")
public class RouteController {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping(value = "dump", produces = MediaType.TEXT_XML_VALUE)
@ResponseBody
public String dump(@PathVariable("routeId") String routeId) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
| RouteOperations routeOps = conn.getRouteOperations(routeId);
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/web/RouteController.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/route/RouteOperations.java
// public interface RouteOperations {
//
// String dumpRouteAsXml() throws Exception;
//
// void remove();
//
// void reset();
//
// void resume() throws Exception;
//
// void setStatisticsEnabled(boolean enabled);
//
// void start() throws Exception;
//
// void stop() throws Exception;
//
// void suspend() throws Exception;
//
// void updateRouteFromXml(String xml) throws Exception;
//
// void setTracing(boolean enable) throws Exception;
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.route.RouteOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
| @RequestMapping("remove")
public String remove(@PathVariable("routeId") String routeId) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
RouteOperations routeOps = conn.getRouteOperations(routeId);
routeOps.remove();
return getRedirect(routeId);
}
@RequestMapping("reset")
public String reset(@PathVariable("routeId") String routeId) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
RouteOperations routeOps = conn.getRouteOperations(routeId);
routeOps.reset();
return getRedirect(routeId);
}
@RequestMapping("resume")
public String resume(@PathVariable("routeId") String routeId) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
RouteOperations routeOps = conn.getRouteOperations(routeId);
routeOps.resume();
return getRedirect(routeId);
}
@RequestMapping
public String show(@PathVariable("routeId") String routeId,
ModelMap map,
@RequestParam(value = "message", required = false) String message) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
RouteOperations ops = conn.getRouteOperations(routeId);
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/route/RouteOperations.java
// public interface RouteOperations {
//
// String dumpRouteAsXml() throws Exception;
//
// void remove();
//
// void reset();
//
// void resume() throws Exception;
//
// void setStatisticsEnabled(boolean enabled);
//
// void start() throws Exception;
//
// void stop() throws Exception;
//
// void suspend() throws Exception;
//
// void updateRouteFromXml(String xml) throws Exception;
//
// void setTracing(boolean enable) throws Exception;
// }
// Path: camelwatch-web/src/main/java/camelwatch/web/RouteController.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.route.RouteOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
@RequestMapping("remove")
public String remove(@PathVariable("routeId") String routeId) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
RouteOperations routeOps = conn.getRouteOperations(routeId);
routeOps.remove();
return getRedirect(routeId);
}
@RequestMapping("reset")
public String reset(@PathVariable("routeId") String routeId) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
RouteOperations routeOps = conn.getRouteOperations(routeId);
routeOps.reset();
return getRedirect(routeId);
}
@RequestMapping("resume")
public String resume(@PathVariable("routeId") String routeId) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
RouteOperations routeOps = conn.getRouteOperations(routeId);
routeOps.resume();
return getRedirect(routeId);
}
@RequestMapping
public String show(@PathVariable("routeId") String routeId,
ModelMap map,
@RequestParam(value = "message", required = false) String message) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
RouteOperations ops = conn.getRouteOperations(routeId);
| CamelBean route = conn.getRoute(routeId);
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/web/ManagerController.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
| import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
| package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 29 Jun 2012 00:47:18
*/
@Controller
public class ManagerController {
@Autowired
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
// Path: camelwatch-web/src/main/java/camelwatch/web/ManagerController.java
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 29 Jun 2012 00:47:18
*/
@Controller
public class ManagerController {
@Autowired
| private CamelConnectionFactory connectionFactory;
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/web/ManagerController.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
| import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
| package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 29 Jun 2012 00:47:18
*/
@Controller
public class ManagerController {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping("/")
public String listContexts(ModelMap map) throws Exception {
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
// Path: camelwatch-web/src/main/java/camelwatch/web/ManagerController.java
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 29 Jun 2012 00:47:18
*/
@Controller
public class ManagerController {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping("/")
public String listContexts(ModelMap map) throws Exception {
| CamelConnection conn = connectionFactory.getConnection();
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/web/RestStyleUrlResolver.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import org.camelwatch.api.CamelBean;
import org.springframework.stereotype.Service;
import org.springframework.web.context.ServletContextAware;
import javax.servlet.ServletContext;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
| package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 12:08:39
*/
@Service
public class RestStyleUrlResolver implements UrlResolver, ServletContextAware {
private ServletContext servletContext;
@Override
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
}
@Override
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: camelwatch-web/src/main/java/camelwatch/web/RestStyleUrlResolver.java
import org.camelwatch.api.CamelBean;
import org.springframework.stereotype.Service;
import org.springframework.web.context.ServletContextAware;
import javax.servlet.ServletContext;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 12:08:39
*/
@Service
public class RestStyleUrlResolver implements UrlResolver, ServletContextAware {
private ServletContext servletContext;
@Override
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
}
@Override
| public String getEndpointUrl(CamelBean bean) throws UnsupportedEncodingException {
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/rest/ProcessorRestEndpoint.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
| package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class ProcessorRestEndpoint {
@Autowired
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
// Path: camelwatch-web/src/main/java/camelwatch/rest/ProcessorRestEndpoint.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class ProcessorRestEndpoint {
@Autowired
| private CamelConnectionFactory connectionFactory;
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/rest/ProcessorRestEndpoint.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
| package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class ProcessorRestEndpoint {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping(value = "/rest/processor", method = RequestMethod.GET)
@ResponseBody
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
// Path: camelwatch-web/src/main/java/camelwatch/rest/ProcessorRestEndpoint.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class ProcessorRestEndpoint {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping(value = "/rest/processor", method = RequestMethod.GET)
@ResponseBody
| public List<CamelBean> getConsumer() throws Exception {
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/rest/ErrorHandlerRestEndpoint.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
| package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class ErrorHandlerRestEndpoint {
@Autowired
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
// Path: camelwatch-web/src/main/java/camelwatch/rest/ErrorHandlerRestEndpoint.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class ErrorHandlerRestEndpoint {
@Autowired
| private CamelConnectionFactory connectionFactory;
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/rest/ErrorHandlerRestEndpoint.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
| package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class ErrorHandlerRestEndpoint {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping(value = "/rest/errorHandler", method = RequestMethod.GET)
@ResponseBody
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
// Path: camelwatch-web/src/main/java/camelwatch/rest/ErrorHandlerRestEndpoint.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class ErrorHandlerRestEndpoint {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping(value = "/rest/errorHandler", method = RequestMethod.GET)
@ResponseBody
| public List<CamelBean> getConsumer() throws Exception {
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/web/ErrorHandlerController.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
| package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("errorHandler/{errorHandlerName}")
public class ErrorHandlerController {
@Autowired
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
// Path: camelwatch-web/src/main/java/camelwatch/web/ErrorHandlerController.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("errorHandler/{errorHandlerName}")
public class ErrorHandlerController {
@Autowired
| private CamelConnectionFactory connectionFactory;
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/web/ErrorHandlerController.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
| package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("errorHandler/{errorHandlerName}")
public class ErrorHandlerController {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping
public String show(@PathVariable("errorHandlerName") String errorHandlerName, ModelMap map) throws Exception {
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
// Path: camelwatch-web/src/main/java/camelwatch/web/ErrorHandlerController.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("errorHandler/{errorHandlerName}")
public class ErrorHandlerController {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping
public String show(@PathVariable("errorHandlerName") String errorHandlerName, ModelMap map) throws Exception {
| CamelConnection conn = connectionFactory.getConnection();
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/web/ErrorHandlerController.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
| package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("errorHandler/{errorHandlerName}")
public class ErrorHandlerController {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping
public String show(@PathVariable("errorHandlerName") String errorHandlerName, ModelMap map) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
// Path: camelwatch-web/src/main/java/camelwatch/web/ErrorHandlerController.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("errorHandler/{errorHandlerName}")
public class ErrorHandlerController {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping
public String show(@PathVariable("errorHandlerName") String errorHandlerName, ModelMap map) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
| CamelBean errorHandler = conn.getErrorHandler(errorHandlerName);
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/rest/EndpointRestEndpoint.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
| package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class EndpointRestEndpoint {
@Autowired
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
// Path: camelwatch-web/src/main/java/camelwatch/rest/EndpointRestEndpoint.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class EndpointRestEndpoint {
@Autowired
| private CamelConnectionFactory connectionFactory;
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/rest/EndpointRestEndpoint.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
| package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class EndpointRestEndpoint {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping(value = "/rest/endpoint", method = RequestMethod.GET)
@ResponseBody
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
// Path: camelwatch-web/src/main/java/camelwatch/rest/EndpointRestEndpoint.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class EndpointRestEndpoint {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping(value = "/rest/endpoint", method = RequestMethod.GET)
@ResponseBody
| public List<CamelBean> getConsumer() throws Exception {
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/rest/RouteRestEndpoint.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
| package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class RouteRestEndpoint {
@Autowired
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
// Path: camelwatch-web/src/main/java/camelwatch/rest/RouteRestEndpoint.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class RouteRestEndpoint {
@Autowired
| private CamelConnectionFactory connectionFactory;
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/rest/RouteRestEndpoint.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
| package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class RouteRestEndpoint {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping(value = "/rest/route", method = RequestMethod.GET)
@ResponseBody
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
// Path: camelwatch-web/src/main/java/camelwatch/rest/RouteRestEndpoint.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class RouteRestEndpoint {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping(value = "/rest/route", method = RequestMethod.GET)
@ResponseBody
| public List<CamelBean> getConsumer() throws Exception {
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/rest/ConsumerRestEndpoint.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
| package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class ConsumerRestEndpoint {
@Autowired
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
// Path: camelwatch-web/src/main/java/camelwatch/rest/ConsumerRestEndpoint.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class ConsumerRestEndpoint {
@Autowired
| private CamelConnectionFactory connectionFactory;
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/rest/ConsumerRestEndpoint.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
| package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class ConsumerRestEndpoint {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping(value = "/rest/consumer", method = RequestMethod.GET)
@ResponseBody
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
// Path: camelwatch-web/src/main/java/camelwatch/rest/ConsumerRestEndpoint.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnectionFactory;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
package camelwatch.rest;
/**
* @author Stephen K Samuel samspade79@gmail.com 2 Jul 2012 10:09:57
*/
@Controller
public class ConsumerRestEndpoint {
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping(value = "/rest/consumer", method = RequestMethod.GET)
@ResponseBody
| public List<CamelBean> getConsumer() throws Exception {
|
sksamuel/camelwatch | camelwatch-api/src/main/java/org/camelwatch/api/endpoint/EndpointOperations.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/Message.java
// public class Message {
//
// private String exchangeId;
//
// private final Map<String, String> headers = Maps.newHashMap();
//
// private String body;
//
// private String bodyType;
//
// public String getBody() {
// return body;
// }
//
// public String getBodyType() {
// return bodyType;
// }
//
// public String getExchangeId() {
// return exchangeId;
// }
//
// public Map<String, String> getHeaders() {
// return headers;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
//
// public void setBodyType(String bodyType) {
// this.bodyType = bodyType;
// }
//
// public void setExchangeId(String exchangeId) {
// this.exchangeId = exchangeId;
// }
// }
| import java.util.List;
import org.camelwatch.api.Message;
| package org.camelwatch.api.endpoint;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 16:50:27
*
*/
public interface EndpointOperations {
String browseExchange(int offset) throws Exception;
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/Message.java
// public class Message {
//
// private String exchangeId;
//
// private final Map<String, String> headers = Maps.newHashMap();
//
// private String body;
//
// private String bodyType;
//
// public String getBody() {
// return body;
// }
//
// public String getBodyType() {
// return bodyType;
// }
//
// public String getExchangeId() {
// return exchangeId;
// }
//
// public Map<String, String> getHeaders() {
// return headers;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
//
// public void setBodyType(String bodyType) {
// this.bodyType = bodyType;
// }
//
// public void setExchangeId(String exchangeId) {
// this.exchangeId = exchangeId;
// }
// }
// Path: camelwatch-api/src/main/java/org/camelwatch/api/endpoint/EndpointOperations.java
import java.util.List;
import org.camelwatch.api.Message;
package org.camelwatch.api.endpoint;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 16:50:27
*
*/
public interface EndpointOperations {
String browseExchange(int offset) throws Exception;
| Message browseMessageAsXml(int offset, boolean includeBody) throws Exception;
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/web/ConsumerController.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/consumer/ConsumerOperations.java
// public interface ConsumerOperations {
//
// void setInitialDelay(long initialDelay);
//
// Object start() throws Exception;
//
// Object stop() throws Exception;
//
// Object resume() throws Exception;
//
// Object suspend() throws Exception;
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.consumer.ConsumerOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
| package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("consumer/{consumerName}")
public class ConsumerController {
@Autowired
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/consumer/ConsumerOperations.java
// public interface ConsumerOperations {
//
// void setInitialDelay(long initialDelay);
//
// Object start() throws Exception;
//
// Object stop() throws Exception;
//
// Object resume() throws Exception;
//
// Object suspend() throws Exception;
// }
// Path: camelwatch-web/src/main/java/camelwatch/web/ConsumerController.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.consumer.ConsumerOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("consumer/{consumerName}")
public class ConsumerController {
@Autowired
| private CamelConnectionFactory connectionFactory;
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/web/ConsumerController.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/consumer/ConsumerOperations.java
// public interface ConsumerOperations {
//
// void setInitialDelay(long initialDelay);
//
// Object start() throws Exception;
//
// Object stop() throws Exception;
//
// Object resume() throws Exception;
//
// Object suspend() throws Exception;
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.consumer.ConsumerOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
| package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("consumer/{consumerName}")
public class ConsumerController {
@Autowired
private CamelConnectionFactory connectionFactory;
String getRedirect(String consumerName) {
return "redirect:/";
}
@RequestMapping
public String show(@PathVariable("consumerName") String consumerName,
ModelMap map,
@RequestParam(value = "message", required = false) String message) throws Exception {
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/consumer/ConsumerOperations.java
// public interface ConsumerOperations {
//
// void setInitialDelay(long initialDelay);
//
// Object start() throws Exception;
//
// Object stop() throws Exception;
//
// Object resume() throws Exception;
//
// Object suspend() throws Exception;
// }
// Path: camelwatch-web/src/main/java/camelwatch/web/ConsumerController.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.consumer.ConsumerOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("consumer/{consumerName}")
public class ConsumerController {
@Autowired
private CamelConnectionFactory connectionFactory;
String getRedirect(String consumerName) {
return "redirect:/";
}
@RequestMapping
public String show(@PathVariable("consumerName") String consumerName,
ModelMap map,
@RequestParam(value = "message", required = false) String message) throws Exception {
| CamelConnection conn = connectionFactory.getConnection();
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/web/ConsumerController.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/consumer/ConsumerOperations.java
// public interface ConsumerOperations {
//
// void setInitialDelay(long initialDelay);
//
// Object start() throws Exception;
//
// Object stop() throws Exception;
//
// Object resume() throws Exception;
//
// Object suspend() throws Exception;
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.consumer.ConsumerOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
| package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("consumer/{consumerName}")
public class ConsumerController {
@Autowired
private CamelConnectionFactory connectionFactory;
String getRedirect(String consumerName) {
return "redirect:/";
}
@RequestMapping
public String show(@PathVariable("consumerName") String consumerName,
ModelMap map,
@RequestParam(value = "message", required = false) String message) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/consumer/ConsumerOperations.java
// public interface ConsumerOperations {
//
// void setInitialDelay(long initialDelay);
//
// Object start() throws Exception;
//
// Object stop() throws Exception;
//
// Object resume() throws Exception;
//
// Object suspend() throws Exception;
// }
// Path: camelwatch-web/src/main/java/camelwatch/web/ConsumerController.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.consumer.ConsumerOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("consumer/{consumerName}")
public class ConsumerController {
@Autowired
private CamelConnectionFactory connectionFactory;
String getRedirect(String consumerName) {
return "redirect:/";
}
@RequestMapping
public String show(@PathVariable("consumerName") String consumerName,
ModelMap map,
@RequestParam(value = "message", required = false) String message) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
| CamelBean consumer = conn.getConsumer(consumerName);
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/web/ConsumerController.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/consumer/ConsumerOperations.java
// public interface ConsumerOperations {
//
// void setInitialDelay(long initialDelay);
//
// Object start() throws Exception;
//
// Object stop() throws Exception;
//
// Object resume() throws Exception;
//
// Object suspend() throws Exception;
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.consumer.ConsumerOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
| package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("consumer/{consumerName}")
public class ConsumerController {
@Autowired
private CamelConnectionFactory connectionFactory;
String getRedirect(String consumerName) {
return "redirect:/";
}
@RequestMapping
public String show(@PathVariable("consumerName") String consumerName,
ModelMap map,
@RequestParam(value = "message", required = false) String message) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
CamelBean consumer = conn.getConsumer(consumerName);
map.put("consumer", consumer);
map.put("message", message);
return "consumer";
}
@RequestMapping("suspend")
public String suspend(@PathVariable("consumerName") String consumerName, ModelMap map) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/consumer/ConsumerOperations.java
// public interface ConsumerOperations {
//
// void setInitialDelay(long initialDelay);
//
// Object start() throws Exception;
//
// Object stop() throws Exception;
//
// Object resume() throws Exception;
//
// Object suspend() throws Exception;
// }
// Path: camelwatch-web/src/main/java/camelwatch/web/ConsumerController.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.consumer.ConsumerOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("consumer/{consumerName}")
public class ConsumerController {
@Autowired
private CamelConnectionFactory connectionFactory;
String getRedirect(String consumerName) {
return "redirect:/";
}
@RequestMapping
public String show(@PathVariable("consumerName") String consumerName,
ModelMap map,
@RequestParam(value = "message", required = false) String message) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
CamelBean consumer = conn.getConsumer(consumerName);
map.put("consumer", consumer);
map.put("message", message);
return "consumer";
}
@RequestMapping("suspend")
public String suspend(@PathVariable("consumerName") String consumerName, ModelMap map) throws Exception {
CamelConnection conn = connectionFactory.getConnection();
| ConsumerOperations ops = conn.getConsumerOperations(consumerName);
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/web/EndpointController.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/Message.java
// public class Message {
//
// private String exchangeId;
//
// private final Map<String, String> headers = Maps.newHashMap();
//
// private String body;
//
// private String bodyType;
//
// public String getBody() {
// return body;
// }
//
// public String getBodyType() {
// return bodyType;
// }
//
// public String getExchangeId() {
// return exchangeId;
// }
//
// public Map<String, String> getHeaders() {
// return headers;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
//
// public void setBodyType(String bodyType) {
// this.bodyType = bodyType;
// }
//
// public void setExchangeId(String exchangeId) {
// this.exchangeId = exchangeId;
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/endpoint/EndpointOperations.java
// public interface EndpointOperations {
//
// String browseExchange(int offset) throws Exception;
//
// Message browseMessageAsXml(int offset, boolean includeBody) throws Exception;
//
// String browseMessageBody(int offset) throws Exception;
//
// List<Message> browseRangeMessagesAsXml(int offset, int end, boolean includeBody) throws Exception;
//
// long queueSize() throws Exception;
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.Message;
import org.camelwatch.api.endpoint.EndpointOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
| package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("endpoint")
public class EndpointController {
private static final int MAX_OVERVIEW_MESSAGES = 15;
@Autowired
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/Message.java
// public class Message {
//
// private String exchangeId;
//
// private final Map<String, String> headers = Maps.newHashMap();
//
// private String body;
//
// private String bodyType;
//
// public String getBody() {
// return body;
// }
//
// public String getBodyType() {
// return bodyType;
// }
//
// public String getExchangeId() {
// return exchangeId;
// }
//
// public Map<String, String> getHeaders() {
// return headers;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
//
// public void setBodyType(String bodyType) {
// this.bodyType = bodyType;
// }
//
// public void setExchangeId(String exchangeId) {
// this.exchangeId = exchangeId;
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/endpoint/EndpointOperations.java
// public interface EndpointOperations {
//
// String browseExchange(int offset) throws Exception;
//
// Message browseMessageAsXml(int offset, boolean includeBody) throws Exception;
//
// String browseMessageBody(int offset) throws Exception;
//
// List<Message> browseRangeMessagesAsXml(int offset, int end, boolean includeBody) throws Exception;
//
// long queueSize() throws Exception;
// }
// Path: camelwatch-web/src/main/java/camelwatch/web/EndpointController.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.Message;
import org.camelwatch.api.endpoint.EndpointOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("endpoint")
public class EndpointController {
private static final int MAX_OVERVIEW_MESSAGES = 15;
@Autowired
| private CamelConnectionFactory connectionFactory;
|
sksamuel/camelwatch | camelwatch-web/src/main/java/camelwatch/web/EndpointController.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/Message.java
// public class Message {
//
// private String exchangeId;
//
// private final Map<String, String> headers = Maps.newHashMap();
//
// private String body;
//
// private String bodyType;
//
// public String getBody() {
// return body;
// }
//
// public String getBodyType() {
// return bodyType;
// }
//
// public String getExchangeId() {
// return exchangeId;
// }
//
// public Map<String, String> getHeaders() {
// return headers;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
//
// public void setBodyType(String bodyType) {
// this.bodyType = bodyType;
// }
//
// public void setExchangeId(String exchangeId) {
// this.exchangeId = exchangeId;
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/endpoint/EndpointOperations.java
// public interface EndpointOperations {
//
// String browseExchange(int offset) throws Exception;
//
// Message browseMessageAsXml(int offset, boolean includeBody) throws Exception;
//
// String browseMessageBody(int offset) throws Exception;
//
// List<Message> browseRangeMessagesAsXml(int offset, int end, boolean includeBody) throws Exception;
//
// long queueSize() throws Exception;
// }
| import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.Message;
import org.camelwatch.api.endpoint.EndpointOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
| package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("endpoint")
public class EndpointController {
private static final int MAX_OVERVIEW_MESSAGES = 15;
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping("browseExchange")
@ResponseBody
public String
browseExchange(@RequestParam("endpointName") String endpointName, @RequestParam("offset") int offset)
throws Exception {
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelBean.java
// public class CamelBean {
//
// private final Map<String, Object> properties = Maps.newTreeMap();
//
// private String name;
//
// private String description;
//
// public String getDescription() {
// return description;
// }
//
// public String getName() {
// return name;
// }
//
// public Map<String, Object> getProperties() {
// return properties;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
// public interface CamelConnection {
//
// CamelBean getComponent(String componentName) throws Exception;
//
// List<CamelBean> getComponents() throws Exception;
//
// CamelBean getConsumer(String consumerId) throws Exception;
//
// ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
//
// List<CamelBean> getConsumers() throws Exception;
//
// CamelBean getContext(String camelId) throws Exception;
//
// List<CamelBean> getContexts() throws Exception;
//
// CamelBean getEndpoint(String endpointName) throws Exception;
//
// EndpointOperations getEndpointOperations(String endpointName) throws Exception;
//
// List<CamelBean> getEndpoints() throws Exception;
//
// CamelBean getErrorHandler(String errorHandlerName) throws Exception;
//
// List<CamelBean> getErrorHandlers() throws Exception;
//
// CamelBean getProcessor(String processorId) throws Exception;
//
// List<CamelBean> getProcessors() throws Exception;
//
// Collection<CamelBean> getProcessors(String routeId) throws Exception;
//
// CamelBean getRoute(String routeId) throws Exception;
//
// RouteOperations getRouteOperations(String routeId) throws Exception;
//
// List<CamelBean> getRoutes() throws Exception;
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnectionFactory.java
// @Service
// public class CamelConnectionFactory {
//
// @Value("${jmx.endpoint.url}")
// private String url;
//
// @Value("${jmx.endpoint.username}")
// private String username;
//
// @Value("${jmx.endpoint.password}")
// private String password;
//
// private final Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap();
//
// public CamelConnection getConnection() throws MalformedObjectNameException, NullPointerException, IOException {
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
//
// public CamelConnection getConnection(String url, String username, String password) throws MalformedObjectNameException, NullPointerException, IOException {
// Map<ObjectName, MBeanInfo> beanInfoCache = Maps.newHashMap() ;
// return new CamelJmxConnection(url, username, password, beanInfoCache);
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/Message.java
// public class Message {
//
// private String exchangeId;
//
// private final Map<String, String> headers = Maps.newHashMap();
//
// private String body;
//
// private String bodyType;
//
// public String getBody() {
// return body;
// }
//
// public String getBodyType() {
// return bodyType;
// }
//
// public String getExchangeId() {
// return exchangeId;
// }
//
// public Map<String, String> getHeaders() {
// return headers;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
//
// public void setBodyType(String bodyType) {
// this.bodyType = bodyType;
// }
//
// public void setExchangeId(String exchangeId) {
// this.exchangeId = exchangeId;
// }
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/endpoint/EndpointOperations.java
// public interface EndpointOperations {
//
// String browseExchange(int offset) throws Exception;
//
// Message browseMessageAsXml(int offset, boolean includeBody) throws Exception;
//
// String browseMessageBody(int offset) throws Exception;
//
// List<Message> browseRangeMessagesAsXml(int offset, int end, boolean includeBody) throws Exception;
//
// long queueSize() throws Exception;
// }
// Path: camelwatch-web/src/main/java/camelwatch/web/EndpointController.java
import org.camelwatch.api.CamelBean;
import org.camelwatch.api.CamelConnection;
import org.camelwatch.api.CamelConnectionFactory;
import org.camelwatch.api.Message;
import org.camelwatch.api.endpoint.EndpointOperations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import java.util.List;
package camelwatch.web;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 19:02:59
*/
@Controller
@RequestMapping("endpoint")
public class EndpointController {
private static final int MAX_OVERVIEW_MESSAGES = 15;
@Autowired
private CamelConnectionFactory connectionFactory;
@RequestMapping("browseExchange")
@ResponseBody
public String
browseExchange(@RequestParam("endpointName") String endpointName, @RequestParam("offset") int offset)
throws Exception {
| CamelConnection conn = connectionFactory.getConnection();
|
sksamuel/camelwatch | camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/consumer/ConsumerOperations.java
// public interface ConsumerOperations {
//
// void setInitialDelay(long initialDelay);
//
// Object start() throws Exception;
//
// Object stop() throws Exception;
//
// Object resume() throws Exception;
//
// Object suspend() throws Exception;
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/endpoint/EndpointOperations.java
// public interface EndpointOperations {
//
// String browseExchange(int offset) throws Exception;
//
// Message browseMessageAsXml(int offset, boolean includeBody) throws Exception;
//
// String browseMessageBody(int offset) throws Exception;
//
// List<Message> browseRangeMessagesAsXml(int offset, int end, boolean includeBody) throws Exception;
//
// long queueSize() throws Exception;
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/route/RouteOperations.java
// public interface RouteOperations {
//
// String dumpRouteAsXml() throws Exception;
//
// void remove();
//
// void reset();
//
// void resume() throws Exception;
//
// void setStatisticsEnabled(boolean enabled);
//
// void start() throws Exception;
//
// void stop() throws Exception;
//
// void suspend() throws Exception;
//
// void updateRouteFromXml(String xml) throws Exception;
//
// void setTracing(boolean enable) throws Exception;
// }
| import org.camelwatch.api.consumer.ConsumerOperations;
import org.camelwatch.api.endpoint.EndpointOperations;
import org.camelwatch.api.route.RouteOperations;
import java.util.Collection;
import java.util.List;
| package org.camelwatch.api;
/**
* @author Stephen K Samuel samspade79@gmail.com 29 Jun 2012 00:49:49
*
*/
public interface CamelConnection {
CamelBean getComponent(String componentName) throws Exception;
List<CamelBean> getComponents() throws Exception;
CamelBean getConsumer(String consumerId) throws Exception;
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/consumer/ConsumerOperations.java
// public interface ConsumerOperations {
//
// void setInitialDelay(long initialDelay);
//
// Object start() throws Exception;
//
// Object stop() throws Exception;
//
// Object resume() throws Exception;
//
// Object suspend() throws Exception;
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/endpoint/EndpointOperations.java
// public interface EndpointOperations {
//
// String browseExchange(int offset) throws Exception;
//
// Message browseMessageAsXml(int offset, boolean includeBody) throws Exception;
//
// String browseMessageBody(int offset) throws Exception;
//
// List<Message> browseRangeMessagesAsXml(int offset, int end, boolean includeBody) throws Exception;
//
// long queueSize() throws Exception;
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/route/RouteOperations.java
// public interface RouteOperations {
//
// String dumpRouteAsXml() throws Exception;
//
// void remove();
//
// void reset();
//
// void resume() throws Exception;
//
// void setStatisticsEnabled(boolean enabled);
//
// void start() throws Exception;
//
// void stop() throws Exception;
//
// void suspend() throws Exception;
//
// void updateRouteFromXml(String xml) throws Exception;
//
// void setTracing(boolean enable) throws Exception;
// }
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
import org.camelwatch.api.consumer.ConsumerOperations;
import org.camelwatch.api.endpoint.EndpointOperations;
import org.camelwatch.api.route.RouteOperations;
import java.util.Collection;
import java.util.List;
package org.camelwatch.api;
/**
* @author Stephen K Samuel samspade79@gmail.com 29 Jun 2012 00:49:49
*
*/
public interface CamelConnection {
CamelBean getComponent(String componentName) throws Exception;
List<CamelBean> getComponents() throws Exception;
CamelBean getConsumer(String consumerId) throws Exception;
| ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
|
sksamuel/camelwatch | camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/consumer/ConsumerOperations.java
// public interface ConsumerOperations {
//
// void setInitialDelay(long initialDelay);
//
// Object start() throws Exception;
//
// Object stop() throws Exception;
//
// Object resume() throws Exception;
//
// Object suspend() throws Exception;
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/endpoint/EndpointOperations.java
// public interface EndpointOperations {
//
// String browseExchange(int offset) throws Exception;
//
// Message browseMessageAsXml(int offset, boolean includeBody) throws Exception;
//
// String browseMessageBody(int offset) throws Exception;
//
// List<Message> browseRangeMessagesAsXml(int offset, int end, boolean includeBody) throws Exception;
//
// long queueSize() throws Exception;
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/route/RouteOperations.java
// public interface RouteOperations {
//
// String dumpRouteAsXml() throws Exception;
//
// void remove();
//
// void reset();
//
// void resume() throws Exception;
//
// void setStatisticsEnabled(boolean enabled);
//
// void start() throws Exception;
//
// void stop() throws Exception;
//
// void suspend() throws Exception;
//
// void updateRouteFromXml(String xml) throws Exception;
//
// void setTracing(boolean enable) throws Exception;
// }
| import org.camelwatch.api.consumer.ConsumerOperations;
import org.camelwatch.api.endpoint.EndpointOperations;
import org.camelwatch.api.route.RouteOperations;
import java.util.Collection;
import java.util.List;
| package org.camelwatch.api;
/**
* @author Stephen K Samuel samspade79@gmail.com 29 Jun 2012 00:49:49
*
*/
public interface CamelConnection {
CamelBean getComponent(String componentName) throws Exception;
List<CamelBean> getComponents() throws Exception;
CamelBean getConsumer(String consumerId) throws Exception;
ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
List<CamelBean> getConsumers() throws Exception;
CamelBean getContext(String camelId) throws Exception;
List<CamelBean> getContexts() throws Exception;
CamelBean getEndpoint(String endpointName) throws Exception;
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/consumer/ConsumerOperations.java
// public interface ConsumerOperations {
//
// void setInitialDelay(long initialDelay);
//
// Object start() throws Exception;
//
// Object stop() throws Exception;
//
// Object resume() throws Exception;
//
// Object suspend() throws Exception;
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/endpoint/EndpointOperations.java
// public interface EndpointOperations {
//
// String browseExchange(int offset) throws Exception;
//
// Message browseMessageAsXml(int offset, boolean includeBody) throws Exception;
//
// String browseMessageBody(int offset) throws Exception;
//
// List<Message> browseRangeMessagesAsXml(int offset, int end, boolean includeBody) throws Exception;
//
// long queueSize() throws Exception;
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/route/RouteOperations.java
// public interface RouteOperations {
//
// String dumpRouteAsXml() throws Exception;
//
// void remove();
//
// void reset();
//
// void resume() throws Exception;
//
// void setStatisticsEnabled(boolean enabled);
//
// void start() throws Exception;
//
// void stop() throws Exception;
//
// void suspend() throws Exception;
//
// void updateRouteFromXml(String xml) throws Exception;
//
// void setTracing(boolean enable) throws Exception;
// }
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
import org.camelwatch.api.consumer.ConsumerOperations;
import org.camelwatch.api.endpoint.EndpointOperations;
import org.camelwatch.api.route.RouteOperations;
import java.util.Collection;
import java.util.List;
package org.camelwatch.api;
/**
* @author Stephen K Samuel samspade79@gmail.com 29 Jun 2012 00:49:49
*
*/
public interface CamelConnection {
CamelBean getComponent(String componentName) throws Exception;
List<CamelBean> getComponents() throws Exception;
CamelBean getConsumer(String consumerId) throws Exception;
ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
List<CamelBean> getConsumers() throws Exception;
CamelBean getContext(String camelId) throws Exception;
List<CamelBean> getContexts() throws Exception;
CamelBean getEndpoint(String endpointName) throws Exception;
| EndpointOperations getEndpointOperations(String endpointName) throws Exception;
|
sksamuel/camelwatch | camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/consumer/ConsumerOperations.java
// public interface ConsumerOperations {
//
// void setInitialDelay(long initialDelay);
//
// Object start() throws Exception;
//
// Object stop() throws Exception;
//
// Object resume() throws Exception;
//
// Object suspend() throws Exception;
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/endpoint/EndpointOperations.java
// public interface EndpointOperations {
//
// String browseExchange(int offset) throws Exception;
//
// Message browseMessageAsXml(int offset, boolean includeBody) throws Exception;
//
// String browseMessageBody(int offset) throws Exception;
//
// List<Message> browseRangeMessagesAsXml(int offset, int end, boolean includeBody) throws Exception;
//
// long queueSize() throws Exception;
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/route/RouteOperations.java
// public interface RouteOperations {
//
// String dumpRouteAsXml() throws Exception;
//
// void remove();
//
// void reset();
//
// void resume() throws Exception;
//
// void setStatisticsEnabled(boolean enabled);
//
// void start() throws Exception;
//
// void stop() throws Exception;
//
// void suspend() throws Exception;
//
// void updateRouteFromXml(String xml) throws Exception;
//
// void setTracing(boolean enable) throws Exception;
// }
| import org.camelwatch.api.consumer.ConsumerOperations;
import org.camelwatch.api.endpoint.EndpointOperations;
import org.camelwatch.api.route.RouteOperations;
import java.util.Collection;
import java.util.List;
| package org.camelwatch.api;
/**
* @author Stephen K Samuel samspade79@gmail.com 29 Jun 2012 00:49:49
*
*/
public interface CamelConnection {
CamelBean getComponent(String componentName) throws Exception;
List<CamelBean> getComponents() throws Exception;
CamelBean getConsumer(String consumerId) throws Exception;
ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
List<CamelBean> getConsumers() throws Exception;
CamelBean getContext(String camelId) throws Exception;
List<CamelBean> getContexts() throws Exception;
CamelBean getEndpoint(String endpointName) throws Exception;
EndpointOperations getEndpointOperations(String endpointName) throws Exception;
List<CamelBean> getEndpoints() throws Exception;
CamelBean getErrorHandler(String errorHandlerName) throws Exception;
List<CamelBean> getErrorHandlers() throws Exception;
CamelBean getProcessor(String processorId) throws Exception;
List<CamelBean> getProcessors() throws Exception;
Collection<CamelBean> getProcessors(String routeId) throws Exception;
CamelBean getRoute(String routeId) throws Exception;
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/consumer/ConsumerOperations.java
// public interface ConsumerOperations {
//
// void setInitialDelay(long initialDelay);
//
// Object start() throws Exception;
//
// Object stop() throws Exception;
//
// Object resume() throws Exception;
//
// Object suspend() throws Exception;
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/endpoint/EndpointOperations.java
// public interface EndpointOperations {
//
// String browseExchange(int offset) throws Exception;
//
// Message browseMessageAsXml(int offset, boolean includeBody) throws Exception;
//
// String browseMessageBody(int offset) throws Exception;
//
// List<Message> browseRangeMessagesAsXml(int offset, int end, boolean includeBody) throws Exception;
//
// long queueSize() throws Exception;
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/route/RouteOperations.java
// public interface RouteOperations {
//
// String dumpRouteAsXml() throws Exception;
//
// void remove();
//
// void reset();
//
// void resume() throws Exception;
//
// void setStatisticsEnabled(boolean enabled);
//
// void start() throws Exception;
//
// void stop() throws Exception;
//
// void suspend() throws Exception;
//
// void updateRouteFromXml(String xml) throws Exception;
//
// void setTracing(boolean enable) throws Exception;
// }
// Path: camelwatch-api/src/main/java/org/camelwatch/api/CamelConnection.java
import org.camelwatch.api.consumer.ConsumerOperations;
import org.camelwatch.api.endpoint.EndpointOperations;
import org.camelwatch.api.route.RouteOperations;
import java.util.Collection;
import java.util.List;
package org.camelwatch.api;
/**
* @author Stephen K Samuel samspade79@gmail.com 29 Jun 2012 00:49:49
*
*/
public interface CamelConnection {
CamelBean getComponent(String componentName) throws Exception;
List<CamelBean> getComponents() throws Exception;
CamelBean getConsumer(String consumerId) throws Exception;
ConsumerOperations getConsumerOperations(String consumerId) throws Exception;
List<CamelBean> getConsumers() throws Exception;
CamelBean getContext(String camelId) throws Exception;
List<CamelBean> getContexts() throws Exception;
CamelBean getEndpoint(String endpointName) throws Exception;
EndpointOperations getEndpointOperations(String endpointName) throws Exception;
List<CamelBean> getEndpoints() throws Exception;
CamelBean getErrorHandler(String errorHandlerName) throws Exception;
List<CamelBean> getErrorHandlers() throws Exception;
CamelBean getProcessor(String processorId) throws Exception;
List<CamelBean> getProcessors() throws Exception;
Collection<CamelBean> getProcessors(String routeId) throws Exception;
CamelBean getRoute(String routeId) throws Exception;
| RouteOperations getRouteOperations(String routeId) throws Exception;
|
sksamuel/camelwatch | camelwatch-api/src/main/java/org/camelwatch/api/endpoint/EndpointOperationsJmxImpl.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/MessageFactory.java
// public class MessageFactory {
//
// public Message build(Element e) {
// Message m = new Message();
// m.setExchangeId(e.getAttributeValue("exchangeId"));
// Element headers = e.getChild("headers");
// if (headers != null) {
// for (Element header : headers.getChildren("header")) {
// m.getHeaders().put(header.getAttributeValue("key"), header.getTextTrim());
// }
// }
// Element body = e.getChild("body");
// if (body != null) {
// m.setBody(body.getTextTrim());
// m.setBodyType(body.getAttributeValue("type"));
// }
// return m;
// }
//
// public List<Message> buildList(Document doc) {
// List<Message> results = Lists.newArrayList();
// for (Element messageElement : doc.getRootElement().getChildren("message")) {
// results.add(build(messageElement));
// }
// return results;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/Message.java
// public class Message {
//
// private String exchangeId;
//
// private final Map<String, String> headers = Maps.newHashMap();
//
// private String body;
//
// private String bodyType;
//
// public String getBody() {
// return body;
// }
//
// public String getBodyType() {
// return bodyType;
// }
//
// public String getExchangeId() {
// return exchangeId;
// }
//
// public Map<String, String> getHeaders() {
// return headers;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
//
// public void setBodyType(String bodyType) {
// this.bodyType = bodyType;
// }
//
// public void setExchangeId(String exchangeId) {
// this.exchangeId = exchangeId;
// }
// }
| import java.io.StringReader;
import java.util.Collections;
import java.util.List;
import javax.management.MBeanInfo;
import javax.management.MBeanServerConnection;
import javax.management.ObjectInstance;
import org.camelwatch.api.MessageFactory;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.input.SAXBuilder;
import org.camelwatch.api.Message;
| package org.camelwatch.api.endpoint;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 21:19:17
*
*/
public class EndpointOperationsJmxImpl implements EndpointOperations {
private final MBeanServerConnection conn;
private final ObjectInstance instance;
private final MBeanInfo info;
public EndpointOperationsJmxImpl(MBeanServerConnection conn, ObjectInstance instance, String consumerId,
MBeanInfo info) {
this.conn = conn;
this.instance = instance;
this.info = info;
}
@Override
public String browseExchange(int offset) throws Exception {
Object result = conn.invoke(instance.getObjectName(),
"browseExchange",
new Object[] { offset },
new String[] { "java.lang.Integer" });
return (String) result;
}
@Override
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/MessageFactory.java
// public class MessageFactory {
//
// public Message build(Element e) {
// Message m = new Message();
// m.setExchangeId(e.getAttributeValue("exchangeId"));
// Element headers = e.getChild("headers");
// if (headers != null) {
// for (Element header : headers.getChildren("header")) {
// m.getHeaders().put(header.getAttributeValue("key"), header.getTextTrim());
// }
// }
// Element body = e.getChild("body");
// if (body != null) {
// m.setBody(body.getTextTrim());
// m.setBodyType(body.getAttributeValue("type"));
// }
// return m;
// }
//
// public List<Message> buildList(Document doc) {
// List<Message> results = Lists.newArrayList();
// for (Element messageElement : doc.getRootElement().getChildren("message")) {
// results.add(build(messageElement));
// }
// return results;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/Message.java
// public class Message {
//
// private String exchangeId;
//
// private final Map<String, String> headers = Maps.newHashMap();
//
// private String body;
//
// private String bodyType;
//
// public String getBody() {
// return body;
// }
//
// public String getBodyType() {
// return bodyType;
// }
//
// public String getExchangeId() {
// return exchangeId;
// }
//
// public Map<String, String> getHeaders() {
// return headers;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
//
// public void setBodyType(String bodyType) {
// this.bodyType = bodyType;
// }
//
// public void setExchangeId(String exchangeId) {
// this.exchangeId = exchangeId;
// }
// }
// Path: camelwatch-api/src/main/java/org/camelwatch/api/endpoint/EndpointOperationsJmxImpl.java
import java.io.StringReader;
import java.util.Collections;
import java.util.List;
import javax.management.MBeanInfo;
import javax.management.MBeanServerConnection;
import javax.management.ObjectInstance;
import org.camelwatch.api.MessageFactory;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.input.SAXBuilder;
import org.camelwatch.api.Message;
package org.camelwatch.api.endpoint;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 21:19:17
*
*/
public class EndpointOperationsJmxImpl implements EndpointOperations {
private final MBeanServerConnection conn;
private final ObjectInstance instance;
private final MBeanInfo info;
public EndpointOperationsJmxImpl(MBeanServerConnection conn, ObjectInstance instance, String consumerId,
MBeanInfo info) {
this.conn = conn;
this.instance = instance;
this.info = info;
}
@Override
public String browseExchange(int offset) throws Exception {
Object result = conn.invoke(instance.getObjectName(),
"browseExchange",
new Object[] { offset },
new String[] { "java.lang.Integer" });
return (String) result;
}
@Override
| public Message browseMessageAsXml(int offset, boolean includeBody) throws Exception {
|
sksamuel/camelwatch | camelwatch-api/src/main/java/org/camelwatch/api/endpoint/EndpointOperationsJmxImpl.java | // Path: camelwatch-api/src/main/java/org/camelwatch/api/MessageFactory.java
// public class MessageFactory {
//
// public Message build(Element e) {
// Message m = new Message();
// m.setExchangeId(e.getAttributeValue("exchangeId"));
// Element headers = e.getChild("headers");
// if (headers != null) {
// for (Element header : headers.getChildren("header")) {
// m.getHeaders().put(header.getAttributeValue("key"), header.getTextTrim());
// }
// }
// Element body = e.getChild("body");
// if (body != null) {
// m.setBody(body.getTextTrim());
// m.setBodyType(body.getAttributeValue("type"));
// }
// return m;
// }
//
// public List<Message> buildList(Document doc) {
// List<Message> results = Lists.newArrayList();
// for (Element messageElement : doc.getRootElement().getChildren("message")) {
// results.add(build(messageElement));
// }
// return results;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/Message.java
// public class Message {
//
// private String exchangeId;
//
// private final Map<String, String> headers = Maps.newHashMap();
//
// private String body;
//
// private String bodyType;
//
// public String getBody() {
// return body;
// }
//
// public String getBodyType() {
// return bodyType;
// }
//
// public String getExchangeId() {
// return exchangeId;
// }
//
// public Map<String, String> getHeaders() {
// return headers;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
//
// public void setBodyType(String bodyType) {
// this.bodyType = bodyType;
// }
//
// public void setExchangeId(String exchangeId) {
// this.exchangeId = exchangeId;
// }
// }
| import java.io.StringReader;
import java.util.Collections;
import java.util.List;
import javax.management.MBeanInfo;
import javax.management.MBeanServerConnection;
import javax.management.ObjectInstance;
import org.camelwatch.api.MessageFactory;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.input.SAXBuilder;
import org.camelwatch.api.Message;
| package org.camelwatch.api.endpoint;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 21:19:17
*
*/
public class EndpointOperationsJmxImpl implements EndpointOperations {
private final MBeanServerConnection conn;
private final ObjectInstance instance;
private final MBeanInfo info;
public EndpointOperationsJmxImpl(MBeanServerConnection conn, ObjectInstance instance, String consumerId,
MBeanInfo info) {
this.conn = conn;
this.instance = instance;
this.info = info;
}
@Override
public String browseExchange(int offset) throws Exception {
Object result = conn.invoke(instance.getObjectName(),
"browseExchange",
new Object[] { offset },
new String[] { "java.lang.Integer" });
return (String) result;
}
@Override
public Message browseMessageAsXml(int offset, boolean includeBody) throws Exception {
String result = (String) conn.invoke(instance.getObjectName(),
"browseMessageAsXml",
new Object[] { offset },
new String[] { "java.lang.Integer" });
if (result == null)
return null;
Document doc = new SAXBuilder().build(new StringReader(result));
Element root = doc.getRootElement();
| // Path: camelwatch-api/src/main/java/org/camelwatch/api/MessageFactory.java
// public class MessageFactory {
//
// public Message build(Element e) {
// Message m = new Message();
// m.setExchangeId(e.getAttributeValue("exchangeId"));
// Element headers = e.getChild("headers");
// if (headers != null) {
// for (Element header : headers.getChildren("header")) {
// m.getHeaders().put(header.getAttributeValue("key"), header.getTextTrim());
// }
// }
// Element body = e.getChild("body");
// if (body != null) {
// m.setBody(body.getTextTrim());
// m.setBodyType(body.getAttributeValue("type"));
// }
// return m;
// }
//
// public List<Message> buildList(Document doc) {
// List<Message> results = Lists.newArrayList();
// for (Element messageElement : doc.getRootElement().getChildren("message")) {
// results.add(build(messageElement));
// }
// return results;
// }
//
// }
//
// Path: camelwatch-api/src/main/java/org/camelwatch/api/Message.java
// public class Message {
//
// private String exchangeId;
//
// private final Map<String, String> headers = Maps.newHashMap();
//
// private String body;
//
// private String bodyType;
//
// public String getBody() {
// return body;
// }
//
// public String getBodyType() {
// return bodyType;
// }
//
// public String getExchangeId() {
// return exchangeId;
// }
//
// public Map<String, String> getHeaders() {
// return headers;
// }
//
// public void setBody(String body) {
// this.body = body;
// }
//
// public void setBodyType(String bodyType) {
// this.bodyType = bodyType;
// }
//
// public void setExchangeId(String exchangeId) {
// this.exchangeId = exchangeId;
// }
// }
// Path: camelwatch-api/src/main/java/org/camelwatch/api/endpoint/EndpointOperationsJmxImpl.java
import java.io.StringReader;
import java.util.Collections;
import java.util.List;
import javax.management.MBeanInfo;
import javax.management.MBeanServerConnection;
import javax.management.ObjectInstance;
import org.camelwatch.api.MessageFactory;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.input.SAXBuilder;
import org.camelwatch.api.Message;
package org.camelwatch.api.endpoint;
/**
* @author Stephen K Samuel samspade79@gmail.com 1 Jul 2012 21:19:17
*
*/
public class EndpointOperationsJmxImpl implements EndpointOperations {
private final MBeanServerConnection conn;
private final ObjectInstance instance;
private final MBeanInfo info;
public EndpointOperationsJmxImpl(MBeanServerConnection conn, ObjectInstance instance, String consumerId,
MBeanInfo info) {
this.conn = conn;
this.instance = instance;
this.info = info;
}
@Override
public String browseExchange(int offset) throws Exception {
Object result = conn.invoke(instance.getObjectName(),
"browseExchange",
new Object[] { offset },
new String[] { "java.lang.Integer" });
return (String) result;
}
@Override
public Message browseMessageAsXml(int offset, boolean includeBody) throws Exception {
String result = (String) conn.invoke(instance.getObjectName(),
"browseMessageAsXml",
new Object[] { offset },
new String[] { "java.lang.Integer" });
if (result == null)
return null;
Document doc = new SAXBuilder().build(new StringReader(result));
Element root = doc.getRootElement();
| return new MessageFactory().build(root);
|
jlinn/asana-api-java | src/main/java/net/joelinn/asana/tags/Tag.java | // Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
| import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName; | package net.joelinn.asana.tags;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
public class Tag {
public long id;
@JsonProperty("created_at")
public String createdAt;
| // Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
// Path: src/main/java/net/joelinn/asana/tags/Tag.java
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
package net.joelinn.asana.tags;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
public class Tag {
public long id;
@JsonProperty("created_at")
public String createdAt;
| public Users followers; |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/tags/Tag.java | // Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
| import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName; | package net.joelinn.asana.tags;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
public class Tag {
public long id;
@JsonProperty("created_at")
public String createdAt;
public Users followers;
public String name;
public String color;
public String notes; | // Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
// Path: src/main/java/net/joelinn/asana/tags/Tag.java
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
package net.joelinn.asana.tags;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
public class Tag {
public long id;
@JsonProperty("created_at")
public String createdAt;
public Users followers;
public String name;
public String color;
public String notes; | public Workspace workspace; |
jlinn/asana-api-java | src/test/java/net/joelinn/asana/test/projects/ProjectsClientTest.java | // Path: src/main/java/net/joelinn/asana/ApiException.java
// public class ApiException extends RuntimeException{
// protected ClientResponse.Status status;
// protected String message;
//
// public ApiException(ClientResponse.Status status, String message){
// super(message);
// this.status = status;
// this.message = message;
// }
//
// public ClientResponse.Status getStatus(){
// return status;
// }
//
// @Override
// public String toString() {
// String s = getClass().getName();
// String message = getLocalizedMessage();
// return String.format("%s: %s %s", s, status.getStatusCode(), message);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Project.java
// @JsonRootName("data")
// public class Project {
// public long id;
// public boolean archived;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public Users followers;
//
// @JsonProperty("modified_at")
// public String modifiedAt;
//
// public String name;
// public String color;
// public String notes;
// public Workspace workspace;
// public Team team;
// public Users members;
//
// @JsonProperty("public")
// public boolean isPublic;
// }
//
// Path: src/main/java/net/joelinn/asana/projects/ProjectRequestBuilder.java
// public class ProjectRequestBuilder {
// MultivaluedMapImpl params = new MultivaluedMapImpl();
//
// public ProjectRequestBuilder(){
//
// }
//
// public ProjectRequestBuilder(long workspaceId, String name){
// workspace(workspaceId).name(name);
// }
//
// public ProjectRequestBuilder name(String name){
// params.add("name", name);
// return this;
// }
//
// public ProjectRequestBuilder notes(String notes){
// params.add("notes", notes);
// return this;
// }
//
// public ProjectRequestBuilder workspace(long workspaceId){
// params.add("workspace", workspaceId);
// return this;
// }
//
// public ProjectRequestBuilder team(long teamId){
// params.add("team", teamId);
// return this;
// }
//
// public ProjectRequestBuilder archived(boolean archived){
// params.add("archived", archived);
// return this;
// }
//
// public ProjectRequestBuilder color(String color){
// params.add("color", color);
// return this;
// }
//
// public MultivaluedMapImpl build(){
// return params;
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/ProjectsClient.java
// public class ProjectsClient extends AbstractClient{
// public ProjectsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public ProjectsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// public Project createProject(ProjectRequestBuilder builder){
// return post("", builder.build()).getEntity(Project.class);
// }
//
// public Project updateProject(long projectId, ProjectRequestBuilder builder){
// return put(Long.toString(projectId), builder.build()).getEntity(Project.class);
// }
//
// public Project getProject(long projectId){
// return get(Long.toString(projectId)).getEntity(Project.class);
// }
//
// public void deleteProject(long projectId){
// delete(Long.toString(projectId));
// }
//
// public Tasks getExpandedTasks (long projectId) {
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("opt_expand", ".");
// return get(String.format("%s/tasks", projectId), params).getEntity(Tasks.class);
// }
//
// public Tasks getTasks(long projectId){
// return get(String.format("%s/tasks", projectId)).getEntity(Tasks.class);
// }
//
// public Projects getProjects(long workspaceId, boolean archived){
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("workspace", workspaceId);
// params.add("archvied", archived);
// return get("", params).getEntity(Projects.class);
// }
//
// @Override
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
// return super.request(method, "projects/" + url, queryParams, data);
// }
// }
//
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
| import com.sun.jersey.api.client.ClientResponse;
import junit.framework.TestCase;
import net.joelinn.asana.ApiException;
import net.joelinn.asana.projects.Project;
import net.joelinn.asana.projects.ProjectRequestBuilder;
import net.joelinn.asana.projects.ProjectsClient;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test; | package net.joelinn.asana.test.projects;
/**
* Joe Linn
* 11/20/13
*/
public class ProjectsClientTest extends BaseTest{
protected ProjectsClient client;
@Before
public void setUp(){
client = new ProjectsClient(getApiKey());
}
@Test
public void testProjects(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
} | // Path: src/main/java/net/joelinn/asana/ApiException.java
// public class ApiException extends RuntimeException{
// protected ClientResponse.Status status;
// protected String message;
//
// public ApiException(ClientResponse.Status status, String message){
// super(message);
// this.status = status;
// this.message = message;
// }
//
// public ClientResponse.Status getStatus(){
// return status;
// }
//
// @Override
// public String toString() {
// String s = getClass().getName();
// String message = getLocalizedMessage();
// return String.format("%s: %s %s", s, status.getStatusCode(), message);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Project.java
// @JsonRootName("data")
// public class Project {
// public long id;
// public boolean archived;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public Users followers;
//
// @JsonProperty("modified_at")
// public String modifiedAt;
//
// public String name;
// public String color;
// public String notes;
// public Workspace workspace;
// public Team team;
// public Users members;
//
// @JsonProperty("public")
// public boolean isPublic;
// }
//
// Path: src/main/java/net/joelinn/asana/projects/ProjectRequestBuilder.java
// public class ProjectRequestBuilder {
// MultivaluedMapImpl params = new MultivaluedMapImpl();
//
// public ProjectRequestBuilder(){
//
// }
//
// public ProjectRequestBuilder(long workspaceId, String name){
// workspace(workspaceId).name(name);
// }
//
// public ProjectRequestBuilder name(String name){
// params.add("name", name);
// return this;
// }
//
// public ProjectRequestBuilder notes(String notes){
// params.add("notes", notes);
// return this;
// }
//
// public ProjectRequestBuilder workspace(long workspaceId){
// params.add("workspace", workspaceId);
// return this;
// }
//
// public ProjectRequestBuilder team(long teamId){
// params.add("team", teamId);
// return this;
// }
//
// public ProjectRequestBuilder archived(boolean archived){
// params.add("archived", archived);
// return this;
// }
//
// public ProjectRequestBuilder color(String color){
// params.add("color", color);
// return this;
// }
//
// public MultivaluedMapImpl build(){
// return params;
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/ProjectsClient.java
// public class ProjectsClient extends AbstractClient{
// public ProjectsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public ProjectsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// public Project createProject(ProjectRequestBuilder builder){
// return post("", builder.build()).getEntity(Project.class);
// }
//
// public Project updateProject(long projectId, ProjectRequestBuilder builder){
// return put(Long.toString(projectId), builder.build()).getEntity(Project.class);
// }
//
// public Project getProject(long projectId){
// return get(Long.toString(projectId)).getEntity(Project.class);
// }
//
// public void deleteProject(long projectId){
// delete(Long.toString(projectId));
// }
//
// public Tasks getExpandedTasks (long projectId) {
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("opt_expand", ".");
// return get(String.format("%s/tasks", projectId), params).getEntity(Tasks.class);
// }
//
// public Tasks getTasks(long projectId){
// return get(String.format("%s/tasks", projectId)).getEntity(Tasks.class);
// }
//
// public Projects getProjects(long workspaceId, boolean archived){
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("workspace", workspaceId);
// params.add("archvied", archived);
// return get("", params).getEntity(Projects.class);
// }
//
// @Override
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
// return super.request(method, "projects/" + url, queryParams, data);
// }
// }
//
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
// Path: src/test/java/net/joelinn/asana/test/projects/ProjectsClientTest.java
import com.sun.jersey.api.client.ClientResponse;
import junit.framework.TestCase;
import net.joelinn.asana.ApiException;
import net.joelinn.asana.projects.Project;
import net.joelinn.asana.projects.ProjectRequestBuilder;
import net.joelinn.asana.projects.ProjectsClient;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test;
package net.joelinn.asana.test.projects;
/**
* Joe Linn
* 11/20/13
*/
public class ProjectsClientTest extends BaseTest{
protected ProjectsClient client;
@Before
public void setUp(){
client = new ProjectsClient(getApiKey());
}
@Test
public void testProjects(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
} | Project project = client.createProject(new ProjectRequestBuilder(4440299545542L, "test project") |
jlinn/asana-api-java | src/test/java/net/joelinn/asana/test/projects/ProjectsClientTest.java | // Path: src/main/java/net/joelinn/asana/ApiException.java
// public class ApiException extends RuntimeException{
// protected ClientResponse.Status status;
// protected String message;
//
// public ApiException(ClientResponse.Status status, String message){
// super(message);
// this.status = status;
// this.message = message;
// }
//
// public ClientResponse.Status getStatus(){
// return status;
// }
//
// @Override
// public String toString() {
// String s = getClass().getName();
// String message = getLocalizedMessage();
// return String.format("%s: %s %s", s, status.getStatusCode(), message);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Project.java
// @JsonRootName("data")
// public class Project {
// public long id;
// public boolean archived;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public Users followers;
//
// @JsonProperty("modified_at")
// public String modifiedAt;
//
// public String name;
// public String color;
// public String notes;
// public Workspace workspace;
// public Team team;
// public Users members;
//
// @JsonProperty("public")
// public boolean isPublic;
// }
//
// Path: src/main/java/net/joelinn/asana/projects/ProjectRequestBuilder.java
// public class ProjectRequestBuilder {
// MultivaluedMapImpl params = new MultivaluedMapImpl();
//
// public ProjectRequestBuilder(){
//
// }
//
// public ProjectRequestBuilder(long workspaceId, String name){
// workspace(workspaceId).name(name);
// }
//
// public ProjectRequestBuilder name(String name){
// params.add("name", name);
// return this;
// }
//
// public ProjectRequestBuilder notes(String notes){
// params.add("notes", notes);
// return this;
// }
//
// public ProjectRequestBuilder workspace(long workspaceId){
// params.add("workspace", workspaceId);
// return this;
// }
//
// public ProjectRequestBuilder team(long teamId){
// params.add("team", teamId);
// return this;
// }
//
// public ProjectRequestBuilder archived(boolean archived){
// params.add("archived", archived);
// return this;
// }
//
// public ProjectRequestBuilder color(String color){
// params.add("color", color);
// return this;
// }
//
// public MultivaluedMapImpl build(){
// return params;
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/ProjectsClient.java
// public class ProjectsClient extends AbstractClient{
// public ProjectsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public ProjectsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// public Project createProject(ProjectRequestBuilder builder){
// return post("", builder.build()).getEntity(Project.class);
// }
//
// public Project updateProject(long projectId, ProjectRequestBuilder builder){
// return put(Long.toString(projectId), builder.build()).getEntity(Project.class);
// }
//
// public Project getProject(long projectId){
// return get(Long.toString(projectId)).getEntity(Project.class);
// }
//
// public void deleteProject(long projectId){
// delete(Long.toString(projectId));
// }
//
// public Tasks getExpandedTasks (long projectId) {
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("opt_expand", ".");
// return get(String.format("%s/tasks", projectId), params).getEntity(Tasks.class);
// }
//
// public Tasks getTasks(long projectId){
// return get(String.format("%s/tasks", projectId)).getEntity(Tasks.class);
// }
//
// public Projects getProjects(long workspaceId, boolean archived){
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("workspace", workspaceId);
// params.add("archvied", archived);
// return get("", params).getEntity(Projects.class);
// }
//
// @Override
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
// return super.request(method, "projects/" + url, queryParams, data);
// }
// }
//
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
| import com.sun.jersey.api.client.ClientResponse;
import junit.framework.TestCase;
import net.joelinn.asana.ApiException;
import net.joelinn.asana.projects.Project;
import net.joelinn.asana.projects.ProjectRequestBuilder;
import net.joelinn.asana.projects.ProjectsClient;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test; | package net.joelinn.asana.test.projects;
/**
* Joe Linn
* 11/20/13
*/
public class ProjectsClientTest extends BaseTest{
protected ProjectsClient client;
@Before
public void setUp(){
client = new ProjectsClient(getApiKey());
}
@Test
public void testProjects(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
} | // Path: src/main/java/net/joelinn/asana/ApiException.java
// public class ApiException extends RuntimeException{
// protected ClientResponse.Status status;
// protected String message;
//
// public ApiException(ClientResponse.Status status, String message){
// super(message);
// this.status = status;
// this.message = message;
// }
//
// public ClientResponse.Status getStatus(){
// return status;
// }
//
// @Override
// public String toString() {
// String s = getClass().getName();
// String message = getLocalizedMessage();
// return String.format("%s: %s %s", s, status.getStatusCode(), message);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Project.java
// @JsonRootName("data")
// public class Project {
// public long id;
// public boolean archived;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public Users followers;
//
// @JsonProperty("modified_at")
// public String modifiedAt;
//
// public String name;
// public String color;
// public String notes;
// public Workspace workspace;
// public Team team;
// public Users members;
//
// @JsonProperty("public")
// public boolean isPublic;
// }
//
// Path: src/main/java/net/joelinn/asana/projects/ProjectRequestBuilder.java
// public class ProjectRequestBuilder {
// MultivaluedMapImpl params = new MultivaluedMapImpl();
//
// public ProjectRequestBuilder(){
//
// }
//
// public ProjectRequestBuilder(long workspaceId, String name){
// workspace(workspaceId).name(name);
// }
//
// public ProjectRequestBuilder name(String name){
// params.add("name", name);
// return this;
// }
//
// public ProjectRequestBuilder notes(String notes){
// params.add("notes", notes);
// return this;
// }
//
// public ProjectRequestBuilder workspace(long workspaceId){
// params.add("workspace", workspaceId);
// return this;
// }
//
// public ProjectRequestBuilder team(long teamId){
// params.add("team", teamId);
// return this;
// }
//
// public ProjectRequestBuilder archived(boolean archived){
// params.add("archived", archived);
// return this;
// }
//
// public ProjectRequestBuilder color(String color){
// params.add("color", color);
// return this;
// }
//
// public MultivaluedMapImpl build(){
// return params;
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/ProjectsClient.java
// public class ProjectsClient extends AbstractClient{
// public ProjectsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public ProjectsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// public Project createProject(ProjectRequestBuilder builder){
// return post("", builder.build()).getEntity(Project.class);
// }
//
// public Project updateProject(long projectId, ProjectRequestBuilder builder){
// return put(Long.toString(projectId), builder.build()).getEntity(Project.class);
// }
//
// public Project getProject(long projectId){
// return get(Long.toString(projectId)).getEntity(Project.class);
// }
//
// public void deleteProject(long projectId){
// delete(Long.toString(projectId));
// }
//
// public Tasks getExpandedTasks (long projectId) {
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("opt_expand", ".");
// return get(String.format("%s/tasks", projectId), params).getEntity(Tasks.class);
// }
//
// public Tasks getTasks(long projectId){
// return get(String.format("%s/tasks", projectId)).getEntity(Tasks.class);
// }
//
// public Projects getProjects(long workspaceId, boolean archived){
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("workspace", workspaceId);
// params.add("archvied", archived);
// return get("", params).getEntity(Projects.class);
// }
//
// @Override
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
// return super.request(method, "projects/" + url, queryParams, data);
// }
// }
//
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
// Path: src/test/java/net/joelinn/asana/test/projects/ProjectsClientTest.java
import com.sun.jersey.api.client.ClientResponse;
import junit.framework.TestCase;
import net.joelinn.asana.ApiException;
import net.joelinn.asana.projects.Project;
import net.joelinn.asana.projects.ProjectRequestBuilder;
import net.joelinn.asana.projects.ProjectsClient;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test;
package net.joelinn.asana.test.projects;
/**
* Joe Linn
* 11/20/13
*/
public class ProjectsClientTest extends BaseTest{
protected ProjectsClient client;
@Before
public void setUp(){
client = new ProjectsClient(getApiKey());
}
@Test
public void testProjects(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
} | Project project = client.createProject(new ProjectRequestBuilder(4440299545542L, "test project") |
jlinn/asana-api-java | src/test/java/net/joelinn/asana/test/projects/ProjectsClientTest.java | // Path: src/main/java/net/joelinn/asana/ApiException.java
// public class ApiException extends RuntimeException{
// protected ClientResponse.Status status;
// protected String message;
//
// public ApiException(ClientResponse.Status status, String message){
// super(message);
// this.status = status;
// this.message = message;
// }
//
// public ClientResponse.Status getStatus(){
// return status;
// }
//
// @Override
// public String toString() {
// String s = getClass().getName();
// String message = getLocalizedMessage();
// return String.format("%s: %s %s", s, status.getStatusCode(), message);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Project.java
// @JsonRootName("data")
// public class Project {
// public long id;
// public boolean archived;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public Users followers;
//
// @JsonProperty("modified_at")
// public String modifiedAt;
//
// public String name;
// public String color;
// public String notes;
// public Workspace workspace;
// public Team team;
// public Users members;
//
// @JsonProperty("public")
// public boolean isPublic;
// }
//
// Path: src/main/java/net/joelinn/asana/projects/ProjectRequestBuilder.java
// public class ProjectRequestBuilder {
// MultivaluedMapImpl params = new MultivaluedMapImpl();
//
// public ProjectRequestBuilder(){
//
// }
//
// public ProjectRequestBuilder(long workspaceId, String name){
// workspace(workspaceId).name(name);
// }
//
// public ProjectRequestBuilder name(String name){
// params.add("name", name);
// return this;
// }
//
// public ProjectRequestBuilder notes(String notes){
// params.add("notes", notes);
// return this;
// }
//
// public ProjectRequestBuilder workspace(long workspaceId){
// params.add("workspace", workspaceId);
// return this;
// }
//
// public ProjectRequestBuilder team(long teamId){
// params.add("team", teamId);
// return this;
// }
//
// public ProjectRequestBuilder archived(boolean archived){
// params.add("archived", archived);
// return this;
// }
//
// public ProjectRequestBuilder color(String color){
// params.add("color", color);
// return this;
// }
//
// public MultivaluedMapImpl build(){
// return params;
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/ProjectsClient.java
// public class ProjectsClient extends AbstractClient{
// public ProjectsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public ProjectsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// public Project createProject(ProjectRequestBuilder builder){
// return post("", builder.build()).getEntity(Project.class);
// }
//
// public Project updateProject(long projectId, ProjectRequestBuilder builder){
// return put(Long.toString(projectId), builder.build()).getEntity(Project.class);
// }
//
// public Project getProject(long projectId){
// return get(Long.toString(projectId)).getEntity(Project.class);
// }
//
// public void deleteProject(long projectId){
// delete(Long.toString(projectId));
// }
//
// public Tasks getExpandedTasks (long projectId) {
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("opt_expand", ".");
// return get(String.format("%s/tasks", projectId), params).getEntity(Tasks.class);
// }
//
// public Tasks getTasks(long projectId){
// return get(String.format("%s/tasks", projectId)).getEntity(Tasks.class);
// }
//
// public Projects getProjects(long workspaceId, boolean archived){
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("workspace", workspaceId);
// params.add("archvied", archived);
// return get("", params).getEntity(Projects.class);
// }
//
// @Override
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
// return super.request(method, "projects/" + url, queryParams, data);
// }
// }
//
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
| import com.sun.jersey.api.client.ClientResponse;
import junit.framework.TestCase;
import net.joelinn.asana.ApiException;
import net.joelinn.asana.projects.Project;
import net.joelinn.asana.projects.ProjectRequestBuilder;
import net.joelinn.asana.projects.ProjectsClient;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test; | package net.joelinn.asana.test.projects;
/**
* Joe Linn
* 11/20/13
*/
public class ProjectsClientTest extends BaseTest{
protected ProjectsClient client;
@Before
public void setUp(){
client = new ProjectsClient(getApiKey());
}
@Test
public void testProjects(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
}
Project project = client.createProject(new ProjectRequestBuilder(4440299545542L, "test project")
.team(4440299545545L).notes("this is a test").color("dark-blue"));
Project retrievedProject = client.getProject(project.id);
TestCase.assertEquals(project.name, retrievedProject.name);
String newName = "changed the name";
client.updateProject(retrievedProject.id, new ProjectRequestBuilder().name(newName));
TestCase.assertEquals(newName, client.getProject(retrievedProject.id).name);
client.deleteProject(retrievedProject.id);
boolean exceptionThrown = false;
try{
client.getProject(retrievedProject.id);
} | // Path: src/main/java/net/joelinn/asana/ApiException.java
// public class ApiException extends RuntimeException{
// protected ClientResponse.Status status;
// protected String message;
//
// public ApiException(ClientResponse.Status status, String message){
// super(message);
// this.status = status;
// this.message = message;
// }
//
// public ClientResponse.Status getStatus(){
// return status;
// }
//
// @Override
// public String toString() {
// String s = getClass().getName();
// String message = getLocalizedMessage();
// return String.format("%s: %s %s", s, status.getStatusCode(), message);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Project.java
// @JsonRootName("data")
// public class Project {
// public long id;
// public boolean archived;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public Users followers;
//
// @JsonProperty("modified_at")
// public String modifiedAt;
//
// public String name;
// public String color;
// public String notes;
// public Workspace workspace;
// public Team team;
// public Users members;
//
// @JsonProperty("public")
// public boolean isPublic;
// }
//
// Path: src/main/java/net/joelinn/asana/projects/ProjectRequestBuilder.java
// public class ProjectRequestBuilder {
// MultivaluedMapImpl params = new MultivaluedMapImpl();
//
// public ProjectRequestBuilder(){
//
// }
//
// public ProjectRequestBuilder(long workspaceId, String name){
// workspace(workspaceId).name(name);
// }
//
// public ProjectRequestBuilder name(String name){
// params.add("name", name);
// return this;
// }
//
// public ProjectRequestBuilder notes(String notes){
// params.add("notes", notes);
// return this;
// }
//
// public ProjectRequestBuilder workspace(long workspaceId){
// params.add("workspace", workspaceId);
// return this;
// }
//
// public ProjectRequestBuilder team(long teamId){
// params.add("team", teamId);
// return this;
// }
//
// public ProjectRequestBuilder archived(boolean archived){
// params.add("archived", archived);
// return this;
// }
//
// public ProjectRequestBuilder color(String color){
// params.add("color", color);
// return this;
// }
//
// public MultivaluedMapImpl build(){
// return params;
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/ProjectsClient.java
// public class ProjectsClient extends AbstractClient{
// public ProjectsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public ProjectsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// public Project createProject(ProjectRequestBuilder builder){
// return post("", builder.build()).getEntity(Project.class);
// }
//
// public Project updateProject(long projectId, ProjectRequestBuilder builder){
// return put(Long.toString(projectId), builder.build()).getEntity(Project.class);
// }
//
// public Project getProject(long projectId){
// return get(Long.toString(projectId)).getEntity(Project.class);
// }
//
// public void deleteProject(long projectId){
// delete(Long.toString(projectId));
// }
//
// public Tasks getExpandedTasks (long projectId) {
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("opt_expand", ".");
// return get(String.format("%s/tasks", projectId), params).getEntity(Tasks.class);
// }
//
// public Tasks getTasks(long projectId){
// return get(String.format("%s/tasks", projectId)).getEntity(Tasks.class);
// }
//
// public Projects getProjects(long workspaceId, boolean archived){
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("workspace", workspaceId);
// params.add("archvied", archived);
// return get("", params).getEntity(Projects.class);
// }
//
// @Override
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
// return super.request(method, "projects/" + url, queryParams, data);
// }
// }
//
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
// Path: src/test/java/net/joelinn/asana/test/projects/ProjectsClientTest.java
import com.sun.jersey.api.client.ClientResponse;
import junit.framework.TestCase;
import net.joelinn.asana.ApiException;
import net.joelinn.asana.projects.Project;
import net.joelinn.asana.projects.ProjectRequestBuilder;
import net.joelinn.asana.projects.ProjectsClient;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test;
package net.joelinn.asana.test.projects;
/**
* Joe Linn
* 11/20/13
*/
public class ProjectsClientTest extends BaseTest{
protected ProjectsClient client;
@Before
public void setUp(){
client = new ProjectsClient(getApiKey());
}
@Test
public void testProjects(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
}
Project project = client.createProject(new ProjectRequestBuilder(4440299545542L, "test project")
.team(4440299545545L).notes("this is a test").color("dark-blue"));
Project retrievedProject = client.getProject(project.id);
TestCase.assertEquals(project.name, retrievedProject.name);
String newName = "changed the name";
client.updateProject(retrievedProject.id, new ProjectRequestBuilder().name(newName));
TestCase.assertEquals(newName, client.getProject(retrievedProject.id).name);
client.deleteProject(retrievedProject.id);
boolean exceptionThrown = false;
try{
client.getProject(retrievedProject.id);
} | catch (ApiException e){ |
jlinn/asana-api-java | src/test/java/net/joelinn/asana/test/workspaces/WorkspacesClientTest.java | // Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspaces.java
// @JsonRootName("data")
// public class Workspaces extends ArrayList<Workspace>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/WorkspacesClient.java
// public class WorkspacesClient extends AbstractClient{
// public WorkspacesClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public WorkspacesClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// /**
// * Retrieve all workspaces visible by the user associated with the current api key
// * @return a list of Workspace objects
// */
// public Workspaces getWorkspaces(){
// return get("").getEntity(Workspaces.class);
// }
//
// /**
// * Change the name of a workspace
// * @param workspaceId the id of the workspace to alter
// * @param name the new name for the workspace
// * @return a Workspace object
// */
// public Workspace updateWorkspace(long workspaceId, String name){
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("name", name);
// ClientResponse clientResponse = put(Long.toString(workspaceId), params);
// if(clientResponse.getClientResponseStatus().getStatusCode() == ClientResponse.Status.FORBIDDEN.getStatusCode()){
// throw new ForbiddenException(clientResponse.getEntity(Errors.class).get(0).message);
// }
// return clientResponse.getEntity(Workspace.class);
// }
//
// public Users getUsers(long workspaceId){
// return get(String.format("%s/users", workspaceId)).getEntity(Users.class);
// }
//
// public Tasks getTasks(long workspaceId, long assigneeId){
// return getTasks(workspaceId, assigneeId, null);
// }
//
// public Tasks getTasks(long workspaceId, long assigneeId, Long projectId){
// return getTasks(workspaceId, assigneeId, projectId, false);
// }
//
// public Tasks getTasks(long workspaceId, long assigneeId, Long projectId, boolean include_archived){
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("assignee", assigneeId);
// params.add("include_archived", include_archived);
// if(projectId != null){
// params.add("project", projectId);
// }
// return get(String.format("%s/tasks", workspaceId), params).getEntity(Tasks.class);
// }
//
// public Projects getProjects(long workspaceId){
// return getProjects(workspaceId, false);
// }
//
// public Projects getProjects(long workspaceId, boolean archived){
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("archived", archived);
// return get(String.format("%s/projects", workspaceId), params).getEntity(Projects.class);
// }
//
// public Tags getTags(long workspaceId){
// return get(String.format("%s/tags", workspaceId)).getEntity(Tags.class);
// }
//
// @Override
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
// return super.request(method, "workspaces/" + url, queryParams, data);
// }
// }
| import net.joelinn.asana.test.BaseTest;
import net.joelinn.asana.workspaces.Workspaces;
import net.joelinn.asana.workspaces.WorkspacesClient;
import org.junit.Before;
import org.junit.Test; | package net.joelinn.asana.test.workspaces;
/**
* Joe Linn
* 11/17/13
*/
public class WorkspacesClientTest extends BaseTest{
protected WorkspacesClient client;
@Before
public void setUp(){
client = new WorkspacesClient(getApiKey());
}
@Test
public void testGetWorkspaces(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
} | // Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspaces.java
// @JsonRootName("data")
// public class Workspaces extends ArrayList<Workspace>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/WorkspacesClient.java
// public class WorkspacesClient extends AbstractClient{
// public WorkspacesClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public WorkspacesClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// /**
// * Retrieve all workspaces visible by the user associated with the current api key
// * @return a list of Workspace objects
// */
// public Workspaces getWorkspaces(){
// return get("").getEntity(Workspaces.class);
// }
//
// /**
// * Change the name of a workspace
// * @param workspaceId the id of the workspace to alter
// * @param name the new name for the workspace
// * @return a Workspace object
// */
// public Workspace updateWorkspace(long workspaceId, String name){
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("name", name);
// ClientResponse clientResponse = put(Long.toString(workspaceId), params);
// if(clientResponse.getClientResponseStatus().getStatusCode() == ClientResponse.Status.FORBIDDEN.getStatusCode()){
// throw new ForbiddenException(clientResponse.getEntity(Errors.class).get(0).message);
// }
// return clientResponse.getEntity(Workspace.class);
// }
//
// public Users getUsers(long workspaceId){
// return get(String.format("%s/users", workspaceId)).getEntity(Users.class);
// }
//
// public Tasks getTasks(long workspaceId, long assigneeId){
// return getTasks(workspaceId, assigneeId, null);
// }
//
// public Tasks getTasks(long workspaceId, long assigneeId, Long projectId){
// return getTasks(workspaceId, assigneeId, projectId, false);
// }
//
// public Tasks getTasks(long workspaceId, long assigneeId, Long projectId, boolean include_archived){
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("assignee", assigneeId);
// params.add("include_archived", include_archived);
// if(projectId != null){
// params.add("project", projectId);
// }
// return get(String.format("%s/tasks", workspaceId), params).getEntity(Tasks.class);
// }
//
// public Projects getProjects(long workspaceId){
// return getProjects(workspaceId, false);
// }
//
// public Projects getProjects(long workspaceId, boolean archived){
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("archived", archived);
// return get(String.format("%s/projects", workspaceId), params).getEntity(Projects.class);
// }
//
// public Tags getTags(long workspaceId){
// return get(String.format("%s/tags", workspaceId)).getEntity(Tags.class);
// }
//
// @Override
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
// return super.request(method, "workspaces/" + url, queryParams, data);
// }
// }
// Path: src/test/java/net/joelinn/asana/test/workspaces/WorkspacesClientTest.java
import net.joelinn.asana.test.BaseTest;
import net.joelinn.asana.workspaces.Workspaces;
import net.joelinn.asana.workspaces.WorkspacesClient;
import org.junit.Before;
import org.junit.Test;
package net.joelinn.asana.test.workspaces;
/**
* Joe Linn
* 11/17/13
*/
public class WorkspacesClientTest extends BaseTest{
protected WorkspacesClient client;
@Before
public void setUp(){
client = new WorkspacesClient(getApiKey());
}
@Test
public void testGetWorkspaces(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
} | Workspaces workspaces = client.getWorkspaces(); |
jlinn/asana-api-java | src/test/java/net/joelinn/asana/test/teams/TeamsClientTest.java | // Path: src/main/java/net/joelinn/asana/teams/Team.java
// public class Team {
// public long id;
// public String name;
// }
//
// Path: src/main/java/net/joelinn/asana/teams/Teams.java
// @JsonRootName("data")
// public class Teams extends ArrayList<Team>{
// }
//
// Path: src/main/java/net/joelinn/asana/teams/TeamsClient.java
// public class TeamsClient extends AbstractClient{
// public TeamsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public TeamsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// /**
// * Retrieve all teams of which the current user is a member within the given organization
// * @param organizationId an organization id
// * @return a list of Team objects
// */
// public Teams getTeams(long organizationId){
// return get(String.format("organizations/%s/teams", organizationId)).getEntity(Teams.class);
// }
// }
//
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
| import net.joelinn.asana.teams.Team;
import net.joelinn.asana.teams.Teams;
import net.joelinn.asana.teams.TeamsClient;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test; | package net.joelinn.asana.test.teams;
/**
* Joe Linn
* 11/20/13
*/
public class TeamsClientTest extends BaseTest{
protected TeamsClient client;
@Before
public void setUp(){
client = new TeamsClient(getApiKey());
}
@Test
public void testTeams(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
} | // Path: src/main/java/net/joelinn/asana/teams/Team.java
// public class Team {
// public long id;
// public String name;
// }
//
// Path: src/main/java/net/joelinn/asana/teams/Teams.java
// @JsonRootName("data")
// public class Teams extends ArrayList<Team>{
// }
//
// Path: src/main/java/net/joelinn/asana/teams/TeamsClient.java
// public class TeamsClient extends AbstractClient{
// public TeamsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public TeamsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// /**
// * Retrieve all teams of which the current user is a member within the given organization
// * @param organizationId an organization id
// * @return a list of Team objects
// */
// public Teams getTeams(long organizationId){
// return get(String.format("organizations/%s/teams", organizationId)).getEntity(Teams.class);
// }
// }
//
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
// Path: src/test/java/net/joelinn/asana/test/teams/TeamsClientTest.java
import net.joelinn.asana.teams.Team;
import net.joelinn.asana.teams.Teams;
import net.joelinn.asana.teams.TeamsClient;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test;
package net.joelinn.asana.test.teams;
/**
* Joe Linn
* 11/20/13
*/
public class TeamsClientTest extends BaseTest{
protected TeamsClient client;
@Before
public void setUp(){
client = new TeamsClient(getApiKey());
}
@Test
public void testTeams(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
} | Teams teams = client.getTeams(4440299545542L); |
jlinn/asana-api-java | src/test/java/net/joelinn/asana/test/teams/TeamsClientTest.java | // Path: src/main/java/net/joelinn/asana/teams/Team.java
// public class Team {
// public long id;
// public String name;
// }
//
// Path: src/main/java/net/joelinn/asana/teams/Teams.java
// @JsonRootName("data")
// public class Teams extends ArrayList<Team>{
// }
//
// Path: src/main/java/net/joelinn/asana/teams/TeamsClient.java
// public class TeamsClient extends AbstractClient{
// public TeamsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public TeamsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// /**
// * Retrieve all teams of which the current user is a member within the given organization
// * @param organizationId an organization id
// * @return a list of Team objects
// */
// public Teams getTeams(long organizationId){
// return get(String.format("organizations/%s/teams", organizationId)).getEntity(Teams.class);
// }
// }
//
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
| import net.joelinn.asana.teams.Team;
import net.joelinn.asana.teams.Teams;
import net.joelinn.asana.teams.TeamsClient;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test; | package net.joelinn.asana.test.teams;
/**
* Joe Linn
* 11/20/13
*/
public class TeamsClientTest extends BaseTest{
protected TeamsClient client;
@Before
public void setUp(){
client = new TeamsClient(getApiKey());
}
@Test
public void testTeams(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
}
Teams teams = client.getTeams(4440299545542L);
| // Path: src/main/java/net/joelinn/asana/teams/Team.java
// public class Team {
// public long id;
// public String name;
// }
//
// Path: src/main/java/net/joelinn/asana/teams/Teams.java
// @JsonRootName("data")
// public class Teams extends ArrayList<Team>{
// }
//
// Path: src/main/java/net/joelinn/asana/teams/TeamsClient.java
// public class TeamsClient extends AbstractClient{
// public TeamsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public TeamsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// /**
// * Retrieve all teams of which the current user is a member within the given organization
// * @param organizationId an organization id
// * @return a list of Team objects
// */
// public Teams getTeams(long organizationId){
// return get(String.format("organizations/%s/teams", organizationId)).getEntity(Teams.class);
// }
// }
//
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
// Path: src/test/java/net/joelinn/asana/test/teams/TeamsClientTest.java
import net.joelinn.asana.teams.Team;
import net.joelinn.asana.teams.Teams;
import net.joelinn.asana.teams.TeamsClient;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test;
package net.joelinn.asana.test.teams;
/**
* Joe Linn
* 11/20/13
*/
public class TeamsClientTest extends BaseTest{
protected TeamsClient client;
@Before
public void setUp(){
client = new TeamsClient(getApiKey());
}
@Test
public void testTeams(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
}
Teams teams = client.getTeams(4440299545542L);
| for(Team team : teams){ |
jlinn/asana-api-java | src/test/java/net/joelinn/asana/test/AsanaTest.java | // Path: src/main/java/net/joelinn/asana/Asana.java
// public class Asana {
// protected String apiKey;
//
// private Integer connectionTimeout;
//
// private Integer readTimeout;
//
// protected Map<Class<? extends AbstractClient>, AbstractClient> clients;
//
// public Asana(String apiKey){
// this.apiKey = apiKey;
// clients = new HashMap<>();
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public Asana(String apiKey, int connectionTimeout, int readTimeout){
// this(apiKey);
// this.connectionTimeout = connectionTimeout;
// this.readTimeout = readTimeout;
// }
//
// @SuppressWarnings("unchecked")
// protected <T> T getClient(Class<? extends AbstractClient> clazz){
// if(!clients.containsKey(clazz)){
// try {
// AbstractClient client;
// if(this.connectionTimeout != null && this.readTimeout != null){
// client = clazz.getConstructor(String.class, int.class, int.class)
// .newInstance(apiKey, connectionTimeout, readTimeout);
// }
// else{
// client = clazz.getConstructor(String.class).newInstance(apiKey);
// }
// clients.put(clazz, client);
// } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
// // This should never happen.
// e.printStackTrace();
// }
// }
// return (T) clients.get(clazz);
// }
//
// public ProjectsClient projects(){
// return getClient(ProjectsClient.class);
// }
//
// public StoriesClient stories(){
// return getClient(StoriesClient.class);
// }
//
// public TagsClient tags(){
// return getClient(TagsClient.class);
// }
//
// public TasksClient tasks(){
// return getClient(TasksClient.class);
// }
//
// public TeamsClient teams(){
// return getClient(TeamsClient.class);
// }
//
// public UsersClient users(){
// return getClient(UsersClient.class);
// }
//
// public WorkspacesClient workspaces(){
// return getClient(WorkspacesClient.class);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/ProjectsClient.java
// public class ProjectsClient extends AbstractClient{
// public ProjectsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public ProjectsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// public Project createProject(ProjectRequestBuilder builder){
// return post("", builder.build()).getEntity(Project.class);
// }
//
// public Project updateProject(long projectId, ProjectRequestBuilder builder){
// return put(Long.toString(projectId), builder.build()).getEntity(Project.class);
// }
//
// public Project getProject(long projectId){
// return get(Long.toString(projectId)).getEntity(Project.class);
// }
//
// public void deleteProject(long projectId){
// delete(Long.toString(projectId));
// }
//
// public Tasks getExpandedTasks (long projectId) {
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("opt_expand", ".");
// return get(String.format("%s/tasks", projectId), params).getEntity(Tasks.class);
// }
//
// public Tasks getTasks(long projectId){
// return get(String.format("%s/tasks", projectId)).getEntity(Tasks.class);
// }
//
// public Projects getProjects(long workspaceId, boolean archived){
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("workspace", workspaceId);
// params.add("archvied", archived);
// return get("", params).getEntity(Projects.class);
// }
//
// @Override
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
// return super.request(method, "projects/" + url, queryParams, data);
// }
// }
| import junit.framework.TestCase;
import net.joelinn.asana.Asana;
import net.joelinn.asana.projects.ProjectsClient;
import org.junit.Before;
import org.junit.Test; | package net.joelinn.asana.test;
/**
* User: Joe Linn
* Date: 12/18/13
* Time: 6:12 PM
*/
public class AsanaTest extends BaseTest{
protected Asana client;
@Before
public void setUp(){
client = new Asana(getApiKey());
}
@Test
public void testGetClient(){ | // Path: src/main/java/net/joelinn/asana/Asana.java
// public class Asana {
// protected String apiKey;
//
// private Integer connectionTimeout;
//
// private Integer readTimeout;
//
// protected Map<Class<? extends AbstractClient>, AbstractClient> clients;
//
// public Asana(String apiKey){
// this.apiKey = apiKey;
// clients = new HashMap<>();
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public Asana(String apiKey, int connectionTimeout, int readTimeout){
// this(apiKey);
// this.connectionTimeout = connectionTimeout;
// this.readTimeout = readTimeout;
// }
//
// @SuppressWarnings("unchecked")
// protected <T> T getClient(Class<? extends AbstractClient> clazz){
// if(!clients.containsKey(clazz)){
// try {
// AbstractClient client;
// if(this.connectionTimeout != null && this.readTimeout != null){
// client = clazz.getConstructor(String.class, int.class, int.class)
// .newInstance(apiKey, connectionTimeout, readTimeout);
// }
// else{
// client = clazz.getConstructor(String.class).newInstance(apiKey);
// }
// clients.put(clazz, client);
// } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
// // This should never happen.
// e.printStackTrace();
// }
// }
// return (T) clients.get(clazz);
// }
//
// public ProjectsClient projects(){
// return getClient(ProjectsClient.class);
// }
//
// public StoriesClient stories(){
// return getClient(StoriesClient.class);
// }
//
// public TagsClient tags(){
// return getClient(TagsClient.class);
// }
//
// public TasksClient tasks(){
// return getClient(TasksClient.class);
// }
//
// public TeamsClient teams(){
// return getClient(TeamsClient.class);
// }
//
// public UsersClient users(){
// return getClient(UsersClient.class);
// }
//
// public WorkspacesClient workspaces(){
// return getClient(WorkspacesClient.class);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/ProjectsClient.java
// public class ProjectsClient extends AbstractClient{
// public ProjectsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public ProjectsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// public Project createProject(ProjectRequestBuilder builder){
// return post("", builder.build()).getEntity(Project.class);
// }
//
// public Project updateProject(long projectId, ProjectRequestBuilder builder){
// return put(Long.toString(projectId), builder.build()).getEntity(Project.class);
// }
//
// public Project getProject(long projectId){
// return get(Long.toString(projectId)).getEntity(Project.class);
// }
//
// public void deleteProject(long projectId){
// delete(Long.toString(projectId));
// }
//
// public Tasks getExpandedTasks (long projectId) {
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("opt_expand", ".");
// return get(String.format("%s/tasks", projectId), params).getEntity(Tasks.class);
// }
//
// public Tasks getTasks(long projectId){
// return get(String.format("%s/tasks", projectId)).getEntity(Tasks.class);
// }
//
// public Projects getProjects(long workspaceId, boolean archived){
// MultivaluedMapImpl params = new MultivaluedMapImpl();
// params.add("workspace", workspaceId);
// params.add("archvied", archived);
// return get("", params).getEntity(Projects.class);
// }
//
// @Override
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
// return super.request(method, "projects/" + url, queryParams, data);
// }
// }
// Path: src/test/java/net/joelinn/asana/test/AsanaTest.java
import junit.framework.TestCase;
import net.joelinn.asana.Asana;
import net.joelinn.asana.projects.ProjectsClient;
import org.junit.Before;
import org.junit.Test;
package net.joelinn.asana.test;
/**
* User: Joe Linn
* Date: 12/18/13
* Time: 6:12 PM
*/
public class AsanaTest extends BaseTest{
protected Asana client;
@Before
public void setUp(){
client = new Asana(getApiKey());
}
@Test
public void testGetClient(){ | TestCase.assertEquals(ProjectsClient.class, client.projects().getClass()); |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/projects/Project.java | // Path: src/main/java/net/joelinn/asana/teams/Team.java
// public class Team {
// public long id;
// public String name;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
| import net.joelinn.asana.teams.Team;
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName; | package net.joelinn.asana.projects;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
public class Project {
public long id;
public boolean archived;
@JsonProperty("created_at")
public String createdAt;
| // Path: src/main/java/net/joelinn/asana/teams/Team.java
// public class Team {
// public long id;
// public String name;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
// Path: src/main/java/net/joelinn/asana/projects/Project.java
import net.joelinn.asana.teams.Team;
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
package net.joelinn.asana.projects;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
public class Project {
public long id;
public boolean archived;
@JsonProperty("created_at")
public String createdAt;
| public Users followers; |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/projects/Project.java | // Path: src/main/java/net/joelinn/asana/teams/Team.java
// public class Team {
// public long id;
// public String name;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
| import net.joelinn.asana.teams.Team;
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName; | package net.joelinn.asana.projects;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
public class Project {
public long id;
public boolean archived;
@JsonProperty("created_at")
public String createdAt;
public Users followers;
@JsonProperty("modified_at")
public String modifiedAt;
public String name;
public String color;
public String notes; | // Path: src/main/java/net/joelinn/asana/teams/Team.java
// public class Team {
// public long id;
// public String name;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
// Path: src/main/java/net/joelinn/asana/projects/Project.java
import net.joelinn.asana.teams.Team;
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
package net.joelinn.asana.projects;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
public class Project {
public long id;
public boolean archived;
@JsonProperty("created_at")
public String createdAt;
public Users followers;
@JsonProperty("modified_at")
public String modifiedAt;
public String name;
public String color;
public String notes; | public Workspace workspace; |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/projects/Project.java | // Path: src/main/java/net/joelinn/asana/teams/Team.java
// public class Team {
// public long id;
// public String name;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
| import net.joelinn.asana.teams.Team;
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName; | package net.joelinn.asana.projects;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
public class Project {
public long id;
public boolean archived;
@JsonProperty("created_at")
public String createdAt;
public Users followers;
@JsonProperty("modified_at")
public String modifiedAt;
public String name;
public String color;
public String notes;
public Workspace workspace; | // Path: src/main/java/net/joelinn/asana/teams/Team.java
// public class Team {
// public long id;
// public String name;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
// Path: src/main/java/net/joelinn/asana/projects/Project.java
import net.joelinn.asana.teams.Team;
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
package net.joelinn.asana.projects;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
public class Project {
public long id;
public boolean archived;
@JsonProperty("created_at")
public String createdAt;
public Users followers;
@JsonProperty("modified_at")
public String modifiedAt;
public String name;
public String color;
public String notes;
public Workspace workspace; | public Team team; |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/workspaces/WorkspacesClient.java | // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/Errors.java
// @JsonRootName("errors")
// public class Errors extends ArrayList<Error>{
// }
//
// Path: src/main/java/net/joelinn/asana/ForbiddenException.java
// public class ForbiddenException extends ApiException {
// public ForbiddenException(String message) {
// super(ClientResponse.Status.FORBIDDEN, message);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/tasks/Tasks.java
// @JsonRootName("data")
// public class Tasks extends ArrayList<Task>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
| import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.Errors;
import net.joelinn.asana.ForbiddenException;
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.tasks.Tasks;
import net.joelinn.asana.users.Users; | package net.joelinn.asana.workspaces;
/**
* Joe Linn
* 11/17/13
* @see <a href="http://developer.asana.com/documentation/#workspaces">http://developer.asana.com/documentation/#workspaces</a>
*/
public class WorkspacesClient extends AbstractClient{
public WorkspacesClient(String apiKey) {
super(apiKey);
}
/**
* @param apiKey your Asana API key
* @param connectionTimeout the connection timeout in MILLISECONDS
* @param readTimeout the read timeout in MILLISECONDS
*/
public WorkspacesClient(String apiKey, int connectionTimeout, int readTimeout) {
super(apiKey, connectionTimeout, readTimeout);
}
/**
* Retrieve all workspaces visible by the user associated with the current api key
* @return a list of Workspace objects
*/
public Workspaces getWorkspaces(){
return get("").getEntity(Workspaces.class);
}
/**
* Change the name of a workspace
* @param workspaceId the id of the workspace to alter
* @param name the new name for the workspace
* @return a Workspace object
*/
public Workspace updateWorkspace(long workspaceId, String name){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("name", name);
ClientResponse clientResponse = put(Long.toString(workspaceId), params);
if(clientResponse.getClientResponseStatus().getStatusCode() == ClientResponse.Status.FORBIDDEN.getStatusCode()){ | // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/Errors.java
// @JsonRootName("errors")
// public class Errors extends ArrayList<Error>{
// }
//
// Path: src/main/java/net/joelinn/asana/ForbiddenException.java
// public class ForbiddenException extends ApiException {
// public ForbiddenException(String message) {
// super(ClientResponse.Status.FORBIDDEN, message);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/tasks/Tasks.java
// @JsonRootName("data")
// public class Tasks extends ArrayList<Task>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
// Path: src/main/java/net/joelinn/asana/workspaces/WorkspacesClient.java
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.Errors;
import net.joelinn.asana.ForbiddenException;
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.tasks.Tasks;
import net.joelinn.asana.users.Users;
package net.joelinn.asana.workspaces;
/**
* Joe Linn
* 11/17/13
* @see <a href="http://developer.asana.com/documentation/#workspaces">http://developer.asana.com/documentation/#workspaces</a>
*/
public class WorkspacesClient extends AbstractClient{
public WorkspacesClient(String apiKey) {
super(apiKey);
}
/**
* @param apiKey your Asana API key
* @param connectionTimeout the connection timeout in MILLISECONDS
* @param readTimeout the read timeout in MILLISECONDS
*/
public WorkspacesClient(String apiKey, int connectionTimeout, int readTimeout) {
super(apiKey, connectionTimeout, readTimeout);
}
/**
* Retrieve all workspaces visible by the user associated with the current api key
* @return a list of Workspace objects
*/
public Workspaces getWorkspaces(){
return get("").getEntity(Workspaces.class);
}
/**
* Change the name of a workspace
* @param workspaceId the id of the workspace to alter
* @param name the new name for the workspace
* @return a Workspace object
*/
public Workspace updateWorkspace(long workspaceId, String name){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("name", name);
ClientResponse clientResponse = put(Long.toString(workspaceId), params);
if(clientResponse.getClientResponseStatus().getStatusCode() == ClientResponse.Status.FORBIDDEN.getStatusCode()){ | throw new ForbiddenException(clientResponse.getEntity(Errors.class).get(0).message); |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/workspaces/WorkspacesClient.java | // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/Errors.java
// @JsonRootName("errors")
// public class Errors extends ArrayList<Error>{
// }
//
// Path: src/main/java/net/joelinn/asana/ForbiddenException.java
// public class ForbiddenException extends ApiException {
// public ForbiddenException(String message) {
// super(ClientResponse.Status.FORBIDDEN, message);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/tasks/Tasks.java
// @JsonRootName("data")
// public class Tasks extends ArrayList<Task>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
| import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.Errors;
import net.joelinn.asana.ForbiddenException;
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.tasks.Tasks;
import net.joelinn.asana.users.Users; | package net.joelinn.asana.workspaces;
/**
* Joe Linn
* 11/17/13
* @see <a href="http://developer.asana.com/documentation/#workspaces">http://developer.asana.com/documentation/#workspaces</a>
*/
public class WorkspacesClient extends AbstractClient{
public WorkspacesClient(String apiKey) {
super(apiKey);
}
/**
* @param apiKey your Asana API key
* @param connectionTimeout the connection timeout in MILLISECONDS
* @param readTimeout the read timeout in MILLISECONDS
*/
public WorkspacesClient(String apiKey, int connectionTimeout, int readTimeout) {
super(apiKey, connectionTimeout, readTimeout);
}
/**
* Retrieve all workspaces visible by the user associated with the current api key
* @return a list of Workspace objects
*/
public Workspaces getWorkspaces(){
return get("").getEntity(Workspaces.class);
}
/**
* Change the name of a workspace
* @param workspaceId the id of the workspace to alter
* @param name the new name for the workspace
* @return a Workspace object
*/
public Workspace updateWorkspace(long workspaceId, String name){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("name", name);
ClientResponse clientResponse = put(Long.toString(workspaceId), params);
if(clientResponse.getClientResponseStatus().getStatusCode() == ClientResponse.Status.FORBIDDEN.getStatusCode()){ | // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/Errors.java
// @JsonRootName("errors")
// public class Errors extends ArrayList<Error>{
// }
//
// Path: src/main/java/net/joelinn/asana/ForbiddenException.java
// public class ForbiddenException extends ApiException {
// public ForbiddenException(String message) {
// super(ClientResponse.Status.FORBIDDEN, message);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/tasks/Tasks.java
// @JsonRootName("data")
// public class Tasks extends ArrayList<Task>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
// Path: src/main/java/net/joelinn/asana/workspaces/WorkspacesClient.java
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.Errors;
import net.joelinn.asana.ForbiddenException;
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.tasks.Tasks;
import net.joelinn.asana.users.Users;
package net.joelinn.asana.workspaces;
/**
* Joe Linn
* 11/17/13
* @see <a href="http://developer.asana.com/documentation/#workspaces">http://developer.asana.com/documentation/#workspaces</a>
*/
public class WorkspacesClient extends AbstractClient{
public WorkspacesClient(String apiKey) {
super(apiKey);
}
/**
* @param apiKey your Asana API key
* @param connectionTimeout the connection timeout in MILLISECONDS
* @param readTimeout the read timeout in MILLISECONDS
*/
public WorkspacesClient(String apiKey, int connectionTimeout, int readTimeout) {
super(apiKey, connectionTimeout, readTimeout);
}
/**
* Retrieve all workspaces visible by the user associated with the current api key
* @return a list of Workspace objects
*/
public Workspaces getWorkspaces(){
return get("").getEntity(Workspaces.class);
}
/**
* Change the name of a workspace
* @param workspaceId the id of the workspace to alter
* @param name the new name for the workspace
* @return a Workspace object
*/
public Workspace updateWorkspace(long workspaceId, String name){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("name", name);
ClientResponse clientResponse = put(Long.toString(workspaceId), params);
if(clientResponse.getClientResponseStatus().getStatusCode() == ClientResponse.Status.FORBIDDEN.getStatusCode()){ | throw new ForbiddenException(clientResponse.getEntity(Errors.class).get(0).message); |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/workspaces/WorkspacesClient.java | // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/Errors.java
// @JsonRootName("errors")
// public class Errors extends ArrayList<Error>{
// }
//
// Path: src/main/java/net/joelinn/asana/ForbiddenException.java
// public class ForbiddenException extends ApiException {
// public ForbiddenException(String message) {
// super(ClientResponse.Status.FORBIDDEN, message);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/tasks/Tasks.java
// @JsonRootName("data")
// public class Tasks extends ArrayList<Task>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
| import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.Errors;
import net.joelinn.asana.ForbiddenException;
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.tasks.Tasks;
import net.joelinn.asana.users.Users; | params.add("name", name);
ClientResponse clientResponse = put(Long.toString(workspaceId), params);
if(clientResponse.getClientResponseStatus().getStatusCode() == ClientResponse.Status.FORBIDDEN.getStatusCode()){
throw new ForbiddenException(clientResponse.getEntity(Errors.class).get(0).message);
}
return clientResponse.getEntity(Workspace.class);
}
public Users getUsers(long workspaceId){
return get(String.format("%s/users", workspaceId)).getEntity(Users.class);
}
public Tasks getTasks(long workspaceId, long assigneeId){
return getTasks(workspaceId, assigneeId, null);
}
public Tasks getTasks(long workspaceId, long assigneeId, Long projectId){
return getTasks(workspaceId, assigneeId, projectId, false);
}
public Tasks getTasks(long workspaceId, long assigneeId, Long projectId, boolean include_archived){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("assignee", assigneeId);
params.add("include_archived", include_archived);
if(projectId != null){
params.add("project", projectId);
}
return get(String.format("%s/tasks", workspaceId), params).getEntity(Tasks.class);
}
| // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/Errors.java
// @JsonRootName("errors")
// public class Errors extends ArrayList<Error>{
// }
//
// Path: src/main/java/net/joelinn/asana/ForbiddenException.java
// public class ForbiddenException extends ApiException {
// public ForbiddenException(String message) {
// super(ClientResponse.Status.FORBIDDEN, message);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/tasks/Tasks.java
// @JsonRootName("data")
// public class Tasks extends ArrayList<Task>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
// Path: src/main/java/net/joelinn/asana/workspaces/WorkspacesClient.java
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.Errors;
import net.joelinn.asana.ForbiddenException;
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.tasks.Tasks;
import net.joelinn.asana.users.Users;
params.add("name", name);
ClientResponse clientResponse = put(Long.toString(workspaceId), params);
if(clientResponse.getClientResponseStatus().getStatusCode() == ClientResponse.Status.FORBIDDEN.getStatusCode()){
throw new ForbiddenException(clientResponse.getEntity(Errors.class).get(0).message);
}
return clientResponse.getEntity(Workspace.class);
}
public Users getUsers(long workspaceId){
return get(String.format("%s/users", workspaceId)).getEntity(Users.class);
}
public Tasks getTasks(long workspaceId, long assigneeId){
return getTasks(workspaceId, assigneeId, null);
}
public Tasks getTasks(long workspaceId, long assigneeId, Long projectId){
return getTasks(workspaceId, assigneeId, projectId, false);
}
public Tasks getTasks(long workspaceId, long assigneeId, Long projectId, boolean include_archived){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("assignee", assigneeId);
params.add("include_archived", include_archived);
if(projectId != null){
params.add("project", projectId);
}
return get(String.format("%s/tasks", workspaceId), params).getEntity(Tasks.class);
}
| public Projects getProjects(long workspaceId){ |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/workspaces/WorkspacesClient.java | // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/Errors.java
// @JsonRootName("errors")
// public class Errors extends ArrayList<Error>{
// }
//
// Path: src/main/java/net/joelinn/asana/ForbiddenException.java
// public class ForbiddenException extends ApiException {
// public ForbiddenException(String message) {
// super(ClientResponse.Status.FORBIDDEN, message);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/tasks/Tasks.java
// @JsonRootName("data")
// public class Tasks extends ArrayList<Task>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
| import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.Errors;
import net.joelinn.asana.ForbiddenException;
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.tasks.Tasks;
import net.joelinn.asana.users.Users; | }
public Tasks getTasks(long workspaceId, long assigneeId){
return getTasks(workspaceId, assigneeId, null);
}
public Tasks getTasks(long workspaceId, long assigneeId, Long projectId){
return getTasks(workspaceId, assigneeId, projectId, false);
}
public Tasks getTasks(long workspaceId, long assigneeId, Long projectId, boolean include_archived){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("assignee", assigneeId);
params.add("include_archived", include_archived);
if(projectId != null){
params.add("project", projectId);
}
return get(String.format("%s/tasks", workspaceId), params).getEntity(Tasks.class);
}
public Projects getProjects(long workspaceId){
return getProjects(workspaceId, false);
}
public Projects getProjects(long workspaceId, boolean archived){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("archived", archived);
return get(String.format("%s/projects", workspaceId), params).getEntity(Projects.class);
}
| // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/Errors.java
// @JsonRootName("errors")
// public class Errors extends ArrayList<Error>{
// }
//
// Path: src/main/java/net/joelinn/asana/ForbiddenException.java
// public class ForbiddenException extends ApiException {
// public ForbiddenException(String message) {
// super(ClientResponse.Status.FORBIDDEN, message);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/tasks/Tasks.java
// @JsonRootName("data")
// public class Tasks extends ArrayList<Task>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
// Path: src/main/java/net/joelinn/asana/workspaces/WorkspacesClient.java
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.Errors;
import net.joelinn.asana.ForbiddenException;
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.tasks.Tasks;
import net.joelinn.asana.users.Users;
}
public Tasks getTasks(long workspaceId, long assigneeId){
return getTasks(workspaceId, assigneeId, null);
}
public Tasks getTasks(long workspaceId, long assigneeId, Long projectId){
return getTasks(workspaceId, assigneeId, projectId, false);
}
public Tasks getTasks(long workspaceId, long assigneeId, Long projectId, boolean include_archived){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("assignee", assigneeId);
params.add("include_archived", include_archived);
if(projectId != null){
params.add("project", projectId);
}
return get(String.format("%s/tasks", workspaceId), params).getEntity(Tasks.class);
}
public Projects getProjects(long workspaceId){
return getProjects(workspaceId, false);
}
public Projects getProjects(long workspaceId, boolean archived){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("archived", archived);
return get(String.format("%s/projects", workspaceId), params).getEntity(Projects.class);
}
| public Tags getTags(long workspaceId){ |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/users/User.java | // Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
| import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.map.annotate.JsonRootName;
import java.util.List;
import java.util.Map; | package net.joelinn.asana.users;
/**
* Joe Linn
* 11/16/13
*/
@JsonRootName("data")
public class User {
public long id;
public String name;
public String email;
public Map<String, String> photo; | // Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
// Path: src/main/java/net/joelinn/asana/users/User.java
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.map.annotate.JsonRootName;
import java.util.List;
import java.util.Map;
package net.joelinn.asana.users;
/**
* Joe Linn
* 11/16/13
*/
@JsonRootName("data")
public class User {
public long id;
public String name;
public String email;
public Map<String, String> photo; | public List<Workspace> workspaces; |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/tasks/TasksClient.java | // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/stories/Stories.java
// @JsonRootName("data")
// public class Stories extends ArrayList<Story>{
// }
//
// Path: src/main/java/net/joelinn/asana/stories/Story.java
// @JsonRootName("data")
// public class Story {
// public long id;
//
// @JsonProperty("created_at")
// public Date createdAt;
//
// @JsonProperty("created_by")
// public User createdBy;
//
// public String text;
// public Task target;
// public String source;
// public String type;
//
// public boolean hearted;
//
// public Users hearts;
//
// @JsonProperty("num_hearts")
// public Integer numHearts;
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
| import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.stories.Stories;
import net.joelinn.asana.stories.Story;
import net.joelinn.asana.tags.Tags; | }
public Task getTask(long taskId){
return get(String.format("tasks/%s", taskId)).getEntity(Task.class);
}
public Tasks getTasks(){
return getTasks(false);
}
public Tasks getTasks(boolean includeArchived){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("include_archived", includeArchived);
return get("tasks", params).getEntity(Tasks.class);
}
/**
* Retrieve all subtasks associated with the given parent task
* @param taskId id of the parent task for which to retrieve subtasks
* @return a list of subtasks
*/
public Tasks getSubtasks(long taskId){
return get(String.format("tasks/%s/subtasks", taskId)).getEntity(Tasks.class);
}
/**
* Retrieve stories (comments) associated with the given task
* @param taskId the id of the task for which to retrieve stories
* @return a list of Story objects
*/ | // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/stories/Stories.java
// @JsonRootName("data")
// public class Stories extends ArrayList<Story>{
// }
//
// Path: src/main/java/net/joelinn/asana/stories/Story.java
// @JsonRootName("data")
// public class Story {
// public long id;
//
// @JsonProperty("created_at")
// public Date createdAt;
//
// @JsonProperty("created_by")
// public User createdBy;
//
// public String text;
// public Task target;
// public String source;
// public String type;
//
// public boolean hearted;
//
// public Users hearts;
//
// @JsonProperty("num_hearts")
// public Integer numHearts;
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
// Path: src/main/java/net/joelinn/asana/tasks/TasksClient.java
import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.stories.Stories;
import net.joelinn.asana.stories.Story;
import net.joelinn.asana.tags.Tags;
}
public Task getTask(long taskId){
return get(String.format("tasks/%s", taskId)).getEntity(Task.class);
}
public Tasks getTasks(){
return getTasks(false);
}
public Tasks getTasks(boolean includeArchived){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("include_archived", includeArchived);
return get("tasks", params).getEntity(Tasks.class);
}
/**
* Retrieve all subtasks associated with the given parent task
* @param taskId id of the parent task for which to retrieve subtasks
* @return a list of subtasks
*/
public Tasks getSubtasks(long taskId){
return get(String.format("tasks/%s/subtasks", taskId)).getEntity(Tasks.class);
}
/**
* Retrieve stories (comments) associated with the given task
* @param taskId the id of the task for which to retrieve stories
* @return a list of Story objects
*/ | public Stories getStories(long taskId){ |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/tasks/TasksClient.java | // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/stories/Stories.java
// @JsonRootName("data")
// public class Stories extends ArrayList<Story>{
// }
//
// Path: src/main/java/net/joelinn/asana/stories/Story.java
// @JsonRootName("data")
// public class Story {
// public long id;
//
// @JsonProperty("created_at")
// public Date createdAt;
//
// @JsonProperty("created_by")
// public User createdBy;
//
// public String text;
// public Task target;
// public String source;
// public String type;
//
// public boolean hearted;
//
// public Users hearts;
//
// @JsonProperty("num_hearts")
// public Integer numHearts;
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
| import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.stories.Stories;
import net.joelinn.asana.stories.Story;
import net.joelinn.asana.tags.Tags; | public Tasks getTasks(boolean includeArchived){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("include_archived", includeArchived);
return get("tasks", params).getEntity(Tasks.class);
}
/**
* Retrieve all subtasks associated with the given parent task
* @param taskId id of the parent task for which to retrieve subtasks
* @return a list of subtasks
*/
public Tasks getSubtasks(long taskId){
return get(String.format("tasks/%s/subtasks", taskId)).getEntity(Tasks.class);
}
/**
* Retrieve stories (comments) associated with the given task
* @param taskId the id of the task for which to retrieve stories
* @return a list of Story objects
*/
public Stories getStories(long taskId){
return get(String.format("tasks/%s/stories", taskId)).getEntity(Stories.class);
}
/**
* Add a story (comment) to a task
* @param taskId the id with which to associate the new story
* @param text the text content of the story
* @return a Story object
*/ | // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/stories/Stories.java
// @JsonRootName("data")
// public class Stories extends ArrayList<Story>{
// }
//
// Path: src/main/java/net/joelinn/asana/stories/Story.java
// @JsonRootName("data")
// public class Story {
// public long id;
//
// @JsonProperty("created_at")
// public Date createdAt;
//
// @JsonProperty("created_by")
// public User createdBy;
//
// public String text;
// public Task target;
// public String source;
// public String type;
//
// public boolean hearted;
//
// public Users hearts;
//
// @JsonProperty("num_hearts")
// public Integer numHearts;
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
// Path: src/main/java/net/joelinn/asana/tasks/TasksClient.java
import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.stories.Stories;
import net.joelinn.asana.stories.Story;
import net.joelinn.asana.tags.Tags;
public Tasks getTasks(boolean includeArchived){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("include_archived", includeArchived);
return get("tasks", params).getEntity(Tasks.class);
}
/**
* Retrieve all subtasks associated with the given parent task
* @param taskId id of the parent task for which to retrieve subtasks
* @return a list of subtasks
*/
public Tasks getSubtasks(long taskId){
return get(String.format("tasks/%s/subtasks", taskId)).getEntity(Tasks.class);
}
/**
* Retrieve stories (comments) associated with the given task
* @param taskId the id of the task for which to retrieve stories
* @return a list of Story objects
*/
public Stories getStories(long taskId){
return get(String.format("tasks/%s/stories", taskId)).getEntity(Stories.class);
}
/**
* Add a story (comment) to a task
* @param taskId the id with which to associate the new story
* @param text the text content of the story
* @return a Story object
*/ | public Story createStory(long taskId, String text){ |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/tasks/TasksClient.java | // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/stories/Stories.java
// @JsonRootName("data")
// public class Stories extends ArrayList<Story>{
// }
//
// Path: src/main/java/net/joelinn/asana/stories/Story.java
// @JsonRootName("data")
// public class Story {
// public long id;
//
// @JsonProperty("created_at")
// public Date createdAt;
//
// @JsonProperty("created_by")
// public User createdBy;
//
// public String text;
// public Task target;
// public String source;
// public String type;
//
// public boolean hearted;
//
// public Users hearts;
//
// @JsonProperty("num_hearts")
// public Integer numHearts;
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
| import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.stories.Stories;
import net.joelinn.asana.stories.Story;
import net.joelinn.asana.tags.Tags; | public Tasks getSubtasks(long taskId){
return get(String.format("tasks/%s/subtasks", taskId)).getEntity(Tasks.class);
}
/**
* Retrieve stories (comments) associated with the given task
* @param taskId the id of the task for which to retrieve stories
* @return a list of Story objects
*/
public Stories getStories(long taskId){
return get(String.format("tasks/%s/stories", taskId)).getEntity(Stories.class);
}
/**
* Add a story (comment) to a task
* @param taskId the id with which to associate the new story
* @param text the text content of the story
* @return a Story object
*/
public Story createStory(long taskId, String text){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("text", text);
return post(String.format("tasks/%s/stories", taskId), params).getEntity(Story.class);
}
/**
* Retrieve the projects with which this task is associated
* @param taskId the id of the task for which to retrieve associated projects
* @return a list of projects
*/ | // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/stories/Stories.java
// @JsonRootName("data")
// public class Stories extends ArrayList<Story>{
// }
//
// Path: src/main/java/net/joelinn/asana/stories/Story.java
// @JsonRootName("data")
// public class Story {
// public long id;
//
// @JsonProperty("created_at")
// public Date createdAt;
//
// @JsonProperty("created_by")
// public User createdBy;
//
// public String text;
// public Task target;
// public String source;
// public String type;
//
// public boolean hearted;
//
// public Users hearts;
//
// @JsonProperty("num_hearts")
// public Integer numHearts;
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
// Path: src/main/java/net/joelinn/asana/tasks/TasksClient.java
import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.stories.Stories;
import net.joelinn.asana.stories.Story;
import net.joelinn.asana.tags.Tags;
public Tasks getSubtasks(long taskId){
return get(String.format("tasks/%s/subtasks", taskId)).getEntity(Tasks.class);
}
/**
* Retrieve stories (comments) associated with the given task
* @param taskId the id of the task for which to retrieve stories
* @return a list of Story objects
*/
public Stories getStories(long taskId){
return get(String.format("tasks/%s/stories", taskId)).getEntity(Stories.class);
}
/**
* Add a story (comment) to a task
* @param taskId the id with which to associate the new story
* @param text the text content of the story
* @return a Story object
*/
public Story createStory(long taskId, String text){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("text", text);
return post(String.format("tasks/%s/stories", taskId), params).getEntity(Story.class);
}
/**
* Retrieve the projects with which this task is associated
* @param taskId the id of the task for which to retrieve associated projects
* @return a list of projects
*/ | public Projects getProjects(long taskId){ |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/tasks/TasksClient.java | // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/stories/Stories.java
// @JsonRootName("data")
// public class Stories extends ArrayList<Story>{
// }
//
// Path: src/main/java/net/joelinn/asana/stories/Story.java
// @JsonRootName("data")
// public class Story {
// public long id;
//
// @JsonProperty("created_at")
// public Date createdAt;
//
// @JsonProperty("created_by")
// public User createdBy;
//
// public String text;
// public Task target;
// public String source;
// public String type;
//
// public boolean hearted;
//
// public Users hearts;
//
// @JsonProperty("num_hearts")
// public Integer numHearts;
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
| import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.stories.Stories;
import net.joelinn.asana.stories.Story;
import net.joelinn.asana.tags.Tags; | }
/**
* Associate the given task with the given project. The newly associated project will be added at the end of the
* task's list of projects.
* @param taskId the id of the task
* @param projectId the id of the project
*/
public void addProject(long taskId, long projectId){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("project", projectId);
post(String.format("tasks/%s/addProject", taskId), params);
}
/**
* Remove an association between the given task and project
* @param taskId the id of the task
* @param projectId the id of the project
*/
public void removeProject(long taskId, long projectId){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("project", projectId);
post(String.format("tasks/%s/removeProject", taskId), params);
}
/**
* Retrieve all tags associated with the given task
* @param taskId the id of the task
* @return a list of tags
*/ | // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/stories/Stories.java
// @JsonRootName("data")
// public class Stories extends ArrayList<Story>{
// }
//
// Path: src/main/java/net/joelinn/asana/stories/Story.java
// @JsonRootName("data")
// public class Story {
// public long id;
//
// @JsonProperty("created_at")
// public Date createdAt;
//
// @JsonProperty("created_by")
// public User createdBy;
//
// public String text;
// public Task target;
// public String source;
// public String type;
//
// public boolean hearted;
//
// public Users hearts;
//
// @JsonProperty("num_hearts")
// public Integer numHearts;
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
// Path: src/main/java/net/joelinn/asana/tasks/TasksClient.java
import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.stories.Stories;
import net.joelinn.asana.stories.Story;
import net.joelinn.asana.tags.Tags;
}
/**
* Associate the given task with the given project. The newly associated project will be added at the end of the
* task's list of projects.
* @param taskId the id of the task
* @param projectId the id of the project
*/
public void addProject(long taskId, long projectId){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("project", projectId);
post(String.format("tasks/%s/addProject", taskId), params);
}
/**
* Remove an association between the given task and project
* @param taskId the id of the task
* @param projectId the id of the project
*/
public void removeProject(long taskId, long projectId){
MultivaluedMapImpl params = new MultivaluedMapImpl();
params.add("project", projectId);
post(String.format("tasks/%s/removeProject", taskId), params);
}
/**
* Retrieve all tags associated with the given task
* @param taskId the id of the task
* @return a list of tags
*/ | public Tags getTags(long taskId){ |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/stories/Story.java | // Path: src/main/java/net/joelinn/asana/tasks/Task.java
// @JsonRootName("data")
// @JsonIgnoreProperties(ignoreUnknown=true)
// public class Task {
// public long id;
// public User assignee;
//
// @JsonProperty("assignee_status")
// public String assigneeStatus;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public boolean completed;
//
// @JsonProperty("completed_at")
// public String completedAt;
//
// @JsonProperty("due_on")
// public String dueOn;
//
// public Users followers;
//
// public boolean hearted;
//
// public Users hearts;
//
// @JsonProperty("num_hearts")
// public Integer numHearts;
//
// @JsonProperty("modified_at")
// public String modifiedAt;
//
// public String name;
// public String notes;
// public Projects projects;
// public Task parent;
// public Workspace workspace;
// public Tags tags;
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
| import net.joelinn.asana.tasks.Task;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.Users;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
import java.util.Date; | package net.joelinn.asana.stories;
/**
* Joe Linn
* 11/20/13
*/
@JsonRootName("data")
public class Story {
public long id;
@JsonProperty("created_at")
public Date createdAt;
@JsonProperty("created_by") | // Path: src/main/java/net/joelinn/asana/tasks/Task.java
// @JsonRootName("data")
// @JsonIgnoreProperties(ignoreUnknown=true)
// public class Task {
// public long id;
// public User assignee;
//
// @JsonProperty("assignee_status")
// public String assigneeStatus;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public boolean completed;
//
// @JsonProperty("completed_at")
// public String completedAt;
//
// @JsonProperty("due_on")
// public String dueOn;
//
// public Users followers;
//
// public boolean hearted;
//
// public Users hearts;
//
// @JsonProperty("num_hearts")
// public Integer numHearts;
//
// @JsonProperty("modified_at")
// public String modifiedAt;
//
// public String name;
// public String notes;
// public Projects projects;
// public Task parent;
// public Workspace workspace;
// public Tags tags;
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
// Path: src/main/java/net/joelinn/asana/stories/Story.java
import net.joelinn.asana.tasks.Task;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.Users;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
import java.util.Date;
package net.joelinn.asana.stories;
/**
* Joe Linn
* 11/20/13
*/
@JsonRootName("data")
public class Story {
public long id;
@JsonProperty("created_at")
public Date createdAt;
@JsonProperty("created_by") | public User createdBy; |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/stories/Story.java | // Path: src/main/java/net/joelinn/asana/tasks/Task.java
// @JsonRootName("data")
// @JsonIgnoreProperties(ignoreUnknown=true)
// public class Task {
// public long id;
// public User assignee;
//
// @JsonProperty("assignee_status")
// public String assigneeStatus;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public boolean completed;
//
// @JsonProperty("completed_at")
// public String completedAt;
//
// @JsonProperty("due_on")
// public String dueOn;
//
// public Users followers;
//
// public boolean hearted;
//
// public Users hearts;
//
// @JsonProperty("num_hearts")
// public Integer numHearts;
//
// @JsonProperty("modified_at")
// public String modifiedAt;
//
// public String name;
// public String notes;
// public Projects projects;
// public Task parent;
// public Workspace workspace;
// public Tags tags;
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
| import net.joelinn.asana.tasks.Task;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.Users;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
import java.util.Date; | package net.joelinn.asana.stories;
/**
* Joe Linn
* 11/20/13
*/
@JsonRootName("data")
public class Story {
public long id;
@JsonProperty("created_at")
public Date createdAt;
@JsonProperty("created_by")
public User createdBy;
public String text; | // Path: src/main/java/net/joelinn/asana/tasks/Task.java
// @JsonRootName("data")
// @JsonIgnoreProperties(ignoreUnknown=true)
// public class Task {
// public long id;
// public User assignee;
//
// @JsonProperty("assignee_status")
// public String assigneeStatus;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public boolean completed;
//
// @JsonProperty("completed_at")
// public String completedAt;
//
// @JsonProperty("due_on")
// public String dueOn;
//
// public Users followers;
//
// public boolean hearted;
//
// public Users hearts;
//
// @JsonProperty("num_hearts")
// public Integer numHearts;
//
// @JsonProperty("modified_at")
// public String modifiedAt;
//
// public String name;
// public String notes;
// public Projects projects;
// public Task parent;
// public Workspace workspace;
// public Tags tags;
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
// Path: src/main/java/net/joelinn/asana/stories/Story.java
import net.joelinn.asana.tasks.Task;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.Users;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
import java.util.Date;
package net.joelinn.asana.stories;
/**
* Joe Linn
* 11/20/13
*/
@JsonRootName("data")
public class Story {
public long id;
@JsonProperty("created_at")
public Date createdAt;
@JsonProperty("created_by")
public User createdBy;
public String text; | public Task target; |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/stories/Story.java | // Path: src/main/java/net/joelinn/asana/tasks/Task.java
// @JsonRootName("data")
// @JsonIgnoreProperties(ignoreUnknown=true)
// public class Task {
// public long id;
// public User assignee;
//
// @JsonProperty("assignee_status")
// public String assigneeStatus;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public boolean completed;
//
// @JsonProperty("completed_at")
// public String completedAt;
//
// @JsonProperty("due_on")
// public String dueOn;
//
// public Users followers;
//
// public boolean hearted;
//
// public Users hearts;
//
// @JsonProperty("num_hearts")
// public Integer numHearts;
//
// @JsonProperty("modified_at")
// public String modifiedAt;
//
// public String name;
// public String notes;
// public Projects projects;
// public Task parent;
// public Workspace workspace;
// public Tags tags;
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
| import net.joelinn.asana.tasks.Task;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.Users;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
import java.util.Date; | package net.joelinn.asana.stories;
/**
* Joe Linn
* 11/20/13
*/
@JsonRootName("data")
public class Story {
public long id;
@JsonProperty("created_at")
public Date createdAt;
@JsonProperty("created_by")
public User createdBy;
public String text;
public Task target;
public String source;
public String type;
public boolean hearted;
| // Path: src/main/java/net/joelinn/asana/tasks/Task.java
// @JsonRootName("data")
// @JsonIgnoreProperties(ignoreUnknown=true)
// public class Task {
// public long id;
// public User assignee;
//
// @JsonProperty("assignee_status")
// public String assigneeStatus;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public boolean completed;
//
// @JsonProperty("completed_at")
// public String completedAt;
//
// @JsonProperty("due_on")
// public String dueOn;
//
// public Users followers;
//
// public boolean hearted;
//
// public Users hearts;
//
// @JsonProperty("num_hearts")
// public Integer numHearts;
//
// @JsonProperty("modified_at")
// public String modifiedAt;
//
// public String name;
// public String notes;
// public Projects projects;
// public Task parent;
// public Workspace workspace;
// public Tags tags;
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
// Path: src/main/java/net/joelinn/asana/stories/Story.java
import net.joelinn.asana.tasks.Task;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.Users;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
import java.util.Date;
package net.joelinn.asana.stories;
/**
* Joe Linn
* 11/20/13
*/
@JsonRootName("data")
public class Story {
public long id;
@JsonProperty("created_at")
public Date createdAt;
@JsonProperty("created_by")
public User createdBy;
public String text;
public Task target;
public String source;
public String type;
public boolean hearted;
| public Users hearts; |
jlinn/asana-api-java | src/test/java/net/joelinn/asana/test/tags/TagsClientTest.java | // Path: src/main/java/net/joelinn/asana/Colors.java
// public class Colors {
// public static final String DARK_PINK = "dark-pink";
// public static final String DARK_GREEN = "dark-green";
// public static final String DARK_BLUE = "dark-blue";
// public static final String DARK_RED = "dark-red";
// public static final String DARK_TEAL = "dark-teal";
// public static final String DARK_BROWN = "dark-brown";
// public static final String DARK_ORANGE = "dark-orange";
// public static final String DARK_PURPLE = "dark-purple";
// public static final String DARK_WARM_GRAY = "dark-warm-gray";
// public static final String LIGHT_PINK = "light-pink";
// public static final String LIGHT_GREEN = "light-green";
// public static final String LIGHT_BLUE = "light-blue";
// public static final String LIGHT_RED = "light-red";
// public static final String LIGHT_TEAL = "light-teal";
// public static final String LIGHT_YELLOW = "light-yellow";
// public static final String LIGHT_ORANGE = "light-orange";
// public static final String LIGHT_PURPLE = "light-purple";
// public static final String LIGHT_WARM_GRAY = "light-warm-gray";
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tag.java
// @JsonRootName("data")
// public class Tag {
// public long id;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public Users followers;
// public String name;
// public String color;
// public String notes;
// public Workspace workspace;
// }
//
// Path: src/main/java/net/joelinn/asana/tags/TagsClient.java
// public class TagsClient extends AbstractClient{
// public TagsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public TagsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// public Tag createTag(TagsRequestBuilder builder){
// return post("", builder.build()).getEntity(Tag.class);
// }
//
// public Tag updateTag(long tagId, TagsRequestBuilder builder){
// return put(Long.toString(tagId), builder.build()).getEntity(Tag.class);
// }
//
// public Tag getTag(long tagId){
// return get(Long.toString(tagId)).getEntity(Tag.class);
// }
//
// public void deleteTag(long tagId){
// delete(Long.toString(tagId));
// }
//
// public Tags getTags(){
// return get("").getEntity(Tags.class);
// }
//
// @Override
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
// return super.request(method, "tags/" + url, queryParams, data);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/tags/TagsRequestBuilder.java
// public class TagsRequestBuilder extends AbstractRequestBuilder{
// protected MultivaluedMapImpl params = new MultivaluedMapImpl();
//
// public TagsRequestBuilder(){
//
// }
//
// public TagsRequestBuilder(long workspaceId, String name){
// workspace(workspaceId).name(name);
// }
//
// public TagsRequestBuilder workspace(long workspaceId){
// return (TagsRequestBuilder) setParam("workspace", workspaceId);
// }
//
// public TagsRequestBuilder name(String name){
// return (TagsRequestBuilder) setParam("name", name);
// }
//
// public TagsRequestBuilder color(String color){
// return (TagsRequestBuilder) setParam("color", color);
// }
//
// public TagsRequestBuilder notes(String notes){
// return (TagsRequestBuilder) setParam("notes", notes);
// }
// }
//
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
| import junit.framework.TestCase;
import net.joelinn.asana.Colors;
import net.joelinn.asana.tags.Tag;
import net.joelinn.asana.tags.TagsClient;
import net.joelinn.asana.tags.TagsRequestBuilder;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test; | package net.joelinn.asana.test.tags;
/**
* Joe Linn
* 11/20/13
*/
public class TagsClientTest extends BaseTest{
protected TagsClient client;
@Before
public void setUp(){
client = new TagsClient(getApiKey());
}
@Test
public void testTags(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
} | // Path: src/main/java/net/joelinn/asana/Colors.java
// public class Colors {
// public static final String DARK_PINK = "dark-pink";
// public static final String DARK_GREEN = "dark-green";
// public static final String DARK_BLUE = "dark-blue";
// public static final String DARK_RED = "dark-red";
// public static final String DARK_TEAL = "dark-teal";
// public static final String DARK_BROWN = "dark-brown";
// public static final String DARK_ORANGE = "dark-orange";
// public static final String DARK_PURPLE = "dark-purple";
// public static final String DARK_WARM_GRAY = "dark-warm-gray";
// public static final String LIGHT_PINK = "light-pink";
// public static final String LIGHT_GREEN = "light-green";
// public static final String LIGHT_BLUE = "light-blue";
// public static final String LIGHT_RED = "light-red";
// public static final String LIGHT_TEAL = "light-teal";
// public static final String LIGHT_YELLOW = "light-yellow";
// public static final String LIGHT_ORANGE = "light-orange";
// public static final String LIGHT_PURPLE = "light-purple";
// public static final String LIGHT_WARM_GRAY = "light-warm-gray";
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tag.java
// @JsonRootName("data")
// public class Tag {
// public long id;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public Users followers;
// public String name;
// public String color;
// public String notes;
// public Workspace workspace;
// }
//
// Path: src/main/java/net/joelinn/asana/tags/TagsClient.java
// public class TagsClient extends AbstractClient{
// public TagsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public TagsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// public Tag createTag(TagsRequestBuilder builder){
// return post("", builder.build()).getEntity(Tag.class);
// }
//
// public Tag updateTag(long tagId, TagsRequestBuilder builder){
// return put(Long.toString(tagId), builder.build()).getEntity(Tag.class);
// }
//
// public Tag getTag(long tagId){
// return get(Long.toString(tagId)).getEntity(Tag.class);
// }
//
// public void deleteTag(long tagId){
// delete(Long.toString(tagId));
// }
//
// public Tags getTags(){
// return get("").getEntity(Tags.class);
// }
//
// @Override
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
// return super.request(method, "tags/" + url, queryParams, data);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/tags/TagsRequestBuilder.java
// public class TagsRequestBuilder extends AbstractRequestBuilder{
// protected MultivaluedMapImpl params = new MultivaluedMapImpl();
//
// public TagsRequestBuilder(){
//
// }
//
// public TagsRequestBuilder(long workspaceId, String name){
// workspace(workspaceId).name(name);
// }
//
// public TagsRequestBuilder workspace(long workspaceId){
// return (TagsRequestBuilder) setParam("workspace", workspaceId);
// }
//
// public TagsRequestBuilder name(String name){
// return (TagsRequestBuilder) setParam("name", name);
// }
//
// public TagsRequestBuilder color(String color){
// return (TagsRequestBuilder) setParam("color", color);
// }
//
// public TagsRequestBuilder notes(String notes){
// return (TagsRequestBuilder) setParam("notes", notes);
// }
// }
//
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
// Path: src/test/java/net/joelinn/asana/test/tags/TagsClientTest.java
import junit.framework.TestCase;
import net.joelinn.asana.Colors;
import net.joelinn.asana.tags.Tag;
import net.joelinn.asana.tags.TagsClient;
import net.joelinn.asana.tags.TagsRequestBuilder;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test;
package net.joelinn.asana.test.tags;
/**
* Joe Linn
* 11/20/13
*/
public class TagsClientTest extends BaseTest{
protected TagsClient client;
@Before
public void setUp(){
client = new TagsClient(getApiKey());
}
@Test
public void testTags(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
} | Tag tag = client.createTag(new TagsRequestBuilder(4440299545542L, "test tag").color(Colors.DARK_BLUE)); |
jlinn/asana-api-java | src/test/java/net/joelinn/asana/test/tags/TagsClientTest.java | // Path: src/main/java/net/joelinn/asana/Colors.java
// public class Colors {
// public static final String DARK_PINK = "dark-pink";
// public static final String DARK_GREEN = "dark-green";
// public static final String DARK_BLUE = "dark-blue";
// public static final String DARK_RED = "dark-red";
// public static final String DARK_TEAL = "dark-teal";
// public static final String DARK_BROWN = "dark-brown";
// public static final String DARK_ORANGE = "dark-orange";
// public static final String DARK_PURPLE = "dark-purple";
// public static final String DARK_WARM_GRAY = "dark-warm-gray";
// public static final String LIGHT_PINK = "light-pink";
// public static final String LIGHT_GREEN = "light-green";
// public static final String LIGHT_BLUE = "light-blue";
// public static final String LIGHT_RED = "light-red";
// public static final String LIGHT_TEAL = "light-teal";
// public static final String LIGHT_YELLOW = "light-yellow";
// public static final String LIGHT_ORANGE = "light-orange";
// public static final String LIGHT_PURPLE = "light-purple";
// public static final String LIGHT_WARM_GRAY = "light-warm-gray";
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tag.java
// @JsonRootName("data")
// public class Tag {
// public long id;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public Users followers;
// public String name;
// public String color;
// public String notes;
// public Workspace workspace;
// }
//
// Path: src/main/java/net/joelinn/asana/tags/TagsClient.java
// public class TagsClient extends AbstractClient{
// public TagsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public TagsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// public Tag createTag(TagsRequestBuilder builder){
// return post("", builder.build()).getEntity(Tag.class);
// }
//
// public Tag updateTag(long tagId, TagsRequestBuilder builder){
// return put(Long.toString(tagId), builder.build()).getEntity(Tag.class);
// }
//
// public Tag getTag(long tagId){
// return get(Long.toString(tagId)).getEntity(Tag.class);
// }
//
// public void deleteTag(long tagId){
// delete(Long.toString(tagId));
// }
//
// public Tags getTags(){
// return get("").getEntity(Tags.class);
// }
//
// @Override
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
// return super.request(method, "tags/" + url, queryParams, data);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/tags/TagsRequestBuilder.java
// public class TagsRequestBuilder extends AbstractRequestBuilder{
// protected MultivaluedMapImpl params = new MultivaluedMapImpl();
//
// public TagsRequestBuilder(){
//
// }
//
// public TagsRequestBuilder(long workspaceId, String name){
// workspace(workspaceId).name(name);
// }
//
// public TagsRequestBuilder workspace(long workspaceId){
// return (TagsRequestBuilder) setParam("workspace", workspaceId);
// }
//
// public TagsRequestBuilder name(String name){
// return (TagsRequestBuilder) setParam("name", name);
// }
//
// public TagsRequestBuilder color(String color){
// return (TagsRequestBuilder) setParam("color", color);
// }
//
// public TagsRequestBuilder notes(String notes){
// return (TagsRequestBuilder) setParam("notes", notes);
// }
// }
//
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
| import junit.framework.TestCase;
import net.joelinn.asana.Colors;
import net.joelinn.asana.tags.Tag;
import net.joelinn.asana.tags.TagsClient;
import net.joelinn.asana.tags.TagsRequestBuilder;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test; | package net.joelinn.asana.test.tags;
/**
* Joe Linn
* 11/20/13
*/
public class TagsClientTest extends BaseTest{
protected TagsClient client;
@Before
public void setUp(){
client = new TagsClient(getApiKey());
}
@Test
public void testTags(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
} | // Path: src/main/java/net/joelinn/asana/Colors.java
// public class Colors {
// public static final String DARK_PINK = "dark-pink";
// public static final String DARK_GREEN = "dark-green";
// public static final String DARK_BLUE = "dark-blue";
// public static final String DARK_RED = "dark-red";
// public static final String DARK_TEAL = "dark-teal";
// public static final String DARK_BROWN = "dark-brown";
// public static final String DARK_ORANGE = "dark-orange";
// public static final String DARK_PURPLE = "dark-purple";
// public static final String DARK_WARM_GRAY = "dark-warm-gray";
// public static final String LIGHT_PINK = "light-pink";
// public static final String LIGHT_GREEN = "light-green";
// public static final String LIGHT_BLUE = "light-blue";
// public static final String LIGHT_RED = "light-red";
// public static final String LIGHT_TEAL = "light-teal";
// public static final String LIGHT_YELLOW = "light-yellow";
// public static final String LIGHT_ORANGE = "light-orange";
// public static final String LIGHT_PURPLE = "light-purple";
// public static final String LIGHT_WARM_GRAY = "light-warm-gray";
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tag.java
// @JsonRootName("data")
// public class Tag {
// public long id;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public Users followers;
// public String name;
// public String color;
// public String notes;
// public Workspace workspace;
// }
//
// Path: src/main/java/net/joelinn/asana/tags/TagsClient.java
// public class TagsClient extends AbstractClient{
// public TagsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public TagsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// public Tag createTag(TagsRequestBuilder builder){
// return post("", builder.build()).getEntity(Tag.class);
// }
//
// public Tag updateTag(long tagId, TagsRequestBuilder builder){
// return put(Long.toString(tagId), builder.build()).getEntity(Tag.class);
// }
//
// public Tag getTag(long tagId){
// return get(Long.toString(tagId)).getEntity(Tag.class);
// }
//
// public void deleteTag(long tagId){
// delete(Long.toString(tagId));
// }
//
// public Tags getTags(){
// return get("").getEntity(Tags.class);
// }
//
// @Override
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
// return super.request(method, "tags/" + url, queryParams, data);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/tags/TagsRequestBuilder.java
// public class TagsRequestBuilder extends AbstractRequestBuilder{
// protected MultivaluedMapImpl params = new MultivaluedMapImpl();
//
// public TagsRequestBuilder(){
//
// }
//
// public TagsRequestBuilder(long workspaceId, String name){
// workspace(workspaceId).name(name);
// }
//
// public TagsRequestBuilder workspace(long workspaceId){
// return (TagsRequestBuilder) setParam("workspace", workspaceId);
// }
//
// public TagsRequestBuilder name(String name){
// return (TagsRequestBuilder) setParam("name", name);
// }
//
// public TagsRequestBuilder color(String color){
// return (TagsRequestBuilder) setParam("color", color);
// }
//
// public TagsRequestBuilder notes(String notes){
// return (TagsRequestBuilder) setParam("notes", notes);
// }
// }
//
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
// Path: src/test/java/net/joelinn/asana/test/tags/TagsClientTest.java
import junit.framework.TestCase;
import net.joelinn.asana.Colors;
import net.joelinn.asana.tags.Tag;
import net.joelinn.asana.tags.TagsClient;
import net.joelinn.asana.tags.TagsRequestBuilder;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test;
package net.joelinn.asana.test.tags;
/**
* Joe Linn
* 11/20/13
*/
public class TagsClientTest extends BaseTest{
protected TagsClient client;
@Before
public void setUp(){
client = new TagsClient(getApiKey());
}
@Test
public void testTags(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
} | Tag tag = client.createTag(new TagsRequestBuilder(4440299545542L, "test tag").color(Colors.DARK_BLUE)); |
jlinn/asana-api-java | src/test/java/net/joelinn/asana/test/tags/TagsClientTest.java | // Path: src/main/java/net/joelinn/asana/Colors.java
// public class Colors {
// public static final String DARK_PINK = "dark-pink";
// public static final String DARK_GREEN = "dark-green";
// public static final String DARK_BLUE = "dark-blue";
// public static final String DARK_RED = "dark-red";
// public static final String DARK_TEAL = "dark-teal";
// public static final String DARK_BROWN = "dark-brown";
// public static final String DARK_ORANGE = "dark-orange";
// public static final String DARK_PURPLE = "dark-purple";
// public static final String DARK_WARM_GRAY = "dark-warm-gray";
// public static final String LIGHT_PINK = "light-pink";
// public static final String LIGHT_GREEN = "light-green";
// public static final String LIGHT_BLUE = "light-blue";
// public static final String LIGHT_RED = "light-red";
// public static final String LIGHT_TEAL = "light-teal";
// public static final String LIGHT_YELLOW = "light-yellow";
// public static final String LIGHT_ORANGE = "light-orange";
// public static final String LIGHT_PURPLE = "light-purple";
// public static final String LIGHT_WARM_GRAY = "light-warm-gray";
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tag.java
// @JsonRootName("data")
// public class Tag {
// public long id;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public Users followers;
// public String name;
// public String color;
// public String notes;
// public Workspace workspace;
// }
//
// Path: src/main/java/net/joelinn/asana/tags/TagsClient.java
// public class TagsClient extends AbstractClient{
// public TagsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public TagsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// public Tag createTag(TagsRequestBuilder builder){
// return post("", builder.build()).getEntity(Tag.class);
// }
//
// public Tag updateTag(long tagId, TagsRequestBuilder builder){
// return put(Long.toString(tagId), builder.build()).getEntity(Tag.class);
// }
//
// public Tag getTag(long tagId){
// return get(Long.toString(tagId)).getEntity(Tag.class);
// }
//
// public void deleteTag(long tagId){
// delete(Long.toString(tagId));
// }
//
// public Tags getTags(){
// return get("").getEntity(Tags.class);
// }
//
// @Override
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
// return super.request(method, "tags/" + url, queryParams, data);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/tags/TagsRequestBuilder.java
// public class TagsRequestBuilder extends AbstractRequestBuilder{
// protected MultivaluedMapImpl params = new MultivaluedMapImpl();
//
// public TagsRequestBuilder(){
//
// }
//
// public TagsRequestBuilder(long workspaceId, String name){
// workspace(workspaceId).name(name);
// }
//
// public TagsRequestBuilder workspace(long workspaceId){
// return (TagsRequestBuilder) setParam("workspace", workspaceId);
// }
//
// public TagsRequestBuilder name(String name){
// return (TagsRequestBuilder) setParam("name", name);
// }
//
// public TagsRequestBuilder color(String color){
// return (TagsRequestBuilder) setParam("color", color);
// }
//
// public TagsRequestBuilder notes(String notes){
// return (TagsRequestBuilder) setParam("notes", notes);
// }
// }
//
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
| import junit.framework.TestCase;
import net.joelinn.asana.Colors;
import net.joelinn.asana.tags.Tag;
import net.joelinn.asana.tags.TagsClient;
import net.joelinn.asana.tags.TagsRequestBuilder;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test; | package net.joelinn.asana.test.tags;
/**
* Joe Linn
* 11/20/13
*/
public class TagsClientTest extends BaseTest{
protected TagsClient client;
@Before
public void setUp(){
client = new TagsClient(getApiKey());
}
@Test
public void testTags(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
} | // Path: src/main/java/net/joelinn/asana/Colors.java
// public class Colors {
// public static final String DARK_PINK = "dark-pink";
// public static final String DARK_GREEN = "dark-green";
// public static final String DARK_BLUE = "dark-blue";
// public static final String DARK_RED = "dark-red";
// public static final String DARK_TEAL = "dark-teal";
// public static final String DARK_BROWN = "dark-brown";
// public static final String DARK_ORANGE = "dark-orange";
// public static final String DARK_PURPLE = "dark-purple";
// public static final String DARK_WARM_GRAY = "dark-warm-gray";
// public static final String LIGHT_PINK = "light-pink";
// public static final String LIGHT_GREEN = "light-green";
// public static final String LIGHT_BLUE = "light-blue";
// public static final String LIGHT_RED = "light-red";
// public static final String LIGHT_TEAL = "light-teal";
// public static final String LIGHT_YELLOW = "light-yellow";
// public static final String LIGHT_ORANGE = "light-orange";
// public static final String LIGHT_PURPLE = "light-purple";
// public static final String LIGHT_WARM_GRAY = "light-warm-gray";
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tag.java
// @JsonRootName("data")
// public class Tag {
// public long id;
//
// @JsonProperty("created_at")
// public String createdAt;
//
// public Users followers;
// public String name;
// public String color;
// public String notes;
// public Workspace workspace;
// }
//
// Path: src/main/java/net/joelinn/asana/tags/TagsClient.java
// public class TagsClient extends AbstractClient{
// public TagsClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public TagsClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// public Tag createTag(TagsRequestBuilder builder){
// return post("", builder.build()).getEntity(Tag.class);
// }
//
// public Tag updateTag(long tagId, TagsRequestBuilder builder){
// return put(Long.toString(tagId), builder.build()).getEntity(Tag.class);
// }
//
// public Tag getTag(long tagId){
// return get(Long.toString(tagId)).getEntity(Tag.class);
// }
//
// public void deleteTag(long tagId){
// delete(Long.toString(tagId));
// }
//
// public Tags getTags(){
// return get("").getEntity(Tags.class);
// }
//
// @Override
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data) {
// return super.request(method, "tags/" + url, queryParams, data);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/tags/TagsRequestBuilder.java
// public class TagsRequestBuilder extends AbstractRequestBuilder{
// protected MultivaluedMapImpl params = new MultivaluedMapImpl();
//
// public TagsRequestBuilder(){
//
// }
//
// public TagsRequestBuilder(long workspaceId, String name){
// workspace(workspaceId).name(name);
// }
//
// public TagsRequestBuilder workspace(long workspaceId){
// return (TagsRequestBuilder) setParam("workspace", workspaceId);
// }
//
// public TagsRequestBuilder name(String name){
// return (TagsRequestBuilder) setParam("name", name);
// }
//
// public TagsRequestBuilder color(String color){
// return (TagsRequestBuilder) setParam("color", color);
// }
//
// public TagsRequestBuilder notes(String notes){
// return (TagsRequestBuilder) setParam("notes", notes);
// }
// }
//
// Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
// Path: src/test/java/net/joelinn/asana/test/tags/TagsClientTest.java
import junit.framework.TestCase;
import net.joelinn.asana.Colors;
import net.joelinn.asana.tags.Tag;
import net.joelinn.asana.tags.TagsClient;
import net.joelinn.asana.tags.TagsRequestBuilder;
import net.joelinn.asana.test.BaseTest;
import org.junit.Before;
import org.junit.Test;
package net.joelinn.asana.test.tags;
/**
* Joe Linn
* 11/20/13
*/
public class TagsClientTest extends BaseTest{
protected TagsClient client;
@Before
public void setUp(){
client = new TagsClient(getApiKey());
}
@Test
public void testTags(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
} | Tag tag = client.createTag(new TagsRequestBuilder(4440299545542L, "test tag").color(Colors.DARK_BLUE)); |
jlinn/asana-api-java | src/test/java/net/joelinn/asana/test/users/UsersClientTest.java | // Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/UsersClient.java
// public class UsersClient extends AbstractClient {
// public UsersClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public UsersClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// /**
// * Retrieve a specific user
// * @param userId the id of the user to be retrieved
// * @return a User object
// */
// public User getUser(long userId){
// return getUser(Long.toString(userId));
// }
//
// /**
// * Retrieve a specific user
// * @param userId the id of the user to be retrieved
// * @return a User object
// */
// public User getUser(String userId){
// return get(String.format("users/%s", userId)).getEntity(User.class);
// }
//
// /**
// * Retrieve the user associated with the api key currently in use
// * @return a User object
// */
// public User getMe(){
// return getUser("me");
// }
//
// /**
// * Retrieve all users in all workspaces visible to the user associated with the api key currently in use
// * @return a list of User objects
// */
// public Users getUsers(){
// //return get("users").getEntity(new GenericType<List<User>>(){});
// return get("users").getEntity(Users.class);
// }
// }
| import junit.framework.TestCase;
import net.joelinn.asana.test.BaseTest;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.UsersClient;
import org.junit.Before;
import org.junit.Test;
import java.util.List; | package net.joelinn.asana.test.users;
/**
* Joe Linn
* 11/16/13
*/
public class UsersClientTest extends BaseTest{
protected UsersClient client;
@Before
public void setUp(){
client = new UsersClient(getApiKey());
}
@Test
public void testGet(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
} | // Path: src/test/java/net/joelinn/asana/test/BaseTest.java
// public abstract class BaseTest {
// protected String getApiKey(){
// return ""; //enter your api key here to run the tests
// }
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/UsersClient.java
// public class UsersClient extends AbstractClient {
// public UsersClient(String apiKey) {
// super(apiKey);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public UsersClient(String apiKey, int connectionTimeout, int readTimeout) {
// super(apiKey, connectionTimeout, readTimeout);
// }
//
// /**
// * Retrieve a specific user
// * @param userId the id of the user to be retrieved
// * @return a User object
// */
// public User getUser(long userId){
// return getUser(Long.toString(userId));
// }
//
// /**
// * Retrieve a specific user
// * @param userId the id of the user to be retrieved
// * @return a User object
// */
// public User getUser(String userId){
// return get(String.format("users/%s", userId)).getEntity(User.class);
// }
//
// /**
// * Retrieve the user associated with the api key currently in use
// * @return a User object
// */
// public User getMe(){
// return getUser("me");
// }
//
// /**
// * Retrieve all users in all workspaces visible to the user associated with the api key currently in use
// * @return a list of User objects
// */
// public Users getUsers(){
// //return get("users").getEntity(new GenericType<List<User>>(){});
// return get("users").getEntity(Users.class);
// }
// }
// Path: src/test/java/net/joelinn/asana/test/users/UsersClientTest.java
import junit.framework.TestCase;
import net.joelinn.asana.test.BaseTest;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.UsersClient;
import org.junit.Before;
import org.junit.Test;
import java.util.List;
package net.joelinn.asana.test.users;
/**
* Joe Linn
* 11/16/13
*/
public class UsersClientTest extends BaseTest{
protected UsersClient client;
@Before
public void setUp(){
client = new UsersClient(getApiKey());
}
@Test
public void testGet(){
if(getApiKey().equals("")){
// skip the test if no api key has been provided
return;
} | User me = client.getMe(); |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/tasks/Task.java | // Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
| import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
import org.codehaus.jackson.annotate.JsonIgnoreProperties; | package net.joelinn.asana.tasks;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
@JsonIgnoreProperties(ignoreUnknown=true)
public class Task {
public long id; | // Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
// Path: src/main/java/net/joelinn/asana/tasks/Task.java
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
package net.joelinn.asana.tasks;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
@JsonIgnoreProperties(ignoreUnknown=true)
public class Task {
public long id; | public User assignee; |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/tasks/Task.java | // Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
| import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
import org.codehaus.jackson.annotate.JsonIgnoreProperties; | package net.joelinn.asana.tasks;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
@JsonIgnoreProperties(ignoreUnknown=true)
public class Task {
public long id;
public User assignee;
@JsonProperty("assignee_status")
public String assigneeStatus;
@JsonProperty("created_at")
public String createdAt;
public boolean completed;
@JsonProperty("completed_at")
public String completedAt;
@JsonProperty("due_on")
public String dueOn;
| // Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
// Path: src/main/java/net/joelinn/asana/tasks/Task.java
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
package net.joelinn.asana.tasks;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
@JsonIgnoreProperties(ignoreUnknown=true)
public class Task {
public long id;
public User assignee;
@JsonProperty("assignee_status")
public String assigneeStatus;
@JsonProperty("created_at")
public String createdAt;
public boolean completed;
@JsonProperty("completed_at")
public String completedAt;
@JsonProperty("due_on")
public String dueOn;
| public Users followers; |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/tasks/Task.java | // Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
| import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
import org.codehaus.jackson.annotate.JsonIgnoreProperties; | package net.joelinn.asana.tasks;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
@JsonIgnoreProperties(ignoreUnknown=true)
public class Task {
public long id;
public User assignee;
@JsonProperty("assignee_status")
public String assigneeStatus;
@JsonProperty("created_at")
public String createdAt;
public boolean completed;
@JsonProperty("completed_at")
public String completedAt;
@JsonProperty("due_on")
public String dueOn;
public Users followers;
public boolean hearted;
public Users hearts;
@JsonProperty("num_hearts")
public Integer numHearts;
@JsonProperty("modified_at")
public String modifiedAt;
public String name;
public String notes; | // Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
// Path: src/main/java/net/joelinn/asana/tasks/Task.java
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
package net.joelinn.asana.tasks;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
@JsonIgnoreProperties(ignoreUnknown=true)
public class Task {
public long id;
public User assignee;
@JsonProperty("assignee_status")
public String assigneeStatus;
@JsonProperty("created_at")
public String createdAt;
public boolean completed;
@JsonProperty("completed_at")
public String completedAt;
@JsonProperty("due_on")
public String dueOn;
public Users followers;
public boolean hearted;
public Users hearts;
@JsonProperty("num_hearts")
public Integer numHearts;
@JsonProperty("modified_at")
public String modifiedAt;
public String name;
public String notes; | public Projects projects; |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/tasks/Task.java | // Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
| import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
import org.codehaus.jackson.annotate.JsonIgnoreProperties; | package net.joelinn.asana.tasks;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
@JsonIgnoreProperties(ignoreUnknown=true)
public class Task {
public long id;
public User assignee;
@JsonProperty("assignee_status")
public String assigneeStatus;
@JsonProperty("created_at")
public String createdAt;
public boolean completed;
@JsonProperty("completed_at")
public String completedAt;
@JsonProperty("due_on")
public String dueOn;
public Users followers;
public boolean hearted;
public Users hearts;
@JsonProperty("num_hearts")
public Integer numHearts;
@JsonProperty("modified_at")
public String modifiedAt;
public String name;
public String notes;
public Projects projects;
public Task parent; | // Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
// Path: src/main/java/net/joelinn/asana/tasks/Task.java
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
package net.joelinn.asana.tasks;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
@JsonIgnoreProperties(ignoreUnknown=true)
public class Task {
public long id;
public User assignee;
@JsonProperty("assignee_status")
public String assigneeStatus;
@JsonProperty("created_at")
public String createdAt;
public boolean completed;
@JsonProperty("completed_at")
public String completedAt;
@JsonProperty("due_on")
public String dueOn;
public Users followers;
public boolean hearted;
public Users hearts;
@JsonProperty("num_hearts")
public Integer numHearts;
@JsonProperty("modified_at")
public String modifiedAt;
public String name;
public String notes;
public Projects projects;
public Task parent; | public Workspace workspace; |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/tasks/Task.java | // Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
| import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
import org.codehaus.jackson.annotate.JsonIgnoreProperties; | package net.joelinn.asana.tasks;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
@JsonIgnoreProperties(ignoreUnknown=true)
public class Task {
public long id;
public User assignee;
@JsonProperty("assignee_status")
public String assigneeStatus;
@JsonProperty("created_at")
public String createdAt;
public boolean completed;
@JsonProperty("completed_at")
public String completedAt;
@JsonProperty("due_on")
public String dueOn;
public Users followers;
public boolean hearted;
public Users hearts;
@JsonProperty("num_hearts")
public Integer numHearts;
@JsonProperty("modified_at")
public String modifiedAt;
public String name;
public String notes;
public Projects projects;
public Task parent;
public Workspace workspace; | // Path: src/main/java/net/joelinn/asana/projects/Projects.java
// @JsonRootName("data")
// public class Projects extends ArrayList<Project>{
// }
//
// Path: src/main/java/net/joelinn/asana/tags/Tags.java
// @JsonRootName("data")
// public class Tags extends ArrayList<Tag>{
// }
//
// Path: src/main/java/net/joelinn/asana/users/User.java
// @JsonRootName("data")
// public class User {
// public long id;
// public String name;
// public String email;
// public Map<String, String> photo;
// public List<Workspace> workspaces;
// }
//
// Path: src/main/java/net/joelinn/asana/users/Users.java
// @JsonRootName("data")
// public class Users extends ArrayList<User>{
//
// }
//
// Path: src/main/java/net/joelinn/asana/workspaces/Workspace.java
// @JsonRootName("data")
// public class Workspace {
// public long id;
// public String name;
// public boolean isOrganization;
// }
// Path: src/main/java/net/joelinn/asana/tasks/Task.java
import net.joelinn.asana.projects.Projects;
import net.joelinn.asana.tags.Tags;
import net.joelinn.asana.users.User;
import net.joelinn.asana.users.Users;
import net.joelinn.asana.workspaces.Workspace;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonRootName;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
package net.joelinn.asana.tasks;
/**
* Joe Linn
* 11/17/13
*/
@JsonRootName("data")
@JsonIgnoreProperties(ignoreUnknown=true)
public class Task {
public long id;
public User assignee;
@JsonProperty("assignee_status")
public String assigneeStatus;
@JsonProperty("created_at")
public String createdAt;
public boolean completed;
@JsonProperty("completed_at")
public String completedAt;
@JsonProperty("due_on")
public String dueOn;
public Users followers;
public boolean hearted;
public Users hearts;
@JsonProperty("num_hearts")
public Integer numHearts;
@JsonProperty("modified_at")
public String modifiedAt;
public String name;
public String notes;
public Projects projects;
public Task parent;
public Workspace workspace; | public Tags tags; |
jlinn/asana-api-java | src/main/java/net/joelinn/asana/projects/ProjectsClient.java | // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/tasks/Tasks.java
// @JsonRootName("data")
// public class Tasks extends ArrayList<Task>{
// }
| import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.tasks.Tasks; | package net.joelinn.asana.projects;
/**
* Joe Linn
* 11/20/13
* @see <a href="http://developer.asana.com/documentation/#projects">http://developer.asana.com/documentation/#projects</a>
*/
public class ProjectsClient extends AbstractClient{
public ProjectsClient(String apiKey) {
super(apiKey);
}
/**
* @param apiKey your Asana API key
* @param connectionTimeout the connection timeout in MILLISECONDS
* @param readTimeout the read timeout in MILLISECONDS
*/
public ProjectsClient(String apiKey, int connectionTimeout, int readTimeout) {
super(apiKey, connectionTimeout, readTimeout);
}
public Project createProject(ProjectRequestBuilder builder){
return post("", builder.build()).getEntity(Project.class);
}
public Project updateProject(long projectId, ProjectRequestBuilder builder){
return put(Long.toString(projectId), builder.build()).getEntity(Project.class);
}
public Project getProject(long projectId){
return get(Long.toString(projectId)).getEntity(Project.class);
}
public void deleteProject(long projectId){
delete(Long.toString(projectId));
}
| // Path: src/main/java/net/joelinn/asana/AbstractClient.java
// public abstract class AbstractClient {
// public static final String BASE_URL = "https://app.asana.com/api/1.0/";
//
// protected String apiKey;
//
// protected WebResource service;
//
// public AbstractClient(String apiKey){
// this(apiKey, 0, 0);
// }
//
// /**
// * @param apiKey your Asana API key
// * @param connectionTimeout the connection timeout in MILLISECONDS
// * @param readTimeout the read timeout in MILLISECONDS
// */
// public AbstractClient(String apiKey, int connectionTimeout, int readTimeout){
// this.apiKey = apiKey;
//
// ClientConfig config = new DefaultClientConfig();
// ObjectMapper mapper = new ObjectMapper();
// mapper.configure(DeserializationConfig.Feature.UNWRAP_ROOT_VALUE, true);
// mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// JacksonJsonProvider provider = new JacksonJsonProvider(mapper);
// config.getSingletons().add(provider);
// //config.getClasses().add(JacksonJsonProvider.class);
// Client client = Client.create(config);
// client.addFilter(new HTTPBasicAuthFilter(apiKey, ""));
// client.setConnectTimeout(connectionTimeout);
// client.setReadTimeout(readTimeout);
// service = client.resource(UriBuilder.fromUri(BASE_URL).build());
// }
//
// protected ClientResponse get(String url){
// return get(url, null);
// }
//
// protected ClientResponse get(String url, MultivaluedMapImpl queryParams){
// return request("GET", url, queryParams);
// }
//
// protected ClientResponse post(String url, MultivaluedMapImpl data){
// return request("POST", url, null, data);
// }
//
// protected ClientResponse put(String url, MultivaluedMapImpl data){
// return request("PUT", url, null, data);
// }
//
// protected ClientResponse delete(String url){
// return request("DELETE", url);
// }
//
// protected ClientResponse request(String method, String url){
// return request(method, url, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams){
// return request(method, url, queryParams, null);
// }
//
// protected ClientResponse request(String method, String url, MultivaluedMapImpl queryParams, MultivaluedMapImpl data){
// ClientResponse clientResponse = getResourceBuilder(url, queryParams).method(method, ClientResponse.class, data);
// checkForErrors(clientResponse);
// return clientResponse;
// }
//
// private void checkForErrors(ClientResponse clientResponse){
// if(clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.OK.getStatusCode()
// && clientResponse.getClientResponseStatus().getStatusCode() != ClientResponse.Status.CREATED.getStatusCode()){
// throw new ApiException(clientResponse.getClientResponseStatus(), clientResponse.getEntity(Errors.class).get(0).message);
// }
// }
//
// private WebResource.Builder getResourceBuilder(String url, MultivaluedMapImpl queryParams){
// WebResource webResource = service.path(url);
// if(queryParams != null){
// webResource = webResource.queryParams(queryParams);
// }
// return webResource.accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_FORM_URLENCODED);
// }
// }
//
// Path: src/main/java/net/joelinn/asana/tasks/Tasks.java
// @JsonRootName("data")
// public class Tasks extends ArrayList<Task>{
// }
// Path: src/main/java/net/joelinn/asana/projects/ProjectsClient.java
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.core.util.MultivaluedMapImpl;
import net.joelinn.asana.AbstractClient;
import net.joelinn.asana.tasks.Tasks;
package net.joelinn.asana.projects;
/**
* Joe Linn
* 11/20/13
* @see <a href="http://developer.asana.com/documentation/#projects">http://developer.asana.com/documentation/#projects</a>
*/
public class ProjectsClient extends AbstractClient{
public ProjectsClient(String apiKey) {
super(apiKey);
}
/**
* @param apiKey your Asana API key
* @param connectionTimeout the connection timeout in MILLISECONDS
* @param readTimeout the read timeout in MILLISECONDS
*/
public ProjectsClient(String apiKey, int connectionTimeout, int readTimeout) {
super(apiKey, connectionTimeout, readTimeout);
}
public Project createProject(ProjectRequestBuilder builder){
return post("", builder.build()).getEntity(Project.class);
}
public Project updateProject(long projectId, ProjectRequestBuilder builder){
return put(Long.toString(projectId), builder.build()).getEntity(Project.class);
}
public Project getProject(long projectId){
return get(Long.toString(projectId)).getEntity(Project.class);
}
public void deleteProject(long projectId){
delete(Long.toString(projectId));
}
| public Tasks getExpandedTasks (long projectId) { |
vjurenka/BWMirror-Generator | src/generator/java/EnumMirror.java | // Path: src/c/CDeclaration.java
// public interface CDeclaration {
// public String getName();
// public DeclarationType getDeclType();
// public void setJavadoc(String string);
// public String getJavadoc();
//
// }
//
// Path: src/c/CEnum.java
// public interface CEnum extends CDeclaration{
//
// public List<EnumValue> getValues();
//
// public String getNameSpaceName();
//
// public String getFullName();
// }
//
// Path: src/c/EnumValue.java
// public class EnumValue extends Pair<String, Integer> {
// public EnumValue(String first, Integer second) {
// super(first, second);
// }
// }
//
// Path: src/generator/MirrorContext.java
// public class MirrorContext {
//
// private String packageName;
//
// private HashMap<String, String> cToJavaTypes = new HashMap<>();
//
// private List<String> additionalImports = new ArrayList<>();
//
// public MirrorContext() {
// cToJavaTypes.put("bool", "boolean");
// cToJavaTypes.put("int", "int");
// cToJavaTypes.put("string", "String");
// }
//
// public void setPackage(String packageName) {
// this.packageName = packageName;
// }
//
//
// public String getPackage() {
// return packageName;
// }
//
// public String getPackageDirs() {
// return getPackage().replaceAll("\\.", "/");
// }
//
// @SuppressWarnings("ResultOfMethodCallIgnored")
// public void prepareWrite(File root) {
// File dir = new File(root, getPackageDirs());
// dir.mkdirs();
// }
//
// private boolean isCollection(String cType) {
// return cType.startsWith("set<") || cType.startsWith("vector<");
// }
//
// private boolean isMap(String cType) {
// return cType.startsWith("map<");
// }
//
// private boolean isPair(String cType) {
// return cType.startsWith("pair<");
// }
//
// private boolean isDeque(String cType) {
// return cType.endsWith("::list");
// }
//
// private boolean isBWAPI4Collection(String cType) {
// return cType.endsWith("set");
// }
//
// private String convertPrimitive(String cType) {
// if (cType.equals("int")) {
// return "Integer";
// }
// if (cType.equals("bool")) {
// return "Boolean";
// }
// if (cType.equals("double")) {
// return "Double";
// }
//
// return cType;
// }
//
// private String extractPair(String cType) {
// cType = cType.substring(cType.indexOf("<") + 1, cType.lastIndexOf(">")).trim();
// String[] types = cType.split(",");
// return convertPrimitive(toJavaType(types[0].trim())) + ", " + convertPrimitive(toJavaType(types[1].trim()));
// }
//
//
// private String extractCollectionGeneric(String cType) {
// if(cType.contains("<")){
// cType = cType.substring(cType.indexOf("<") + 1, cType.lastIndexOf(">")).trim();
// }
// if(cType.endsWith("::list")) {
// cType = cType.substring(0, cType.lastIndexOf("::"));
// }
//
// if (cType.contains(":")) {
// cType = cType.substring(cType.lastIndexOf(":") + 1);
// }
// if (cType.endsWith("*")) {
// cType = cType.substring(0, cType.lastIndexOf("*"));
// }
//
//
// return cType;
// }
//
// private String extractBWAPI4CollectionGeneric(String cType) {
// cType = cType.substring(0, cType.length() - 3);
// return cType;
// }
//
//
// public String toJavaType(String cType) {
// if (isDeque(cType)) {
// return "List<" + extractCollectionGeneric(cType) + ">";
// }
// if (isCollection(cType)) {
// return "List<" + extractCollectionGeneric(cType) + ">";
// }
// if (isBWAPI4Collection(cType)) {
// return "List<" + extractBWAPI4CollectionGeneric(cType) + ">";
// }
// if (isMap(cType)) {
// return "Map<" + extractPair(cType) + ">";
// }
// if (isPair(cType)) {
// return "Pair<" + extractPair(cType) + ">";
// }
// String result = cToJavaTypes.get(cType);
// if (result == null) {
// result = cType;
// }
// int ddIndex;
// if ((ddIndex = result.lastIndexOf(':')) != -1) {
// result = result.substring(ddIndex + 1);
// }
// if (result.endsWith("*")) {
// return result.substring(0, result.length() - 1);
// }
// /*if (CJavaPipeline.BWAPI_VERSION == CJavaPipeline.BWAPI_V4 && cType.contains("bwapi.")) {
// cType = cType.replace("bwapi.", "bwapi4.");
// } */
// return result;
// }
//
// public List<String> getAdditionalImports() {
// return additionalImports;
// }
//
// public void setAdditionalImports(List<String> additionalImports) {
// this.additionalImports = additionalImports;
// }
// }
| import c.CDeclaration;
import c.CEnum;
import c.EnumValue;
import generator.MirrorContext;
import java.io.File;
import java.io.PrintStream;
import java.util.List; | package generator.java;
/**
* User: PC
* Date: 14. 6. 2014
* Time: 14:27
*/
public class EnumMirror extends Mirror {
private CEnum cEnum;
public EnumMirror(CEnum cEnum) {
this.cEnum = cEnum;
}
protected void writePackage() {
if (cEnum.getNameSpaceName() == null) {
super.writePackage();
return;
}
out.println("package" + SPACE + context.getPackage() + "." + cEnum.getNameSpaceName() + SEMICOLON);
out.println();
}
| // Path: src/c/CDeclaration.java
// public interface CDeclaration {
// public String getName();
// public DeclarationType getDeclType();
// public void setJavadoc(String string);
// public String getJavadoc();
//
// }
//
// Path: src/c/CEnum.java
// public interface CEnum extends CDeclaration{
//
// public List<EnumValue> getValues();
//
// public String getNameSpaceName();
//
// public String getFullName();
// }
//
// Path: src/c/EnumValue.java
// public class EnumValue extends Pair<String, Integer> {
// public EnumValue(String first, Integer second) {
// super(first, second);
// }
// }
//
// Path: src/generator/MirrorContext.java
// public class MirrorContext {
//
// private String packageName;
//
// private HashMap<String, String> cToJavaTypes = new HashMap<>();
//
// private List<String> additionalImports = new ArrayList<>();
//
// public MirrorContext() {
// cToJavaTypes.put("bool", "boolean");
// cToJavaTypes.put("int", "int");
// cToJavaTypes.put("string", "String");
// }
//
// public void setPackage(String packageName) {
// this.packageName = packageName;
// }
//
//
// public String getPackage() {
// return packageName;
// }
//
// public String getPackageDirs() {
// return getPackage().replaceAll("\\.", "/");
// }
//
// @SuppressWarnings("ResultOfMethodCallIgnored")
// public void prepareWrite(File root) {
// File dir = new File(root, getPackageDirs());
// dir.mkdirs();
// }
//
// private boolean isCollection(String cType) {
// return cType.startsWith("set<") || cType.startsWith("vector<");
// }
//
// private boolean isMap(String cType) {
// return cType.startsWith("map<");
// }
//
// private boolean isPair(String cType) {
// return cType.startsWith("pair<");
// }
//
// private boolean isDeque(String cType) {
// return cType.endsWith("::list");
// }
//
// private boolean isBWAPI4Collection(String cType) {
// return cType.endsWith("set");
// }
//
// private String convertPrimitive(String cType) {
// if (cType.equals("int")) {
// return "Integer";
// }
// if (cType.equals("bool")) {
// return "Boolean";
// }
// if (cType.equals("double")) {
// return "Double";
// }
//
// return cType;
// }
//
// private String extractPair(String cType) {
// cType = cType.substring(cType.indexOf("<") + 1, cType.lastIndexOf(">")).trim();
// String[] types = cType.split(",");
// return convertPrimitive(toJavaType(types[0].trim())) + ", " + convertPrimitive(toJavaType(types[1].trim()));
// }
//
//
// private String extractCollectionGeneric(String cType) {
// if(cType.contains("<")){
// cType = cType.substring(cType.indexOf("<") + 1, cType.lastIndexOf(">")).trim();
// }
// if(cType.endsWith("::list")) {
// cType = cType.substring(0, cType.lastIndexOf("::"));
// }
//
// if (cType.contains(":")) {
// cType = cType.substring(cType.lastIndexOf(":") + 1);
// }
// if (cType.endsWith("*")) {
// cType = cType.substring(0, cType.lastIndexOf("*"));
// }
//
//
// return cType;
// }
//
// private String extractBWAPI4CollectionGeneric(String cType) {
// cType = cType.substring(0, cType.length() - 3);
// return cType;
// }
//
//
// public String toJavaType(String cType) {
// if (isDeque(cType)) {
// return "List<" + extractCollectionGeneric(cType) + ">";
// }
// if (isCollection(cType)) {
// return "List<" + extractCollectionGeneric(cType) + ">";
// }
// if (isBWAPI4Collection(cType)) {
// return "List<" + extractBWAPI4CollectionGeneric(cType) + ">";
// }
// if (isMap(cType)) {
// return "Map<" + extractPair(cType) + ">";
// }
// if (isPair(cType)) {
// return "Pair<" + extractPair(cType) + ">";
// }
// String result = cToJavaTypes.get(cType);
// if (result == null) {
// result = cType;
// }
// int ddIndex;
// if ((ddIndex = result.lastIndexOf(':')) != -1) {
// result = result.substring(ddIndex + 1);
// }
// if (result.endsWith("*")) {
// return result.substring(0, result.length() - 1);
// }
// /*if (CJavaPipeline.BWAPI_VERSION == CJavaPipeline.BWAPI_V4 && cType.contains("bwapi.")) {
// cType = cType.replace("bwapi.", "bwapi4.");
// } */
// return result;
// }
//
// public List<String> getAdditionalImports() {
// return additionalImports;
// }
//
// public void setAdditionalImports(List<String> additionalImports) {
// this.additionalImports = additionalImports;
// }
// }
// Path: src/generator/java/EnumMirror.java
import c.CDeclaration;
import c.CEnum;
import c.EnumValue;
import generator.MirrorContext;
import java.io.File;
import java.io.PrintStream;
import java.util.List;
package generator.java;
/**
* User: PC
* Date: 14. 6. 2014
* Time: 14:27
*/
public class EnumMirror extends Mirror {
private CEnum cEnum;
public EnumMirror(CEnum cEnum) {
this.cEnum = cEnum;
}
protected void writePackage() {
if (cEnum.getNameSpaceName() == null) {
super.writePackage();
return;
}
out.println("package" + SPACE + context.getPackage() + "." + cEnum.getNameSpaceName() + SEMICOLON);
out.println();
}
| public void write(File root, MirrorContext context) throws Exception { |
vjurenka/BWMirror-Generator | manual-bwapi4/Mirror.java | // Path: manual-bwapi/AIModule.java
// public class AIModule {
//
// AIModule(){}
//
// private BWEventListener eventListener;
//
// public void setEventListener(BWEventListener eventListener) {
// this.eventListener = eventListener;
// }
//
// public void onStart() {
// if (eventListener != null) {
// eventListener.onStart();
// }
// }
//
// public void onEnd(boolean isWinner) {
// if (eventListener != null) {
// eventListener.onEnd(isWinner);
// }
// }
//
// public void onFrame() {
// if (eventListener != null) {
// eventListener.onFrame();
// }
// }
//
// public void onSendText(String text) {
// if (eventListener != null)
// {
// eventListener.onSendText(text);
// }
// }
//
// public void onReceiveText(Player player, String text) {
// if (eventListener != null) {
// eventListener.onReceiveText(player, text);
// }
// }
//
// public void onPlayerLeft(Player player) {
// if (eventListener != null) {
// eventListener.onPlayerLeft(player);
// }
// }
//
// public void onNukeDetect(Position target) {
// if (eventListener != null) {
// eventListener.onNukeDetect(target);
// }
// }
//
// public void onUnitDiscover(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitDiscover(unit);
// }
// }
//
// public void onUnitEvade(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitEvade(unit);
// }
// }
//
// public void onUnitShow(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitShow(unit);
// }
// }
//
// public void onUnitHide(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitHide(unit);
// }
// }
//
// public void onUnitCreate(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitCreate(unit);
// }
// }
//
// public void onUnitDestroy(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitDestroy(unit);
// }
// }
//
// public void onUnitMorph(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitMorph(unit);
// }
// }
//
// public void onUnitRenegade(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitRenegade(unit);
// }
// }
//
// public void onSaveGame(String gameName) {
// if (eventListener != null) {
// eventListener.onSaveGame(gameName);
// }
// }
//
// public void onUnitComplete(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitComplete(unit);
// }
// }
//
// public void onPlayerDropped(Player player) {
// if (eventListener != null) {
// eventListener.onPlayerDropped(player);
// }
// }
//
// }
//
// Path: manual-bwapi4/BWEventListener.java
// public interface BWEventListener {
//
// public void onStart();
//
// public void onEnd(boolean isWinner);
//
// public void onFrame();
//
// public void onSendText(String text);
//
// public void onReceiveText(Player player, String text);
//
// public void onPlayerLeft(Player player);
//
// public void onNukeDetect(Position target);
//
// public void onUnitDiscover(Unit unit);
//
// public void onUnitEvade(Unit unit);
//
// public void onUnitShow(Unit unit);
//
// public void onUnitHide(Unit unit);
//
// public void onUnitCreate(Unit unit);
//
// public void onUnitDestroy(Unit unit);
//
// public void onUnitMorph(Unit unit);
//
// public void onUnitRenegade(Unit unit);
//
// public void onSaveGame(String gameName);
//
// public void onUnitComplete(Unit unit);
//
// public void onPlayerDropped(Player player);
//
// }
| import bwapi.AIModule;
import bwapi.BWEventListener;
import java.io.*;
import java.io.File;
import java.lang.Exception;
import java.lang.UnsupportedOperationException;
import java.util.*;
import java.util.zip.*; | package bwapi;
/**
* <p>The API entry point. Standard use case:</p>
* <ul>
* <li>Create a Mirror object and use {@link #getModule()} and then set an {@link AIModule}'s {@link BWEventListener}<br/>
* <li>Call {@link #startGame()} to init the API and connect to Broodwar, then launch Broodwar from ChaosLauncher.</li>
* <li>In you {@link BWEventListener#onStart()} method, receive the Game object by calling {@link #getGame()}</li>
* </ul>
* <br/>
* <b>Example</b>
* <pre>
* {@code
*
* mirror.getModule().setEventListener(new DefaultBWListener()
* {
* public void onStart() {
* game = mirror.getGame();
* self = game.self();
* //initialization
* ....
* }
*
* public void onUpdate() {
* for (Unit myUnit : self.getUnits()) {
* //give orders to unit
* ...
* }
* }
* });
* }
* mirror.startGame();
* </pre>
* <p><b>Note:</b> The Game object is initialized during the {@link #startGame()} as well as other BWMirror API's constants.
* Do not use any API releated methods/fields prior to {@link #startGame()}.</p>
*/
public class Mirror {
private Game game;
| // Path: manual-bwapi/AIModule.java
// public class AIModule {
//
// AIModule(){}
//
// private BWEventListener eventListener;
//
// public void setEventListener(BWEventListener eventListener) {
// this.eventListener = eventListener;
// }
//
// public void onStart() {
// if (eventListener != null) {
// eventListener.onStart();
// }
// }
//
// public void onEnd(boolean isWinner) {
// if (eventListener != null) {
// eventListener.onEnd(isWinner);
// }
// }
//
// public void onFrame() {
// if (eventListener != null) {
// eventListener.onFrame();
// }
// }
//
// public void onSendText(String text) {
// if (eventListener != null)
// {
// eventListener.onSendText(text);
// }
// }
//
// public void onReceiveText(Player player, String text) {
// if (eventListener != null) {
// eventListener.onReceiveText(player, text);
// }
// }
//
// public void onPlayerLeft(Player player) {
// if (eventListener != null) {
// eventListener.onPlayerLeft(player);
// }
// }
//
// public void onNukeDetect(Position target) {
// if (eventListener != null) {
// eventListener.onNukeDetect(target);
// }
// }
//
// public void onUnitDiscover(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitDiscover(unit);
// }
// }
//
// public void onUnitEvade(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitEvade(unit);
// }
// }
//
// public void onUnitShow(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitShow(unit);
// }
// }
//
// public void onUnitHide(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitHide(unit);
// }
// }
//
// public void onUnitCreate(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitCreate(unit);
// }
// }
//
// public void onUnitDestroy(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitDestroy(unit);
// }
// }
//
// public void onUnitMorph(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitMorph(unit);
// }
// }
//
// public void onUnitRenegade(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitRenegade(unit);
// }
// }
//
// public void onSaveGame(String gameName) {
// if (eventListener != null) {
// eventListener.onSaveGame(gameName);
// }
// }
//
// public void onUnitComplete(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitComplete(unit);
// }
// }
//
// public void onPlayerDropped(Player player) {
// if (eventListener != null) {
// eventListener.onPlayerDropped(player);
// }
// }
//
// }
//
// Path: manual-bwapi4/BWEventListener.java
// public interface BWEventListener {
//
// public void onStart();
//
// public void onEnd(boolean isWinner);
//
// public void onFrame();
//
// public void onSendText(String text);
//
// public void onReceiveText(Player player, String text);
//
// public void onPlayerLeft(Player player);
//
// public void onNukeDetect(Position target);
//
// public void onUnitDiscover(Unit unit);
//
// public void onUnitEvade(Unit unit);
//
// public void onUnitShow(Unit unit);
//
// public void onUnitHide(Unit unit);
//
// public void onUnitCreate(Unit unit);
//
// public void onUnitDestroy(Unit unit);
//
// public void onUnitMorph(Unit unit);
//
// public void onUnitRenegade(Unit unit);
//
// public void onSaveGame(String gameName);
//
// public void onUnitComplete(Unit unit);
//
// public void onPlayerDropped(Player player);
//
// }
// Path: manual-bwapi4/Mirror.java
import bwapi.AIModule;
import bwapi.BWEventListener;
import java.io.*;
import java.io.File;
import java.lang.Exception;
import java.lang.UnsupportedOperationException;
import java.util.*;
import java.util.zip.*;
package bwapi;
/**
* <p>The API entry point. Standard use case:</p>
* <ul>
* <li>Create a Mirror object and use {@link #getModule()} and then set an {@link AIModule}'s {@link BWEventListener}<br/>
* <li>Call {@link #startGame()} to init the API and connect to Broodwar, then launch Broodwar from ChaosLauncher.</li>
* <li>In you {@link BWEventListener#onStart()} method, receive the Game object by calling {@link #getGame()}</li>
* </ul>
* <br/>
* <b>Example</b>
* <pre>
* {@code
*
* mirror.getModule().setEventListener(new DefaultBWListener()
* {
* public void onStart() {
* game = mirror.getGame();
* self = game.self();
* //initialization
* ....
* }
*
* public void onUpdate() {
* for (Unit myUnit : self.getUnits()) {
* //give orders to unit
* ...
* }
* }
* });
* }
* mirror.startGame();
* </pre>
* <p><b>Note:</b> The Game object is initialized during the {@link #startGame()} as well as other BWMirror API's constants.
* Do not use any API releated methods/fields prior to {@link #startGame()}.</p>
*/
public class Mirror {
private Game game;
| private AIModule module = new AIModule(); |
vjurenka/BWMirror-Generator | manual-bwapi/AIModule.java | // Path: manual-bwapi4/BWEventListener.java
// public interface BWEventListener {
//
// public void onStart();
//
// public void onEnd(boolean isWinner);
//
// public void onFrame();
//
// public void onSendText(String text);
//
// public void onReceiveText(Player player, String text);
//
// public void onPlayerLeft(Player player);
//
// public void onNukeDetect(Position target);
//
// public void onUnitDiscover(Unit unit);
//
// public void onUnitEvade(Unit unit);
//
// public void onUnitShow(Unit unit);
//
// public void onUnitHide(Unit unit);
//
// public void onUnitCreate(Unit unit);
//
// public void onUnitDestroy(Unit unit);
//
// public void onUnitMorph(Unit unit);
//
// public void onUnitRenegade(Unit unit);
//
// public void onSaveGame(String gameName);
//
// public void onUnitComplete(Unit unit);
//
// public void onPlayerDropped(Player player);
//
// }
| import bwapi.BWEventListener; | package bwapi;
/**
* This class receives all events from Broodwar.
* To process them, receive an AIModule's instance from {@link bwapi.Mirror} and call {@link #setEventListener(BWEventListener)}
* to set you own {@link bwapi.BWEventListener listener}.
* There's also a stub class ({@link bwapi.DefaultBWListener}) provided, so you don't have to implement all of the methods.
*/
public class AIModule {
AIModule(){}
| // Path: manual-bwapi4/BWEventListener.java
// public interface BWEventListener {
//
// public void onStart();
//
// public void onEnd(boolean isWinner);
//
// public void onFrame();
//
// public void onSendText(String text);
//
// public void onReceiveText(Player player, String text);
//
// public void onPlayerLeft(Player player);
//
// public void onNukeDetect(Position target);
//
// public void onUnitDiscover(Unit unit);
//
// public void onUnitEvade(Unit unit);
//
// public void onUnitShow(Unit unit);
//
// public void onUnitHide(Unit unit);
//
// public void onUnitCreate(Unit unit);
//
// public void onUnitDestroy(Unit unit);
//
// public void onUnitMorph(Unit unit);
//
// public void onUnitRenegade(Unit unit);
//
// public void onSaveGame(String gameName);
//
// public void onUnitComplete(Unit unit);
//
// public void onPlayerDropped(Player player);
//
// }
// Path: manual-bwapi/AIModule.java
import bwapi.BWEventListener;
package bwapi;
/**
* This class receives all events from Broodwar.
* To process them, receive an AIModule's instance from {@link bwapi.Mirror} and call {@link #setEventListener(BWEventListener)}
* to set you own {@link bwapi.BWEventListener listener}.
* There's also a stub class ({@link bwapi.DefaultBWListener}) provided, so you don't have to implement all of the methods.
*/
public class AIModule {
AIModule(){}
| private BWEventListener eventListener; |
vjurenka/BWMirror-Generator | src/impl/Clazz.java | // Path: src/c/CClass.java
// public interface CClass extends CDeclaration {
//
// public List<Field> getFields();
//
// public boolean isStatic();
// }
//
// Path: src/c/DeclarationType.java
// public enum DeclarationType {
// CLASS,
// CONSTANT,
// FIELD,
// METHOD,
// ENUM,
// VARIABLE;
// }
//
// Path: src/c/Field.java
// public interface Field extends CDeclaration{
//
// public String getType();
// public boolean isFinal();
// }
| import c.CClass;
import c.DeclarationType;
import c.Field;
import java.util.List; | package impl;
/**
* Created with IntelliJ IDEA.
* User: Vladimir
* Date: 5.3.2014
* Time: 10:12
*/
public class Clazz implements CClass {
String name;
| // Path: src/c/CClass.java
// public interface CClass extends CDeclaration {
//
// public List<Field> getFields();
//
// public boolean isStatic();
// }
//
// Path: src/c/DeclarationType.java
// public enum DeclarationType {
// CLASS,
// CONSTANT,
// FIELD,
// METHOD,
// ENUM,
// VARIABLE;
// }
//
// Path: src/c/Field.java
// public interface Field extends CDeclaration{
//
// public String getType();
// public boolean isFinal();
// }
// Path: src/impl/Clazz.java
import c.CClass;
import c.DeclarationType;
import c.Field;
import java.util.List;
package impl;
/**
* Created with IntelliJ IDEA.
* User: Vladimir
* Date: 5.3.2014
* Time: 10:12
*/
public class Clazz implements CClass {
String name;
| List<Field> fields = new FieldList<Field>(); |
vjurenka/BWMirror-Generator | src/impl/Clazz.java | // Path: src/c/CClass.java
// public interface CClass extends CDeclaration {
//
// public List<Field> getFields();
//
// public boolean isStatic();
// }
//
// Path: src/c/DeclarationType.java
// public enum DeclarationType {
// CLASS,
// CONSTANT,
// FIELD,
// METHOD,
// ENUM,
// VARIABLE;
// }
//
// Path: src/c/Field.java
// public interface Field extends CDeclaration{
//
// public String getType();
// public boolean isFinal();
// }
| import c.CClass;
import c.DeclarationType;
import c.Field;
import java.util.List; | package impl;
/**
* Created with IntelliJ IDEA.
* User: Vladimir
* Date: 5.3.2014
* Time: 10:12
*/
public class Clazz implements CClass {
String name;
List<Field> fields = new FieldList<Field>();
public Clazz(String name) {
this.name = name;
}
@Override
public List<Field> getFields() {
return fields;
}
@Override
public boolean isStatic() {
return false;
}
@Override
public String getName() {
return name;
}
public String toString(){
String str = "class " + name + "\n";
for(Field f: fields){
str += f+"\n";
}
return str ;
}
@Override | // Path: src/c/CClass.java
// public interface CClass extends CDeclaration {
//
// public List<Field> getFields();
//
// public boolean isStatic();
// }
//
// Path: src/c/DeclarationType.java
// public enum DeclarationType {
// CLASS,
// CONSTANT,
// FIELD,
// METHOD,
// ENUM,
// VARIABLE;
// }
//
// Path: src/c/Field.java
// public interface Field extends CDeclaration{
//
// public String getType();
// public boolean isFinal();
// }
// Path: src/impl/Clazz.java
import c.CClass;
import c.DeclarationType;
import c.Field;
import java.util.List;
package impl;
/**
* Created with IntelliJ IDEA.
* User: Vladimir
* Date: 5.3.2014
* Time: 10:12
*/
public class Clazz implements CClass {
String name;
List<Field> fields = new FieldList<Field>();
public Clazz(String name) {
this.name = name;
}
@Override
public List<Field> getFields() {
return fields;
}
@Override
public boolean isStatic() {
return false;
}
@Override
public String getName() {
return name;
}
public String toString(){
String str = "class " + name + "\n";
for(Field f: fields){
str += f+"\n";
}
return str ;
}
@Override | public DeclarationType getDeclType() { |
vjurenka/BWMirror-Generator | manual-bwapi/Mirror.java | // Path: manual-bwapi/AIModule.java
// public class AIModule {
//
// AIModule(){}
//
// private BWEventListener eventListener;
//
// public void setEventListener(BWEventListener eventListener) {
// this.eventListener = eventListener;
// }
//
// public void onStart() {
// if (eventListener != null) {
// eventListener.onStart();
// }
// }
//
// public void onEnd(boolean isWinner) {
// if (eventListener != null) {
// eventListener.onEnd(isWinner);
// }
// }
//
// public void onFrame() {
// if (eventListener != null) {
// eventListener.onFrame();
// }
// }
//
// public void onSendText(String text) {
// if (eventListener != null)
// {
// eventListener.onSendText(text);
// }
// }
//
// public void onReceiveText(Player player, String text) {
// if (eventListener != null) {
// eventListener.onReceiveText(player, text);
// }
// }
//
// public void onPlayerLeft(Player player) {
// if (eventListener != null) {
// eventListener.onPlayerLeft(player);
// }
// }
//
// public void onNukeDetect(Position target) {
// if (eventListener != null) {
// eventListener.onNukeDetect(target);
// }
// }
//
// public void onUnitDiscover(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitDiscover(unit);
// }
// }
//
// public void onUnitEvade(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitEvade(unit);
// }
// }
//
// public void onUnitShow(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitShow(unit);
// }
// }
//
// public void onUnitHide(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitHide(unit);
// }
// }
//
// public void onUnitCreate(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitCreate(unit);
// }
// }
//
// public void onUnitDestroy(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitDestroy(unit);
// }
// }
//
// public void onUnitMorph(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitMorph(unit);
// }
// }
//
// public void onUnitRenegade(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitRenegade(unit);
// }
// }
//
// public void onSaveGame(String gameName) {
// if (eventListener != null) {
// eventListener.onSaveGame(gameName);
// }
// }
//
// public void onUnitComplete(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitComplete(unit);
// }
// }
//
// public void onPlayerDropped(Player player) {
// if (eventListener != null) {
// eventListener.onPlayerDropped(player);
// }
// }
//
// }
//
// Path: manual-bwapi4/BWEventListener.java
// public interface BWEventListener {
//
// public void onStart();
//
// public void onEnd(boolean isWinner);
//
// public void onFrame();
//
// public void onSendText(String text);
//
// public void onReceiveText(Player player, String text);
//
// public void onPlayerLeft(Player player);
//
// public void onNukeDetect(Position target);
//
// public void onUnitDiscover(Unit unit);
//
// public void onUnitEvade(Unit unit);
//
// public void onUnitShow(Unit unit);
//
// public void onUnitHide(Unit unit);
//
// public void onUnitCreate(Unit unit);
//
// public void onUnitDestroy(Unit unit);
//
// public void onUnitMorph(Unit unit);
//
// public void onUnitRenegade(Unit unit);
//
// public void onSaveGame(String gameName);
//
// public void onUnitComplete(Unit unit);
//
// public void onPlayerDropped(Player player);
//
// }
| import bwapi.AIModule;
import bwapi.BWEventListener;
import java.io.*;
import java.io.File;
import java.lang.Exception;
import java.lang.UnsupportedOperationException;
import java.util.*;
import java.util.zip.*; | package bwapi;
/**
* <p>The API entry point. Standard use case:</p>
* <ul>
* <li>Create a Mirror object and use {@link #getModule()} and then set an {@link bwapi.AIModule}'s {@link bwapi.BWEventListener}<br/>
* <li>Call {@link #startGame()} to init the API and connect to Broodwar, then launch Broodwar from ChaosLauncher.</li>
* <li>In you {@link bwapi.BWEventListener#onStart()} method, receive the Game object by calling {@link #getGame()}</li>
* </ul>
* <br/>
* <b>Example</b>
* <pre>
* {@code
*
* mirror.getModule().setEventListener(new DefaultBWListener()
* {
* public void onStart() {
* game = mirror.getGame();
* self = game.self();
* //initialization
* ....
* }
*
* public void onUpdate() {
* for (Unit myUnit : self.getUnits()) {
* //give orders to unit
* ...
* }
* }
* });
* }
* mirror.startGame();
* </pre>
* <p><b>Note:</b> The Game object is initialized during the {@link #startGame()} as well as other BWMirror API's constants.
* Do not use any API releated methods/fields prior to {@link #startGame()}.</p>
*/
public class Mirror {
private Game game;
| // Path: manual-bwapi/AIModule.java
// public class AIModule {
//
// AIModule(){}
//
// private BWEventListener eventListener;
//
// public void setEventListener(BWEventListener eventListener) {
// this.eventListener = eventListener;
// }
//
// public void onStart() {
// if (eventListener != null) {
// eventListener.onStart();
// }
// }
//
// public void onEnd(boolean isWinner) {
// if (eventListener != null) {
// eventListener.onEnd(isWinner);
// }
// }
//
// public void onFrame() {
// if (eventListener != null) {
// eventListener.onFrame();
// }
// }
//
// public void onSendText(String text) {
// if (eventListener != null)
// {
// eventListener.onSendText(text);
// }
// }
//
// public void onReceiveText(Player player, String text) {
// if (eventListener != null) {
// eventListener.onReceiveText(player, text);
// }
// }
//
// public void onPlayerLeft(Player player) {
// if (eventListener != null) {
// eventListener.onPlayerLeft(player);
// }
// }
//
// public void onNukeDetect(Position target) {
// if (eventListener != null) {
// eventListener.onNukeDetect(target);
// }
// }
//
// public void onUnitDiscover(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitDiscover(unit);
// }
// }
//
// public void onUnitEvade(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitEvade(unit);
// }
// }
//
// public void onUnitShow(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitShow(unit);
// }
// }
//
// public void onUnitHide(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitHide(unit);
// }
// }
//
// public void onUnitCreate(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitCreate(unit);
// }
// }
//
// public void onUnitDestroy(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitDestroy(unit);
// }
// }
//
// public void onUnitMorph(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitMorph(unit);
// }
// }
//
// public void onUnitRenegade(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitRenegade(unit);
// }
// }
//
// public void onSaveGame(String gameName) {
// if (eventListener != null) {
// eventListener.onSaveGame(gameName);
// }
// }
//
// public void onUnitComplete(Unit unit) {
// if (eventListener != null) {
// eventListener.onUnitComplete(unit);
// }
// }
//
// public void onPlayerDropped(Player player) {
// if (eventListener != null) {
// eventListener.onPlayerDropped(player);
// }
// }
//
// }
//
// Path: manual-bwapi4/BWEventListener.java
// public interface BWEventListener {
//
// public void onStart();
//
// public void onEnd(boolean isWinner);
//
// public void onFrame();
//
// public void onSendText(String text);
//
// public void onReceiveText(Player player, String text);
//
// public void onPlayerLeft(Player player);
//
// public void onNukeDetect(Position target);
//
// public void onUnitDiscover(Unit unit);
//
// public void onUnitEvade(Unit unit);
//
// public void onUnitShow(Unit unit);
//
// public void onUnitHide(Unit unit);
//
// public void onUnitCreate(Unit unit);
//
// public void onUnitDestroy(Unit unit);
//
// public void onUnitMorph(Unit unit);
//
// public void onUnitRenegade(Unit unit);
//
// public void onSaveGame(String gameName);
//
// public void onUnitComplete(Unit unit);
//
// public void onPlayerDropped(Player player);
//
// }
// Path: manual-bwapi/Mirror.java
import bwapi.AIModule;
import bwapi.BWEventListener;
import java.io.*;
import java.io.File;
import java.lang.Exception;
import java.lang.UnsupportedOperationException;
import java.util.*;
import java.util.zip.*;
package bwapi;
/**
* <p>The API entry point. Standard use case:</p>
* <ul>
* <li>Create a Mirror object and use {@link #getModule()} and then set an {@link bwapi.AIModule}'s {@link bwapi.BWEventListener}<br/>
* <li>Call {@link #startGame()} to init the API and connect to Broodwar, then launch Broodwar from ChaosLauncher.</li>
* <li>In you {@link bwapi.BWEventListener#onStart()} method, receive the Game object by calling {@link #getGame()}</li>
* </ul>
* <br/>
* <b>Example</b>
* <pre>
* {@code
*
* mirror.getModule().setEventListener(new DefaultBWListener()
* {
* public void onStart() {
* game = mirror.getGame();
* self = game.self();
* //initialization
* ....
* }
*
* public void onUpdate() {
* for (Unit myUnit : self.getUnits()) {
* //give orders to unit
* ...
* }
* }
* });
* }
* mirror.startGame();
* </pre>
* <p><b>Note:</b> The Game object is initialized during the {@link #startGame()} as well as other BWMirror API's constants.
* Do not use any API releated methods/fields prior to {@link #startGame()}.</p>
*/
public class Mirror {
private Game game;
| private AIModule module = new AIModule(); |
vjurenka/BWMirror-Generator | src/generator/MyJavaCompiler.java | // Path: src/compile/JavaSourceFile.java
// public class JavaSourceFile extends SimpleJavaFileObject {
//
// private String sourceCode;
//
// public JavaSourceFile(File file) {
// super(file.toURI(), Kind.SOURCE);
// this.sourceCode = FileToString.readFile(file.toURI());
// }
//
// @Override
// public CharSequence getCharContent(boolean ignoreEncodingErrors) {
// return sourceCode;
// }
//
// }
| import compile.JavaSourceFile;
import javax.tools.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale; | package generator;
/**
* User: PC
* Date: 30.4.2014
* Time: 16:13
*/
public class MyJavaCompiler {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
@SuppressWarnings("ConstantConditions")
public void run(File inDir, File outDir) {
outDir.delete();
outDir.mkdir();
List<JavaFileObject> javaFileObjects = new ArrayList<JavaFileObject>();
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
Iterable<String> compilationOptions = Arrays.asList("-d", outDir.getName());
for (File file : inDir.listFiles()) {
if(file.isDirectory()){
for(File ffile : file.listFiles()){
if(ffile.isDirectory()){
for(File fffile : ffile.listFiles()){ | // Path: src/compile/JavaSourceFile.java
// public class JavaSourceFile extends SimpleJavaFileObject {
//
// private String sourceCode;
//
// public JavaSourceFile(File file) {
// super(file.toURI(), Kind.SOURCE);
// this.sourceCode = FileToString.readFile(file.toURI());
// }
//
// @Override
// public CharSequence getCharContent(boolean ignoreEncodingErrors) {
// return sourceCode;
// }
//
// }
// Path: src/generator/MyJavaCompiler.java
import compile.JavaSourceFile;
import javax.tools.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
package generator;
/**
* User: PC
* Date: 30.4.2014
* Time: 16:13
*/
public class MyJavaCompiler {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
@SuppressWarnings("ConstantConditions")
public void run(File inDir, File outDir) {
outDir.delete();
outDir.mkdir();
List<JavaFileObject> javaFileObjects = new ArrayList<JavaFileObject>();
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
Iterable<String> compilationOptions = Arrays.asList("-d", outDir.getName());
for (File file : inDir.listFiles()) {
if(file.isDirectory()){
for(File ffile : file.listFiles()){
if(ffile.isDirectory()){
for(File fffile : ffile.listFiles()){ | javaFileObjects.add(new JavaSourceFile(fffile)); |
vjurenka/BWMirror-Generator | src/impl/Function.java | // Path: src/c/DeclarationType.java
// public enum DeclarationType {
// CLASS,
// CONSTANT,
// FIELD,
// METHOD,
// ENUM,
// VARIABLE;
// }
//
// Path: src/c/Method.java
// public interface Method extends Field{
//
// public List<Param> getParams();
//
// public Method clone();
//
// public boolean isStatic();
// }
//
// Path: src/c/Param.java
// public class Param extends Triple<String, String, String> {
//
// public Param() {
// }
//
// public Param(String first, String second) {
// super(first, second);
// }
//
// //c type, name, javatype
// public Param(String first, String second, String third) {
// super(first, second, third);
// }
// }
| import c.DeclarationType;
import c.Method;
import c.Param;
import java.util.ArrayList;
import java.util.List; | package impl;
/**
* User: PC
* Date: 26.2.2014
* Time: 20:34
*/
public class Function implements Method {
String returnType;
String name;
| // Path: src/c/DeclarationType.java
// public enum DeclarationType {
// CLASS,
// CONSTANT,
// FIELD,
// METHOD,
// ENUM,
// VARIABLE;
// }
//
// Path: src/c/Method.java
// public interface Method extends Field{
//
// public List<Param> getParams();
//
// public Method clone();
//
// public boolean isStatic();
// }
//
// Path: src/c/Param.java
// public class Param extends Triple<String, String, String> {
//
// public Param() {
// }
//
// public Param(String first, String second) {
// super(first, second);
// }
//
// //c type, name, javatype
// public Param(String first, String second, String third) {
// super(first, second, third);
// }
// }
// Path: src/impl/Function.java
import c.DeclarationType;
import c.Method;
import c.Param;
import java.util.ArrayList;
import java.util.List;
package impl;
/**
* User: PC
* Date: 26.2.2014
* Time: 20:34
*/
public class Function implements Method {
String returnType;
String name;
| ArrayList<Param> args = new ArrayList<Param>(); |
vjurenka/BWMirror-Generator | src/impl/Function.java | // Path: src/c/DeclarationType.java
// public enum DeclarationType {
// CLASS,
// CONSTANT,
// FIELD,
// METHOD,
// ENUM,
// VARIABLE;
// }
//
// Path: src/c/Method.java
// public interface Method extends Field{
//
// public List<Param> getParams();
//
// public Method clone();
//
// public boolean isStatic();
// }
//
// Path: src/c/Param.java
// public class Param extends Triple<String, String, String> {
//
// public Param() {
// }
//
// public Param(String first, String second) {
// super(first, second);
// }
//
// //c type, name, javatype
// public Param(String first, String second, String third) {
// super(first, second, third);
// }
// }
| import c.DeclarationType;
import c.Method;
import c.Param;
import java.util.ArrayList;
import java.util.List; | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Function)) return false;
Function function = (Function) o;
if (name != null ? !name.equals(function.name) : function.name != null) return false;
if (returnType != null ? !returnType.equals(function.returnType) : function.returnType != null) return false;
if(this.args.size()!= function.args.size()){return false;}
for(int i = 0; i < args.size(); i++){
if(!args.get(i).first.equals(function.args.get(i).first)){
return false;
}
}
return true;
}
@Override
public int hashCode() {
int result = returnType != null ? returnType.hashCode() : 0;
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (args != null ? args.hashCode() : 0);
return result;
}
@Override | // Path: src/c/DeclarationType.java
// public enum DeclarationType {
// CLASS,
// CONSTANT,
// FIELD,
// METHOD,
// ENUM,
// VARIABLE;
// }
//
// Path: src/c/Method.java
// public interface Method extends Field{
//
// public List<Param> getParams();
//
// public Method clone();
//
// public boolean isStatic();
// }
//
// Path: src/c/Param.java
// public class Param extends Triple<String, String, String> {
//
// public Param() {
// }
//
// public Param(String first, String second) {
// super(first, second);
// }
//
// //c type, name, javatype
// public Param(String first, String second, String third) {
// super(first, second, third);
// }
// }
// Path: src/impl/Function.java
import c.DeclarationType;
import c.Method;
import c.Param;
import java.util.ArrayList;
import java.util.List;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Function)) return false;
Function function = (Function) o;
if (name != null ? !name.equals(function.name) : function.name != null) return false;
if (returnType != null ? !returnType.equals(function.returnType) : function.returnType != null) return false;
if(this.args.size()!= function.args.size()){return false;}
for(int i = 0; i < args.size(); i++){
if(!args.get(i).first.equals(function.args.get(i).first)){
return false;
}
}
return true;
}
@Override
public int hashCode() {
int result = returnType != null ? returnType.hashCode() : 0;
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (args != null ? args.hashCode() : 0);
return result;
}
@Override | public DeclarationType getDeclType() { |
vjurenka/BWMirror-Generator | src/generator/JavaContext.java | // Path: src/util/Generic.java
// public class Generic {
// public static String extractGeneric(String str){
// return str.substring(str.indexOf("<") +1, str.indexOf(">")).trim();
// }
//
// public static String[] extractPair(String str) {
// str = str.substring(str.indexOf("<") +1, str.indexOf(">")).trim();
// String[] kv = str.split(",");
// return new String[]{kv[0].trim(), kv[1].trim()};
// }
//
// public static String stripGeneric(String str){
// int index = str.indexOf("<");
// if (index == -1){
// return str;
// }
// return str.substring(0, index);
// }
// }
//
// Path: src/util/PointerTest.java
// public class PointerTest {
//
// private static final List<String> BWAPI4_INTERFACES = Arrays.asList("Client", "Game", "AIModule" ,"Event", "Race", "Error", "Order");
//
// private static boolean testCls(String cls){
// return BWAPI4_INTERFACES.contains(cls) || cls.endsWith("set") || cls.endsWith("Type") || cls.startsWith("BWTA");
// }
//
// public static String test(String cls) {
// return test(cls, true);
// }
//
//
// public static String test(String cls, boolean print) {
// if (CJavaPipeline.isBWAPI3()) {
// return (print ? cls : "" )+ "*";
// }
// return (print ? cls : "" ) + (testCls(cls) ? "*" : "");
// }
//
// }
//
// Path: src/util/StringUtils.java
// public class StringUtils {
// public static String capitalize(final String line) {
// return Character.toUpperCase(line.charAt(0)) + line.substring(1);
// }
// }
| import util.Generic;
import util.PointerTest;
import util.StringUtils;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List; | javaToCType.put("boolean", "jboolean");
javaToCType.put("String", "jstring");
}
public boolean isSelfReturnType(String clsName, String methodName) {
return packageName.equals("bwta") && selfReturnTypes.contains(clsName) && methodName.equals("getPoints");
}
public String getPackageName() {
return packageName;
}
public String getPackageName(String javaRetType) {
if (packageName.equals("bwta") && (javaRetType.equals("Position") || javaRetType.equals("Unit") || javaRetType.equals("Pair") || javaRetType.equals("TilePosition"))) {
return "bwapi";
}
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String toCType(String javaType) {
String result = javaToCType.get(javaType);
return result != null ? result : "REF";
}
public String toCPair(String javaType) {
if (javaType.startsWith("Pair")) { | // Path: src/util/Generic.java
// public class Generic {
// public static String extractGeneric(String str){
// return str.substring(str.indexOf("<") +1, str.indexOf(">")).trim();
// }
//
// public static String[] extractPair(String str) {
// str = str.substring(str.indexOf("<") +1, str.indexOf(">")).trim();
// String[] kv = str.split(",");
// return new String[]{kv[0].trim(), kv[1].trim()};
// }
//
// public static String stripGeneric(String str){
// int index = str.indexOf("<");
// if (index == -1){
// return str;
// }
// return str.substring(0, index);
// }
// }
//
// Path: src/util/PointerTest.java
// public class PointerTest {
//
// private static final List<String> BWAPI4_INTERFACES = Arrays.asList("Client", "Game", "AIModule" ,"Event", "Race", "Error", "Order");
//
// private static boolean testCls(String cls){
// return BWAPI4_INTERFACES.contains(cls) || cls.endsWith("set") || cls.endsWith("Type") || cls.startsWith("BWTA");
// }
//
// public static String test(String cls) {
// return test(cls, true);
// }
//
//
// public static String test(String cls, boolean print) {
// if (CJavaPipeline.isBWAPI3()) {
// return (print ? cls : "" )+ "*";
// }
// return (print ? cls : "" ) + (testCls(cls) ? "*" : "");
// }
//
// }
//
// Path: src/util/StringUtils.java
// public class StringUtils {
// public static String capitalize(final String line) {
// return Character.toUpperCase(line.charAt(0)) + line.substring(1);
// }
// }
// Path: src/generator/JavaContext.java
import util.Generic;
import util.PointerTest;
import util.StringUtils;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
javaToCType.put("boolean", "jboolean");
javaToCType.put("String", "jstring");
}
public boolean isSelfReturnType(String clsName, String methodName) {
return packageName.equals("bwta") && selfReturnTypes.contains(clsName) && methodName.equals("getPoints");
}
public String getPackageName() {
return packageName;
}
public String getPackageName(String javaRetType) {
if (packageName.equals("bwta") && (javaRetType.equals("Position") || javaRetType.equals("Unit") || javaRetType.equals("Pair") || javaRetType.equals("TilePosition"))) {
return "bwapi";
}
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String toCType(String javaType) {
String result = javaToCType.get(javaType);
return result != null ? result : "REF";
}
public String toCPair(String javaType) {
if (javaType.startsWith("Pair")) { | String[] pair = Generic.extractPair(javaType); |
vjurenka/BWMirror-Generator | src/generator/JavaContext.java | // Path: src/util/Generic.java
// public class Generic {
// public static String extractGeneric(String str){
// return str.substring(str.indexOf("<") +1, str.indexOf(">")).trim();
// }
//
// public static String[] extractPair(String str) {
// str = str.substring(str.indexOf("<") +1, str.indexOf(">")).trim();
// String[] kv = str.split(",");
// return new String[]{kv[0].trim(), kv[1].trim()};
// }
//
// public static String stripGeneric(String str){
// int index = str.indexOf("<");
// if (index == -1){
// return str;
// }
// return str.substring(0, index);
// }
// }
//
// Path: src/util/PointerTest.java
// public class PointerTest {
//
// private static final List<String> BWAPI4_INTERFACES = Arrays.asList("Client", "Game", "AIModule" ,"Event", "Race", "Error", "Order");
//
// private static boolean testCls(String cls){
// return BWAPI4_INTERFACES.contains(cls) || cls.endsWith("set") || cls.endsWith("Type") || cls.startsWith("BWTA");
// }
//
// public static String test(String cls) {
// return test(cls, true);
// }
//
//
// public static String test(String cls, boolean print) {
// if (CJavaPipeline.isBWAPI3()) {
// return (print ? cls : "" )+ "*";
// }
// return (print ? cls : "" ) + (testCls(cls) ? "*" : "");
// }
//
// }
//
// Path: src/util/StringUtils.java
// public class StringUtils {
// public static String capitalize(final String line) {
// return Character.toUpperCase(line.charAt(0)) + line.substring(1);
// }
// }
| import util.Generic;
import util.PointerTest;
import util.StringUtils;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List; | public String getPackageName() {
return packageName;
}
public String getPackageName(String javaRetType) {
if (packageName.equals("bwta") && (javaRetType.equals("Position") || javaRetType.equals("Unit") || javaRetType.equals("Pair") || javaRetType.equals("TilePosition"))) {
return "bwapi";
}
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String toCType(String javaType) {
String result = javaToCType.get(javaType);
return result != null ? result : "REF";
}
public String toCPair(String javaType) {
if (javaType.startsWith("Pair")) {
String[] pair = Generic.extractPair(javaType);
return "std::pair<" + javaObjectToPrimitive(prefixPackageNameAndAddPointerIfNeeded(pair[0])) + ", " + javaObjectToPrimitive(prefixPackageNameAndAddPointerIfNeeded(pair[1])) + ">";
}
return javaType;
}
public String prefixPackageNameAndAddPointerIfNeeded(String javaType) {
if (isBWTA(javaType)) { | // Path: src/util/Generic.java
// public class Generic {
// public static String extractGeneric(String str){
// return str.substring(str.indexOf("<") +1, str.indexOf(">")).trim();
// }
//
// public static String[] extractPair(String str) {
// str = str.substring(str.indexOf("<") +1, str.indexOf(">")).trim();
// String[] kv = str.split(",");
// return new String[]{kv[0].trim(), kv[1].trim()};
// }
//
// public static String stripGeneric(String str){
// int index = str.indexOf("<");
// if (index == -1){
// return str;
// }
// return str.substring(0, index);
// }
// }
//
// Path: src/util/PointerTest.java
// public class PointerTest {
//
// private static final List<String> BWAPI4_INTERFACES = Arrays.asList("Client", "Game", "AIModule" ,"Event", "Race", "Error", "Order");
//
// private static boolean testCls(String cls){
// return BWAPI4_INTERFACES.contains(cls) || cls.endsWith("set") || cls.endsWith("Type") || cls.startsWith("BWTA");
// }
//
// public static String test(String cls) {
// return test(cls, true);
// }
//
//
// public static String test(String cls, boolean print) {
// if (CJavaPipeline.isBWAPI3()) {
// return (print ? cls : "" )+ "*";
// }
// return (print ? cls : "" ) + (testCls(cls) ? "*" : "");
// }
//
// }
//
// Path: src/util/StringUtils.java
// public class StringUtils {
// public static String capitalize(final String line) {
// return Character.toUpperCase(line.charAt(0)) + line.substring(1);
// }
// }
// Path: src/generator/JavaContext.java
import util.Generic;
import util.PointerTest;
import util.StringUtils;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
public String getPackageName() {
return packageName;
}
public String getPackageName(String javaRetType) {
if (packageName.equals("bwta") && (javaRetType.equals("Position") || javaRetType.equals("Unit") || javaRetType.equals("Pair") || javaRetType.equals("TilePosition"))) {
return "bwapi";
}
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String toCType(String javaType) {
String result = javaToCType.get(javaType);
return result != null ? result : "REF";
}
public String toCPair(String javaType) {
if (javaType.startsWith("Pair")) {
String[] pair = Generic.extractPair(javaType);
return "std::pair<" + javaObjectToPrimitive(prefixPackageNameAndAddPointerIfNeeded(pair[0])) + ", " + javaObjectToPrimitive(prefixPackageNameAndAddPointerIfNeeded(pair[1])) + ">";
}
return javaType;
}
public String prefixPackageNameAndAddPointerIfNeeded(String javaType) {
if (isBWTA(javaType)) { | return PointerTest.test("BWTA::" + javaType); |
vjurenka/BWMirror-Generator | src/impl/ClassVariable.java | // Path: src/c/DeclarationType.java
// public enum DeclarationType {
// CLASS,
// CONSTANT,
// FIELD,
// METHOD,
// ENUM,
// VARIABLE;
// }
//
// Path: src/c/Variable.java
// public interface Variable extends Field{
// }
| import c.DeclarationType;
import c.Variable; | package impl;
/**
* User: PC
* Date: 17. 6. 2014
* Time: 19:44
*/
public class ClassVariable implements Variable {
private String type, name;
private boolean isFinal;
public ClassVariable(String type, String name, boolean isFinal) {
this.type = type;
this.name = name;
this.isFinal = isFinal;
}
@Override
public String getType() {
return type;
}
@Override
public String getName() {
return name;
}
@Override | // Path: src/c/DeclarationType.java
// public enum DeclarationType {
// CLASS,
// CONSTANT,
// FIELD,
// METHOD,
// ENUM,
// VARIABLE;
// }
//
// Path: src/c/Variable.java
// public interface Variable extends Field{
// }
// Path: src/impl/ClassVariable.java
import c.DeclarationType;
import c.Variable;
package impl;
/**
* User: PC
* Date: 17. 6. 2014
* Time: 19:44
*/
public class ClassVariable implements Variable {
private String type, name;
private boolean isFinal;
public ClassVariable(String type, String name, boolean isFinal) {
this.type = type;
this.name = name;
this.isFinal = isFinal;
}
@Override
public String getType() {
return type;
}
@Override
public String getName() {
return name;
}
@Override | public DeclarationType getDeclType() { |
vjurenka/BWMirror-Generator | manual-bwapi4/DefaultBWListener.java | // Path: manual-bwapi4/BWEventListener.java
// public interface BWEventListener {
//
// public void onStart();
//
// public void onEnd(boolean isWinner);
//
// public void onFrame();
//
// public void onSendText(String text);
//
// public void onReceiveText(Player player, String text);
//
// public void onPlayerLeft(Player player);
//
// public void onNukeDetect(Position target);
//
// public void onUnitDiscover(Unit unit);
//
// public void onUnitEvade(Unit unit);
//
// public void onUnitShow(Unit unit);
//
// public void onUnitHide(Unit unit);
//
// public void onUnitCreate(Unit unit);
//
// public void onUnitDestroy(Unit unit);
//
// public void onUnitMorph(Unit unit);
//
// public void onUnitRenegade(Unit unit);
//
// public void onSaveGame(String gameName);
//
// public void onUnitComplete(Unit unit);
//
// public void onPlayerDropped(Player player);
//
// }
//
// Path: manual-bwapi/Position.java
// public class Position extends AbstractPoint<Position>{
//
// private int x, y;
//
// public Position(int x, int y) {
// this.x = x;
// this.y = y;
// }
//
// public String toString() {
// return "[" + x + ", " + y + "]";
// }
//
// public native boolean isValid();
//
// public native Position makeValid();
//
// public native double getDistance(Position position);
//
// public native int getApproxDistance(Position position);
//
// public native double getLength();
//
// public native boolean hasPath(Position position);
//
// public int getX() {
// return x;
// }
//
// public int getY() {
// return y;
// }
//
// public static Position Invalid;
//
// public static Position None;
//
// public static Position Unknown;
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Position)) return false;
//
// Position position = (Position) o;
//
// if (x != position.x) return false;
// if (y != position.y) return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = x;
// result = 31 * result + y;
// return result;
// }
//
//
// private static Map<Long, Position> instances = new HashMap<Long, Position>();
//
// private Position(long pointer) {
// this.pointer = pointer;
// }
//
// private static Position get(long pointer) {
// Position instance = instances.get(pointer);
// if (instance == null) {
// instance = new Position(pointer);
// instances.put(pointer, instance);
// }
// return instance;
// }
//
// private long pointer;
//
// public Position getPoint(){
// return this;
// }
// }
| import bwapi.BWEventListener;
import bwapi.Player;
import bwapi.Position;
import bwapi.Unit; | package bwapi;
/**
* A utility stub class providing a default implementation of {@link BWEventListener},
* override it's methods if you want to handle only some events.
*/
public class DefaultBWListener implements BWEventListener {
@Override
public void onStart() {
}
@Override
public void onEnd(boolean b) {
}
@Override
public void onFrame() {
}
@Override
public void onSendText(String s) {
}
@Override
public void onReceiveText(Player player, String s) {
}
@Override
public void onPlayerLeft(Player player) {
}
@Override | // Path: manual-bwapi4/BWEventListener.java
// public interface BWEventListener {
//
// public void onStart();
//
// public void onEnd(boolean isWinner);
//
// public void onFrame();
//
// public void onSendText(String text);
//
// public void onReceiveText(Player player, String text);
//
// public void onPlayerLeft(Player player);
//
// public void onNukeDetect(Position target);
//
// public void onUnitDiscover(Unit unit);
//
// public void onUnitEvade(Unit unit);
//
// public void onUnitShow(Unit unit);
//
// public void onUnitHide(Unit unit);
//
// public void onUnitCreate(Unit unit);
//
// public void onUnitDestroy(Unit unit);
//
// public void onUnitMorph(Unit unit);
//
// public void onUnitRenegade(Unit unit);
//
// public void onSaveGame(String gameName);
//
// public void onUnitComplete(Unit unit);
//
// public void onPlayerDropped(Player player);
//
// }
//
// Path: manual-bwapi/Position.java
// public class Position extends AbstractPoint<Position>{
//
// private int x, y;
//
// public Position(int x, int y) {
// this.x = x;
// this.y = y;
// }
//
// public String toString() {
// return "[" + x + ", " + y + "]";
// }
//
// public native boolean isValid();
//
// public native Position makeValid();
//
// public native double getDistance(Position position);
//
// public native int getApproxDistance(Position position);
//
// public native double getLength();
//
// public native boolean hasPath(Position position);
//
// public int getX() {
// return x;
// }
//
// public int getY() {
// return y;
// }
//
// public static Position Invalid;
//
// public static Position None;
//
// public static Position Unknown;
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Position)) return false;
//
// Position position = (Position) o;
//
// if (x != position.x) return false;
// if (y != position.y) return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = x;
// result = 31 * result + y;
// return result;
// }
//
//
// private static Map<Long, Position> instances = new HashMap<Long, Position>();
//
// private Position(long pointer) {
// this.pointer = pointer;
// }
//
// private static Position get(long pointer) {
// Position instance = instances.get(pointer);
// if (instance == null) {
// instance = new Position(pointer);
// instances.put(pointer, instance);
// }
// return instance;
// }
//
// private long pointer;
//
// public Position getPoint(){
// return this;
// }
// }
// Path: manual-bwapi4/DefaultBWListener.java
import bwapi.BWEventListener;
import bwapi.Player;
import bwapi.Position;
import bwapi.Unit;
package bwapi;
/**
* A utility stub class providing a default implementation of {@link BWEventListener},
* override it's methods if you want to handle only some events.
*/
public class DefaultBWListener implements BWEventListener {
@Override
public void onStart() {
}
@Override
public void onEnd(boolean b) {
}
@Override
public void onFrame() {
}
@Override
public void onSendText(String s) {
}
@Override
public void onReceiveText(Player player, String s) {
}
@Override
public void onPlayerLeft(Player player) {
}
@Override | public void onNukeDetect(Position position) { |
vjurenka/BWMirror-Generator | src/generator/java/ClassMirror.java | // Path: src/generator/MirrorContext.java
// public class MirrorContext {
//
// private String packageName;
//
// private HashMap<String, String> cToJavaTypes = new HashMap<>();
//
// private List<String> additionalImports = new ArrayList<>();
//
// public MirrorContext() {
// cToJavaTypes.put("bool", "boolean");
// cToJavaTypes.put("int", "int");
// cToJavaTypes.put("string", "String");
// }
//
// public void setPackage(String packageName) {
// this.packageName = packageName;
// }
//
//
// public String getPackage() {
// return packageName;
// }
//
// public String getPackageDirs() {
// return getPackage().replaceAll("\\.", "/");
// }
//
// @SuppressWarnings("ResultOfMethodCallIgnored")
// public void prepareWrite(File root) {
// File dir = new File(root, getPackageDirs());
// dir.mkdirs();
// }
//
// private boolean isCollection(String cType) {
// return cType.startsWith("set<") || cType.startsWith("vector<");
// }
//
// private boolean isMap(String cType) {
// return cType.startsWith("map<");
// }
//
// private boolean isPair(String cType) {
// return cType.startsWith("pair<");
// }
//
// private boolean isDeque(String cType) {
// return cType.endsWith("::list");
// }
//
// private boolean isBWAPI4Collection(String cType) {
// return cType.endsWith("set");
// }
//
// private String convertPrimitive(String cType) {
// if (cType.equals("int")) {
// return "Integer";
// }
// if (cType.equals("bool")) {
// return "Boolean";
// }
// if (cType.equals("double")) {
// return "Double";
// }
//
// return cType;
// }
//
// private String extractPair(String cType) {
// cType = cType.substring(cType.indexOf("<") + 1, cType.lastIndexOf(">")).trim();
// String[] types = cType.split(",");
// return convertPrimitive(toJavaType(types[0].trim())) + ", " + convertPrimitive(toJavaType(types[1].trim()));
// }
//
//
// private String extractCollectionGeneric(String cType) {
// if(cType.contains("<")){
// cType = cType.substring(cType.indexOf("<") + 1, cType.lastIndexOf(">")).trim();
// }
// if(cType.endsWith("::list")) {
// cType = cType.substring(0, cType.lastIndexOf("::"));
// }
//
// if (cType.contains(":")) {
// cType = cType.substring(cType.lastIndexOf(":") + 1);
// }
// if (cType.endsWith("*")) {
// cType = cType.substring(0, cType.lastIndexOf("*"));
// }
//
//
// return cType;
// }
//
// private String extractBWAPI4CollectionGeneric(String cType) {
// cType = cType.substring(0, cType.length() - 3);
// return cType;
// }
//
//
// public String toJavaType(String cType) {
// if (isDeque(cType)) {
// return "List<" + extractCollectionGeneric(cType) + ">";
// }
// if (isCollection(cType)) {
// return "List<" + extractCollectionGeneric(cType) + ">";
// }
// if (isBWAPI4Collection(cType)) {
// return "List<" + extractBWAPI4CollectionGeneric(cType) + ">";
// }
// if (isMap(cType)) {
// return "Map<" + extractPair(cType) + ">";
// }
// if (isPair(cType)) {
// return "Pair<" + extractPair(cType) + ">";
// }
// String result = cToJavaTypes.get(cType);
// if (result == null) {
// result = cType;
// }
// int ddIndex;
// if ((ddIndex = result.lastIndexOf(':')) != -1) {
// result = result.substring(ddIndex + 1);
// }
// if (result.endsWith("*")) {
// return result.substring(0, result.length() - 1);
// }
// /*if (CJavaPipeline.BWAPI_VERSION == CJavaPipeline.BWAPI_V4 && cType.contains("bwapi.")) {
// cType = cType.replace("bwapi.", "bwapi4.");
// } */
// return result;
// }
//
// public List<String> getAdditionalImports() {
// return additionalImports;
// }
//
// public void setAdditionalImports(List<String> additionalImports) {
// this.additionalImports = additionalImports;
// }
// }
| import c.*;
import generator.MirrorContext;
import java.io.File;
import java.io.PrintStream;
import java.util.List; | package generator.java;
/**
* Created with IntelliJ IDEA.
* User: Vladimir
* Date: 27.2.2014
* Time: 16:02
*/
public class ClassMirror extends Mirror {
private CClass cClass;
private String nativeBinds;
public ClassMirror(CClass cClass) {
this.cClass = cClass;
}
| // Path: src/generator/MirrorContext.java
// public class MirrorContext {
//
// private String packageName;
//
// private HashMap<String, String> cToJavaTypes = new HashMap<>();
//
// private List<String> additionalImports = new ArrayList<>();
//
// public MirrorContext() {
// cToJavaTypes.put("bool", "boolean");
// cToJavaTypes.put("int", "int");
// cToJavaTypes.put("string", "String");
// }
//
// public void setPackage(String packageName) {
// this.packageName = packageName;
// }
//
//
// public String getPackage() {
// return packageName;
// }
//
// public String getPackageDirs() {
// return getPackage().replaceAll("\\.", "/");
// }
//
// @SuppressWarnings("ResultOfMethodCallIgnored")
// public void prepareWrite(File root) {
// File dir = new File(root, getPackageDirs());
// dir.mkdirs();
// }
//
// private boolean isCollection(String cType) {
// return cType.startsWith("set<") || cType.startsWith("vector<");
// }
//
// private boolean isMap(String cType) {
// return cType.startsWith("map<");
// }
//
// private boolean isPair(String cType) {
// return cType.startsWith("pair<");
// }
//
// private boolean isDeque(String cType) {
// return cType.endsWith("::list");
// }
//
// private boolean isBWAPI4Collection(String cType) {
// return cType.endsWith("set");
// }
//
// private String convertPrimitive(String cType) {
// if (cType.equals("int")) {
// return "Integer";
// }
// if (cType.equals("bool")) {
// return "Boolean";
// }
// if (cType.equals("double")) {
// return "Double";
// }
//
// return cType;
// }
//
// private String extractPair(String cType) {
// cType = cType.substring(cType.indexOf("<") + 1, cType.lastIndexOf(">")).trim();
// String[] types = cType.split(",");
// return convertPrimitive(toJavaType(types[0].trim())) + ", " + convertPrimitive(toJavaType(types[1].trim()));
// }
//
//
// private String extractCollectionGeneric(String cType) {
// if(cType.contains("<")){
// cType = cType.substring(cType.indexOf("<") + 1, cType.lastIndexOf(">")).trim();
// }
// if(cType.endsWith("::list")) {
// cType = cType.substring(0, cType.lastIndexOf("::"));
// }
//
// if (cType.contains(":")) {
// cType = cType.substring(cType.lastIndexOf(":") + 1);
// }
// if (cType.endsWith("*")) {
// cType = cType.substring(0, cType.lastIndexOf("*"));
// }
//
//
// return cType;
// }
//
// private String extractBWAPI4CollectionGeneric(String cType) {
// cType = cType.substring(0, cType.length() - 3);
// return cType;
// }
//
//
// public String toJavaType(String cType) {
// if (isDeque(cType)) {
// return "List<" + extractCollectionGeneric(cType) + ">";
// }
// if (isCollection(cType)) {
// return "List<" + extractCollectionGeneric(cType) + ">";
// }
// if (isBWAPI4Collection(cType)) {
// return "List<" + extractBWAPI4CollectionGeneric(cType) + ">";
// }
// if (isMap(cType)) {
// return "Map<" + extractPair(cType) + ">";
// }
// if (isPair(cType)) {
// return "Pair<" + extractPair(cType) + ">";
// }
// String result = cToJavaTypes.get(cType);
// if (result == null) {
// result = cType;
// }
// int ddIndex;
// if ((ddIndex = result.lastIndexOf(':')) != -1) {
// result = result.substring(ddIndex + 1);
// }
// if (result.endsWith("*")) {
// return result.substring(0, result.length() - 1);
// }
// /*if (CJavaPipeline.BWAPI_VERSION == CJavaPipeline.BWAPI_V4 && cType.contains("bwapi.")) {
// cType = cType.replace("bwapi.", "bwapi4.");
// } */
// return result;
// }
//
// public List<String> getAdditionalImports() {
// return additionalImports;
// }
//
// public void setAdditionalImports(List<String> additionalImports) {
// this.additionalImports = additionalImports;
// }
// }
// Path: src/generator/java/ClassMirror.java
import c.*;
import generator.MirrorContext;
import java.io.File;
import java.io.PrintStream;
import java.util.List;
package generator.java;
/**
* Created with IntelliJ IDEA.
* User: Vladimir
* Date: 27.2.2014
* Time: 16:02
*/
public class ClassMirror extends Mirror {
private CClass cClass;
private String nativeBinds;
public ClassMirror(CClass cClass) {
this.cClass = cClass;
}
| public void write(File root, MirrorContext context, String superClass) throws Exception { |
vjurenka/BWMirror-Generator | src/inject/GetPolygonPointsInjector.java | // Path: src/api/DefaultEventListener.java
// public class DefaultEventListener implements GeneratorEventListener {
// @Override
// public void onPackageProcessingStart(PackageProcessOptions packageProcessOptions, MirrorContext mirrorContext, Generator generator, List<CDeclaration> cDeclarationList) {
//
// }
//
// @Override
// public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) {
// }
//
// @Override
// public void onPackageProcessingEnd(PackageProcessOptions packageProcessOptions) {
//
// }
//
// @Override
// public void beforeManual() {
//
// }
//
// @Override
// public void afterManual() {
//
// }
//
// @Override
// public void beforeCompile() {
//
// }
//
// @Override
// public void afterCompile() {
//
// }
//
// @Override
// public void beforeHeaders() {
//
// }
//
// @Override
// public void afterHeaders() {
//
// }
// }
//
// Path: src/c/CClass.java
// public interface CClass extends CDeclaration {
//
// public List<Field> getFields();
//
// public boolean isStatic();
// }
//
// Path: src/c/CDeclaration.java
// public interface CDeclaration {
// public String getName();
// public DeclarationType getDeclType();
// public void setJavadoc(String string);
// public String getJavadoc();
//
// }
//
// Path: src/c/Param.java
// public class Param extends Triple<String, String, String> {
//
// public Param() {
// }
//
// public Param(String first, String second) {
// super(first, second);
// }
//
// //c type, name, javatype
// public Param(String first, String second, String third) {
// super(first, second, third);
// }
// }
//
// Path: src/generator/PackageProcessOptions.java
// public class PackageProcessOptions {
//
// //name of the package to create (bwapi/bwta)
// public String packageName;
//
// //directory where C headers are located
// public File cHeadersDir;
//
// //optional - name of class which will hold global functions
// public String globalClassName;
//
// //optional - list of classes that should be used in import statements in created .java files
// public List<String> additionalImportClasses;
//
// //optional - directory containing files that should be copied inside the generated api
// public File manualCopyClassesDir;
// }
//
// Path: src/impl/Function.java
// public class Function implements Method {
//
// String returnType;
//
// String name;
//
// ArrayList<Param> args = new ArrayList<Param>();
//
// boolean isStatic = false;
//
// @Override
// public List<Param> getParams() {
// return args;
// }
//
// @Override
// public Method clone() {
// Function f = new Function();
// f.name = name;
// f.returnType = returnType;
// //f.args.addAll(args);
// for (Param p : args){
// f.args.add(new Param(p.first, p.second, p.third));
// }
// f.isStatic = isStatic;
// return f;
// }
//
// Function() {
// }
//
// public Function(String name, String returnType, boolean isStatic, ArrayList<Param> args) {
// this.name = name;
// this.returnType = returnType;
// this.isStatic = isStatic;
// this.args = args;
// }
//
// @Override
// public String getType() {
// return returnType;
// }
//
// //final functions are not supported yet
// @Override
// public boolean isFinal() {
// return false;
// }
//
// @Override
// public String getName() {
// return name;
// }
//
// public String toString(){
// String sig = returnType +" "+name+"(";
// for(Param p: getParams()){
// sig += p.first +" "+p.second +" ";
// }
// sig +=")";
// return sig;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Function)) return false;
//
// Function function = (Function) o;
//
// if (name != null ? !name.equals(function.name) : function.name != null) return false;
// if (returnType != null ? !returnType.equals(function.returnType) : function.returnType != null) return false;
//
// if(this.args.size()!= function.args.size()){return false;}
//
// for(int i = 0; i < args.size(); i++){
// if(!args.get(i).first.equals(function.args.get(i).first)){
// return false;
// }
// }
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = returnType != null ? returnType.hashCode() : 0;
// result = 31 * result + (name != null ? name.hashCode() : 0);
// result = 31 * result + (args != null ? args.hashCode() : 0);
// return result;
// }
//
// @Override
// public DeclarationType getDeclType() {
// return DeclarationType.METHOD;
// }
//
// private String javadoc;
//
// public String getJavadoc() {
// return javadoc;
// }
//
// public void setJavadoc(String javadoc) {
// this.javadoc = javadoc;
// }
//
// @Override
// public boolean isStatic() {
// return isStatic;
// }
//
// public void setStatic(boolean isStatic) {
// this.isStatic = isStatic;
// }
// }
| import api.DefaultEventListener;
import c.CClass;
import c.CDeclaration;
import c.Param;
import generator.PackageProcessOptions;
import impl.Function;
import java.util.ArrayList; | package inject;
public class GetPolygonPointsInjector extends DefaultEventListener {
@Override | // Path: src/api/DefaultEventListener.java
// public class DefaultEventListener implements GeneratorEventListener {
// @Override
// public void onPackageProcessingStart(PackageProcessOptions packageProcessOptions, MirrorContext mirrorContext, Generator generator, List<CDeclaration> cDeclarationList) {
//
// }
//
// @Override
// public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) {
// }
//
// @Override
// public void onPackageProcessingEnd(PackageProcessOptions packageProcessOptions) {
//
// }
//
// @Override
// public void beforeManual() {
//
// }
//
// @Override
// public void afterManual() {
//
// }
//
// @Override
// public void beforeCompile() {
//
// }
//
// @Override
// public void afterCompile() {
//
// }
//
// @Override
// public void beforeHeaders() {
//
// }
//
// @Override
// public void afterHeaders() {
//
// }
// }
//
// Path: src/c/CClass.java
// public interface CClass extends CDeclaration {
//
// public List<Field> getFields();
//
// public boolean isStatic();
// }
//
// Path: src/c/CDeclaration.java
// public interface CDeclaration {
// public String getName();
// public DeclarationType getDeclType();
// public void setJavadoc(String string);
// public String getJavadoc();
//
// }
//
// Path: src/c/Param.java
// public class Param extends Triple<String, String, String> {
//
// public Param() {
// }
//
// public Param(String first, String second) {
// super(first, second);
// }
//
// //c type, name, javatype
// public Param(String first, String second, String third) {
// super(first, second, third);
// }
// }
//
// Path: src/generator/PackageProcessOptions.java
// public class PackageProcessOptions {
//
// //name of the package to create (bwapi/bwta)
// public String packageName;
//
// //directory where C headers are located
// public File cHeadersDir;
//
// //optional - name of class which will hold global functions
// public String globalClassName;
//
// //optional - list of classes that should be used in import statements in created .java files
// public List<String> additionalImportClasses;
//
// //optional - directory containing files that should be copied inside the generated api
// public File manualCopyClassesDir;
// }
//
// Path: src/impl/Function.java
// public class Function implements Method {
//
// String returnType;
//
// String name;
//
// ArrayList<Param> args = new ArrayList<Param>();
//
// boolean isStatic = false;
//
// @Override
// public List<Param> getParams() {
// return args;
// }
//
// @Override
// public Method clone() {
// Function f = new Function();
// f.name = name;
// f.returnType = returnType;
// //f.args.addAll(args);
// for (Param p : args){
// f.args.add(new Param(p.first, p.second, p.third));
// }
// f.isStatic = isStatic;
// return f;
// }
//
// Function() {
// }
//
// public Function(String name, String returnType, boolean isStatic, ArrayList<Param> args) {
// this.name = name;
// this.returnType = returnType;
// this.isStatic = isStatic;
// this.args = args;
// }
//
// @Override
// public String getType() {
// return returnType;
// }
//
// //final functions are not supported yet
// @Override
// public boolean isFinal() {
// return false;
// }
//
// @Override
// public String getName() {
// return name;
// }
//
// public String toString(){
// String sig = returnType +" "+name+"(";
// for(Param p: getParams()){
// sig += p.first +" "+p.second +" ";
// }
// sig +=")";
// return sig;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Function)) return false;
//
// Function function = (Function) o;
//
// if (name != null ? !name.equals(function.name) : function.name != null) return false;
// if (returnType != null ? !returnType.equals(function.returnType) : function.returnType != null) return false;
//
// if(this.args.size()!= function.args.size()){return false;}
//
// for(int i = 0; i < args.size(); i++){
// if(!args.get(i).first.equals(function.args.get(i).first)){
// return false;
// }
// }
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = returnType != null ? returnType.hashCode() : 0;
// result = 31 * result + (name != null ? name.hashCode() : 0);
// result = 31 * result + (args != null ? args.hashCode() : 0);
// return result;
// }
//
// @Override
// public DeclarationType getDeclType() {
// return DeclarationType.METHOD;
// }
//
// private String javadoc;
//
// public String getJavadoc() {
// return javadoc;
// }
//
// public void setJavadoc(String javadoc) {
// this.javadoc = javadoc;
// }
//
// @Override
// public boolean isStatic() {
// return isStatic;
// }
//
// public void setStatic(boolean isStatic) {
// this.isStatic = isStatic;
// }
// }
// Path: src/inject/GetPolygonPointsInjector.java
import api.DefaultEventListener;
import c.CClass;
import c.CDeclaration;
import c.Param;
import generator.PackageProcessOptions;
import impl.Function;
import java.util.ArrayList;
package inject;
public class GetPolygonPointsInjector extends DefaultEventListener {
@Override | public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) { |
vjurenka/BWMirror-Generator | src/inject/GetPolygonPointsInjector.java | // Path: src/api/DefaultEventListener.java
// public class DefaultEventListener implements GeneratorEventListener {
// @Override
// public void onPackageProcessingStart(PackageProcessOptions packageProcessOptions, MirrorContext mirrorContext, Generator generator, List<CDeclaration> cDeclarationList) {
//
// }
//
// @Override
// public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) {
// }
//
// @Override
// public void onPackageProcessingEnd(PackageProcessOptions packageProcessOptions) {
//
// }
//
// @Override
// public void beforeManual() {
//
// }
//
// @Override
// public void afterManual() {
//
// }
//
// @Override
// public void beforeCompile() {
//
// }
//
// @Override
// public void afterCompile() {
//
// }
//
// @Override
// public void beforeHeaders() {
//
// }
//
// @Override
// public void afterHeaders() {
//
// }
// }
//
// Path: src/c/CClass.java
// public interface CClass extends CDeclaration {
//
// public List<Field> getFields();
//
// public boolean isStatic();
// }
//
// Path: src/c/CDeclaration.java
// public interface CDeclaration {
// public String getName();
// public DeclarationType getDeclType();
// public void setJavadoc(String string);
// public String getJavadoc();
//
// }
//
// Path: src/c/Param.java
// public class Param extends Triple<String, String, String> {
//
// public Param() {
// }
//
// public Param(String first, String second) {
// super(first, second);
// }
//
// //c type, name, javatype
// public Param(String first, String second, String third) {
// super(first, second, third);
// }
// }
//
// Path: src/generator/PackageProcessOptions.java
// public class PackageProcessOptions {
//
// //name of the package to create (bwapi/bwta)
// public String packageName;
//
// //directory where C headers are located
// public File cHeadersDir;
//
// //optional - name of class which will hold global functions
// public String globalClassName;
//
// //optional - list of classes that should be used in import statements in created .java files
// public List<String> additionalImportClasses;
//
// //optional - directory containing files that should be copied inside the generated api
// public File manualCopyClassesDir;
// }
//
// Path: src/impl/Function.java
// public class Function implements Method {
//
// String returnType;
//
// String name;
//
// ArrayList<Param> args = new ArrayList<Param>();
//
// boolean isStatic = false;
//
// @Override
// public List<Param> getParams() {
// return args;
// }
//
// @Override
// public Method clone() {
// Function f = new Function();
// f.name = name;
// f.returnType = returnType;
// //f.args.addAll(args);
// for (Param p : args){
// f.args.add(new Param(p.first, p.second, p.third));
// }
// f.isStatic = isStatic;
// return f;
// }
//
// Function() {
// }
//
// public Function(String name, String returnType, boolean isStatic, ArrayList<Param> args) {
// this.name = name;
// this.returnType = returnType;
// this.isStatic = isStatic;
// this.args = args;
// }
//
// @Override
// public String getType() {
// return returnType;
// }
//
// //final functions are not supported yet
// @Override
// public boolean isFinal() {
// return false;
// }
//
// @Override
// public String getName() {
// return name;
// }
//
// public String toString(){
// String sig = returnType +" "+name+"(";
// for(Param p: getParams()){
// sig += p.first +" "+p.second +" ";
// }
// sig +=")";
// return sig;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Function)) return false;
//
// Function function = (Function) o;
//
// if (name != null ? !name.equals(function.name) : function.name != null) return false;
// if (returnType != null ? !returnType.equals(function.returnType) : function.returnType != null) return false;
//
// if(this.args.size()!= function.args.size()){return false;}
//
// for(int i = 0; i < args.size(); i++){
// if(!args.get(i).first.equals(function.args.get(i).first)){
// return false;
// }
// }
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = returnType != null ? returnType.hashCode() : 0;
// result = 31 * result + (name != null ? name.hashCode() : 0);
// result = 31 * result + (args != null ? args.hashCode() : 0);
// return result;
// }
//
// @Override
// public DeclarationType getDeclType() {
// return DeclarationType.METHOD;
// }
//
// private String javadoc;
//
// public String getJavadoc() {
// return javadoc;
// }
//
// public void setJavadoc(String javadoc) {
// this.javadoc = javadoc;
// }
//
// @Override
// public boolean isStatic() {
// return isStatic;
// }
//
// public void setStatic(boolean isStatic) {
// this.isStatic = isStatic;
// }
// }
| import api.DefaultEventListener;
import c.CClass;
import c.CDeclaration;
import c.Param;
import generator.PackageProcessOptions;
import impl.Function;
import java.util.ArrayList; | package inject;
public class GetPolygonPointsInjector extends DefaultEventListener {
@Override | // Path: src/api/DefaultEventListener.java
// public class DefaultEventListener implements GeneratorEventListener {
// @Override
// public void onPackageProcessingStart(PackageProcessOptions packageProcessOptions, MirrorContext mirrorContext, Generator generator, List<CDeclaration> cDeclarationList) {
//
// }
//
// @Override
// public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) {
// }
//
// @Override
// public void onPackageProcessingEnd(PackageProcessOptions packageProcessOptions) {
//
// }
//
// @Override
// public void beforeManual() {
//
// }
//
// @Override
// public void afterManual() {
//
// }
//
// @Override
// public void beforeCompile() {
//
// }
//
// @Override
// public void afterCompile() {
//
// }
//
// @Override
// public void beforeHeaders() {
//
// }
//
// @Override
// public void afterHeaders() {
//
// }
// }
//
// Path: src/c/CClass.java
// public interface CClass extends CDeclaration {
//
// public List<Field> getFields();
//
// public boolean isStatic();
// }
//
// Path: src/c/CDeclaration.java
// public interface CDeclaration {
// public String getName();
// public DeclarationType getDeclType();
// public void setJavadoc(String string);
// public String getJavadoc();
//
// }
//
// Path: src/c/Param.java
// public class Param extends Triple<String, String, String> {
//
// public Param() {
// }
//
// public Param(String first, String second) {
// super(first, second);
// }
//
// //c type, name, javatype
// public Param(String first, String second, String third) {
// super(first, second, third);
// }
// }
//
// Path: src/generator/PackageProcessOptions.java
// public class PackageProcessOptions {
//
// //name of the package to create (bwapi/bwta)
// public String packageName;
//
// //directory where C headers are located
// public File cHeadersDir;
//
// //optional - name of class which will hold global functions
// public String globalClassName;
//
// //optional - list of classes that should be used in import statements in created .java files
// public List<String> additionalImportClasses;
//
// //optional - directory containing files that should be copied inside the generated api
// public File manualCopyClassesDir;
// }
//
// Path: src/impl/Function.java
// public class Function implements Method {
//
// String returnType;
//
// String name;
//
// ArrayList<Param> args = new ArrayList<Param>();
//
// boolean isStatic = false;
//
// @Override
// public List<Param> getParams() {
// return args;
// }
//
// @Override
// public Method clone() {
// Function f = new Function();
// f.name = name;
// f.returnType = returnType;
// //f.args.addAll(args);
// for (Param p : args){
// f.args.add(new Param(p.first, p.second, p.third));
// }
// f.isStatic = isStatic;
// return f;
// }
//
// Function() {
// }
//
// public Function(String name, String returnType, boolean isStatic, ArrayList<Param> args) {
// this.name = name;
// this.returnType = returnType;
// this.isStatic = isStatic;
// this.args = args;
// }
//
// @Override
// public String getType() {
// return returnType;
// }
//
// //final functions are not supported yet
// @Override
// public boolean isFinal() {
// return false;
// }
//
// @Override
// public String getName() {
// return name;
// }
//
// public String toString(){
// String sig = returnType +" "+name+"(";
// for(Param p: getParams()){
// sig += p.first +" "+p.second +" ";
// }
// sig +=")";
// return sig;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Function)) return false;
//
// Function function = (Function) o;
//
// if (name != null ? !name.equals(function.name) : function.name != null) return false;
// if (returnType != null ? !returnType.equals(function.returnType) : function.returnType != null) return false;
//
// if(this.args.size()!= function.args.size()){return false;}
//
// for(int i = 0; i < args.size(); i++){
// if(!args.get(i).first.equals(function.args.get(i).first)){
// return false;
// }
// }
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = returnType != null ? returnType.hashCode() : 0;
// result = 31 * result + (name != null ? name.hashCode() : 0);
// result = 31 * result + (args != null ? args.hashCode() : 0);
// return result;
// }
//
// @Override
// public DeclarationType getDeclType() {
// return DeclarationType.METHOD;
// }
//
// private String javadoc;
//
// public String getJavadoc() {
// return javadoc;
// }
//
// public void setJavadoc(String javadoc) {
// this.javadoc = javadoc;
// }
//
// @Override
// public boolean isStatic() {
// return isStatic;
// }
//
// public void setStatic(boolean isStatic) {
// this.isStatic = isStatic;
// }
// }
// Path: src/inject/GetPolygonPointsInjector.java
import api.DefaultEventListener;
import c.CClass;
import c.CDeclaration;
import c.Param;
import generator.PackageProcessOptions;
import impl.Function;
import java.util.ArrayList;
package inject;
public class GetPolygonPointsInjector extends DefaultEventListener {
@Override | public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) { |
vjurenka/BWMirror-Generator | src/inject/GetPolygonPointsInjector.java | // Path: src/api/DefaultEventListener.java
// public class DefaultEventListener implements GeneratorEventListener {
// @Override
// public void onPackageProcessingStart(PackageProcessOptions packageProcessOptions, MirrorContext mirrorContext, Generator generator, List<CDeclaration> cDeclarationList) {
//
// }
//
// @Override
// public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) {
// }
//
// @Override
// public void onPackageProcessingEnd(PackageProcessOptions packageProcessOptions) {
//
// }
//
// @Override
// public void beforeManual() {
//
// }
//
// @Override
// public void afterManual() {
//
// }
//
// @Override
// public void beforeCompile() {
//
// }
//
// @Override
// public void afterCompile() {
//
// }
//
// @Override
// public void beforeHeaders() {
//
// }
//
// @Override
// public void afterHeaders() {
//
// }
// }
//
// Path: src/c/CClass.java
// public interface CClass extends CDeclaration {
//
// public List<Field> getFields();
//
// public boolean isStatic();
// }
//
// Path: src/c/CDeclaration.java
// public interface CDeclaration {
// public String getName();
// public DeclarationType getDeclType();
// public void setJavadoc(String string);
// public String getJavadoc();
//
// }
//
// Path: src/c/Param.java
// public class Param extends Triple<String, String, String> {
//
// public Param() {
// }
//
// public Param(String first, String second) {
// super(first, second);
// }
//
// //c type, name, javatype
// public Param(String first, String second, String third) {
// super(first, second, third);
// }
// }
//
// Path: src/generator/PackageProcessOptions.java
// public class PackageProcessOptions {
//
// //name of the package to create (bwapi/bwta)
// public String packageName;
//
// //directory where C headers are located
// public File cHeadersDir;
//
// //optional - name of class which will hold global functions
// public String globalClassName;
//
// //optional - list of classes that should be used in import statements in created .java files
// public List<String> additionalImportClasses;
//
// //optional - directory containing files that should be copied inside the generated api
// public File manualCopyClassesDir;
// }
//
// Path: src/impl/Function.java
// public class Function implements Method {
//
// String returnType;
//
// String name;
//
// ArrayList<Param> args = new ArrayList<Param>();
//
// boolean isStatic = false;
//
// @Override
// public List<Param> getParams() {
// return args;
// }
//
// @Override
// public Method clone() {
// Function f = new Function();
// f.name = name;
// f.returnType = returnType;
// //f.args.addAll(args);
// for (Param p : args){
// f.args.add(new Param(p.first, p.second, p.third));
// }
// f.isStatic = isStatic;
// return f;
// }
//
// Function() {
// }
//
// public Function(String name, String returnType, boolean isStatic, ArrayList<Param> args) {
// this.name = name;
// this.returnType = returnType;
// this.isStatic = isStatic;
// this.args = args;
// }
//
// @Override
// public String getType() {
// return returnType;
// }
//
// //final functions are not supported yet
// @Override
// public boolean isFinal() {
// return false;
// }
//
// @Override
// public String getName() {
// return name;
// }
//
// public String toString(){
// String sig = returnType +" "+name+"(";
// for(Param p: getParams()){
// sig += p.first +" "+p.second +" ";
// }
// sig +=")";
// return sig;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Function)) return false;
//
// Function function = (Function) o;
//
// if (name != null ? !name.equals(function.name) : function.name != null) return false;
// if (returnType != null ? !returnType.equals(function.returnType) : function.returnType != null) return false;
//
// if(this.args.size()!= function.args.size()){return false;}
//
// for(int i = 0; i < args.size(); i++){
// if(!args.get(i).first.equals(function.args.get(i).first)){
// return false;
// }
// }
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = returnType != null ? returnType.hashCode() : 0;
// result = 31 * result + (name != null ? name.hashCode() : 0);
// result = 31 * result + (args != null ? args.hashCode() : 0);
// return result;
// }
//
// @Override
// public DeclarationType getDeclType() {
// return DeclarationType.METHOD;
// }
//
// private String javadoc;
//
// public String getJavadoc() {
// return javadoc;
// }
//
// public void setJavadoc(String javadoc) {
// this.javadoc = javadoc;
// }
//
// @Override
// public boolean isStatic() {
// return isStatic;
// }
//
// public void setStatic(boolean isStatic) {
// this.isStatic = isStatic;
// }
// }
| import api.DefaultEventListener;
import c.CClass;
import c.CDeclaration;
import c.Param;
import generator.PackageProcessOptions;
import impl.Function;
import java.util.ArrayList; | package inject;
public class GetPolygonPointsInjector extends DefaultEventListener {
@Override
public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) {
if (cDeclaration.getName().equals("Polygon") && packageProcessOptions.packageName.equals("bwta")) { | // Path: src/api/DefaultEventListener.java
// public class DefaultEventListener implements GeneratorEventListener {
// @Override
// public void onPackageProcessingStart(PackageProcessOptions packageProcessOptions, MirrorContext mirrorContext, Generator generator, List<CDeclaration> cDeclarationList) {
//
// }
//
// @Override
// public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) {
// }
//
// @Override
// public void onPackageProcessingEnd(PackageProcessOptions packageProcessOptions) {
//
// }
//
// @Override
// public void beforeManual() {
//
// }
//
// @Override
// public void afterManual() {
//
// }
//
// @Override
// public void beforeCompile() {
//
// }
//
// @Override
// public void afterCompile() {
//
// }
//
// @Override
// public void beforeHeaders() {
//
// }
//
// @Override
// public void afterHeaders() {
//
// }
// }
//
// Path: src/c/CClass.java
// public interface CClass extends CDeclaration {
//
// public List<Field> getFields();
//
// public boolean isStatic();
// }
//
// Path: src/c/CDeclaration.java
// public interface CDeclaration {
// public String getName();
// public DeclarationType getDeclType();
// public void setJavadoc(String string);
// public String getJavadoc();
//
// }
//
// Path: src/c/Param.java
// public class Param extends Triple<String, String, String> {
//
// public Param() {
// }
//
// public Param(String first, String second) {
// super(first, second);
// }
//
// //c type, name, javatype
// public Param(String first, String second, String third) {
// super(first, second, third);
// }
// }
//
// Path: src/generator/PackageProcessOptions.java
// public class PackageProcessOptions {
//
// //name of the package to create (bwapi/bwta)
// public String packageName;
//
// //directory where C headers are located
// public File cHeadersDir;
//
// //optional - name of class which will hold global functions
// public String globalClassName;
//
// //optional - list of classes that should be used in import statements in created .java files
// public List<String> additionalImportClasses;
//
// //optional - directory containing files that should be copied inside the generated api
// public File manualCopyClassesDir;
// }
//
// Path: src/impl/Function.java
// public class Function implements Method {
//
// String returnType;
//
// String name;
//
// ArrayList<Param> args = new ArrayList<Param>();
//
// boolean isStatic = false;
//
// @Override
// public List<Param> getParams() {
// return args;
// }
//
// @Override
// public Method clone() {
// Function f = new Function();
// f.name = name;
// f.returnType = returnType;
// //f.args.addAll(args);
// for (Param p : args){
// f.args.add(new Param(p.first, p.second, p.third));
// }
// f.isStatic = isStatic;
// return f;
// }
//
// Function() {
// }
//
// public Function(String name, String returnType, boolean isStatic, ArrayList<Param> args) {
// this.name = name;
// this.returnType = returnType;
// this.isStatic = isStatic;
// this.args = args;
// }
//
// @Override
// public String getType() {
// return returnType;
// }
//
// //final functions are not supported yet
// @Override
// public boolean isFinal() {
// return false;
// }
//
// @Override
// public String getName() {
// return name;
// }
//
// public String toString(){
// String sig = returnType +" "+name+"(";
// for(Param p: getParams()){
// sig += p.first +" "+p.second +" ";
// }
// sig +=")";
// return sig;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Function)) return false;
//
// Function function = (Function) o;
//
// if (name != null ? !name.equals(function.name) : function.name != null) return false;
// if (returnType != null ? !returnType.equals(function.returnType) : function.returnType != null) return false;
//
// if(this.args.size()!= function.args.size()){return false;}
//
// for(int i = 0; i < args.size(); i++){
// if(!args.get(i).first.equals(function.args.get(i).first)){
// return false;
// }
// }
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = returnType != null ? returnType.hashCode() : 0;
// result = 31 * result + (name != null ? name.hashCode() : 0);
// result = 31 * result + (args != null ? args.hashCode() : 0);
// return result;
// }
//
// @Override
// public DeclarationType getDeclType() {
// return DeclarationType.METHOD;
// }
//
// private String javadoc;
//
// public String getJavadoc() {
// return javadoc;
// }
//
// public void setJavadoc(String javadoc) {
// this.javadoc = javadoc;
// }
//
// @Override
// public boolean isStatic() {
// return isStatic;
// }
//
// public void setStatic(boolean isStatic) {
// this.isStatic = isStatic;
// }
// }
// Path: src/inject/GetPolygonPointsInjector.java
import api.DefaultEventListener;
import c.CClass;
import c.CDeclaration;
import c.Param;
import generator.PackageProcessOptions;
import impl.Function;
import java.util.ArrayList;
package inject;
public class GetPolygonPointsInjector extends DefaultEventListener {
@Override
public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) {
if (cDeclaration.getName().equals("Polygon") && packageProcessOptions.packageName.equals("bwta")) { | CClass cClass = (CClass) cDeclaration; |
vjurenka/BWMirror-Generator | src/inject/GetPolygonPointsInjector.java | // Path: src/api/DefaultEventListener.java
// public class DefaultEventListener implements GeneratorEventListener {
// @Override
// public void onPackageProcessingStart(PackageProcessOptions packageProcessOptions, MirrorContext mirrorContext, Generator generator, List<CDeclaration> cDeclarationList) {
//
// }
//
// @Override
// public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) {
// }
//
// @Override
// public void onPackageProcessingEnd(PackageProcessOptions packageProcessOptions) {
//
// }
//
// @Override
// public void beforeManual() {
//
// }
//
// @Override
// public void afterManual() {
//
// }
//
// @Override
// public void beforeCompile() {
//
// }
//
// @Override
// public void afterCompile() {
//
// }
//
// @Override
// public void beforeHeaders() {
//
// }
//
// @Override
// public void afterHeaders() {
//
// }
// }
//
// Path: src/c/CClass.java
// public interface CClass extends CDeclaration {
//
// public List<Field> getFields();
//
// public boolean isStatic();
// }
//
// Path: src/c/CDeclaration.java
// public interface CDeclaration {
// public String getName();
// public DeclarationType getDeclType();
// public void setJavadoc(String string);
// public String getJavadoc();
//
// }
//
// Path: src/c/Param.java
// public class Param extends Triple<String, String, String> {
//
// public Param() {
// }
//
// public Param(String first, String second) {
// super(first, second);
// }
//
// //c type, name, javatype
// public Param(String first, String second, String third) {
// super(first, second, third);
// }
// }
//
// Path: src/generator/PackageProcessOptions.java
// public class PackageProcessOptions {
//
// //name of the package to create (bwapi/bwta)
// public String packageName;
//
// //directory where C headers are located
// public File cHeadersDir;
//
// //optional - name of class which will hold global functions
// public String globalClassName;
//
// //optional - list of classes that should be used in import statements in created .java files
// public List<String> additionalImportClasses;
//
// //optional - directory containing files that should be copied inside the generated api
// public File manualCopyClassesDir;
// }
//
// Path: src/impl/Function.java
// public class Function implements Method {
//
// String returnType;
//
// String name;
//
// ArrayList<Param> args = new ArrayList<Param>();
//
// boolean isStatic = false;
//
// @Override
// public List<Param> getParams() {
// return args;
// }
//
// @Override
// public Method clone() {
// Function f = new Function();
// f.name = name;
// f.returnType = returnType;
// //f.args.addAll(args);
// for (Param p : args){
// f.args.add(new Param(p.first, p.second, p.third));
// }
// f.isStatic = isStatic;
// return f;
// }
//
// Function() {
// }
//
// public Function(String name, String returnType, boolean isStatic, ArrayList<Param> args) {
// this.name = name;
// this.returnType = returnType;
// this.isStatic = isStatic;
// this.args = args;
// }
//
// @Override
// public String getType() {
// return returnType;
// }
//
// //final functions are not supported yet
// @Override
// public boolean isFinal() {
// return false;
// }
//
// @Override
// public String getName() {
// return name;
// }
//
// public String toString(){
// String sig = returnType +" "+name+"(";
// for(Param p: getParams()){
// sig += p.first +" "+p.second +" ";
// }
// sig +=")";
// return sig;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Function)) return false;
//
// Function function = (Function) o;
//
// if (name != null ? !name.equals(function.name) : function.name != null) return false;
// if (returnType != null ? !returnType.equals(function.returnType) : function.returnType != null) return false;
//
// if(this.args.size()!= function.args.size()){return false;}
//
// for(int i = 0; i < args.size(); i++){
// if(!args.get(i).first.equals(function.args.get(i).first)){
// return false;
// }
// }
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = returnType != null ? returnType.hashCode() : 0;
// result = 31 * result + (name != null ? name.hashCode() : 0);
// result = 31 * result + (args != null ? args.hashCode() : 0);
// return result;
// }
//
// @Override
// public DeclarationType getDeclType() {
// return DeclarationType.METHOD;
// }
//
// private String javadoc;
//
// public String getJavadoc() {
// return javadoc;
// }
//
// public void setJavadoc(String javadoc) {
// this.javadoc = javadoc;
// }
//
// @Override
// public boolean isStatic() {
// return isStatic;
// }
//
// public void setStatic(boolean isStatic) {
// this.isStatic = isStatic;
// }
// }
| import api.DefaultEventListener;
import c.CClass;
import c.CDeclaration;
import c.Param;
import generator.PackageProcessOptions;
import impl.Function;
import java.util.ArrayList; | package inject;
public class GetPolygonPointsInjector extends DefaultEventListener {
@Override
public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) {
if (cDeclaration.getName().equals("Polygon") && packageProcessOptions.packageName.equals("bwta")) {
CClass cClass = (CClass) cDeclaration;
| // Path: src/api/DefaultEventListener.java
// public class DefaultEventListener implements GeneratorEventListener {
// @Override
// public void onPackageProcessingStart(PackageProcessOptions packageProcessOptions, MirrorContext mirrorContext, Generator generator, List<CDeclaration> cDeclarationList) {
//
// }
//
// @Override
// public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) {
// }
//
// @Override
// public void onPackageProcessingEnd(PackageProcessOptions packageProcessOptions) {
//
// }
//
// @Override
// public void beforeManual() {
//
// }
//
// @Override
// public void afterManual() {
//
// }
//
// @Override
// public void beforeCompile() {
//
// }
//
// @Override
// public void afterCompile() {
//
// }
//
// @Override
// public void beforeHeaders() {
//
// }
//
// @Override
// public void afterHeaders() {
//
// }
// }
//
// Path: src/c/CClass.java
// public interface CClass extends CDeclaration {
//
// public List<Field> getFields();
//
// public boolean isStatic();
// }
//
// Path: src/c/CDeclaration.java
// public interface CDeclaration {
// public String getName();
// public DeclarationType getDeclType();
// public void setJavadoc(String string);
// public String getJavadoc();
//
// }
//
// Path: src/c/Param.java
// public class Param extends Triple<String, String, String> {
//
// public Param() {
// }
//
// public Param(String first, String second) {
// super(first, second);
// }
//
// //c type, name, javatype
// public Param(String first, String second, String third) {
// super(first, second, third);
// }
// }
//
// Path: src/generator/PackageProcessOptions.java
// public class PackageProcessOptions {
//
// //name of the package to create (bwapi/bwta)
// public String packageName;
//
// //directory where C headers are located
// public File cHeadersDir;
//
// //optional - name of class which will hold global functions
// public String globalClassName;
//
// //optional - list of classes that should be used in import statements in created .java files
// public List<String> additionalImportClasses;
//
// //optional - directory containing files that should be copied inside the generated api
// public File manualCopyClassesDir;
// }
//
// Path: src/impl/Function.java
// public class Function implements Method {
//
// String returnType;
//
// String name;
//
// ArrayList<Param> args = new ArrayList<Param>();
//
// boolean isStatic = false;
//
// @Override
// public List<Param> getParams() {
// return args;
// }
//
// @Override
// public Method clone() {
// Function f = new Function();
// f.name = name;
// f.returnType = returnType;
// //f.args.addAll(args);
// for (Param p : args){
// f.args.add(new Param(p.first, p.second, p.third));
// }
// f.isStatic = isStatic;
// return f;
// }
//
// Function() {
// }
//
// public Function(String name, String returnType, boolean isStatic, ArrayList<Param> args) {
// this.name = name;
// this.returnType = returnType;
// this.isStatic = isStatic;
// this.args = args;
// }
//
// @Override
// public String getType() {
// return returnType;
// }
//
// //final functions are not supported yet
// @Override
// public boolean isFinal() {
// return false;
// }
//
// @Override
// public String getName() {
// return name;
// }
//
// public String toString(){
// String sig = returnType +" "+name+"(";
// for(Param p: getParams()){
// sig += p.first +" "+p.second +" ";
// }
// sig +=")";
// return sig;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Function)) return false;
//
// Function function = (Function) o;
//
// if (name != null ? !name.equals(function.name) : function.name != null) return false;
// if (returnType != null ? !returnType.equals(function.returnType) : function.returnType != null) return false;
//
// if(this.args.size()!= function.args.size()){return false;}
//
// for(int i = 0; i < args.size(); i++){
// if(!args.get(i).first.equals(function.args.get(i).first)){
// return false;
// }
// }
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = returnType != null ? returnType.hashCode() : 0;
// result = 31 * result + (name != null ? name.hashCode() : 0);
// result = 31 * result + (args != null ? args.hashCode() : 0);
// return result;
// }
//
// @Override
// public DeclarationType getDeclType() {
// return DeclarationType.METHOD;
// }
//
// private String javadoc;
//
// public String getJavadoc() {
// return javadoc;
// }
//
// public void setJavadoc(String javadoc) {
// this.javadoc = javadoc;
// }
//
// @Override
// public boolean isStatic() {
// return isStatic;
// }
//
// public void setStatic(boolean isStatic) {
// this.isStatic = isStatic;
// }
// }
// Path: src/inject/GetPolygonPointsInjector.java
import api.DefaultEventListener;
import c.CClass;
import c.CDeclaration;
import c.Param;
import generator.PackageProcessOptions;
import impl.Function;
import java.util.ArrayList;
package inject;
public class GetPolygonPointsInjector extends DefaultEventListener {
@Override
public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) {
if (cDeclaration.getName().equals("Polygon") && packageProcessOptions.packageName.equals("bwta")) {
CClass cClass = (CClass) cDeclaration;
| Function getPolygons = new Function("getPoints", "set<Position>", false, new ArrayList<Param>()); |
vjurenka/BWMirror-Generator | src/inject/GetPolygonPointsInjector.java | // Path: src/api/DefaultEventListener.java
// public class DefaultEventListener implements GeneratorEventListener {
// @Override
// public void onPackageProcessingStart(PackageProcessOptions packageProcessOptions, MirrorContext mirrorContext, Generator generator, List<CDeclaration> cDeclarationList) {
//
// }
//
// @Override
// public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) {
// }
//
// @Override
// public void onPackageProcessingEnd(PackageProcessOptions packageProcessOptions) {
//
// }
//
// @Override
// public void beforeManual() {
//
// }
//
// @Override
// public void afterManual() {
//
// }
//
// @Override
// public void beforeCompile() {
//
// }
//
// @Override
// public void afterCompile() {
//
// }
//
// @Override
// public void beforeHeaders() {
//
// }
//
// @Override
// public void afterHeaders() {
//
// }
// }
//
// Path: src/c/CClass.java
// public interface CClass extends CDeclaration {
//
// public List<Field> getFields();
//
// public boolean isStatic();
// }
//
// Path: src/c/CDeclaration.java
// public interface CDeclaration {
// public String getName();
// public DeclarationType getDeclType();
// public void setJavadoc(String string);
// public String getJavadoc();
//
// }
//
// Path: src/c/Param.java
// public class Param extends Triple<String, String, String> {
//
// public Param() {
// }
//
// public Param(String first, String second) {
// super(first, second);
// }
//
// //c type, name, javatype
// public Param(String first, String second, String third) {
// super(first, second, third);
// }
// }
//
// Path: src/generator/PackageProcessOptions.java
// public class PackageProcessOptions {
//
// //name of the package to create (bwapi/bwta)
// public String packageName;
//
// //directory where C headers are located
// public File cHeadersDir;
//
// //optional - name of class which will hold global functions
// public String globalClassName;
//
// //optional - list of classes that should be used in import statements in created .java files
// public List<String> additionalImportClasses;
//
// //optional - directory containing files that should be copied inside the generated api
// public File manualCopyClassesDir;
// }
//
// Path: src/impl/Function.java
// public class Function implements Method {
//
// String returnType;
//
// String name;
//
// ArrayList<Param> args = new ArrayList<Param>();
//
// boolean isStatic = false;
//
// @Override
// public List<Param> getParams() {
// return args;
// }
//
// @Override
// public Method clone() {
// Function f = new Function();
// f.name = name;
// f.returnType = returnType;
// //f.args.addAll(args);
// for (Param p : args){
// f.args.add(new Param(p.first, p.second, p.third));
// }
// f.isStatic = isStatic;
// return f;
// }
//
// Function() {
// }
//
// public Function(String name, String returnType, boolean isStatic, ArrayList<Param> args) {
// this.name = name;
// this.returnType = returnType;
// this.isStatic = isStatic;
// this.args = args;
// }
//
// @Override
// public String getType() {
// return returnType;
// }
//
// //final functions are not supported yet
// @Override
// public boolean isFinal() {
// return false;
// }
//
// @Override
// public String getName() {
// return name;
// }
//
// public String toString(){
// String sig = returnType +" "+name+"(";
// for(Param p: getParams()){
// sig += p.first +" "+p.second +" ";
// }
// sig +=")";
// return sig;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Function)) return false;
//
// Function function = (Function) o;
//
// if (name != null ? !name.equals(function.name) : function.name != null) return false;
// if (returnType != null ? !returnType.equals(function.returnType) : function.returnType != null) return false;
//
// if(this.args.size()!= function.args.size()){return false;}
//
// for(int i = 0; i < args.size(); i++){
// if(!args.get(i).first.equals(function.args.get(i).first)){
// return false;
// }
// }
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = returnType != null ? returnType.hashCode() : 0;
// result = 31 * result + (name != null ? name.hashCode() : 0);
// result = 31 * result + (args != null ? args.hashCode() : 0);
// return result;
// }
//
// @Override
// public DeclarationType getDeclType() {
// return DeclarationType.METHOD;
// }
//
// private String javadoc;
//
// public String getJavadoc() {
// return javadoc;
// }
//
// public void setJavadoc(String javadoc) {
// this.javadoc = javadoc;
// }
//
// @Override
// public boolean isStatic() {
// return isStatic;
// }
//
// public void setStatic(boolean isStatic) {
// this.isStatic = isStatic;
// }
// }
| import api.DefaultEventListener;
import c.CClass;
import c.CDeclaration;
import c.Param;
import generator.PackageProcessOptions;
import impl.Function;
import java.util.ArrayList; | package inject;
public class GetPolygonPointsInjector extends DefaultEventListener {
@Override
public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) {
if (cDeclaration.getName().equals("Polygon") && packageProcessOptions.packageName.equals("bwta")) {
CClass cClass = (CClass) cDeclaration;
| // Path: src/api/DefaultEventListener.java
// public class DefaultEventListener implements GeneratorEventListener {
// @Override
// public void onPackageProcessingStart(PackageProcessOptions packageProcessOptions, MirrorContext mirrorContext, Generator generator, List<CDeclaration> cDeclarationList) {
//
// }
//
// @Override
// public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) {
// }
//
// @Override
// public void onPackageProcessingEnd(PackageProcessOptions packageProcessOptions) {
//
// }
//
// @Override
// public void beforeManual() {
//
// }
//
// @Override
// public void afterManual() {
//
// }
//
// @Override
// public void beforeCompile() {
//
// }
//
// @Override
// public void afterCompile() {
//
// }
//
// @Override
// public void beforeHeaders() {
//
// }
//
// @Override
// public void afterHeaders() {
//
// }
// }
//
// Path: src/c/CClass.java
// public interface CClass extends CDeclaration {
//
// public List<Field> getFields();
//
// public boolean isStatic();
// }
//
// Path: src/c/CDeclaration.java
// public interface CDeclaration {
// public String getName();
// public DeclarationType getDeclType();
// public void setJavadoc(String string);
// public String getJavadoc();
//
// }
//
// Path: src/c/Param.java
// public class Param extends Triple<String, String, String> {
//
// public Param() {
// }
//
// public Param(String first, String second) {
// super(first, second);
// }
//
// //c type, name, javatype
// public Param(String first, String second, String third) {
// super(first, second, third);
// }
// }
//
// Path: src/generator/PackageProcessOptions.java
// public class PackageProcessOptions {
//
// //name of the package to create (bwapi/bwta)
// public String packageName;
//
// //directory where C headers are located
// public File cHeadersDir;
//
// //optional - name of class which will hold global functions
// public String globalClassName;
//
// //optional - list of classes that should be used in import statements in created .java files
// public List<String> additionalImportClasses;
//
// //optional - directory containing files that should be copied inside the generated api
// public File manualCopyClassesDir;
// }
//
// Path: src/impl/Function.java
// public class Function implements Method {
//
// String returnType;
//
// String name;
//
// ArrayList<Param> args = new ArrayList<Param>();
//
// boolean isStatic = false;
//
// @Override
// public List<Param> getParams() {
// return args;
// }
//
// @Override
// public Method clone() {
// Function f = new Function();
// f.name = name;
// f.returnType = returnType;
// //f.args.addAll(args);
// for (Param p : args){
// f.args.add(new Param(p.first, p.second, p.third));
// }
// f.isStatic = isStatic;
// return f;
// }
//
// Function() {
// }
//
// public Function(String name, String returnType, boolean isStatic, ArrayList<Param> args) {
// this.name = name;
// this.returnType = returnType;
// this.isStatic = isStatic;
// this.args = args;
// }
//
// @Override
// public String getType() {
// return returnType;
// }
//
// //final functions are not supported yet
// @Override
// public boolean isFinal() {
// return false;
// }
//
// @Override
// public String getName() {
// return name;
// }
//
// public String toString(){
// String sig = returnType +" "+name+"(";
// for(Param p: getParams()){
// sig += p.first +" "+p.second +" ";
// }
// sig +=")";
// return sig;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Function)) return false;
//
// Function function = (Function) o;
//
// if (name != null ? !name.equals(function.name) : function.name != null) return false;
// if (returnType != null ? !returnType.equals(function.returnType) : function.returnType != null) return false;
//
// if(this.args.size()!= function.args.size()){return false;}
//
// for(int i = 0; i < args.size(); i++){
// if(!args.get(i).first.equals(function.args.get(i).first)){
// return false;
// }
// }
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = returnType != null ? returnType.hashCode() : 0;
// result = 31 * result + (name != null ? name.hashCode() : 0);
// result = 31 * result + (args != null ? args.hashCode() : 0);
// return result;
// }
//
// @Override
// public DeclarationType getDeclType() {
// return DeclarationType.METHOD;
// }
//
// private String javadoc;
//
// public String getJavadoc() {
// return javadoc;
// }
//
// public void setJavadoc(String javadoc) {
// this.javadoc = javadoc;
// }
//
// @Override
// public boolean isStatic() {
// return isStatic;
// }
//
// public void setStatic(boolean isStatic) {
// this.isStatic = isStatic;
// }
// }
// Path: src/inject/GetPolygonPointsInjector.java
import api.DefaultEventListener;
import c.CClass;
import c.CDeclaration;
import c.Param;
import generator.PackageProcessOptions;
import impl.Function;
import java.util.ArrayList;
package inject;
public class GetPolygonPointsInjector extends DefaultEventListener {
@Override
public void onCDeclarationRead(PackageProcessOptions packageProcessOptions, CDeclaration cDeclaration) {
if (cDeclaration.getName().equals("Polygon") && packageProcessOptions.packageName.equals("bwta")) {
CClass cClass = (CClass) cDeclaration;
| Function getPolygons = new Function("getPoints", "set<Position>", false, new ArrayList<Param>()); |
vjurenka/BWMirror-Generator | src/compile/JavaSourceFile.java | // Path: src/util/FileToString.java
// public class FileToString {
// public static String readFile(URI path) {
// byte[] encoded = new byte[0];
// try {
// encoded = Files.readAllBytes(Paths.get(path));
// } catch (IOException e) {
// e.printStackTrace();
// }
// return new String(encoded, Charset.defaultCharset());
// }
// }
| import util.FileToString;
import javax.tools.SimpleJavaFileObject;
import java.io.File; | package compile;
/**
* User: PC
* Date: 30.4.2014
* Time: 16:30
*/
public class JavaSourceFile extends SimpleJavaFileObject {
private String sourceCode;
public JavaSourceFile(File file) {
super(file.toURI(), Kind.SOURCE); | // Path: src/util/FileToString.java
// public class FileToString {
// public static String readFile(URI path) {
// byte[] encoded = new byte[0];
// try {
// encoded = Files.readAllBytes(Paths.get(path));
// } catch (IOException e) {
// e.printStackTrace();
// }
// return new String(encoded, Charset.defaultCharset());
// }
// }
// Path: src/compile/JavaSourceFile.java
import util.FileToString;
import javax.tools.SimpleJavaFileObject;
import java.io.File;
package compile;
/**
* User: PC
* Date: 30.4.2014
* Time: 16:30
*/
public class JavaSourceFile extends SimpleJavaFileObject {
private String sourceCode;
public JavaSourceFile(File file) {
super(file.toURI(), Kind.SOURCE); | this.sourceCode = FileToString.readFile(file.toURI()); |
vjurenka/BWMirror-Generator | manual-bwapi4/TilePosition.java | // Path: manual-bwapi/Position.java
// public class Position extends AbstractPoint<Position>{
//
// private int x, y;
//
// public Position(int x, int y) {
// this.x = x;
// this.y = y;
// }
//
// public String toString() {
// return "[" + x + ", " + y + "]";
// }
//
// public native boolean isValid();
//
// public native Position makeValid();
//
// public native double getDistance(Position position);
//
// public native int getApproxDistance(Position position);
//
// public native double getLength();
//
// public native boolean hasPath(Position position);
//
// public int getX() {
// return x;
// }
//
// public int getY() {
// return y;
// }
//
// public static Position Invalid;
//
// public static Position None;
//
// public static Position Unknown;
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Position)) return false;
//
// Position position = (Position) o;
//
// if (x != position.x) return false;
// if (y != position.y) return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = x;
// result = 31 * result + y;
// return result;
// }
//
//
// private static Map<Long, Position> instances = new HashMap<Long, Position>();
//
// private Position(long pointer) {
// this.pointer = pointer;
// }
//
// private static Position get(long pointer) {
// Position instance = instances.get(pointer);
// if (instance == null) {
// instance = new Position(pointer);
// instances.put(pointer, instance);
// }
// return instance;
// }
//
// private long pointer;
//
// public Position getPoint(){
// return this;
// }
// }
| import bwapi.Position;
import java.lang.Override;
import java.util.HashMap;
import java.util.Map; | return instance;
}
private long pointer;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TilePosition)) return false;
TilePosition that = (TilePosition) o;
if (x != that.x) return false;
if (y != that.y) return false;
return true;
}
@Override
public int hashCode() {
int result = x;
result = 31 * result + y;
return result;
}
public TilePosition getPoint(){
return this;
}
| // Path: manual-bwapi/Position.java
// public class Position extends AbstractPoint<Position>{
//
// private int x, y;
//
// public Position(int x, int y) {
// this.x = x;
// this.y = y;
// }
//
// public String toString() {
// return "[" + x + ", " + y + "]";
// }
//
// public native boolean isValid();
//
// public native Position makeValid();
//
// public native double getDistance(Position position);
//
// public native int getApproxDistance(Position position);
//
// public native double getLength();
//
// public native boolean hasPath(Position position);
//
// public int getX() {
// return x;
// }
//
// public int getY() {
// return y;
// }
//
// public static Position Invalid;
//
// public static Position None;
//
// public static Position Unknown;
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Position)) return false;
//
// Position position = (Position) o;
//
// if (x != position.x) return false;
// if (y != position.y) return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = x;
// result = 31 * result + y;
// return result;
// }
//
//
// private static Map<Long, Position> instances = new HashMap<Long, Position>();
//
// private Position(long pointer) {
// this.pointer = pointer;
// }
//
// private static Position get(long pointer) {
// Position instance = instances.get(pointer);
// if (instance == null) {
// instance = new Position(pointer);
// instances.put(pointer, instance);
// }
// return instance;
// }
//
// private long pointer;
//
// public Position getPoint(){
// return this;
// }
// }
// Path: manual-bwapi4/TilePosition.java
import bwapi.Position;
import java.lang.Override;
import java.util.HashMap;
import java.util.Map;
return instance;
}
private long pointer;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TilePosition)) return false;
TilePosition that = (TilePosition) o;
if (x != that.x) return false;
if (y != that.y) return false;
return true;
}
@Override
public int hashCode() {
int result = x;
result = 31 * result + y;
return result;
}
public TilePosition getPoint(){
return this;
}
| public Position toPosition(){ |
vjurenka/BWMirror-Generator | manual-bwapi4/Position.java | // Path: manual-bwapi/TilePosition.java
// public class TilePosition extends AbstractPoint<TilePosition>{
// private int x, y;
//
// public TilePosition(int x, int y) {
// this.x = x;
// this.y = y;
// }
//
// public String toString() {
// return "[" + x + ", " + y + "]";
// }
//
// public native boolean hasPath(TilePosition position);
//
// public native boolean isValid();
//
// public native TilePosition makeValid();
//
// public native double getDistance(TilePosition position);
//
// public native double getLength();
//
// public int getX() {
// return x;
// }
//
// public int getY() {
// return y;
// }
//
// public static TilePosition Invalid;
//
// public static TilePosition None;
//
// public static TilePosition Unknown;
//
// private static Map<Long, TilePosition> instances = new HashMap<Long, TilePosition>();
//
// private TilePosition(long pointer) {
// this.pointer = pointer;
// }
//
// private static TilePosition get(long pointer) {
// TilePosition instance = instances.get(pointer);
// if (instance == null) {
// instance = new TilePosition(pointer);
// instances.put(pointer, instance);
// }
// return instance;
// }
//
// private long pointer;
//
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof TilePosition)) return false;
//
// TilePosition that = (TilePosition) o;
//
// if (x != that.x) return false;
// if (y != that.y) return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = x;
// result = 31 * result + y;
// return result;
// }
//
// public TilePosition getPoint(){
// return this;
// }
// }
| import bwapi.TilePosition;
import java.lang.Override;
import java.util.HashMap;
import java.util.Map; |
@Override
public int hashCode() {
int result = x;
result = 31 * result + y;
return result;
}
private static Map<Long, Position> instances = new HashMap<Long, Position>();
private Position(long pointer) {
this.pointer = pointer;
}
private static Position get(long pointer) {
Position instance = instances.get(pointer);
if (instance == null) {
instance = new Position(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
public Position getPoint(){
return this;
}
| // Path: manual-bwapi/TilePosition.java
// public class TilePosition extends AbstractPoint<TilePosition>{
// private int x, y;
//
// public TilePosition(int x, int y) {
// this.x = x;
// this.y = y;
// }
//
// public String toString() {
// return "[" + x + ", " + y + "]";
// }
//
// public native boolean hasPath(TilePosition position);
//
// public native boolean isValid();
//
// public native TilePosition makeValid();
//
// public native double getDistance(TilePosition position);
//
// public native double getLength();
//
// public int getX() {
// return x;
// }
//
// public int getY() {
// return y;
// }
//
// public static TilePosition Invalid;
//
// public static TilePosition None;
//
// public static TilePosition Unknown;
//
// private static Map<Long, TilePosition> instances = new HashMap<Long, TilePosition>();
//
// private TilePosition(long pointer) {
// this.pointer = pointer;
// }
//
// private static TilePosition get(long pointer) {
// TilePosition instance = instances.get(pointer);
// if (instance == null) {
// instance = new TilePosition(pointer);
// instances.put(pointer, instance);
// }
// return instance;
// }
//
// private long pointer;
//
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof TilePosition)) return false;
//
// TilePosition that = (TilePosition) o;
//
// if (x != that.x) return false;
// if (y != that.y) return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = x;
// result = 31 * result + y;
// return result;
// }
//
// public TilePosition getPoint(){
// return this;
// }
// }
// Path: manual-bwapi4/Position.java
import bwapi.TilePosition;
import java.lang.Override;
import java.util.HashMap;
import java.util.Map;
@Override
public int hashCode() {
int result = x;
result = 31 * result + y;
return result;
}
private static Map<Long, Position> instances = new HashMap<Long, Position>();
private Position(long pointer) {
this.pointer = pointer;
}
private static Position get(long pointer) {
Position instance = instances.get(pointer);
if (instance == null) {
instance = new Position(pointer);
instances.put(pointer, instance);
}
return instance;
}
private long pointer;
public Position getPoint(){
return this;
}
| public TilePosition toTilePosition(){ |
vjurenka/BWMirror-Generator | manual-bwapi/DefaultBWListener.java | // Path: manual-bwapi4/BWEventListener.java
// public interface BWEventListener {
//
// public void onStart();
//
// public void onEnd(boolean isWinner);
//
// public void onFrame();
//
// public void onSendText(String text);
//
// public void onReceiveText(Player player, String text);
//
// public void onPlayerLeft(Player player);
//
// public void onNukeDetect(Position target);
//
// public void onUnitDiscover(Unit unit);
//
// public void onUnitEvade(Unit unit);
//
// public void onUnitShow(Unit unit);
//
// public void onUnitHide(Unit unit);
//
// public void onUnitCreate(Unit unit);
//
// public void onUnitDestroy(Unit unit);
//
// public void onUnitMorph(Unit unit);
//
// public void onUnitRenegade(Unit unit);
//
// public void onSaveGame(String gameName);
//
// public void onUnitComplete(Unit unit);
//
// public void onPlayerDropped(Player player);
//
// }
//
// Path: manual-bwapi/Position.java
// public class Position extends AbstractPoint<Position>{
//
// private int x, y;
//
// public Position(int x, int y) {
// this.x = x;
// this.y = y;
// }
//
// public String toString() {
// return "[" + x + ", " + y + "]";
// }
//
// public native boolean isValid();
//
// public native Position makeValid();
//
// public native double getDistance(Position position);
//
// public native int getApproxDistance(Position position);
//
// public native double getLength();
//
// public native boolean hasPath(Position position);
//
// public int getX() {
// return x;
// }
//
// public int getY() {
// return y;
// }
//
// public static Position Invalid;
//
// public static Position None;
//
// public static Position Unknown;
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Position)) return false;
//
// Position position = (Position) o;
//
// if (x != position.x) return false;
// if (y != position.y) return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = x;
// result = 31 * result + y;
// return result;
// }
//
//
// private static Map<Long, Position> instances = new HashMap<Long, Position>();
//
// private Position(long pointer) {
// this.pointer = pointer;
// }
//
// private static Position get(long pointer) {
// Position instance = instances.get(pointer);
// if (instance == null) {
// instance = new Position(pointer);
// instances.put(pointer, instance);
// }
// return instance;
// }
//
// private long pointer;
//
// public Position getPoint(){
// return this;
// }
// }
| import bwapi.BWEventListener;
import bwapi.Player;
import bwapi.Position;
import bwapi.Unit; | package bwapi;
/**
* A utility stub class providing a default implementation of {@link bwapi.BWEventListener},
* override it's methods if you want to handle only some events.
*/
public class DefaultBWListener implements BWEventListener {
@Override
public void onStart() {
}
@Override
public void onEnd(boolean b) {
}
@Override
public void onFrame() {
}
@Override
public void onSendText(String s) {
}
@Override
public void onReceiveText(Player player, String s) {
}
@Override
public void onPlayerLeft(Player player) {
}
@Override | // Path: manual-bwapi4/BWEventListener.java
// public interface BWEventListener {
//
// public void onStart();
//
// public void onEnd(boolean isWinner);
//
// public void onFrame();
//
// public void onSendText(String text);
//
// public void onReceiveText(Player player, String text);
//
// public void onPlayerLeft(Player player);
//
// public void onNukeDetect(Position target);
//
// public void onUnitDiscover(Unit unit);
//
// public void onUnitEvade(Unit unit);
//
// public void onUnitShow(Unit unit);
//
// public void onUnitHide(Unit unit);
//
// public void onUnitCreate(Unit unit);
//
// public void onUnitDestroy(Unit unit);
//
// public void onUnitMorph(Unit unit);
//
// public void onUnitRenegade(Unit unit);
//
// public void onSaveGame(String gameName);
//
// public void onUnitComplete(Unit unit);
//
// public void onPlayerDropped(Player player);
//
// }
//
// Path: manual-bwapi/Position.java
// public class Position extends AbstractPoint<Position>{
//
// private int x, y;
//
// public Position(int x, int y) {
// this.x = x;
// this.y = y;
// }
//
// public String toString() {
// return "[" + x + ", " + y + "]";
// }
//
// public native boolean isValid();
//
// public native Position makeValid();
//
// public native double getDistance(Position position);
//
// public native int getApproxDistance(Position position);
//
// public native double getLength();
//
// public native boolean hasPath(Position position);
//
// public int getX() {
// return x;
// }
//
// public int getY() {
// return y;
// }
//
// public static Position Invalid;
//
// public static Position None;
//
// public static Position Unknown;
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Position)) return false;
//
// Position position = (Position) o;
//
// if (x != position.x) return false;
// if (y != position.y) return false;
//
// return true;
// }
//
// @Override
// public int hashCode() {
// int result = x;
// result = 31 * result + y;
// return result;
// }
//
//
// private static Map<Long, Position> instances = new HashMap<Long, Position>();
//
// private Position(long pointer) {
// this.pointer = pointer;
// }
//
// private static Position get(long pointer) {
// Position instance = instances.get(pointer);
// if (instance == null) {
// instance = new Position(pointer);
// instances.put(pointer, instance);
// }
// return instance;
// }
//
// private long pointer;
//
// public Position getPoint(){
// return this;
// }
// }
// Path: manual-bwapi/DefaultBWListener.java
import bwapi.BWEventListener;
import bwapi.Player;
import bwapi.Position;
import bwapi.Unit;
package bwapi;
/**
* A utility stub class providing a default implementation of {@link bwapi.BWEventListener},
* override it's methods if you want to handle only some events.
*/
public class DefaultBWListener implements BWEventListener {
@Override
public void onStart() {
}
@Override
public void onEnd(boolean b) {
}
@Override
public void onFrame() {
}
@Override
public void onSendText(String s) {
}
@Override
public void onReceiveText(Player player, String s) {
}
@Override
public void onPlayerLeft(Player player) {
}
@Override | public void onNukeDetect(Position position) { |
vjurenka/BWMirror-Generator | src/impl/Enum.java | // Path: src/c/CEnum.java
// public interface CEnum extends CDeclaration{
//
// public List<EnumValue> getValues();
//
// public String getNameSpaceName();
//
// public String getFullName();
// }
//
// Path: src/c/DeclarationType.java
// public enum DeclarationType {
// CLASS,
// CONSTANT,
// FIELD,
// METHOD,
// ENUM,
// VARIABLE;
// }
//
// Path: src/c/EnumValue.java
// public class EnumValue extends Pair<String, Integer> {
// public EnumValue(String first, Integer second) {
// super(first, second);
// }
// }
| import c.CEnum;
import c.DeclarationType;
import c.EnumValue;
import java.util.ArrayList;
import java.util.List; | package impl;
/**
* User: PC
* Date: 14. 6. 2014
* Time: 14:07
*/
public class Enum implements CEnum {
String name;
| // Path: src/c/CEnum.java
// public interface CEnum extends CDeclaration{
//
// public List<EnumValue> getValues();
//
// public String getNameSpaceName();
//
// public String getFullName();
// }
//
// Path: src/c/DeclarationType.java
// public enum DeclarationType {
// CLASS,
// CONSTANT,
// FIELD,
// METHOD,
// ENUM,
// VARIABLE;
// }
//
// Path: src/c/EnumValue.java
// public class EnumValue extends Pair<String, Integer> {
// public EnumValue(String first, Integer second) {
// super(first, second);
// }
// }
// Path: src/impl/Enum.java
import c.CEnum;
import c.DeclarationType;
import c.EnumValue;
import java.util.ArrayList;
import java.util.List;
package impl;
/**
* User: PC
* Date: 14. 6. 2014
* Time: 14:07
*/
public class Enum implements CEnum {
String name;
| List<EnumValue> values = new ArrayList<>(); |
vjurenka/BWMirror-Generator | src/impl/Enum.java | // Path: src/c/CEnum.java
// public interface CEnum extends CDeclaration{
//
// public List<EnumValue> getValues();
//
// public String getNameSpaceName();
//
// public String getFullName();
// }
//
// Path: src/c/DeclarationType.java
// public enum DeclarationType {
// CLASS,
// CONSTANT,
// FIELD,
// METHOD,
// ENUM,
// VARIABLE;
// }
//
// Path: src/c/EnumValue.java
// public class EnumValue extends Pair<String, Integer> {
// public EnumValue(String first, Integer second) {
// super(first, second);
// }
// }
| import c.CEnum;
import c.DeclarationType;
import c.EnumValue;
import java.util.ArrayList;
import java.util.List; | }
@Override
public List<EnumValue> getValues() {
return values;
}
@Override
public String getName() {
return name;
}
@Override
public String getNameSpaceName() {
return nameSpaceName;
}
public String getFullName() {
return (nameSpaceName != null ? (getNameSpaceName() + "_" ): "") + getName();
}
public String toString() {
String str = "enum " + nameSpaceName + "_" + name + "\n";
for (EnumValue f : values) {
str += f + "\n";
}
return str;
}
@Override | // Path: src/c/CEnum.java
// public interface CEnum extends CDeclaration{
//
// public List<EnumValue> getValues();
//
// public String getNameSpaceName();
//
// public String getFullName();
// }
//
// Path: src/c/DeclarationType.java
// public enum DeclarationType {
// CLASS,
// CONSTANT,
// FIELD,
// METHOD,
// ENUM,
// VARIABLE;
// }
//
// Path: src/c/EnumValue.java
// public class EnumValue extends Pair<String, Integer> {
// public EnumValue(String first, Integer second) {
// super(first, second);
// }
// }
// Path: src/impl/Enum.java
import c.CEnum;
import c.DeclarationType;
import c.EnumValue;
import java.util.ArrayList;
import java.util.List;
}
@Override
public List<EnumValue> getValues() {
return values;
}
@Override
public String getName() {
return name;
}
@Override
public String getNameSpaceName() {
return nameSpaceName;
}
public String getFullName() {
return (nameSpaceName != null ? (getNameSpaceName() + "_" ): "") + getName();
}
public String toString() {
String str = "enum " + nameSpaceName + "_" + name + "\n";
for (EnumValue f : values) {
str += f + "\n";
}
return str;
}
@Override | public DeclarationType getDeclType() { |
vjurenka/BWMirror-Generator | manual-bwapi4/AIModule.java | // Path: manual-bwapi4/BWEventListener.java
// public interface BWEventListener {
//
// public void onStart();
//
// public void onEnd(boolean isWinner);
//
// public void onFrame();
//
// public void onSendText(String text);
//
// public void onReceiveText(Player player, String text);
//
// public void onPlayerLeft(Player player);
//
// public void onNukeDetect(Position target);
//
// public void onUnitDiscover(Unit unit);
//
// public void onUnitEvade(Unit unit);
//
// public void onUnitShow(Unit unit);
//
// public void onUnitHide(Unit unit);
//
// public void onUnitCreate(Unit unit);
//
// public void onUnitDestroy(Unit unit);
//
// public void onUnitMorph(Unit unit);
//
// public void onUnitRenegade(Unit unit);
//
// public void onSaveGame(String gameName);
//
// public void onUnitComplete(Unit unit);
//
// public void onPlayerDropped(Player player);
//
// }
| import bwapi.BWEventListener; | package bwapi;
/**
* This class receives all events from Broodwar.
* To process them, receive an AIModule's instance from {@link Mirror} and call {@link #setEventListener(bwapi.BWEventListener)}
* to set you own {@link BWEventListener listener}.
* There's also a stub class ({@link DefaultBWListener}) provided, so you don't have to implement all of the methods.
*/
public class AIModule {
AIModule(){}
| // Path: manual-bwapi4/BWEventListener.java
// public interface BWEventListener {
//
// public void onStart();
//
// public void onEnd(boolean isWinner);
//
// public void onFrame();
//
// public void onSendText(String text);
//
// public void onReceiveText(Player player, String text);
//
// public void onPlayerLeft(Player player);
//
// public void onNukeDetect(Position target);
//
// public void onUnitDiscover(Unit unit);
//
// public void onUnitEvade(Unit unit);
//
// public void onUnitShow(Unit unit);
//
// public void onUnitHide(Unit unit);
//
// public void onUnitCreate(Unit unit);
//
// public void onUnitDestroy(Unit unit);
//
// public void onUnitMorph(Unit unit);
//
// public void onUnitRenegade(Unit unit);
//
// public void onSaveGame(String gameName);
//
// public void onUnitComplete(Unit unit);
//
// public void onPlayerDropped(Player player);
//
// }
// Path: manual-bwapi4/AIModule.java
import bwapi.BWEventListener;
package bwapi;
/**
* This class receives all events from Broodwar.
* To process them, receive an AIModule's instance from {@link Mirror} and call {@link #setEventListener(bwapi.BWEventListener)}
* to set you own {@link BWEventListener listener}.
* There's also a stub class ({@link DefaultBWListener}) provided, so you don't have to implement all of the methods.
*/
public class AIModule {
AIModule(){}
| private BWEventListener eventListener; |
PascalUrso/ReplicationBenchmark | src/jbenchmarker/trace/TraceOperation.java | // Path: src/jbenchmarker/core/VectorClock.java
// public class VectorClock extends TreeMap<Integer, Integer> {
//
// public VectorClock() {
// super();
// }
//
// // TODO: test me, plz
// public VectorClock(VectorClock siteVC) {
// super(siteVC);
// }
//
// /*
// * Is this VC is ready to integrate O ?
// * true iff VCr = Or - 1 && for all i!=r, VCi >= Oi
// */
// public boolean readyFor(int r, VectorClock O) {
// if (this.getSafe(r) != O.get(r) - 1) {
// return false;
// }
// Iterator<Map.Entry<Integer, Integer>> it = O.entrySet().iterator();
// while (it.hasNext()) {
// Map.Entry<Integer, Integer> e = it.next();
// if ((e.getKey() != r) && (this.getSafe(e.getKey()) < e.getValue())) {
// return false;
// }
// }
// return true;
// }
//
// /**
// * Get the sum of all entries
// * added by Roh.
// */
// public int getSum(){
// int sum = 0;
// Iterator<Map.Entry<Integer, Integer>> it = this.entrySet().iterator();
// while (it.hasNext()) sum+= it.next().getValue();
// return sum;
// }
//
// /*
// * Increment an entry.
// */
// public void inc(int r) {
// put(r, getSafe(r) + 1);
// }
//
// /*
// * Returns the entry for replica r. 0 if none.
// */
// public int getSafe(int r) {
// Integer v = get(r);
// return (v != null) ? v : 0;
// }
//
// /*
// * Is this VC > T ?
// * true iff for all i, VCi >= Ti and exists j VCj > Tj
// */
// public boolean greaterThan(VectorClock T) {
// boolean gt = false;
// Iterator<Map.Entry<Integer, Integer>> it = T.entrySet().iterator();
// while (it.hasNext()) {
// Map.Entry<Integer, Integer> i = it.next();
// if (this.getSafe(i.getKey()) < i.getValue()) {
// return false;
// } else if (this.getSafe(i.getKey()) > i.getValue()) {
// gt = true;
// }
// }
// if (gt) {
// return true;
// }
// it = this.entrySet().iterator();
// while (it.hasNext()) {
// Map.Entry<Integer, Integer> i = it.next();
// if (T.getSafe(i.getKey()) < i.getValue()) {
// return true;
// }
// }
// return false;
// }
//
// /*
// * Is this VC // T ?
// * true iff nor VC > T nor T > VC
// */
// public boolean concurrent(VectorClock T) {
// return !(this.greaterThan(T) || T.greaterThan(this));
// }
//
// /**
// * Sets each entry of the VC to max(VCi, Oi)
// */
// public void upTo(VectorClock O) {
// for (Entry<Integer, Integer> k : O.entrySet()) {
// if (k.getValue() > this.getSafe(k.getKey())) {
// this.put(k.getKey(), k.getValue());
// }
// }
// }
//
// @Override
// public boolean equals(Object obj) {
// if (obj == null || getClass() != obj.getClass()) {
// return false;
// }
//
// final VectorClock other = (VectorClock) obj;
//
// Set<Integer> h = new HashSet<Integer>(this.keySet());
// h.addAll(other.keySet());
//
// for (Integer k : h) {
// if (this.getSafe(k) != other.getSafe(k)) {
// return false;
// }
// }
// return true;
// }
//
// /*
// * computes minimal vector from current and vector clocks provided in parameters.
// * for each vc in {this} U otherVectorClocks, for each i in min, min[i] <= vc[i]
// */
// public VectorClock min(Collection<VectorClock> otherVectorClocks) {
// VectorClock min = new VectorClock(this);
//
// for (VectorClock clock : otherVectorClocks) {
// Iterator<Map.Entry<Integer, Integer>> componentIterator = clock.entrySet().iterator();
// while (componentIterator.hasNext()) {
// Map.Entry<Integer, Integer> i = componentIterator.next();
// Integer key = i.getKey();
// min.put(key, Math.min(min.getSafe(key), i.getValue()));
// }
// }
// return min;
// }
// }
| import jbenchmarker.core.VectorClock; | /**
* This file is part of ReplicationBenchmark.
*
* ReplicationBenchmark 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.
*
* ReplicationBenchmark 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 ReplicationBenchmark. If not, see <http://www.gnu.org/licenses/>.
*
**/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package jbenchmarker.trace;
/**
*
* @author urso
*/
public class TraceOperation {
public enum OpType { ins, del };
private int replica; // replica number
private OpType type; // type of operation : insert or delete
private int position; // position in the document
private int offset; // length of a del
private String content; // content of an ins | // Path: src/jbenchmarker/core/VectorClock.java
// public class VectorClock extends TreeMap<Integer, Integer> {
//
// public VectorClock() {
// super();
// }
//
// // TODO: test me, plz
// public VectorClock(VectorClock siteVC) {
// super(siteVC);
// }
//
// /*
// * Is this VC is ready to integrate O ?
// * true iff VCr = Or - 1 && for all i!=r, VCi >= Oi
// */
// public boolean readyFor(int r, VectorClock O) {
// if (this.getSafe(r) != O.get(r) - 1) {
// return false;
// }
// Iterator<Map.Entry<Integer, Integer>> it = O.entrySet().iterator();
// while (it.hasNext()) {
// Map.Entry<Integer, Integer> e = it.next();
// if ((e.getKey() != r) && (this.getSafe(e.getKey()) < e.getValue())) {
// return false;
// }
// }
// return true;
// }
//
// /**
// * Get the sum of all entries
// * added by Roh.
// */
// public int getSum(){
// int sum = 0;
// Iterator<Map.Entry<Integer, Integer>> it = this.entrySet().iterator();
// while (it.hasNext()) sum+= it.next().getValue();
// return sum;
// }
//
// /*
// * Increment an entry.
// */
// public void inc(int r) {
// put(r, getSafe(r) + 1);
// }
//
// /*
// * Returns the entry for replica r. 0 if none.
// */
// public int getSafe(int r) {
// Integer v = get(r);
// return (v != null) ? v : 0;
// }
//
// /*
// * Is this VC > T ?
// * true iff for all i, VCi >= Ti and exists j VCj > Tj
// */
// public boolean greaterThan(VectorClock T) {
// boolean gt = false;
// Iterator<Map.Entry<Integer, Integer>> it = T.entrySet().iterator();
// while (it.hasNext()) {
// Map.Entry<Integer, Integer> i = it.next();
// if (this.getSafe(i.getKey()) < i.getValue()) {
// return false;
// } else if (this.getSafe(i.getKey()) > i.getValue()) {
// gt = true;
// }
// }
// if (gt) {
// return true;
// }
// it = this.entrySet().iterator();
// while (it.hasNext()) {
// Map.Entry<Integer, Integer> i = it.next();
// if (T.getSafe(i.getKey()) < i.getValue()) {
// return true;
// }
// }
// return false;
// }
//
// /*
// * Is this VC // T ?
// * true iff nor VC > T nor T > VC
// */
// public boolean concurrent(VectorClock T) {
// return !(this.greaterThan(T) || T.greaterThan(this));
// }
//
// /**
// * Sets each entry of the VC to max(VCi, Oi)
// */
// public void upTo(VectorClock O) {
// for (Entry<Integer, Integer> k : O.entrySet()) {
// if (k.getValue() > this.getSafe(k.getKey())) {
// this.put(k.getKey(), k.getValue());
// }
// }
// }
//
// @Override
// public boolean equals(Object obj) {
// if (obj == null || getClass() != obj.getClass()) {
// return false;
// }
//
// final VectorClock other = (VectorClock) obj;
//
// Set<Integer> h = new HashSet<Integer>(this.keySet());
// h.addAll(other.keySet());
//
// for (Integer k : h) {
// if (this.getSafe(k) != other.getSafe(k)) {
// return false;
// }
// }
// return true;
// }
//
// /*
// * computes minimal vector from current and vector clocks provided in parameters.
// * for each vc in {this} U otherVectorClocks, for each i in min, min[i] <= vc[i]
// */
// public VectorClock min(Collection<VectorClock> otherVectorClocks) {
// VectorClock min = new VectorClock(this);
//
// for (VectorClock clock : otherVectorClocks) {
// Iterator<Map.Entry<Integer, Integer>> componentIterator = clock.entrySet().iterator();
// while (componentIterator.hasNext()) {
// Map.Entry<Integer, Integer> i = componentIterator.next();
// Integer key = i.getKey();
// min.put(key, Math.min(min.getSafe(key), i.getValue()));
// }
// }
// return min;
// }
// }
// Path: src/jbenchmarker/trace/TraceOperation.java
import jbenchmarker.core.VectorClock;
/**
* This file is part of ReplicationBenchmark.
*
* ReplicationBenchmark 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.
*
* ReplicationBenchmark 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 ReplicationBenchmark. If not, see <http://www.gnu.org/licenses/>.
*
**/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package jbenchmarker.trace;
/**
*
* @author urso
*/
public class TraceOperation {
public enum OpType { ins, del };
private int replica; // replica number
private OpType type; // type of operation : insert or delete
private int position; // position in the document
private int offset; // length of a del
private String content; // content of an ins | private VectorClock VC; // Vector clock |
PascalUrso/ReplicationBenchmark | src/jbenchmarker/ot/TTFTransformations.java | // Path: src/jbenchmarker/trace/TraceOperation.java
// public enum OpType { ins, del };
| import jbenchmarker.trace.TraceOperation.OpType; | /**
* This file is part of ReplicationBenchmark.
*
* ReplicationBenchmark 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.
*
* ReplicationBenchmark 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 ReplicationBenchmark. If not, see <http://www.gnu.org/licenses/>.
*
**/
package jbenchmarker.ot;
/**
*
* @author oster
*/
public class TTFTransformations {
public static TTFOperation transpose(TTFOperation op1, TTFOperation op2) {
| // Path: src/jbenchmarker/trace/TraceOperation.java
// public enum OpType { ins, del };
// Path: src/jbenchmarker/ot/TTFTransformations.java
import jbenchmarker.trace.TraceOperation.OpType;
/**
* This file is part of ReplicationBenchmark.
*
* ReplicationBenchmark 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.
*
* ReplicationBenchmark 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 ReplicationBenchmark. If not, see <http://www.gnu.org/licenses/>.
*
**/
package jbenchmarker.ot;
/**
*
* @author oster
*/
public class TTFTransformations {
public static TTFOperation transpose(TTFOperation op1, TTFOperation op2) {
| if (op1.getType() == OpType.ins && op2.getType() == OpType.ins) { |
PascalUrso/ReplicationBenchmark | src/jbenchmarker/core/Simulator.java | // Path: src/jbenchmarker/trace/TraceOperation.java
// public class TraceOperation {
// public enum OpType { ins, del };
//
// private int replica; // replica number
// private OpType type; // type of operation : insert or delete
// private int position; // position in the document
// private int offset; // length of a del
// private String content; // content of an ins
// private VectorClock VC; // Vector clock
//
//
// public VectorClock getVC() {
// return VC;
// }
//
// public String getContent() {
// return content;
// }
//
// public int getOffset() {
// return offset;
// }
//
// public int getPosition() {
// return position;
// }
//
//
// public int getReplica() {
// return replica;
// }
//
//
// public OpType getType() {
// return type;
// }
//
// public TraceOperation(OpType type, int replica, int position, int offset, String content, VectorClock VC) {
// this.type = type;
// this.replica = replica;
// this.position = position;
// this.offset = offset;
// this.content = content;
// this.VC = VC;
// }
//
// /*
// * Construction of an insert operation
// */
// static public TraceOperation insert(int replica, int position, String content, VectorClock VC) {
// return new TraceOperation(OpType.ins, replica, position, 0, content, VC);
// }
//
// /*
// * Construction of an insert operation
// */
// static public TraceOperation delete(int replica, int position, int offset, VectorClock VC) {
// return new TraceOperation(OpType.del, replica, position, offset, null, VC);
// }
//
// @Override
// public boolean equals(Object obj) {
// if (obj == null) {
// return false;
// }
// if (getClass() != obj.getClass()) {
// return false;
// }
// final TraceOperation other = (TraceOperation) obj;
// if (this.replica != other.replica) {
// return false;
// }
// if (this.type != other.type) {
// return false;
// }
// if (this.position != other.position) {
// return false;
// }
// if (this.offset != other.offset) {
// return false;
// }
// if ((this.content == null) ? (other.content != null) : !this.content.equals(other.content)) {
// return false;
// }
// if (this.VC != other.VC && (this.VC == null || !this.VC.equals(other.VC))) {
// return false;
// }
// return true;
// }
//
// @Override
// public int hashCode() {
// int hash = 7;
// hash = 53 * hash + this.replica;
// hash = 53 * hash + (this.type != null ? this.type.hashCode() : 0);
// hash = 53 * hash + this.position;
// hash = 53 * hash + this.offset;
// hash = 53 * hash + (this.content != null ? this.content.hashCode() : 0);
// hash = 53 * hash + (this.VC != null ? this.VC.hashCode() : 0);
// return hash;
// }
//
// @Override
// public String toString() {
// return "TraceOperation{" + "replica=" + replica + ", VC=" + VC + ", type=" + type + ", position=" + position + (type==OpType.del ? ", offset=" + offset : ", content=" + content) + '}';
// }
//
//
// }
| import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import jbenchmarker.trace.TraceOperation; | /**
* This file is part of ReplicationBenchmark.
*
* ReplicationBenchmark 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.
*
* ReplicationBenchmark 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 ReplicationBenchmark. If not, see <http://www.gnu.org/licenses/>.
*
**/
package jbenchmarker.core;
/**
*
* @author urso
*/
public abstract class Simulator {
protected Map<Integer,MergeAlgorithm> replicas;
// Local operations generated
protected List<Long> memUsed;
private ReplicaFactory rf;
/**
* Constructor of a Simulator. Replicas and Document will be instaciated at run time.
* @param rf the factory
*/
public Simulator(ReplicaFactory rf) {
this.replicas = new HashMap<Integer,MergeAlgorithm>();
this.memUsed = new java.util.ArrayList<Long>();
this.rf = rf;
}
public Map<Integer, MergeAlgorithm> getReplicas() {
return replicas;
}
/*
* Runs a trace of operations. Iterate trough trace and construct replica with documents while needed.
*/ | // Path: src/jbenchmarker/trace/TraceOperation.java
// public class TraceOperation {
// public enum OpType { ins, del };
//
// private int replica; // replica number
// private OpType type; // type of operation : insert or delete
// private int position; // position in the document
// private int offset; // length of a del
// private String content; // content of an ins
// private VectorClock VC; // Vector clock
//
//
// public VectorClock getVC() {
// return VC;
// }
//
// public String getContent() {
// return content;
// }
//
// public int getOffset() {
// return offset;
// }
//
// public int getPosition() {
// return position;
// }
//
//
// public int getReplica() {
// return replica;
// }
//
//
// public OpType getType() {
// return type;
// }
//
// public TraceOperation(OpType type, int replica, int position, int offset, String content, VectorClock VC) {
// this.type = type;
// this.replica = replica;
// this.position = position;
// this.offset = offset;
// this.content = content;
// this.VC = VC;
// }
//
// /*
// * Construction of an insert operation
// */
// static public TraceOperation insert(int replica, int position, String content, VectorClock VC) {
// return new TraceOperation(OpType.ins, replica, position, 0, content, VC);
// }
//
// /*
// * Construction of an insert operation
// */
// static public TraceOperation delete(int replica, int position, int offset, VectorClock VC) {
// return new TraceOperation(OpType.del, replica, position, offset, null, VC);
// }
//
// @Override
// public boolean equals(Object obj) {
// if (obj == null) {
// return false;
// }
// if (getClass() != obj.getClass()) {
// return false;
// }
// final TraceOperation other = (TraceOperation) obj;
// if (this.replica != other.replica) {
// return false;
// }
// if (this.type != other.type) {
// return false;
// }
// if (this.position != other.position) {
// return false;
// }
// if (this.offset != other.offset) {
// return false;
// }
// if ((this.content == null) ? (other.content != null) : !this.content.equals(other.content)) {
// return false;
// }
// if (this.VC != other.VC && (this.VC == null || !this.VC.equals(other.VC))) {
// return false;
// }
// return true;
// }
//
// @Override
// public int hashCode() {
// int hash = 7;
// hash = 53 * hash + this.replica;
// hash = 53 * hash + (this.type != null ? this.type.hashCode() : 0);
// hash = 53 * hash + this.position;
// hash = 53 * hash + this.offset;
// hash = 53 * hash + (this.content != null ? this.content.hashCode() : 0);
// hash = 53 * hash + (this.VC != null ? this.VC.hashCode() : 0);
// return hash;
// }
//
// @Override
// public String toString() {
// return "TraceOperation{" + "replica=" + replica + ", VC=" + VC + ", type=" + type + ", position=" + position + (type==OpType.del ? ", offset=" + offset : ", content=" + content) + '}';
// }
//
//
// }
// Path: src/jbenchmarker/core/Simulator.java
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import jbenchmarker.trace.TraceOperation;
/**
* This file is part of ReplicationBenchmark.
*
* ReplicationBenchmark 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.
*
* ReplicationBenchmark 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 ReplicationBenchmark. If not, see <http://www.gnu.org/licenses/>.
*
**/
package jbenchmarker.core;
/**
*
* @author urso
*/
public abstract class Simulator {
protected Map<Integer,MergeAlgorithm> replicas;
// Local operations generated
protected List<Long> memUsed;
private ReplicaFactory rf;
/**
* Constructor of a Simulator. Replicas and Document will be instaciated at run time.
* @param rf the factory
*/
public Simulator(ReplicaFactory rf) {
this.replicas = new HashMap<Integer,MergeAlgorithm>();
this.memUsed = new java.util.ArrayList<Long>();
this.rf = rf;
}
public Map<Integer, MergeAlgorithm> getReplicas() {
return replicas;
}
/*
* Runs a trace of operations. Iterate trough trace and construct replica with documents while needed.
*/ | public abstract void run(Iterator<TraceOperation> trace) throws Exception; |
PascalUrso/ReplicationBenchmark | src/jbenchmarker/woot/wooth/WootHashNode.java | // Path: src/jbenchmarker/woot/WootIdentifier.java
// public class WootIdentifier implements Comparable<WootIdentifier> {
// public static final WootIdentifier IB = new WootIdentifier(-1,0);
// public static final WootIdentifier IE = new WootIdentifier(-1,1);;
//
// public WootIdentifier(int replica, int clock) {
// this.replica = replica;
// this.clock = clock;
// }
//
// private int replica;
// private int clock;
//
// public int getClock() {
// return clock;
// }
//
// public int getReplica() {
// return replica;
// }
//
//
// @Override
// public int compareTo(WootIdentifier t) {
// if (this.replica == t.replica)
// return this.clock - t.clock;
// else
// return this.replica - t.replica;
// }
//
// public WootIdentifier clone() {
// return new WootIdentifier(replica,clock);
// }
//
// @Override
// public boolean equals(Object obj) {
// if (obj == null) {
// return false;
// }
// if (getClass() != obj.getClass()) {
// return false;
// }
// final WootIdentifier other = (WootIdentifier) obj;
// if (this.replica != other.replica) {
// return false;
// }
// if (this.clock != other.clock) {
// return false;
// }
// return true;
// }
//
// @Override
// public int hashCode() {
// int hash = 7;
// hash = 13 * hash + this.replica;
// hash = 13 * hash + this.clock;
// return hash;
// }
// }
//
// Path: src/jbenchmarker/woot/WootNode.java
// public abstract class WootNode {
//
// private WootIdentifier id; // own identifier
//
// private char content;
// private boolean visible;
//
// public WootNode(WootIdentifier id, char content, boolean visible) {
// this.id = id;
// this.content = content;
// this.visible = visible;
// }
//
// public WootIdentifier getId() {
// return id;
// }
//
// public char getContent() {
// return content;
// }
//
// public boolean isVisible() {
// return visible;
// }
//
// public void setVisible(boolean visible) {
// this.visible = visible;
// }
// }
| import jbenchmarker.woot.WootIdentifier;
import jbenchmarker.woot.WootNode; | /**
* This file is part of ReplicationBenchmark.
*
* ReplicationBenchmark 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.
*
* ReplicationBenchmark 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 ReplicationBenchmark. If not, see <http://www.gnu.org/licenses/>.
*
**/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package jbenchmarker.woot.wooth;
/**
*
* @author urso
*/
public class WootHashNode extends WootNode {
private WootHashNode next;
private int degree;
| // Path: src/jbenchmarker/woot/WootIdentifier.java
// public class WootIdentifier implements Comparable<WootIdentifier> {
// public static final WootIdentifier IB = new WootIdentifier(-1,0);
// public static final WootIdentifier IE = new WootIdentifier(-1,1);;
//
// public WootIdentifier(int replica, int clock) {
// this.replica = replica;
// this.clock = clock;
// }
//
// private int replica;
// private int clock;
//
// public int getClock() {
// return clock;
// }
//
// public int getReplica() {
// return replica;
// }
//
//
// @Override
// public int compareTo(WootIdentifier t) {
// if (this.replica == t.replica)
// return this.clock - t.clock;
// else
// return this.replica - t.replica;
// }
//
// public WootIdentifier clone() {
// return new WootIdentifier(replica,clock);
// }
//
// @Override
// public boolean equals(Object obj) {
// if (obj == null) {
// return false;
// }
// if (getClass() != obj.getClass()) {
// return false;
// }
// final WootIdentifier other = (WootIdentifier) obj;
// if (this.replica != other.replica) {
// return false;
// }
// if (this.clock != other.clock) {
// return false;
// }
// return true;
// }
//
// @Override
// public int hashCode() {
// int hash = 7;
// hash = 13 * hash + this.replica;
// hash = 13 * hash + this.clock;
// return hash;
// }
// }
//
// Path: src/jbenchmarker/woot/WootNode.java
// public abstract class WootNode {
//
// private WootIdentifier id; // own identifier
//
// private char content;
// private boolean visible;
//
// public WootNode(WootIdentifier id, char content, boolean visible) {
// this.id = id;
// this.content = content;
// this.visible = visible;
// }
//
// public WootIdentifier getId() {
// return id;
// }
//
// public char getContent() {
// return content;
// }
//
// public boolean isVisible() {
// return visible;
// }
//
// public void setVisible(boolean visible) {
// this.visible = visible;
// }
// }
// Path: src/jbenchmarker/woot/wooth/WootHashNode.java
import jbenchmarker.woot.WootIdentifier;
import jbenchmarker.woot.WootNode;
/**
* This file is part of ReplicationBenchmark.
*
* ReplicationBenchmark 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.
*
* ReplicationBenchmark 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 ReplicationBenchmark. If not, see <http://www.gnu.org/licenses/>.
*
**/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package jbenchmarker.woot.wooth;
/**
*
* @author urso
*/
public class WootHashNode extends WootNode {
private WootHashNode next;
private int degree;
| public WootHashNode(WootIdentifier id, char content, boolean visible, WootHashNode next, int degree) { |
PascalUrso/ReplicationBenchmark | test/jbenchmarker/logoot/LogootMergeTest.java | // Path: src/jbenchmarker/core/Operation.java
// public abstract class Operation {
// private TraceOperation originalOp; // Trace operation issuing this one
//
// public TraceOperation getOriginalOp() {
// return originalOp;
// }
//
// public void setOriginalOp(TraceOperation originalOp) {
// this.originalOp = originalOp;
// }
//
// public Operation(TraceOperation o) {
// this.originalOp = o;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (obj == null) {
// return false;
// }
// if (getClass() != obj.getClass()) {
// return false;
// }
// final Operation other = (Operation) obj;
// if (this.originalOp != other.originalOp && (this.originalOp == null || !this.originalOp.equals(other.originalOp))) {
// return false;
// }
// return true;
// }
//
// @Override
// public int hashCode() {
// int hash = 3;
// hash = 17 * hash + (this.originalOp != null ? this.originalOp.hashCode() : 0);
// return hash;
// }
//
// abstract public Operation clone();
// }
//
// Path: src/jbenchmarker/trace/TraceOperation.java
// public class TraceOperation {
// public enum OpType { ins, del };
//
// private int replica; // replica number
// private OpType type; // type of operation : insert or delete
// private int position; // position in the document
// private int offset; // length of a del
// private String content; // content of an ins
// private VectorClock VC; // Vector clock
//
//
// public VectorClock getVC() {
// return VC;
// }
//
// public String getContent() {
// return content;
// }
//
// public int getOffset() {
// return offset;
// }
//
// public int getPosition() {
// return position;
// }
//
//
// public int getReplica() {
// return replica;
// }
//
//
// public OpType getType() {
// return type;
// }
//
// public TraceOperation(OpType type, int replica, int position, int offset, String content, VectorClock VC) {
// this.type = type;
// this.replica = replica;
// this.position = position;
// this.offset = offset;
// this.content = content;
// this.VC = VC;
// }
//
// /*
// * Construction of an insert operation
// */
// static public TraceOperation insert(int replica, int position, String content, VectorClock VC) {
// return new TraceOperation(OpType.ins, replica, position, 0, content, VC);
// }
//
// /*
// * Construction of an insert operation
// */
// static public TraceOperation delete(int replica, int position, int offset, VectorClock VC) {
// return new TraceOperation(OpType.del, replica, position, offset, null, VC);
// }
//
// @Override
// public boolean equals(Object obj) {
// if (obj == null) {
// return false;
// }
// if (getClass() != obj.getClass()) {
// return false;
// }
// final TraceOperation other = (TraceOperation) obj;
// if (this.replica != other.replica) {
// return false;
// }
// if (this.type != other.type) {
// return false;
// }
// if (this.position != other.position) {
// return false;
// }
// if (this.offset != other.offset) {
// return false;
// }
// if ((this.content == null) ? (other.content != null) : !this.content.equals(other.content)) {
// return false;
// }
// if (this.VC != other.VC && (this.VC == null || !this.VC.equals(other.VC))) {
// return false;
// }
// return true;
// }
//
// @Override
// public int hashCode() {
// int hash = 7;
// hash = 53 * hash + this.replica;
// hash = 53 * hash + (this.type != null ? this.type.hashCode() : 0);
// hash = 53 * hash + this.position;
// hash = 53 * hash + this.offset;
// hash = 53 * hash + (this.content != null ? this.content.hashCode() : 0);
// hash = 53 * hash + (this.VC != null ? this.VC.hashCode() : 0);
// return hash;
// }
//
// @Override
// public String toString() {
// return "TraceOperation{" + "replica=" + replica + ", VC=" + VC + ", type=" + type + ", position=" + position + (type==OpType.del ? ", offset=" + offset : ", content=" + content) + '}';
// }
//
//
// }
//
// Path: src/jbenchmarker/trace/IncorrectTrace.java
// public class IncorrectTrace extends Exception {
// public IncorrectTrace() {
// }
//
// public IncorrectTrace(Throwable thrwbl) {
// super(thrwbl);
// }
//
// public IncorrectTrace(String string, Throwable thrwbl) {
// super(string, thrwbl);
// }
//
// public IncorrectTrace(String string) {
// super(string);
// }
//
// }
| import org.junit.Test;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
import jbenchmarker.trace.IncorrectTrace;
import java.math.BigInteger;
import jbenchmarker.core.Operation;
import jbenchmarker.trace.TraceOperation;
import java.util.ArrayList;
import java.util.List; | /**
* This file is part of ReplicationBenchmark.
*
* ReplicationBenchmark 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.
*
* ReplicationBenchmark 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 ReplicationBenchmark. If not, see <http://www.gnu.org/licenses/>.
*
**/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package jbenchmarker.logoot;
/**
*
* @author mehdi
*/
public class LogootMergeTest
{
// helpers | // Path: src/jbenchmarker/core/Operation.java
// public abstract class Operation {
// private TraceOperation originalOp; // Trace operation issuing this one
//
// public TraceOperation getOriginalOp() {
// return originalOp;
// }
//
// public void setOriginalOp(TraceOperation originalOp) {
// this.originalOp = originalOp;
// }
//
// public Operation(TraceOperation o) {
// this.originalOp = o;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (obj == null) {
// return false;
// }
// if (getClass() != obj.getClass()) {
// return false;
// }
// final Operation other = (Operation) obj;
// if (this.originalOp != other.originalOp && (this.originalOp == null || !this.originalOp.equals(other.originalOp))) {
// return false;
// }
// return true;
// }
//
// @Override
// public int hashCode() {
// int hash = 3;
// hash = 17 * hash + (this.originalOp != null ? this.originalOp.hashCode() : 0);
// return hash;
// }
//
// abstract public Operation clone();
// }
//
// Path: src/jbenchmarker/trace/TraceOperation.java
// public class TraceOperation {
// public enum OpType { ins, del };
//
// private int replica; // replica number
// private OpType type; // type of operation : insert or delete
// private int position; // position in the document
// private int offset; // length of a del
// private String content; // content of an ins
// private VectorClock VC; // Vector clock
//
//
// public VectorClock getVC() {
// return VC;
// }
//
// public String getContent() {
// return content;
// }
//
// public int getOffset() {
// return offset;
// }
//
// public int getPosition() {
// return position;
// }
//
//
// public int getReplica() {
// return replica;
// }
//
//
// public OpType getType() {
// return type;
// }
//
// public TraceOperation(OpType type, int replica, int position, int offset, String content, VectorClock VC) {
// this.type = type;
// this.replica = replica;
// this.position = position;
// this.offset = offset;
// this.content = content;
// this.VC = VC;
// }
//
// /*
// * Construction of an insert operation
// */
// static public TraceOperation insert(int replica, int position, String content, VectorClock VC) {
// return new TraceOperation(OpType.ins, replica, position, 0, content, VC);
// }
//
// /*
// * Construction of an insert operation
// */
// static public TraceOperation delete(int replica, int position, int offset, VectorClock VC) {
// return new TraceOperation(OpType.del, replica, position, offset, null, VC);
// }
//
// @Override
// public boolean equals(Object obj) {
// if (obj == null) {
// return false;
// }
// if (getClass() != obj.getClass()) {
// return false;
// }
// final TraceOperation other = (TraceOperation) obj;
// if (this.replica != other.replica) {
// return false;
// }
// if (this.type != other.type) {
// return false;
// }
// if (this.position != other.position) {
// return false;
// }
// if (this.offset != other.offset) {
// return false;
// }
// if ((this.content == null) ? (other.content != null) : !this.content.equals(other.content)) {
// return false;
// }
// if (this.VC != other.VC && (this.VC == null || !this.VC.equals(other.VC))) {
// return false;
// }
// return true;
// }
//
// @Override
// public int hashCode() {
// int hash = 7;
// hash = 53 * hash + this.replica;
// hash = 53 * hash + (this.type != null ? this.type.hashCode() : 0);
// hash = 53 * hash + this.position;
// hash = 53 * hash + this.offset;
// hash = 53 * hash + (this.content != null ? this.content.hashCode() : 0);
// hash = 53 * hash + (this.VC != null ? this.VC.hashCode() : 0);
// return hash;
// }
//
// @Override
// public String toString() {
// return "TraceOperation{" + "replica=" + replica + ", VC=" + VC + ", type=" + type + ", position=" + position + (type==OpType.del ? ", offset=" + offset : ", content=" + content) + '}';
// }
//
//
// }
//
// Path: src/jbenchmarker/trace/IncorrectTrace.java
// public class IncorrectTrace extends Exception {
// public IncorrectTrace() {
// }
//
// public IncorrectTrace(Throwable thrwbl) {
// super(thrwbl);
// }
//
// public IncorrectTrace(String string, Throwable thrwbl) {
// super(string, thrwbl);
// }
//
// public IncorrectTrace(String string) {
// super(string);
// }
//
// }
// Path: test/jbenchmarker/logoot/LogootMergeTest.java
import org.junit.Test;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
import jbenchmarker.trace.IncorrectTrace;
import java.math.BigInteger;
import jbenchmarker.core.Operation;
import jbenchmarker.trace.TraceOperation;
import java.util.ArrayList;
import java.util.List;
/**
* This file is part of ReplicationBenchmark.
*
* ReplicationBenchmark 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.
*
* ReplicationBenchmark 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 ReplicationBenchmark. If not, see <http://www.gnu.org/licenses/>.
*
**/
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package jbenchmarker.logoot;
/**
*
* @author mehdi
*/
public class LogootMergeTest
{
// helpers | TraceOperation insert(int p, String s) { |
PascalUrso/ReplicationBenchmark | src/jbenchmarker/core/MergeAlgorithm.java | // Path: src/jbenchmarker/trace/IncorrectTrace.java
// public class IncorrectTrace extends Exception {
// public IncorrectTrace() {
// }
//
// public IncorrectTrace(Throwable thrwbl) {
// super(thrwbl);
// }
//
// public IncorrectTrace(String string, Throwable thrwbl) {
// super(string, thrwbl);
// }
//
// public IncorrectTrace(String string) {
// super(string);
// }
//
// }
//
// Path: src/jbenchmarker/trace/TraceOperation.java
// public class TraceOperation {
// public enum OpType { ins, del };
//
// private int replica; // replica number
// private OpType type; // type of operation : insert or delete
// private int position; // position in the document
// private int offset; // length of a del
// private String content; // content of an ins
// private VectorClock VC; // Vector clock
//
//
// public VectorClock getVC() {
// return VC;
// }
//
// public String getContent() {
// return content;
// }
//
// public int getOffset() {
// return offset;
// }
//
// public int getPosition() {
// return position;
// }
//
//
// public int getReplica() {
// return replica;
// }
//
//
// public OpType getType() {
// return type;
// }
//
// public TraceOperation(OpType type, int replica, int position, int offset, String content, VectorClock VC) {
// this.type = type;
// this.replica = replica;
// this.position = position;
// this.offset = offset;
// this.content = content;
// this.VC = VC;
// }
//
// /*
// * Construction of an insert operation
// */
// static public TraceOperation insert(int replica, int position, String content, VectorClock VC) {
// return new TraceOperation(OpType.ins, replica, position, 0, content, VC);
// }
//
// /*
// * Construction of an insert operation
// */
// static public TraceOperation delete(int replica, int position, int offset, VectorClock VC) {
// return new TraceOperation(OpType.del, replica, position, offset, null, VC);
// }
//
// @Override
// public boolean equals(Object obj) {
// if (obj == null) {
// return false;
// }
// if (getClass() != obj.getClass()) {
// return false;
// }
// final TraceOperation other = (TraceOperation) obj;
// if (this.replica != other.replica) {
// return false;
// }
// if (this.type != other.type) {
// return false;
// }
// if (this.position != other.position) {
// return false;
// }
// if (this.offset != other.offset) {
// return false;
// }
// if ((this.content == null) ? (other.content != null) : !this.content.equals(other.content)) {
// return false;
// }
// if (this.VC != other.VC && (this.VC == null || !this.VC.equals(other.VC))) {
// return false;
// }
// return true;
// }
//
// @Override
// public int hashCode() {
// int hash = 7;
// hash = 53 * hash + this.replica;
// hash = 53 * hash + (this.type != null ? this.type.hashCode() : 0);
// hash = 53 * hash + this.position;
// hash = 53 * hash + this.offset;
// hash = 53 * hash + (this.content != null ? this.content.hashCode() : 0);
// hash = 53 * hash + (this.VC != null ? this.VC.hashCode() : 0);
// return hash;
// }
//
// @Override
// public String toString() {
// return "TraceOperation{" + "replica=" + replica + ", VC=" + VC + ", type=" + type + ", position=" + position + (type==OpType.del ? ", offset=" + offset : ", content=" + content) + '}';
// }
//
//
// }
| import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import jbenchmarker.trace.IncorrectTrace;
import jbenchmarker.trace.TraceOperation; | /**
* This file is part of ReplicationBenchmark.
*
* ReplicationBenchmark 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.
*
* ReplicationBenchmark 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 ReplicationBenchmark. If not, see <http://www.gnu.org/licenses/>.
*
**/
package jbenchmarker.core;
/**
*
* @author urso
*/
public abstract class MergeAlgorithm {
// Replica identifier
private int replicaNb;
// Supported Document
private Document doc;
// Local operations generated | // Path: src/jbenchmarker/trace/IncorrectTrace.java
// public class IncorrectTrace extends Exception {
// public IncorrectTrace() {
// }
//
// public IncorrectTrace(Throwable thrwbl) {
// super(thrwbl);
// }
//
// public IncorrectTrace(String string, Throwable thrwbl) {
// super(string, thrwbl);
// }
//
// public IncorrectTrace(String string) {
// super(string);
// }
//
// }
//
// Path: src/jbenchmarker/trace/TraceOperation.java
// public class TraceOperation {
// public enum OpType { ins, del };
//
// private int replica; // replica number
// private OpType type; // type of operation : insert or delete
// private int position; // position in the document
// private int offset; // length of a del
// private String content; // content of an ins
// private VectorClock VC; // Vector clock
//
//
// public VectorClock getVC() {
// return VC;
// }
//
// public String getContent() {
// return content;
// }
//
// public int getOffset() {
// return offset;
// }
//
// public int getPosition() {
// return position;
// }
//
//
// public int getReplica() {
// return replica;
// }
//
//
// public OpType getType() {
// return type;
// }
//
// public TraceOperation(OpType type, int replica, int position, int offset, String content, VectorClock VC) {
// this.type = type;
// this.replica = replica;
// this.position = position;
// this.offset = offset;
// this.content = content;
// this.VC = VC;
// }
//
// /*
// * Construction of an insert operation
// */
// static public TraceOperation insert(int replica, int position, String content, VectorClock VC) {
// return new TraceOperation(OpType.ins, replica, position, 0, content, VC);
// }
//
// /*
// * Construction of an insert operation
// */
// static public TraceOperation delete(int replica, int position, int offset, VectorClock VC) {
// return new TraceOperation(OpType.del, replica, position, offset, null, VC);
// }
//
// @Override
// public boolean equals(Object obj) {
// if (obj == null) {
// return false;
// }
// if (getClass() != obj.getClass()) {
// return false;
// }
// final TraceOperation other = (TraceOperation) obj;
// if (this.replica != other.replica) {
// return false;
// }
// if (this.type != other.type) {
// return false;
// }
// if (this.position != other.position) {
// return false;
// }
// if (this.offset != other.offset) {
// return false;
// }
// if ((this.content == null) ? (other.content != null) : !this.content.equals(other.content)) {
// return false;
// }
// if (this.VC != other.VC && (this.VC == null || !this.VC.equals(other.VC))) {
// return false;
// }
// return true;
// }
//
// @Override
// public int hashCode() {
// int hash = 7;
// hash = 53 * hash + this.replica;
// hash = 53 * hash + (this.type != null ? this.type.hashCode() : 0);
// hash = 53 * hash + this.position;
// hash = 53 * hash + this.offset;
// hash = 53 * hash + (this.content != null ? this.content.hashCode() : 0);
// hash = 53 * hash + (this.VC != null ? this.VC.hashCode() : 0);
// return hash;
// }
//
// @Override
// public String toString() {
// return "TraceOperation{" + "replica=" + replica + ", VC=" + VC + ", type=" + type + ", position=" + position + (type==OpType.del ? ", offset=" + offset : ", content=" + content) + '}';
// }
//
//
// }
// Path: src/jbenchmarker/core/MergeAlgorithm.java
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import jbenchmarker.trace.IncorrectTrace;
import jbenchmarker.trace.TraceOperation;
/**
* This file is part of ReplicationBenchmark.
*
* ReplicationBenchmark 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.
*
* ReplicationBenchmark 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 ReplicationBenchmark. If not, see <http://www.gnu.org/licenses/>.
*
**/
package jbenchmarker.core;
/**
*
* @author urso
*/
public abstract class MergeAlgorithm {
// Replica identifier
private int replicaNb;
// Supported Document
private Document doc;
// Local operations generated | private List<TraceOperation> localHistory; |
PascalUrso/ReplicationBenchmark | src/jbenchmarker/core/MergeAlgorithm.java | // Path: src/jbenchmarker/trace/IncorrectTrace.java
// public class IncorrectTrace extends Exception {
// public IncorrectTrace() {
// }
//
// public IncorrectTrace(Throwable thrwbl) {
// super(thrwbl);
// }
//
// public IncorrectTrace(String string, Throwable thrwbl) {
// super(string, thrwbl);
// }
//
// public IncorrectTrace(String string) {
// super(string);
// }
//
// }
//
// Path: src/jbenchmarker/trace/TraceOperation.java
// public class TraceOperation {
// public enum OpType { ins, del };
//
// private int replica; // replica number
// private OpType type; // type of operation : insert or delete
// private int position; // position in the document
// private int offset; // length of a del
// private String content; // content of an ins
// private VectorClock VC; // Vector clock
//
//
// public VectorClock getVC() {
// return VC;
// }
//
// public String getContent() {
// return content;
// }
//
// public int getOffset() {
// return offset;
// }
//
// public int getPosition() {
// return position;
// }
//
//
// public int getReplica() {
// return replica;
// }
//
//
// public OpType getType() {
// return type;
// }
//
// public TraceOperation(OpType type, int replica, int position, int offset, String content, VectorClock VC) {
// this.type = type;
// this.replica = replica;
// this.position = position;
// this.offset = offset;
// this.content = content;
// this.VC = VC;
// }
//
// /*
// * Construction of an insert operation
// */
// static public TraceOperation insert(int replica, int position, String content, VectorClock VC) {
// return new TraceOperation(OpType.ins, replica, position, 0, content, VC);
// }
//
// /*
// * Construction of an insert operation
// */
// static public TraceOperation delete(int replica, int position, int offset, VectorClock VC) {
// return new TraceOperation(OpType.del, replica, position, offset, null, VC);
// }
//
// @Override
// public boolean equals(Object obj) {
// if (obj == null) {
// return false;
// }
// if (getClass() != obj.getClass()) {
// return false;
// }
// final TraceOperation other = (TraceOperation) obj;
// if (this.replica != other.replica) {
// return false;
// }
// if (this.type != other.type) {
// return false;
// }
// if (this.position != other.position) {
// return false;
// }
// if (this.offset != other.offset) {
// return false;
// }
// if ((this.content == null) ? (other.content != null) : !this.content.equals(other.content)) {
// return false;
// }
// if (this.VC != other.VC && (this.VC == null || !this.VC.equals(other.VC))) {
// return false;
// }
// return true;
// }
//
// @Override
// public int hashCode() {
// int hash = 7;
// hash = 53 * hash + this.replica;
// hash = 53 * hash + (this.type != null ? this.type.hashCode() : 0);
// hash = 53 * hash + this.position;
// hash = 53 * hash + this.offset;
// hash = 53 * hash + (this.content != null ? this.content.hashCode() : 0);
// hash = 53 * hash + (this.VC != null ? this.VC.hashCode() : 0);
// return hash;
// }
//
// @Override
// public String toString() {
// return "TraceOperation{" + "replica=" + replica + ", VC=" + VC + ", type=" + type + ", position=" + position + (type==OpType.del ? ", offset=" + offset : ", content=" + content) + '}';
// }
//
//
// }
| import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import jbenchmarker.trace.IncorrectTrace;
import jbenchmarker.trace.TraceOperation; | /**
* This file is part of ReplicationBenchmark.
*
* ReplicationBenchmark 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.
*
* ReplicationBenchmark 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 ReplicationBenchmark. If not, see <http://www.gnu.org/licenses/>.
*
**/
package jbenchmarker.core;
/**
*
* @author urso
*/
public abstract class MergeAlgorithm {
// Replica identifier
private int replicaNb;
// Supported Document
private Document doc;
// Local operations generated
private List<TraceOperation> localHistory;
// All operations executed
private List<Operation> history;
// Local operations generated time map : size history -> exec time
private TreeMap<Integer, Long> localExecTime;
// All operations executed
private List<Long> execTime;
/*
* Constructor
*/
public MergeAlgorithm(Document doc, int r) {
this();
this.replicaNb = r;
this.doc = doc;
}
public MergeAlgorithm() {
this.execTime = new ArrayList<Long>();
this.localExecTime = new TreeMap<Integer, Long>();
this.history = new ArrayList<Operation>();
this.localHistory = new ArrayList<TraceOperation>();
}
/**
* To be define by the concrete merge algorithm
* Should call doc.apply
*/ | // Path: src/jbenchmarker/trace/IncorrectTrace.java
// public class IncorrectTrace extends Exception {
// public IncorrectTrace() {
// }
//
// public IncorrectTrace(Throwable thrwbl) {
// super(thrwbl);
// }
//
// public IncorrectTrace(String string, Throwable thrwbl) {
// super(string, thrwbl);
// }
//
// public IncorrectTrace(String string) {
// super(string);
// }
//
// }
//
// Path: src/jbenchmarker/trace/TraceOperation.java
// public class TraceOperation {
// public enum OpType { ins, del };
//
// private int replica; // replica number
// private OpType type; // type of operation : insert or delete
// private int position; // position in the document
// private int offset; // length of a del
// private String content; // content of an ins
// private VectorClock VC; // Vector clock
//
//
// public VectorClock getVC() {
// return VC;
// }
//
// public String getContent() {
// return content;
// }
//
// public int getOffset() {
// return offset;
// }
//
// public int getPosition() {
// return position;
// }
//
//
// public int getReplica() {
// return replica;
// }
//
//
// public OpType getType() {
// return type;
// }
//
// public TraceOperation(OpType type, int replica, int position, int offset, String content, VectorClock VC) {
// this.type = type;
// this.replica = replica;
// this.position = position;
// this.offset = offset;
// this.content = content;
// this.VC = VC;
// }
//
// /*
// * Construction of an insert operation
// */
// static public TraceOperation insert(int replica, int position, String content, VectorClock VC) {
// return new TraceOperation(OpType.ins, replica, position, 0, content, VC);
// }
//
// /*
// * Construction of an insert operation
// */
// static public TraceOperation delete(int replica, int position, int offset, VectorClock VC) {
// return new TraceOperation(OpType.del, replica, position, offset, null, VC);
// }
//
// @Override
// public boolean equals(Object obj) {
// if (obj == null) {
// return false;
// }
// if (getClass() != obj.getClass()) {
// return false;
// }
// final TraceOperation other = (TraceOperation) obj;
// if (this.replica != other.replica) {
// return false;
// }
// if (this.type != other.type) {
// return false;
// }
// if (this.position != other.position) {
// return false;
// }
// if (this.offset != other.offset) {
// return false;
// }
// if ((this.content == null) ? (other.content != null) : !this.content.equals(other.content)) {
// return false;
// }
// if (this.VC != other.VC && (this.VC == null || !this.VC.equals(other.VC))) {
// return false;
// }
// return true;
// }
//
// @Override
// public int hashCode() {
// int hash = 7;
// hash = 53 * hash + this.replica;
// hash = 53 * hash + (this.type != null ? this.type.hashCode() : 0);
// hash = 53 * hash + this.position;
// hash = 53 * hash + this.offset;
// hash = 53 * hash + (this.content != null ? this.content.hashCode() : 0);
// hash = 53 * hash + (this.VC != null ? this.VC.hashCode() : 0);
// return hash;
// }
//
// @Override
// public String toString() {
// return "TraceOperation{" + "replica=" + replica + ", VC=" + VC + ", type=" + type + ", position=" + position + (type==OpType.del ? ", offset=" + offset : ", content=" + content) + '}';
// }
//
//
// }
// Path: src/jbenchmarker/core/MergeAlgorithm.java
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import jbenchmarker.trace.IncorrectTrace;
import jbenchmarker.trace.TraceOperation;
/**
* This file is part of ReplicationBenchmark.
*
* ReplicationBenchmark 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.
*
* ReplicationBenchmark 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 ReplicationBenchmark. If not, see <http://www.gnu.org/licenses/>.
*
**/
package jbenchmarker.core;
/**
*
* @author urso
*/
public abstract class MergeAlgorithm {
// Replica identifier
private int replicaNb;
// Supported Document
private Document doc;
// Local operations generated
private List<TraceOperation> localHistory;
// All operations executed
private List<Operation> history;
// Local operations generated time map : size history -> exec time
private TreeMap<Integer, Long> localExecTime;
// All operations executed
private List<Long> execTime;
/*
* Constructor
*/
public MergeAlgorithm(Document doc, int r) {
this();
this.replicaNb = r;
this.doc = doc;
}
public MergeAlgorithm() {
this.execTime = new ArrayList<Long>();
this.localExecTime = new TreeMap<Integer, Long>();
this.history = new ArrayList<Operation>();
this.localHistory = new ArrayList<TraceOperation>();
}
/**
* To be define by the concrete merge algorithm
* Should call doc.apply
*/ | protected abstract void integrateLocal(Operation op) throws IncorrectTrace; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.