bug 18180

Names changed
Pluglet->PlugletFactory, *PlugletInstance*->*Pluglet*


git-svn-id: svn://10.0.0.236/trunk@52992 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
idk%eng.sun.com
1999-11-09 10:28:46 +00:00
parent 2d80fbfdef
commit 51254cf0e7
33 changed files with 811 additions and 800 deletions

View File

@@ -19,27 +19,66 @@
* Contributor(s):
*/
package org.mozilla.pluglet;
import org.mozilla.pluglet.mozilla.*;
import java.awt.Frame;
import java.awt.print.PrinterJob;
public interface Pluglet {
/**
* Creates a new pluglet instance, based on a MIME type. This
* allows different impelementations to be created depending on
* the specified MIME type.
* Initializes a newly created pluglet instance, passing to it the pluglet
* instance peer which it should use for all communication back to the browser.
*
* @param peer the corresponding pluglet peer
*/
public PlugletInstance createPlugletInstance(String mimeType);
void initialize(PlugletPeer peer);
/**
* Initializes the pluglet and will be called before any new instances are
* created.
* Called to instruct the pluglet instance to start. This will be called after
* the pluglet is first created and initialized, and may be called after the
* pluglet is stopped (via the Stop method) if the pluglet instance is returned
* to in the browser window's history.
*/
public void initialize(PlugletManager manager);
void start();
/**
* Called when the browser is done with the pluglet factory, or when
* the pluglet is disabled by the user.
* Called to instruct the pluglet instance to stop, thereby suspending its state.
* This method will be called whenever the browser window goes on to display
* another page and the page containing the pluglet goes into the window's history
* list.
*/
public void shutdown();
void stop();
/**
* Called to instruct the pluglet instance to destroy itself. This is called when
* it become no longer possible to return to the pluglet instance, either because
* the browser window's history list of pages is being trimmed, or because the
* window containing this page in the history is being closed.
*/
void destroy();
/**
* Called to tell the pluglet that the initial src/data stream is
* ready.
*
* @result PlugletStreamListener
*/
PlugletStreamListener newStream();
/**
* Called when the window containing the pluglet instance changes.
*
* @param frame the pluglet panel
*/
void setWindow(Frame frame);
/**
* Called to instruct the pluglet instance to print itself to a printer.
*
* @param print printer information.
*/
void print(PrinterJob printerJob);
}

View File

@@ -0,0 +1,47 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet;
import org.mozilla.pluglet.mozilla.*;
public interface PlugletFactory {
/**
* Creates a new pluglet instance, based on a MIME type. This
* allows different impelementations to be created depending on
* the specified MIME type.
*/
public Pluglet createPluglet(String mimeType);
/**
* Initializes the pluglet and will be called before any new instances are
* created.
*/
public void initialize(PlugletManager manager);
/**
* Called when the browser is done with the pluglet factory, or when
* the pluglet is disabled by the user.
*/
public void shutdown();
}

View File

@@ -1,86 +0,0 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
*/
package org.mozilla.pluglet;
import org.mozilla.pluglet.mozilla.*;
import java.awt.Frame;
import java.awt.print.PrinterJob;
public interface PlugletInstance {
/**
* Initializes a newly created pluglet instance, passing to it the pluglet
* instance peer which it should use for all communication back to the browser.
*
* @param peer the corresponding pluglet instance peer
*/
void initialize(PlugletInstancePeer peer);
/**
* Called to instruct the pluglet instance to start. This will be called after
* the pluglet is first created and initialized, and may be called after the
* pluglet is stopped (via the Stop method) if the pluglet instance is returned
* to in the browser window's history.
*/
void start();
/**
* Called to instruct the pluglet instance to stop, thereby suspending its state.
* This method will be called whenever the browser window goes on to display
* another page and the page containing the pluglet goes into the window's history
* list.
*/
void stop();
/**
* Called to instruct the pluglet instance to destroy itself. This is called when
* it become no longer possible to return to the pluglet instance, either because
* the browser window's history list of pages is being trimmed, or because the
* window containing this page in the history is being closed.
*/
void destroy();
/**
* Called to tell the pluglet that the initial src/data stream is
* ready.
*
* @result PlugletStreamListener
*/
PlugletStreamListener newStream();
/**
* Called when the window containing the pluglet instance changes.
*
* @param frame the pluglet panel
*/
void setWindow(Frame frame);
/**
* Called to instruct the pluglet instance to print itself to a printer.
*
* @param print printer information.
*/
void print(PrinterJob printerJob);
}

View File

