I have a simple app I'd like to use JDO. But I don't want to use any DB back, just regular file system. Before jdo, I had this class it serializes it object to a file whereas file name is the "primary key". I'd like to be able to do the same thing with JDO. Is that possible?
Reference Implementation for JDO 1.0 used flat files. Look at Apache JDO which ought to contain the original files
Perhaps DataNucleus is a choice for you as it supports different kind of storage backends. The xml storage plugin or the embedded database db4o storage plugin might be an option, but both use a single file for all objects instead of one file per object.
Some time ago I used the JDO 1.0.1 file implementation and worked fine for my simple cases
Related
Is there a way to get any Apache Camel component "metadata" using Java code, like the list of options and other parameters and their types? I think some automatic help builder was mentioned somewhere that might be of use for this task without using reflection.
A way to get the registered components of all types (including data formats and languages) with java code is also sought. Thanks
Yeah take a look at the camel-catalog JAR which includes all such details. This JAR is what the tooling uses such as some of the Maven tooling itself, or IDE plugs for IntelliJ or Eclipse etc. The JAR has both Java API and metadata files embedded in the JAR you can load.
At runtime you can also access this catalog via RuntimeCamelCatalog which you can access via CamelContext. The runtime catalog is a little bit more limited than CamelCatalog as it has a view of what actually is available at runtime in the current Camel application.
Also I cover this in my book Camel in Action 2nd edition where there is a full chapter devoted on Camel tooling and how to build custom tooling etc.
This is what I've found so far
http://camel.apache.org/componentconfiguration.html
Anticipating possible future issues, I decided to use Java-based Jackrabbit implementation (since it's the system with the highest performance according to the Symfony CMF docs) for the storage purposes. For the portal I'm developing I use at the moment Symfony CMF with PHPCR content repository feature + some related tables in a standard RDBMS (MySQL).
Unfortunetely I have a very little knowledge and almost none practical experience on content repository systems. So here's my question:
When using Jackrabbit with PHPCR-ODM from within Symfony CMF app, am I able to access the stored content (being Document objects as seeing from PHPCR-ODM) from other solutions than PHPCR-ODM - say, from Java Spring app?
In other words, if I wanted at some stage switch to Java, and not touching the storage (Jackrabbit / MySQL), but just creating Java equivalent Documents, would I able to do this? Or I need to do some more work like exporting the database, and then make some work with importing it again to e.g. mentioned Java based solution?
yes, you can access the content from java without having to change the content. we even did a proof of concept to read data from Magnolia and Adobe CQ via PHPCR ODM.
I have a GAE/Python application that is an admin program that allows people all over the world to translate template files for a large GAE application into their local language (we cannot use auto translation because many idioms and the like are involved). The template files have been tokenized and text snippets in the various languages are stored in a GAE datastore (there are thousands of template files involved).
I therefore need to be able to write files to a folder.
I have the following code:
with open("my_new_file.html", "wb") as fh:
fh.write(output)
I have read that GAE blocks the writing of files. If that is true, is there some way to get around it?
If I cannot write the file direct, does anyone have a suggestion for how I accomplish the same thing (e.g. do something with a web-service that does some kind of round trip to download and then upload the file)?
I am a newbie to GAE/Python, so please be specific.
Thanks for any suggestions.
you could use google app engine blobstore or BlobProperty in datastore to store blobs/files
for using blobstore (up to 2GB)
https://developers.google.com/appengine/docs/python/blobstore/
for using datastore blobs (only up to 1MB)
https://developers.google.com/appengine/docs/python/datastore/typesandpropertyclasses#Blob
Filesystem is read only in many cloud system and GAE is too. In a virtual world, where the OS and machine are virtual, the filesystem is least reliable place to store anything
I would suggest using any of BLOB, Google Cloud Storage, Google Drive or even go a setp further and store in any external provider like Amazon S3 etc.
Use the files API:
https://developers.google.com/appengine/docs/python/googlestorage/overview
Adding some extra code you can use it like the normal Python file API:
with files.open(writable_file_name, 'a') as f:
f.write('Hello World!')
While this particular link describes it in relation with Google Cloud Storage (GCS) you can easily replace the GCS-specific pieces and use blobstore as a storage backend.
The code can be found here:
http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/api/files/
As far as I learned there is no possibility to write directly to the filesystem on GAE.
Since the templates are stored in the app/view directory how do you solve the problem to have some interface that is used to editing the templates that are being used? Is it possible to have template editors who have access to the new version's template files, or they must work on a separate development server and when everyone is done then the app admin can upload the new version to GAE?
IMO the best solution is to store the templates directly in GAE? In the datastore itself or in the blobstore... I think nothing prevents Play! from extracting its VirtualFile from a datastore instead of the file system. But, you need to tweak a bit this part of Play! I don't think it's really terrible but it's not trivial.
You can save them in blobstore so it will slow. You could make a hybrid solution using Memcache + Datastore or play around with the Files API
I'd like to create an application that would run on Google's appengine.
However, this application needs to be able to generate PDFs dynamically.
How could I do this?
You can use the reportlab library to generate a PDF from Python. You can just include the ReportLab files in with your application's code, or you can include a zip archive of the ReportLab code, and insert it into your application's sys.path.
To overcome the number-of-files limit in google appengine, you could package your reportlib in a zip file and use it. Be sure you check out this issue i bumped into..
http://code.google.com/p/googleappengine/issues/detail?id=1085
Also, you can use pisa, htmllib and pyPdf to generate the pdf using html templates.
All the best.
varun
I would recommend PyFPDF, which is a pure-Python port of the lightweight yet highly powerful PHP FPDF library. It is hardly a few dozen kilobytes.
See http://code.google.com/p/pyfpdf/
Google has a new "Conversion API" that may solve all your problems. Here's a description from the site:
The App Engine Conversion API converts documents between common filetypes using Google's infrastructure for efficiency and scale. The API enables conversions between HTML, PDF, text, and image formats, synchronously or asynchronously, with an option to perform optical character recognition (OCR).