Package org.jboss.deployment

Examples of org.jboss.deployment.DeploymentException


         serviceController.stop(di.deployedObject);
         super.stop(di);
      }
      catch (Exception e)
      {
         throw new DeploymentException( "problem stopping ejb module: " +
            di.url, e );
      }
   }
View Full Code Here


         serviceController.remove( di.deployedObject );
         super.destroy(di);
      }
      catch (Exception e)
      {
         throw new DeploymentException( "problem destroying BSH Script: " +
            di.url, e );
      }
   }
View Full Code Here

         mainDeployer.deploy(scriptURL);
         return scriptURL;
      }
      catch(IOException e)
      {
         throw new DeploymentException("Failed to deploy: "+scriptName, e);
      }
   }
View Full Code Here

         log.debug("unpacking to " + destination);
         inflateJar(di.localUrl, destination);
      }
      catch(Exception e)
      {
         throw new DeploymentException("Unpacking failed: ", e);
      }

      // invoke super class' initialization
      super.init(di);
   }
View Full Code Here

   public ObjectInstance install(ObjectName mbeanName, ObjectName loaderName,
      Element mbeanElement) throws Exception
   {
      if (server.isRegistered(mbeanName))
      {
         throw new DeploymentException("Trying to install an already registered mbean: " + mbeanName);
      }
      // If class is given, instantiate it
      String code = mbeanElement.getAttribute("code");
      if ( code == null || "".equals(code))
      {
View Full Code Here

         }

         if (e instanceof DeploymentException)
            throw (DeploymentException) e;

         throw new DeploymentException(e);
      }
   }
