Select a tag to browse associated projects and drill deeper into the tag cloud.
Another Amazon AWS SimpleDB wrapper?Yes, this is yet another wrapper for Amazon SimpleDB. First of all, despite the REST hype, I still see SOAP + WS standards as a much more mature platform for enterprise development. Second, there needs to be an authority that keeps APIs in synch with latest Amazon ... [More] AWS WSDLs. I would like to utilize my development team to help become such an authority, hopefully with your help. And by help I mean user community. Please use this API if you like it or not ;) Since all the projects we are involved in make use of Spring framework, we decided to make heavy use of it here as well. We are actively using Apache ServiceMix and Progress Fuse OSGi-containers, that is why the project is using Maven with PAX to create OSGi bundles. If you are not using OSGi, you can treat this library as a regular jar. We love Apache CXF (untill we ran into issues with EC2 WSDL and wsdl2java :)) and use it as to help out with SOAP stuff. UsageAt first, check out our unit tests to get the best idea about SimpleDB client. The API is very simple to use once you configure everything. // Get all domains. SimpleDB simpledb = (SimpleDB) context.getBean("simpleDB"); Iterator> domainsIterator; try { domainsIterator = simpledb.getDomains(); while (domainsIterator.hasNext()) { List domains = (List) domainsIterator.next(); for (Domain domain : domains) { System.out.println(domain.getName()); } } } catch (SimpleDBException e) { // TODO Auto-generated catch block e.printStackTrace(); } // Issue select. Iterator> itemIterator; try { itemIterator = simpledb.select("select * from Domain where LN='Party' and city like 'Buck%'"); while (itemIterator.hasNext()) { List items = (List) itemIterator.next(); for (Item item : items) { System.out.print(item.getIdentifier()); List attributes = item.getAttributes(); for (ItemAttribute attribute : attributes) { System.out.print(attribute.getName() + "=" + attribute.getValue() + " , "); System.out.println(); } } } } catch (SimpleDBException e) { // TODO Auto-generated catch block e.printStackTrace(); }Spring Context aws.propertiesamazonaws.simpledb.url=https\://sdb.amazonaws.com keystore.alias=REPLACEME signaturePropFile=clientKeystore.properties encryptionPropFile=clientKeystore.properties signatureParts={Element}{http\://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;{Element}{http\://schemas.xmlsoap.org/soap/envelope/}BodyclientKeystore.propertiesorg.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin org.apache.ws.security.crypto.merlin.keystore.type=jks org.apache.ws.security.crypto.merlin.keystore.password=REPLACEME org.apache.ws.security.crypto.merlin.keystore.alias=REPLACEME org.apache.ws.security.crypto.merlin.file=awskeystore.jksawskeystore.jksThis is your java keystore file. Obviously, you can rename it, just make sure you update clientKeystore.properties accordingly. This is the most complex step of the entire setup. Unlike REST, SOAP needs a keystore file, composed of a pair: your Amazon x509 certificate (xxx.pem) and your Amazon private key. Unfortunatelly, java keygen utility cannot create a keystore using exising certificate + private key. To create, the keystore, please follow these instructions. In couple of days we will provide a utility that will simplify things. http://www.agentbob.info/agentbob/79-AB.html Contains Instructions http://www.slproweb.com/products/Win32OpenSSL.html Contains Windows OpenSSL install instructions. Here is what had to do: openssl pkcs8 -topk8 -nocrypt -in pk-YOURPRIVATEKEY.pem -inform PEM -out C:\Users\netflexity\Documents\pk-YOURPRIVATEKEY.der -outform DER openssl x509 -in cert-YOURX509.pem -inform PEM -out cert-YOURX509.der -outform DER java ImportKey C:\\Users\\xx\\xx\\projects\\workspace-fuse\\netflexitysolutions.amazonws.sdb\\src\\test\\resources\\pk-YOURPRIVATEKEY.der C:\\Users\\netflexity\\development\\projects\\workspace-fuse\\netflexitysolutions.amazonws.sdb\\src\\test\\resources\\cert-YOURX509.cer YOUR-KEYSTORE-ALIAS [Less]
This project has been renamed. Please visit us here SimpleDB ORM. Another ORM for SimpleDB?This is a simple java-based object-relational mapping (ORM) framework, targeting people who used to develop against Hibernate ORM. Knowledge of Hibernate is not required, but will definitely help. What is ... [More] wrong with simplejpa? Nothing wrong, it is a great project and please check it out. I am not a fan of JPA and my goal was to make this as light as possible with as less dependencies as possible. This framework is not perfect. Frankly, I would prefer to have SimpleDB jdbc driver with SimpleDB Hibernate Dialect, but too lazy to do that. Maybe someone will act on this idea. Some Features:Compatible with existing hibernate mapping files (.hbm) Lightweight. I am not a fan of JPA. I also believe that Annotations defeat the purpose of POJO. Externalizing mappings into XML makes it easier to browse the mappings as well as allows using generated JAXB classes, for example, as domain objects. Removed lazy loading (CGLib dependency). Since I am used to initializing all the lazy beans through Hibernate initialization utility, I decided to put loading burden on the utility itself. Supports Amazon S3 for large storage. Supports Ehcache and Memcached as Second Level Cache. Many-to-Many relationship is used in conjunction with multi-valued attributes. This removes a need in a many-to-many tables. I really like this one. Supports logical table names, allowing one domain to store an entire schema. This might be useful for small projects where data load is small. This design allows creating INNER JOIN queries, assuming all column names are unique. Supports simple query building. Will support record distribution throughout domains to increase performance for large databases. I am still not sure if this is a good place for this functionality. Getting Started:Note: this projects depends on netflexity-amazonws-simpledb project, which provides client API to Amazon SimpleDB. I suggest to start Amazon SimpleDB modeling with MySQL or any other relational database that you are the most familiar and productive with. Create the model. Make sure to use VARCHAR for primary and foreign keys. Make sure that you have no composite primary keys; this is the recommended approach for normalization anyway. Reverse-engineer your schema with Hibernate Tools. Make minor adjustments to support Domains and Logical names if necessary. Create DAO layer with SimpleDB ORM and have fun doing it! Usage Example// Find all party objects. SimpleDBSession simpledbSession = (SimpleDBSession) context.getBean("simpledbSessionFactory"); Set parties = simpledbSession.findAll(Party.class, "companyName"); for (Party nfxParty : parties) { System.out.println(RecordUtil.toString(simpledbSession.getMetadata(Party.class), nfxParty)); } // Add User with many-to-one account and 2 roles, setup as many-to-many. Note that // many-to-many is mapped to Item Attributes with multiple values, which is very convenient :) Role role = new Role(); role.setName("Administrator 3"); simpledbSession.save(role); Role role2 = new Role(); role2.setName("Developer 3"); simpledbSession.save(role2); Account account = new Account(); account.setId("3ca5b4b8-5d0b-4ed0-8908-bd6f046a3581"); User user = new User(); user.setUsername("maxim"); user.setPassword("password1"); user.setStatus("A"); user.setChangeBy("Somebody"); user.setChangeDate(System.currentTimeMillis()); user.setNfxAccount(account); user.getNfxRoles().add(role); user.getNfxRoles().add(role2); simpledbSession.save(user);Spring ConfigurationThis is an example of SimpleDB ORM setup with Ehcache as a 2nd level cache. There is a reference to simpledbDataSource, which is a SimpleDB client for Amazon SimpleDB that you can find here. mappingResource property points to sample.xml, which is a hibernate-like configuration file, which is 99% like .hbm.xml files, but with a different root element. Sample Ehcache Configuration Sample Hibernate-like configurationNote, that for now, many-to-many has to be supplied in a and one-to-many in a . We are using Apache Digester to parse the configuration and it does not support XPath. table is used for domain name discriminator-value is used as a logical name (to use a domain per schema) Company name. Address line 1. Address line 2. City name. State or province. Postal code. Country code. Contact name. Contact phone. Contact email. Company. Company. Account auto-generated string id. License content in XML. Date membership becomes valid. Date membership expires. Date account established. A - ACTIVE, I - INACTIVE Username Password [Less]
Copyright
©
2013
Black Duck Software, Inc.
and its contributors, Some Rights Reserved. Unless otherwise marked, this work is licensed under a
Creative Commons Attribution 3.0 Unported License
. Ohloh
®
and the Ohloh logo are trademarks of
Black Duck Software, Inc.
in the United States and/or other jurisdictions. All other trademarks are the property of their respective holders.