User: mulder  
  Date: 00/07/07 16:47:48

  Modified:    src/main/org/jboss/metadata BeanMetaData.java
                        ContainerMetaData.java FieldMetaData.java
                        MetaData.java MetaDataFactory.java
                        MetaDataPlugin.java MethodMetaData.java
                        ServerMetaData.java
  Log:
  Added JavaDoc and header comments to the metadata interfaces.
  
  Revision  Changes    Path
  1.2       +62 -0     jboss/src/main/org/jboss/metadata/BeanMetaData.java
  
  Index: BeanMetaData.java
  ===================================================================
  RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/metadata/BeanMetaData.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BeanMetaData.java 2000/07/04 00:10:00     1.1
  +++ BeanMetaData.java 2000/07/07 23:47:46     1.2
  @@ -1,14 +1,76 @@
  +/*
  + * jBoss, the OpenSource EJB server
  + *
  + * Distributable under GPL license.
  + * See terms of license at gnu.org.
  + */
   package org.jboss.metadata;
   
   import java.util.Set;
   
  +/**
  + * The metadata for a specific EJB.  The bean may iself have properties, and
  + * it has several collections of other metadata instances that may have
  + * additional properties.
  + */
   public interface BeanMetaData extends MetaData {
  +    /**
  +     * Gets the metadata for a method of this bean.  The method is identified
  +     * by its name and arguments.
  +     * @throws java.lang.IllegalArgumentException
  +     *      Occurs when no method with the specified name and arguments can be
  +     *      found.
  +     */
       public MethodMetaData getMethod(String name, Class[] args);
  +
  +    /**
  +     * Gets the metadata for a method of this bean's home interface.  The
  +     * method is identified by its name and arguments.
  +     * @throws java.lang.IllegalArgumentException
  +     *      Occurs when no method with the specified name and arguments can be
  +     *      found.
  +     */
       public MethodMetaData getHomeMethod(String name, Class[] args);
  +
  +    /**
  +     * Gets the metadata for a field of this bean.  This is generally used for
  +     * persistence but may have properties for other things as well.
  +     * @throws java.lang.IllegalArgumentException
  +     *      Occurs when no field with the specified name can be found.
  +     */
       public FieldMetaData getField(String name);
  +
  +    /**
  +     * Gets the metadata for this bean's container.  One set of container
  +     * metadata may be shared across several beans, or they may all have
  +     * individual instances.
  +     */
       public ContainerMetaData getContainer();
  +
  +    /**
  +     * Gets the metadata for all the methods of this bean.  Each element in the
  +     * Set is of type MethodMetaData.
  +     * @see org.jboss.metadata.MethodMetaData
  +     */
       public Set getMethods();
  +
  +    /**
  +     * Gets the metadata for all the methods of this bean's home interface.
  +     * Each element in the Set is of type MethodMetaData.
  +     * @see org.jboss.metadata.MethodMetaData
  +     */
       public Set getHomeMethods();
  +
  +    /**
  +     * Gets the metadata for all the fields of this bean.  Each element in the
  +     * Set is of type FieldMetaData.
  +     * @see org.jboss.metadata.FieldMetaData
  +     */
       public Set getFields();
  +
  +    /**
  +     * Gets the EJB name of this bean.  This is the unique identifier for each
  +     * bean (it must be globally unique).
  +     */
       public String getName();
   }
  
  
  
  1.2       +12 -0     jboss/src/main/org/jboss/metadata/ContainerMetaData.java
  
  Index: ContainerMetaData.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/metadata/ContainerMetaData.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ContainerMetaData.java    2000/07/04 00:10:01     1.1
  +++ ContainerMetaData.java    2000/07/07 23:47:46     1.2
  @@ -1,6 +1,18 @@
  +/*
  + * jBoss, the OpenSource EJB server
  + *
  + * Distributable under GPL license.
  + * See terms of license at gnu.org.
  + */
   package org.jboss.metadata;
   
   import java.util.Set;
   
  +/**
  + * The metadata for a bean's Container.  In general, each bean may have
  + * its own ContainerMetaData, or multiple beans may share a single
  + * ContainerMetaData.  It depends on the configuration and container
  + * implementation.
  + */
   public interface ContainerMetaData extends MetaData {
   }
  
  
  
  1.2       +14 -0     jboss/src/main/org/jboss/metadata/FieldMetaData.java
  
  Index: FieldMetaData.java
  ===================================================================
  RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/metadata/FieldMetaData.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FieldMetaData.java        2000/07/04 00:10:01     1.1
  +++ FieldMetaData.java        2000/07/07 23:47:46     1.2
  @@ -1,5 +1,19 @@
  +/*
  + * jBoss, the OpenSource EJB server
  + *
  + * Distributable under GPL license.
  + * See terms of license at gnu.org.
  + */
   package org.jboss.metadata;
   
  +/**
  + * The metadata for a field of an EJB.  It is generally used to hold persistance
  + * properties, but other uses are possible.
  + */
   public interface FieldMetaData extends MetaData {
  +    /**
  +     * Gets the name of the field.  This is the unique identifier for a field
  +     * (within the scope of the owning EJB).
  +     */
       public String getName();
   }
  
  
  
  1.2       +46 -0     jboss/src/main/org/jboss/metadata/MetaData.java
  
  Index: MetaData.java
  ===================================================================
  RCS file: /products/cvs/ejboss/jboss/src/main/org/jboss/metadata/MetaData.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MetaData.java     2000/07/04 00:10:01     1.1
  +++ MetaData.java     2000/07/07 23:47:46     1.2
  @@ -1,11 +1,57 @@
  +/*
  + * jBoss, the OpenSource EJB server
  + *
  + * Distributable under GPL license.
  + * See terms of license at gnu.org.
  + */
   package org.jboss.metadata;
   
   import java.util.*;
   
  +/**
  + * The base class for all the metadata classes.  All the metadata type support
  + * named properties, which you can get or set.  In addition, individual metadata
  + * implementation may be part of a set, represented by the metadata manager.
  + * Each set generally holds all the metadata from a specific configuration file
  + * or source.
  + */
   public interface MetaData extends Map {
  +    /**
  +     * Tells whether this specific metadata has a property by the specified name.
  +     */
       public boolean hasProperty(String name);
  +
  +    /**
  +     * Gets a property by name.
  +     * @param name The name of the property you want
  +     * @return The value of the specified property, or null if the property
  +     *      exists but has not been set or has been set to null
  +     * @throws java.lang.IllegalArgumentException
  +     *      Occurs when the specified property does not exist
  +     */
       public Object getProperty(String name);
  +
  +    /**
  +     * Sets the value of a property.
  +     * @param name The name of the property you're setting
  +     * @param value The value you want to set for the specified property (may be
  +     *      null)
  +     * @throws java.lang.IllegalArgumentException
  +     *      Occurs when the specified property does not exist
  +     */
       public void setProperty(String name, Object value);
  +
  +    /**
  +     * Gets the names of all the properties present in this metadata.  These
  +     * properties may have a value of null, but they definitely exist.
  +     */
       public String[] getPropertyNames();
  +
  +
  +    /**
  +     * Gets the manager for the plugin that this metadata is a part of (i.e.
  +     * jBoss, JAWS, etc.).  This will be null if the metadata is not part of
  +     * a specific plugin (for example, if it is the aggregate of all plugins).
  +     */
       public MetaDataPlugin getManager();
   }
  
  
  
  1.2       +35 -0     jboss/src/main/org/jboss/metadata/MetaDataFactory.java
  
  Index: MetaDataFactory.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/metadata/MetaDataFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MetaDataFactory.java      2000/07/04 00:10:01     1.1
  +++ MetaDataFactory.java      2000/07/07 23:47:47     1.2
  @@ -1,3 +1,9 @@
  +/*
  + * jBoss, the OpenSource EJB server
  + *
  + * Distributable under GPL license.
  + * See terms of license at gnu.org.
  + */
   package org.jboss.metadata;
   
   import java.io.*;
  @@ -5,7 +11,18 @@
   import org.jboss.metadata.aggregate.AggregateServer;
   import org.jboss.metadata.io.*;
   
  +/**
  + * Serves as the global repository for metadata plugins, and can construct
  + * sets of metadata from the available plugins.  This does not handle a
  + * situation where some groups of plugins may be mutually exclusive.
  + * @see org.jboss.metadata.MetaDataPlugin
  + */
   public class MetaDataFactory {
  +
  +    /**
  +     * Holds the class names and Class variables for primitives.  Used to set
  +     * or decode properties that are stored in primitive variables.
  +     */
       public final static HashMap primitives = new HashMap();
       static {
           primitives.put("int", Integer.TYPE);
  @@ -19,14 +36,24 @@
       }
       private static MetaDataPlugin[] plugins = new MetaDataPlugin[0];
   
  +    /**
  +     * Gets the number of plugins that have registered.
  +     */
       public static int getPluginCount() {
           return plugins.length;
       }
   
  +    /**
  +     * Gets the plugin at a specified index.  Once registered, a plugin will
  +     * have the same index until the JVM is shut down.
  +     */
       public static MetaDataPlugin getPlugin(int index) {
           return plugins[index];
       }
   
  +    /**
  +     * Registers a new plugin.
  +     */
       public static void addPlugin(MetaDataPlugin plugin) {
           for(int i=0; i<plugins.length; i++)
               if(plugins[i].getClass().equals(plugin.getClass()))
  @@ -36,6 +63,10 @@
           plugins = (MetaDataPlugin[])list.toArray(new MetaDataPlugin[list.size()]);
       }
   
  +    /**
  +     * Loads XML files from a specified directory.  Probably should be enhanced
  +     * to handle URLs and JARs to be truly useful.
  +     */
       public static ServerMetaData loadXMLFile(File directory) {
           ServerMetaData[] list = new ServerMetaData[plugins.length];
           for(int i=0; i<list.length; i++) {
  @@ -52,6 +83,10 @@
           return new AggregateServer(list);
       }
   
  +    /**
  +     * Sample - you give it a directory, it loads XML files form there and
  +     * dumps metadata to the console.
  +     */
       public static void main(String params[]) {
           addPlugin(org.jboss.metadata.ejbjar.EJBPlugin.instance());
           addPlugin(org.jboss.metadata.jboss.JBossPlugin.instance());
  
  
  
  1.2       +41 -0     jboss/src/main/org/jboss/metadata/MetaDataPlugin.java
  
  Index: MetaDataPlugin.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/metadata/MetaDataPlugin.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MetaDataPlugin.java       2000/07/04 00:10:01     1.1
  +++ MetaDataPlugin.java       2000/07/07 23:47:47     1.2
  @@ -1,12 +1,53 @@
  +/*
  + * jBoss, the OpenSource EJB server
  + *
  + * Distributable under GPL license.
  + * See terms of license at gnu.org.
  + */
   package org.jboss.metadata;
   
   import org.jboss.metadata.io.*;
   
  +/**
  + * A metadata "plugin" - that is, all the metadata provided by a specific
  + * configuration file or resource.  This interface gives access to the Class
  + * object used to store each type of metadata, and Visitors that read in, write
  + * out, or reformat the metadata.
  + */
   public interface MetaDataPlugin {
  +    /**
  +     * Gets the implementation of ServerMetaData for the plugin.
  +     * @see org.jboss.metadata.ServerMetaData
  +     */
       public Class getServerClass();
  +
  +    /**
  +     * Gets the implementation of BeanMetaData for the plugin.
  +     * @see org.jboss.metadata.BeanMetaData
  +     */
       public Class getBeanClass();
  +
  +    /**
  +     * Gets the implementation of ContainerMetaData for the plugin.
  +     * @see org.jboss.metadata.ContainerMetaData
  +     */
       public Class getContainerClass();
  +
  +    /**
  +     * Gets the implementation of MethodMetaData for the plugin.
  +     * @see org.jboss.metadata.MethodMetaData
  +     */
       public Class getMethodClass();
  +
  +    /**
  +     * Gets the implementation of FieldMetaData for the plugin.
  +     * @see org.jboss.metadata.FieldMetaData
  +     */
       public Class getFieldClass();
  +
  +    /**
  +     * Gets the implementation of XMLReader for the plugin.
  +     * @see org.jboss.metadata.io.XMLReader
  +     */
       public XMLReader getXMLReader();
   }
  
  
  
  1.2       +18 -0     jboss/src/main/org/jboss/metadata/MethodMetaData.java
  
  Index: MethodMetaData.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/metadata/MethodMetaData.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MethodMetaData.java       2000/07/04 00:10:01     1.1
  +++ MethodMetaData.java       2000/07/07 23:47:47     1.2
  @@ -1,6 +1,24 @@
  +/*
  + * jBoss, the OpenSource EJB server
  + *
  + * Distributable under GPL license.
  + * See terms of license at gnu.org.
  + */
   package org.jboss.metadata;
   
  +/**
  + * The metadata for one method of an EJB or the EJB's home interface.
  + */
   public interface MethodMetaData extends MetaData {
  +    /**
  +     * Gets the name of this method.  The name and parameter class types of a
  +     * method together are the unique identifier.
  +     */
       public String getName();
  +
  +    /**
  +     * Gets the parameter types of this method.  The name and parameter class
  +     * types of a method together are the unique identifier.
  +     */
       public Class[] getParameterTypes();
   }
  
  
  
  1.2       +24 -0     jboss/src/main/org/jboss/metadata/ServerMetaData.java
  
  Index: ServerMetaData.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/metadata/ServerMetaData.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServerMetaData.java       2000/07/04 00:10:02     1.1
  +++ ServerMetaData.java       2000/07/07 23:47:47     1.2
  @@ -1,8 +1,32 @@
  +/*
  + * jBoss, the OpenSource EJB server
  + *
  + * Distributable under GPL license.
  + * See terms of license at gnu.org.
  + */
   package org.jboss.metadata;
   
   import java.util.Set;
   
  +/**
  + * The metadata for a server.  This is generally just a collection of all the
  + * EJBs and related metadata that appear in a particular configuration file
  + * or resource.  Most of the properties are stored in the metadata for the
  + * beans, containers, etc.
  + */
   public interface ServerMetaData extends MetaData {
  +    /**
  +     * Gets the metadata for all the beans available here.  Each element of the
  +     * Set is of type org.jboss.metadata.BeanMetaData.
  +     * @see org.jboss.metadata.BeanMetaData
  +     */
       public Set getBeans();
  +
  +    /**
  +     * Gets the metadata for one bean available here.  Each bean is identified
  +     * by its unique EJB name.
  +     * @throws java.lang.IllegalArgumentException
  +     *      Occurs when no bean with the specified name can be found.
  +     */
       public BeanMetaData getBean(String name);
   }
  
  
  

Reply via email to