View Full Code Here

         info = server.getMBeanInfo(objectName);
      }
      catch (InstanceNotFoundException e)
      {
         // The MBean is no longer available
         throw new DeploymentException("trying to configure nonexistent mbean: " + objectName);
      }
      catch (Exception e)
      {
         throw new DeploymentException("Could not get mbeanInfo", JMXExceptionDecoder.decode(e));
      } // end of catch

      if (info == null)
      {
         throw new DeploymentException("MBeanInfo is null for mbean: " + objectName);
      } // end of if ()

      // Get the classloader for loading attribute classes.
      ClassLoader cl = server.getClassLoader(loaderName);
      // Initialize the mbean using the configuration supplied defaults
      MBeanAttributeInfo[] attributes = info.getAttributes();
      HashMap<String, MBeanAttributeInfo> attributeMap = new HashMap<String, MBeanAttributeInfo>();
      for (int i = 0; i < attributes.length; i++)
      {
         MBeanAttributeInfo attr = attributes[i];
         attributeMap.put(attr.getName(), attr);
      }

      NodeList attrs = mbeanElement.getChildNodes();
      for (int j = 0; j < attrs.getLength(); j++)
      {
         // skip over non-element nodes
         if (attrs.item(j).getNodeType() != Node.ELEMENT_NODE)
         {
            continue;
         }

         Element element = (Element) attrs.item(j);

         boolean replace = true;

         // Set attributes
         if (element.getTagName().equals("attribute"))
         {
            String attributeName = element.getAttribute("name");
            boolean trim = true;
            String replaceAttr = element.getAttribute("replace");
            if (replaceAttr.length() > 0)
               replace = Boolean.valueOf(replaceAttr).booleanValue();
            String trimAttr = element.getAttribute("trim");
            if (trimAttr.length() > 0)
               trim = Boolean.valueOf(trimAttr).booleanValue();
            String serialDataType = element.getAttribute("serialDataType");

            // Get the MBeanAttributeInfo
            MBeanAttributeInfo attr = attributeMap.get(attributeName);
            if (attr == null)
               throw new DeploymentException("No Attribute found with name: " + attributeName);

            if (element.hasChildNodes())
            {
               Object value = null;
               // Unmarshall the attribute value based on the serialDataType
               if (serialDataType.equals("javaBean"))
                  value = parseJavaBeanSerialData(attr, cl, element, replace, trim);
               else if (serialDataType.equals("jbxb"))
                  value = parseJbxbSerialData(attr, cl, element, replace, trim);
               else
                  value = parseTextSerialData(attr, cl, element, replace, trim);
              
               log.debug(attributeName + " set to " + value + " in " + objectName);
               setAttribute(objectName, new Attribute(attributeName, value));
            }//if has children

         }
         //end of "attribute
         else if (element.getTagName().equals("depends"))
         {
            if (!element.hasChildNodes())
            {
               throw new DeploymentException("No ObjectName supplied for depends in  " + objectName);
            }

            String mbeanRefName = element.getAttribute("optional-attribute-name");
            if ("".equals(mbeanRefName))
               mbeanRefName = null;
            else
               mbeanRefName = StringPropertyReplacer.replaceProperties(mbeanRefName);

            String proxyType = element.getAttribute("proxy-type");
            if ("".equals(proxyType))
               proxyType = null;
            else
               proxyType = StringPropertyReplacer.replaceProperties(proxyType);

            // Get the mbeanRef value
            ObjectName dependsObjectName = processDependency(objectName, loaderName, element, mbeans, replace);
            log.debug("considering " + ((mbeanRefName == null) ? "<anonymous>" : mbeanRefName.toString()) + " with object name " + dependsObjectName);

            if (mbeanRefName != null)
            {
               Object attribute = dependsObjectName;
               if (proxyType != null)
               {
                  if (mbeanRefName == null)
                     throw new DeploymentException("You cannot use a proxy-type without an optional-attribute-name");
                  if (proxyType.equals("attribute"))
                  {
                     MBeanAttributeInfo attr = attributeMap.get(mbeanRefName);
                     if (attr == null)
                        throw new DeploymentException("No Attribute found with name: " + mbeanRefName);
                     proxyType = attr.getType();
                  }
                  Class proxyClass = cl.loadClass(proxyType);
                  attribute = MBeanProxyExt.create(proxyClass, dependsObjectName,
                     server, true);
               }

               //if if doesn't exist or has wrong type, we'll get an exception
               setAttribute(objectName, new Attribute(mbeanRefName, attribute));
            } // end of if ()
         }
         //end of depends
         else if (element.getTagName().equals("depends-list"))
         {
            String dependsListName = element.getAttribute("optional-attribute-name");
            if ("".equals(dependsListName))
            {
               dependsListName = null;
            } // end of if ()

            NodeList dependsList = element.getChildNodes();
            ArrayList<ObjectName> dependsListNames = new ArrayList<ObjectName>();
            for (int l = 0; l < dependsList.getLength(); l++)
            {
               if (dependsList.item(l).getNodeType() != Node.ELEMENT_NODE)
               {
                  continue;
               }

               Element dependsElement = (Element) dependsList.item(l);
               if (dependsElement.getTagName().equals("depends-list-element"))
               {
                  if (!dependsElement.hasChildNodes())
                  {
                     throw new DeploymentException("Empty depends-list-element!");
                  } // end of if ()

                  // Get the depends value
                  ObjectName dependsObjectName = processDependency(objectName, loaderName, dependsElement, mbeans, replace);
                  if (!dependsListNames.contains(dependsObjectName))
View Full Code Here

         {
            typeClass = cl.loadClass(typeName);
         }
         catch (ClassNotFoundException e)
         {
            throw new DeploymentException
               ("Class not found for attribute: " + attributeName, e);
         }
      }

      Object value = null;

      /* Attributes of type Element are passed as is after optionally
      performing system property replacement
      */
      if (typeClass.equals(Element.class))
      {
         // Use the first child Element of this element as the value
         NodeList nl = element.getChildNodes();
         for (int i = 0; i < nl.getLength(); i++)
         {
            Node n = nl.item(i);
            if (n.getNodeType() == Node.ELEMENT_NODE)
            {
               value = n;
               break;
            }
         }
         // Replace any ${x} references in the element text
         if (replace)
         {
            PropertyEditor editor = PropertyEditorManager.findEditor(typeClass);
            if (editor == null)
            {
               log.warn("Cannot perform property replace on Element");
            }
            else
            {
               editor.setValue(value);
               String text = editor.getAsText();
               text = StringPropertyReplacer.replaceProperties(text);
               editor.setAsText(text);
               value = editor.getValue();
            }
         }
      }

      if (value == null)
      {
         PropertyEditor editor = PropertyEditorManager.findEditor(typeClass);
         if (editor == null)
         {
            throw new DeploymentException
               ("No property editor for attribute: " + attributeName +
               "; type=" + typeClass);
         }

         // JBAS-1709, temporarily switch the TCL so that property
View Full Code Here

               dependsObjectName = internalInstall(child, mbeans, loaderName, replace);
               break;
            }
            else
            {
               throw new DeploymentException("Non mbean child element in depends tag: " + child);
            } // end of else
         } // end of if ()
      } // end of for ()

      if (dependsObjectName == null)
      {
         String name = getElementContent(element, true, replace);
         dependsObjectName = ObjectNameFactory.create(name);
      }
      if (dependsObjectName == null)
      {
         throw new DeploymentException("No object name found for attribute!");
      } // end of if ()

      serviceController.registerDependency(container, dependsObjectName);

      return dependsObjectName;
View Full Code Here

      {
         server.setAttribute(name, attr);
      }
      catch (Exception e)
      {
         throw new DeploymentException("Exception setting attribute " +
            attr + " on mbean " + name, JMXExceptionDecoder.decode(e));
      }
   }
View Full Code Here

TOP

Related Classes of org.jboss.deployment.DeploymentException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.