
org.apache.InstanceManagerImpl Maven / Gradle / Ivy
The newest version!
/**
*
* Copyright(c) IronOre Server and it's author(s).
*
* Licensed under LGPL License version 3.0 or later.
* Contains traces of code released under Apache License
*
* You can get a copy of Apache License at :-
* http://www.apache.org/licenses/LICENSE-2.0
*
* and LGPL License at :-
* http://www.gnu.org/licenses/lgpl.html
*
* 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;
import java.lang.reflect.InvocationTargetException;
import javax.naming.NamingException;
import org.apache.jasper.runtime.InstanceManagerFactory;
import com.ironore.common.log.Logger;
import static com.ironore.common.log.LoggerFactory.*;
import static java.lang.String.format;
/**
* An implementation of {@link InstanceManager} to instantiates tags when Jasper
* requires them. Servlet that Jasper generate will contains reference to
* {@link InstanceManager} created through {@link InstanceManagerFactory}.
*
* @see {@link InstanceManager}
* @see {@link InstanceManagerFactory}
*
* @author tmjee
*/
public class InstanceManagerImpl implements InstanceManager {
private static final Logger LOG = getLog(InstanceManagerImpl.class);
@Override
public Object newInstance(String className) throws IllegalAccessException,
InvocationTargetException, NamingException, InstantiationException,
ClassNotFoundException {
LOG.info(format("new Instance [%s]", className));
return Class.forName(className).newInstance();
}
@Override
public Object newInstance(String fqcn, ClassLoader classLoader)
throws IllegalAccessException, InvocationTargetException,
NamingException, InstantiationException, ClassNotFoundException {
LOG.info(format("new instance [%s] [%s]", fqcn, classLoader));
return Class.forName(fqcn, true, classLoader).newInstance();
}
@Override
public void newInstance(Object o) throws IllegalAccessException,
InvocationTargetException, NamingException {
LOG.info(format("new instance [%s] [%s]", o.getClass(), o));
}
@Override
public void destroyInstance(Object o) throws IllegalAccessException,
InvocationTargetException {
LOG.info(format("Destroy instance [%s] [%s]", o.getClass(), o));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy