init
commit
c07515b18c
|
@ -0,0 +1,13 @@
|
|||
|
||||
# 程序生成
|
||||
BKPG/target
|
||||
BKPG_DEMO/target
|
||||
BKPG_PROTOCAL/target
|
||||
PLUGIN_BKPG_GROUP_PROCESS/target
|
||||
|
||||
ext/*.jar
|
||||
|
||||
|
||||
|
||||
# 个人项目
|
||||
PLUGIN_BKPG_Company
|
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Datasource local storage ignored files
|
||||
/../../../../../:\projects_self\java\BKPG_PROj\.idea/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
|
@ -0,0 +1,8 @@
|
|||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="PLUGIN_BKPG_Company:jar">
|
||||
<output-path>$PROJECT_DIR$/ext</output-path>
|
||||
<root id="archive" name="PLUGIN_BKPG_Company.jar">
|
||||
<element id="module-output" name="PLUGIN_BKPG_Company" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="BKPG_DEMO" />
|
||||
<module name="BKPG_PROTOCAL" />
|
||||
<module name="PLUGIN_BKPG_GROUP_PROCESS" />
|
||||
<module name="PLUGIN_BKPG_Company" />
|
||||
<module name="BKPG" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name=".mvn (1)" target="1.5" />
|
||||
<module name=".mvn (2)" target="1.5" />
|
||||
<module name="BKPG" target="8" />
|
||||
<module name="BKPG_DEMO" target="8" />
|
||||
<module name="BKPG_PROj" target="8" />
|
||||
<module name="BKPG_PROTOCAL" target="8" />
|
||||
<module name="PLUGIN_BKPG_Company" target="1.8" />
|
||||
<module name="PLUGIN_BKPG_GROUP_PROCESS" target="8" />
|
||||
</bytecodeTargetLevel>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/BKPG/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/BKPG/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/BKPG/src/main/resources/img" charset="GBK" />
|
||||
<file url="file://$PROJECT_DIR$/BKPG_DEMO/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/BKPG_PROTOCAL/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/PLUGIN_BKPG_Company/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/PLUGIN_BKPG_GROUP_PROCESS/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/PLUGIN_BKPG_GROUP_PROCESS/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,13 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: junit:junit:4.11">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../basic/Maven/maven_repository/junit/junit/4.11/junit-4.11.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$PROJECT_DIR$/../../../basic/Maven/maven_repository/junit/junit/4.11/junit-4.11-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../basic/Maven/maven_repository/junit/junit/4.11/junit-4.11-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -0,0 +1,13 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: org.hamcrest:hamcrest-core:1.3">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../basic/Maven/maven_repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$PROJECT_DIR$/../../../basic/Maven/maven_repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../basic/Maven/maven_repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -0,0 +1,15 @@
|
|||
<component name="libraryTable">
|
||||
<library name="Maven: top.dreamcenter.bkpg:BKPG_PROTOCAL:1.0-SNAPSHOT">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../../../basic/Maven/maven_repository/top/dreamcenter/bkpg/BKPG_PROTOCAL/1.0-SNAPSHOT/BKPG_PROTOCAL-1.0-SNAPSHOT.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$PROJECT_DIR$/BKPG_PROTOCAL/BKPG_PROTOCAL-1.0-SNAPSHOT-javadoc.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/../../../basic/Maven/maven_repository/top/dreamcenter/bkpg/BKPG_PROTOCAL/1.0-SNAPSHOT/BKPG_PROTOCAL-1.0-SNAPSHOT-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/BKPG_PROTOCAL/BKPG_PROTOCAL-1.0-SNAPSHOT-sources.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/../../../basic/Maven/maven_repository/top/dreamcenter/bkpg/BKPG_PROTOCAL/1.0-SNAPSHOT/BKPG_PROTOCAL-1.0-SNAPSHOT-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/BKPG/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/BKPG_DEMO/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/BKPG_PROTOCAL/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/BKPG_SELF/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/BKPG_GROUP_PROCESS_TEMPLATE/BKPG_GROUP_PROCESS_TEMPLATE/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/BKPG_GROUP_PROCESS_TEMPLATE/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/PLUGIN_BKPG_Company/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/PLUGIN_BKPG_GROUP_PROCESS/pom.xml" />
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/BKPG/BKPG.iml" filepath="$PROJECT_DIR$/BKPG/BKPG.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/BKPG_DEMO/BKPG_DEMO.iml" filepath="$PROJECT_DIR$/BKPG_DEMO/BKPG_DEMO.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/BKPG_PROTOCAL/BKPG_PROTOCAL.iml" filepath="$PROJECT_DIR$/BKPG_PROTOCAL/BKPG_PROTOCAL.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/BKPG_PROj.iml" filepath="$PROJECT_DIR$/BKPG_PROj.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/PLUGIN_BKPG_Company/PLUGIN_BKPG_Company.iml" filepath="$PROJECT_DIR$/PLUGIN_BKPG_Company/PLUGIN_BKPG_Company.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/PLUGIN_BKPG_GROUP_PROCESS/PLUGIN_BKPG_GROUP_PROCESS.iml" filepath="$PROJECT_DIR$/PLUGIN_BKPG_GROUP_PROCESS/PLUGIN_BKPG_GROUP_PROCESS.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,124 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/test-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.11" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||
<orderEntry type="module" module-name="BKPG_PROTOCAL" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,60 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>BKPG_PROj</artifactId>
|
||||
<groupId>top.dreamcenter</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<groupId>top.dreamcenter.bkpg</groupId>
|
||||
<artifactId>BKPG</artifactId>
|
||||
|
||||
<name>BKPG</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>top.dreamcenter.bkpg</groupId>
|
||||
<artifactId>BKPG_PROTOCAL</artifactId>
|
||||
<version>${revision}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>top.dreamcenter.bkpg.App</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,58 @@
|
|||
package top.dreamcenter.bkpg;
|
||||
|
||||
import top.dreamcenter.bkpg.ui.MainFrame;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* 应用管理器
|
||||
*
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
public static void main(String[] args){
|
||||
final MainFrame[] mainFrame = {new MainFrame()};
|
||||
mainFrame[0].setVisible(true);
|
||||
|
||||
|
||||
if (SystemTray.isSupported()){
|
||||
URL url = App.class.getClassLoader().getResource("img/icon.png");
|
||||
|
||||
|
||||
Image icon = Toolkit.getDefaultToolkit().createImage(url);
|
||||
SystemTray tray = SystemTray.getSystemTray();
|
||||
|
||||
|
||||
PopupMenu popupMenu = new PopupMenu();
|
||||
MenuItem reloadItem = new MenuItem("Reload");
|
||||
reloadItem.addActionListener(e -> {
|
||||
mainFrame[0].setVisible(false);
|
||||
mainFrame[0].reloadFrame();
|
||||
mainFrame[0].setVisible(true);
|
||||
});
|
||||
MenuItem exitItem = new MenuItem("Exit");
|
||||
exitItem.addActionListener(e -> System.exit(0));
|
||||
popupMenu.add(reloadItem);
|
||||
popupMenu.add(exitItem);
|
||||
|
||||
TrayIcon trayIcon = new TrayIcon(icon, "任务管理器", popupMenu);
|
||||
trayIcon.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (e.getButton() == 1) {
|
||||
mainFrame[0].setVisible(!mainFrame[0].isVisible());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
tray.add(trayIcon);
|
||||
} catch (AWTException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package top.dreamcenter.bkpg.entity;
|
||||
|
||||
import top.dreamcenter.bkpg.protocal.MiniApp;
|
||||
|
||||
/**
|
||||
* 应用包装
|
||||
*/
|
||||
public class MiniAppJListWrap {
|
||||
private MiniApp miniApp;
|
||||
|
||||
public MiniAppJListWrap(MiniApp miniApp) {
|
||||
this.miniApp = miniApp;
|
||||
}
|
||||
|
||||
public MiniApp getMiniApp() {
|
||||
return miniApp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return miniApp.getName();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package top.dreamcenter.bkpg.ui;
|
||||
|
||||
import top.dreamcenter.bkpg.entity.MiniAppJListWrap;
|
||||
import top.dreamcenter.bkpg.protocal.MiniApp;
|
||||
import top.dreamcenter.bkpg.util.MiniAppRegister;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MainFrame extends JFrame {
|
||||
|
||||
|
||||
private final HashMap<String, MiniApp> container;
|
||||
|
||||
public MainFrame() {
|
||||
|
||||
container = MiniAppRegister.registerApps();
|
||||
|
||||
// 基础设置
|
||||
setSize(600,400);
|
||||
setLocationRelativeTo(null);
|
||||
setLayout(null);
|
||||
setTitle("JM管理器");
|
||||
setResizable(false);
|
||||
URL resource = MainFrame.class.getClassLoader().getResource("img/icon.png");
|
||||
Image icon = Toolkit.getDefaultToolkit().createImage(resource);
|
||||
setIconImage(icon);
|
||||
|
||||
initializeContent();
|
||||
|
||||
}
|
||||
|
||||
private void initializeContent() {
|
||||
|
||||
// 面板
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new BorderLayout());
|
||||
panel.setBounds(156, 2,424,358);
|
||||
panel.setBackground(new Color(250,250,250));
|
||||
panel.add(new JLabel("欢迎使用JM管理器"), BorderLayout.NORTH);
|
||||
|
||||
// 任务列表
|
||||
DefaultListModel<MiniAppJListWrap> model = new DefaultListModel<>();
|
||||
for (Map.Entry<String, MiniApp> next : container.entrySet()) {
|
||||
model.addElement(new MiniAppJListWrap(next.getValue()));
|
||||
}
|
||||
JList<MiniAppJListWrap> list = new JList<>(model);
|
||||
list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
list.addListSelectionListener(e -> {
|
||||
if (!e.getValueIsAdjusting()){
|
||||
panel.removeAll();
|
||||
|
||||
MiniAppJListWrap entity = list.getSelectedValue();
|
||||
|
||||
panel.add(entity.getMiniApp().getPanel());
|
||||
panel.updateUI();
|
||||
}
|
||||
});
|
||||
JScrollPane tasksPanelS = new JScrollPane(list);
|
||||
tasksPanelS.setBounds(2,2,150,358);
|
||||
|
||||
|
||||
add(tasksPanelS);
|
||||
add(panel);
|
||||
}
|
||||
|
||||
public void reloadFrame() {
|
||||
|
||||
// 1. 保护中的程序列表
|
||||
Map<String, MiniApp> protectedApps = container.entrySet().stream()
|
||||
.filter(item -> item.getValue().protect())
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
|
||||
// 2. 新的程序列表
|
||||
HashMap<String, MiniApp> list = MiniAppRegister.registerApps();
|
||||
list.forEach((key, value) -> {
|
||||
if (!protectedApps.containsKey(key)) {
|
||||
protectedApps.put(key, value);
|
||||
}
|
||||
});
|
||||
|
||||
// 放入容器
|
||||
container.clear();
|
||||
container.putAll(protectedApps);
|
||||
|
||||
|
||||
|
||||
getContentPane().removeAll();
|
||||
initializeContent();
|
||||
|
||||
revalidate();
|
||||
repaint();
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package top.dreamcenter.bkpg.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
|
||||
public class JarFileFilter implements FilenameFilter {
|
||||
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.endsWith(".jar");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package top.dreamcenter.bkpg.util;
|
||||
|
||||
import top.dreamcenter.bkpg.protocal.MiniApp;
|
||||
import top.dreamcenter.bkpg.protocal.MiniAppGroup;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
/**
|
||||
* 应用注册器
|
||||
*/
|
||||
public class MiniAppRegister {
|
||||
/**
|
||||
* 注册 ext 文件夹下的扩展应用
|
||||
* @return
|
||||
*/
|
||||
public static HashMap<String, MiniApp> registerApps() {
|
||||
HashMap<String, MiniApp> miniAppContainer = new HashMap<>();
|
||||
|
||||
Class<MiniApp> miniAppClass = MiniApp.class;
|
||||
Class<MiniAppGroup> miniAppGroupClass = MiniAppGroup.class;
|
||||
|
||||
// 找到ext 文件夹 并且初始化ext路径类加载器
|
||||
String extDirectory = "ext";
|
||||
File file = new File(extDirectory);
|
||||
|
||||
// 解析ext 目录下的 Jar文件
|
||||
File[] files = file.listFiles(new JarFileFilter());
|
||||
if (files == null) return new HashMap<>();
|
||||
|
||||
// 遍历jar文件
|
||||
for (File tmp : files) {
|
||||
JarFile jarFile = null;
|
||||
try {
|
||||
jarFile = new JarFile("/" + tmp.getAbsoluteFile());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// 解析jar包
|
||||
if (jarFile != null) {
|
||||
Enumeration<JarEntry> entries = jarFile.entries();
|
||||
while (entries.hasMoreElements()){
|
||||
JarEntry jarEntry = entries.nextElement();
|
||||
// 解析class文件
|
||||
if (jarEntry.getName().endsWith(".class") && !jarEntry.getName().contains("$")){
|
||||
String classRoute = jarEntry.getName().replaceAll("/", ".").replace(".class", "");
|
||||
|
||||
try {
|
||||
// 装载类
|
||||
URLClassLoader loader = new URLClassLoader(new URL[]{tmp.toURI().toURL()});
|
||||
Class<?> clazz = loader.loadClass(classRoute);
|
||||
|
||||
// 校验是否符合协议
|
||||
if (miniAppClass.isAssignableFrom(clazz)) { // 单应用
|
||||
// 注册进容器
|
||||
Object obj = clazz.getConstructor().newInstance();
|
||||
miniAppContainer.put(classRoute, (MiniApp) obj);
|
||||
} else if(miniAppGroupClass.isAssignableFrom(clazz)){ // 组合应用
|
||||
// 注册进容器
|
||||
Object obj = clazz.getConstructor().newInstance();
|
||||
MiniAppGroup group = (MiniAppGroup) obj;
|
||||
List<MiniApp> miniApps = group.getMiniApps();
|
||||
|
||||
// 检查返回值是否为空,如果为空则不处理
|
||||
if (miniApps != null) {
|
||||
for (int i = 0; i < miniApps.size(); i++) {
|
||||
MiniApp app = miniApps.get(i);
|
||||
miniAppContainer.put(classRoute + "-" + app.getName(), app);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 返回结果
|
||||
return miniAppContainer;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Manifest-Version: 1.0
|
||||
Main-Class: top.dreamcenter.bkpg.App
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 178 B |
|
@ -0,0 +1,20 @@
|
|||
package top.dreamcenter.bkpg;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class AppTest
|
||||
{
|
||||
/**
|
||||
* Rigorous Test :-)
|
||||
*/
|
||||
@Test
|
||||
public void shouldAnswerWithTrue()
|
||||
{
|
||||
assertTrue( true );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/test-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/ext" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="BKPG_PROTOCAL" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>BKPG_PROj</artifactId>
|
||||
<groupId>top.dreamcenter</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<groupId>top.dreamcenter.bkpg</groupId>
|
||||
<artifactId>BKPG_DEMO</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>top.dreamcenter.bkpg</groupId>
|
||||
<artifactId>BKPG_PROTOCAL</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<outputDirectory>${project.parent.basedir}/ext</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,28 @@
|
|||
package top.dreamcenter.bkpg.demo;
|
||||
|
||||
import top.dreamcenter.bkpg.demo.ui.MainPanel;
|
||||
import top.dreamcenter.bkpg.protocal.MiniApp;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class DemoApp implements MiniApp {
|
||||
|
||||
private static final String DEMO_APP = "案例程序";
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return DEMO_APP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getPanel() {
|
||||
MainPanel mainPanel = new MainPanel();
|
||||
mainPanel.add(new JLabel(getName()));
|
||||
return mainPanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean protect() {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package top.dreamcenter.bkpg.demo;
|
||||
|
||||
import top.dreamcenter.bkpg.protocal.template.ProcessAppTemplate;
|
||||
|
||||
public class DemoApp2 extends ProcessAppTemplate {
|
||||
private static final String DEMO_APP = "案例程序2";
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return DEMO_APP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCmdStr() {
|
||||
return "ping 81.70.80.152 -t";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package top.dreamcenter.bkpg.demo;
|
||||
|
||||
import top.dreamcenter.bkpg.protocal.template.ProcessAppTemplate;
|
||||
|
||||
public class DemoApp3 extends ProcessAppTemplate {
|
||||
@Override
|
||||
public String getName() {
|
||||
return "案例程序3";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCmdStr() {
|
||||
return "ipconfig";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package top.dreamcenter.bkpg.demo;
|
||||
|
||||
import top.dreamcenter.bkpg.protocal.MiniApp;
|
||||
import top.dreamcenter.bkpg.protocal.MiniAppGroup;
|
||||
import top.dreamcenter.bkpg.protocal.template.ProcessAppTemplate;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class DemoGroupApp implements MiniAppGroup {
|
||||
@Override
|
||||
public List<MiniApp> getMiniApps() {
|
||||
|
||||
List<MiniApp> list = new LinkedList<>();
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int finalI = i;
|
||||
MiniApp miniApp = new ProcessAppTemplate() {
|
||||
@Override
|
||||
public String getCmdStr() {
|
||||
return "ping www.baidu.com -n " + (finalI + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "GroupDemo" + finalI;
|
||||
}
|
||||
};
|
||||
list.add(miniApp);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package top.dreamcenter.bkpg.demo.ui;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class MainPanel extends JPanel {
|
||||
|
||||
public MainPanel() {
|
||||
|
||||
JLabel label = new JLabel("这是一个demo");
|
||||
|
||||
add(label);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/test-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>top.dreamcenter.bkpg</groupId>
|
||||
<artifactId>BKPG_PROTOCAL</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,27 @@
|
|||
package top.dreamcenter.bkpg.protocal;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* 程序基类
|
||||
*/
|
||||
public interface MiniApp {
|
||||
|
||||
/**
|
||||
* 获取应用名称
|
||||
* @return 应用名称
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* 获取应用面板
|
||||
* @return 面板
|
||||
*/
|
||||
JPanel getPanel();
|
||||
|
||||
/**
|
||||
* 保护应用,重启的时候是否重新装载
|
||||
* @return
|
||||
*/
|
||||
boolean protect();
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package top.dreamcenter.bkpg.protocal;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 程序组合包
|
||||
*/
|
||||
public interface MiniAppGroup {
|
||||
|
||||
/**
|
||||
* 获取所有的组合
|
||||
* @return 组合
|
||||
*/
|
||||
List<MiniApp> getMiniApps();
|
||||
|
||||
}
|
|
@ -0,0 +1,191 @@
|
|||
package top.dreamcenter.bkpg.protocal.template;
|
||||
|
||||
import top.dreamcenter.bkpg.protocal.MiniApp;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 进程启动模板
|
||||
*/
|
||||
public abstract class ProcessAppTemplate implements MiniApp, ActionListener {
|
||||
|
||||
private Process process;
|
||||
|
||||
private JTextArea textArea;
|
||||
|
||||
private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
/**
|
||||
* 需要执行的命令
|
||||
* @return CMD命令
|
||||
*/
|
||||
public abstract String getCmdStr();
|
||||
|
||||
@Override
|
||||
public JPanel getPanel() {
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new BorderLayout());
|
||||
panel.setBackground(Color.WHITE);
|
||||
|
||||
JPanel centerPanel = new JPanel();
|
||||
centerPanel.setLayout(new FlowLayout());
|
||||
centerPanel.setBackground(Color.WHITE);
|
||||
|
||||
// 标题
|
||||
JLabel title = new JLabel(getName());
|
||||
|
||||
// 按钮组
|
||||
JButton startBtn = new JButton("启动");
|
||||
JButton stopBtn = new JButton("停止");
|
||||
|
||||
startBtn.setBackground(Color.WHITE);
|
||||
stopBtn.setBackground(Color.WHITE);
|
||||
|
||||
startBtn.addActionListener(this);
|
||||
stopBtn.addActionListener(this);
|
||||
|
||||
startBtn.setActionCommand("start");
|
||||
stopBtn.setActionCommand("stop");
|
||||
|
||||
centerPanel.add(startBtn);
|
||||
centerPanel.add(stopBtn);
|
||||
|
||||
// 输出
|
||||
if (textArea == null) {
|
||||
textArea = new JTextArea();
|
||||
}
|
||||
textArea.setBackground(Color.DARK_GRAY);
|
||||
textArea.setForeground(Color.WHITE);
|
||||
textArea.setRows(15);
|
||||
JScrollPane scrollPane = new JScrollPane(textArea);
|
||||
|
||||
panel.add(title, BorderLayout.NORTH);
|
||||
panel.add(centerPanel, BorderLayout.CENTER);
|
||||
panel.add(scrollPane, BorderLayout.SOUTH);
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
switch (e.getActionCommand()){
|
||||
case "start": btnStartMethod(); break;
|
||||
case "stop": btnStopMethod(); break;
|
||||
default:
|
||||
System.out.println("未找到的命令:" + e.getActionCommand());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按钮 - 启动
|
||||
*/
|
||||
private void btnStartMethod() {
|
||||
new Thread(() -> {
|
||||
successWrite("尝试启动程序...");
|
||||
if (process != null) {
|
||||
failWrite("已启动过。");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
process = Runtime.getRuntime().exec(getCmdStr());
|
||||
successWrite("启动成功!");
|
||||
heartbeatCheck();
|
||||
String tmp;
|
||||
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream(), "GBK"));
|
||||
BufferedReader errReader = new BufferedReader(new InputStreamReader(process.getErrorStream(), "GBK"));
|
||||
|
||||
while ((tmp = reader.readLine()) != null) {
|
||||
successWrite(tmp);
|
||||
}
|
||||
|
||||
while ((tmp = errReader.readLine()) != null) {
|
||||
failWrite(tmp);
|
||||
}
|
||||
|
||||
reader.close();
|
||||
errReader.close();
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
/**
|
||||
* 按钮 - 停止
|
||||
*/
|
||||
private void btnStopMethod() {
|
||||
if (process ==null) {
|
||||
failWrite("未启动。");
|
||||
return;
|
||||
}
|
||||
if (process.isAlive()) process.destroy();
|
||||
process = null;
|
||||
successWrite("已终止。");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 写入正确信息
|
||||
* @param raw 原文
|
||||
*/
|
||||
private void successWrite(String raw) {
|
||||
textArea.append(formatOutput(true, raw));
|
||||
}
|
||||
|
||||
/**
|
||||
* 写入错误信息
|
||||
* @param raw 原文
|
||||
*/
|
||||
private void failWrite(String raw) {
|
||||
textArea.append(formatOutput(false, raw));
|
||||
}
|
||||
|
||||
/**
|
||||
* 输出格式化
|
||||
* @param code 是否成功结果
|
||||
* @param raw 原文
|
||||
* @return 输出结果
|
||||
*/
|
||||
private String formatOutput(boolean code,String raw) {
|
||||
return (code ? "O" : "E") + " " + dateFormat.format(Calendar.getInstance().getTime()) + " " + raw + "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* 5 分钟心跳检测,如果心跳停止,则自动释放进程
|
||||
*/
|
||||
private void heartbeatCheck() {
|
||||
new Thread(() -> {
|
||||
while (true) {
|
||||
if (process == null) break;
|
||||
else if (!process.isAlive()) {
|
||||
failWrite("心跳停止");
|
||||
process.destroy();
|
||||
process = null;
|
||||
successWrite("已释放资源");
|
||||
break;
|
||||
}
|
||||
try {
|
||||
TimeUnit.SECONDS.sleep(5);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean protect() {
|
||||
return process != null && process.isAlive();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/${project.build.directory}/test-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="BKPG_PROTOCAL" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>BKPG_PROj</artifactId>
|
||||
<groupId>top.dreamcenter</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<groupId>top.dreamcenter.bkpg.plugin.group</groupId>
|
||||
<artifactId>PLUGIN_BKPG_GROUP_PROCESS</artifactId>
|
||||
|
||||
<name>PLUGIN_BKPG_GROUP_PROCESS</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>top.dreamcenter.bkpg</groupId>
|
||||
<artifactId>BKPG_PROTOCAL</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<outputDirectory>${project.parent.basedir}/ext</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,52 @@
|
|||
package top.dreamcenter.bkpg.group;
|
||||
|
||||
import top.dreamcenter.bkpg.protocal.MiniApp;
|
||||
import top.dreamcenter.bkpg.protocal.MiniAppGroup;
|
||||
import top.dreamcenter.bkpg.protocal.template.ProcessAppTemplate;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class ProcessGroupApp implements MiniAppGroup {
|
||||
@Override
|
||||
public List<MiniApp> getMiniApps() {
|
||||
|
||||
List<MiniApp> list = new LinkedList<>();
|
||||
|
||||
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("ext/ProgressGroup.txt")))) {
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
String[] split = line.split(": ");
|
||||
|
||||
String appName = split[0];
|
||||
String appCmd = split[1];
|
||||
|
||||
MiniApp miniApp = new ProcessAppTemplate() {
|
||||
@Override
|
||||
public String getCmdStr() {
|
||||
return appCmd;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return appName;
|
||||
}
|
||||
};
|
||||
|
||||
list.add(miniApp);
|
||||
}
|
||||
|
||||
} catch (Exception e){
|
||||
System.err.println(e.getMessage());
|
||||
return list;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,118 @@
|
|||
|
||||
## 项目架构
|
||||
|
||||
主工程
|
||||
|
||||
模块 | 作用
|
||||
--- | ---
|
||||
BKPG | 主应用程序
|
||||
BKPG_PROTOCAL | 三方扩展协议
|
||||
BKPG_DEMO | 简单示例扩展
|
||||
|
||||
官方扩展插件工程
|
||||
|
||||
模块 | 作用
|
||||
--- | ---
|
||||
PLUGIN_BKPG_GROUP_PROCESS | 命令组
|
||||
|
||||
|
||||
## 生产环境
|
||||
|
||||
- JAVA : 8
|
||||
|
||||
## 主应用程序执行逻辑
|
||||
|
||||
1. 应用启动,绘制UI,挂载到系统托盘
|
||||
2. 扫描注册ext目录下的jar包(扫描实现了MiniApp的类)
|
||||
3. 程序挂载
|
||||
|
||||
## 扩展协议
|
||||
|
||||
### 可用协议
|
||||
|
||||
```text
|
||||
MiniApp 基础协议
|
||||
┗ ProcessAppTemplate 命令执行协议模板
|
||||
↑
|
||||
MiniAppGroup 程序组合包
|
||||
```
|
||||
|
||||
### 协议结构定义
|
||||
|
||||
MiniApp
|
||||
- String getName(); // 获取应用名称
|
||||
- JPanel getPanel(); // 获取应用面板
|
||||
- boolean protect(); // 保护应用,重启是否重新装载
|
||||
|
||||
MiniAppGroup
|
||||
- List\<MiniApp> getMiniApps(); // 获取所有的应用
|
||||
|
||||
ProcessAppTemplate: MiniApp
|
||||
- String getName(); // 获取应用名称
|
||||
- String getCmdStr(); // 需要执行的命令
|
||||
- 其余基类函数已默认实现
|
||||
|
||||
|
||||
### 详细说明
|
||||
|
||||
**MiniApp** 为基础协议,所有的扩展实现都需要继承或者实现该协议,
|
||||
主应用程序只会扫描到实现了该接口的类,并且注册到容器中。
|
||||
MiniAppGroup是对MiniApp的扩展,旨在一次性批量注入MiniApp,
|
||||
同样也会被扫描到,其下的miniApp也都会被注册。
|
||||
|
||||
MiniApp中,getName 是用于获取任务名称的,不用担心重复导致程序异常
|
||||
(因为注册时采用的是类完整访问路径注册的), 不过建议名称具有标志性,
|
||||
这样才能快速识别该任务所具备的特质。
|
||||
|
||||
getPanel 是绘制的面板,即右面板,实际的操作区,可以自定义,
|
||||
也可以采用模板快速构建(如ProcessAppTemplate)。
|
||||
如果自定义,或者制作模板,需要注意以下几点:
|
||||
|
||||
1. 长连接的任务,强烈建议做好资源的调度,适量增加 任务控制按钮
|
||||
(启动、终止);如果可监测,建议增加连接心跳监测机制,
|
||||
在一定时间后,自动断开连接。
|
||||
2. 从A任务切换到B任务,A任务面板会销毁,调用B任务面板,
|
||||
但是任务的实例不会销毁,所以,你可以将一些数据存于全局变量来存储
|
||||
上一会话的某些状态量。
|
||||
3. 主程序面板的大小是固定的,所以,为了界面协调,建议纵向布局,
|
||||
并且内容较多的话,适量增加滚动条。
|
||||
4. 任务自身不建议开辟太大的内存空间,以免出现任务切换卡顿现象,
|
||||
如果一定要用大量内存,也做好完备的内存管控,避免出现OOM的情况。
|
||||
|
||||
protect() 是保护函数,如果返回true,则表示在BKPG进行RELOAD时,该App不会被注销,
|
||||
而是保持实例不变,状态也都保持。这通常作为服务器服务非常关键,比如想要添加一个指令,
|
||||
需要RELOAD但是原有服务不能关闭,如果设置为true就可以实现保护。
|
||||
|
||||
**ProcessAppTemplate** 为命令执行协议模板,为抽象类,继承实现了MiniApp接口,
|
||||
用于执行命令行指令,需要实现两个接口,一个是getName,作用同上,另外一个是该抽象类
|
||||
独有的,getCmdStr,需要设置命令行的完整执行指令。当点击面板的执行按钮时,
|
||||
会启动一个线程来执行该命令,并且每5s会检测一次命令心跳,如果心跳失去连接,
|
||||
则会释放资源。可以作为一些应用或者服务的启动端。
|
||||
|
||||
|
||||
为了更加高效的添加命令(常用),
|
||||
官方内置了一个命令AppGroup: **PLUGIN_BKPG_GROUP_PROCESS** 。
|
||||
通过配置ext/ProgressGroup.txt来添加指令应用,
|
||||
指令名称和指令用英文冒号和一个空格隔开【: 】,会自动创建多组ProcessAppTemplate。
|
||||
|
||||
|
||||
|
||||
### 第三方扩展指南
|
||||
首先,下载BKPG_PROTOCAL协议JAR包,引入自己的项目中,作为环境依赖。
|
||||
之后在自己项目中实现MiniApp/MiniAppGroup接口或者ProcessAppTemplate抽象类即可。
|
||||
将JAR包生成路径配置到ext目录下,此时生成JAR包,点击主程序系统托盘右键的RELOAD选项,
|
||||
即可看到JAR包中的MiniApp都已经加载完毕了。
|
||||
|
||||
你可以参考BKPG_DEMO的项目或者直接套用该demo来架构一个项目。
|
||||
注意,最后打包时,不应该包含BKPG_PROTOCAL这个依赖,是冗余的,建议排除在外。
|
||||
|
||||
一个JAR包项目中可以包含多个MiniApp,这些MiniApp如果没有特殊机制劫持,
|
||||
最后全部会被装载进入到容器之中。
|
||||
|
||||
如果您开发了自己的工具包,并且认为非常具有价值,你也可以分享自己的JAR包给别人,
|
||||
或者分享给官方,由我们加入README进行大众分享。
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
PING百度: ping www.baidu.com
|
||||
PING主站: ping www.dreamcenter.top
|
|
@ -0,0 +1,57 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>top.dreamcenter</groupId>
|
||||
<artifactId>BKPG_PROj</artifactId>
|
||||
<version>${revision}</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>BKPG_PROj</name>
|
||||
<description>A tool to manage all self process.</description>
|
||||
|
||||
<modules>
|
||||
<module>BKPG</module>
|
||||
<module>BKPG_DEMO</module>
|
||||
<module>PLUGIN_BKPG_GROUP_PROCESS</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<revision>1.0-SNAPSHOT</revision>
|
||||
<junit.version>4.11</junit.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.4.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>3.6.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
|
||||
</project>
|
Loading…
Reference in New Issue