Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, a division of Red Hat
   * Copyright 2011, Red Hat Middleware, LLC, and individual
   * contributors as indicated by the @authors tag. See the
   * copyright.txt 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.gatein.wsrp.producer.config.impl.xml;
 
Used to marshall Producer configuration to XML via JBoss XB.

Author(s):
Chris Laprun
Version:
$Revision: 10408 $
Since:
2.6.3
 
 {
    public Object getRoot(Object oMarshallingContext marshallingContextString sString s1)
    {
       return o;
    }
 
    public Object getChildren(ProducerConfigurationImpl configurationString namespaceUriString localName)
    {
       if ("registration-configuration".equals(localName))
       {
          ProducerRegistrationRequirements registrationRequirements = configuration.getRegistrationRequirements();
          if (registrationRequirements != null && registrationRequirements.isRegistrationRequired())
          {
             return registrationRequirements;
          }
       }
       else if ("producer-configuration".equals(localName))
       {
          return configuration;
       }
 
       return null;
    }
 
    public Object getChildren(ProducerRegistrationRequirementsImpl regReqString namespaceUriString localName)
    {
       if ("registration-property-description".equals(localName))
       {
          return regReq.getRegistrationProperties().values();
       }
 
       return null;
    }
 
    public Object getAttributeValue(ProducerConfigurationImpl configurationString namespaceUriString localName)
    {
       if ("useStrictMode".equals(localName))
       {
          return configuration.isUsingStrictMode();
       }
 
       return null;
    }
 
    public Object getAttributeValue(ProducerRegistrationRequirementsImpl regReqString namespaceUriString localName)
    {
       if ("fullServiceDescriptionRequiresRegistration".equals(localName))
       {
          return regReq.isRegistrationRequiredForFullDescription();
       }
 
       return null;
    }
 
   public Object getElementValue(ProducerRegistrationRequirementsImpl regReqString namespaceUriString localName)
   {
      Object value = null;
      if ("registration-policy".equals(localName))
      {
         RegistrationPolicy policy = regReq.getPolicy();
         if (policy != null)
         {
            value = policy.getClassName();
         }
      }
      else if ("registration-property-validator".equals(localName))
      {
         RegistrationPolicy policy = RegistrationPolicyWrapper.unwrap(regReq.getPolicy());
         if (policy instanceof DefaultRegistrationPolicy)
         {
            DefaultRegistrationPolicy defaultRegistrationPolicy = (DefaultRegistrationPolicy)policy;
            value = defaultRegistrationPolicy.getValidator().getClass().getName();
         }
      }
      else
      {
         value = null;
      }
      return value;
   }
   public Object getElementValue(RegistrationPropertyDescription propertyDescriptionString namespaceUriString localName)
   {
      Object value = null;
      if ("name".equals(localName))
      {
         value = propertyDescription.getName();
      }
      else if ("type".equals(localName))
      {
         value = propertyDescription.getType();
      }
      else if ("label".equals(localName))
      {
         value = getLocalizedStringOrNull(propertyDescription.getLabel());
      }
      else if ("hint".equals(localName))
      {
         value = getLocalizedStringOrNull(propertyDescription.getHint());
      }
      else if ("description".equals(localName))
      {
         value = getLocalizedStringOrNull(propertyDescription.getDescription());
      }
      return value;
   }
   {
      if (string != null)
      {
         String value = string.getValue();
         if (value == null || value.length() == 0)
         {
            return null;
         }
         else
         {
            return string;
         }
      }
      else
      {
         return null;
      }
   }
   public Object getAttributeValue(LocalizedString localizedStringString namespaceUriString localName)
   {
      Object value = null;
      if ("lang".equals(localName))
      {
         value = WSRPUtils.toString(localizedString.getLocale());
      }
      else if ("resourceName".equals(localName))
      {
         value = localizedString.getResourceName();
      }
      return value;
   }
   public Object getElementValue(LocalizedString localizedStringString namespaceUriString localName)
   {
      return localizedString.getValue();
   }
New to GrepCode? Check out our FAQ X