All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.happyonroad.component.core.ComponentResource Maven / Gradle / Ivy

Go to download

The spring component framework is used to setup a plugin based, micro-kernel, standalone application (today, we will support webapp in later releases) which is based on SpringFramework. It can help you decouple your application into several components clearly with zero invasion and keep your application consistent between develop time and runtime.

The newest version!
/**
 * @author XiongJie, Date: 13-9-2
 */
package net.happyonroad.component.core;

import java.io.IOException;
import java.io.InputStream;
import java.util.jar.Manifest;

/**
 * 组件的资源
 */
public abstract class ComponentResource {

    protected Manifest manifest;

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // 主要对外公开API
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////


    public InputStream getPomStream() throws IOException {
        return getInputStream("META-INF/pom.xml");
    }

    public InputStream getApplicationStream() throws IOException {
        return getInputStream("META-INF/application.xml");
    }

    public InputStream getServiceStream() throws IOException {
        return getInputStream("META-INF/service.xml");
    }

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // 次要对外API
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public Manifest getManifest() {
        return manifest;
    }

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // 内部实现方法
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////
    public abstract InputStream getInputStream(String relativePath) throws IOException;

    public abstract boolean exists(String relativePath);

    public abstract void close();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy