com.sun.jini.example.browser
Class Browser

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by com.sun.jini.example.browser.Browser
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class Browser
extends JFrame

Example service browser. See the package documentation for details.

Author:
Sun Microsystems, Inc.
See Also:
Serialized Form

Nested Class Summary
private  class Browser.AllFind
           
private  class Browser.AttrSet
           
private  class Browser.Entries
           
static class Browser.Exit
          An action listener that cancels any lookup service event registration lease and then calls System.exit.
private  class Browser.Exiter
           
private  class Browser.Fields
           
private  class Browser.Handler
           
(package private) static class Browser.LeaseNotify
           
private  class Browser.Listener
           
private  class Browser.Lookup
           
private  class Browser.LookupListener
           
private  class Browser.MouseReceiver
           
private  class Browser.MultiFind
           
private  class Browser.PubFind
           
private static class Browser.RegistrarMenuItem
           
private  class Browser.Reset
           
private  class Browser.Service
           
(package private)  class Browser.ServiceItemRenderer
           
private  class Browser.ServiceListItem
           
private  class Browser.ServiceListPopup
           
private  class Browser.Services
           
private  class Browser.Show
           
private  class Browser.UniFind
           
private  class Browser.Unmatch
           
private  class Browser.Value
           
private  class Browser.Values
           
 
Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private  Browser.LookupListener adder
           
(package private)  ProxyPreparer adminPreparer
           
private  boolean autoConfirm
           
(package private) static String BROWSER
           
private  ClassLoader ccl
           
(package private)  Configuration config
           
private  SecurityContext ctx
           
private  DiscoveryGroupManagement disco
           
private  DefaultListModel dummyModel
           
private  Lease elease
           
private  JCheckBoxMenuItem esuper
           
private  long eventID
           
private  Object eventSource
           
private  ActionListener exiter
           
private static Icon[] icons
           
private  List ignoreInterfaces
           
private  boolean isAdmin
           
(package private)  LeaseRenewalManager leaseMgr
           
(package private)  ProxyPreparer leasePreparer
           
private  JList list
           
private  Browser.Listener listen
           
private  DefaultListModel listModel
           
private  JScrollPane listScrollPane
           
private  LeaseListener lnotify
           
private  MethodConstraints locatorConstraints
           
(package private) static Logger logger
           
private  ServiceRegistrar lookup
           
private  JMenu registrars
           
private  JCheckBoxMenuItem sclass
           
private  long seqNo
           
(package private)  ProxyPreparer servicePreparer
           
private  JCheckBoxMenuItem ssuper
           
private  JTextArea text
           
private  ServiceTemplate tmpl
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Browser(ActionListener exiter, Configuration config)
          Creates an instance with the given action listener for the Exit menu item and the given configuration.
Browser(String[] args, LifeCycle lc)
          Creates an instance with the given command line arguments and life cycle callback.
 
Method Summary
private static void addNone(JMenu menu)
           
private  void addOne(ServiceRegistrar registrar)
           
private  void cancelLease()
           
private  void failure(Throwable t)
           
private  void genEntries(StringBuffer buf, Entry[] entries, boolean showNulls)
           
private  void genMatches(StringBuffer buf, boolean match)
           
private  String genText(boolean match)
           
(package private) static Class[] getInterfaces(Class c)
           
private  void init(ActionListener exiter, Configuration config)
           
(package private)  boolean isAutoConfirm()
          Indicates whether auto confirm is enabled to prevent from the user having to click the 'Yes' button in the a popup window to confirm a modification to the service browser pane is allowed to take place as result of a service being removed, or its lookup attributes being changed.
static void main(String[] args)
          Runs the service browser.
private static String[] parseList(String names, boolean groups)
           
private  void reset()
           
private  void resetTmpl()
           
private  void setGroups(String[] groups)
           
private  void setText(boolean match)
           
private static String typeName(Class type)
           
private  void update()
           
private static boolean valid(Field f)
           
(package private)  ActionListener wrap(ActionListener l)
           
(package private)  MenuListener wrap(MenuListener l)
           
(package private)  MouseListener wrap(MouseListener l)
           
private  Object wrap(Object obj, Class iface)
           
(package private)  Runnable wrap(Runnable r)
           
(package private)  WindowListener wrap(WindowListener a)
           
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

BROWSER

