Skip to content

Commit

Permalink
2003-10-07 Pierre-Luc Paour <gallery@paour.com> (1.2-b11)
Browse files Browse the repository at this point in the history
	* Implemented patching mechanism for LAX file when the classpath
	  needs to be changed.
	* Build process can now update Menalto.com with the latest build information
	  so automated daily builds are automatically propagated. Also now pushing
	  beta builds to jpmullan.com.
	* Cosmetic changes to the Log class.
  • Loading branch information
Pierre-Luc Paour committed Oct 8, 2003
1 parent 4afab35 commit d180d72
Show file tree
Hide file tree
Showing 36 changed files with 539 additions and 632 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
@@ -1,3 +1,12 @@
2003-10-09 Pierre-Luc Paour <gallery@paour.com> (1.2-b11)

* Implemented patching mechanism for LAX file when the classpath
needs to be changed.
* Build process can now update Menalto.com with the latest build information
so automated daily builds are automatically propagated. Also now pushing
beta builds to jpmullan.com.
* Cosmetic changes to the Log class.

2003-10-06 Amedeo Paglione <apaglione@mac.com> (1.2-b10)

* Adoption of more generic locale
Expand Down
8 changes: 8 additions & 0 deletions build.xml
Expand Up @@ -161,5 +161,13 @@
<move file="${install}/GenericUnix/InstallGalleryRemote.bin" tofile="${install}/staging/GalleryRemote.${version}.Unix.NoVM.bin" />
<move file="${install}/Java/InstallGalleryRemote.jar" tofile="${install}/staging/GalleryRemote.${version}.jar" />
</target>

<target name="post" description="Posts ChangeLog to menalto.com">
<taskdef name="postchangelog"
classpath="GalleryRemote.jar"
classname="com.gallery.GalleryRemote.util.PostChangeLog" />

<postchangelog />
</target>
</project>