@@ -30,7 +30,7 @@ import java.security.*;
public class PlugletLoader {
// path to jar file. Name of main class sould to be in MANIFEST.
public static Pluglet getPluglet(String path) {
public static PlugletFactory getPluglet(String path) {
try {
org.mozilla.util.Debug.print("-- PlugletLoader.getPluglet("+path+")\n");
URL url = new URL("file:/"+path);
@@ -41,7 +41,7 @@ public class PlugletLoader {
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]);
org.mozilla.util.Debug.print("-- PL url[0] "+loader.getURLs()[0]+"\n");
if (plugletClassName == null) {
//nb
return null;
@@ -58,9 +58,11 @@ public class PlugletLoader {
collection.add(perm);
policy.grantPermission(codesource,collection);
Object pluglet = loader.loadClass(plugletClassName).newInstance();
if (pluglet instanceof Pluglet) {
return (Pluglet) pluglet;
if (pluglet instanceof PlugletFactory) {
org.mozilla.util.Debug.print("-- ok we have a PlugletFactory"+"\n");
return (PlugletFactory) pluglet;
} else {
org.mozilla.util.Debug.print("-- oups we do not have a PlugletFactory"+"\n");
return null;
}
} catch (Exception e) {

View File

@@ -47,7 +47,7 @@ public interface PlugletManager {
public String userAgent();
/**
* Fetches a URL.
* @param plugletInst the pluglet making the request.
* @param pluglet the pluglet making the request.
* If null, the URL is fetched in the background.
* @param url the URL to fetch
* @param target the target window into which to load the URL
@@ -62,7 +62,7 @@ public interface PlugletManager {
* 'javascript:' URLs, even if the user currently has JavaScript
* disabled (usually specify false)
*/
public void getURL(PlugletInstance plugletInst,
public void getURL(Pluglet pluglet,
URL url, String target,
PlugletStreamListener streamListener,
String altHost, URL referrer,
@@ -70,7 +70,7 @@ public interface PlugletManager {
/**
* Posts to a URL with post data and/or post headers.
*
* @param plugletInst the pluglet making the request. If null, the URL
* @param pluglet the pluglet making the request. If null, the URL
* is fetched in the background.
* @param url the URL to fetch
* @param target the target window into which to load the URL
@@ -93,7 +93,7 @@ public interface PlugletManager {
* are no post headers
*/
public void postURL(PlugletInstance plugletInst,
public void postURL(Pluglet pluglet,
URL url,
int postDataLen,
byte[] postData,

View File

@@ -50,7 +50,7 @@ public class PlugletManagerImpl implements PlugletManager {
public native String userAgent();
/**
* Fetches a URL.
* @param plugletInst the pluglet making the request.
* @param pluglet the pluglet making the request.
* If null, the URL is fetched in the background.
* @param url the URL to fetch
* @param target the target window into which to load the URL
@@ -65,7 +65,7 @@ public class PlugletManagerImpl implements PlugletManager {
* 'javascript:' URLs, even if the user currently has JavaScript
* disabled (usually specify false)
*/
public native void getURL(PlugletInstance plugletInst,
public native void getURL(Pluglet pluglet,
URL url, String target,
PlugletStreamListener streamListener,
String altHost, URL referrer,
@@ -73,7 +73,7 @@ public class PlugletManagerImpl implements PlugletManager {
/**
* Posts to a URL with post data and/or post headers.
*
* @param plugletInst the pluglet making the request. If null, the URL
* @param pluglet the pluglet making the request. If null, the URL
* is fetched in the background.
* @param url the URL to fetch
* @param target the target window into which to load the URL
@@ -96,7 +96,7 @@ public class PlugletManagerImpl implements PlugletManager {
* are no post headers
*/
public native void postURL(PlugletInstance plugletInst,
public native void postURL(Pluglet pluglet,
URL url,
int postDataLen,
byte[] postData,

View File

@@ -1,28 +1,23 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
* Inc. Portions created by Sun are Copyright (C) 1999 Sun Microsystems,
* Inc. All Rights Reserved.
*/
package org.mozilla.pluglet.mozilla;
import java.io.OutputStream;
public interface PlugletInstancePeer {
public interface PlugletPeer {
public static final int NETSCAPE_WINDOW = 3;
/**
* Returns the MIME type of the pluglet instance.

View File

@@ -1,30 +1,25 @@
/*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Initial Developer of the Original Code is Sun Microsystems,
* Inc. Portions created by Sun are
* Copyright (C) 1999 Sun Microsystems, Inc. All
* Rights Reserved.
*
* Contributor(s):
* Inc. Portions created by Sun are Copyright (C) 1999 Sun Microsystems,
* Inc. All Rights Reserved.
*/
package org.mozilla.pluglet.mozilla;
import java.io.OutputStream;
public class PlugletInstancePeerImpl implements PlugletInstancePeer {
public class PlugletPeerImpl implements PlugletPeer {
private long peer = 0;
public PlugletInstancePeerImpl(long peer) {
public PlugletPeerImpl(long peer) {
this.peer = peer;
nativeInitialize();
}