Parcourir la source

清理esb-admin无用文件

Airhead il y a 8 ans
Parent
commit
889e35fc35

+ 0 - 117
src/main/java/com/yihu/hos/common/ActiveMqUtil.java

@ -1,117 +0,0 @@
package com.yihu.hos.common;
import com.yihu.hos.common.activeMq.ActiveMqConstants;
import com.yihu.hos.common.activeMq.ActivemqConfiguration;
import org.apache.activemq.ActiveMQConnectionFactory;
import javax.jms.*;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/8/22.
 */
//@Component
public class ActiveMqUtil {
    static ConnectionFactory connectionFactory;
    static Connection connection = null;
    static Session session;
    static Map<String, MessageProducer> sendQueues = new ConcurrentHashMap<String, MessageProducer>();
    static Map<String, MessageConsumer> getQueues = new ConcurrentHashMap<String, MessageConsumer>();
    static {
        ActivemqConfiguration configuration = new ActivemqConfiguration();
        connectionFactory = new ActiveMQConnectionFactory(
                ActiveMqConstants.ACTIVE_MQ_USER,
                ActiveMqConstants.ACTIVE_MQ_PASS,
                ActiveMqConstants.ACTIVE_MQ_URI);
        try
        {
            connection = connectionFactory.createConnection();
            connection.start();
            session = connection.createSession(Boolean.FALSE.booleanValue(),
                    1);
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
    static MessageProducer getMessageProducer(String name) {
        if (sendQueues.containsKey(name))
            return ((MessageProducer)sendQueues.get(name));
        try
        {
            Destination destination = session.createQueue(name);
            MessageProducer producer = session.createProducer(destination);
            sendQueues.put(name, producer);
            return producer;
        } catch (JMSException e) {
            e.printStackTrace();
        }
        return ((MessageProducer)sendQueues.get(name));
    }
    static MessageConsumer getMessageConsumer(String name) {
        if (getQueues.containsKey(name))
            return ((MessageConsumer)getQueues.get(name));
        try
        {
            Destination destination = session.createQueue(name);
            MessageConsumer consumer = session.createConsumer(destination);
            getQueues.put(name, consumer);
            return consumer;
        } catch (JMSException e) {
            e.printStackTrace();
        }
        return ((MessageConsumer)getQueues.get(name));
    }
    public static void sendMessage(String queue, String text) {
        try {
            TextMessage message = session.createTextMessage(text);
            getMessageProducer(queue).send(message);
            // log.info("sendMessage " + queue + "\t\t" + text);
        }
        catch (JMSException e) {
            e.printStackTrace();
        }
    }
    public static String getMessage(String queue)
    {
        try {
            TextMessage message = (TextMessage)getMessageConsumer(queue).receive(10000L);
            if (message != null)
                return message.getText();
        } catch (JMSException e) {
            e.printStackTrace();
        }
        return null;
    }
    public static void close() {
        try {
            session.close();
        } catch (JMSException e) {
            e.printStackTrace();
        }
        try {
            connection.close();
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}

+ 0 - 13
src/main/java/com/yihu/hos/common/activeMq/ActiveMqConstants.java

@ -1,13 +0,0 @@
package com.yihu.hos.common.activeMq;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/8/22.
 */
public class ActiveMqConstants {
    public static String ACTIVE_MQ_USER = "";
    public static String ACTIVE_MQ_PASS = "";
    public static String ACTIVE_MQ_URI = "";
}

+ 0 - 29
src/main/java/com/yihu/hos/common/activeMq/ActivemqConfiguration.java

@ -1,29 +0,0 @@
package com.yihu.hos.common.activeMq;
import org.springframework.beans.factory.annotation.Value;
import javax.annotation.PostConstruct;
/**
 * 配置文件参数-静态初始化
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/8/21.
 */
//@Configuration
public class ActivemqConfiguration {
    @Value("${spring.activemq.broker-url}")
    private String brokerURL;
    @Value("${spring.activemq.user}")
    private String user;
    @Value("${spring.activemq.password}")
    private String password;
    @PostConstruct
    public void init() {
        ActiveMqConstants.ACTIVE_MQ_USER = user;
        ActiveMqConstants.ACTIVE_MQ_PASS = password;
        ActiveMqConstants.ACTIVE_MQ_URI = brokerURL;
    }
}

+ 0 - 27
src/main/java/com/yihu/hos/config/WebConfig.java

@ -1,27 +0,0 @@
package com.yihu.hos.config;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.view.UrlBasedViewResolver;
import org.springframework.web.servlet.view.tiles3.TilesConfigurer;
import org.springframework.web.servlet.view.tiles3.TilesView;
//@EnableWebMvc
//@Configuration
public class WebConfig {
    @Bean
    public UrlBasedViewResolver tilesViewResolver() {
        UrlBasedViewResolver tilesViewResolver = new UrlBasedViewResolver();
        tilesViewResolver.setViewClass(TilesView.class);
        return tilesViewResolver;
    }
    @Bean
    public TilesConfigurer tilesConfigurer() {
        TilesConfigurer tilesConfigurer = new TilesConfigurer();
        tilesConfigurer.setDefinitions(new String[]{"file:src/main/webapp/WEB-INF/ehr/commons/layout/layout.xml"});
        return tilesConfigurer;
    }
}