001 /* 002 * Copyright 2006 Stephen J. McConnell. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 013 * implied. 014 * 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019 package net.dpml.lang; 020 021 import dpml.util.ElementHelper; 022 import dpml.util.DefaultLogger; 023 import dpml.util.StandardClassLoader; 024 import dpml.util.SystemClassLoader; 025 import dpml.util.Category; 026 027 import dpml.lang.Classpath; 028 import dpml.lang.ValueDecoder; 029 import dpml.lang.Value; 030 031 import net.dpml.runtime.ComponentStrategyHandler; 032 033 import java.io.IOException; 034 import java.io.Writer; 035 import java.net.URI; 036 037 import net.dpml.util.Logger; 038 import net.dpml.util.Resolver; 039 040 import org.w3c.dom.Element; 041 import org.w3c.dom.TypeInfo; 042 043 /** 044 * Antlib strategy handler implementation. 045 * 046 * @author <a href="http://www.dpml.net">Digital Product Management Laboratory</a> 047 * @version 2.0.1 048 */ 049 public class AntlibStrategyHandler implements StrategyHandler 050 { 051 public static final String NAMESPACE = "dpml:antlib"; 052 053 public Strategy newStrategy( Class<?> c ) throws IOException 054 { 055 return newStrategy( c, null ); 056 } 057 058 public Strategy newStrategy( Class<?> c, String name ) throws IOException 059 { 060 throw new UnsupportedOperationException( "newStrategy" ); 061 } 062 063 /** 064 * Construct a strategy definition using a supplied element and value resolver. 065 * @param classloader the classloader 066 * @param element the DOM element definining the deployment strategy 067 * @param resolver symbolic property resolver 068 * @param query the query fragment (ignored) 069 * @return the strategy definition 070 * @exception IOException if an I/O error occurs 071 */ 072 public Strategy build( 073 ClassLoader classloader, Element element, Resolver resolver, String partition, 074 String query, boolean validate ) throws IOException 075 { 076 String urn = ElementHelper.getAttribute( element, "urn", null, resolver ); 077 String path = ElementHelper.getAttribute( element, "path", null, resolver ); 078 return new AntlibStrategy( classloader, urn, path ); 079 } 080 }