1 Reply Latest reply on Dec 19, 2006 8:30 AM by Adrian Brock

    New Microcontainer projects

    Adrian Brock Master

      NEW MICROCONTAINER PROJECTS

      Mainly because Sacha was nagging me about not committing stuff,
      I've added two projects to the microcontainer project
      (they only include what I think is "stable")
      http:/anonsvn.jboss.org/repos/jbossas/projects/microcontainer/trunk/

      metatype - which will an extended version of the open mbean stuff
      managed - managed object support

      MOCK MANAGED OBJECT

      The managed project is little more than attempt to write the mock
      that Charles was talking about.
      It implements a trivial managed object based on XML element names as properties.

      REAL MANAGED OBJECTS

      Most of the work that currently I'm doing is to "generate" these managed object
      implementations from annotations, xml overrides, etc.
      Although there is no reason why a deployer couldn't just hand code one.

      ASPECTIZED

      The api that exists in managed will be replaced in the full version
      with an aspectized version such that we can plugin different behaviours
      such as:
      * custom persistence/version policies
      * server updates
      * etc.

      Obviously the concurrent server udpates will depend upon whether the user
      is "working offline" and whether the managed object supports single
      property updates or needs a full redeploy for that property.
      Additionally, there will be a notion of which servers to update (e.g. a cluster/domain).

      INITIAL ASPECTS

      The first implementation will just feedback changes into Scott's repository
      for perisistent and will probably be single server.

      FACTORY

      I haven't included a managed object factory api.
      Most managed objects will be coming from the deployers
      which will be able to choose implementation details (e.g.
      annotating their metadata classes) rather than having
      to implement it themselves.

      RUNTIME CHANGES WITHOUT REDEPLOYMENT

      For none MBean/MC metadata the deployer will also have to provide
      some code if it wants to support non-trivial runtime property changes,
      i.e. just updating the metadata doesn't lead the change taking affect.

      e.g. datasource properties which need to be applied from the metadata
      onto the connection factory or XADataSource, but can still potentially
      be support at runtime if you flush the pool

      In fact, the latter is not a good example since there is already
      code in the MCF MBean that knows how to do this, though it is little
      known/used so I'm not sure if it actually works properly :-)

      I expect most of the more complicated deployments (e.g. EJB/WEB) will require
      a full redeploy for most changes?

        • 1. Re: New Microcontainer projects
          Adrian Brock Master

          The Mock DataSource "test" can be found in the managed project
          org.jboss.managed.mock.Test

          This is mainly just an example of what I expect the user api to look like.
          Please don't add "tests" here, yet!

           public static void main(String[] args) throws Exception
           {
           MockDataSourceManagedObject mo = new MockDataSourceManagedObject();
          
           System.out.println("MockDataSourceManagedObject, available propertes...\n");
           System.out.println(mo.getPropertyNames());
          
           System.out.println("\nInitial MetaData...\n");
           System.out.println(mo.prettyPrint());
          
           System.out.println("\nAdding jndi-name...\n");
           mo.getProperty("jndi-name").setValue("DefaultDS");
           System.out.println(mo.prettyPrint());
          
           System.out.println("\nAdding user and password...\n");
           mo.getProperty("user").setValue("Scott");
           mo.getProperty("password").setValue("Tiger");
           System.out.println(mo.prettyPrint());
          
           System.out.println("\nChanging jndi-name...\n");
           mo.getProperty("jndi-name").setValue("ChangedDS");
           System.out.println(mo.prettyPrint());
          
           System.out.println("\nRemoving jndi-name...\n");
           mo.getProperty("jndi-name").setValue(null);
           System.out.println(mo.prettyPrint());
           }
          


          Which produces the following output
          [ejort@warjort managed]$ ./build.sh mock
          <snip/>
          
          mock:
           [java] MockDataSourceManagedObject, available propertes...
          
           [java] [password, jndi-name, user, connection-url]
          
           [java] Initial MetaData...
          
           [java] <data-source/>
          
           [java] Adding jndi-name...
          
           [java] <data-source>
           [java] <jndi-name>DefaultDS</jndi-name>
           [java] </data-source>
          
           [java] Adding user and password...
          
           [java] <data-source>
           [java] <jndi-name>DefaultDS</jndi-name>
           [java] <user>Scott</user>
           [java] <password>Tiger</password>
           [java] </data-source>
          
           [java] Changing jndi-name...
          
           [java] <data-source>
           [java] <jndi-name>ChangedDS</jndi-name>
           [java] <user>Scott</user>
           [java] <password>Tiger</password>
           [java] </data-source>
          
           [java] Removing jndi-name...
          
           [java] <data-source>
           [java] <user>Scott</user>
           [java] <password>Tiger</password>
           [java] </data-source>