Added Blogger API key.
Added missing files.
This commit is contained in:
parent
38544a1b56
commit
fa8a7eae02
9 changed files with 590 additions and 42 deletions
|
@ -71,7 +71,7 @@
|
||||||
<option name="PUT_FOCUS_INTO_COMMENT" value="true" />
|
<option name="PUT_FOCUS_INTO_COMMENT" value="true" />
|
||||||
<option name="SHOW_CHECKIN_OPTIONS" value="true" />
|
<option name="SHOW_CHECKIN_OPTIONS" value="true" />
|
||||||
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
|
<option name="FORCE_NON_EMPTY_COMMENT" value="false" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Added image preview. Base64 encoding is now done thru a temporary file." />
|
<option name="LAST_COMMIT_MESSAGE" value="Added ability to post to post via the Blogger API." />
|
||||||
<option name="SAVE_LAST_COMMIT_MESSAGE" value="true" />
|
<option name="SAVE_LAST_COMMIT_MESSAGE" value="true" />
|
||||||
<option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8" />
|
<option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8" />
|
||||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
|
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||||
|
@ -112,7 +112,7 @@
|
||||||
<option name="HIDE_WARNINGS" value="false" />
|
<option name="HIDE_WARNINGS" value="false" />
|
||||||
</component>
|
</component>
|
||||||
<component name="FileEditorManager" split-orientation="vertical" split-proportion="0.5">
|
<component name="FileEditorManager" split-orientation="vertical" split-proportion="0.5">
|
||||||
<first-group selected-file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlog.java">
|
<first-group selected-file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifePost.java">
|
||||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/post.xml" pinned="false">
|
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/post.xml" pinned="false">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="7" column="75" selection-start="534" selection-end="534" vertical-scroll-proportion="0.21834862">
|
<state line="7" column="75" selection-start="534" selection-end="534" vertical-scroll-proportion="0.21834862">
|
||||||
|
@ -131,7 +131,7 @@
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeAction.java" pinned="false">
|
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeAction.java" pinned="false">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="50" column="11" selection-start="759" selection-end="759" vertical-scroll-proportion="1.0623853">
|
<state line="50" column="11" selection-start="759" selection-end="759" vertical-scroll-proportion="1.0220183">
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -140,7 +140,7 @@
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeMediaObject.java" pinned="false">
|
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeMediaObject.java" pinned="false">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="45" column="115" selection-start="1916" selection-end="1916" vertical-scroll-proportion="0.24770643">
|
<state line="45" column="115" selection-start="1916" selection-end="1916" vertical-scroll-proportion="0.26972476">
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -149,14 +149,14 @@
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifePost.java" pinned="false">
|
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifePost.java" pinned="false">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="46" column="106" selection-start="1950" selection-end="1950" vertical-scroll-proportion="0.097247705">
|
<state line="99" column="229" selection-start="3364" selection-end="3364" vertical-scroll-proportion="0.5302752">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeRPCResponse.java" pinned="false">
|
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeRPCResponse.java" pinned="false">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="60" column="11" selection-start="2171" selection-end="2171" vertical-scroll-proportion="0.1412844">
|
<state line="60" column="11" selection-start="2171" selection-end="2171" vertical-scroll-proportion="0.14862385">
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -165,7 +165,7 @@
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeFTP.java" pinned="false">
|
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeFTP.java" pinned="false">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="132" column="71" selection-start="3917" selection-end="3917" vertical-scroll-proportion="0.76330274">
|
<state line="132" column="71" selection-start="3917" selection-end="3917" vertical-scroll-proportion="0.7963303">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
|
@ -179,7 +179,7 @@
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlogger.java" pinned="false">
|
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlogger.java" pinned="false">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="320" column="5" selection-start="7758" selection-end="7758" vertical-scroll-proportion="1.0201834">
|
<state line="320" column="5" selection-start="7758" selection-end="7758" vertical-scroll-proportion="0.9798165">
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -188,7 +188,7 @@
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/ReleaseInfo.java" pinned="false">
|
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/ReleaseInfo.java" pinned="false">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="15" column="23" selection-start="413" selection-end="413" vertical-scroll-proportion="0.14495413">
|
<state line="15" column="23" selection-start="413" selection-end="413" vertical-scroll-proportion="0.1559633">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
|
@ -209,9 +209,9 @@
|
||||||
<component name="J2EEProjectPane" />
|
<component name="J2EEProjectPane" />
|
||||||
<component name="NamedScopeManager" />
|
<component name="NamedScopeManager" />
|
||||||
<component name="PackagesPane">
|
<component name="PackagesPane">
|
||||||
<expanded_node url="net.thauvin" module="LifeBlogger" type="package" />
|
|
||||||
<expanded_node url="net.thauvin.lifeblogger" module="LifeBlogger" type="package" />
|
|
||||||
<expanded_node url="net" module="LifeBlogger" type="package" />
|
<expanded_node url="net" module="LifeBlogger" type="package" />
|
||||||
|
<expanded_node url="net.thauvin.lifeblogger" module="LifeBlogger" type="package" />
|
||||||
|
<expanded_node url="net.thauvin" module="LifeBlogger" type="package" />
|
||||||
<expanded_node url="" module="LifeBlogger" type="module" />
|
<expanded_node url="" module="LifeBlogger" type="module" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectPane">
|
<component name="ProjectPane">
|
||||||
|
@ -243,20 +243,6 @@
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager">
|
<component name="RunManager">
|
||||||
<activeType name="Application" />
|
<activeType name="Application" />
|
||||||
<configuration selected="false" default="true" type="WebLogic Instance" factoryName="Local">
|
|
||||||
<option name="WORKING_DIRECTORY" />
|
|
||||||
<option name="HOST" value="localhost" />
|
|
||||||
<option name="PORT" value="7001" />
|
|
||||||
<option name="LOCAL" value="true" />
|
|
||||||
<option name="OPEN_IN_BROWSER" value="true" />
|
|
||||||
<option name="OPEN_IN_BROWSER_URL" value="/" />
|
|
||||||
<option name="COMMON_VM_ARGUMENTS" value="" />
|
|
||||||
<option name="DOMAIN_PATH" value="" />
|
|
||||||
<option name="USER" value="weblogic" />
|
|
||||||
<option name="PASSWORD" value="weblogic" />
|
|
||||||
<option name="SERVER_NAME" value="myserver" />
|
|
||||||
<option name="DOMAIN_NAME" value="mydomain" />
|
|
||||||
</configuration>
|
|
||||||
<configuration selected="false" default="true" type="JUnit" factoryName="JUnit">
|
<configuration selected="false" default="true" type="JUnit" factoryName="JUnit">
|
||||||
<module name="" />
|
<module name="" />
|
||||||
<option name="PACKAGE_NAME" />
|
<option name="PACKAGE_NAME" />
|
||||||
|
@ -285,6 +271,20 @@
|
||||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||||
<module name="" />
|
<module name="" />
|
||||||
</configuration>
|
</configuration>
|
||||||
|
<configuration selected="false" default="true" type="WebLogic Instance" factoryName="Local">
|
||||||
|
<option name="WORKING_DIRECTORY" />
|
||||||
|
<option name="HOST" value="localhost" />
|
||||||
|
<option name="PORT" value="7001" />
|
||||||
|
<option name="LOCAL" value="true" />
|
||||||
|
<option name="OPEN_IN_BROWSER" value="true" />
|
||||||
|
<option name="OPEN_IN_BROWSER_URL" value="/" />
|
||||||
|
<option name="COMMON_VM_ARGUMENTS" value="" />
|
||||||
|
<option name="DOMAIN_PATH" value="" />
|
||||||
|
<option name="USER" value="weblogic" />
|
||||||
|
<option name="PASSWORD" value="weblogic" />
|
||||||
|
<option name="SERVER_NAME" value="myserver" />
|
||||||
|
<option name="DOMAIN_NAME" value="mydomain" />
|
||||||
|
</configuration>
|
||||||
<configuration selected="false" default="true" type="Applet" factoryName="Applet">
|
<configuration selected="false" default="true" type="Applet" factoryName="Applet">
|
||||||
<module name="" />
|
<module name="" />
|
||||||
<option name="MAIN_CLASS_NAME" />
|
<option name="MAIN_CLASS_NAME" />
|
||||||
|
@ -364,7 +364,7 @@
|
||||||
<window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="8" />
|
<window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="8" />
|
||||||
<window_info id="Regex" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="9" />
|
<window_info id="Regex" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="9" />
|
||||||
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="7" />
|
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="7" />
|
||||||
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.21632653" order="0" />
|
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.22959183" order="0" />
|
||||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="1" />
|
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="1" />
|
||||||
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" />
|
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" />
|
||||||
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="10" />
|
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33024693" order="10" />
|
||||||
|
@ -521,18 +521,9 @@
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlog.java">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state line="52" column="22" selection-start="2083" selection-end="2083" vertical-scroll-proportion="0.5302752">
|
|
||||||
<folding>
|
|
||||||
<element signature="imports" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeAction.java">
|
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeAction.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="50" column="11" selection-start="759" selection-end="759" vertical-scroll-proportion="1.0623853">
|
<state line="50" column="11" selection-start="759" selection-end="759" vertical-scroll-proportion="1.0220183">
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -541,7 +532,7 @@
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeMediaObject.java">
|
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeMediaObject.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="45" column="115" selection-start="1916" selection-end="1916" vertical-scroll-proportion="0.24770643">
|
<state line="45" column="115" selection-start="1916" selection-end="1916" vertical-scroll-proportion="0.26972476">
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -550,14 +541,14 @@
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifePost.java">
|
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifePost.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="46" column="106" selection-start="1950" selection-end="1950" vertical-scroll-proportion="0.097247705">
|
<state line="99" column="229" selection-start="3364" selection-end="3364" vertical-scroll-proportion="0.5302752">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeRPCResponse.java">
|
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeRPCResponse.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="60" column="11" selection-start="2171" selection-end="2171" vertical-scroll-proportion="0.1412844">
|
<state line="60" column="11" selection-start="2171" selection-end="2171" vertical-scroll-proportion="0.14862385">
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -566,7 +557,7 @@
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeFTP.java">
|
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeFTP.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="132" column="71" selection-start="3917" selection-end="3917" vertical-scroll-proportion="0.76330274">
|
<state line="132" column="71" selection-start="3917" selection-end="3917" vertical-scroll-proportion="0.7963303">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
|
@ -580,7 +571,7 @@
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlogger.java">
|
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlogger.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="320" column="5" selection-start="7758" selection-end="7758" vertical-scroll-proportion="1.0201834">
|
<state line="320" column="5" selection-start="7758" selection-end="7758" vertical-scroll-proportion="0.9798165">
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="imports" expanded="true" />
|
<element signature="imports" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
@ -589,11 +580,20 @@
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/ReleaseInfo.java">
|
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/ReleaseInfo.java">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state line="15" column="23" selection-start="413" selection-end="413" vertical-scroll-proportion="0.14495413">
|
<state line="15" column="23" selection-start="413" selection-end="413" vertical-scroll-proportion="0.1559633">
|
||||||
<folding />
|
<folding />
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/src/net/thauvin/lifeblogger/LifeBlog.java">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state line="52" column="22" selection-start="2083" selection-end="2083" vertical-scroll-proportion="0.5302752">
|
||||||
|
<folding>
|
||||||
|
<element signature="imports" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|
143
src/net/thauvin/lifeblogger/LifeAction.java
Normal file
143
src/net/thauvin/lifeblogger/LifeAction.java
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
/*
|
||||||
|
* @(#)LifeAction.java
|
||||||
|
*
|
||||||
|
* Copyright (C) 2004 by Erik C. Thauvin (erik@thauvin.net)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package net.thauvin.lifeblogger;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The <code>LifeAction</code> class provides the base functionality for all actions.
|
||||||
|
*
|
||||||
|
* @author Erik C. Thauvin
|
||||||
|
* @version $Revision$, $Date$
|
||||||
|
*
|
||||||
|
* @created Jul 24, 2004
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public abstract class LifeAction extends Thread
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The Thinlet instance.
|
||||||
|
*/
|
||||||
|
private final LifeBlogger _thinlet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Transfer dialog.
|
||||||
|
*/
|
||||||
|
private final Object _dialog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The host name.
|
||||||
|
*/
|
||||||
|
private final String _host;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The login name.
|
||||||
|
*/
|
||||||
|
private final String _login;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The password.
|
||||||
|
*/
|
||||||
|
private final String _password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new LifeAction object.
|
||||||
|
*
|
||||||
|
* @param thinlet The Thinlet instance.
|
||||||
|
* @param host The host.
|
||||||
|
* @param login The login name.
|
||||||
|
* @param password The password.
|
||||||
|
*
|
||||||
|
* @throws IOException If an error occurs while creating the object.
|
||||||
|
*/
|
||||||
|
protected LifeAction(LifeBlogger thinlet, String host, String login, String password)
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
|
_thinlet = thinlet;
|
||||||
|
_host = host;
|
||||||
|
_login = login;
|
||||||
|
_password = password;
|
||||||
|
_dialog = _thinlet.parse("transfer.xml");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs the action.
|
||||||
|
*
|
||||||
|
* @see Thread#run()
|
||||||
|
*/
|
||||||
|
public abstract void run();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Transfer dialog.
|
||||||
|
*
|
||||||
|
* @return The dialog.
|
||||||
|
*/
|
||||||
|
protected final Object getDialog()
|
||||||
|
{
|
||||||
|
return _dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the host name.
|
||||||
|
*
|
||||||
|
* @return The host.
|
||||||
|
*/
|
||||||
|
protected final String getHost()
|
||||||
|
{
|
||||||
|
return _host;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the login name.
|
||||||
|
*
|
||||||
|
* @return The login.
|
||||||
|
*/
|
||||||
|
protected final String getLogin()
|
||||||
|
{
|
||||||
|
return _login;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the password.
|
||||||
|
*
|
||||||
|
* @return The password.
|
||||||
|
*/
|
||||||
|
protected final String getPassword()
|
||||||
|
{
|
||||||
|
return _password;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Thinlet instance.
|
||||||
|
*
|
||||||
|
* @return The Thinlet.
|
||||||
|
*/
|
||||||
|
protected final LifeBlogger getThinlet()
|
||||||
|
{
|
||||||
|
return _thinlet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays an alert message.
|
||||||
|
*
|
||||||
|
* @param message The message to display.
|
||||||
|
*/
|
||||||
|
protected final void alert(String message)
|
||||||
|
{
|
||||||
|
Toolkit.getDefaultToolkit().beep();
|
||||||
|
|
||||||
|
getThinlet().setIcon(getThinlet().find(getDialog(), "iconlbl"), "icon", getThinlet().getIcon("/icon/error.gif"));
|
||||||
|
getThinlet().setString(getThinlet().find(getDialog(), "message"), "text", message);
|
||||||
|
getThinlet().setBoolean(getThinlet().find(getDialog(), "closebtn"), "enabled", true);
|
||||||
|
}
|
||||||
|
}
|
221
src/net/thauvin/lifeblogger/LifePost.java
Normal file
221
src/net/thauvin/lifeblogger/LifePost.java
Normal file
|
@ -0,0 +1,221 @@
|
||||||
|
/*
|
||||||
|
* @(#)LifeMediaObject.java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2004, Erik C. Thauvin (http://www.thauvin.net/erik/)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
*
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* Neither the name of the authors nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software without
|
||||||
|
* specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||||
|
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package net.thauvin.lifeblogger;
|
||||||
|
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The <code>LifePostObject</code> class posts a new blog entry using the blogger.newPost() XML-RPC method.
|
||||||
|
*
|
||||||
|
* @author Erik C. Thauvin
|
||||||
|
* @version $Revision$, $Date$
|
||||||
|
*
|
||||||
|
* @created Jul 21, 2004
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public class LifePost extends LifeAction
|
||||||
|
{
|
||||||
|
private final String _blogEntry;
|
||||||
|
private final String _blogID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new LifePost object.
|
||||||
|
*
|
||||||
|
* @param thinlet The Thinlet instance.
|
||||||
|
* @param url The MetaWeblog XML-RPC URL.
|
||||||
|
* @param blogID The blog ID.
|
||||||
|
* @param login The MetaWeblog login username.
|
||||||
|
* @param password The MetaWeblog login password.
|
||||||
|
* @param blogEntry The blog entry.
|
||||||
|
*
|
||||||
|
* @throws IOException If an error occurs while creating the object.
|
||||||
|
*/
|
||||||
|
public LifePost(LifeBlogger thinlet, String url, String blogID, String login, String password, String blogEntry)
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
|
super(thinlet, url, login, password);
|
||||||
|
|
||||||
|
_blogEntry = blogEntry;
|
||||||
|
_blogID = blogID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs the action.
|
||||||
|
*
|
||||||
|
* @see Thread#run()
|
||||||
|
*/
|
||||||
|
public final void run()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
getThinlet().add(getDialog());
|
||||||
|
|
||||||
|
final URL url = new URL(getHost());
|
||||||
|
|
||||||
|
if (!"http".equalsIgnoreCase(url.getProtocol()))
|
||||||
|
{
|
||||||
|
throw new IOException("Unsupported URL protocol: " + url.getProtocol());
|
||||||
|
}
|
||||||
|
|
||||||
|
final StringBuffer request =
|
||||||
|
new StringBuffer("<?xml version=\"1.0\"?><methodCall><methodName>blogger.newPost</methodName><params><param><value><string>0a6afffffffaffffffb8ffffff8569474cffffffc778500c03ffffffecffffff876116565a27283bffffffda56</string></value></param><param><value><string>").append(_blogID)
|
||||||
|
.append("</string></value></param><param><value><string>")
|
||||||
|
.append(getLogin())
|
||||||
|
.append("</string></value></param><param><value><string>")
|
||||||
|
.append(getPassword())
|
||||||
|
.append("</string></value></param><param><value><string>")
|
||||||
|
.append(textToXML(_blogEntry))
|
||||||
|
.append("</string></value></param><param><value><boolean>false</boolean></value></param></params></methodCall>");
|
||||||
|
final URLConnection urlConn = url.openConnection();
|
||||||
|
urlConn.setDoInput(true);
|
||||||
|
urlConn.setDoOutput(true);
|
||||||
|
urlConn.setUseCaches(false);
|
||||||
|
urlConn.setRequestProperty("Content-Length", String.valueOf(request.length()));
|
||||||
|
urlConn.setRequestProperty("Content-Type", "text/xml");
|
||||||
|
|
||||||
|
final DataOutputStream dos = new DataOutputStream(urlConn.getOutputStream());
|
||||||
|
dos.write(request.toString().getBytes());
|
||||||
|
dos.flush();
|
||||||
|
dos.close();
|
||||||
|
|
||||||
|
final LifeRPCResponse xmlrpc = new LifeRPCResponse(urlConn.getInputStream());
|
||||||
|
|
||||||
|
if (xmlrpc.isValidResponse())
|
||||||
|
{
|
||||||
|
//getThinlet().closeDialog(getDialog());
|
||||||
|
getThinlet().setIcon(getThinlet().find(getDialog(), "iconlbl"), "icon",
|
||||||
|
getThinlet().getIcon("/icon/info.gif"));
|
||||||
|
getThinlet().setString(getThinlet().find(getDialog(), "message"), "text",
|
||||||
|
"Post successful. (ID " + xmlrpc.getResponse() + ')');
|
||||||
|
getThinlet().setBoolean(getThinlet().find(getDialog(), "closebtn"), "enabled", true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alert(xmlrpc.getResponse());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
getThinlet().closeDialog(getDialog());
|
||||||
|
getThinlet().showException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a character to XML entity.
|
||||||
|
*
|
||||||
|
* @param ch The character to convert.
|
||||||
|
*
|
||||||
|
* @return The converted string.
|
||||||
|
*/
|
||||||
|
private String charToXML(char ch)
|
||||||
|
{
|
||||||
|
final int c;
|
||||||
|
|
||||||
|
// Convert left bracket
|
||||||
|
if (ch == '<')
|
||||||
|
{
|
||||||
|
return ("<");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert left bracket
|
||||||
|
else if (ch == '>')
|
||||||
|
{
|
||||||
|
return (">");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert ampersand
|
||||||
|
else if (ch == '&')
|
||||||
|
{
|
||||||
|
return ("&");
|
||||||
|
}
|
||||||
|
|
||||||
|
// High-ASCII character
|
||||||
|
else if (ch >= 128)
|
||||||
|
{
|
||||||
|
c = (int) ch;
|
||||||
|
|
||||||
|
return ("&#" + c + ';');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert double quote
|
||||||
|
else if (ch == '"')
|
||||||
|
{
|
||||||
|
return (""");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert single quote
|
||||||
|
else if (ch == '\'')
|
||||||
|
{
|
||||||
|
return ("'");
|
||||||
|
}
|
||||||
|
|
||||||
|
// No conversion
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Return character as string
|
||||||
|
return (String.valueOf(ch));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a text string to XML entities.
|
||||||
|
*
|
||||||
|
* @param text The string to convert.
|
||||||
|
*
|
||||||
|
* @return The converted string.
|
||||||
|
*/
|
||||||
|
private String textToXML(String text)
|
||||||
|
{
|
||||||
|
final StringBuffer html = new StringBuffer();
|
||||||
|
|
||||||
|
// Loop thru each characters of the text
|
||||||
|
for (int i = 0; i < text.length(); i++)
|
||||||
|
{
|
||||||
|
// Convert character to HTML/XML
|
||||||
|
html.append(charToXML(text.charAt(i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return HTML/XML string
|
||||||
|
return html.toString();
|
||||||
|
}
|
||||||
|
}
|
164
src/net/thauvin/lifeblogger/LifeRPCResponse.java
Normal file
164
src/net/thauvin/lifeblogger/LifeRPCResponse.java
Normal file
|
@ -0,0 +1,164 @@
|
||||||
|
/*
|
||||||
|
* @(#)LifeRPCResponse.java
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
*
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* Neither the name of the authors nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software without
|
||||||
|
* specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||||
|
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package net.thauvin.lifeblogger;
|
||||||
|
|
||||||
|
import thinlet.Thinlet;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The <code>LifeRPCResponse</code> class uses the Thinlet DOM parser to process a XML-RCP response.
|
||||||
|
*
|
||||||
|
* @author Erik C. Thauvin
|
||||||
|
* @version $Revision$, $Date$
|
||||||
|
*
|
||||||
|
* @created Jul 21, 2004
|
||||||
|
* @since 1.0
|
||||||
|
*/
|
||||||
|
public class LifeRPCResponse extends Thinlet
|
||||||
|
{
|
||||||
|
private final InputStream _inputStream;
|
||||||
|
private String _response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new LifeRPCResponse object.
|
||||||
|
*
|
||||||
|
* @param inputStream The input stream.
|
||||||
|
*/
|
||||||
|
public LifeRPCResponse(InputStream inputStream)
|
||||||
|
{
|
||||||
|
_inputStream = inputStream;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the XML-RPC response/fault string.
|
||||||
|
*
|
||||||
|
* @return The response string.
|
||||||
|
*/
|
||||||
|
public final String getResponse()
|
||||||
|
{
|
||||||
|
return _response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses and validates the XML-RPC response.
|
||||||
|
*
|
||||||
|
* @return <code>true</code> is the response is valid, <code>false</code> if it is a fault.
|
||||||
|
*
|
||||||
|
* @throws IOException If an error occurs while processing the response.
|
||||||
|
*/
|
||||||
|
public final boolean isValidResponse()
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
final Object dom = parseDOM(_inputStream);
|
||||||
|
final Object params = getDOMNode(dom, "params", 0);
|
||||||
|
|
||||||
|
if (params != null)
|
||||||
|
{
|
||||||
|
final Object param = getDOMNode(params, "param", 0);
|
||||||
|
final Object value = getDOMNode(param, "value", 0);
|
||||||
|
final Object struct = getDOMNode(value, "struct", 0);
|
||||||
|
|
||||||
|
if (struct == null)
|
||||||
|
{
|
||||||
|
final Object string = getDOMNode(value, "string", 0);
|
||||||
|
|
||||||
|
_response = getDOMText(string);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final Object member = getDOMNode(struct, "member", 0);
|
||||||
|
final Object url = getDOMNode(member, "value", 0);
|
||||||
|
final Object string = getDOMNode(url, "string", 0);
|
||||||
|
|
||||||
|
if (string == null)
|
||||||
|
{
|
||||||
|
_response = getDOMText(url);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_response = getDOMText(string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final Object fault = getDOMNode(dom, "fault", 0);
|
||||||
|
final Object value = getDOMNode(fault, "value", 0);
|
||||||
|
final Object struct = getDOMNode(value, "struct", 0);
|
||||||
|
Object member = getDOMNode(struct, "member", 0);
|
||||||
|
|
||||||
|
if (getDOMCount(struct, "member") > 1)
|
||||||
|
{
|
||||||
|
member = getDOMNode(struct, "member", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
final Object error = getDOMNode(member, "value", 0);
|
||||||
|
final Object string = getDOMNode(error, "string", 0);
|
||||||
|
|
||||||
|
if (string != null)
|
||||||
|
{
|
||||||
|
_response = getDOMText(string);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new IOException("Could not parse the XML-RPC error response.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_inputStream.close();
|
||||||
|
}
|
||||||
|
catch (IOException ignore)
|
||||||
|
{
|
||||||
|
; // Do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
src/net/thauvin/lifeblogger/post.xml
Normal file
15
src/net/thauvin/lifeblogger/post.xml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<dialog name="dialog" icon="/icon/icon.gif" text="Post to Your Blog (Blogger API)" modal="false" columns="1" gap="4" top="4" left="4" bottom="4" right="4">
|
||||||
|
<panel name="blog" columns="2" halign="right" gap="4" weightx="1">
|
||||||
|
<label text="RPC URL:"/><textfield name="host" start="0" end="1000"/>
|
||||||
|
<label text="Blog ID:"/><textfield name="blogid"/>
|
||||||
|
<label text="Login:"/><textfield name="login"/>
|
||||||
|
<label text="Password:"/><passwordfield name="password"/>
|
||||||
|
<label valign="top" text="Post:"/>
|
||||||
|
<textarea name="entry" width="300" height="150" weightx="1" weighty="1"/>
|
||||||
|
</panel>
|
||||||
|
<panel columns="2" halign="right" gap="4">
|
||||||
|
<button name="cancelbtn" text="Cancel" icon="/icon/exit.gif" action="closeDialog(dialog)"/>
|
||||||
|
<button name="sendbtn" text="Post" icon="/icon/go.gif" action="post(dialog, blog)"/>
|
||||||
|
</panel>
|
||||||
|
</dialog>
|
5
src/net/thauvin/lifeblogger/preview.xml
Normal file
5
src/net/thauvin/lifeblogger/preview.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<dialog name="preview" icon="/icon/image.gif" text="Preview" columns="1" modal="true" top="8" left="8" bottom="8" right="8" gap="8">
|
||||||
|
<label name="image" valign="top" alignment="center"/>
|
||||||
|
<button text="Close" halign="center" action="closeDialog(preview)"/>
|
||||||
|
</dialog>
|
BIN
www/images/banner.gif
Normal file
BIN
www/images/banner.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
BIN
www/images/get_java.gif
Normal file
BIN
www/images/get_java.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
BIN
www/images/shot3.gif
Normal file
BIN
www/images/shot3.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Loading…
Add table
Add a link
Reference in a new issue