{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\fmodern\fprq1\fcharset0 Courier New;}{\f2\fnil\fcharset2 Symbol;}} {\*\generator Msftedit 5.41.15.1515;}\viewkind4\uc1\pard\b\f0\fs28 LDAP\par \b0\fs24\par LDAP provides a tree structure as the means of organizing data. It is used when there are far more read than write operations. \par \par Each entry in the tree formed has these attributes:\par \par Zero or more attributes, which consist of an identifier and a value (like properties). \par One or more object classes. This is a set of required or optional attributes for the particular tree leaf\par Distinguished name. Sequence of attributes for tracing the path to the leaf from the tree root\par \par Commonly used attributes\par dc\par cn\par sn\par dn\par o\par ou\par uid\par \par \b Configuration\par \b0 In OpenLDAP the \f1\fs20 slapd.conf\f0\fs24 file is used for configuration. There suffix entry in the file specifies the distinguished name, i.e. the path to the leaf: suffix "dc=Wendell Murray Associates Inc.,dc=com"\par Administrative rights are provided through two lines:\par \par \f1\fs20 rootdn\tab "cn=Wendell Murray,dc=Wendell Murray Associates Inc., dc=com"\par rootpw\tab modica1970\par \f0\fs24\par A directory tree might be:\par \par \f1\fs20 root\par DN:dc=com\par DN:dc=Wendell Murray Associates Inc, dc=com\par Object classes: dcObject, organization\par Attributes:dc=Wendell Murray Associates Inc. o=Owner\par DN:ou=employees,dc=Wendell Murray Associates Inc.,dc=com\tab\par \f0\fs24\par Authorization settings made me made, such as permitting a manager to have read and write attributes while others have read authorization\par \par Databases permit import of LDIP data. Light directory interchange format. There are browser which permit browsing of thr directory tree.\par \par \b Accessing data\par \b0\par \par \b\fs28 Chapter 5 Internationalization\par \pard\tx1260\b0\fs24\par \pard\b Resource bundles\par Locating bundles\par \b0\par \f1\fs20 bundleName_language_country\par bundleName_language\par \par ResourceBundle bundle = ResourceBundle.getBundle(bundleName, currentLocale);\par \f0\fs24\par \b Property files\par \b0 key=value\par \par \b Bundle classes\par \b0 Standard naming conventions:\par \f1\fs20 programResources.java\par programResources_en.java\par programResources_de_DE.java\par \f0\fs24\par \f1\fs20 public class bundleName_language_country extends ListResourceBundle \{\par \par \tab public Object[][] getContents \{return contents;\}\par \par \tab public static final Object[][] contents = \{\par \tab\tab\{key1, value1\}, \{key2, value2\}\par \tab\}\par \}\par \f0\fs24\par See example\par \par \par \par \b\fs28 Chapter 6 Advanced Swing\par \fs24 Lists\par \b0 JList\par \par \f1\fs20 String[] words = \{"this", "is", "a", "list", ...\};\par JList wordList = new JList(words);\par \par wordList.setVisibleRowCount(4);\par \par JList.VERTICAL\par JList.VERTICAL_WRAP\par JList.HORIZONTAL_WRAP\par \par wordList.setSelectionMode(ListSelectionMode.SINGLE_SELECTION);\par \f0\fs24\par List test\par \par \par \b Tables\par \b0\par JTable displays a two-dimensional table. The component displays tables but does not produce them. It has a constructor that takes a two-dimensional array as an argument.\par \par For example:\par \par \f1\fs20 Object[][] cellsForTable = \{"Mercury", 2440, 0, false, ColorYELLOW\}, "Venus", 6052, 0, false, Color.YELLOW\}, ...\}\par \f0\fs24\par The table involkes the toString method on each object for display. The colors appear as:\par \f1\fs20 java.awt.Color[r=...,g=...,b=...]..\par \f0\fs24\par Column names are a separate array: \par \f1\fs20 String[] columns = \{"Planet", "Radius", "Moons", "Gaseous", "Color"\};\par \f0\fs24\par Scroll bars are added:\par \par \f1\fs20 JTable table = new JTable(cells, columns);\par JScrollPane pane = new JScrollPane(table);\par \f0\fs24\par There is rich behavior from this simple setup.\par \par \b Table models\par \b0 There is an \f1\fs20 AbstractTableModel\f0\fs24 class that implements most methods for a table. Three must be implemented:\par \par \f1\fs20 public int getRowCount();\par public int getColumnCount();\par public Object getValueAt(int row, int column);\par \par \f0\fs24 Manipulation of rows and columns\par \par \f1\fs20 Class getColumnClass(int columnIndex);\par \f0\fs24\par Rendering actions:\par Boolean\tab checkbox\par Icon\tab\tab image\par Object\tab\tab String\par \par Accessing table columns\par \f1\fs20 int columnIndex = ...;\par TableColumn column = table.getColumnModel().getColumn(index);\par \f0\fs24\par Resizing columns\par \par \f1\fs20 void setPreferredWidth(int width);\par void setMinWidth(int width);\par void setMaxWidth(int width);\par \par \f0\fs24 Resize modes\par \f1\fs20 AUTO_RESIZE_OFF\par AUTO_RESIZE_NEXT_COLUMN\par AUTO_RESIZE_SUBSEQUENT_COLUMNS\par AUTO_RESIZE_LAST_COLUMN\par AUTO_RESIZE_ALL_COLUMNS\par \f0\fs24\par Selecting rows and columns\par \par Sorting\par \par \par Filtering\par \par \par Hiding/displaying\par \par \par Cell rendering.editing\par \par \par Rendering header\par \par \par Cell edits\par \par Custom editing\par \par Trees\par \par \par Simple trees\par \par \par Editing trees and paths\par \par \par Nodes\par \par \par Rendering nodes\par \par \par Tree events\par \par \par Custom trees\par \par \par \par Text components\par \par \par Tracking changes in text components\par \par \par Formatting input fields\par \par \par Integers\par \par \par Loss of focus\par \par \par Filters\par \par Verifiers\par \par \par Standard formatting\par \par Custom formatting\par \par JSpinner\par \par \par \b\fs28 Chapter 7 Advanced AWT\par \b0\fs24\par \par \par \b Readers and writers for images\par \b0 To load or write an image:\par \par \f1\fs20 File file = ....;\par BufferedImage image = ImageIO.read(file);\par \par String format = ...;\par ImageIO.write(image, format, file);\par \f0\fs24\par \b Obtaining readers and writers\par \b0\par Clipboard\par The data transfer API in Java supports the transfer of arbitrary local object references in the same virtual machine. Between virtual machines serialized objects and references to remote objects are transferred.\par \par \b Clipboard mechanism\par \b0\par The package that contains classes for using the clipboard is java.awt.datatransfer.\par \par Objects must implement Transferable interface\par Clipboard is the clipboard class\par DataFlavor is a class for describing types of data\par StringSelection implements Transferable\par ClipboardOwner is an interface that must be implemented to permit alerts when a clipboard's contents are overwritten\par \par \par \b Transferring text\par \b0 See the example in the book.\par \par \par \par \par \par \par \par \par \par \par \par \par \b\fs28 Chapter 8 JavaBeans\par \b0\fs24\par \b Bean writing\par \b0\par \par \par \b Using beans for applications\par \b0\par \par \b Packaging beans\par \b0\par \par Composing beans in an IDE\par \par \par Naming patterns\par \par \par Property types\par \par \par Indexed properties\par \par Bound properties\par \par \par \par Constrained properties\par \par \par BeanInfo classes\par \par \par Property editors\par \par \par Creating property editors\par \par String-based editors\par \par GUI-based editors\par \par Customization\par \par \par Writing a customizer\par \par Persistence\par \par \par Persistence for arbitrary data\par \par \par Delegation for object construction\par \par \par Constructing an object from properties\par \par Using a factory\par \par \par Postconstruction\par \par \par Transience\par \par \b\fs28 Chapter 9 Security\par \b0\fs24\par Class loading\par \par \par Class loading hierarchy\par \par \par Class loaders as namespaces\par \par Writing a class loader\par \par \par Byte code verification role\par \par \par Security managers/permissions\par \par \par Platform security\par \par Policy files\par \par \par Custom permissions\par \par \par Creating a permission class\par \par \par Authentication\par \par \par JAAS\par \par \par Digital signatures\par \par \par Message digests\par \par \par Message signing\par \par \par X.509 certificate\par \par \par Authentication issues\par \par Certificates\par \par \par Signing\par \par \par Requests\par \par \par Code signing\par \par \par JAR file signing\par \par Developer certificates\par \par \par Encryption\par \par Symmetric\par \par \par Asymmetric\par \par Key generation\par \par Public key ciphers\par \par \par \b\fs28 Chapter 10 Distributed objects\par \b0\fs24\par Client/server model\par \par \par RMI\par \par Stubs and marshalling\par \par \par RMI model\par \par \par RMI registry\par \par Program deployment\par \par RMI logs\par \par \par Parameters and return values\par \par \par Transferring remote objects\par \par \par Transferring non-remote objects\par \par \par Dynamic class loading\par \par Remote references with multiple interfaces\par \par Remote objects and method overriding\par \par \par Remote object activation\par \par Web services/JAX-WS\par \par JAX-WS use\par \par Web service client\par \par \par \par \par \b\fs28 Chapter 11 Scripting/annotations.compilation\par \b0\fs24\par \par Compiler API\par JavaCompiler compiler = ToolProvider.getSystemCompiler();\par OutputStream output = ...;\par OutputStream error = ...;\par int result = compiler.run(null, output, error, "-sourcepath, "src". ".java");\par \par \par Compilation tasks\par JavaFileManager controls location of source and class files. JavaFileObject is determined by that class.\par \par Error messages require DiagnosticListener object. \par \par \par \par \par \b Annotations\par \b0 Tools look for annotations in source and can operate either on the source or class files. A processing tool is required to act on the annotations because the annotations themselves are only markers that tell another piece of software what to do with the source or class text.\par \par An annotation must have an annotation interface that provides metadata on the context where the annotation operates and on its methods and any final fields:\par \par \f1\fs20 @Target(ElementType.METHOD)\par @Retention(RetentionPolicy.RUNTIME)\par public @Interface Test \{\par \tab long timeout() default 0L;\par \}\par \f0\fs24\par Example that uses an annotation to wire a listener to an event source:\par \par \f1\fs20 someElement.addActionListener(\par \tab new ActionListener() \{\par \tab\tab public void actionPerformed(ActionEvent event) \{\par \tab\tab\tab doSomething();\par \tab\tab\}\par \tab\}\par );\par \f0\fs24\par This is replaced by:\par \par \f1\fs20 @ActionListenerFor(source="") \par public void \{\}\par \f0\fs24\par The tool will encounter this annotation. It will take the source element and construct the text for the action listener above based on the element name and its method.\par \par The tool is called ActionListenerInstaller and its static method is processAnnotations(Object thisObject);\par \par The interface definition is:\par \par \f1\fs20 @Target(ElementType.METHOD)\par @Retention(RetentionPolicy.RUNTIME)\par public @Interface ActionListenerFor \{\par \tab String source();\par \}\par \f0\fs24\par In this ase if the name of the element is the value identified by "" above, then that is the source that is activated by the action listener. In the example the source is the various colors of buttons, e.g. "redButton" which is identified as JButton redButton., or JButton yellowButton, etc.\par \par The static class that does the processing uses reflection to look for the element and to manipulate the code. Fairly complet:\par \par \f1\fs20 public class ActionListenerInstaller \{\par \par public static void processAnnotations(Object object) \{\par try \{\par \tab Class thisClass = object.getClass();\par \tab for (Method method : thisClass.getDeclaredMethods()) \{\par \tab ActionListenerFor actionListener = method.getAnnotation(ActionListenerFor.class);\par \tab\tab if (actionListener != null) \{\par \tab\tab Field field = thisClass.getDeclaredField(actionListener.source());\par \tab\tab field.setAccessible(true);\par \tab\tab addListener(field.get(object)), object, method);\par \tab\tab\}\par \tab \}\par \} catch (Exception exception) \{\}\par \}\par \par public static void addListener(Object source, final Object parameter, final Method method) throws NoSuchMethodException, IllegalArgumentException, InvocationTargetException \{\par InvocationHandler handler = new InvocationHandler(\par new InvocationHandler() \{\par \tab public Object invoke(Object proxy, Method thisMethod, Object[] arguments) \tab\tab\tab throws Throwable \{\par \tab return method.invoke(arguments);\par \tab \}\par \tab \}\par );\par \}\par \par Object listener = Proxy.getProxyInstance(null, new Class[] \{java.awt.ActionListener.class\}, handler);\par Method method = source.getClass().getMethod("addActionListener", ActionListener.class);\par method.invole(source, listener);\par \}\par \f0\fs24\par Annotations may be added to these elements:\par \pard{\pntext\f2\'B7\tab}{\*\pn\pnlvlblt\pnf2\pnindent0{\pntxtb\'B7}}\fi-720\li720 packages\par {\pntext\f2\'B7\tab}classes\par {\pntext\f2\'B7\tab}interfaces\par {\pntext\f2\'B7\tab}methods\par {\pntext\f2\'B7\tab}constructors\par {\pntext\f2\'B7\tab}instance fields\par {\pntext\f2\'B7\tab}local variables\par {\pntext\f2\'B7\tab}parameters\par \pard\par \par \b Annotations for managing resources\par \b0\par \par \b Annotations for managing compilation\par \b0\par \b Element types in @Target annotation\par \b0\par \par \b Byte code engineering\par \b0\par \par \b\fs28 Chapter 12 Native methods\par \b0\fs24 Example\par \par \par \par \par \par \par \par \f1\fs20\par }