diff options
| author | jesus m. rodriguez <jesusr@redhat.com> | 2009-07-08 21:54:46 -0400 |
|---|---|---|
| committer | jesus m. rodriguez <jesusr@redhat.com> | 2009-07-08 21:54:46 -0400 |
| commit | cefdabc4e86fc027bf0fa6c59f2cdf51fba95665 (patch) | |
| tree | 32b97061df9534be92b71cbb6d9347340810bc3d /proxy/code/src | |
| parent | 70ed767bff02517b3fc986293540b5c5abb40b53 (diff) | |
| download | candlepin-cefdabc4e86fc027bf0fa6c59f2cdf51fba95665.tar.gz candlepin-cefdabc4e86fc027bf0fa6c59f2cdf51fba95665.tar.xz candlepin-cefdabc4e86fc027bf0fa6c59f2cdf51fba95665.zip | |
remove the evil tab characters
Diffstat (limited to 'proxy/code/src')
10 files changed, 517 insertions, 517 deletions
diff --git a/proxy/code/src/org/fedoraproject/candlepin/api/ApiHandler.java b/proxy/code/src/org/fedoraproject/candlepin/api/ApiHandler.java index 4f127b3..c9fee84 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/api/ApiHandler.java +++ b/proxy/code/src/org/fedoraproject/candlepin/api/ApiHandler.java @@ -13,62 +13,62 @@ import org.fedoraproject.candlepin.model.Organization; import org.fedoraproject.candlepin.model.User; public class ApiHandler { - - private static ApiHandler instance = new ApiHandler(); - private Set authTokens; - - /** - * Logger for this class - */ - private static final Logger logger = Logger.getLogger(ApiHandler.class); + + private static ApiHandler instance = new ApiHandler(); + private Set authTokens; + + /** + * Logger for this class + */ + private static final Logger logger = Logger.getLogger(ApiHandler.class); - private ApiHandler() { - authTokens = new HashSet(); - } - - public static ApiHandler get() { - return instance; - } - - /** - * Auth - */ - public String login(String login, String password) { - User u = (User) ObjectFactory.get(). - lookupByFieldName(User.class, "login", login); - if (u == null) { - return null; - } - if (u.getPassword().equals(password)) { - String newtoken = BaseModel.generateUUID(); - authTokens.add(newtoken); - return newtoken; - } - else { - return null; - } - } - - private void checkToken(String token) throws AuthenticationException { - if (!authTokens.contains(token)) { - throw new AuthenticationException("token not valid: " + token); - } - } - - /** Organizations */ - - /** Fetch an org - * - */ - public Organization getOrg(String authToken, String uuid) { - checkToken(authToken); - logger.debug("getOrg(String) - start: " + uuid); - Organization retval = (Organization) ObjectFactory.get() - .lookupByUUID(Organization.class, uuid); - if (logger.isDebugEnabled()) { - logger.debug("getOrg(String) - end. returning: " + retval); - } - return retval; - } - + private ApiHandler() { + authTokens = new HashSet(); + } + + public static ApiHandler get() { + return instance; + } + + /** + * Auth + */ + public String login(String login, String password) { + User u = (User) ObjectFactory.get(). + lookupByFieldName(User.class, "login", login); + if (u == null) { + return null; + } + if (u.getPassword().equals(password)) { + String newtoken = BaseModel.generateUUID(); + authTokens.add(newtoken); + return newtoken; + } + else { + return null; + } + } + + private void checkToken(String token) throws AuthenticationException { + if (!authTokens.contains(token)) { + throw new AuthenticationException("token not valid: " + token); + } + } + + /** Organizations */ + + /** Fetch an org + * + */ + public Organization getOrg(String authToken, String uuid) { + checkToken(authToken); + logger.debug("getOrg(String) - start: " + uuid); + Organization retval = (Organization) ObjectFactory.get() + .lookupByUUID(Organization.class, uuid); + if (logger.isDebugEnabled()) { + logger.debug("getOrg(String) - end. returning: " + retval); + } + return retval; + } + } diff --git a/proxy/code/src/org/fedoraproject/candlepin/api/AuthenticationException.java b/proxy/code/src/org/fedoraproject/candlepin/api/AuthenticationException.java index f7b318e..8cd4ec6 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/api/AuthenticationException.java +++ b/proxy/code/src/org/fedoraproject/candlepin/api/AuthenticationException.java @@ -20,13 +20,13 @@ package org.fedoraproject.candlepin.api; */ public class AuthenticationException extends RuntimeException { - private static final long serialVersionUID = 1L; - - /** - * @param message - */ - public AuthenticationException(String message) { - super(message); - } + private static final long serialVersionUID = 1L; + + /** + * @param message + */ + public AuthenticationException(String message) { + super(message); + } } diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/BaseModel.java b/proxy/code/src/org/fedoraproject/candlepin/model/BaseModel.java index 0091949..43468ec 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/model/BaseModel.java +++ b/proxy/code/src/org/fedoraproject/candlepin/model/BaseModel.java @@ -22,45 +22,45 @@ import java.util.UUID; */ public class BaseModel { - private String uuid; - private String name; + private String uuid; + private String name; - /** - * Construct new with UUID - * @param uuid - */ - public BaseModel(String uuid) { - this.uuid = uuid; - } - - /** - * Default constructor - */ - public BaseModel() { - - } - - public String getUuid() { - return uuid; - } + /** + * Construct new with UUID + * @param uuid + */ + public BaseModel(String uuid) { + this.uuid = uuid; + } + + /** + * Default constructor + */ + public BaseModel() { + + } + + public String getUuid() { + return uuid; + } - public void setUuid(String uuid) { - this.uuid = uuid; - } + public void setUuid(String uuid) { + this.uuid = uuid; + } - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(String name) { - this.name = name; - } + public void setName(String name) { + this.name = name; + } - /** - * Generate a UUID for an object. - * @return String UUID. - */ - public static String generateUUID() { - return UUID.randomUUID().toString(); - } + /** + * Generate a UUID for an object. + * @return String UUID. + */ + public static String generateUUID() { + return UUID.randomUUID().toString(); + } } diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/Consumer.java b/proxy/code/src/org/fedoraproject/candlepin/model/Consumer.java index b97ee5e..473474b 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/model/Consumer.java +++ b/proxy/code/src/org/fedoraproject/candlepin/model/Consumer.java @@ -19,78 +19,78 @@ import java.util.List; public class Consumer extends BaseModel { - - private String type; - private Organization organization; - private Consumer parent; - private List<Product> consumedProducts; - - /** - * @param uuid - */ - public Consumer(String uuid) { - super(uuid); - } - /** - * @return the type - */ - public String getType() { - return type; - } - /** - * @param type the type to set - */ - public void setType(String type) { - this.type = type; - } - /** - * @return the parent - */ - public Consumer getParent() { - return parent; - } - /** - * @param parent the parent to set - */ - public void setParent(Consumer parent) { - this.parent = parent; - } - /** - * @return the consumedProducts - */ - public List<Product> getConsumedProducts() { - return consumedProducts; - } - /** - * @param consumedProducts the consumedProducts to set - */ - public void setConsumedProducts(List<Product> consumedProducts) { - this.consumedProducts = consumedProducts; - } - /** - * @return the organization - */ - public Organization getOrganization() { - return organization; - } - /** - * @param organization the organization to set - */ - public void setOrganization(Organization organization) { - this.organization = organization; - } - - /** - * Add a Product to this Consumer. - * - */ - public void addConsumedProduct(Product p) { - if (this.consumedProducts == null) { - this.consumedProducts = new LinkedList<Product>(); - } - this.consumedProducts.add(p); - - } - - + + private String type; + private Organization organization; + private Consumer parent; + private List<Product> consumedProducts; + + /** + * @param uuid + */ + public Consumer(String uuid) { + super(uuid); + } + /** + * @return the type + */ + public String getType() { + return type; + } + /** + * @param type the type to set + */ + public void setType(String type) { + this.type = type; + } + /** + * @return the parent + */ + public Consumer getParent() { + return parent; + } + /** + * @param parent the parent to set + */ + public void setParent(Consumer parent) { + this.parent = parent; + } + /** + * @return the consumedProducts + */ + public List<Product> getConsumedProducts() { + return consumedProducts; + } + /** + * @param consumedProducts the consumedProducts to set + */ + public void setConsumedProducts(List<Product> consumedProducts) { + this.consumedProducts = consumedProducts; + } + /** + * @return the organization + */ + public Organization getOrganization() { + return organization; + } + /** + * @param organization the organization to set + */ + public void setOrganization(Organization organization) { + this.organization = organization; + } + + /** + * Add a Product to this Consumer. + * + */ + public void addConsumedProduct(Product p) { + if (this.consumedProducts == null) { + this.consumedProducts = new LinkedList<Product>(); + } + this.consumedProducts.add(p); + + } + + } diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/Entitlement.java b/proxy/code/src/org/fedoraproject/candlepin/model/Entitlement.java index a573ad9..b4157db 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/model/Entitlement.java +++ b/proxy/code/src/org/fedoraproject/candlepin/model/Entitlement.java @@ -18,36 +18,36 @@ import java.util.List; public class Entitlement extends BaseModel { - - private Organization org; - private List<Entitlement> childEntitlements; - - /** - * @return the org - */ - public Organization getOrg() { - return org; - } - - /** - * @param org the org to set - */ - public void setOrg(Organization org) { - this.org = org; - } - - /** - * @return the childEntitlements - */ - public List<Entitlement> getChildEntitlements() { - return childEntitlements; - } - - /** - * @param childEntitlements the childEntitlements to set - */ - public void setChildEntitlements(List<Entitlement> childEntitlements) { - this.childEntitlements = childEntitlements; - } + + private Organization org; + private List<Entitlement> childEntitlements; + + /** + * @return the org + */ + public Organization getOrg() { + return org; + } + + /** + * @param org the org to set + */ + public void setOrg(Organization org) { + this.org = org; + } + + /** + * @return the childEntitlements + */ + public List<Entitlement> getChildEntitlements() { + return childEntitlements; + } + + /** + * @param childEntitlements the childEntitlements to set + */ + public void setChildEntitlements(List<Entitlement> childEntitlements) { + this.childEntitlements = childEntitlements; + } } diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/EntitlementPool.java b/proxy/code/src/org/fedoraproject/candlepin/model/EntitlementPool.java index aa59c62..2899ac1 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/model/EntitlementPool.java +++ b/proxy/code/src/org/fedoraproject/candlepin/model/EntitlementPool.java @@ -18,103 +18,103 @@ import java.util.Date; public class EntitlementPool extends BaseModel { - - private Organization organization; - private Product product; - private long maxMembers; - private long currentMembers; - - private Date startDate; - private Date endDate; - - /** - * @param uuid - */ - public EntitlementPool(String uuid) { - super(uuid); - } - - /** - * Default const - */ - public EntitlementPool() { - - } - - /** - * @return the product - */ - public Product getProduct() { - return product; - } - /** - * @param product the product to set - */ - public void setProduct(Product product) { - this.product = product; - } - /** - * @return the startDate - */ - public Date getStartDate() { - return startDate; - } - /** - * @param startDate the startDate to set - */ - public void setStartDate(Date startDate) { - this.startDate = startDate; - } - /** - * @return the endDate - */ - public Date getEndDate() { - return endDate; - } - /** - * @param endDate the endDate to set - */ - public void setEndDate(Date endDate) { - this.endDate = endDate; - } - /** - * @return the maxMembers - */ - public long getMaxMembers() { - return maxMembers; - } - /** - * @param maxMembers the maxMembers to set - */ - public void setMaxMembers(long maxMembers) { - this.maxMembers = maxMembers; - } - /** - * @return the currentMembers - */ - public long getCurrentMembers() { - return currentMembers; - } - /** - * @param currentMembers the currentMembers to set - */ - public void setCurrentMembers(long currentMembers) { - this.currentMembers = currentMembers; - } + + private Organization organization; + private Product product; + private long maxMembers; + private long currentMembers; + + private Date startDate; + private Date endDate; + + /** + * @param uuid + */ + public EntitlementPool(String uuid) { + super(uuid); + } + + /** + * Default const + */ + public EntitlementPool() { + + } + + /** + * @return the product + */ + public Product getProduct() { + return product; + } + /** + * @param product the product to set + */ + public void setProduct(Product product) { + this.product = product; + } + /** + * @return the startDate + */ + public Date getStartDate() { + return startDate; + } + /** + * @param startDate the startDate to set + */ + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + /** + * @return the endDate + */ + public Date getEndDate() { + return endDate; + } + /** + * @param endDate the endDate to set + */ + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + /** + * @return the maxMembers + */ + public long getMaxMembers() { + return maxMembers; + } + /** + * @param maxMembers the maxMembers to set + */ + public void setMaxMembers(long maxMembers) { + this.maxMembers = maxMembers; + } + /** + * @return the currentMembers + */ + public long getCurrentMembers() { + return currentMembers; + } + /** + * @param currentMembers the currentMembers to set + */ + public void setCurrentMembers(long currentMembers) { + this.currentMembers = currentMembers; + } - /** - * @return the organization - */ - public Organization getOrganization() { - return organization; - } + /** + * @return the organization + */ + public Organization getOrganization() { + return organization; + } - /** - * @param organization the organization to set - */ - public void setOrganization(Organization organization) { - this.organization = organization; - } - + /** + * @param organization the organization to set + */ + public void setOrganization(Organization organization) { + this.organization = organization; + } + } diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/ObjectFactory.java b/proxy/code/src/org/fedoraproject/candlepin/model/ObjectFactory.java index 38d028d..94f1b29 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/model/ObjectFactory.java +++ b/proxy/code/src/org/fedoraproject/candlepin/model/ObjectFactory.java @@ -29,55 +29,55 @@ import org.fedoraproject.candlepin.util.MethodUtil; */ public class ObjectFactory { - private static ObjectFactory instance = new ObjectFactory(); - private Map objects; - - - private ObjectFactory() { - objects = new HashMap(); - } + private static ObjectFactory instance = new ObjectFactory(); + private Map objects; + + + private ObjectFactory() { + objects = new HashMap(); + } - public static ObjectFactory get() { - return instance; - } + public static ObjectFactory get() { + return instance; + } - /** - * Lookup an Organization by UUID - * @param uuid to lookup - * @return Organization - */ - public BaseModel lookupByUUID(Class<?> clazz, String uuid) { - return (BaseModel) lookupByFieldName(clazz, "uuid", uuid); - } + /** + * Lookup an Organization by UUID + * @param uuid to lookup + * @return Organization + */ + public BaseModel lookupByUUID(Class<?> clazz, String uuid) { + return (BaseModel) lookupByFieldName(clazz, "uuid", uuid); + } - /** - * Lookup an object by a field name - * @param clazz - * @param fieldName - * @return BaseModel if found. - */ - public Object lookupByFieldName(Class<?> clazz, String fieldName, String value) { - String key = clazz.getName(); - if (!objects.containsKey(key)) { - return null; - } - List typelist = (List) objects.get(key); - for (int i = 0; i < typelist.size(); i++) { - Object o = typelist.get(i); - System.out.println("O: " + o); - String getter = "get" + fieldName.substring(0, 1).toUpperCase() + - fieldName.substring(1); - System.out.println("getter: " + getter); - Object v = MethodUtil.callMethod(o, getter, new Object[0]); - System.out.println("v: " + v); - if (v.equals(value)) { - return o; - } - } - return null; - } - - /** + /** + * Lookup an object by a field name + * @param clazz + * @param fieldName + * @return BaseModel if found. + */ + public Object lookupByFieldName(Class<?> clazz, String fieldName, String value) { + String key = clazz.getName(); + if (!objects.containsKey(key)) { + return null; + } + List typelist = (List) objects.get(key); + for (int i = 0; i < typelist.size(); i++) { + Object o = typelist.get(i); + System.out.println("O: " + o); + String getter = "get" + fieldName.substring(0, 1).toUpperCase() + + fieldName.substring(1); + System.out.println("getter: " + getter); + Object v = MethodUtil.callMethod(o, getter, new Object[0]); + System.out.println("v: " + v); + if (v.equals(value)) { + return o; + } + } + return null; + } + + /** * Create a new instance of the classname passed in. * * @param className @@ -145,16 +145,16 @@ public class ObjectFactory { * Store an object * @param u */ - public void store(Object u) { - String key = u.getClass().getName(); - if (!objects.containsKey(key)) { - List newtype = new LinkedList(); - newtype.add(u); - objects.put(u.getClass().getName(), newtype); - } - List typelist = (List) objects.get(key); - typelist.add(u); - } + public void store(Object u) { + String key = u.getClass().getName(); + if (!objects.containsKey(key)) { + List newtype = new LinkedList(); + newtype.add(u); + objects.put(u.getClass().getName(), newtype); + } + List typelist = (List) objects.get(key); + typelist.add(u); + } } diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/Organization.java b/proxy/code/src/org/fedoraproject/candlepin/model/Organization.java index 3fd7be4..8e50ef5 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/model/Organization.java +++ b/proxy/code/src/org/fedoraproject/candlepin/model/Organization.java @@ -19,87 +19,87 @@ import java.util.List; public class Organization extends BaseModel { - - private List<Consumer> consumers; - private List<EntitlementPool> entitlementPools; - private List<User> users; - - /** - * @param uuid - */ - public Organization(String uuid) { - super(uuid); - } - - /** - * Default - */ - public Organization() { - } - - /** - * @return the consumers - */ - public List<Consumer> getConsumers() { - return consumers; - } - /** - * @param consumers the consumers to set - */ - public void setConsumers(List<Consumer> consumers) { - this.consumers = consumers; - } - /** - * @return the entitlementPools - */ - public List<EntitlementPool> getEntitlementPools() { - return entitlementPools; - } - /** - * @param entitlementPools the entitlementPools to set - */ - public void setEntitlementPools(List<EntitlementPool> entitlementPools) { - this.entitlementPools = entitlementPools; - } - /** - * @return the users - */ - public List<User> getUsers() { - return users; - } - /** - * @param users the users to set - */ - public void setUsers(List<User> users) { - this.users = users; - } - - /** - * Add a user. - * @param u to add to this org. - */ - public void addUser(User u) { - u.setOrganization(this); - if (this.users == null) { - this.users = new LinkedList<User>(); - } - this.users.add(u); - } + + private List<Consumer> consumers; + private List<EntitlementPool> entitlementPools; + private List<User> users; + + /** + * @param uuid + */ + public Organization(String uuid) { + super(uuid); + } + + /** + * Default + */ + public Organization() { + } + + /** + * @return the consumers + */ + public List<Consumer> getConsumers() { + return consumers; + } + /** + * @param consumers the consumers to set + */ + public void setConsumers(List<Consumer> consumers) { + this.consumers = consumers; + } + /** + * @return the entitlementPools + */ + public List<EntitlementPool> getEntitlementPools() { + return entitlementPools; + } + /** + * @param entitlementPools the entitlementPools to set + */ + public void setEntitlementPools(List<EntitlementPool> entitlementPools) { + this.entitlementPools = entitlementPools; + } + /** + * @return the users + */ + public List<User> getUsers() { + return users; + } + /** + * @param users the users to set + */ + public void setUsers(List<User> users) { + this.users = users; + } + + /** + * Add a user. + * @param u to add to this org. + */ + public void addUser(User u) { + u.setOrganization(this); + if (this.users == null) { + this.users = new LinkedList<User>(); + } + this.users.add(u); + } - public void addConsumer(Consumer c) { - c.setOrganization(this); - if (this.consumers == null) { - this.consumers = new LinkedList<Consumer>(); - } - this.consumers.add(c); - - } + public void addConsumer(Consumer c) { + c.setOrganization(this); + if (this.consumers == null) { + this.consumers = new LinkedList<Consumer>(); + } + this.consumers.add(c); + + } - public void addEntitlementPool(EntitlementPool pool) { - pool.setOrganization(this); - if (this.entitlementPools == null) { - this.entitlementPools = new LinkedList<EntitlementPool>(); - } - this.entitlementPools.add(pool); - } + public void addEntitlementPool(EntitlementPool pool) { + pool.setOrganization(this); + if (this.entitlementPools == null) { + this.entitlementPools = new LinkedList<EntitlementPool>(); + } + this.entitlementPools.add(pool); + } } diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/Product.java b/proxy/code/src/org/fedoraproject/candlepin/model/Product.java index b20c783..a4876cc 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/model/Product.java +++ b/proxy/code/src/org/fedoraproject/candlepin/model/Product.java @@ -19,45 +19,45 @@ import java.util.List; public class Product extends BaseModel { - - private List<Product> childProducts; + + private List<Product> childProducts; - /** - * Create product with UUID - * @param uuid - */ - public Product(String uuid) { - super(uuid); - } - - /** - * Default constructor - */ - public Product() { - } + /** + * Create product with UUID + * @param uuid + */ + public Product(String uuid) { + super(uuid); + } + + /** + * Default constructor + */ + public Product() { + } - /** - * @return the childProducts - */ - public List<Product> getChildProducts() { - return childProducts; - } + /** + * @return the childProducts + */ + public List<Product> getChildProducts() { + return childProducts; + } - /** - * @param childProducts the childProducts to set - */ - public void setChildProducts(List<Product> childProducts) { - this.childProducts = childProducts; - } - - /** - * Add a child of this Product. - * @param p to add - */ - public void addChildProduct(Product p) { - if (this.childProducts == null) { - this.childProducts = new LinkedList<Product>(); - } - this.childProducts.add(p); - } + /** + * @param childProducts the childProducts to set + */ + public void setChildProducts(List<Product> childProducts) { + this.childProducts = childProducts; + } + + /** + * Add a child of this Product. + * @param p to add + */ + public void addChildProduct(Product p) { + if (this.childProducts == null) { + this.childProducts = new LinkedList<Product>(); + } + this.childProducts.add(p); + } } diff --git a/proxy/code/src/org/fedoraproject/candlepin/model/User.java b/proxy/code/src/org/fedoraproject/candlepin/model/User.java index 96f72df..eda58b1 100644 --- a/proxy/code/src/org/fedoraproject/candlepin/model/User.java +++ b/proxy/code/src/org/fedoraproject/candlepin/model/User.java @@ -16,46 +16,46 @@ package org.fedoraproject.candlepin.model; public class User extends BaseModel { - - private Organization organization; - private String login; - private String password; + + private Organization organization; + private String login; + private String password; - /** - * @return the login - */ - public String getLogin() { - return login; - } - /** - * @param login the login to set - */ - public void setLogin(String login) { - this.login = login; - } - /** - * @return the password - */ - public String getPassword() { - return password; - } - /** - * @param password the password to set - */ - public void setPassword(String password) { - this.password = password; - } - /** - * @return the organization - */ - public Organization getOrganization() { - return organization; - } - /** - * @param organization the organization to set - */ - public void setOrganization(Organization organization) { - this.organization = organization; - } + /** + * @return the login + */ + public String getLogin() { + return login; + } + /** + * @param login the login to set + */ + public void setLogin(String login) { + this.login = login; + } + /** + * @return the password + */ + public String getPassword() { + return password; + } + /** + * @param password the password to set + */ + public void setPassword(String password) { + this.password = password; + } + /** + * @return the organization + */ + public Organization getOrganization() { + return organization; + } + /** + * @param organization the organization to set + */ + public void setOrganization(Organization organization) { + this.organization = organization; + } } |
