[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2002-01-12 Thread Adrian Brock

  User: ejort   
  Date: 02/01/12 13:14:26

  Modified:src/main/org/jboss/configuration ConfigurationService.java
  Log:
  Remove directory reference to log4j Category in preparation for log4j 1.2
  
  Revision  ChangesPath
  1.43  +14 -15jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- ConfigurationService.java 2002/01/05 08:16:08 1.42
  +++ ConfigurationService.java 2002/01/12 21:14:25 1.43
  @@ -35,7 +35,7 @@
   import javax.management.RuntimeErrorException;
   import javax.management.RuntimeMBeanException;
   import javax.management.RuntimeOperationsException;
  - 
  +
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   import org.w3c.dom.NodeList;
  @@ -44,9 +44,8 @@
   import org.xml.sax.SAXException;
   import javax.xml.parsers.DocumentBuilderFactory;
   import javax.xml.parsers.DocumentBuilder;
  -
  -import org.apache.log4j.Category;
   
  +import org.jboss.logging.Logger;
   import org.jboss.system.Service;
   import org.jboss.system.ServiceFactory;
   import org.jboss.system.ServiceMBeanSupport;
  @@ -67,7 +66,7 @@
* @author  a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a.
* @author  a href=mailto:[EMAIL PROTECTED];Scott Stark/a.
* @author  a href=mailto:[EMAIL PROTECTED];Jason Dillon/a
  - * @version $Revision: 1.42 $
  + * @version $Revision: 1.43 $
* Revisions:
*
* 20010622 scott.stark: Clean up the unsafe downcast of Throwable to Exception
  @@ -78,13 +77,13 @@
   {
  /** The name of the file initial configuration is read from. */
  public static final String CONFIGURATION_FILE = jboss.jcml;
  -   
  +
  /** The name of the file that running state will be written into. */
  public static final String RUNNING_STATE_FILE = jboss-auto.jcml;
  -   
  +
  /** Primitive type name - class map. */
  private static Hashtable primitives = new Hashtable();
  -   
  +
  /** Setup the primitives map. */
  static
  {
  @@ -100,7 +99,7 @@
   * corresponding index into the ServiceProxy.hasOp array.
   */
  private static HashMap serviceOpMap = new HashMap();
  -   
  +
  /**
   * Initialize the service operation map.
   */
  @@ -111,20 +110,20 @@
 serviceOpMap.put(destroy, new Integer(2));
 serviceOpMap.put(stop, new Integer(3));
  }
  -   
  -   
  +
  +
  /** Instance logger. */
  -   private final Category log = Category.getInstance(this.getClass());
  -   
  +   private Logger log = Logger.getLogger(getClass());
  +
  /** The MBean server which this service is registered in. */
  private MBeanServer server;
  -   
  +
  /** The name of the ServiceControl service. */
  private ObjectName serviceControl;
  -   
  +
  /** Flag to indicate if attribute values should be automatically trimmed. */
  private boolean autoTrim;
  -   
  +
  // Constructors --
  
  /**
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2002-01-05 Thread Adrian Brock

  User: ejort   
  Date: 02/01/05 00:16:08

  Modified:src/main/org/jboss/configuration ConfigurationService.java
  Log:
  Guarded debug logging
  
  Revision  ChangesPath
  1.42  +22 -15jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- ConfigurationService.java 2001/12/18 22:20:32 1.41
  +++ ConfigurationService.java 2002/01/05 08:16:08 1.42
  @@ -67,7 +67,7 @@
* @author  a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a.
* @author  a href=mailto:[EMAIL PROTECTED];Scott Stark/a.
* @author  a href=mailto:[EMAIL PROTECTED];Jason Dillon/a
  - * @version $Revision: 1.41 $
  + * @version $Revision: 1.42 $
* Revisions:
*
* 20010622 scott.stark: Clean up the unsafe downcast of Throwable to Exception
  @@ -197,7 +197,9 @@
 if (server.isRegistered(serviceControl) == false)
throw new IllegalStateException
(Failed to find ServiceControl mbean, name= + serviceControl);
  -  
  +
  +  boolean debug = log.isDebugEnabled();
  +
 try
 {
// Set configuration to MBeans from XML
  @@ -205,7 +207,7 @@
for (int i = 0; i  nl.getLength(); i++)
{
   Element mbeanElement = (Element)nl.item(i);
  -
  +
   // get the name of the mbean
   ObjectName objectName = parseObjectName(mbeanElement);
   MBeanInfo info;
  @@ -218,7 +220,7 @@
  // It's ok, skip to next one
  continue;
   }
  -
  +
   // Set attributes
   NodeList attrs = mbeanElement.getElementsByTagName(attribute);
   for (int j = 0; j  attrs.getLength(); j++)
  @@ -228,12 +230,12 @@
  if (attributeElement.hasChildNodes())
  {
 String attributeValue = 
((Text)attributeElement.getFirstChild()).getData();
  -  
  +
 if (autoTrim)
 {
attributeValue = attributeValue.trim();
 }
  -  
  +
 MBeanAttributeInfo[] attributes = info.getAttributes();
 for (int k = 0; k  attributes.length; k++)
 {
  @@ -255,10 +257,11 @@
  editor.setAsText(attributeValue);
  value = editor.getValue();
   }
  -
  -log.debug(attributeName +  set to  + attributeValue +  
in  + objectName);
  +
  +if (debug)
  +   log.debug(attributeName +  set to  + attributeValue + 
 in  + objectName);
   server.setAttribute(objectName, new 
Attribute(attributeName, value));
  -
  +
   break;
}
 }
  @@ -275,7 +278,7 @@
throw new ConfigurationException(Unexpected Error, e);
 }
  }
  -   
  +
  /**
   * Builds a string that consists of the configuration elements of
   * the currently running MBeans registered in the server.
  @@ -284,14 +287,16 @@
   */
  public String save() throws Exception
  {
  +  boolean debug = log.isDebugEnabled();
  +
 Writer out = new StringWriter();
  -  
  +
 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
 DocumentBuilder builder = factory.newDocumentBuilder();
 Document doc = builder.newDocument();
  -  
  +
 Element serverElement = doc.createElement(server);
  -  
  +
 // Store attributes as XML
 Iterator mbeans = server.queryMBeans(null, null).iterator();
 while (mbeans.hasNext())
  @@ -300,18 +305,20 @@
ObjectName name = (ObjectName)instance.getObjectName();
Element mbeanElement = doc.createElement(mbean);
mbeanElement.setAttribute(name, name.toString());
  - 
  +
MBeanInfo info = server.getMBeanInfo(name);
mbeanElement.setAttribute(code, info.getClassName());
MBeanAttributeInfo[] attributes = info.getAttributes();
boolean hasAttributes = true;
  +
for (int i = 0; i  attributes.length; i++)
{
   if (attributes[i].isReadable()  
isAttributeWriteable(server.getObjectInstance(name).getClassName(), 
attributes[i].getName(), attributes[i].getType()))
   {
  if (!attributes[i].isWritable())
  {
  -  log.debug(Detected JMX Bug: Server reports attribute 

[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-12-18 Thread marc fleury

  User: mnf999  
  Date: 01/12/18 14:20:32

  Modified:src/main/org/jboss/configuration ConfigurationService.java
  Log:
  init()-create()
  
  Revision  ChangesPath
  1.41  +2 -2  jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- ConfigurationService.java 2001/10/19 01:20:26 1.40
  +++ ConfigurationService.java 2001/12/18 22:20:32 1.41
  @@ -67,7 +67,7 @@
* @author  a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a.
* @author  a href=mailto:[EMAIL PROTECTED];Scott Stark/a.
* @author  a href=mailto:[EMAIL PROTECTED];Jason Dillon/a
  - * @version $Revision: 1.40 $
  + * @version $Revision: 1.41 $
* Revisions:
*
* 20010622 scott.stark: Clean up the unsafe downcast of Throwable to Exception
  @@ -106,7 +106,7 @@
   */
  static
  {
  -  serviceOpMap.put(init, new Integer(0));
  +  serviceOpMap.put(create, new Integer(0));
 serviceOpMap.put(start, new Integer(1));
 serviceOpMap.put(destroy, new Integer(2));
 serviceOpMap.put(stop, new Integer(3));
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-12-04 Thread Scott M Stark

  User: starksm 
  Date: 01/12/04 10:38:53

  Modified:src/main/org/jboss/configuration Tag: Branch_2_4
ConfigurationService.java
  Log:
  Change the support of arbitrary mbean configuration to be based on
  attribute child nodes as is done in main for consistency.
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.30.2.5  +41 -33jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.30.2.4
  retrieving revision 1.30.2.5
  diff -u -r1.30.2.4 -r1.30.2.5
  --- ConfigurationService.java 2001/11/20 09:42:47 1.30.2.4
  +++ ConfigurationService.java 2001/12/04 18:38:52 1.30.2.5
  @@ -39,6 +39,7 @@
   
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
  +import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
   import org.w3c.dom.Text;
   import org.xml.sax.InputSource;
  @@ -67,7 +68,7 @@
* @author  Rickard Öberg ([EMAIL PROTECTED])
* @author  [EMAIL PROTECTED]
* @author  Jason Dillon a 
href=mailto:[EMAIL PROTECTED];lt;[EMAIL PROTECTED]gt;/a
  - * @version $Revision: 1.30.2.4 $
  + * @version $Revision: 1.30.2.5 $
*/
   public class ConfigurationService
  extends ServiceMBeanSupport
  @@ -220,13 +221,16 @@
  String attributeName = attributeElement.getAttribute(name);
  if (attributeElement.hasChildNodes())
  {
  -  String attributeValue = 
((Text)attributeElement.getFirstChild()).getData();
  -  
  -  if (autoTrim)
  +  Node n = attributeElement.getFirstChild();
  +  // Check for a text value
  +  String attributeText = null;
  +  if( n instanceof Text )
 {
  - attributeValue = attributeValue.trim();
  + attributeText = ((Text)n).getData();
  + if( autoTrim )
  +attributeText = attributeText.trim();
 }
  -  
  +
 MBeanAttributeInfo[] attributes = info.getAttributes();
 for (int k = 0; k  attributes.length; k++)
 {
  @@ -241,13 +245,32 @@
   else
   {
  typeClass = Class.forName(typeName);
  +}
  +Object value = attributeText;
  +// Check for Element type attribute
  +if( Element.class.isAssignableFrom(typeClass) )
  +{
  +   // The attribute is an Element
  +   NodeList nodes = attributeElement.getChildNodes();
  +   for(int l=0; l  nodes.getLength(); l++)
  +   {
  +  n = nodes.item(l);
  +  if (n.getNodeType() == Node.ELEMENT_NODE)
  +  {
  + value = (Element) n;
  + break;
  +  }
  +   }
   }
  -PropertyEditor editor = 
PropertyEditorManager.findEditor(typeClass);
  -Object value = attributeValue;
  -if( editor != null )
  +else
   {
  -   editor.setAsText(attributeValue);
  -   value = editor.getValue();
  +   // Get the property value from the string presentation
  +   PropertyEditor editor = 
PropertyEditorManager.findEditor(typeClass);
  +   if( editor != null )
  +   {
  +  editor.setAsText(attributeText);
  +  value = editor.getValue();
  +   }
   }
   log.debug(attributeName +  set to  + value +  in  + 
objectName);
   server.setAttribute(objectName, new 
Attribute(attributeName, value));
  @@ -257,35 +280,20 @@
 }
  }
   }
  -/* Look for a config element and if it exists invoke the 
importXml(Element)
  - operation to allow the MBean to support its own arbitrary 
configuration.
  -*/
  -NodeList configs = mbeanElement.getElementsByTagName(config);
  -if( configs.getLength()  0 )
  -{
  -   Element configElement = (Element) 

[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-11-20 Thread Scott M Stark

  User: starksm 
  Date: 01/11/20 01:42:48

  Modified:src/main/org/jboss/configuration Tag: Branch_2_4
ConfigurationService.java
  Log:
  Change to the unified log4j based org.jboss.logging.Logger class.
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.30.2.4  +14 -15jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.30.2.3
  retrieving revision 1.30.2.4
  diff -u -r1.30.2.3 -r1.30.2.4
  --- ConfigurationService.java 2001/11/12 19:31:07 1.30.2.3
  +++ ConfigurationService.java 2001/11/20 09:42:47 1.30.2.4
  @@ -46,7 +46,7 @@
   import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.DocumentBuilderFactory;
   
  -import org.jboss.logging.Log;
  +import org.jboss.logging.Logger;
   import org.jboss.util.Service;
   import org.jboss.util.ServiceFactory;
   import org.jboss.util.ServiceMBeanSupport;
  @@ -67,7 +67,7 @@
* @author  Rickard Öberg ([EMAIL PROTECTED])
* @author  [EMAIL PROTECTED]
* @author  Jason Dillon a 
href=mailto:[EMAIL PROTECTED];lt;[EMAIL PROTECTED]gt;/a
  - * @version $Revision: 1.30.2.3 $
  + * @version $Revision: 1.30.2.4 $
*/
   public class ConfigurationService
  extends ServiceMBeanSupport
  @@ -108,11 +108,7 @@
 serviceOpMap.put(destroy, new Integer(2));
 serviceOpMap.put(stop, new Integer(3));
  }
  -   
  -   
  -   /** Instance logger. */
  -   private final Log log = Log.createLog(getName());
  -   
  +
  /** The MBean server which this service is registered in. */
  private MBeanServer server;
  
  @@ -390,8 +386,7 @@
catch (FileNotFoundException e)
{
   log.error(Configuration file  + confFile.getFile() +
  - must be available and writable.);
  -log.exception(e);
  + must be available and writable., e);
}
finally
{
  @@ -685,9 +680,8 @@
 info = server.getMBeanInfo(instance.getObjectName());
  } catch (Throwable ex)
  {
  -  log.error(Could not create MBean  +
  -  objectName + ( + code + ));
  -  logException(ex);
  +  logException(Could not create MBean  +
  +  objectName + ( + code + ), ex);
 
 // Ah what the heck.. skip it
 continue;
  @@ -813,7 +807,7 @@
   server.invoke(serviceControl, register, args, signature);
} catch (Exception e)
{
  -logException(e);
  +logException(register failure, e);
}
 }
  }
  @@ -861,6 +855,10 @@
   */
  private void logException(Throwable e)
  {
  +  logException(Unexpected error, e);
  +   }
  +   private void logException(String msg, Throwable e)
  +   {
 if (e instanceof RuntimeErrorException)
 {
e = ((RuntimeErrorException)e).getTargetError();
  @@ -878,7 +876,7 @@
e = ((ReflectionException)e).getTargetException();
 }
 
  -  log.exception(e);
  +  log.error(msg, e);
  }
  
  /**
  @@ -889,6 +887,7 @@
   * matching operation is forwarded to the mbean by invoking the method
   * through the MBeanServer object.
   */
  +   static Logger proxyLog = Logger.getLogger(ServiceProxy.class);
  private class ServiceProxy implements InvocationHandler
  {
 private boolean[] hasOp = { false, false, false, false };
  @@ -931,7 +930,7 @@
// Log a warning if the mbean does not implement
// any Service methods
if (opCount == 0)
  -log.warning(objectName +  does not implement any Service methods);
  +proxyLog.warn(objectName +  does not implement any Service methods);
 }
 
 /**
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-11-12 Thread Scott M Stark

  User: starksm 
  Date: 01/11/12 11:31:07

  Modified:src/main/org/jboss/configuration Tag: Branch_2_4
ConfigurationService.java
  Log:
  Add support for a mbean/config element that allows an mbean to import an
  arbitrary XML configuration tree if it implements the importXml(Element)
  method.
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.30.2.3  +125 -102  jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.30.2.2
  retrieving revision 1.30.2.3
  diff -u -r1.30.2.2 -r1.30.2.3
  --- ConfigurationService.java 2001/10/19 01:31:29 1.30.2.2
  +++ ConfigurationService.java 2001/11/12 19:31:07 1.30.2.3
  @@ -8,7 +8,8 @@
   package org.jboss.configuration;
   
   import java.io.*;
  -import java.beans.*;
  +import java.beans.PropertyEditor;
  +import java.beans.PropertyEditorManager;
   import java.lang.reflect.Constructor;
   import java.lang.reflect.InvocationHandler;
   import java.lang.reflect.Method;
  @@ -19,11 +20,31 @@
   import java.util.Hashtable;
   import java.util.Iterator;
   
  -import javax.management.*;
  +import javax.management.Attribute;
  +import javax.management.InstanceNotFoundException;
  +import javax.management.JMException;
  +import javax.management.JMRuntimeException;
  +import javax.management.MalformedObjectNameException;
  +import javax.management.MBeanAttributeInfo;
  +import javax.management.MBeanInfo;
  +import javax.management.MBeanOperationInfo;
  +import javax.management.MBeanServer;
  +import javax.management.ObjectInstance;
  +import javax.management.ObjectName;
  +import javax.management.RuntimeErrorException;
  +import javax.management.RuntimeMBeanException;
  +import javax.management.RuntimeOperationsException;
  +import javax.management.MBeanException;
  +import javax.management.ReflectionException;
   
  -import org.w3c.dom.*;
  -import org.xml.sax.*;
  -import javax.xml.parsers.*;
  +import org.w3c.dom.Document;
  +import org.w3c.dom.Element;
  +import org.w3c.dom.NodeList;
  +import org.w3c.dom.Text;
  +import org.xml.sax.InputSource;
  +import org.xml.sax.SAXException;
  +import javax.xml.parsers.DocumentBuilder;
  +import javax.xml.parsers.DocumentBuilderFactory;
   
   import org.jboss.logging.Log;
   import org.jboss.util.Service;
  @@ -46,11 +67,11 @@
* @author  Rickard Öberg ([EMAIL PROTECTED])
* @author  [EMAIL PROTECTED]
* @author  Jason Dillon a 
href=mailto:[EMAIL PROTECTED];lt;[EMAIL PROTECTED]gt;/a
  - * @version $Revision: 1.30.2.2 $
  + * @version $Revision: 1.30.2.3 $
*/
   public class ConfigurationService
  -extends ServiceMBeanSupport
  -implements ConfigurationServiceMBean
  +   extends ServiceMBeanSupport
  +   implements ConfigurationServiceMBean
   {
  /** The name of the file initial configuration is read from. */
  public static final String CONFIGURATION_FILE = jboss.jcml;
  @@ -187,18 +208,19 @@
   try
   {
  info = server.getMBeanInfo(objectName);
  -} catch (InstanceNotFoundException e)
  +}
  +catch (InstanceNotFoundException e)
   {
  // The MBean is no longer available
  // It's ok, skip to next one
  continue;
   }
  -
  +
   // Set attributes
   NodeList attrs = mbeanElement.getElementsByTagName(attribute);
   for (int j = 0; j  attrs.getLength(); j++)
   {
  -   Element attributeElement = (Element)attrs.item(j);
  +   Element attributeElement = (Element) attrs.item(j);
  String attributeName = attributeElement.getAttribute(name);
  if (attributeElement.hasChildNodes())
  {
  @@ -239,7 +261,25 @@
 }
  }
   }
  -
  +/* Look for a config element and if it exists invoke the 
importXml(Element)
  + operation to allow the MBean to support its own arbitrary 
configuration.
  +*/
  +NodeList configs = mbeanElement.getElementsByTagName(config);
  +if( configs.getLength()  0 )
  +{
  +   Element configElement = (Element) configs.item(0);
  +   Object[] args = { configElement };
  +   String[] signature = { org.w3c.dom.Element };
  +   try
  +   {
  +  server.invoke(objectName, importXml, args, signature);
  +   }
  +   catch(Exception e)
  +   {
  +  logException(e);
  +   }
  +}
  +
   // Register the mbean with the 

[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-10-18 Thread Scott M Stark

  User: starksm 
  Date: 01/10/18 18:20:26

  Modified:src/main/org/jboss/configuration ConfigurationService.java
  Log:
  Only use the property editor if it is not null
  
  Revision  ChangesPath
  1.40  +7 -3  jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- ConfigurationService.java 2001/08/30 03:03:31 1.39
  +++ ConfigurationService.java 2001/10/19 01:20:26 1.40
  @@ -67,7 +67,7 @@
* @author  a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a.
* @author  a href=mailto:[EMAIL PROTECTED];Scott Stark/a.
* @author  a href=mailto:[EMAIL PROTECTED];Jason Dillon/a
  - * @version $Revision: 1.39 $
  + * @version $Revision: 1.40 $
* Revisions:
*
* 20010622 scott.stark: Clean up the unsafe downcast of Throwable to Exception
  @@ -249,8 +249,12 @@
  typeClass = Class.forName(typeName);
   }
   PropertyEditor editor = 
PropertyEditorManager.findEditor(typeClass);
  -editor.setAsText(attributeValue);
  -Object value = editor.getValue();
  +Object value = attributeValue;
  +if( editor != null )
  +{
  +   editor.setAsText(attributeValue);
  +   value = editor.getValue();
  +}
   
   log.debug(attributeName +  set to  + attributeValue +  
in  + objectName);
   server.setAttribute(objectName, new 
Attribute(attributeName, value));
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-07-30 Thread Jason Dillon

  User: user57  
  Date: 01/07/30 17:28:40

  Modified:src/main/org/jboss/configuration Tag: jboss_buildmagic
ConfigurationService.java
  Log:
   o updating from main
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.36.2.1  +2 -2  jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.36
  retrieving revision 1.36.2.1
  diff -u -r1.36 -r1.36.2.1
  --- ConfigurationService.java 2001/07/19 20:17:18 1.36
  +++ ConfigurationService.java 2001/07/31 00:28:40 1.36.2.1
  @@ -67,7 +67,7 @@
* @author  a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a.
* @author  a href=mailto:[EMAIL PROTECTED];Scott Stark/a.
* @author  a href=mailto:[EMAIL PROTECTED];Jason Dillon/a
  - * @version $Revision: 1.36 $
  + * @version $Revision: 1.36.2.1 $
* Revisions:
*
* 20010622 scott.stark: Clean up the unsafe downcast of Throwable to Exception
  @@ -661,7 +661,7 @@
  {
 log.error(Could not create MBean  +
   objectName + ( + code + ), ex);
  -  
  +  logException(ex);
 // Ah what the heck.. skip it
 continue;
  }
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-07-19 Thread Scott M Stark

  User: starksm 
  Date: 01/07/19 03:24:08

  Modified:src/main/org/jboss/configuration Tag: Branch_2_4
ConfigurationService.java
  Log:
  Add an eol character to each line read from the jboss.jcml file to preserve
  line oriented content
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.30.2.1  +10 -5 jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.30
  retrieving revision 1.30.2.1
  diff -u -r1.30 -r1.30.2.1
  --- ConfigurationService.java 2001/06/16 05:53:38 1.30
  +++ ConfigurationService.java 2001/07/19 10:24:08 1.30.2.1
  @@ -46,7 +46,7 @@
* @author  Rickard Öberg ([EMAIL PROTECTED])
* @author  [EMAIL PROTECTED]
* @author  Jason Dillon a 
href=mailto:[EMAIL PROTECTED];lt;[EMAIL PROTECTED]gt;/a
  - * @version $Revision: 1.30 $
  + * @version $Revision: 1.30.2.1 $
*/
   public class ConfigurationService
   extends ServiceMBeanSupport
  @@ -351,12 +351,17 @@
   BufferedReader br = new BufferedReader(new InputStreamReader(input));
   
   String sTmp;
  -
  -try {
  -while((sTmp = br.readLine())!=null){
  +String eol = System.getProperty(line.separator);
  +try
  +{
  +while((sTmp = br.readLine())!=null)
  +{
  sbufData.append(sTmp);
  +   sbufData.append(eol);
   }
  -} finally {
  +}
  +finally
  +{
   input.close();
   }
   //Modification Ends
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-07-19 Thread Scott M Stark

  User: starksm 
  Date: 01/07/19 10:09:54

  Modified:src/main/org/jboss/configuration ConfigurationService.java
  Log:
  Add eol to each line read from jboss.jcml
  
  Revision  ChangesPath
  1.35  +3 -2  jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- ConfigurationService.java 2001/07/06 03:17:09 1.34
  +++ ConfigurationService.java 2001/07/19 17:09:54 1.35
  @@ -67,7 +67,7 @@
* @author  a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a.
* @author  a href=mailto:[EMAIL PROTECTED];Scott Stark/a.
* @author  a href=mailto:[EMAIL PROTECTED];Jason Dillon/a
  - * @version $Revision: 1.34 $
  + * @version $Revision: 1.35 $
* Revisions:
*
* 20010622 scott.stark: Clean up the unsafe downcast of Throwable to Exception
  @@ -404,12 +404,13 @@
 BufferedReader br = new BufferedReader(new InputStreamReader(input));
 
 String sTmp;
  -  
  +  String eol = System.getProperty(line.seperator);
 try
 {
while((sTmp = br.readLine())!=null)
{
   sbufData.append(sTmp);
  +sbufData.append(eol);
}
 }
 finally
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-07-19 Thread Scott M Stark

  User: starksm 
  Date: 01/07/19 13:17:18

  Modified:src/main/org/jboss/configuration ConfigurationService.java
  Log:
  Fix typo in eol property name
  
  Revision  ChangesPath
  1.36  +2 -2  jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- ConfigurationService.java 2001/07/19 17:09:54 1.35
  +++ ConfigurationService.java 2001/07/19 20:17:18 1.36
  @@ -67,7 +67,7 @@
* @author  a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a.
* @author  a href=mailto:[EMAIL PROTECTED];Scott Stark/a.
* @author  a href=mailto:[EMAIL PROTECTED];Jason Dillon/a
  - * @version $Revision: 1.35 $
  + * @version $Revision: 1.36 $
* Revisions:
*
* 20010622 scott.stark: Clean up the unsafe downcast of Throwable to Exception
  @@ -404,7 +404,7 @@
 BufferedReader br = new BufferedReader(new InputStreamReader(input));
 
 String sTmp;
  -  String eol = System.getProperty(line.seperator);
  +  String eol = System.getProperty(line.separator);
 try
 {
while((sTmp = br.readLine())!=null)
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-07-05 Thread Jason Dillon

  User: user57  
  Date: 01/07/05 20:17:09

  Modified:src/main/org/jboss/configuration ConfigurationService.java
  Log:
   o using Log4j to log.
  
  Revision  ChangesPath
  1.34  +11 -12jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- ConfigurationService.java 2001/06/23 03:55:35 1.33
  +++ ConfigurationService.java 2001/07/06 03:17:09 1.34
  @@ -45,7 +45,8 @@
   import javax.xml.parsers.DocumentBuilderFactory;
   import javax.xml.parsers.DocumentBuilder;
   
  -import org.jboss.logging.Log;
  +import org.apache.log4j.Category;
  +
   import org.jboss.util.Service;
   import org.jboss.util.ServiceFactory;
   import org.jboss.util.ServiceMBeanSupport;
  @@ -66,7 +67,7 @@
* @author  a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a.
* @author  a href=mailto:[EMAIL PROTECTED];Scott Stark/a.
* @author  a href=mailto:[EMAIL PROTECTED];Jason Dillon/a
  - * @version $Revision: 1.33 $
  + * @version $Revision: 1.34 $
* Revisions:
*
* 20010622 scott.stark: Clean up the unsafe downcast of Throwable to Exception
  @@ -113,7 +114,7 @@
  
  
  /** Instance logger. */
  -   private final Log log = Log.createLog(getName());
  +   private final Category log = Category.getInstance(this.getClass());
  
  /** The MBean server which this service is registered in. */
  private MBeanServer server;
  @@ -368,8 +369,7 @@
catch (FileNotFoundException e)
{
   log.error(Configuration file  + confFile.getFile() +
  - must be available and writable.);
  -log.exception(e);
  +   must be available and writable., e);
}
finally
{
  @@ -659,8 +659,7 @@
  catch (Throwable ex)
  {
 log.error(Could not create MBean  +
  -  objectName + ( + code + ));
  -  logException(ex);
  +objectName + ( + code + ), ex);
 
 // Ah what the heck.. skip it
 continue;
  @@ -714,7 +713,7 @@
   arg = Class.forName(type);
 } catch (ClassNotFoundException e)
 {
  - log.error(Unable to check parameter of type ' + type + ');
  + log.error(Unable to check parameter of type ' + type + ', e);
return false;
 }
 
  @@ -723,7 +722,7 @@
cls = Class.forName(className);
 } catch (ClassNotFoundException e)
 {
  - log.error(Unable to check MBean of type ' + className + ');
  + log.error(Unable to check MBean of type ' + className + ', e);
return false;
 }
 
  @@ -852,7 +851,7 @@
e = ((ReflectionException)e).getTargetException();
 }
 
  -  log.exception(e);
  +  log.error(error, e);
  }
  
  /**
  @@ -906,8 +905,8 @@
// Log a warning if the mbean does not implement
// any Service methods
if (opCount == 0)
  -log.warning(objectName +
  - does not implement any Service methods);
  +log.warn(objectName +
  +  does not implement any Service methods);
 }
 
 /**
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-06-22 Thread starksm

  User: starksm 
  Date: 01/06/22 20:55:35

  Modified:src/main/org/jboss/configuration ConfigurationService.java
  Log:
  Fix the wildcard import statements
  
  Revision  ChangesPath
  1.33  +26 -6 jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- ConfigurationService.java 2001/06/23 03:33:28 1.32
  +++ ConfigurationService.java 2001/06/23 03:55:35 1.33
  @@ -19,12 +19,32 @@
   import java.util.Hashtable;
   import java.util.Iterator;
   
  -import javax.management.*;
  +import javax.management.Attribute;
  +import javax.management.InstanceNotFoundException;
  +import javax.management.JMException;
  +import javax.management.JMRuntimeException;
  +import javax.management.MalformedObjectNameException;
  +import javax.management.MBeanInfo;
  +import javax.management.MBeanAttributeInfo;
  +import javax.management.MBeanOperationInfo;
  +import javax.management.MBeanException;
  +import javax.management.MBeanServer;
  +import javax.management.ObjectInstance;
  +import javax.management.ObjectName;
  +import javax.management.ReflectionException;
  +import javax.management.RuntimeErrorException;
  +import javax.management.RuntimeMBeanException;
  +import javax.management.RuntimeOperationsException;
  + 
  +import org.w3c.dom.Document;
  +import org.w3c.dom.Element;
  +import org.w3c.dom.NodeList;
  +import org.w3c.dom.Text;
  +import org.xml.sax.InputSource;
  +import org.xml.sax.SAXException;
  +import javax.xml.parsers.DocumentBuilderFactory;
  +import javax.xml.parsers.DocumentBuilder;
   
  -import org.w3c.dom.*;
  -import org.xml.sax.*;
  -import javax.xml.parsers.*;
  -
   import org.jboss.logging.Log;
   import org.jboss.util.Service;
   import org.jboss.util.ServiceFactory;
  @@ -46,7 +66,7 @@
* @author  a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a.
* @author  a href=mailto:[EMAIL PROTECTED];Scott Stark/a.
* @author  a href=mailto:[EMAIL PROTECTED];Jason Dillon/a
  - * @version $Revision: 1.32 $
  + * @version $Revision: 1.33 $
* Revisions:
*
* 20010622 scott.stark: Clean up the unsafe downcast of Throwable to Exception
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development



RE: [JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-06-22 Thread marc fleury

hey scott,

don't bother man, I already did this and I rewrite most of it anyway. (like
the configuration service is going the way of the dodo...

I guess it is a good thing for 2.4 though... man these are a pain to fix
aren't they?

BTW for all coders:

the best way is NEVER PUT A WILDCARD and then either you remember to add the
class everytime you use a new type either you let the compiler barf and you
go adding the classes one by one.

Of course it ends up being a mix a both.

marcf

|-Original Message-
|From: [EMAIL PROTECTED]
|[mailto:[EMAIL PROTECTED]]On Behalf Of
|[EMAIL PROTECTED]
|Sent: Friday, June 22, 2001 11:56 PM
|To: [EMAIL PROTECTED]
|Subject: [JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration
|ConfigurationService.java
|
|
|  User: starksm
|  Date: 01/06/22 20:55:35
|
|  Modified:src/main/org/jboss/configuration ConfigurationService.java
|  Log:
|  Fix the wildcard import statements
|
|  Revision  ChangesPath
|  1.33  +26 -6
|jboss/src/main/org/jboss/configuration/ConfigurationService.java
|
|  Index: ConfigurationService.java
|  ===
|  RCS file:
|/cvsroot/jboss/jboss/src/main/org/jboss/configuration/Configuration
|Service.java,v
|  retrieving revision 1.32
|  retrieving revision 1.33
|  diff -u -r1.32 -r1.33
|  --- ConfigurationService.java2001/06/23 03:33:28 1.32
|  +++ ConfigurationService.java2001/06/23 03:55:35 1.33
|  @@ -19,12 +19,32 @@
|   import java.util.Hashtable;
|   import java.util.Iterator;
|
|  -import javax.management.*;
|  +import javax.management.Attribute;
|  +import javax.management.InstanceNotFoundException;
|  +import javax.management.JMException;
|  +import javax.management.JMRuntimeException;
|  +import javax.management.MalformedObjectNameException;
|  +import javax.management.MBeanInfo;
|  +import javax.management.MBeanAttributeInfo;
|  +import javax.management.MBeanOperationInfo;
|  +import javax.management.MBeanException;
|  +import javax.management.MBeanServer;
|  +import javax.management.ObjectInstance;
|  +import javax.management.ObjectName;
|  +import javax.management.ReflectionException;
|  +import javax.management.RuntimeErrorException;
|  +import javax.management.RuntimeMBeanException;
|  +import javax.management.RuntimeOperationsException;
|  +
|  +import org.w3c.dom.Document;
|  +import org.w3c.dom.Element;
|  +import org.w3c.dom.NodeList;
|  +import org.w3c.dom.Text;
|  +import org.xml.sax.InputSource;
|  +import org.xml.sax.SAXException;
|  +import javax.xml.parsers.DocumentBuilderFactory;
|  +import javax.xml.parsers.DocumentBuilder;
|
|  -import org.w3c.dom.*;
|  -import org.xml.sax.*;
|  -import javax.xml.parsers.*;
|  -
|   import org.jboss.logging.Log;
|   import org.jboss.util.Service;
|   import org.jboss.util.ServiceFactory;
|  @@ -46,7 +66,7 @@
|* @author  a href=mailto:[EMAIL PROTECTED];Rickard Öberg/a.
|* @author  a href=mailto:[EMAIL PROTECTED];Scott
|Stark/a.
|* @author  a href=mailto:[EMAIL PROTECTED];Jason Dillon/a
|  - * @version $Revision: 1.32 $
|  + * @version $Revision: 1.33 $
|* Revisions:
|*
|* 20010622 scott.stark: Clean up the unsafe downcast of
|Throwable to Exception
|
|
|
|
|___
|Jboss-development mailing list
|[EMAIL PROTECTED]
|http://lists.sourceforge.net/lists/listinfo/jboss-development



___
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-06-15 Thread schaefera

  User: schaefera
  Date: 01/06/15 22:53:38

  Modified:src/main/org/jboss/configuration ConfigurationService.java
  Log:
  Added the support for classes with a single string as only argument for
  the constructor to the ConfigurationService. Some fixes and additional
  methods for the JBoss management.
  
  Revision  ChangesPath
  1.30  +31 -1 jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- ConfigurationService.java 2001/06/10 07:49:09 1.29
  +++ ConfigurationService.java 2001/06/16 05:53:38 1.30
  @@ -9,6 +9,7 @@
   
   import java.io.*;
   import java.beans.*;
  +import java.lang.reflect.Constructor;
   import java.lang.reflect.InvocationHandler;
   import java.lang.reflect.Method;
   import java.lang.reflect.Modifier;
  @@ -45,7 +46,7 @@
* @author  Rickard Öberg ([EMAIL PROTECTED])
* @author  [EMAIL PROTECTED]
* @author  Jason Dillon a 
href=mailto:[EMAIL PROTECTED];lt;[EMAIL PROTECTED]gt;/a
  - * @version $Revision: 1.29 $
  + * @version $Revision: 1.30 $
*/
   public class ConfigurationService
   extends ServiceMBeanSupport
  @@ -405,6 +406,9 @@
   /**
* Provides a wrapper around the information about which constructor
* that MBeanServer should use to construct a MBean.
  + * Please note that only basic datatypes (type is then the same as
  + * you use to declare it short, int, float etc.) and any class
  + * having a constructor taking a single String as only parameter.
*
* pXML syntax for contructor:
*   pre
  @@ -467,6 +471,10 @@
   String value = arg.getAttribute(value);
   Object realValue = value;
   if( signature != null ) {
  +   if( signature.equals( short ) ) {
  +  signature = Short.TYPE.getName();
  +  realValue = new Short( value );
  +   } else
  if( signature.equals( int ) ) {
 signature = Integer.TYPE.getName();
 realValue = new Integer( value );
  @@ -495,6 +503,22 @@
 signature = Boolean.TYPE.getName();
 realValue = new Boolean( value );
  }
  +   else
  +   {
  +  try {
  + // Check if there is a constructor with a single 
String as
  + // only parameter
  + Class signatureClass =
  +
Thread.currentThread().getContextClassLoader().loadClass( signature );
  + Constructor signatureConstructor =
  +signatureClass.getConstructor( new Class[] { 
String.class } );
  + realValue = signatureConstructor.newInstance(
  +new Object[] { value }
  + );
  +  }
  +  catch( Exception e ) {
  +  }
  +   }
   }
   info.signature[j] = signature;
   info.params[j] = realValue;
  @@ -817,3 +841,9 @@
   }
   }
   }
  +
  +/* Log
  +6/13/2001 Andreas Schaefer Added type short for constructor argument and
  +   any class having a constructor taking a String
  +   as only parameter
  +*/
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-06-10 Thread schaefera

  User: schaefera
  Date: 01/06/10 00:49:09

  Modified:src/main/org/jboss/configuration ConfigurationService.java
  Log:
  Added primitive value support for Constructor Arguments. As type just enter
  the same as you use as data type (int, long etc.).
  
  Revision  ChangesPath
  1.29  +37 -3 jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- ConfigurationService.java 2001/05/04 22:47:14 1.28
  +++ ConfigurationService.java 2001/06/10 07:49:09 1.29
  @@ -45,7 +45,7 @@
* @author  Rickard Öberg ([EMAIL PROTECTED])
* @author  [EMAIL PROTECTED]
* @author  Jason Dillon a 
href=mailto:[EMAIL PROTECTED];lt;[EMAIL PROTECTED]gt;/a
  - * @version $Revision: 1.28 $
  + * @version $Revision: 1.29 $
*/
   public class ConfigurationService
   extends ServiceMBeanSupport
  @@ -462,8 +462,42 @@
   //
   // NOTE: should coerce value to the correct type??
   //
  -info.signature[j] = arg.getAttribute(type);
  -info.params[j] = arg.getAttribute(value);
  +// Add support for primitive Data Types
  +String signature = arg.getAttribute(type);
  +String value = arg.getAttribute(value);
  +Object realValue = value;
  +if( signature != null ) {
  +   if( signature.equals( int ) ) {
  +  signature = Integer.TYPE.getName();
  +  realValue = new Integer( value );
  +   } else
  +   if( signature.equals( long ) ) {
  +  signature = Long.TYPE.getName();
  +  realValue = new Long( value );
  +   } else
  +   if( signature.equals( byte ) ) {
  +  signature = Byte.TYPE.getName();
  +  realValue = new Byte( value );
  +   } else
  +   if( signature.equals( char ) ) {
  +  signature = Character.TYPE.getName();
  +  realValue = new Character( value.charAt( 0 ) );
  +   } else
  +   if( signature.equals( float ) ) {
  +  signature = Float.TYPE.getName();
  +  realValue = new Float( value );
  +   } else
  +   if( signature.equals( double ) ) {
  +  signature = Double.TYPE.getName();
  +  realValue = new Double( value );
  +   } else
  +   if( signature.equals( boolean ) ) {
  +  signature = Boolean.TYPE.getName();
  +  realValue = new Boolean( value );
  +   }
  +}
  +info.signature[j] = signature;
  +info.params[j] = realValue;
   }
   }
   
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-05-04 Thread kvvinaymenon

  User: kvvinaymenon
  Date: 01/05/04 15:47:14

  Modified:src/main/org/jboss/configuration ConfigurationService.java
  Log:
  Change to buffer the jboss.jcml read operation. While the previous code worked fine 
from a local file, reading the file from a webserver caused the read operation to 
fail. We now buffer it to a string buffer.
  
  [Marc, the fix we put for loading the jboss.jcml from the remote webserver at CPW].
  
  Revision  ChangesPath
  1.28  +95 -89jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ConfigurationService.java 2001/04/25 20:09:00 1.27
  +++ ConfigurationService.java 2001/05/04 22:47:14 1.28
  @@ -34,9 +34,9 @@
* The ConfigurationService MBean is loaded when JBoss starts up by the
* JMX MLet.
*
  - * pThe ConfigurationService in turn loads the jboss.jcml configuration 
  - *when {@link #loadConfiguration} is invoked. This instantiates JBoss 
  - *specific mbean services that wish to be controlled by the JBoss 
  + * pThe ConfigurationService in turn loads the jboss.jcml configuration
  + *when {@link #loadConfiguration} is invoked. This instantiates JBoss
  + *specific mbean services that wish to be controlled by the JBoss
*{@link ServiceControl}/{@link Service} lifecycle service.
*
* @see org.jboss.util.Service
  @@ -45,7 +45,7 @@
* @author  Rickard Öberg ([EMAIL PROTECTED])
* @author  [EMAIL PROTECTED]
* @author  Jason Dillon a 
href=mailto:[EMAIL PROTECTED];lt;[EMAIL PROTECTED]gt;/a
  - * @version $Revision: 1.27 $
  + * @version $Revision: 1.28 $
*/
   public class ConfigurationService
   extends ServiceMBeanSupport
  @@ -56,10 +56,10 @@
   
   /** The name of the file that running state will be written into. */
   public static final String RUNNING_STATE_FILE = jboss-auto.jcml;
  -
  +
   /** Primitive type name - class map. */
   private static Hashtable primitives = new Hashtable();
  -
  +
   /** Setup the primitives map. */
   static {
   primitives.put(int, Integer.TYPE);
  @@ -68,7 +68,7 @@
   primitives.put(float, Float.TYPE);
   primitives.put(long, Long.TYPE);
   }
  -
  +
   /**
* A mapping from the Service interface method names to the
* corresponding index into the ServiceProxy.hasOp array.
  @@ -84,22 +84,22 @@
   serviceOpMap.put(destroy, new Integer(2));
   serviceOpMap.put(stop, new Integer(3));
   }
  -
   
  +
   /** Instance logger. */
   private final Log log = Log.createLog(getName());
  -
  +
   /** The MBean server which this service is registered in. */
   private MBeanServer server;
  -
  +
   /** The name of the ServiceControl service. */
   private ObjectName serviceControl;
  -
  +
   /** Flag to indicate if attribute values should be automatically trimmed. */
   private boolean autoTrim;
  -
  +
   // Constructors --
  -
  +
   /**
* Construct a ttConfigurationService/tt.
*
  @@ -108,7 +108,7 @@
   public ConfigurationService(final boolean autoTrim) {
   this.autoTrim = autoTrim;
   }
  -
  +
   /**
* Construct a ttConfigurationService/tt that auto-trim
* attribute values.
  @@ -116,9 +116,9 @@
   public ConfigurationService() {
   this(true);
   }
  -
  +
   // Public 
  -
  +
   /**
* Get the attribute value auto-trim flag.
*
  @@ -127,7 +127,7 @@
   public boolean getAutoTrim() {
   return autoTrim;
   }
  -
  +
   /**
* Get the name of this object.  Always ignores the given
* object name.
  @@ -165,13 +165,13 @@
   if (server.isRegistered(serviceControl) == false)
   throw new IllegalStateException
   (Failed to find ServiceControl mbean, name= + serviceControl);
  -
  +
   try {
   // Set configuration to MBeans from XML
   NodeList nl = configuration.getElementsByTagName(mbean);
   for (int i = 0; i  nl.getLength(); i++) {
   Element mbeanElement = (Element)nl.item(i);
  -
  +
   // get the name of the mbean
   ObjectName objectName = parseObjectName(mbeanElement);
   MBeanInfo info;
  @@ -182,7 +182,7 @@
   // It's ok, skip to next one
   continue;
   }
  -
  +
   // Set attributes
  

[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-04-20 Thread user57

  User: user57  
  Date: 01/04/20 16:40:26

  Modified:src/main/org/jboss/configuration ConfigurationService.java
  Log:
   o Moved the parsing of mbean object names to parseObjectName(), since
 the same code was used in more than one location.
  
   o Modified the behavior of the configuration service to throw a
 ConfigurationException when a 'name' attribute was not found, rather than
 ignoring the mbean configuration.
  
   o Modified create() to make use of the logException() method to decode
 and log any JMX exceptions thrown instead of trying to duplicate it's
 exact functionality.
  
   o Removed duplicate calls to log.exception(t) by re-assigning the decoded
 exception to the original exception variable.
  
  Revision  ChangesPath
  1.24  +112 -115  jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- ConfigurationService.java 2001/04/20 05:19:38 1.23
  +++ ConfigurationService.java 2001/04/20 23:40:26 1.24
  @@ -45,7 +45,7 @@
* @author  Rickard Öberg ([EMAIL PROTECTED])
* @author  [EMAIL PROTECTED]
* @author  Jason Dillon a 
href="mailto:[EMAIL PROTECTED]"lt;[EMAIL PROTECTED]gt;/a
  - * @version $Revision: 1.23 $
  + * @version $Revision: 1.24 $
*/
   public class ConfigurationService
  extends ServiceMBeanSupport
  @@ -102,14 +102,10 @@
   {
   Element mbeanElement = (Element)nl.item(i);
   
  -String name = mbeanElement.getAttribute("name");
  -
  -if (name == null)
  -  continue; // MBean ObjectName must be given
  -
  -ObjectName objectName = new ObjectName(name);
  -
  +// get the name of the mbean 
  +ObjectName objectName = parseObjectName(mbeanElement);
   MBeanInfo info;
  +
   try
   {
   info = server.getMBeanInfo(objectName);
  @@ -148,7 +144,7 @@
   editor.setAsText(attributeValue);
   Object value = editor.getValue();
   
  -log.debug(attributeName +" set to 
"+attributeValue+" in "+name);
  +log.debug(attributeName +" set to 
"+attributeValue+" in "+objectName);
   server.setAttribute(objectName, new 
Attribute(attributeName, value));
   
   break;
  @@ -303,71 +299,93 @@
   
   // Protected -
   
  -/**
  - * Provides a wrapper around the information about which constructor 
  - * that MBeanServer should use to construct a MBean.
  - *
  - * pXML syntax for contructor:
  - *   pre
  - *  constructor
  - * arg type="xxx" value="yyy"/
  - * ...
  - * arg type="xxx" value="yyy"/
  - *  /constructor
  - *   /pre
  - */
  -protected static class ConstructorInfo
  -{
  -   public static final Object EMPTY_PARAMS[] = {};
  -   public static final String EMPTY_SIGNATURE[] = {};
  +   /**
  +* Parse an object name from the given element attribute 'name'.
  +*
  +* @param elementElement to parse name from.
  +* @return   Object name.
  +* 
  +* @throws ConfigurationException   Missing attribute 'name'
  +*  (thrown if 'name' is null or "").
  +* @throws MalformedObjectNameException
  +*/
  +   protected ObjectName parseObjectName(final Element element) 
  +  throws ConfigurationException, MalformedObjectNameException
  +   {
  +  String name = element.getAttribute("name");
  +  if (name == null || name.trim().equals("")) {
  + throw new ConfigurationException
  +("MBean attribute 'name' must be given.");
  +  }
  +
  +  return new ObjectName(name);
  +   }
  +
  +   /**
  +* Provides a wrapper around the information about which constructor 
  +* that MBeanServer should use to construct a MBean.
  +*
  +* pXML syntax for contructor:
  +*   pre
  +*  constructor
  +* arg type="xxx" value="yyy"/
  +* ...
  +* arg type="xxx" value="yyy"/
  +*  /constructor
  +*   /pre
  +*/
  +   protected static class ConstructorInfo
  +   {
  +  public static final Object EMPTY_PARAMS[] = {};
  +  public static final String EMPTY_SIGNATURE[] = {};
   
  -   /** The constructor signature. */
  -   public String[] signature = EMPTY_SIGNATURE;
  +  /** The constructor signature. */
  +  public String[] 

[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-04-20 Thread starksm

  User: starksm 
  Date: 01/04/20 23:00:38

  Modified:src/main/org/jboss/configuration ConfigurationService.java
  Log:
  Issue a warning if an mbean does not implement any of the Service interface
  methods.
  
  Revision  ChangesPath
  1.25  +6 -3  jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- ConfigurationService.java 2001/04/20 23:40:26 1.24
  +++ ConfigurationService.java 2001/04/21 06:00:38 1.25
  @@ -45,7 +45,7 @@
* @author  Rickard Öberg ([EMAIL PROTECTED])
* @author  [EMAIL PROTECTED]
* @author  Jason Dillon a 
href="mailto:[EMAIL PROTECTED]"lt;[EMAIL PROTECTED]gt;/a
  - * @version $Revision: 1.24 $
  + * @version $Revision: 1.25 $
*/
   public class ConfigurationService
  extends ServiceMBeanSupport
  @@ -105,7 +105,6 @@
   // get the name of the mbean 
   ObjectName objectName = parseObjectName(mbeanElement);
   MBeanInfo info;
  -
   try
   {
   info = server.getMBeanInfo(objectName);
  @@ -427,7 +426,6 @@
 loader, 
 constructor.params, 
 constructor.signature);
  -
   info = server.getMBeanInfo(instance.getObjectName());
} catch (Throwable ex)
{
  @@ -573,6 +571,7 @@
   ServiceProxy(ObjectName objectName, MBeanOperationInfo[] opInfo)
   {
   this.objectName = objectName;
  +int opCount = 0;
   for(int op = 0; op  opInfo.length; op ++)
   {
   MBeanOperationInfo info = opInfo[op];
  @@ -587,7 +586,11 @@
   if( info.getSignature().length != 0 )
   continue;
   hasOp[opID.intValue()] = true;
  +opCount ++;
   }
  +// Log a warning if the mbean does not implement any Service methods
  +if( opCount == 0 )
  +log.warning(objectName+" does not implement any Service methods");
   }
   
   /** Map the method name to a Service interface method index and
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-04-19 Thread user57

  User: user57  
  Date: 01/04/19 21:09:58

  Modified:src/main/org/jboss/configuration ConfigurationService.java
  Log:
   o decodes target exceptions for RuntimeOperationsException
  
  Revision  ChangesPath
  1.22  +4 -1  jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ConfigurationService.java 2001/04/13 19:06:59 1.21
  +++ ConfigurationService.java 2001/04/20 04:09:58 1.22
  @@ -41,7 +41,7 @@
*   @see org.jboss.util.ServiceControl
*   @author Rickard Öberg ([EMAIL PROTECTED])
*   @author [EMAIL PROTECTED]
  - *   @version $Revision: 1.21 $
  + *   @version $Revision: 1.22 $
*/
   public class ConfigurationService
  extends ServiceMBeanSupport
  @@ -331,12 +331,15 @@
   // Create MBean
   ObjectInstance instance = server.createMBean(code, 
objectName,
   new ObjectName(server.getDefaultDomain(), "service", 
"MLet"));
  +
   info = server.getMBeanInfo(instance.getObjectName());
} catch (Throwable ex)
{
   log.error("Could not create MBean "+name+"("+code+")");
   if (ex instanceof RuntimeMBeanException)
  ex = ((RuntimeMBeanException)ex).getTargetException();
  +if (ex instanceof RuntimeOperationsException)
  +   ex = 
((RuntimeOperationsException)ex).getTargetException();
   else if (ex instanceof MBeanException)
  ex = ((MBeanException)ex).getTargetException();
   else if (ex instanceof ReflectionException)
  
  
  

___
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development



[JBoss-dev] CVS update: jboss/src/main/org/jboss/configuration ConfigurationService.java

2001-04-13 Thread starksm

  User: starksm 
  Date: 01/04/13 12:06:59

  Modified:src/main/org/jboss/configuration ConfigurationService.java
  Log:
  Change the ServiceControl to be a passive service with which services
  requiring lifecycle events must register.
  Change ConfigurationService to register all mbean found in the jboss.jcml
  file with the ServiceControl service and make jboss-auto.jcml write only.
  
  Revision  ChangesPath
  1.21  +185 -36   jboss/src/main/org/jboss/configuration/ConfigurationService.java
  
  Index: ConfigurationService.java
  ===
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/configuration/ConfigurationService.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- ConfigurationService.java 2001/03/15 03:23:44 1.20
  +++ ConfigurationService.java 2001/04/13 19:06:59 1.21
  @@ -9,9 +9,12 @@
   
   import java.io.*;
   import java.beans.*;
  +import java.lang.reflect.InvocationHandler;
   import java.lang.reflect.Method;
   import java.lang.reflect.Modifier;
  +import java.lang.reflect.Proxy;
   import java.net.URL;
  +import java.util.HashMap;
   import java.util.Hashtable;
   import java.util.Iterator;
   
  @@ -23,15 +26,22 @@
   
   
   import org.jboss.logging.Log;
  +import org.jboss.util.Service;
  +import org.jboss.util.ServiceFactory;
   import org.jboss.util.ServiceMBeanSupport;
   import org.jboss.util.XmlHelper;
   
  -/**
  - *   description
  +/** The ConfigurationService MBean is loaded when JBoss starts up by the
  +JMX MLet. The ConfigurationService in turn loads the jboss.jcml configuration
  +when loadConfiguration() is invoked. This instantiates JBoss specific mbean
  +services that wish to be controlled by the JBoss ServiceControl/Service
  +lifecycle service.
*
  - *   @see related
  + *   @see org.jboss.util.Service
  + *   @see org.jboss.util.ServiceControl
*   @author Rickard Öberg ([EMAIL PROTECTED])
  - *   @version $Revision: 1.20 $
  + *   @author [EMAIL PROTECTED]
  + *   @version $Revision: 1.21 $
*/
   public class ConfigurationService
  extends ServiceMBeanSupport
  @@ -53,6 +63,7 @@
   Log log = Log.createLog(getName());
   
   MBeanServer server;
  +ObjectName serviceControl;
   
  // Static 
   
  @@ -74,8 +85,13 @@
   public void load(Document configuration)
   throws Exception
   {
  +// Get the ServiceControl MBean
  +serviceControl = new ObjectName(server.getDefaultDomain(), "service", 
"ServiceControl");
  +if( server.isRegistered(serviceControl) == false )
  +throw new IllegalStateException("Failed to find ServiceControl mbean, 
name="+serviceControl);
  +
   try
  -{
  +{  
   // Set configuration to MBeans from XML
   NodeList nl = configuration.getElementsByTagName("mbean");
   for (int i = 0; i  nl.getLength(); i++)
  @@ -137,6 +153,9 @@
   }
   
   }
  +
  +// Register the mbean with the JBoss ServiceControl mbean
  +registerService(objectName, info, mbeanElement);
   }
   } catch (Throwable e)
   {
  @@ -240,10 +259,9 @@
   public void loadConfiguration()
  throws Exception
   {
  -  // This is a 3-step process
  +  // This is a 2-step process
 // 1) Load user conf. and create MBeans from that
  -  // 2) Load auto-saved conf and apply to created MBeans
  -  // 3) Apply user conf to created MBeans, overwriting any auto-saved conf.
  +  // 2) Apply user conf to created MBeans
   
  // Load user config from XML, and create the MBeans
  InputStream conf = 
Thread.currentThread().getContextClassLoader().getResourceAsStream("jboss.jcml");
  @@ -261,7 +279,6 @@
  try
  {
  userConf = parser.parse(new InputSource(new StringReader(cfg)));
  -   //userConf = xdb.getDocument();
  }
  catch (SAXException se)
  {
  @@ -270,31 +287,6 @@
   
  create(userConf);
   
  -   // Load auto-saved configuration from XML, and apply it
  -   conf = 
Thread.currentThread().getContextClassLoader().getResourceAsStream("jboss-auto.jcml");
  -   if (conf != null) // The auto file is optional
  -   {
  -  arr = new byte[conf.available()];
  -  conf.read(arr);
  -  conf.close();
  -  cfg = new String(arr);
  -
  -  // Parse XML
  -  Document autoConf;
  -
  -  try
  -  {
  -  autoConf = parser.parse(new InputSource(new StringReader(cfg)));
  -  //autoConf = xdb.getDocument();
  -  }
  -  catch (SAXException se)
  -  {
  -   throw new IOException(se.getMessage());
  -  }
  -