21291
org.mozilla.util.Debug renamed to org.mozilla.util.DebugPluglet Tests updated git-svn-id: svn://10.0.0.236/trunk@55880 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -39,7 +39,7 @@ public class PlugletLoader {
|
||||
// path to jar file. Name of main class sould to be in MANIFEST.
|
||||
public static PlugletFactory getPluglet(String path) {
|
||||
try {
|
||||
org.mozilla.util.Debug.print("-- PlugletLoader.getPluglet("+path+")\n");
|
||||
org.mozilla.util.DebugPluglet.print("-- PlugletLoader.getPluglet("+path+")\n");
|
||||
URL url = new URL("file://"+path);
|
||||
URLClassLoader loader = URLClassLoader.newInstance(new URL[]{url});
|
||||
URL manifestURL = new URL("jar:file://"+path+"!/META-INF/MANIFEST.MF");
|
||||
@@ -47,8 +47,8 @@ public class PlugletLoader {
|
||||
Manifest manifest = new Manifest(inputStream);
|
||||
Attributes attr = manifest.getMainAttributes();
|
||||
String plugletClassName = attr.getValue("Pluglet-Class");
|
||||
org.mozilla.util.Debug.print("-- PlugletLoader.getPluglet class name "+plugletClassName+"\n");
|
||||
org.mozilla.util.Debug.print("-- PL url[0] "+loader.getURLs()[0]+"\n");
|
||||
org.mozilla.util.DebugPluglet.print("-- PlugletLoader.getPluglet class name "+plugletClassName+"\n");
|
||||
org.mozilla.util.DebugPluglet.print("-- PL url[0] "+loader.getURLs()[0]+"\n");
|
||||
if (plugletClassName == null) {
|
||||
//nb
|
||||
return null;
|
||||
@@ -66,14 +66,14 @@ public class PlugletLoader {
|
||||
policy.grantPermission(codesource,collection);
|
||||
Object pluglet = loader.loadClass(plugletClassName).newInstance();
|
||||
if (pluglet instanceof PlugletFactory) {
|
||||
org.mozilla.util.Debug.print("-- ok we have a PlugletFactory"+"\n");
|
||||
org.mozilla.util.DebugPluglet.print("-- ok we have a PlugletFactory"+"\n");
|
||||
return (PlugletFactory) pluglet;
|
||||
} else {
|
||||
org.mozilla.util.Debug.print("-- oups we do not have a PlugletFactory"+"\n");
|
||||
org.mozilla.util.DebugPluglet.print("-- oups we do not have a PlugletFactory"+"\n");
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
org.mozilla.util.Debug.print("-- PlugletLoader.getPluglet exc "+e);
|
||||
org.mozilla.util.DebugPluglet.print("-- PlugletLoader.getPluglet exc "+e);
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
@@ -81,16 +81,16 @@ public class PlugletLoader {
|
||||
|
||||
public static String getMIMEDescription(String path) {
|
||||
try {
|
||||
org.mozilla.util.Debug.print("-- PlugletLoader.getMIMEDescription("+path+")\n");
|
||||
org.mozilla.util.DebugPluglet.print("-- PlugletLoader.getMIMEDescription("+path+")\n");
|
||||
URL manifestURL = new URL("jar:file://"+path+"!/META-INF/MANIFEST.MF");
|
||||
InputStream inputStream = manifestURL.openStream();
|
||||
Manifest manifest = new Manifest(inputStream);
|
||||
Attributes attr = manifest.getMainAttributes();
|
||||
String mimeDescription = attr.getValue("MIMEDescription");
|
||||
org.mozilla.util.Debug.print("-- PlugletLoader.getMIMEDescription desc "+mimeDescription+"\n");
|
||||
org.mozilla.util.DebugPluglet.print("-- PlugletLoader.getMIMEDescription desc "+mimeDescription+"\n");
|
||||
return mimeDescription;
|
||||
} catch (Exception e) {
|
||||
org.mozilla.util.Debug.print(e+"\n");
|
||||
org.mozilla.util.DebugPluglet.print(e+"\n");
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
package org.mozilla.util;
|
||||
|
||||
public class Debug {
|
||||
public class DebugPluglet {
|
||||
public static native void print(String str);
|
||||
|
||||
}
|
||||
@@ -93,7 +93,6 @@ class Player implements Pluglet, ControllerListener {
|
||||
}
|
||||
|
||||
public PlugletStreamListener newStream() {
|
||||
org.mozilla.util.Debug.print("--TestInstance.newStream\n");
|
||||
JMPlayerStreamListener listener = new JMPlayerStreamListener();
|
||||
listener.setPlayer(this);
|
||||
return listener;
|
||||
|
||||
@@ -42,7 +42,7 @@ CPPSRCS = \
|
||||
org_mozilla_pluglet_mozilla_PlugletPeerImpl.cpp \
|
||||
org_mozilla_pluglet_mozilla_PlugletStreamInfoImpl.cpp \
|
||||
org_mozilla_pluglet_mozilla_PlugletTagInfo2Impl.cpp \
|
||||
org_mozilla_util_Debug.cpp \
|
||||
org_mozilla_util_DebugPluglet.cpp \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -31,7 +31,7 @@ LIBRARY_NAME = plugletjni
|
||||
DEPTH= ..\..\..
|
||||
|
||||
OBJS = \
|
||||
.\$(OBJDIR)\org_mozilla_util_Debug.obj \
|
||||
.\$(OBJDIR)\org_mozilla_util_DebugPluglet.obj \
|
||||
.\$(OBJDIR)\org_mozilla_pluglet_mozilla_PlugletStreamInfoImpl.obj \
|
||||
.\$(OBJDIR)\org_mozilla_pluglet_mozilla_PlugletInputStream.obj \
|
||||
.\$(OBJDIR)\org_mozilla_pluglet_mozilla_PlugletOutputStream.obj \
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.io.*;
|
||||
|
||||
public class test implements PlugletFactory {
|
||||
public test() {
|
||||
org.mozilla.util.Debug.print("--test.test()\n");
|
||||
org.mozilla.util.DebugPluglet.print("--test.test()\n");
|
||||
}
|
||||
/**
|
||||
* Creates a new pluglet instance, based on a MIME type. This
|
||||
@@ -35,7 +35,7 @@ public class test implements PlugletFactory {
|
||||
* the specified MIME type.
|
||||
*/
|
||||
public Pluglet createPluglet(String mimeType) {
|
||||
org.mozilla.util.Debug.print("--test.createPlugletInstance\n");
|
||||
org.mozilla.util.DebugPluglet.print("--test.createPlugletInstance\n");
|
||||
return new TestInstance();
|
||||
}
|
||||
/**
|
||||
@@ -43,14 +43,14 @@ public class test implements PlugletFactory {
|
||||
* created.
|
||||
*/
|
||||
public void initialize(PlugletManager manager) {
|
||||
org.mozilla.util.Debug.print("--test.initialize\n");
|
||||
org.mozilla.util.DebugPluglet.print("--test.initialize\n");
|
||||
}
|
||||
/**
|
||||
* Called when the browser is done with the pluglet factory, or when
|
||||
* the pluglet is disabled by the user.
|
||||
*/
|
||||
public void shutdown() {
|
||||
org.mozilla.util.Debug.print("--test.shutdown\n");
|
||||
org.mozilla.util.DebugPluglet.print("--test.shutdown\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class TestInstance implements Pluglet {
|
||||
List list;
|
||||
PlugletPeer peer;
|
||||
public TestInstance() {
|
||||
org.mozilla.util.Debug.print("--TestInstance.TestInstance() \n");
|
||||
org.mozilla.util.DebugPluglet.print("--TestInstance.TestInstance() \n");
|
||||
panel = new Panel();
|
||||
button = new Button("Press me :)");
|
||||
button.addActionListener(new ActionListener() {
|
||||
@@ -91,9 +91,9 @@ class TestInstance implements Pluglet {
|
||||
|
||||
public void initialize(PlugletPeer peer) {
|
||||
this.peer = peer;
|
||||
org.mozilla.util.Debug.print("--TestInstance.initialize\n");
|
||||
org.mozilla.util.DebugPluglet.print("--TestInstance.initialize\n");
|
||||
peer.showStatus("Hello world");
|
||||
org.mozilla.util.Debug.print("--TestInstance.initialize "+peer.getMIMEType());
|
||||
org.mozilla.util.DebugPluglet.print("--TestInstance.initialize "+peer.getMIMEType());
|
||||
/*
|
||||
try {
|
||||
OutputStreamWriter out = new OutputStreamWriter(peer.newStream("text/plain","_new"));
|
||||
@@ -113,7 +113,7 @@ class TestInstance implements Pluglet {
|
||||
* to in the browser window's history.
|
||||
*/
|
||||
public void start() {
|
||||
org.mozilla.util.Debug.print("--TestInstance.start\n");
|
||||
org.mozilla.util.DebugPluglet.print("--TestInstance.start\n");
|
||||
}
|
||||
/**
|
||||
* Called to instruct the pluglet instance to stop, thereby suspending its state.
|
||||
@@ -122,7 +122,7 @@ class TestInstance implements Pluglet {
|
||||
* list.
|
||||
*/
|
||||
public void stop() {
|
||||
org.mozilla.util.Debug.print("--TestInstance.stop\n");
|
||||
org.mozilla.util.DebugPluglet.print("--TestInstance.stop\n");
|
||||
}
|
||||
/**
|
||||
* Called to instruct the pluglet instance to destroy itself. This is called when
|
||||
@@ -131,7 +131,7 @@ class TestInstance implements Pluglet {
|
||||
* window containing this page in the history is being closed.
|
||||
*/
|
||||
public void destroy() {
|
||||
org.mozilla.util.Debug.print("--TestInstance.destroy\n");
|
||||
org.mozilla.util.DebugPluglet.print("--TestInstance.destroy\n");
|
||||
}
|
||||
/**
|
||||
* Called to tell the pluglet that the initial src/data stream is
|
||||
@@ -140,7 +140,7 @@ class TestInstance implements Pluglet {
|
||||
* @result PlugletStreamListener
|
||||
*/
|
||||
public PlugletStreamListener newStream() {
|
||||
org.mozilla.util.Debug.print("--TestInstance.newStream\n");
|
||||
org.mozilla.util.DebugPluglet.print("--TestInstance.newStream\n");
|
||||
return new TestStreamListener();
|
||||
}
|
||||
/**
|
||||
@@ -149,7 +149,7 @@ class TestInstance implements Pluglet {
|
||||
* @param frame the pluglet panel
|
||||
*/
|
||||
public void setWindow(Frame frame) {
|
||||
org.mozilla.util.Debug.print("--Test...SetWindow "+frame+"\n");
|
||||
org.mozilla.util.DebugPluglet.print("--Test...SetWindow "+frame+"\n");
|
||||
if(frame == null) {
|
||||
return;
|
||||
}
|
||||
@@ -157,8 +157,8 @@ class TestInstance implements Pluglet {
|
||||
if (info instanceof PlugletTagInfo2) {
|
||||
PlugletTagInfo2 info2 = (PlugletTagInfo2)info;
|
||||
frame.setSize(info2.getWidth(),info2.getHeight());
|
||||
org.mozilla.util.Debug.print("--TestInstance.SetWindow width "+info2.getWidth()+ " height "+info2.getHeight()+"\n");
|
||||
org.mozilla.util.Debug.print("--Test...SetWindow "+frame+"\n");
|
||||
org.mozilla.util.DebugPluglet.print("--TestInstance.SetWindow width "+info2.getWidth()+ " height "+info2.getHeight()+"\n");
|
||||
org.mozilla.util.DebugPluglet.print("--Test...SetWindow "+frame+"\n");
|
||||
}
|
||||
frame.add(panel);
|
||||
frame.pack();
|
||||
@@ -175,16 +175,16 @@ class TestInstance implements Pluglet {
|
||||
|
||||
class TestStreamListener implements PlugletStreamListener {
|
||||
public TestStreamListener() {
|
||||
org.mozilla.util.Debug.print("--TestStreamListener.TestStreamListener()\n");
|
||||
org.mozilla.util.DebugPluglet.print("--TestStreamListener.TestStreamListener()\n");
|
||||
}
|
||||
/**
|
||||
* Notify the observer that the URL has started to load. This method is
|
||||
* called only once, at the beginning of a URL load.<BR><BR>
|
||||
*/
|
||||
public void onStartBinding(PlugletStreamInfo streamInfo) {
|
||||
org.mozilla.util.Debug.print("--TestStreamListener.onStartBinding ");
|
||||
org.mozilla.util.Debug.print("length "+streamInfo.getLength());
|
||||
org.mozilla.util.Debug.print(" contenet type "+ streamInfo.getContentType());
|
||||
org.mozilla.util.DebugPluglet.print("--TestStreamListener.onStartBinding ");
|
||||
org.mozilla.util.DebugPluglet.print("length "+streamInfo.getLength());
|
||||
org.mozilla.util.DebugPluglet.print(" contenet type "+ streamInfo.getContentType());
|
||||
}
|
||||
/**
|
||||
* Notify the client that data is available in the input stream. This
|
||||
@@ -197,23 +197,23 @@ class TestStreamListener implements PlugletStreamListener {
|
||||
*/
|
||||
public void onDataAvailable(PlugletStreamInfo plugletInfo, InputStream input,int length) {
|
||||
try{
|
||||
org.mozilla.util.Debug.print("--TestStreamListener.onDataAvailable ");
|
||||
org.mozilla.util.Debug.print("--length "+input.available()+"\n");
|
||||
org.mozilla.util.DebugPluglet.print("--TestStreamListener.onDataAvailable ");
|
||||
org.mozilla.util.DebugPluglet.print("--length "+input.available()+"\n");
|
||||
} catch(Exception e) {
|
||||
;
|
||||
}
|
||||
}
|
||||
public void onFileAvailable(PlugletStreamInfo plugletInfo, String fileName) {
|
||||
org.mozilla.util.Debug.print("--TestStreamListener.onFileAvailable\n");
|
||||
org.mozilla.util.DebugPluglet.print("--TestStreamListener.onFileAvailable\n");
|
||||
}
|
||||
/**
|
||||
* Notify the observer that the URL has finished loading.
|
||||
*/
|
||||
public void onStopBinding(PlugletStreamInfo plugletInfo,int status) {
|
||||
org.mozilla.util.Debug.print("--TestStreamListener.onStopBinding\n");
|
||||
org.mozilla.util.DebugPluglet.print("--TestStreamListener.onStopBinding\n");
|
||||
}
|
||||
public int getStreamType() {
|
||||
org.mozilla.util.Debug.print("--TestStreamListener.getStreamType\n");
|
||||
org.mozilla.util.DebugPluglet.print("--TestStreamListener.getStreamType\n");
|
||||
return 1; //:)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user