unstick r1874024

Revision 1874024

Date:
2020/02/14 15:23:07
Author:
cziegeler
Revision Log:
FELIX-6218 : Replace kxml2 with standard SAX XML parser. Apply patch provided by Mat Booth.
Files:

Legend:

 
Added
 
Removed
 
Modified
  • felix/trunk/scr/bnd.bnd

     
    39 39 org.osgi.service.cm;version="[1.6,2)", \
    40 40 org.osgi.service.log;version="[1.3,2)", \
    41 41 org.osgi.service.metatype;version="[1.1,2)"
    42
    43 Embed-Dependency: kxml2;inline=org/kxml2/io/KXmlParser.class|org/xmlpull/v1/XmlPull**
  • felix/trunk/scr/pom.xml

     
    129 129 <version>1.0.0</version>
    130 130 <scope>provided</scope>
    131 131 </dependency>
    132 <dependency>
    133 <groupId>net.sf.kxml</groupId>
    134 <artifactId>kxml2</artifactId>
    135 <version>2.2.2</version>
    136 <scope>provided</scope>
    137 </dependency>
    138 132
    139 133 <!-- Testing -->
    140 134 <dependency>
  • felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java

     
    18 18 */
    19 19 package org.apache.felix.scr.impl;
    20 20
    21 import java.io.BufferedReader;
    22 21 import java.io.IOException;
    23 22 import java.io.InputStream;
    24 import java.io.InputStreamReader;
    25 23 import java.net.URL;
    26 24 import java.util.ArrayList;
    27 25 import java.util.Collections;
     
    34 32 import java.util.concurrent.TimeUnit;
    35 33 import java.util.concurrent.atomic.AtomicBoolean;
    36 34
    35 import javax.xml.parsers.SAXParser;
    36 import javax.xml.parsers.SAXParserFactory;
    37
    37 38 import org.apache.felix.scr.impl.helper.ConfigAdminTracker;
    38 39 import org.apache.felix.scr.impl.logger.BundleLogger;
    39 40 import org.apache.felix.scr.impl.logger.ComponentLogger;
     
    47 48 import org.apache.felix.scr.impl.manager.RegionConfigurationSupport;
    48 49 import org.apache.felix.scr.impl.manager.ScrConfiguration;
    49 50 import org.apache.felix.scr.impl.metadata.ComponentMetadata;
    50 import org.apache.felix.scr.impl.parser.KXml2SAXParser;
    51 51 import org.apache.felix.scr.impl.xml.XmlHandler;
    52 52 import org.osgi.framework.Bundle;
    53 53 import org.osgi.framework.BundleContext;
     
    276 276 /**
    277 277 * Gets the MetaData location, parses the meta data and requests the processing
    278 278 * of binder instances
    279 * @param cachedComponentMetadata
    279 * @param cachedComponentMetadata
    280 280 *
    281 281 * @throws IllegalStateException If the bundle has already been uninstalled.
    282 282 */
     
    321 321 continue;
    322 322 }
    323 323
    324
    324 325 // load from the descriptors
    325 326 for (URL descriptorURL : descriptorURLs)
    326 327 {
     
    434 435 {
    435 436 stream = descriptorURL.openStream();
    436 437
    437 BufferedReader in = new BufferedReader( new InputStreamReader( stream, "UTF-8" ) );
    438 438 XmlHandler handler = new XmlHandler( m_bundle, this.logger, getConfiguration().isFactoryEnabled(),
    439 439 getConfiguration().keepInstances() );
    440 final KXml2SAXParser parser = new KXml2SAXParser( in );
    440 final SAXParserFactory factory = SAXParserFactory.newInstance();
    441 factory.setNamespaceAware(true);
    442 final SAXParser parser = factory.newSAXParser();
    441 443
    442 parser.parseXML( handler );
    444 parser.parse( stream, handler );
    443 445
    444 446 // 112.4.2 Component descriptors may contain a single, root component element
    445 447 // or one or more component elements embedded in a larger document
  • felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/parser/KXml2SAXHandler.java

     
    1 /*
    2 * Licensed to the Apache Software Foundation (ASF) under one
    3 * or more contributor license agreements. See the NOTICE file
    4 * distributed with this work for additional information
    5 * regarding copyright ownership. The ASF licenses this file
    6 * to you under the Apache License, Version 2.0 (the
    7 * "License"); you may not use this file except in compliance
    8 * with the License. You may obtain a copy of the License at
    9 *
    10 * http://www.apache.org/licenses/LICENSE-2.0
    11 *
    12 * Unless required by applicable law or agreed to in writing,
    13 * software distributed under the License is distributed on an
    14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    15 * KIND, either express or implied. See the License for the
    16 * specific language governing permissions and limitations
    17 * under the License.
    18 */
    19 package org.apache.felix.scr.impl.parser;
    20
    21 import org.apache.felix.scr.impl.parser.KXml2SAXParser.Attributes;
    22
    23 /**
    24 * Interface for a SAX like handler with kXML
    25 */
    26 public interface KXml2SAXHandler {
    27
    28 /**
    29 * Method called when parsing text
    30 *
    31 * @param text
    32 * @exception ParseException
    33 */
    34 void characters(String text) throws ParseException;
    35
    36 /**
    37 * Method called when a tag opens
    38 *
    39 * @param uri
    40 * @param localName
    41 * @param attributes
    42 * @exception ParseException
    43 */
    44 void startElement(
    45 String uri,
    46 String localName,
    47 Attributes attributes)
    48 throws ParseException;
    49
    50 /**
    51 * Method called when a tag closes
    52 *
    53 * @param uri
    54 * @param localName
    55 * @exception ParseException
    56 */
    57 void endElement(
    58 String uri,
    59 String localName)
    60 throws ParseException;
    61
    62 void processingInstruction(String target,
    63 String data)
    64 throws Exception;
    65
    66 void setLineNumber(int lineNumber);
    67
    68 void setColumnNumber(int columnNumber);
    69 }
  • felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/parser/KXml2SAXParser.java

     
    1 /*
    2 * Licensed to the Apache Software Foundation (ASF) under one
    3 * or more contributor license agreements. See the NOTICE file
    4 * distributed with this work for additional information
    5 * regarding copyright ownership. The ASF licenses this file
    6 * to you under the Apache License, Version 2.0 (the
    7 * "License"); you may not use this file except in compliance
    8 * with the License. You may obtain a copy of the License at
    9 *
    10 * http://www.apache.org/licenses/LICENSE-2.0
    11 *
    12 * Unless required by applicable law or agreed to in writing,
    13 * software distributed under the License is distributed on an
    14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    15 * KIND, either express or implied. See the License for the
    16 * specific language governing permissions and limitations
    17 * under the License.
    18 */
    19 package org.apache.felix.scr.impl.parser;
    20
    21
    22 import java.io.Reader;
    23 import java.util.Stack;
    24
    25 import org.kxml2.io.KXmlParser;
    26 import org.xmlpull.v1.XmlPullParser;
    27 import org.xmlpull.v1.XmlPullParserException;
    28
    29
    30 /**
    31 * The KXml2SAXParser extends the XmlParser from kxml. This is a very
    32 * simple parser that does not take into account the DTD
    33 *
    34 */
    35 public class KXml2SAXParser extends KXmlParser
    36 {
    37
    38 /**
    39 * The constructor for a parser, it receives a java.io.Reader.
    40 *
    41 * @param reader The reader
    42 * @throws XmlPullParserException
    43 */
    44 public KXml2SAXParser( Reader reader ) throws XmlPullParserException
    45 {
    46 super();
    47 setInput( reader );
    48 setFeature( FEATURE_PROCESS_NAMESPACES, true );
    49 }
    50
    51
    52 /**
    53 * Parser from the reader provided in the constructor, and call
    54 * the startElement and endElement in a KxmlHandler
    55 *
    56 * @param handler The handler
    57 * @exception Exception thrown by the superclass
    58 */
    59 public void parseXML( KXml2SAXHandler handler ) throws Exception
    60 {
    61
    62 final Stack<XmlElement> openElements = new Stack<XmlElement>();
    63 XmlElement currentElement = null;
    64 final Attributes attributes = new Attributes();
    65
    66 while ( next() != XmlPullParser.END_DOCUMENT )
    67 {
    68 handler.setLineNumber( getLineNumber() );
    69 handler.setColumnNumber( getColumnNumber() );
    70
    71 if ( getEventType() == XmlPullParser.START_TAG )
    72 {
    73 currentElement = new XmlElement( getNamespace(), getName(), getLineNumber(), getColumnNumber() );
    74 openElements.push( currentElement );
    75
    76 handler.startElement( getNamespace(), getName(), attributes );
    77 }
    78 else if ( getEventType() == XmlPullParser.END_TAG )
    79 {
    80 ensureMatchingCurrentElement(currentElement);
    81 openElements.pop();
    82 currentElement = openElements.isEmpty() ? null : ( XmlElement ) openElements.peek();
    83
    84 handler.endElement( getNamespace(), getName() );
    85 }
    86 else if ( getEventType() == XmlPullParser.TEXT )
    87 {
    88 String text = getText();
    89 handler.characters( text );
    90 }
    91 else if ( getEventType() == XmlPullParser.PROCESSING_INSTRUCTION )
    92 {
    93 // TODO extract the target from the evt.getText()
    94 handler.processingInstruction( null, getText() );
    95 }
    96 else
    97 {
    98 // do nothing
    99 }
    100 }
    101
    102 if ( !openElements.isEmpty() )
    103 {
    104 throw new ParseException( "Unclosed elements found: " + openElements, null );
    105 }
    106 }
    107
    108
    109 private void ensureMatchingCurrentElement( final XmlElement currentElement ) throws Exception
    110 {
    111 if ( currentElement == null )
    112 {
    113 throw new ParseException( "Unexpected closing element "
    114 + new XmlElement( getNamespace(), getName(), getLineNumber(), getColumnNumber() ), null );
    115 }
    116
    117 if ( !currentElement.match( getNamespace(), getName() ) )
    118 {
    119 throw new ParseException( "Unexpected closing element "
    120 + new XmlElement( getNamespace(), getName(), getLineNumber(), getColumnNumber() )
    121 + ": Does not match opening element " + currentElement, null );
    122 }
    123 }
    124
    125 private static class XmlElement
    126 {
    127
    128 final String namespaceUri;
    129 final String name;
    130 final int line;
    131 final int col;
    132
    133
    134 XmlElement( final String namespaceUri, final String name, final int line, final int col )
    135 {
    136 this.namespaceUri = namespaceUri;
    137 this.name = name;
    138 this.line = line;
    139 this.col = col;
    140 }
    141
    142
    143 boolean match( final String namespaceUri, final String name )
    144 {
    145 return namespaceUri.equals( this.namespaceUri ) && name.equals( this.name );
    146 }
    147
    148 @Override
    149 public String toString()
    150 {
    151 return name + "@" + line + ":" + col;
    152 }
    153 }
    154
    155 public class Attributes {
    156
    157 public String getAttribute(String name) {
    158 return getAttributeValue("", name);
    159 }
    160
    161 public String getAttribute(String uri, String name) {
    162 return getAttributeValue(uri, name);
    163 }
    164
    165 public boolean getBoolAttribute(String name, boolean defaultValue) {
    166 return getBoolAttribute("", name, defaultValue);
    167 }
    168
    169 public boolean getBoolAttribute(String uri, String name, boolean defaultValue) {
    170 final String val = getAttribute(uri, name);
    171 if ( val != null ) {
    172 return "true".equals(val);
    173 }
    174 return defaultValue;
    175 }
    176 }
    177 }
  • felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/parser/ParseException.java

     
    1 /*
    2 * Licensed to the Apache Software Foundation (ASF) under one
    3 * or more contributor license agreements. See the NOTICE file
    4 * distributed with this work for additional information
    5 * regarding copyright ownership. The ASF licenses this file
    6 * to you under the Apache License, Version 2.0 (the
    7 * "License"); you may not use this file except in compliance
    8 * with the License. You may obtain a copy of the License at
    9 *
    10 * http://www.apache.org/licenses/LICENSE-2.0
    11 *
    12 * Unless required by applicable law or agreed to in writing,
    13 * software distributed under the License is distributed on an
    14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    15 * KIND, either express or implied. See the License for the
    16 * specific language governing permissions and limitations
    17 * under the License.
    18 */
    19 package org.apache.felix.scr.impl.parser;
    20
    21 public class ParseException extends Exception
    22 {
    23 private static final long serialVersionUID = 7476908955452692098L;
    24
    25 public ParseException(String msg, Exception originalException) {
    26 super(msg, originalException);
    27 }
    28
    29 }
  • felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/xml/XmlHandler.java

     
    32 32 import org.apache.felix.scr.impl.metadata.PropertyMetadata;
    33 33 import org.apache.felix.scr.impl.metadata.ReferenceMetadata;
    34 34 import org.apache.felix.scr.impl.metadata.ServiceMetadata;
    35 import org.apache.felix.scr.impl.parser.KXml2SAXHandler;
    36 import org.apache.felix.scr.impl.parser.KXml2SAXParser.Attributes;
    37 import org.apache.felix.scr.impl.parser.ParseException;
    38 35 import org.osgi.framework.Bundle;
    39 36 import org.osgi.service.log.LogService;
    37 import org.xml.sax.Attributes;
    38 import org.xml.sax.SAXException;
    39 import org.xml.sax.helpers.DefaultHandler;
    40 40
    41 41 /**
    42 42 * XML Parser for the component XML
    43 43 */
    44 public class XmlHandler implements KXml2SAXHandler
    44 public class XmlHandler extends DefaultHandler
    45 45 {
    46 46 // the bundle containing the XML resource being parsed
    47 47 private final Bundle m_bundle;
     
    68 68 // PropertyMetaData whose value attribute is missing, hence has element data
    69 69 private PropertyMetadata m_pendingFactoryProperty;
    70 70
    71 private StringBuilder propertyBuilder;
    72
    71 73 /** Flag for detecting the first element. */
    72 74 protected boolean firstElement = true;
    73 75
     
    99 101 }
    100 102
    101 103
    102 /**
    103 * Method called when a tag opens
    104 *
    105 * @param uri
    106 * @param localName
    107 * @param attributes
    108 * @exception ParseException
    109 **/
    110 104 @Override
    111 public void startElement( String uri, String localName, Attributes attributes ) throws ParseException
    105 public void startElement( String uri, String localName, String qName, Attributes attributes ) throws SAXException
    112 106 {
    113 107 // according to the spec, the elements should have the namespace,
    114 108 // except when the root element is the "component" element
     
    152 146 m_currentComponent = new ComponentMetadata( namespaceCode );
    153 147
    154 148 // name attribute is optional (since DS 1.1)
    155 if ( attributes.getAttribute( XmlConstants.ATTR_NAME ) != null )
    149 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_NAME ) != null )
    156 150 {
    157 m_currentComponent.setName( attributes.getAttribute( XmlConstants.ATTR_NAME ) );
    151 m_currentComponent.setName( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_NAME ) );
    158 152 }
    159 153
    160 154 // enabled attribute is optional
    161 if ( attributes.getAttribute( "enabled" ) != null )
    155 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "enabled" ) != null )
    162 156 {
    163 m_currentComponent.setEnabled( attributes.getAttribute( "enabled" ).equals( "true" ) );
    157 m_currentComponent.setEnabled( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "enabled" ).equals( "true" ) );
    164 158 }
    165 159
    166 160 // immediate attribute is optional
    167 if ( attributes.getAttribute( "immediate" ) != null )
    161 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "immediate" ) != null )
    168 162 {
    169 m_currentComponent.setImmediate( attributes.getAttribute( "immediate" ).equals( "true" ) );
    163 m_currentComponent.setImmediate( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "immediate" ).equals( "true" ) );
    170 164 }
    171 165
    172 166 // factory attribute is optional
    173 if ( attributes.getAttribute( "factory" ) != null )
    167 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "factory" ) != null )
    174 168 {
    175 m_currentComponent.setFactoryIdentifier( attributes.getAttribute( "factory" ) );
    169 m_currentComponent.setFactoryIdentifier( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "factory" ) );
    176 170 }
    177 171
    178 172 // configuration-policy is optional (since DS 1.1)
    179 if ( attributes.getAttribute( "configuration-policy" ) != null )
    173 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "configuration-policy" ) != null )
    180 174 {
    181 m_currentComponent.setConfigurationPolicy( attributes.getAttribute( "configuration-policy" ) );
    175 m_currentComponent.setConfigurationPolicy( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "configuration-policy" ) );
    182 176 }
    183 177
    184 178 // activate attribute is optional (since DS 1.1)
    185 if ( attributes.getAttribute( "activate" ) != null )
    179 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "activate" ) != null )
    186 180 {
    187 m_currentComponent.setActivate( attributes.getAttribute( "activate" ) );
    181 m_currentComponent.setActivate( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "activate" ) );
    188 182 }
    189 183
    190 184 // deactivate attribute is optional (since DS 1.1)
    191 if ( attributes.getAttribute( "deactivate" ) != null )
    185 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "deactivate" ) != null )
    192 186 {
    193 m_currentComponent.setDeactivate( attributes.getAttribute( "deactivate" ) );
    187 m_currentComponent.setDeactivate( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "deactivate" ) );
    194 188 }
    195 189
    196 190 // modified attribute is optional (since DS 1.1)
    197 if ( attributes.getAttribute( "modified" ) != null )
    191 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "modified" ) != null )
    198 192 {
    199 m_currentComponent.setModified( attributes.getAttribute( "modified" ) );
    193 m_currentComponent.setModified( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "modified" ) );
    200 194 }
    201 195
    202 196 // configuration-pid attribute is optional (since DS 1.2)
    203 String configurationPidString = attributes.getAttribute( "configuration-pid" );
    197 String configurationPidString = attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "configuration-pid" );
    204 198 if (configurationPidString != null)
    205 199 {
    206 200 String[] configurationPid = configurationPidString.split( " " );
    207 201 m_currentComponent.setConfigurationPid( configurationPid );
    208 202 }
    209 203
    210 m_currentComponent.setConfigurableServiceProperties("true".equals(attributes.getAttribute(XmlConstants.NAMESPACE_URI_1_0_FELIX_EXTENSIONS, XmlConstants.ATTR_CONFIGURABLE_SERVICE_PROPERTIES)));
    211 m_currentComponent.setPersistentFactoryComponent("true".equals(attributes.getAttribute(XmlConstants.NAMESPACE_URI_1_0_FELIX_EXTENSIONS, XmlConstants.ATTR_PERSISTENT_FACTORY_COMPONENT)));
    212 m_currentComponent.setDeleteCallsModify("true".equals(attributes.getAttribute(XmlConstants.NAMESPACE_URI_1_0_FELIX_EXTENSIONS, XmlConstants.ATTR_DELETE_CALLS_MODIFY)));
    213 if ( attributes.getAttribute(XmlConstants.NAMESPACE_URI_1_0_FELIX_EXTENSIONS, XmlConstants.ATTR_OBSOLETE_FACTORY_COMPONENT_FACTORY) != null)
    204 m_currentComponent.setConfigurableServiceProperties("true".equals(attributes.getValue(XmlConstants.NAMESPACE_URI_1_0_FELIX_EXTENSIONS, XmlConstants.ATTR_CONFIGURABLE_SERVICE_PROPERTIES)));
    205 m_currentComponent.setPersistentFactoryComponent("true".equals(attributes.getValue(XmlConstants.NAMESPACE_URI_1_0_FELIX_EXTENSIONS, XmlConstants.ATTR_PERSISTENT_FACTORY_COMPONENT)));
    206 m_currentComponent.setDeleteCallsModify("true".equals(attributes.getValue(XmlConstants.NAMESPACE_URI_1_0_FELIX_EXTENSIONS, XmlConstants.ATTR_DELETE_CALLS_MODIFY)));
    207 if ( attributes.getValue(XmlConstants.NAMESPACE_URI_1_0_FELIX_EXTENSIONS, XmlConstants.ATTR_OBSOLETE_FACTORY_COMPONENT_FACTORY) != null)
    214 208 {
    215 m_currentComponent.setObsoleteFactoryComponentFactory("true".equals(attributes.getAttribute(XmlConstants.NAMESPACE_URI_1_0_FELIX_EXTENSIONS, XmlConstants.ATTR_OBSOLETE_FACTORY_COMPONENT_FACTORY)));
    209 m_currentComponent.setObsoleteFactoryComponentFactory("true".equals(attributes.getValue(XmlConstants.NAMESPACE_URI_1_0_FELIX_EXTENSIONS, XmlConstants.ATTR_OBSOLETE_FACTORY_COMPONENT_FACTORY)));
    216 210 }
    217 211 else if ( !namespaceCode.isDS13() )
    218 212 {
    219 213 m_currentComponent.setObsoleteFactoryComponentFactory(m_globalObsoleteFactoryComponentFactory);
    220 214 }
    221 m_currentComponent.setConfigureWithInterfaces("true".equals(attributes.getAttribute(XmlConstants.NAMESPACE_URI_1_0_FELIX_EXTENSIONS, XmlConstants.ATTR_CONFIGURE_WITH_INTERFACES)));
    222 m_currentComponent.setDelayedKeepInstances(m_globalDelayedKeepInstances || "true".equals(attributes.getAttribute(XmlConstants.NAMESPACE_URI_1_0_FELIX_EXTENSIONS, XmlConstants.ATTR_DELAYED_KEEP_INSTANCES)));
    215 m_currentComponent.setConfigureWithInterfaces("true".equals(attributes.getValue(XmlConstants.NAMESPACE_URI_1_0_FELIX_EXTENSIONS, XmlConstants.ATTR_CONFIGURE_WITH_INTERFACES)));
    216 m_currentComponent.setDelayedKeepInstances(m_globalDelayedKeepInstances || "true".equals(attributes.getValue(XmlConstants.NAMESPACE_URI_1_0_FELIX_EXTENSIONS, XmlConstants.ATTR_DELAYED_KEEP_INSTANCES)));
    223 217
    224 218 // activation-fields is optional (since DS 1.4)
    225 String activationFields = attributes.getAttribute( XmlConstants.ATTR_ACTIVATION_FIELDS );
    219 String activationFields = attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_ACTIVATION_FIELDS );
    226 220 if ( activationFields != null )
    227 221 {
    228 222 final String[] fields = activationFields.split(" ");
     
    230 224 }
    231 225
    232 226 // init is optional (since DS 1.4)
    233 String init = attributes.getAttribute( XmlConstants.ATTR_INIT );
    227 String init = attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_INIT );
    234 228 if ( init != null )
    235 229 {
    236 230 m_currentComponent.setInit( init );
     
    252 246 else if ( localName.equals( XmlConstants.EL_IMPL ) )
    253 247 {
    254 248 // Set the implementation class name (mandatory)
    255 m_currentComponent.setImplementationClassName( attributes.getAttribute( "class" ) );
    249 m_currentComponent.setImplementationClassName( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "class" ) );
    256 250 }
    257 251 // 112.4.5 [...] Property Elements
    258 252 else if ( localName.equals( XmlConstants.EL_PROPERTY ) )
     
    260 254 PropertyMetadata prop = new PropertyMetadata();
    261 255
    262 256 // name attribute is mandatory
    263 prop.setName( attributes.getAttribute( XmlConstants.ATTR_NAME ) );
    257 prop.setName( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_NAME ) );
    264 258
    265 259 // type attribute is optional
    266 if ( attributes.getAttribute( XmlConstants.ATTR_TYPE ) != null )
    260 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_TYPE ) != null )
    267 261 {
    268 prop.setType( attributes.getAttribute( XmlConstants.ATTR_TYPE ) );
    262 prop.setType( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_TYPE ) );
    269 263 }
    270 264
    271 265 // 112.4.5: If the value attribute is specified, the body of the element is ignored.
    272 if ( attributes.getAttribute( XmlConstants.ATTR_VALUE ) != null )
    266 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_VALUE ) != null )
    273 267 {
    274 prop.setValue( attributes.getAttribute( XmlConstants.ATTR_VALUE ) );
    268 prop.setValue( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_VALUE ) );
    275 269 m_currentComponent.addProperty( prop );
    276 270 }
    277 271 else
     
    283 277 // 112.4.5 Properties [...] Elements
    284 278 else if ( localName.equals( XmlConstants.EL_PROPERTIES ) )
    285 279 {
    286 final Properties props = readPropertiesEntry( attributes.getAttribute( "entry" ) );
    280 final Properties props = readPropertiesEntry( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "entry" ) );
    287 281 // create PropertyMetadata for the properties from the file
    288 282 for ( Map.Entry<Object, Object> pEntry: props.entrySet() )
    289 283 {
     
    300 294 PropertyMetadata prop = new PropertyMetadata();
    301 295
    302 296 // name attribute is mandatory
    303 prop.setName( attributes.getAttribute( XmlConstants.ATTR_NAME ) );
    297 prop.setName( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_NAME ) );
    304 298
    305 299 // type attribute is optional
    306 if ( attributes.getAttribute( XmlConstants.ATTR_TYPE ) != null )
    300 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_TYPE ) != null )
    307 301 {
    308 prop.setType( attributes.getAttribute( XmlConstants.ATTR_TYPE ) );
    302 prop.setType( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_TYPE ) );
    309 303 }
    310 304
    311 305 // 112.4.5: If the value attribute is specified, the body of the element is ignored.
    312 if ( attributes.getAttribute( XmlConstants.ATTR_VALUE ) != null )
    306 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_VALUE ) != null )
    313 307 {
    314 prop.setValue( attributes.getAttribute( XmlConstants.ATTR_VALUE ) );
    308 prop.setValue( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_VALUE ) );
    315 309 m_currentComponent.addFactoryProperty( prop );
    316 310 }
    317 311 else
     
    323 317 // 112.4.9 [...] Factory Properties Element
    324 318 else if ( localName.equals( XmlConstants.EL_FACTORY_PROPERTIES ) )
    325 319 {
    326 final Properties props = readPropertiesEntry( attributes.getAttribute( "entry" ) );
    320 final Properties props = readPropertiesEntry( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "entry" ) );
    327 321 // create PropertyMetadata for the properties from the file
    328 322 for ( Map.Entry<Object, Object> pEntry: props.entrySet() )
    329 323 {
     
    340 334 m_currentService = new ServiceMetadata();
    341 335
    342 336 // servicefactory attribute is optional
    343 if ( attributes.getAttribute( "servicefactory" ) != null )
    337 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "servicefactory" ) != null )
    344 338 {
    345 m_currentService.setServiceFactory( attributes.getAttribute( "servicefactory" ).equals( "true" ) );
    339 m_currentService.setServiceFactory( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "servicefactory" ).equals( "true" ) );
    346 340 }
    347 341
    348 if ( attributes.getAttribute( "scope" ) != null )
    342 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "scope" ) != null )
    349 343 {
    350 m_currentService.setScope( attributes.getAttribute( "scope" ) );
    344 m_currentService.setScope( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "scope" ) );
    351 345 }
    352 346
    353 347 m_currentComponent.setService( m_currentService );
    354 348 }
    355 349 else if ( localName.equals( XmlConstants.EL_PROVIDE ) )
    356 350 {
    357 m_currentService.addProvide( attributes.getAttribute( XmlConstants.ATTR_INTERFACE ) );
    351 m_currentService.addProvide( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_INTERFACE ) );
    358 352 }
    359 353
    360 354 // 112.4.7 Reference element
     
    363 357 ReferenceMetadata ref = new ReferenceMetadata();
    364 358
    365 359 // name attribute is optional (since DS 1.1)
    366 if ( attributes.getAttribute( XmlConstants.ATTR_NAME ) != null )
    360 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_NAME ) != null )
    367 361 {
    368 ref.setName( attributes.getAttribute( XmlConstants.ATTR_NAME ) );
    362 ref.setName( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_NAME ) );
    369 363 }
    370 364
    371 ref.setInterface( attributes.getAttribute( XmlConstants.ATTR_INTERFACE ) );
    365 ref.setInterface( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, XmlConstants.ATTR_INTERFACE ) );
    372 366
    373 367 // Cardinality
    374 if ( attributes.getAttribute( "cardinality" ) != null )
    368 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "cardinality" ) != null )
    375 369 {
    376 ref.setCardinality( attributes.getAttribute( "cardinality" ) );
    370 ref.setCardinality( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "cardinality" ) );
    377 371 }
    378 372
    379 if ( attributes.getAttribute( "policy" ) != null )
    373 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "policy" ) != null )
    380 374 {
    381 ref.setPolicy( attributes.getAttribute( "policy" ) );
    375 ref.setPolicy( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "policy" ) );
    382 376 }
    383 377
    384 if ( attributes.getAttribute( "policy-option" ) != null )
    378 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "policy-option" ) != null )
    385 379 {
    386 ref.setPolicyOption( attributes.getAttribute( "policy-option" ) );
    380 ref.setPolicyOption( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "policy-option" ) );
    387 381 }
    388 382
    389 if ( attributes.getAttribute( "scope" ) != null )
    383 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "scope" ) != null )
    390 384 {
    391 ref.setScope( attributes.getAttribute( "scope" ) );
    385 ref.setScope( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "scope" ) );
    392 386 }
    393 387
    394 if ( attributes.getAttribute( "target" ) != null)
    388 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "target" ) != null)
    395 389 {
    396 ref.setTarget( attributes.getAttribute( "target" ) );
    390 ref.setTarget( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "target" ) );
    397 391 PropertyMetadata prop = new PropertyMetadata();
    398 392 prop.setName( (ref.getName() == null? ref.getInterface(): ref.getName()) + ".target");
    399 prop.setValue( attributes.getAttribute( "target" ) );
    393 prop.setValue( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "target" ) );
    400 394 m_currentComponent.addProperty( prop );
    401 395
    402 396 }
    403 397
    404 398 // method reference
    405 ref.setBind( attributes.getAttribute( "bind" ) );
    406 ref.setUpdated( attributes.getAttribute( "updated" ) );
    407 ref.setUnbind( attributes.getAttribute( "unbind" ) );
    399 ref.setBind( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "bind" ) );
    400 ref.setUpdated( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "updated" ) );
    401 ref.setUnbind( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "unbind" ) );
    408 402
    409 403 // field reference
    410 ref.setField( attributes.getAttribute( "field" ) );
    411 ref.setFieldOption( attributes.getAttribute( "field-option" ) );
    412 ref.setFieldCollectionType( attributes.getAttribute( "field-collection-type" ) );
    404 ref.setField( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "field" ) );
    405 ref.setFieldOption( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "field-option" ) );
    406 ref.setFieldCollectionType( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "field-collection-type" ) );
    413 407
    414 408 // DS 1.4 : references as parameter of the activator (method or constructor)
    415 if ( attributes.getAttribute( "parameter" ) != null)
    409 if ( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "parameter" ) != null)
    416 410 {
    417 ref.setParameter( attributes.getAttribute( "parameter" ) );
    411 ref.setParameter( attributes.getValue( XmlConstants.NAMESPACE_URI_EMPTY, "parameter" ) );
    418 412
    419 413 }
    420 414
     
    431 425 }
    432 426 catch ( Exception ex )
    433 427 {
    434 throw new ParseException( "Exception during parsing", ex );
    428 throw new SAXException( "Exception during parsing", ex );
    435 429 }
    436 430 }
    437 431
     
    445 439 }
    446 440
    447 441
    448 /**
    449 * Method called when a tag closes
    450 *
    451 * @param uri
    452 * @param localName
    453 */
    454 442 @Override
    455 public void endElement( String uri, String localName )
    443 public void endElement(String uri, String localName, String qName) throws SAXException
    456 444 {
    457 445 if ( overrideNamespace != null && XmlConstants.NAMESPACE_URI_EMPTY.equals( uri ) )
    458 446 {
     
    472 460 }
    473 461 else if ( localName.equals( XmlConstants.EL_PROPERTY ) && m_pendingProperty != null )
    474 462 {
    475 // 112.4.5 body expected to contain property value
    476 // if so, the m_pendingProperty field would be null
    477 // currently, we just ignore this situation
    463 if (propertyBuilder != null) {
    464 m_pendingProperty.setValues(propertyBuilder.toString());
    465 propertyBuilder = null;
    466 } else {
    467 m_pendingProperty.setValues("");
    468 }
    469 m_currentComponent.addProperty( m_pendingProperty );
    478 470 m_pendingProperty = null;
    479 471 }
    480 472 else if ( localName.equals( XmlConstants.EL_FACTORY_PROPERTY ) && m_pendingFactoryProperty != null )
    481 473 {
    482 // 112.4.5 body expected to contain property value
    483 // if so, the m_pendingFactoryProperty field would be null
    484 // currently, we just ignore this situation
    474 if (propertyBuilder != null) {
    475 m_pendingFactoryProperty.setValues(propertyBuilder.toString());
    476 propertyBuilder = null;
    477 } else {
    478 m_pendingFactoryProperty.setValues("");
    479 }
    480 m_currentComponent.addFactoryProperty( m_pendingFactoryProperty );
    485 481 m_pendingFactoryProperty = null;
    486 482 }
    487 483 }
    488 484 }
    489 485
    490 486
    491 /**
    492 * @see org.apache.felix.scr.impl.parser.KXml2SAXHandler#characters(java.lang.String)
    493 */
    494 487 @Override
    495 public void characters( String text )
    488 public void characters(char[] ch, int start, int length) throws SAXException
    496 489 {
    497 490 // 112.4.5 If the value attribute is not specified, the body must contain one or more values
    498 if ( m_pendingProperty != null )
    491 if ( m_pendingProperty != null || m_pendingFactoryProperty != null )
    499 492 {
    500 m_pendingProperty.setValues( text );
    501 m_currentComponent.addProperty( m_pendingProperty );
    502 m_pendingProperty = null;
    493 if (propertyBuilder == null) {
    494 propertyBuilder = new StringBuilder();
    495 }
    496 propertyBuilder.append(String.valueOf( ch, start, length));
    503 497 }
    504 if ( m_pendingFactoryProperty != null )
    505 {
    506 m_pendingFactoryProperty.setValues( text );
    507 m_currentComponent.addFactoryProperty( m_pendingFactoryProperty );
    508 m_pendingFactoryProperty = null;
    509 }
    510 498 }
    511 499
    512 500
    513 501 /**
    514 * @see org.apache.felix.scr.impl.parser.KXml2SAXHandler#processingInstruction(java.lang.String, java.lang.String)
    515 */
    516 @Override
    517 public void processingInstruction( String target, String data )
    518 {
    519 // Not used
    520 }
    521
    522
    523 /**
    524 * @see org.apache.felix.scr.impl.parser.KXml2SAXHandler#setLineNumber(int)
    525 */
    526 @Override
    527 public void setLineNumber( int lineNumber )
    528 {
    529 // Not used
    530 }
    531
    532
    533 /**
    534 * @see org.apache.felix.scr.impl.parser.KXml2SAXHandler#setColumnNumber(int)
    535 */
    536 @Override
    537 public void setColumnNumber( int columnNumber )
    538 {
    539 // Not used
    540 }
    541
    542
    543 /**
    544 502 * Reads the name property file from the bundle owning this descriptor. All
    545 503 * properties read from the properties file are added to the current
    546 504 * component's property meta data list.
     
    548 506 * @param entryName The name of the bundle entry containing the propertes
    549 507 * to be added. This must not be <code>null</code>.
    550 508 *
    551 * @throws ParseException If the entry name is <code>null</code> or no
    509 * @throws SAXException If the entry name is <code>null</code> or no
    552 510 * entry with the given name exists in the bundle or an error occurrs
    553 511 * reading the properties file.
    554 512 */
    555 private Properties readPropertiesEntry( String entryName ) throws ParseException
    513 private Properties readPropertiesEntry( String entryName ) throws SAXException
    556 514 {
    557 515 if ( entryName == null )
    558 516 {
    559 throw new ParseException( "Missing entry attribute of properties element", null );
    517 throw new SAXException( "Missing entry attribute of properties element", null );
    560 518 }
    561 519
    562 520 URL entryURL = m_bundle.getEntry( entryName );
    563 521 if ( entryURL == null )
    564 522 {
    565 throw new ParseException( "Missing bundle entry " + entryName, null );
    523 throw new SAXException( "Missing bundle entry " + entryName, null );
    566 524 }
    567 525
    568 526 Properties props = new Properties();
     
    574 532 }
    575 533 catch ( IOException ioe )
    576 534 {
    577 throw new ParseException( "Failed to read properties entry " + entryName, ioe );
    535 throw new SAXException( "Failed to read properties entry " + entryName, ioe );
    578 536 }
    579 537 finally
    580 538 {
  • felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/metadata/ComponentBase.java

     
    19 19 package org.apache.felix.scr.impl.metadata;
    20 20
    21 21 import java.io.BufferedReader;
    22 import java.io.ByteArrayInputStream;
    22 23 import java.io.IOException;
    24 import java.io.InputStream;
    23 25 import java.io.InputStreamReader;
    24 26 import java.io.Reader;
    25 27 import java.io.StringReader;
    26 28 import java.util.Iterator;
    27 29 import java.util.List;
    28 30
    31 import javax.xml.parsers.SAXParser;
    32 import javax.xml.parsers.SAXParserFactory;
    33
    29 34 import org.apache.felix.scr.impl.MockBundle;
    30 35 import org.apache.felix.scr.impl.logger.MockBundleLogger;
    31 import org.apache.felix.scr.impl.parser.KXml2SAXParser;
    32 36 import org.apache.felix.scr.impl.xml.XmlHandler;
    33 37 import org.osgi.service.component.ComponentException;
    34 import org.xmlpull.v1.XmlPullParserException;
    38 import org.xml.sax.SAXException;
    35 39
    36 40 import junit.framework.TestCase;
    37 41
     
    47 51 logger = new MockBundleLogger();
    48 52 }
    49 53
    50 private List readMetadata(final Reader reader)
    51 throws IOException, ComponentException, XmlPullParserException, Exception
    54 private List readMetadata(InputStream in)
    55 throws IOException, ComponentException, SAXException, Exception
    52 56 {
    57 final SAXParserFactory factory = SAXParserFactory.newInstance();
    58 factory.setNamespaceAware(true);
    59 final SAXParser parser = factory.newSAXParser();
    53 60
    54 try
    55 {
    56 final KXml2SAXParser parser = new KXml2SAXParser(reader);
    61 XmlHandler handler = new XmlHandler(new MockBundle(), logger, false, false);
    62 parser.parse(in, handler);
    57 63
    58 XmlHandler handler = new XmlHandler(new MockBundle(), logger, false, false);
    59 parser.parseXML(handler);
    60
    61 return handler.getComponentMetadataList();
    62 }
    63 finally
    64 {
    65 try
    66 {
    67 reader.close();
    68 }
    69 catch (IOException ignore)
    70 {
    71 }
    72 }
    64 return handler.getComponentMetadataList();
    73 65 }
    74 66
    75 67 protected List readMetadata(String filename)
    76 throws IOException, ComponentException, XmlPullParserException, Exception
    68 throws IOException, ComponentException, SAXException, Exception
    77 69 {
    78 try (BufferedReader in = new BufferedReader(
    79 new InputStreamReader(getClass().getResourceAsStream(filename), "UTF-8")))
    70 try (InputStream in = getClass().getResourceAsStream(filename))
    80 71 {
    81 72 return readMetadata(in);
    82 73 }
    83 74 }
    84 75
    85 76 protected List readMetadataFromString(final String source)
    86 throws IOException, ComponentException, XmlPullParserException, Exception
    77 throws IOException, ComponentException, SAXException, Exception
    87 78 {
    88 return readMetadata(new StringReader(source));
    79 return readMetadata(new ByteArrayInputStream(source.getBytes()));
    89 80 }
    90 81
    91 82 protected ReferenceMetadata getReference(final ComponentMetadata cm,
  • felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/metadata/ComponentMetaDataCacheTest.java

     
    30 30
    31 31 import org.apache.felix.scr.impl.metadata.MetadataStoreHelper.MetaDataReader;
    32 32 import org.apache.felix.scr.impl.metadata.MetadataStoreHelper.MetaDataWriter;
    33 import org.xmlpull.v1.XmlPullParserException;
    33 import org.xml.sax.SAXException;
    34 34
    35 35 public class ComponentMetaDataCacheTest extends ComponentBase
    36 36 {
     
    61 61 }
    62 62
    63 63 private void doTestCachedComponentMetadata(String xmlFile, DSVersion version)
    64 throws IOException, XmlPullParserException, Exception
    64 throws IOException, SAXException, Exception
    65 65 {
    66 66 final List<?> metadataList = readMetadata(xmlFile);
    67 67 assertEquals("Component Descriptors size not as expected", 1,
  • felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/metadata/XmlHandlerTest.java

     
    21 21
    22 22 import java.util.List;
    23 23
    24 import org.apache.felix.scr.impl.parser.ParseException;
    25 24 import org.osgi.service.component.ComponentException;
    25 import org.xml.sax.SAXException;
    26 26
    27 27
    28 28 public class XmlHandlerTest extends ComponentBase
     
    35 35 readMetadataFromString( "<component name=\"n\"><implementation class=\"n\" /><component name=\"x\">" );
    36 36 fail( "ParseException expected for unclosed elements" );
    37 37 }
    38 catch ( ParseException pe )
    38 catch ( SAXException pe )
    39 39 {
    40 40 // exptected
    41 41 }
     
    49 49 readMetadataFromString( "</component>" );
    50 50 fail( "Exception expected for element without opening element" );
    51 51 }
    52 catch ( Exception p )
    52 catch ( SAXException p )
    53 53 {
    54 54 // exptected
    55 55 }
  • felix/trunk/scr/src/test/java/org/apache/felix/scr/impl/xml/XmlHandlerTest.java

     
    1 /*
    2 * Licensed to the Apache Software Foundation (ASF) under one
    3 * or more contributor license agreements. See the NOTICE file
    4 * distributed with this work for additional information
    5 * regarding copyright ownership. The ASF licenses this file
    6 * to you under the Apache License, Version 2.0 (the
    7 * "License"); you may not use this file except in compliance
    8 * with the License. You may obtain a copy of the License at
    9 *
    10 * http://www.apache.org/licenses/LICENSE-2.0
    11 *
    12 * Unless required by applicable law or agreed to in writing,
    13 * software distributed under the License is distributed on an
    14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    15 * KIND, either express or implied. See the License for the
    16 * specific language governing permissions and limitations
    17 * under the License.
    18 */
    19 package org.apache.felix.scr.impl.xml;
    20
    21 import java.io.IOException;
    22 import java.io.InputStream;
    23 import java.net.URL;
    24
    25 import javax.xml.parsers.SAXParser;
    26 import javax.xml.parsers.SAXParserFactory;
    27
    28 import org.apache.felix.scr.impl.logger.MockBundleLogger;
    29 import org.junit.Test;
    30 import org.mockito.Mockito;
    31 import org.osgi.framework.Bundle;
    32
    33 public class XmlHandlerTest {
    34
    35 @Test
    36 public void testPropertiesWithoutValue() throws Exception {
    37 final URL url = this.getClass().getClassLoader().getResource("parsertest-nopropvalue.xml");
    38 parse(url);
    39 }
    40
    41 private void parse(final URL descriptorURL) throws Exception {
    42 final Bundle bundle = Mockito.mock(Bundle.class);
    43 Mockito.when(bundle.getLocation()).thenReturn("bundle");
    44
    45 InputStream stream = null;
    46 try {
    47 stream = descriptorURL.openStream();
    48
    49 XmlHandler handler = new XmlHandler(bundle, new MockBundleLogger(), false, false);
    50 final SAXParserFactory factory = SAXParserFactory.newInstance();
    51 factory.setNamespaceAware(true);
    52 final SAXParser parser = factory.newSAXParser();
    53
    54 parser.parse(stream, handler);
    55
    56 } finally {
    57 if (stream != null) {
    58 try {
    59 stream.close();
    60 } catch (IOException ignore) {
    61 }
    62 }
    63 }
    64
    65 }
    66 }
  • felix/trunk/scr/src/test/resources/parsertest-nopropvalue.xml

     
    1 <?xml version="1.0" encoding="UTF-8"?>
    2 <!--
    3 Licensed to the Apache Software Foundation (ASF) under one
    4 or more contributor license agreements. See the NOTICE file
    5 distributed with this work for additional information
    6 regarding copyright ownership. The ASF licenses this file
    7 to you under the Apache License, Version 2.0 (the
    8 "License"); you may not use this file except in compliance
    9 with the License. You may obtain a copy of the License at
    10
    11 http://www.apache.org/licenses/LICENSE-2.0
    12
    13 Unless required by applicable law or agreed to in writing,
    14 software distributed under the License is distributed on an
    15 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    16 KIND, either express or implied. See the License for the
    17 specific language governing permissions and limitations
    18 under the License.
    19 -->
    20 <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.0.0" name="org.apache.sling.server.impl.jmx.ManagedRepository">
    21 <property name="jmx.objectname" value="org.apache.sling:type=Repository"/>
    22 <property name="repository.config"/>
    23 <property name="bootstrap.properties"/>
    24 <property name="service.vendor" value="The Apache Software Foundation"/>
    25 <service servicefactory="false">
    26 <provide interface="org.apache.sling.server.jmx.ManagedRepositoryMBean"/>
    27 </service>
    28 <reference name="productInfo" interface="org.apache.sling.license.ProductInfoService" cardinality="1..1" policy="static" bind="bindProductInfo" unbind="unbindProductInfo"/>
    29 <reference name="repository" interface="org.apache.sling.Repository" cardinality="1..1" policy="static" bind="bindRepository" unbind="unbindRepository"/>
    30 <reference name="backup" interface="org.apache.sling.FileStoreBackupService" cardinality="1..1" policy="static" bind="bindBackup" unbind="unbindBackup"/>
    31 <reference name="repositoryManagementMBean" interface="org.apache.jackrabbit.oak.api.jmx.RepositoryManagementMBean" cardinality="1..1" policy="static" bind="bindRepositoryManagementMBean" unbind="unbindRepositoryMa
    32 nagementMBean"/>
    33 <implementation class="org.apache.sling.server.impl.jmx.ManagedRepository"/>
    34 </scr:component>