blob: d3f52b205ff9a1357b50acc86ce8dedbd53e498a [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.felix.bundlerepository.metadataparser;
/**
* this class adds type of elements to the parser
*/
public class MappingProcessingInstructionHandler
{
private XmlCommonHandler m_handler;
private String m_name;
private String m_classname;
public MappingProcessingInstructionHandler(XmlCommonHandler handler)
{
m_handler = handler;
}
public void process() throws Exception
{
if (m_name == null)
{
throw new Exception("element is missing");
}
if (m_classname == null)
{
throw new Exception("class is missing");
}
m_handler.addType(m_name, getClass().getClassLoader().loadClass(m_classname), null, null);
}
public void setElement(String element)
{
m_name = element;
}
public void setClass(String classname)
{
m_classname = classname;
}
}