[jboss-cvs] JBossAS SVN: r81429 - projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/factory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Nov 21 09:37:55 EST 2008


Author: alesj
Date: 2008-11-21 09:37:55 -0500 (Fri, 21 Nov 2008)
New Revision: 81429

Added:
   projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectDefinition.java
Log:
[JBAS-6225]; add mo definition.

Added: projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectDefinition.java
===================================================================
--- projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectDefinition.java	                        (rev 0)
+++ projects/jboss-man/trunk/managed/src/main/java/org/jboss/managed/api/factory/ManagedObjectDefinition.java	2008-11-21 14:37:55 UTC (rev 81429)
@@ -0,0 +1,141 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.managed.api.factory;
+
+import org.jboss.managed.spi.factory.ManagedObjectBuilder;
+
+/**
+ * Managed object definition.
+ *
+ * @author <a href="mailto:ales.justin at jboss.org">Ales Justin</a>
+ */
+public class ManagedObjectDefinition
+{
+   private ManagedObjectFactory factory;
+
+   private Class<?> type;
+   private ManagedObjectBuilder builder;
+
+   public ManagedObjectDefinition()
+   {
+   }
+
+   public ManagedObjectDefinition(ManagedObjectFactory factory)
+   {
+      this.factory = factory;
+   }
+
+   public ManagedObjectDefinition(ManagedObjectFactory factory, Class<?> type, ManagedObjectBuilder builder)
+   {
+      this(factory);
+      this.type = type;
+      this.builder = builder;
+   }
+
+   /**
+    * Add builder to factory.
+    */
+   public void start()
+   {
+      if (factory == null)
+         throw new IllegalArgumentException("Missing managed object factory");
+      if (type == null)
+         throw new IllegalArgumentException("Missing type");
+      if (builder == null)
+         throw new IllegalArgumentException("Missing builder");
+
+      factory.setBuilder(type, builder);
+   }
+
+   /**
+    * Remove builder from factory.
+    */
+   public void stop()
+   {
+      if (factory == null)
+         throw new IllegalArgumentException("Missing managed object factory");
+      if (type == null)
+         throw new IllegalArgumentException("Missing type");
+
+      factory.setBuilder(type, null);
+   }
+
+   /**
+    * Get managed obejct factory.
+    *
+    * @return the managed object factory
+    */
+   public ManagedObjectFactory getFactory()
+   {
+      return factory;
+   }
+
+   /**
+    * Set managed object factory.
+    *
+    * @param factory the managed object factory
+    */
+   public void setFactory(ManagedObjectFactory factory)
+   {
+      this.factory = factory;
+   }
+
+   /**
+    * Get type.
+    *
+    * @return the type
+    */
+   public Class<?> getType()
+   {
+      return type;
+   }
+
+   /**
+    * Set type.
+    *
+    * @param type the type
+    */
+   public void setType(Class<?> type)
+   {
+      this.type = type;
+   }
+
+   /**
+    * Get builder.
+    *
+    * @return the builder
+    */
+   public ManagedObjectBuilder getBuilder()
+   {
+      return builder;
+   }
+
+   /**
+    * Set builder.
+    *
+    * @param builder the builder
+    */
+   public void setBuilder(ManagedObjectBuilder builder)
+   {
+      this.builder = builder;
+   }
+}




More information about the jboss-cvs-commits mailing list