2 changes: 1 addition & 1 deletion com/gallery/GalleryRemote/AboutBox.java
Expand Up @@ -127,7 +127,7 @@ public AboutPanel() {
fm = getFontMetrics( getFont() );

URL imu = getClass().getResource( "/rar_about_gr1.png" );
Log.log(Log.TRACE, MODULE, "Looking for splash screen in " + imu.toString());
Log.log(Log.LEVEL_TRACE, MODULE, "Looking for splash screen in " + imu.toString());
image = new ImageIcon( imu );

setBorder( new MatteBorder( 1, 1, 1, 1, Color.gray ) );
Expand Down
28 changes: 14 additions & 14 deletions com/gallery/GalleryRemote/DroppableList.java
Expand Up @@ -114,7 +114,7 @@ public void paint( Graphics g ) {

/* ********* TargetListener ********** */
public void dragEnter( DropTargetDragEvent dropTargetDragEvent ) {
Log.log( Log.TRACE, MODULE, "dragEnter - dtde" );
Log.log( Log.LEVEL_TRACE, MODULE, "dragEnter - dtde" );
if ( isEnabled() ) {
dropTargetDragEvent.acceptDrag( DnDConstants.ACTION_COPY_OR_MOVE );
} else {
Expand All @@ -123,11 +123,11 @@ public void dragEnter( DropTargetDragEvent dropTargetDragEvent ) {
}

public void dragExit( DropTargetEvent dropTargetEvent ) {
Log.log( Log.TRACE, MODULE, "dragExit - dtde" );
Log.log( Log.LEVEL_TRACE, MODULE, "dragExit - dtde" );

if ( ps != null ) {
//add pictures back
Log.log( Log.INFO, MODULE, "dragging internal selection out..." );
Log.log( Log.LEVEL_INFO, MODULE, "dragging internal selection out..." );
try {
java.util.List fileList = (java.util.List) ps.getTransferData( DataFlavor.javaFileListFlavor );
if ( !ps.isEmpty() ) {
Expand All @@ -136,7 +136,7 @@ public void dragExit( DropTargetEvent dropTargetEvent ) {
//kill dragEvent
//need to figure out why MainFrame becomes dropTarget for internal drops??!!
} catch ( Exception e ) {
Log.log( Log.INFO, MODULE, "coudn't kill drag " + e );
Log.log( Log.LEVEL_INFO, MODULE, "coudn't kill drag " + e );
}
}
ps = null;
Expand Down Expand Up @@ -170,7 +170,7 @@ public void dragOver( int y ) {
}

public synchronized void drop( DropTargetDropEvent dropTargetDropEvent ) {
Log.log( Log.TRACE, MODULE, "drop - dtde" );
Log.log( Log.LEVEL_TRACE, MODULE, "drop - dtde" );

if ( !isEnabled() ) {
// for some reason this crappy system doesn't take rejectDrag for an answer
Expand All @@ -189,8 +189,8 @@ public synchronized void drop( DropTargetDropEvent dropTargetDropEvent ) {
try {
fileList = expandDirectories( fileList );
} catch ( IOException ioe ) {
Log.log( Log.ERROR, MODULE, "i/o exception listing dirs in a drop" );
Log.logStack( Log.ERROR, MODULE );
Log.log( Log.LEVEL_ERROR, MODULE, "i/o exception listing dirs in a drop" );
Log.logStack( Log.LEVEL_ERROR, MODULE );
JOptionPane.showMessageDialog(
null,
grRes.getString(MODULE, "imgError"),
Expand All @@ -202,13 +202,13 @@ public synchronized void drop( DropTargetDropEvent dropTargetDropEvent ) {
Point dropLocation = dropTargetDropEvent.getLocation();
int listIndex = snapIndex( (int) dropLocation.getY() );

Log.log( Log.TRACE, MODULE, "Adding new image(s) to list at index " + listIndex );
Log.log( Log.LEVEL_TRACE, MODULE, "Adding new image(s) to list at index " + listIndex );

mf.addPictures( (File[]) fileList.toArray( new File[0] ), listIndex );

dropTargetDropEvent.getDropTargetContext().dropComplete( true );
} else {
Log.log( Log.TRACE, MODULE, "rejecting drop: javaFileListFlavor is not supported for this data" );
Log.log( Log.LEVEL_TRACE, MODULE, "rejecting drop: javaFileListFlavor is not supported for this data" );
dropTargetDropEvent.rejectDrop();
}
} catch ( IOException io ) {
Expand All @@ -221,13 +221,13 @@ public synchronized void drop( DropTargetDropEvent dropTargetDropEvent ) {
}

public void dropActionChanged( DropTargetDragEvent dropTargetDragEvent ) {
Log.log( Log.TRACE, MODULE, "dropActionChanged - dtde" );
Log.log( Log.LEVEL_TRACE, MODULE, "dropActionChanged - dtde" );
}


/* ********* DragSourceListener ********** */
public void dragDropEnd( DragSourceDropEvent dragSourceDropEvent ) {
Log.log( Log.TRACE, MODULE, "dragDropEnd - dsde" );
Log.log( Log.LEVEL_TRACE, MODULE, "dragDropEnd - dsde" );
}

public void dragEnter( DragSourceDragEvent dragSourceDragEvent ) {
Expand Down Expand Up @@ -256,7 +256,7 @@ public void dropActionChanged( DragSourceDragEvent dragSourceDragEvent ) { }

/* ********* DragGestureListener ********** */
public void dragGestureRecognized( DragGestureEvent event ) {
Log.log( Log.TRACE, MODULE, "dragGestureRecognized" );
Log.log( Log.LEVEL_TRACE, MODULE, "dragGestureRecognized" );
int[] selIndices = this.getSelectedIndices();
ps = new PictureSelection();
for ( int i = 0; i < selIndices.length; i++ ) {
Expand All @@ -272,7 +272,7 @@ public void dragGestureRecognized( DragGestureEvent event ) {
dragSource.startDrag( event, DragSource.DefaultMoveDrop, ps, this );
mf.deleteSelectedPictures();
} else {
Log.log( Log.TRACE, MODULE, "nothing was selected" );
Log.log( Log.LEVEL_TRACE, MODULE, "nothing was selected" );
}

}
Expand Down Expand Up @@ -311,7 +311,7 @@ static List listFilesRecursive( File dir )
throw new IOException( "i/o exception listing directory: " + dir.getPath() );
} else {
/* this method should only be called on a directory */
Log.log( Log.CRITICAL, MODULE, "assertion failed: listFilesRecursive called on a non-dir file" );
Log.log( Log.LEVEL_CRITICAL, MODULE, "assertion failed: listFilesRecursive called on a non-dir file" );
return ret;
}
}
Expand Down
34 changes: 19 additions & 15 deletions com/gallery/GalleryRemote/GalleryComm.java
Expand Up @@ -63,23 +63,27 @@ public abstract class GalleryComm implements PreferenceNames {
static {
/* Enable customized AuthorizePopup */
AuthorizePopup.enable();

/* Configures HTTPClient to accept all cookies
* this should be done at least once per GalleryRemote
* invokation */
CookieModule.setCookiePolicyHandler(new CookiePolicyHandler() {
public boolean acceptCookie(Cookie cookie, RoRequest req, RoResponse resp) {
Log.log(Log.TRACE, MODULE, "Accepting cookie: " + cookie);
Log.log(Log.LEVEL_TRACE, MODULE, "Accepting cookie: " + cookie);
return true;
}
public boolean sendCookie(Cookie cookie, RoRequest req) {
Log.log(Log.TRACE, MODULE, "Sending cookie: " + cookie);
Log.log(Log.LEVEL_TRACE, MODULE, "Sending cookie: " + cookie);
return true;
}
});
}



public static void initHTTPClient() {
// no need to do anything: the static initializer does it...
}


/**
* Causes the GalleryComm instance to upload the pictures in the
* associated Gallery to the server.
Expand Down Expand Up @@ -153,7 +157,7 @@ public static GalleryComm getCommInstance(StatusUpdate su, URL url, Gallery g) {
try { port = p.getIntProperty(PROXY_PORT); } catch (NumberFormatException e) {}
String username = p.getProperty(PROXY_USERNAME);

Log.log(Log.TRACE, MODULE, "Setting proxy to " + hostname + ":" + port);
Log.log(Log.LEVEL_TRACE, MODULE, "Setting proxy to " + hostname + ":" + port);

HTTPConnection.setProxyServer(hostname, port);

Expand All @@ -172,28 +176,28 @@ public static GalleryComm getCommInstance(StatusUpdate su, URL url, Gallery g) {
// assemble the URL
String urlPath = url.getFile();

Log.log(Log.TRACE, MODULE, "Trying protocol 2 for " + url);
Log.log(Log.LEVEL_TRACE, MODULE, "Trying protocol 2 for " + url);
// Test GalleryComm2
String urlPath2 = urlPath + ( (urlPath.endsWith( "/" )) ? GalleryComm2.SCRIPT_NAME : "/" + GalleryComm2.SCRIPT_NAME );
if (tryComm(su, mConnection, urlPath2)) {
Log.log(Log.TRACE, MODULE, "Server has protocol 2");
Log.log(Log.LEVEL_TRACE, MODULE, "Server has protocol 2");
return new GalleryComm2(g);
}

Log.log(Log.TRACE, MODULE, "Trying protocol 1 for " + url);
Log.log(Log.LEVEL_TRACE, MODULE, "Trying protocol 1 for " + url);
// Test GalleryComm1
// BUT: only if first try was not status code 401 = authorization failure
String urlPath1 = urlPath + ( (urlPath.endsWith( "/" )) ? GalleryComm1.SCRIPT_NAME : "/" + GalleryComm1.SCRIPT_NAME );
if (lastRespCode != 401 && tryComm(su, mConnection, urlPath1)) {
Log.log(Log.TRACE, MODULE, "Server has protocol 1");
Log.log(Log.LEVEL_TRACE, MODULE, "Server has protocol 1");
return new GalleryComm1(g);
}
} else {
// if Gallery is embedded, only support protocol 2
return new GalleryComm2(g);
}
} catch (HTTPClient.ProtocolNotSuppException e) {
Log.logException(Log.ERROR, MODULE, e);
Log.logException(Log.LEVEL_ERROR, MODULE, e);
}

return null;
Expand Down Expand Up @@ -222,17 +226,17 @@ private static boolean tryComm(StatusUpdate su, HTTPConnection mConnection, Stri
// loading this class at all. Instead, cast it inside another try-catch...
try {
if (ioe instanceof javax.net.ssl.SSLPeerUnverifiedException) {
Log.logException(Log.ERROR, MODULE, ioe);
Log.logException(Log.LEVEL_ERROR, MODULE, ioe);

JOptionPane.showMessageDialog((Component) su, grRes.getString(MODULE, "noAuth"), grRes.getString(MODULE, "error"), JOptionPane.ERROR_MESSAGE);
} else {
Log.logException(Log.ERROR, MODULE, ioe);
Log.logException(Log.LEVEL_ERROR, MODULE, ioe);
}
} catch (NoClassDefFoundError ncdfe) {
Log.logException(Log.ERROR, MODULE, ioe);
Log.logException(Log.LEVEL_ERROR, MODULE, ioe);
}
} catch (ModuleException me) {
Log.logException(Log.ERROR, MODULE, me);
Log.logException(Log.LEVEL_ERROR, MODULE, me);
}

return false;
Expand Down
38 changes: 19 additions & 19 deletions com/gallery/GalleryRemote/GalleryComm1.java
Expand Up @@ -101,7 +101,7 @@ public void run() {

isLoggedIn = true;
} else {
Log.log(Log.TRACE, MODULE, "Still logged in to " + g.toString());
Log.log(Log.LEVEL_TRACE, MODULE, "Still logged in to " + g.toString());
}

runTask();
Expand All @@ -122,15 +122,15 @@ private boolean login() {
try {
URL url = g.getGalleryUrl(SCRIPT_NAME);
String urlPath = url.getFile();
Log.log(Log.TRACE, MODULE, "Url: " + url);
Log.log(Log.LEVEL_TRACE, MODULE, "Url: " + url);

NVPair form_data[] = {
new NVPair("cmd", "login"),
new NVPair("protocal_version", PROTOCAL_VERSION),
new NVPair("uname", g.getUsername()),
new NVPair("password", g.getPassword())
};
Log.log(Log.TRACE, MODULE, "login parameters: " + Arrays.asList(form_data));
Log.log(Log.LEVEL_TRACE, MODULE, "login parameters: " + Arrays.asList(form_data));

HTTPConnection mConnection = new HTTPConnection(url);
HTTPResponse rsp = mConnection.Post(urlPath, form_data);
Expand All @@ -148,7 +148,7 @@ private boolean login() {
return false;
} else {
String response = new String(rsp.getData()).trim();
Log.log(Log.TRACE, MODULE, response);
Log.log(Log.LEVEL_TRACE, MODULE, response);

if (response.indexOf("SUCCESS") >= 0) {
status(StatusUpdate.LEVEL_GENERIC, grRes.getString(MODULE, "loggedIn"));
Expand All @@ -160,11 +160,11 @@ private boolean login() {
}
}
} catch (IOException ioe) {
Log.logException(Log.ERROR, MODULE, ioe);
Log.logException(Log.LEVEL_ERROR, MODULE, ioe);
Object [] params3 = {ioe.toString() };
status(StatusUpdate.LEVEL_GENERIC, grRes.getString(MODULE, "error", params3));
} catch (ModuleException me) {
Log.logException(Log.ERROR, MODULE, me);
Log.logException(Log.LEVEL_ERROR, MODULE, me);
Object [] params3 = {me.getMessage() };
status(StatusUpdate.LEVEL_GENERIC, grRes.getString(MODULE, "errReq", params3));
}
Expand All @@ -173,7 +173,7 @@ private boolean login() {
}

void status(int level, String message) {
Log.log(Log.INFO, MODULE, message);
Log.log(Log.LEVEL_INFO, MODULE, message);
su.updateProgressStatus(level, message);
}

Expand All @@ -183,7 +183,7 @@ void error(String message) {
}

void trace(String message) {
Log.log(Log.TRACE, MODULE, message);
Log.log(Log.LEVEL_TRACE, MODULE, message);
}
}

Expand Down Expand Up @@ -225,14 +225,14 @@ boolean uploadPicture(Picture p) {
try {
URL url = g.getGalleryUrl(SCRIPT_NAME);
String urlPath = url.getFile();
Log.log(Log.TRACE, MODULE, "Url: " + url);
Log.log(Log.LEVEL_TRACE, MODULE, "Url: " + url);

NVPair[] opts = {
new NVPair("set_albumName", p.getAlbum().getName()),
new NVPair("cmd", "add-item"),
new NVPair("protocal_version", PROTOCAL_VERSION)
};
Log.log(Log.TRACE, MODULE, "add-item parameters: " + Arrays.asList(opts));
Log.log(Log.LEVEL_TRACE, MODULE, "add-item parameters: " + Arrays.asList(opts));

NVPair[] afile = { new NVPair("userfile", p.getUploadSource().getAbsolutePath()) };
NVPair[] hdrs = new NVPair[1];
Expand All @@ -253,7 +253,7 @@ boolean uploadPicture(Picture p) {
return false;
} else {
String response = new String(rsp.getData()).trim();
Log.log(Log.TRACE, MODULE, response);
Log.log(Log.LEVEL_TRACE, MODULE, response);

if (response.indexOf("SUCCESS") >= 0) {
trace(grRes.getString(MODULE, "upldSucc"));
Expand All @@ -265,11 +265,11 @@ boolean uploadPicture(Picture p) {
}
}
} catch (IOException ioe) {
Log.logException(Log.ERROR, MODULE, ioe);
Log.logException(Log.LEVEL_ERROR, MODULE, ioe);
Object [] params3 = {ioe.toString() };
error(grRes.getString(MODULE, "error", params3));
} catch (ModuleException me) {
Log.logException(Log.ERROR, MODULE, me);
Log.logException(Log.LEVEL_ERROR, MODULE, me);
Object [] params3 = {me.getMessage() };
error(grRes.getString(MODULE, "errReq", params3));
}
Expand All @@ -290,15 +290,15 @@ void runTask() {
try {
URL url =g.getGalleryUrl(SCRIPT_NAME);
String urlPath = url.getFile();
Log.log(Log.TRACE, MODULE, "Url: " + url);
Log.log(Log.LEVEL_TRACE, MODULE, "Url: " + url);

NVPair form_data[] = {
new NVPair("cmd", "fetch-albums"),
new NVPair("protocal_version", PROTOCAL_VERSION),
new NVPair("uname", g.getUsername()),
new NVPair("password", g.getPassword())
};
Log.log(Log.TRACE, MODULE, "fetchAlbums parameters: " + Arrays.asList(form_data));
Log.log(Log.LEVEL_TRACE, MODULE, "fetchAlbums parameters: " + Arrays.asList(form_data));

mConnection = new HTTPConnection(url);
HTTPResponse rsp = mConnection.Post(urlPath, form_data);
Expand All @@ -316,7 +316,7 @@ void runTask() {
return;
} else {
String response = new String(rsp.getData()).trim();
Log.log(Log.TRACE, MODULE, response);
Log.log(Log.LEVEL_TRACE, MODULE, response);

if (response.indexOf("SUCCESS") >= 0) {
ArrayList mAlbumList = new ArrayList();
Expand Down Expand Up @@ -347,15 +347,15 @@ void runTask() {
}
}
} catch (IOException ioe) {
Log.logException(Log.ERROR, MODULE, ioe);
Log.logException(Log.LEVEL_ERROR, MODULE, ioe);
Object [] params2 = {ioe.toString()};
status(StatusUpdate.LEVEL_BACKGROUND, grRes.getString(MODULE, "error", params2));
} catch (ModuleException me) {
Log.logException(Log.ERROR, MODULE, me);
Log.logException(Log.LEVEL_ERROR, MODULE, me);
Object [] params2 = {me.toString()};
status(StatusUpdate.LEVEL_BACKGROUND, grRes.getString(MODULE, "error", params2));
} catch (Exception ee) {
Log.logException(Log.ERROR, MODULE, ee);
Log.logException(Log.LEVEL_ERROR, MODULE, ee);
Object [] params2 = {ee.toString()};
status(StatusUpdate.LEVEL_BACKGROUND, grRes.getString(MODULE, "error", params2));
}
Expand Down

0 comments on commit d180d72

Please sign in to comment.