Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
  * JBoss, Home of Professional Open Source
  * Copyright 2006, JBoss Inc., 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.jboss.xb.binding.sunday.unmarshalling;
 
SingletonSchemaResolverFactory.

Author(s):
Ales Justin
Adrian Brock
Version:
$Revision: 3021 $
 
 {
   
The log
 
    private static final Logger log = Logger.getLogger(SingletonSchemaResolverFactory.class);

   
The factory instance
 
    private static final SingletonSchemaResolverFactory singleton = new SingletonSchemaResolverFactory();

   
The resolver
 
    private final MutableSchemaResolver resolver = new MultiClassSchemaResolver();

   
Get the factory instance

Returns:
the instance
 
    {
       return ;
    }

   
Create a new SingletonSchemaResolverFactory.
 
    {
       // old initializer 
       //addSchema("urn:jboss:aop-beans:1.0", "org.jboss.aop.microcontainer.beans.xml.AOPBeansSchemaInitializer", Boolean.FALSE);
       addSchema("urn:jboss:spring-beans:2.0""org.jboss.spring.deployment.xml.SpringSchemaInitializer".);
       addSchema("urn:jboss:osgi-beans:1.0""org.jboss.osgi.deployment.xml.OSGiSchemaInitializer".);
       addSchema("urn:jboss:seam-components:1.0""org.jboss.seam.ioc.microcontainer.xml.SeamSchemaInitializer".);
       // new jaxb
       addJaxbSchema("urn:jboss:aop-beans:1.0""org.jboss.aop.microcontainer.beans.metadata.AOPDeployment");
       addJaxbSchema("urn:jboss:bean-deployer""org.jboss.kernel.plugins.deployment.AbstractKernelDeployment10");
       addJaxbSchema("urn:jboss:bean-deployer:2.0""org.jboss.kernel.plugins.deployment.AbstractKernelDeployment");
       addJaxbSchema("urn:jboss:javabean:1.0""org.jboss.javabean.plugins.jaxb.JavaBean10");
       addJaxbSchema("urn:jboss:javabean:2.0""org.jboss.javabean.plugins.jaxb.JavaBean20");
       addJaxbSchema("urn:jboss:policy:1.0""org.jboss.beans.metadata.plugins.policy.AbstractPolicyMetaData");
       addJaxbSchema("urn:jboss:classloading:1.0""org.jboss.classloading.spi.metadata.ClassLoadingMetaData10");
       addJaxbSchema("urn:jboss:classloader:1.0""org.jboss.classloading.spi.vfs.metadata.VFSClassLoaderFactory10");
       addJaxbSchema("urn:jboss:deployers:2.0""org.jboss.deployers.vfs.plugins.xb.SchemaResolverDeployerMetaData");
    }
 
    {
       return ;
    }

   
Add a schema

Parameters:
namespace the namespace
initializer the initializer
Returns:
true when added
 
    protected boolean addSchema(String namespaceString initializer)
    {
       try
       {
          .mapSchemaInitializer(namespaceinitializer);
          if (.isTraceEnabled())
             .trace("Mapped initializer '" + namespace + "' to '" + initializer + "'");
          return true;
       }
       catch (Exception ignored)
      {
         if (.isTraceEnabled())
            .trace("Ignored: "ignored);
         return false;
      }
   }

   
Add a schema

Parameters:
namespace the namespace
initializer the initializer
parseAnnotations whether to parse annotations
Returns:
true when added
   protected boolean addSchema(String namespaceString initializerBoolean parseAnnotations)
   {
      if (addSchema(namespaceinitializer) == false)
         return false;
      setParseAnnotations(namespaceparseAnnotations);
      return true;
   }

   
Add a schema

Parameters:
namespace the namespace
initializer the initializer
location the location
Returns:
true when added
   protected boolean addSchema(String namespaceString initializerString location)
   {
      if (addSchema(namespaceinitializer) == false)
         return false;
      try
      {
         .mapSchemaLocation(namespacelocation);
         if (.isTraceEnabled())
            .trace("Mapped location '" + namespace + "' to '" + location + "'");
         return true;
      }
      catch (Exception ignored)
      {
         if (.isTraceEnabled())
            .trace("Ignored: "ignored);
         return false;
      }
   }

   
Add a schema

Parameters:
namespace the namespace
initializer the initializer
location the location
parseAnnotations whether to parse annotations
Returns:
true when added
   protected boolean addSchema(String namespaceString initializerString locationBoolean parseAnnotations)
   {
      if (addSchema(namespaceinitializerlocation) == false)
         return false;
      setParseAnnotations(namespaceparseAnnotations);
      return true;
   }

   
Set the parse annotations for a schema

Parameters:
namespace the namespace
parseAnnotations whether to parse annotations
   protected void setParseAnnotations(String namespaceBoolean parseAnnotations)
   {
      if(parseAnnotations != null)
         .setParseXSDAnnotations(namespaceparseAnnotations);
      else
         .unsetParseXSDAnnotations(namespace);
      if (.isTraceEnabled())
         .trace("Parse annotations '" + namespace + "' set to '" + parseAnnotations + "'");
   }

   
Add a schema.

Parameters:
namespace the namespace
reference the schema reference class
Returns:
true when added
   public boolean addJaxbSchema(String namespaceString reference)
   {
      try
      {
         .mapURIToClass(namespacereference);
         if (.isTraceEnabled())
            .trace("Mapped '" + namespace + "' to '" + reference + "'");
         return true;
      }
      catch (Exception ignored)
      {
         if (.isTraceEnabled())
            .trace("Ignored: "ignored);
         return false;
      }
   }
New to GrepCode? Check out our FAQ X