The Artima Developer Community
Sponsored Link

Java Buzz Forum
Migrating to Pebble

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Simon Brown

Posts: 636
Nickname: simonbrown
Registered: Jun, 2003

Simon Brown is a Java developer, architect and author.
Migrating to Pebble Posted: Feb 7, 2005 3:21 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Simon Brown.
Original Post: Migrating to Pebble
Feed Title: Simon Brown's weblog
Feed URL: http://www.simongbrown.com/blog/feed.xml?flavor=rss20&category=java
Feed Description: My thoughts on Java, software development and technology.
Latest Java Buzz Posts
Latest Java Buzz Posts by Simon Brown
Latest Posts From Simon Brown's weblog

Advertisement

There's been an influx of e-mails recently asking me how to migrate content from other blogging systems to Pebble, so I thought that I'd outline the approach that I used when migrating from Radio Userland.

By default, Pebble stores all blog content as XML files on disk in a directory structure that follows a year/month/day hierarchy. When migrating content to Pebble, rather than manually create directories and XML files, the best approach is to write some Java code that directly uses the Pebble classes because you then get all of this for free. If you can write a short Java program to extract the existing entries, you can use something like the following to import them into Pebble.

DAOFactory.setConfiguredFactory(new FileDAOFactory());
SimpleBlog blog = new SimpleBlog("~/pebble-blog/");
blog.setProperty(Blog.TIMEZONE_KEY, "Europe/London");
blog.setProperty(Blog.CHARACTER_ENCODING_KEY, "UTF-8");

foreach (existing blog entry) {
    // get the title, body, date, etc from the old entry
    String title, body;
    Date date;

    // create a new Pebble entry, add and store
    DailyBlog day = blog.getBlogForDay(date);
    BlogEntry entry = day.createBlogEntry(title, body, date);
    entry.set...(); // set any other properties
    day.addEntry(entry);
    entry.store();
}

Doing something like this will create the relevant files for you, while setting the Blog.TIMEZONE_KEY property on the SimpleBlog instance will ensure that your existing blog entries are stored underneath the correct year/month/day structure for your time zone. Using this technique, migrating to Pebble should be easy and if you ever want to migrate from Pebble, you'll find a link to export all content as RSS/RSS with comments/RDF/Atom after you've logged in.

Read: Migrating to Pebble

Topic: New job new buzzwords Previous Topic   Next Topic Topic: Cognitive bandwidth is like dial-up

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use