static final String BROWSER
See Also:
Constant Field Values

logger

static final Logger logger

ctx

private transient SecurityContext ctx

ccl

private transient ClassLoader ccl

config

transient Configuration config

disco

private transient DiscoveryGroupManagement disco

lookup

private transient ServiceRegistrar lookup

eventSource

private transient Object eventSource

eventID

private transient long eventID

seqNo

private transient long seqNo

exiter

private transient ActionListener exiter

tmpl

private transient ServiceTemplate tmpl

listen

private transient Browser.Listener listen

adder

private transient Browser.LookupListener adder

elease

private transient Lease elease

leasePreparer

transient ProxyPreparer leasePreparer

servicePreparer

transient ProxyPreparer servicePreparer

adminPreparer

transient ProxyPreparer adminPreparer

locatorConstraints

private transient MethodConstraints locatorConstraints

leaseMgr

transient LeaseRenewalManager leaseMgr

lnotify

private transient LeaseListener lnotify

ignoreInterfaces

private transient List ignoreInterfaces

text

private transient JTextArea text

registrars

private transient JMenu registrars

esuper

private transient JCheckBoxMenuItem esuper

ssuper

private transient JCheckBoxMenuItem ssuper

sclass

private transient JCheckBoxMenuItem sclass

isAdmin

private transient boolean isAdmin

autoConfirm

private transient volatile boolean autoConfirm

list

private transient JList list

listModel

private transient DefaultListModel listModel

dummyModel

private transient DefaultListModel dummyModel

listScrollPane

private transient JScrollPane listScrollPane

icons

private static Icon[] icons
Constructor Detail

Browser

public Browser(ActionListener exiter,
               Configuration config)
        throws ConfigurationException,
               IOException
Creates an instance with the given action listener for the Exit menu item and the given configuration. The action listener defaults to an instance of Exit. The action listener can be overridden by a configuration entry. The configuration defaults to an empty configuration.

Parameters:
exiter - the action listener, or null
config - the configuration, or null
Throws:
ConfigurationException
IOException

Browser

public Browser(String[] args,
               LifeCycle lc)
        throws ConfigurationException,
               LoginException,
               IOException
Creates an instance with the given command line arguments and life cycle callback. See the package documentation for details of the command line arguments. The default action listener for the Exit menu item calls the dispose method of this instance, cancels any lookup service event registration lease, unexports any remote event listener, and calls the unregister method of the life cycle callback. The action listener can be overridden by a configuration entry.

Parameters:
args - command line arguments
lc - life cycle callback, or null.
Throws:
ConfigurationException
LoginException
IOException
Method Detail

init

private void init(ActionListener exiter,
                  Configuration config)
           throws ConfigurationException,
                  IOException
Throws:
ConfigurationException
IOException

typeName

private static String typeName(Class type)

setText

private void setText(boolean match)

genText

private String genText(boolean match)

genEntries

private void genEntries(StringBuffer buf,
                        Entry[] entries,
                        boolean showNulls)

valid

private static boolean valid(Field f)

genMatches

private void genMatches(StringBuffer buf,
                        boolean match)

addNone

private static void addNone(JMenu menu)

addOne

private void addOne(ServiceRegistrar registrar)

getInterfaces

static Class[] getInterfaces(Class c)

isAutoConfirm

boolean isAutoConfirm()
Indicates whether auto confirm is enabled to prevent from the user having to click the 'Yes' button in the a popup window to confirm a modification to the service browser pane is allowed to take place as result of a service being removed, or its lookup attributes being changed.

Returns:
true in case no popup is required to have the user confirm the modifications, false otherwise

wrap

ActionListener wrap(ActionListener l)

wrap

MenuListener wrap(MenuListener l)

wrap

MouseListener wrap(MouseListener l)

wrap

WindowListener wrap(WindowListener a)

wrap

Runnable wrap(Runnable r)

wrap

private Object wrap(Object obj,
                    Class iface)

resetTmpl

private void resetTmpl()

reset

private void reset()

setGroups

private void setGroups(String[] groups)

parseList

private static String[] parseList(String names,
                                  boolean groups)

cancelLease

private void cancelLease()

update

private void update()

failure

private void failure(Throwable t)

main

public static void main(String[] args)
Runs the service browser. See the package documentation for details.

Parameters:
args - command line arguments


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.