合并-9.14

web_backend_develope
wu ming 9 years ago
commit d2f5305d2b

6
.gitignore vendored

@ -1 +1,5 @@
build/ /target
/build
.classpath
/bin/

@ -0,0 +1,14 @@
!SESSION 2016-09-13 08:39:40.662 -----------------------------------------------
eclipse.buildId=4.3.0.I20130605-2000
java.version=1.8.0_91
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=zh_CN
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product
!ENTRY org.eclipse.egit.ui 2 0 2016-09-13 08:40:07.850
!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git
user global configuration and to define the default location to store repositories: 'C:\Users\wuming'. If this is
not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and
EGit might behave differently since they see different configuration options.
This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.

@ -0,0 +1,2 @@
GitRepositoriesView.GitDirectories=C\:\\Users\\wuming\\workspace\\data_manager_backend\\.git;
eclipse.preferences.version=1

@ -0,0 +1,14 @@
content_assist_proposals_background=255,255,255
content_assist_proposals_foreground=0,0,0
eclipse.preferences.version=1
fontPropagated=true
org.eclipse.jdt.internal.ui.navigator.layout=2
org.eclipse.jdt.ui.editor.tab.width=
org.eclipse.jdt.ui.formatterprofiles.version=12
org.eclipse.jdt.ui.javadoclocations.migrated=true
org.eclipse.jface.textfont=1|Courier New|10.0|0|WINDOWS|1|0|0|0|0|0|0|0|0|1|0|0|0|0|Courier New;
proposalOrderMigrated=true
spelling_locale_initialized=true
tabWidthPropagated=true
useAnnotationsPrefPage=true
useQuickDiffPrefPage=true

@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.m2e.discovery.pref.projects=

@ -0,0 +1,2 @@
eclipse.preferences.version=1
mylyn.attention.migrated=true

@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.mylyn.monitor.activity.tracking.enabled.checked=true

@ -0,0 +1,3 @@
eclipse.preferences.version=1
org.eclipse.mylyn.tasks.ui.filters.nonmatching=true
org.eclipse.mylyn.tasks.ui.filters.nonmatching.encouraged=true

@ -0,0 +1,3 @@
activeuserprofiles=DESKTOP-65KJ4BV;Team
eclipse.preferences.version=1
org.eclipse.rse.systemtype.local.systemType.defaultUserId=wuming

@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.rse.preferences.order.connections=DESKTOP-65KJ4BV.Local

@ -0,0 +1,2 @@
eclipse.preferences.version=1
pref_first_startup=false

@ -0,0 +1,2 @@
eclipse.preferences.version=1
org.eclipse.team.ui.first_time=false

@ -0,0 +1,2 @@
browsers=<?xml version\="1.0" encoding\="UTF-8"?>\r\n<web-browsers current\="0">\r\n<system/>\r\n<external location\="C\:\\Program Files\\Internet Explorer\\iexplore.exe" name\="Internet Explorer"/>\r\n</web-browsers>
eclipse.preferences.version=1

@ -0,0 +1,5 @@
PROBLEMS_FILTERS_MIGRATE=true
eclipse.preferences.version=1
platformState=1470357608478
quickStart=false
tipsAndTricks=true

@ -0,0 +1,2 @@
eclipse.preferences.version=1
showIntro=false

@ -0,0 +1,4 @@
//org.eclipse.ui.commands/state/org.eclipse.wst.xml.views.XPathView.processor.xpathprocessor/org.eclipse.ui.commands.radioState=xpath10
ENABLED_DECORATORS=org.eclipse.jst.ws.jaxws.dom.integration.navigator.WebServiceDecorator\:true,org.eclipse.m2e.core.mavenVersionDecorator\:false,org.eclipse.wst.server.ui.decorator\:false,org.eclipse.datatools.connectivity.sqm.core.internal.ui.explorer.DependencyDecoration\:true,org.eclipse.datatools.connectivity.sqm.core.internal.ui.explorer.ColumnDecoration\:true,org.eclipse.datatools.connectivity.sqm.core.internal.ui.explorer.ForeignKeyDecoration\:true,org.eclipse.datatools.connectivity.sqm.core.internal.ui.explorer.IndexTriggerDecoration\:true,org.eclipse.datatools.connectivity.internal.core.ui.bookmarkDecoration\:true,org.eclipse.datatools.connectivity.internal.core.ui.FilterNodeDecoration\:true,org.eclipse.datatools.connectivity.ui.decorator.contentextension\:false,org.eclipse.datatools.enablement.ingres.ui.providers.decorators.SynonymDecorationService\:true,org.eclipse.datatools.enablement.ingres.internal.ui.providers.decorators.ParameterDecorationService\:true,org.eclipse.datatools.enablement.sybase.asa.proxytabledecorator\:true,org.eclipse.datatools.enablement.sybase.ase.webservicetabledecorator\:true,org.eclipse.datatools.enablement.sybase.systemtabledecorator\:true,org.eclipse.egit.ui.internal.decorators.GitLightweightDecorator\:true,org.eclipse.jdt.ui.override.decorator\:true,org.eclipse.jdt.ui.interface.decorator\:false,org.eclipse.jdt.ui.buildpath.decorator\:true,org.eclipse.jst.j2ee.internal.ui.util.AnnotationIconDecorator_ejb\:true,org.eclipse.jst.j2ee.navigator.internal.J2EEProjectDecorator\:true,org.eclipse.jst.jee.ui.internal.navigator.ejb.BeanDecorator\:true,org.eclipse.jst.jee.navigator.internal.JEEProjectDecorator\:true,org.eclipse.jst.j2ee.internal.ui.util.AnnotationIconDecorator_servlet\:true,org.eclipse.m2e.core.maven2decorator\:true,org.eclipse.mylyn.context.ui.decorator.interest\:true,org.eclipse.mylyn.tasks.ui.decorators.task\:true,org.eclipse.mylyn.team.ui.changeset.decorator\:true,org.eclipse.pde.ui.binaryProjectDecorator\:false,org.eclipse.rse.core.virtualobject.decorator\:true,org.eclipse.rse.core.binary.executable.decorator\:true,org.eclipse.rse.core.script.executable.decorator\:true,org.eclipse.rse.core.java.executable.decorator\:true,org.eclipse.rse.core.library.decorator\:true,org.eclipse.rse.core.link.decorator\:true,org.eclipse.rse.subsystems.error.decorator\:true,org.eclipse.team.cvs.ui.decorator\:true,org.eclipse.ui.LinkedResourceDecorator\:true,org.eclipse.ui.SymlinkDecorator\:true,org.eclipse.ui.VirtualResourceDecorator\:true,org.eclipse.ui.ContentTypeDecorator\:true,org.eclipse.ui.ResourceFilterDecorator\:false,org.eclipse.wst.jsdt.ui.override.decorator\:true,org.eclipse.wst.server.ui.navigatorDecorator\:true,
PLUGINS_NOT_ACTIVATED_ON_STARTUP=org.eclipse.m2e.discovery;
eclipse.preferences.version=1

File diff suppressed because it is too large Load Diff

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<typeInfoHistroy/>

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<qualifiedTypeNameHistroy/>

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
<section name="org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart">
<item value="2" key="layout"/>
<item value="true" key="group_libraries"/>
<item value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#x0D;&#x0A;&lt;packageExplorer group_libraries=&quot;1&quot; layout=&quot;2&quot; linkWithEditor=&quot;0&quot; rootMode=&quot;1&quot; workingSetName=&quot;&quot;&gt;&#x0D;&#x0A;&lt;customFilters userDefinedPatternsEnabled=&quot;false&quot;&gt;&#x0D;&#x0A;&lt;xmlDefinedFilters&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.StaticsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer_patternFilterId_RemoteSystemsConnections&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.mylyn.java.ui.MembersFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonSharedProjectsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.internal.ui.PackageExplorer.EmptyInnerPackageFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.m2e.MavenModuleFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.ClosedProjectsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.EmptyLibraryContainerFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.PackageDeclarationFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.pde.ui.BinaryProjectFilter1&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.LocalTypesFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.pde.ui.ExternalPluginLibrariesFilter1&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.FieldsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer_patternFilterId_RemoteSystemsTempFiles&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonJavaProjectsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer_patternFilterId_.*&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.SyntheticMembersFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.ContainedLibraryFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.internal.ui.PackageExplorer.HideInnerClassFilesFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.ImportDeclarationFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonJavaElementFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.LibraryFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.CuAndClassFileFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.internal.ui.PackageExplorer.EmptyPackageFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonPublicFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;/xmlDefinedFilters&gt;&#x0D;&#x0A;&lt;/customFilters&gt;&#x0D;&#x0A;&lt;/packageExplorer&gt;" key="memento"/>
<item value="1" key="rootMode"/>
<item value="false" key="linkWithEditor"/>
</section>
</section>

@ -0,0 +1,41 @@
<configuration scan="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
<filter class="org.eclipse.m2e.logback.appender.ConsoleAppenderFilter"/>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${org.eclipse.m2e.log.dir}/0.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<FileNamePattern>${org.eclipse.m2e.log.dir}/%i.log</FileNamePattern>
<MinIndex>1</MinIndex>
<MaxIndex>10</MaxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>100MB</MaxFileSize>
</triggeringPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%date [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
</appender>
<appender name="EclipseLog" class="org.eclipse.m2e.logback.appender.EclipseLogAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
</filter>
</appender>
<appender name="MavenConsoleLog" class="org.eclipse.m2e.logback.appender.MavenConsoleAppender">
</appender>
<root level="INFO">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
<appender-ref ref="EclipseLog" />
<appender-ref ref="MavenConsoleLog" />
</root>
<logger name="com.ning.http.client" level="INFO" />
</configuration>

@ -0,0 +1,57 @@
# RSE DOM Node
00-name=DESKTOP-65KJ4BV\:local.files
01-type=FilterPool
03-attr.default=true
03-attr.deletable=true
03-attr.id=local.files
03-attr.nonRenamable=false
03-attr.owningParentName=null
03-attr.release=200
03-attr.singleFilterStringOnly=false
03-attr.singleFilterStringOnlyESet=false
03-attr.stringsCaseSensitive=true
03-attr.supportsDuplicateFilterStrings=false
03-attr.supportsNestedFilters=true
03-attr.type=default
06-child.00000.00-name=My Home
06-child.00000.01-type=Filter
06-child.00000.03-attr.default=false
06-child.00000.03-attr.filterType=default
06-child.00000.03-attr.id=My Home
06-child.00000.03-attr.nonChangable=false
06-child.00000.03-attr.nonDeletable=false
06-child.00000.03-attr.nonRenamable=false
06-child.00000.03-attr.promptable=false
06-child.00000.03-attr.relativeOrder=0
06-child.00000.03-attr.release=200
06-child.00000.03-attr.singleFilterStringOnly=false
06-child.00000.03-attr.stringsCaseSensitive=false
06-child.00000.03-attr.stringsNonChangable=false
06-child.00000.03-attr.supportsDuplicateFilterStrings=false
06-child.00000.03-attr.supportsNestedFilters=true
06-child.00000.06-child.00000.00-name=C\:\\Users\\wuming\\*
06-child.00000.06-child.00000.01-type=FilterString
06-child.00000.06-child.00000.03-attr.default=false
06-child.00000.06-child.00000.03-attr.string=C\:\\Users\\wuming\\*
06-child.00000.06-child.00000.03-attr.type=default
06-child.00001.00-name=Drives
06-child.00001.01-type=Filter
06-child.00001.03-attr.default=false
06-child.00001.03-attr.filterType=default
06-child.00001.03-attr.id=Drives
06-child.00001.03-attr.nonChangable=false
06-child.00001.03-attr.nonDeletable=false
06-child.00001.03-attr.nonRenamable=false
06-child.00001.03-attr.promptable=false
06-child.00001.03-attr.relativeOrder=0
06-child.00001.03-attr.release=200
06-child.00001.03-attr.singleFilterStringOnly=false
06-child.00001.03-attr.stringsCaseSensitive=false
06-child.00001.03-attr.stringsNonChangable=false
06-child.00001.03-attr.supportsDuplicateFilterStrings=false
06-child.00001.03-attr.supportsNestedFilters=true
06-child.00001.06-child.00000.00-name=*
06-child.00001.06-child.00000.01-type=FilterString
06-child.00001.06-child.00000.03-attr.default=false
06-child.00001.06-child.00000.03-attr.string=*
06-child.00001.06-child.00000.03-attr.type=default

@ -0,0 +1,25 @@
# RSE DOM Node
00-name=Local
01-type=Host
03-attr.description=
03-attr.hostname=LOCALHOST
03-attr.offline=false
03-attr.promptable=false
03-attr.systemType=org.eclipse.rse.systemtype.local
03-attr.type=Local
06-child.00000.00-name=Local Connector Service
06-child.00000.01-type=ConnectorService
06-child.00000.03-attr.group=Local Connector Service
06-child.00000.03-attr.port=0
06-child.00000.03-attr.useSSL=false
06-child.00000.06-child.00000.00-name=Local Files
06-child.00000.06-child.00000.01-type=SubSystem
06-child.00000.06-child.00000.03-attr.hidden=false
06-child.00000.06-child.00000.03-attr.type=local.files
06-child.00000.06-child.00000.06-child.00000.00-name=DESKTOP-65KJ4BV___DESKTOP-65KJ4BV\:local.files
06-child.00000.06-child.00000.06-child.00000.01-type=FilterPoolReference
06-child.00000.06-child.00000.06-child.00000.03-attr.refID=local.files
06-child.00000.06-child.00001.00-name=Local Shells
06-child.00000.06-child.00001.01-type=SubSystem
06-child.00000.06-child.00001.03-attr.hidden=false
06-child.00000.06-child.00001.03-attr.type=local.shells

@ -0,0 +1,7 @@
# RSE DOM Node
00-name=DESKTOP-65KJ4BV
01-type=Profile
03-attr.defaultPrivate=true
03-attr.isActive=true
05-ref.00000=FP.local.files_0
05-ref.00001=H.local_16

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
<section name="org.eclipse.ui.internal.QuickAccess">
<item value="759" key="dialogHeight"/>
<item value="1440" key="dialogWidth"/>
<list key="textEntries">
</list>
<list key="orderedElements">
</list>
<list key="orderedProviders">
</list>
<list key="textArray">
</list>
</section>
<section name="ShowViewDialog">
<item value="345" key="DIALOG_WIDTH"/>
<item value="1|Microsoft YaHei UI|9.0|0|WINDOWS|1|-12|0|0|0|400|0|0|0|1|0|0|0|0|Microsoft YaHei UI" key="DIALOG_FONT_NAME"/>
<item value="org.eclipse.jdt.ui.PackageExplorer" key="ShowViewDialog.STORE_SELECTED_VIEW_ID"/>
<item value="452" key="DIALOG_HEIGHT"/>
<item value="796" key="DIALOG_X_ORIGIN"/>
<item value="227" key="DIALOG_Y_ORIGIN"/>
<list key="ShowViewDialog.STORE_EXPANDED_CATEGORIES_ID">
<item value="org.eclipse.jdt.ui.java"/>
</list>
</section>
<section name="ImportExportAction">
</section>
</section>

@ -0,0 +1 @@
org.eclipse.core.runtime=1

@ -25,6 +25,11 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>

@ -0,0 +1,3 @@
eclipse.preferences.version=1
performed.operation.correct.unbound.jre=1.0
performed.operation.resolve.unknown.runtime=1.0

@ -1,4 +1,10 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
encoding//WebContent/WEB-INF/config/config.properties=UTF-8 encoding//WebContent/WEB-INF/config/config.properties=UTF-8
<<<<<<< HEAD
encoding//src/com/platform/controller/DataModelController.java=UTF-8 encoding//src/com/platform/controller/DataModelController.java=UTF-8
encoding/<project>=UTF-8 encoding/<project>=UTF-8
=======
encoding//src/com/platform/utils/GanymedSSH.java=UTF-8
encoding/<project>=UTF-8
separateDerivedEncodings=true
>>>>>>> ef099fd1aed73bcc4ef4c8d62aaba6cc6ec2dabf

@ -1,7 +1,101 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7 org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.compiler.source=1.7

@ -0,0 +1,3 @@
eclipse.preferences.version=1
org.eclipse.jpt.core.platform=generic2_1
org.eclipse.jpt.jpa.core.discoverAnnotatedClasses=false

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

@ -0,0 +1,7 @@
<root>
<facet id="jpt.jpa">
<node name="libprov">
<attribute name="provider-id" value="jpa-no-op-library-provider"/>
</node>
</facet>
</root>

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<faceted-project> <faceted-project>
<runtime name="Apache Tomcat v7.0"/> <runtime name="MyEclipse Tomcat v7.0"/>
<fixed facet="java"/> <fixed facet="java"/>
<fixed facet="wst.jsdt.web"/> <fixed facet="wst.jsdt.web"/>
<fixed facet="jst.web"/> <fixed facet="jst.web"/>
<installed facet="java" version="1.7"/> <installed facet="java" version="1.7"/>
<installed facet="jst.web" version="3.0"/> <installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/> <installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="jpt.jpa" version="2.1"/>
</faceted-project> </faceted-project>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>RemoteSystemsTempFiles</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
<nature>org.eclipse.rse.ui.remoteSystemsTempNature</nature>
</natures>
</projectDescription>

@ -0,0 +1,17 @@
#!/bin/bash
function ergodic(){
for file in `ls $1`
do
if [ "$file" != "app" -a -d $1"/"$file ]
then
ergodic $1"/"$file
else
local path=$1"/"$file
echo $path
fi
done
}
IFS=$'\n' #这个必须要,否则会在文件名中有空格时出错
INIT_PATH=".";
ergodic $1

@ -14,7 +14,7 @@
<appender name="dailyRollingFile" class="org.apache.log4j.DailyRollingFileAppender"> <appender name="dailyRollingFile" class="org.apache.log4j.DailyRollingFileAppender">
<param name="Threshold" value="info"></param> <param name="Threshold" value="info"></param>
<param name="ImmediateFlush" value="true"></param> <param name="ImmediateFlush" value="true"></param>
<param name="File" value="d:/logs/dailyRollingFile.log"></param> <param name="File" value="logs/dailyRollingFile.log"></param>
<param name="DatePattern" value="'.'yyyy-MM-dd'.log'"></param> <param name="DatePattern" value="'.'yyyy-MM-dd'.log'"></param>
<layout class="org.apache.log4j.PatternLayout"> <layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"></param> <param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"></param>
@ -23,7 +23,7 @@
<!-- 输出日志到文件 文件大小到达指定尺寸的时候产生一个新的文件 --> <!-- 输出日志到文件 文件大小到达指定尺寸的时候产生一个新的文件 -->
<appender name="railyFile" class="org.apache.log4j.RollingFileAppender"> <appender name="railyFile" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="d:/logs/railyFile.log"></param> <param name="File" value="logs/railyFile.log"></param>
<param name="ImmediateFlush" value="true" /> <param name="ImmediateFlush" value="true" />
<param name="Threshold" value="info"></param> <param name="Threshold" value="info"></param>
<param name="Append" value="true"></param> <param name="Append" value="true"></param>

@ -8,9 +8,11 @@
<typeAlias alias="DataInfoEntity" type="com.platform.entities.DataInfoEntity" /> <typeAlias alias="DataInfoEntity" type="com.platform.entities.DataInfoEntity" />
<typeAlias alias="PagerOptions" type="com.platform.entities.PagerOptions"/> <typeAlias alias="PagerOptions" type="com.platform.entities.PagerOptions"/>
<typeAlias alias="GatherOracleInfo" type="com.platform.entities.GatherOracleInfo"/> <typeAlias alias="GatherOracleInfo" type="com.platform.entities.GatherOracleInfo"/>
<typeAlias alias="DataInfoEntityMoveTmp" type="com.platform.entities.DataInfoEntityMoveTmp"/>
</typeAliases> </typeAliases>
<mappers> <mappers>
<mapper resource="com/dao/mapper/data-details-mapper.xml" /> <mapper resource="com/dao/mapper/data-details-mapper.xml" />
<mapper resource="com/dao/mapper/config-details-mapper.xml"/> <mapper resource="com/dao/mapper/config-details-mapper.xml"/>
<mapper resource="com/dao/mapper/dataInfoMoveTmpmapper.xml"/>
</mappers> </mappers>
</configuration> </configuration>

@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context" xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx
@ -12,7 +15,12 @@
http://www.springframework.org/schema/context http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/websocket http://www.springframework.org/schema/websocket
http://www.springframework.org/schema/websocket/spring-websocket.xsd"> http://www.springframework.org/schema/websocket/spring-websocket.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.0.xsd">
<!-- 读取db.properties中的属性值 --> <!-- 读取db.properties中的属性值 -->
<bean <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
@ -78,4 +86,8 @@
<context:exclude-filter type="annotation" <context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller" /> expression="org.springframework.stereotype.Controller" />
</context:component-scan> </context:component-scan>
<!-- Enables the Spring Task @Scheduled programming model -->
<task:executor id="executor" pool-size="5" />
<task:scheduler id="scheduler" pool-size="10" />
<task:annotation-driven executor="executor" scheduler="scheduler" />
</beans> </beans>

@ -18,7 +18,7 @@
</filter> </filter>
<filter-mapping> <filter-mapping>
<filter-name>CharacterEncodingFilter</filter-name> <filter-name>CharacterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern> <url-pattern>/</url-pattern>
</filter-mapping> </filter-mapping>
<!-- spring配置文件 --> <!-- spring配置文件 -->

@ -1,3 +1,4 @@
/** /**
* BaseController.java * BaseController.java
* : XX * : XX
@ -60,4 +61,5 @@ public class BaseController {
return response; return response;
} }
} }
} }

@ -1,3 +1,5 @@
package com.base; package com.base;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -122,3 +124,4 @@ public class CustomException extends Exception {
return cause; return cause;
} }
} }

@ -79,6 +79,7 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
</otherwise> </otherwise>
</choose> </choose>
</where> </where>
ORDER BY data_details.id ORDER BY data_details.id
<if test="PagerOptions.limit > 0"> <if test="PagerOptions.limit > 0">
LIMIT #{PagerOptions.limit} LIMIT #{PagerOptions.limit}
@ -101,8 +102,107 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
<!-- 获取数据查询的起始di --> <!-- 获取数据查询的起始di -->
<select id="getLimitedBeginId" resultType="java.lang.Integer" <select id="getLimitedBeginId" resultType="java.lang.Integer"
parameterType="PagerOptions"> parameterType="PagerOptions">
SELECT MAX(idx) FROM (SELECT id idx FROM data_details SELECT MAX(idx) FROM (SELECT id idx FROM data_details
ORDER BY id LIMIT 0,#{PagerOptions.totalLimit}) AS TEMP ORDER BY id LIMIT 0,#{PagerOptions.totalLimit}) AS TEMP
</select> </select>
<insert id="save" parameterType="com.platform.entities.DataInfoEntity">
INSERT INTO
data_info(
<trim suffixOverrides=",">
<if test="regionalismCode != null and regionalismCode != ''">
regionalism_code,
</if>
<if test="systemCode > 0">
system_code,
</if>
<if test="dataType != null and dataType != ''">
data_type,
</if>
<if test="dataVersion != null">
data_version,
</if>
<if test="submittedBatch != null and submittedBatch != ''">
submitted_batch,
</if>
<if test="dataPath != null and dataPath != ''">
data_path,
</if>
<if test="collectingTime != null">
collection_time,
</if>
<if test="collectorName != null and collectorName != ''">
collector_name,
</if>
<if test="collectorContacts != null and collectorContacts != ''">
collector_contacts,
</if>
<if test="charset != null and charset != ''">
data_charset,
</if>
<if test="year != null and year != ''">
data_year
</if>
</trim>
)
VALUES(
<trim suffixOverrides=",">
<if test="regionalismCode != null and regionalismCode != ''">
#{regionalismCode},
</if>
<if test="systemCode != null">
#{systemCode},
</if>
<if test="dataType != null and dataType != ''">
#{dataType},
</if>
<if test="dataVersion != null">
#{dataVersion},
</if>
<if test="submittedBatch != null and submittedBatch != ''">
#{submittedBatch},
</if>
<if test="dataPath != null and dataPath != ''">
#{dataPath},
</if>
<if test="collectingTime != null">
#{collectingTime},
</if>
<if test="collectorName != null and collectorName != ''">
#{collectorName},
</if>
<if test="collectorContacts != null and collectorContacts != ''">
#{collectorContacts},
</if>
<if test="charset != null and charset != ''">
#{charset},
</if>
<if test="year != null and year != ''">
#{year}
</if>
</trim>
)
</insert>
<select id="getIdIsExist" parameterType="java.util.List" resultType="java.lang.String">
select data_path
from data_info
where id in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
and remove ='0'
</select>
<update id="removes" parameterType="java.util.List">
UPDATE
data_info
set remove = '1'
where id in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
and remove ='0'
</update>
</mapper> </mapper>

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
<mapper namespace="com.platform.dao.DataInfoDao">
<resultMap id="getEntityByText" type="DataInfoEntity">
<id property="id" column="id" javaType="int" jdbcType="INTEGER" />
<result property="regionalismCode" column="regionalism_code"
javaType="string" jdbcType="VARCHAR" />
<result property="cityName" column="city_name" javaType="string"
jdbcType="VARCHAR" />
<result property="districtName" column="district_name"
javaType="string" jdbcType="VARCHAR" />
<result property="systemCode" column="system_code" javaType="int"
jdbcType="INTEGER" />
<result property="systemName" column="system_name" javaType="string"
jdbcType="VARCHAR" />
<result property="dataType" column="data_type" javaType="string"
jdbcType="VARCHAR" />
<result property="dataVersion" column="data_version" javaType="int"
jdbcType="INTEGER" />
<result property="submittedBatch" column="submitted_batch"
javaType="string" jdbcType="VARCHAR" />
<result property="dataPath" column="data_path" javaType="string"
jdbcType="VARCHAR" />
<result property="charset" column="data_charset" javaType="string"
jdbcType="VARCHAR" />
<result property="collectingTime" column="collection_time"
javaType="string" jdbcType="DATE" />
<result property="collectorContacts" column="collector_contacts"
javaType="string" jdbcType="VARCHAR" />
<result property="collectorName" column="collector_name"
javaType="string" jdbcType="VARCHAR" />
<result property="year" column="data_year" javaType="string"
jdbcType="VARCHAR" />
</resultMap>
<sql id="conditionsFilters">
<if test="PagerOptions.dataType!=null">
and data_details.data_type=#{PagerOptions.dataType}
</if>
<if test="PagerOptions.submittedBatch!=null">
and
data_details.submitted_batch=#{PagerOptions.submittedBatch}
</if>
<if test="PagerOptions.cityName!=null">
and data_details.city_name=#{PagerOptions.cityName}
</if>
<if test="PagerOptions.districtName!=null">
and
data_details.district_name=#{PagerOptions.districtName}
</if>
<if test="PagerOptions.dataVersion !=null">
and data_details.data_version=#{PagerOptions.dataVersion}
</if>
<if test="PagerOptions.systemName !=null">
and data_details=#{PagerOptions.systemName}
</if>
<if test="PagerOptions.dataYear !=null">
and data_details.data_year=#{PagerOptions.dataYear}
</if>
</sql>
<!-- 获取数据符合筛选条件的全部记录信息 -->
<select id="3
" parameterType="PagerOptions"
resultMap="getEntityByText">
SELECT
id,regionalism_code,city_name,district_name,system_code,system_name,data_type,data_version,submitted_batch,data_path,data_charset,collection_time,collector_name,collector_contacts,data_year
FROM data_details
<if test="PagerOptions!=null">
<where>
<include refid="conditionsFilters" />
<choose>
<when test="PagerOptions.offset > 0">
and data_details.id>= #{PagerOptions.offset}
</when>
<otherwise>
and data_details.id>=0
</otherwise>
</choose>
</where>
ORDER BY data_details.id
<if test="PagerOptions.limit > 0">
LIMIT #{PagerOptions.limit}
</if>
</if>
</select>
<!-- 获取数据符合筛选条件的总记录条数 -->
<select id="getLimitedDataCount" resultType="java.lang.Integer"
parameterType="PagerOptions">
SELECT COUNT(id) FROM data_details
<if test="PagerOptions!=null">
<where>
<include refid="conditionsFilters" />
</where>
</if>
</select>
<!-- 获取数据查询的起始di -->
<select id="getLimitedBeginId" resultType="java.lang.Integer"
parameterType="PagerOptions">
SELECT MAX(idx) FROM (SELECT id idx FROM data_details
ORDER BY id LIMIT 0,#{PagerOptions.totalLimit}) AS TEMP
</select>
</mapper>

@ -41,16 +41,26 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
jdbcType="VARCHAR" /> jdbcType="VARCHAR" />
<result property="rate" column="rate" javaType="int" <result property="rate" column="rate" javaType="int"
jdbcType="INTEGER" /> jdbcType="INTEGER" />
<result property="lastTime" column="lasttime"
javaType="string" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<sql id="Base_Column_List">
regionalism_code,system_code,dst_path,lasttime
</sql>
<!-- 获取数据全部记录信息 --> <!-- 获取数据全部记录信息 -->
<select id="findAll" parameterType="" resultMap="getEntityByText"> <select id="findAll" resultType="com.platform.entities.DataInfoEntityMoveTmp">
SELECT SELECT
a.id,a.regionalism_code,b.city_name,b.district_name, a.system_code,b.system_name,b.data_type,b.data_version,b.submitted_batch, a.id id,a.regionalism_code regionalismCode,b.city_name cityName,b.district_name districtName,
b.data_path,b.data_charset,b.collection_time,b.collector_name,b.collector_contacts,b.data_year,a.dst_path,a.complete_status,a.rate a.system_code systemCode,b.system_name systemName,b.data_type dataType,b.data_version dataVersion,
b.submitted_batch submittedBatch,b.data_path dataPath,b.data_charset charset,b.collection_time collectionTime,
b.collector_name collectorName,b.collector_contacts collectorContacts,b.data_year dataYear,a.dst_path dstPath,
a.complete_status completeStatus,a.rate rate, a.lasttime lastTime
FROM FROM
move_data_tmp a LEFT JOIN data_details b move_data_tmp a LEFT JOIN data_details b
ON a.system_code = b.system_code AND a.regionalism_code = b.regionalism_code; ON a.system_code = b.system_code AND a.regionalism_code = b.regionalism_code
ORDER BY a.id
</select> </select>
<update id="update" parameterType="com.platform.entities.DataInfoEntityMoveTmp"> <update id="update" parameterType="com.platform.entities.DataInfoEntityMoveTmp">
@ -58,19 +68,18 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
move_data_tmp move_data_tmp
<set > <set >
<trim suffixOverrides=","> <trim suffixOverrides=",">
<if test="regionalismCode != null and regionalismCode != ''">
regionalism_code = #{regionalismCode},
</if>
<if test="systemCode != null and systemCode != ''">
system_code= #{systemCode},
</if>
<if test="dstPath != null and dstPath != ''"> <if test="dstPath != null and dstPath != ''">
dst_path= #{dstPath}, dst_path= #{dstPath},
</if> </if>
<if test="completeStatus != null and completeStatus != ''"> <if test="completeStatus != null and completeStatus != ''">
complete_status= #{completeStatus}, complete_status= #{completeStatus},
</if> </if>
rate= #{rate} <if test="rate > 0">
rate= #{rate},
</if>
<if test="lastTime != null and lastTime != ''">
lasttime= #{lastTime},
</if>
</trim> </trim>
</set> </set>
<where> <where>
@ -78,7 +87,7 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
</where> </where>
</update> </update>
<insert id="save" parameterType=""> <insert id="save" parameterType="com.platform.entities.DataInfoEntityMoveTmp">
INSERT INTO INSERT INTO
move_data_tmp( move_data_tmp(
<trim suffixOverrides=","> <trim suffixOverrides=",">
@ -88,7 +97,7 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
<if test="regionalismCode != null and regionalismCode != ''"> <if test="regionalismCode != null and regionalismCode != ''">
regionalism_code, regionalism_code,
</if> </if>
<if test="systemCode != null and systemCode != ''"> <if test="systemCode != null">
system_code, system_code,
</if> </if>
<if test="dstPath != null and dstPath != ''"> <if test="dstPath != null and dstPath != ''">
@ -97,7 +106,12 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
<if test="completeStatus != null and completeStatus != ''"> <if test="completeStatus != null and completeStatus != ''">
complete_status, complete_status,
</if> </if>
rate <if test="rate > 0">
rate,
</if>
<if test="lastTime != null and lastTime != ''">
lasttime,
</if>
</trim> </trim>
) )
VALUES( VALUES(
@ -117,19 +131,32 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
<if test="completeStatus != null and completeStatus != ''"> <if test="completeStatus != null and completeStatus != ''">
#{completeStatus}, #{completeStatus},
</if> </if>
#{rate} <if test="rate > 0">
#{rate}
</if>
<if test="lastTime != null and lastTime != ''">
#{lastTime},
</if>
</trim> </trim>
) )
</insert> </insert>
<delete id="remove" parameterType="java.lang.INTEGER"> <select id="insertBatch" parameterType="java.util.List">
INSERT INTO move_data_tmp ( <include refid="Base_Column_List" /> )
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.regionalismCode,jdbcType=VARCHAR},#{item.systemCode,jdbcType=INTEGER},#{item.dstPath,jdbcType=VARCHAR},#{item.lastTime,jdbcType=VARCHAR})
</foreach>
</select>
<delete id="remove" parameterType="java.lang.Integer">
DELETE FROM DELETE FROM
move_data_tmp move_data_tmp
WHERE WHERE
id = #{id} id = #{id}
</delete> </delete>
<!-- 获取数据符合筛选条件的总记录条数 -->
<!-- 获取数据符合筛选条件的总记录条数 --> <!--
<select id="getLimitedDataCount" resultType="java.lang.Integer" <select id="getLimitedDataCount" resultType="java.lang.Integer"
parameterType="PagerOptions"> parameterType="PagerOptions">
SELECT COUNT(id) FROM move_data_tmp SELECT COUNT(id) FROM move_data_tmp
@ -141,11 +168,11 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
</select> </select>
<!-- 获取数据查询的起始di --> 获取数据查询的起始di
<select id="getLimitedBeginId" resultType="java.lang.Integer" <select id="getLimitedBeginId" resultType="java.lang.Integer"
parameterType="PagerOptions"> parameterType="PagerOptions">
SELECT MAX(idx) FROM (SELECT id idx FROM move_data_tmp SELECT MAX(idx) FROM (SELECT id idx FROM move_data_tmp
ORDER BY id LIMIT 0,#{PagerOptions.totalLimit}) AS TEMP ORDER BY id LIMIT 0,#{PagerOptions.totalLimit}) AS TEMP
</select> </select> -->
</mapper> </mapper>

@ -1,5 +1,6 @@
package com.platform.controller; package com.platform.controller;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -21,15 +22,18 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.base.BaseController; import com.base.BaseController;
import com.platform.entities.DataInfoEntity; import com.platform.entities.DataInfoEntity;
import com.platform.entities.DataInfoEntityMoveTmp;
import com.platform.entities.FolderNode; import com.platform.entities.FolderNode;
import com.platform.entities.GatherOracleInfo; import com.platform.entities.GatherOracleInfo;
import com.platform.entities.PagerOptions; import com.platform.entities.PagerOptions;
import com.platform.entities.VolumeEntity; import com.platform.entities.VolumeEntity;
import com.platform.service.DataInfoService; import com.platform.service.DataInfoService;
import com.platform.service.IGfsService; import com.platform.service.IGfsService;
import com.platform.service.IMoveDataService;
import com.platform.service.IMySqlService; import com.platform.service.IMySqlService;
import com.platform.service.IOracleExtractService; import com.platform.service.IOracleExtractService;
import com.platform.service.OracleStatusService; import com.platform.service.OracleStatusService;
import com.platform.utils.Bean2MapUtils;
import com.platform.utils.Configs; import com.platform.utils.Configs;
import com.platform.utils.UtilsHelper; import com.platform.utils.UtilsHelper;
@ -46,6 +50,9 @@ public class DataModelController extends BaseController{
@Resource(name = "OracleExtract") @Resource(name = "OracleExtract")
private IOracleExtractService OracleExtract; private IOracleExtractService OracleExtract;
@Resource(name = "moveDataService")
private IMoveDataService moveDataService;
public void setDfsImp(DataInfoService dfs) { public void setDfsImp(DataInfoService dfs) {
this.dfs = dfs; this.dfs = dfs;
@ -54,11 +61,12 @@ public class DataModelController extends BaseController{
@RequestMapping("/data.json") @RequestMapping("/data.json")
@ResponseBody @ResponseBody
public ModelMap getAllDataToJson(HttpServletRequest res, public ModelMap getAllDataToJson(HttpServletRequest res,
HttpServletResponse req) { HttpServletResponse req) throws UnsupportedEncodingException {
res.setCharacterEncoding("UTF-8");
Map<String, String[]> paramMap = res.getParameterMap(); Map<String, String[]> paramMap = res.getParameterMap();
Set<String> keySet = paramMap.keySet(); Set<String> keySet = paramMap.keySet();
Map<String, String> params = new HashMap<String, String>(); Map<String, String> params = new HashMap<String, String>();
StringBuffer sb = new StringBuffer().append("<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:{"); StringBuffer sb = new StringBuffer().append("当前的请求参数:{");
for (String str : keySet) { for (String str : keySet) {
String value = paramMap.get(str)[0]; String value = paramMap.get(str)[0];
if (StringUtils.isNotEmpty(value)) { if (StringUtils.isNotEmpty(value)) {
@ -72,19 +80,21 @@ public class DataModelController extends BaseController{
.append("}").toString()); .append("}").toString());
PagerOptions pagerOptions = (PagerOptions) UtilsHelper PagerOptions pagerOptions = (PagerOptions) UtilsHelper
.newObjAndSetAttrsByClass(PagerOptions.class, params); .newObjAndSetAttrsByClass(PagerOptions.class, params);
return dfs.getPagerTableData(pagerOptions); return dfs.getPagerTableData(pagerOptions);
} }
@RequestMapping("/delete/data") @RequestMapping(value="/delete/data", method= RequestMethod.POST)
public void deleteData(HttpServletRequest res, HttpServletResponse req) { public void deleteData(HttpServletRequest res, HttpServletResponse req) throws Exception {
res.setCharacterEncoding("UTF-8");
Map<String, String[]> paramMap = res.getParameterMap(); Map<String, String[]> paramMap = res.getParameterMap();
String[] data = paramMap.get("data"); String[] data = paramMap.get("data");
dfs.deleteData(data); dfs.deleteData(data);
} }
@RequestMapping("/connectOracle") @RequestMapping("/connectOracle")
public void connectOracle(HttpServletRequest res, HttpServletResponse req) { public void connectOracle(HttpServletRequest res, HttpServletResponse req) throws UnsupportedEncodingException {
res.setCharacterEncoding("UTF-8");
Map<String, String[]> paramMap = res.getParameterMap(); Map<String, String[]> paramMap = res.getParameterMap();
String[] oraclesName = paramMap.get("oracleName"); String[] oraclesName = paramMap.get("oracleName");
if (oraclesName != null) if (oraclesName != null)
@ -96,22 +106,24 @@ public class DataModelController extends BaseController{
@RequestMapping("/cancelOracleConection") @RequestMapping("/cancelOracleConection")
public void cancelOracleConnection(HttpServletRequest res, public void cancelOracleConnection(HttpServletRequest res,
HttpServletResponse req) { HttpServletResponse req) throws UnsupportedEncodingException {
res.setCharacterEncoding("UTF-8");
Map<String, String[]> paramMap = res.getParameterMap(); Map<String, String[]> paramMap = res.getParameterMap();
String[] oraclesName = paramMap.get("oracleName"); String[] oraclesName = paramMap.get("oracleName");
String operate = paramMap.get("operation")[0]; String operate = paramMap.get("operation")[0];
if (null != oraclesName) { if (null != oraclesName) {
for (String rcName : oraclesName) { for (String rcName : oraclesName) {
Configs.CONSOLE_LOGGER.info("连接成功:\t" + rcName); Configs.CONSOLE_LOGGER.info("取消连接:\t" + rcName);
new OracleStatusService().cancelToOracle(rcName, operate); new OracleStatusService().cancelToOracle(rcName, operate);
} }
} }
} }
@SuppressWarnings({ "unchecked", "unused", "rawtypes" }) @SuppressWarnings({ "unused", "rawtypes", "unchecked" })
@RequestMapping("/oracle/{name}/extract") @RequestMapping(value="/oracle/{name}/extract", method= RequestMethod.POST)
public void extractOracleData(HttpServletRequest res, public void extractOracleData(HttpServletRequest res,
HttpServletResponse req, String name) throws Exception { HttpServletResponse req, String name) throws Exception {
res.setCharacterEncoding("UTF-8");
System.out.println("------extract-------"); System.out.println("------extract-------");
System.out.println(name); System.out.println(name);
Map<String, String[]> paramMap = res.getParameterMap(); Map<String, String[]> paramMap = res.getParameterMap();
@ -136,7 +148,7 @@ public class DataModelController extends BaseController{
} }
@RequestMapping("/volume/list") @RequestMapping(value="/volume/list", method= RequestMethod.POST)
@ResponseBody @ResponseBody
public List<VolumeEntity> getFolder(HttpServletRequest res, HttpServletResponse req) throws Exception { public List<VolumeEntity> getFolder(HttpServletRequest res, HttpServletResponse req) throws Exception {
System.out.println("get Request"); System.out.println("get Request");
@ -149,11 +161,12 @@ public class DataModelController extends BaseController{
return result; return result;
} }
@SuppressWarnings("rawtypes") @SuppressWarnings({ "unused", "rawtypes" })
@RequestMapping(value = "/volume/{name}/move", method= RequestMethod.POST) @RequestMapping(value = "/volume/{name}/move", method= RequestMethod.POST)
@ResponseBody @ResponseBody
public Object move(HttpServletRequest res, HttpServletResponse req, String name, public Object move(HttpServletRequest res, HttpServletResponse req, String name,
FolderNode selectNode, DataInfoEntity selectItems) throws Exception { FolderNode selectNode, DataInfoEntity selectItems) throws Exception {
res.setCharacterEncoding("UTF-8");
System.out.println("get Request"); System.out.println("get Request");
Map<String, String[]> paramMap = res.getParameterMap(); Map<String, String[]> paramMap = res.getParameterMap();
// System.out.println(paramMap); // System.out.println(paramMap);
@ -164,25 +177,32 @@ public class DataModelController extends BaseController{
JSONObject jsonobject = JSONObject.fromObject(string); JSONObject jsonobject = JSONObject.fromObject(string);
map = jsonobject; map = jsonobject;
} }
String dstVolume = (String) map.get("volume");
List<String> listItemPath = new ArrayList<String>(); List<String> listItemPath = new ArrayList<String>();
String[] items = paramMap.get("selectItems"); String[] items = paramMap.get("selectItems");
System.out.println("selectItems"); System.out.println("selectItems");
List<DataInfoEntity> datas = new ArrayList<DataInfoEntity>();
List<String> srcVolumes = new ArrayList<String>();
for (String string : items) { for (String string : items) {
System.out.println(string); System.out.println(string);
JSONObject jsobj = JSONObject.fromObject(string); JSONObject jsobj = JSONObject.fromObject(string);
Map itemmap = jsobj; Map itemmap = jsobj;
listItemPath.add((String)itemmap.get("dataPath")); if (null != itemmap.get("volume")) {
srcVolumes.add((String) itemmap.get("volume"));
}
DataInfoEntity data = (DataInfoEntity) Bean2MapUtils.convertMap(DataInfoEntity.class, itemmap);
datas.add(data);
}
System.out.println("------/volume/{name}/move--------");
boolean result = false ;
if (datas.size() >0) {
result = moveDataService.moveData(datas, (String)map.get("path"));
} }
System.out.println(name);
System.out.println(nodes);
System.out.println(selectItems);
System.out.println("--------------");
int result = gfsService.copyFolder(listItemPath, (String)map.get("path"), "app");
return result; return result;
} }
@RequestMapping("/oracle/list") @RequestMapping(value="/oracle/list", method= RequestMethod.POST)
@ResponseBody @ResponseBody
public List<GatherOracleInfo> getOracleInfo(HttpServletRequest res, public List<GatherOracleInfo> getOracleInfo(HttpServletRequest res,
HttpServletResponse req) throws Exception { HttpServletResponse req) throws Exception {
@ -192,30 +212,47 @@ public class DataModelController extends BaseController{
return result; return result;
} }
@RequestMapping("/oracle/{id}/delete") @RequestMapping(value="/oracle/{id}/delete", method= RequestMethod.POST)
@ResponseBody @ResponseBody
public void deleteOracleInfo(HttpServletRequest res, public void deleteOracleInfo(HttpServletRequest res,
HttpServletResponse req, int id) throws Exception { HttpServletResponse req, int id) throws Exception {
res.setCharacterEncoding("UTF-8");
mySqlService.deleteMySql(id); mySqlService.deleteMySql(id);
System.out.println("----------deleteOracleInfo-----------------------"); System.out.println("----------deleteOracleInfo-----------------------");
} }
@RequestMapping("/oracle/{id}/insert") @RequestMapping(value="/oracle/{id}/insert", method= RequestMethod.POST)
@ResponseBody @ResponseBody
public void insertOracleInfo(HttpServletRequest res, public void insertOracleInfo(HttpServletRequest res,
HttpServletResponse req, GatherOracleInfo oracle) throws Exception { HttpServletResponse req, GatherOracleInfo oracle) throws Exception {
res.setCharacterEncoding("UTF-8");
mySqlService.insertOracle(oracle); mySqlService.insertOracle(oracle);
System.out.println("----------insertOracleInfo-----------------------"); System.out.println("----------insertOracleInfo-----------------------");
} }
@RequestMapping("/oracle/{id}/update") @RequestMapping(value="/oracle/{id}/update", method= RequestMethod.POST)
@ResponseBody @ResponseBody
public void updateOracleInfo(HttpServletRequest res, public void updateOracleInfo(HttpServletRequest res,
HttpServletResponse req, GatherOracleInfo oracle) throws Exception { HttpServletResponse req, GatherOracleInfo oracle) throws Exception {
res.setCharacterEncoding("gb2312");
System.out.println(oracle.getName());
System.out.println(oracle);
mySqlService.updateOracle(oracle); mySqlService.updateOracle(oracle);
System.out.println("----------updateOracleInfo-----------------------"); System.out.println("----------updateOracleInfo-----------------------");
} }
@RequestMapping(value="/task/transfer/list", method= RequestMethod.POST)
@ResponseBody
public Object taskList() throws Exception {
List<DataInfoEntityMoveTmp> result = moveDataService.findAll();
return result;
}
@RequestMapping(value="/task/transfer/delete", method= RequestMethod.POST)
@ResponseBody
public Object taskdeletes(DataInfoEntityMoveTmp move) throws Exception {
int result = moveDataService.delete(move);
return result;
}
} }

@ -1,3 +1,4 @@
package com.platform.controller; package com.platform.controller;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
@ -28,3 +29,4 @@ public class DefaultController {
} }
} }

@ -1,6 +1,7 @@
package com.platform.controller; package com.platform.controller;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -13,11 +14,19 @@ import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import com.base.BaseController; import com.base.BaseController;
import com.base.CustomException; import com.base.CustomException;
import com.platform.entities.GfsFolderEntity; import com.platform.entities.GfsFolderEntity;
import com.platform.entities.VolumeEntity; import com.platform.entities.VolumeEntity;
import com.platform.glusterfs.VolumeInfo; import com.platform.glusterfs.VolumeInfo;
import com.platform.entities.VolumeEntity;
import com.platform.glusterfs.VolumeInfo;
import com.platform.service.IGfsService; import com.platform.service.IGfsService;
@ -30,13 +39,19 @@ import com.platform.service.IGfsService;
* @since [/] * @since [/]
*/ */
@Controller @Controller
@RequestMapping("") @RequestMapping("")
public class FolderController extends BaseController { public class FolderController extends BaseController {
@Resource(name = "gfsService") @Resource(name = "gfsService")
private IGfsService gfsService; private IGfsService gfsService;
@RequestMapping(value="/getAllSubPathByPath", method= RequestMethod.POST) @RequestMapping(value="/getAllSubPathByPath", method= RequestMethod.POST)
public Object getAllSubPathByPath(String path) throws Exception { public Object getAllSubPathByPath(String path) throws Exception {
System.out.println(path); System.out.println(path);
Object result = null; Object result = null;
@ -47,6 +62,22 @@ public class FolderController extends BaseController {
return result; return result;
} }
@RequestMapping("/copyFolder")
public Object copyFolder(String srcpath, String dstPath, String name) throws Exception {
// -1 :error; -2: the filename is not exists ;-3 :destFolderName ; 1: right
int result = 0;
// int result = gfsService.copyFolder(srcpath, dstPath, name);
System.out.println(srcpath);
System.out.println(dstPath);
String obj = "right";
if (1 != result) {
obj = "err";
}
return obj;
}
// /** // /**
// * <一句话功能简述> 查询集群中所有的 volume 及其 信息 // * <一句话功能简述> 查询集群中所有的 volume 及其 信息
// * <功能详细描述> // * <功能详细描述>
@ -77,6 +108,7 @@ public class FolderController extends BaseController {
public Object getVolumByName(String volumeName) throws Exception{ public Object getVolumByName(String volumeName) throws Exception{
VolumeEntity result = gfsService.getOneVolume(volumeName); VolumeEntity result = gfsService.getOneVolume(volumeName);
return result; return result;
} }
} }

@ -17,7 +17,12 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
/** /**
* <>
* <> * <>
* <> * <>
* @author liliy * @author liliy
* @version [201698] * @version [201698]
@ -26,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
*/ */
@Controller @Controller
public class SetGlusterfsController { public class SetGlusterfsController {
@RequestMapping("/tes") @RequestMapping("/tes")
public Object defaultHandler(HttpServletRequest req, HttpServletResponse request) { public Object defaultHandler(HttpServletRequest req, HttpServletResponse request) {
//<2F><><EFBFBD><><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //<2F><><EFBFBD><><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@ -42,4 +48,5 @@ public class SetGlusterfsController {
} }
} }

@ -10,6 +10,7 @@
*/ */
package com.platform.controller; package com.platform.controller;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -17,9 +18,11 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import com.platform.glusterfs.ClusterInfo; import com.platform.glusterfs.ClusterInfo;
import com.platform.glusterfs.VolumeInfo;
/** /**
* <> * <>
* <> * <>
* @author liliy * @author liliy
* @version [201698] * @version [201698]
@ -28,8 +31,11 @@ import com.platform.glusterfs.ClusterInfo;
*/ */
@Controller @Controller
public class ShowGlusterfsController { public class ShowGlusterfsController {
/** /**
* <> * <>
* <> * <>
* @return * @return
* @see [##] * @see [##]

@ -3,10 +3,12 @@ package com.platform.dao;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.platform.entities.DataInfoEntity; import com.platform.entities.DataInfoEntity;
import com.platform.entities.PagerOptions; import com.platform.entities.PagerOptions;
@Repository(value = "dataInfoDao")
public interface DataInfoDao { public interface DataInfoDao {
int getLimitedDataCount(@Param("PagerOptions")PagerOptions pagerOptions); int getLimitedDataCount(@Param("PagerOptions")PagerOptions pagerOptions);
@ -15,6 +17,10 @@ public interface DataInfoDao {
List<DataInfoEntity> getLimitedDataInfoEntities(@Param("PagerOptions")PagerOptions pagerOptions); List<DataInfoEntity> getLimitedDataInfoEntities(@Param("PagerOptions")PagerOptions pagerOptions);
List<String> getIdIsExist(int parseInt); List<String> getIdIsExist(List<Integer> list)throws Exception;
int removes(List<Integer> list)throws Exception;
int save(DataInfoEntity data) throws Exception;
} }

@ -23,6 +23,7 @@ public interface DataInfoMoveTmpDao {
int save(DataInfoEntityMoveTmp data) throws Exception; int save(DataInfoEntityMoveTmp data) throws Exception;
int remove(DataInfoEntityMoveTmp data) throws Exception; void insertBatch(List<DataInfoEntityMoveTmp> list) throws Exception;
int remove(int id) throws Exception;
} }

@ -1,93 +1,110 @@
/** /**
* : Brick.java * : Brick.java
* : </> * : </>
* : <> * : <>
* @author chen * @author chen
* : <> * : <>
* 201699 * 201699
* <> * <>
*/ */
package com.platform.entities; package com.platform.entities;
/** /**
* <> volume * <> volume
* <> * <>
* @author chen * @author chen
* @version [201699] * @version [201699]
* @see [/] * @see [/]
* @since [/] * @since [/]
*/ */
public class Brick { public class Brick {
/** volume总大小 */ /** volume总大小 */
private double availableSize; private double availableSize;
/** volume已使用大小 */ /** volume已使用大小 */
private double usedSize; private double usedSize;
/** ip */ /** ip */
private String ip; private String ip;
/** 路径 */ /** 路径 */
private String path; private String path;
/** /**
* @return the availableSize * true false
*/ */
public double getAvailableSize() { private boolean status;
return availableSize;
} /**
* @return the availableSize
/** */
* @param availableSize the availableSize to set public double getAvailableSize() {
*/ return availableSize;
public void setAvailableSize(double availableSize) { }
this.availableSize = availableSize;
} /**
* @param availableSize the availableSize to set
/** */
* @return the usedSize public void setAvailableSize(double availableSize) {
*/ this.availableSize = availableSize;
public double getUsedSize() { }
return usedSize;
} /**
* @return the usedSize
/** */
* @param usedSize the usedSize to set public double getUsedSize() {
*/ return usedSize;
public void setUsedSize(double usedSize) { }
this.usedSize = usedSize;
} /**
* @param usedSize the usedSize to set
/** */
* @return the ip public void setUsedSize(double usedSize) {
*/ this.usedSize = usedSize;
public String getIp() { }
return ip;
} /**
* @return the ip
/** */
* @param ip the ip to set public String getIp() {
*/ return ip;
public void setIp(String ip) { }
this.ip = ip;
} /**
* @param ip the ip to set
/** */
* @return the path public void setIp(String ip) {
*/ this.ip = ip;
public String getPath() { }
return path;
} /**
* @return the path
/** */
* @param path the path to set public String getPath() {
*/ return path;
public void setPath(String path) { }
this.path = path;
} /**
* @param path the path to set
*/
} public void setPath(String path) {
this.path = path;
}
/**
* @return the status
*/
public boolean isStatus() {
return status;
}
/**
* @param status the status to set
*/
public void setStatus(boolean status) {
this.status = status;
}
}

@ -7,6 +7,12 @@ public class DataInfoEntityMoveTmp extends DataInfoEntity {
private String completeStatus; private String completeStatus;
private int rate; private int rate;
private String lastTime; // 采集时间
public DataInfoEntityMoveTmp() {
// TODO Auto-generated constructor stub
}
/** /**
* @return the dstPath * @return the dstPath
@ -49,6 +55,19 @@ public class DataInfoEntityMoveTmp extends DataInfoEntity {
public void setRate(int rate) { public void setRate(int rate) {
this.rate = rate; this.rate = rate;
} }
/**
* @return the lastTime
*/
public String getLastTime() {
return lastTime;
}
/**
* @param lastTime the lastTime to set
*/
public void setLastTime(String lastTime) {
this.lastTime = lastTime;
}
} }

@ -1,16 +1,19 @@
package com.platform.entities; package com.platform.entities;
import java.util.ArrayList;
import java.util.List; import java.util.List;
public class FolderNode { public class FolderNode {
private String name; private String name;
private int isFolder; // 1 is file and other integer is folder show children number private int isFolder; // 1 is file and other integer is folder show children number
private String path; private String path;
private List<FolderNode> childNodes; private List<FolderNode> childNodes = new ArrayList<FolderNode>();
public FolderNode() { public FolderNode() {
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
public FolderNode(String name) { public FolderNode(String name) {
this.name = name; this.name = name;

@ -37,7 +37,7 @@ public class VolumeEntity {
private String path; private String path;
/** volume树形目录 */ /** volume树形目录 */
private FolderNode folder; private List<FolderNode> folder = new ArrayList<FolderNode>();
/** volume的 块 */ /** volume的 块 */
private List<Brick> brick = new ArrayList<Brick>(); private List<Brick> brick = new ArrayList<Brick>();
@ -101,14 +101,14 @@ public class VolumeEntity {
/** /**
* @return the folder * @return the folder
*/ */
public FolderNode getFolder() { public List<FolderNode> getFolder() {
return folder; return folder;
} }
/** /**
* @param folder the folder to set * @param folder the folder to set
*/ */
public void setFolder(FolderNode folder) { public void setFolder(List<FolderNode> folder) {
this.folder = folder; this.folder = folder;
} }

@ -0,0 +1,106 @@
package com.platform.glusterfs;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.aspectj.weaver.ast.And;
import com.mysql.jdbc.log.Log;
import com.platform.utils.Constant;
public class CheckoutMD5 {
public static Logger log = Logger.getLogger(CheckoutMD5.class);
String sourcePath;
String destPath;
String dataName;
// String cmd_crateSourceMD5File="find "+sourcePath+dataName+"/app/ -type f
// -print0 | xargs -0 md5sum | sort >"+deskPath+dataName+"_md5.txt";
String cmd_getSourceMD5File;
// String cmd_crateDestMD5File="find "+destPath+dataName+"/app/ -type f
// -print0 | xargs -0 md5sum | sort >"+deskPath+dataName+"_md5.txt";
String cmd_getDestMD5File;
Map<String, String> source_md5 = new HashMap<String, String>();
Map<String, String> dest_md5 = new HashMap<String, String>();
public CheckoutMD5() {
// TODO Auto-generated constructor stub
}
public CheckoutMD5(String sourcePath, String destPath, String dataName) {
// TODO Auto-generated constructor stub
this.sourcePath = sourcePath;
this.destPath = destPath;
this.dataName = dataName;
cmd_getSourceMD5File = "find " + sourcePath + dataName + "/app/ -type f -print0 | xargs -0 md5sum | sort ";
cmd_getDestMD5File = "find " + destPath + dataName + "/app/ -type f -print0 | xargs -0 md5sum | sort ";
}
/**
* sourcePathdestPath1
* 0MD5-1-2-3
*
* @param sourcePath
* @param destPath
* @return
* @see [##]
*/
public int checkoutMD5Folder(String sourcePath, String destPath) {
log.info("start checkout md5 "+sourcePath+" and "+ destPath);
List<String> wrong_files = new ArrayList<String>();
String source_cmd = "find " + sourcePath + " -type f -print0 | xargs -0 md5sum";
String dest_cmd = "find " + destPath + " -type f -print0 | xargs -0 md5sum";
List<String> sourceReStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(source_cmd);
if (sourceReStrings == null || sourceReStrings.size() == 0) {
log.error("get " + sourcePath + " MD5 error!");
return -1;
}
if(sourceReStrings.get(0).contains(Constant.noSuchFile)){
log.error(sourcePath+" is not exist!");
return -2;
}
List<String> destReStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(dest_cmd);
if (destReStrings == null || destReStrings.size() == 0) {
log.error("get " + destReStrings + " MD5 error!");
return -1;
}
if(destReStrings.get(0).contains(Constant.noSuchFile)){
log.error(destPath+" is not exist!");
return -3;
}
Map<String, String> source_md5 = new HashMap<String, String>();
Map<String, String> dest_md5 = new HashMap<String, String>();
for (String line : sourceReStrings) {
String[] lines = line.split(" ");
String key = lines[1].replace(sourcePath, "").trim();
String value = lines[0].trim();
source_md5.put(key, value);
}
for (String line : destReStrings) {
String[] lines = line.split(" ");
String key = lines[1].replace(destPath, "").trim();
String value = lines[0].trim();
dest_md5.put(key, value);
}
for (Map.Entry<String, String> mapEntry : source_md5.entrySet()) {
if (!(dest_md5.containsKey(mapEntry.getKey())
&& dest_md5.get(mapEntry.getKey()).equals(mapEntry.getValue()))) {
log.info(sourcePath + " and " + destPath + " is not same!");
return 0;
// System.out.println(mapEntry.getKey());
}
}
log.info(sourcePath + " and " + destPath + " is same!");
return 1;
}
public static void main(String[] args) {
CheckoutMD5 checkoutMD5 = new CheckoutMD5();
System.out.println(checkoutMD5.checkoutMD5Folder("/home/v1_copy","/home/ubuntu"));
}
}

@ -1,110 +1,124 @@
package com.platform.glusterfs;
package com.platform.glusterfs;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap; import java.io.File;
import java.util.Iterator; import java.util.ArrayList;
import java.util.List; import java.util.HashMap;
import java.util.Map; import java.util.Iterator;
import java.util.List;
import org.apache.log4j.Logger; import java.util.Map;
import org.apache.log4j.PropertyConfigurator;
import org.apache.log4j.Logger;
import com.platform.utils.Constant; import org.apache.log4j.PropertyConfigurator;
/** import com.platform.utils.Constant;
*
* nullmapipip /**
* ipPeerinCluster(Connected) *
* ipPeerinCluster(Disconnected) * @author liliy
* @author liliy * @version [2016912]
* @version [2016912] * @see [/]
* @see [/] * @since [/]
* @since [/] */
*/ public class ClusterInfo {
public class ClusterInfo { public static Logger log = Logger.getLogger(ClusterInfo.class);
public static Logger log = Logger.getLogger(ClusterInfo.class);
/**
public Map<String, String> showClusterInfo() { *
log.info("get cluster info"); * nullmapipip
Map<String, String> peerIps = new HashMap<String, String>(); * ipPeerinCluster(Connected)
* ipPeerinCluster(Disconnected)
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd, Constant.port, Constant.glusterPeerStatus); * @return
if (reStrings == null) { * @see [##]
log.error("1101 command get result is null"); */
return null; public Map<String, String> showClusterInfo() {
} log.info("get cluster info");
if (reStrings.size() == 0) { Map<String, String> peerIps = new HashMap<String, String>();
log.error("1102 command get result is nothing");
return null; List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(Constant.glusterPeerStatus);
} if (reStrings == null) {
log.error("1101 command get result is null");
if (!(reStrings.get(0).split(":")[0].contains("Number of Peers"))) { return null;
}
log.error("1103 get result string wrong"); if (reStrings.size() == 0) {
return null; log.error("1102 command get result is nothing");
} return null;
}
// System.out.print(reStrings.get(0)); if (!(reStrings.get(0).split(":")[0].contains("Number of Peers"))) {
int flag = 0; log.error("1103 get result string wrong");
String ipString = ""; return null;
String state = ""; }
for (Iterator it2 = reStrings.iterator(); it2.hasNext();) {
String line = (String) it2.next();
line=line.replaceAll(" +", " "); // System.out.print(reStrings.get(0));
String keyValue[] = line.split(":");
if (keyValue[0].equals("Hostname")) { int flag = 0;
String ipString = "";
if (keyValue.length < 2) { String state = "";
log.error("1105 command get result is wrong"); for (Iterator it2 = reStrings.iterator(); it2.hasNext();) {
continue; String line = (String) it2.next();
} line=line.replaceAll(" +", " ");
String keyValue[] = line.split(":");
ipString = keyValue[1].replaceAll(" ", ""); if (keyValue[0].equals("Hostname")) {
flag = 1;
} else if (flag == 1 && keyValue[0].equals("State")) { if (keyValue.length < 2) {
log.error("1105 command get result is wrong");
if (keyValue.length < 2) { continue;
log.error("1106 command get result is wrong"); }
continue;
} ipString = keyValue[1].replaceAll(" ", "");
flag = 1;
state = keyValue[1].replaceAll(" ", ""); } else if (flag == 1 && keyValue[0].equals("State")) {
flag = 0;
peerIps.put(ipString, state); if (keyValue.length < 2) {
} log.error("1106 command get result is wrong");
continue;
} }
return peerIps;
} state = keyValue[1].replaceAll(" ", "");
flag = 0;
/** peerIps.put(ipString, state);
* ipip }
* ipnull
* ipPeerinCluster(Connected) }
* ipPeerinCluster(Disconnected) return peerIps;
* @param peerip }
* @return
* @see [##] /**
*/ * ipip
public String getPeerStatus(String peerip){ * ipnull
Map<String, String> peerIps=showClusterInfo(); * ipPeerinCluster(Connected)
if(peerIps==null || peerIps.size()==0){ * ipPeerinCluster(Disconnected)
return null; * @param peerip
} * @return
if(!peerIps.containsKey(peerip)){ * @see [##]
return Constant.peerincluster_disconnected; */
} public String getPeerStatus(String peerip){
return peerIps.get(peerip); Map<String, String> peerIps=showClusterInfo();
} if(peerIps==null || peerIps.size()==0){
return null;
}
public static void main(String[] args) {
PropertyConfigurator.configure("log4j.properties"); if(peerip.equals(Constant.hostIp)){
System.out.println(new ClusterInfo().showClusterInfo()); return Constant.peerincluster_connected;
} }
} if(!peerIps.containsKey(peerip)){
return Constant.peerNotinCluster;
}
return peerIps.get(peerip);
}
public static void main(String[] args) {
// PropertyConfigurator.configure("log4j.properties");
System.out.println(new ClusterInfo().showClusterInfo());
System.out.println(new ClusterInfo().getPeerStatus("192.168.0.116"));
}
}

@ -1,3 +1,4 @@
package com.platform.glusterfs; package com.platform.glusterfs;
import java.util.List; import java.util.List;
@ -32,7 +33,7 @@ public class CopyData {
String sourceFolderName = sourceVolumeName; String sourceFolderName = sourceVolumeName;
String destFolderName = destVolumeName; String destFolderName = destVolumeName;
status = copyFolderFiles(sourceFolderName, destFolderName, fileName); status = copyFolderFilesAnyway(sourceFolderName, destFolderName, fileName);
return status; return status;
} }
@ -54,7 +55,7 @@ public class CopyData {
return -3; return -3;
} }
reStrings=showData.showFolderData(sourceFolderName+"/"+fileName); reStrings=showData.showFolderData(sourceFolderName+"/"+fileName);
if(reStrings==null){ if(reStrings==null){
log.info("3202 "+sourceFolderName+"/"+fileName+" is not exists"); log.info("3202 "+sourceFolderName+"/"+fileName+" is not exists");
return -2; return -2;
@ -71,10 +72,40 @@ public class CopyData {
return 1; return 1;
} }
/**
* @param sourceFolderName
* @param destFolderName
* @param fileName
* @return
*/
public int copyFolderFilesAnyway(String sourceFolderName, String destFolderName, String fileName) {
createFolders(destFolderName);
int result = copyFolderFiles(sourceFolderName, destFolderName, fileName);
return result;
}
public int createFolders(String folder){
log.info("create "+folder);
String splitFolder[]=folder.substring(1).split("/");
String cmd="mkdir ";
for(String one:splitFolder){
cmd+="/"+one.replaceAll(" ", "");
Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
}
return 1;
}
@Test @Test
public void testcreateFolders() {
createFolders("/aaa/vvv/ddd/www/rrrr");
}
//@Test
public void testCopyFolderFiles() { public void testCopyFolderFiles() {
PropertyConfigurator.configure("log4j.properties");
copyFolderFiles("/home", "/home/ubuntu", "system_data"); copyFolderFiles("/home", "/home/ubuntu", "system_data");
} }
} }

@ -1,120 +1,125 @@
package com.platform.glusterfs;
import java.util.ArrayList; package com.platform.glusterfs;
import java.util.List;
import java.util.Map; import java.util.ArrayList;
import java.util.List;
import org.junit.Test; import java.util.Map;
import com.platform.entities.FolderNode; import org.junit.Test;
import com.platform.utils.Constant; import com.platform.entities.FolderNode;
import com.platform.utils.FileOperateHelper; import com.platform.utils.Constant;
import com.platform.utils.FileOperateHelper;
/** import com.platform.utils.GanymedSSH;
* <> GFS
* <> /**
* @author chen * <> GFS
* @version [201698] * <>
* @see [/] * @author chen
* @since [/] * @version [201698]
*/ * @see [/]
public class GetTreeData { * @since [/]
ShowData showData = new ShowData(); */
public class GetTreeData {
/** ShowData showData = new ShowData();
* <>
* <> /**
* @param name * <>
* @return * <>
* @see [##] * @param name
*/ * @return
public FolderNode getDatas(String name) { * @see [##]
String names[]=name.split("/"); */
String only_name=names[names.length-1]; public FolderNode getDatas(String name) {
FolderNode fileNode = new FolderNode(only_name); String names[]=name.split("/");
fileNode.setPath(name); String only_name=names[names.length-1];
Map<String, String> files = showData.showFolderData(name); FolderNode fileNode = new FolderNode(only_name);
if(files==null || files.size()==0){ fileNode.setPath(name);
return fileNode; Map<String, String> files = showData.showFolderData(name);
} if(files==null || files.size()==0){
fileNode.setIsFolder(files.size()); return fileNode;
List<FolderNode> list = new ArrayList<FolderNode>(); }
fileNode.setChildNodes(list); fileNode.setIsFolder(files.size());
for (Map.Entry<String, String> entry : files.entrySet()) { List<FolderNode> list = new ArrayList<FolderNode>();
if(entry.getKey().equals("app")){ fileNode.setChildNodes(list);
continue; for (Map.Entry<String, String> entry : files.entrySet()) {
} if(entry.getKey().equals("app")){
int number = Integer.parseInt(entry.getValue()); continue;
if (number == 1) { }
fileNode.getChildNodes().add(new FolderNode(entry.getKey(), number)); int number = Integer.parseInt(entry.getValue());
} if (number == 1) {
if (number > 1) { fileNode.getChildNodes().add(new FolderNode(entry.getKey(), number));
FolderNode temp=getDatas(name+"/"+entry.getKey()); }
fileNode.getChildNodes().add(temp); if (number > 1) {
} FolderNode temp=getDatas(name+"/"+entry.getKey());
} fileNode.getChildNodes().add(temp);
}
return fileNode; }
}
return fileNode;
/** }
* <>
* <>
* @param name /**
* @return * <>
* @see [##] * <>
*/ * @param name
public FolderNode getDatasWithShell(String name) { * @return
if(name.endsWith("/")){ * @see [##]
name=name.substring(0, name.length()); */
} public FolderNode getDatasWithShell(String name) {
String names[]=name.split("/"); if(name.endsWith("/")){
String only_name=names[names.length-1]; name=name.substring(0, name.length()-1);
FolderNode fileNode = new FolderNode(name); }
fileNode.setPath(name); // String names[]=name.split("/");
// String only_name=names[names.length-1];
String shellComment=new FileOperateHelper().fileReaderAndendline(Constant.fileGetTreeData); FolderNode fileNode = new FolderNode(name);
String sh_path="/getTreedata.sh"; fileNode.setPath(name);
String cmd="echo -e "+shellComment+" > "+sh_path+" & chmod +x "+sh_path;
Constant.ganymedSSH.execCmdWaitAcquiescent(cmd); // String shellComment= new FileOperateHelper().fileReaderAndendline(Constant.fileGetTreeData);
// Map<String, String> files = showData.showFolderData(name); String shellComment= Constant.strGetTreeData;
List<String> files=Constant.ganymedSSH.execCmdWaitAcquiescent(sh_path+" "+name); String sh_path="/getTreedata.sh";
if(files==null){ String cmd="echo -e \""+shellComment+"\" > "+sh_path+" & chmod +x "+sh_path;
return null; Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
} // Map<String, String> files = showData.showFolderData(name);
if(files.size()==0){ List<String> files=Constant.ganymedSSH.execCmdWaitAcquiescent(sh_path+" "+name);
return fileNode; if(files==null){
} return null;
for(String file:files){ }
if(files.size()==0){
} return fileNode;
}
return fileNode; for(String file:files){
}
@Test }
public void test_getTreeData() {
return fileNode;
GetTreeData getTreeData=new GetTreeData(); }
FolderNode fileOrFolder=getTreeData.getDatas("/home"); @Test
System.out.println(fileOrFolder); public void test_getTreeData() {
}
} GetTreeData getTreeData=new GetTreeData();
/* // FolderNode fileOrFolder=getTreeData.getDatas("/home/gfs_ftp_point");
class FileOrFolder { FolderNode fileOrFolder=getTreeData.getDatasWithShell("/home/gfs_ftp_point/");
String name; System.out.println(fileOrFolder);
int isFolder; // 1 is file and other integer is folder show children number }
List<FileOrFolder> children; }
/*
public FileOrFolder(String name) { class FileOrFolder {
// TODO Auto-generated constructor stub String name;
this.name = name; int isFolder; // 1 is file and other integer is folder show children number
} List<FileOrFolder> children;
public FileOrFolder(String name, int isFolder) { public FileOrFolder(String name) {
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
this.name = name; this.name = name;
this.isFolder = isFolder; }
}
} public FileOrFolder(String name, int isFolder) {
// TODO Auto-generated constructor stub
*/ this.name = name;
this.isFolder = isFolder;
}
}
*/

@ -16,17 +16,7 @@ import com.platform.utils.Constant;
public class RemoveData { public class RemoveData {
public static Logger log = Logger.getLogger ( RemoveData.class); public static Logger log = Logger.getLogger ( RemoveData.class);
public int deleteVolumeFiles(String volumeName,String fileName){
log.info("start delete "+volumeName+" "+fileName);
int status=-1;
/**
* get mount point of volumeName
*/
String folderName=volumeName;
status=deleteFolderFiles(folderName,fileName);
return status;
}
/** /**
* -1 :error; 0: the filename is not exists ; 1: right * -1 :error; 0: the filename is not exists ; 1: right
@ -34,65 +24,33 @@ public class RemoveData {
* @param fileName * @param fileName
* @return * @return
*/ */
public int deleteFolderFiles(String folderName,String fileName){ public int deleteFolder(String folderName){
log.info("start delete "+folderName+"/"+fileName); log.info("start delete "+folderName);
ShowData showData=new ShowData(); ShowData showData=new ShowData();
Map<String,String> reStrings=showData.showFolderData(folderName+"/"+fileName); Map<String,String> reStrings=showData.showFolderData(folderName);
if(reStrings==null){ if(reStrings==null){
log.error("3301 "+folderName+"/"+fileName+" is not exists"); log.error("3301 "+folderName+" is not exists");
return -1; return -1;
} }
String command="rm -r "+folderName+"/"+fileName; String command="rm -r "+folderName;
// int status=runCommand.runCommand(command); // int status=runCommand.runCommand(command);
Constant.ganymedSSH.execCmdNoWaitAcquiescent(command); Constant.ganymedSSH.execCmdNoWaitAcquiescent(command);
log.info("delete "+folderName+" "+fileName+" running"); log.info("delete "+folderName+" running");
return 1; return 1;
} }
public int getFolderSize(String name) {
log.info("get "+name+" size");
String command="du -k -d 0 "+name;
/*
* RunCommand runCommand=new RunCommand();
List<String> reStrings=runCommand.runCommandWait(command);
*/
List<String> reStrings=Constant.ganymedSSH.execCmdWaitAcquiescent(command);
if(reStrings==null){
log.error("3302 the "+command+" return error");
return -1;
}
if(reStrings.size()<1){
log.error("3303 the "+command+" return error");
return -1;
}
if(reStrings.size()==1 && reStrings.get(0).contains("No such file or directory")){
log.info("3304 "+name+" is not exists");
return 0;
}
String strSize=(reStrings.get(0).split("\t"))[0];
int size=Integer.parseInt(strSize);
log.info(name +" size is "+size);
return size;
}
// @Test
public void test_getFolderSize() {
PropertyConfigurator.configure("log4j.properties");
getFolderSize("/home/ubuntu");
}
@Test @Test
public void testDeleteFolderFiles() { public void testDeleteFolderFiles() {
PropertyConfigurator.configure("log4j.properties"); PropertyConfigurator.configure("log4j.properties");
deleteFolderFiles("/home/ubuntu","system_data"); deleteFolder("/home/ubuntu");
} }
} }

@ -1,11 +1,67 @@
package com.platform.glusterfs;
package com.platform.glusterfs;
import org.apache.log4j.Logger;
import java.util.List;
public class SetCluster {
public static Logger log = Logger.getLogger ( SetCluster.class); import org.apache.log4j.Logger;
import org.hamcrest.core.Is;
public int addPeer(String peerip){
return 0; import com.platform.utils.Constant;
} import com.platform.utils.Support;
}
public class SetCluster {
public static Logger log = Logger.getLogger ( SetCluster.class);
/**
*
* 1-1ip-2 0
* @param peerip
* @return
* @see [##]
*/
public int probePeer(String peerip){
if(!Support.checkIP(peerip)){
log.error(peerip +"is illegal!" );
return -1;
}
String cmd="gluster peer probe "+peerip;
List<String> reStrings=Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
if(reStrings==null || reStrings.size()==0){
log.error("detach error! ");
return -2;
}
if(reStrings.contains(Constant.success)){
log.info("probe success!");
return 1;
}
log.info("probe failed!");
return 0;
}
/**
*
* 1-1ip-2 0
* @param peerip
* @return
* @see [##]
*/
public int detachPeer(String peerip){
if(!Support.checkIP(peerip)){
log.error(peerip +"is illegal!" );
return -1;
}
String cmd="gluster peer detach "+peerip;
List<String> reStrings=Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
if(reStrings==null || reStrings.size()==0){
log.error("detach error! ");
return -2;
}
if(reStrings.contains(Constant.success)){
log.info("detach success!");
return 1;
}
log.info("detach failed!");
return 0;
}
}

File diff suppressed because it is too large Load Diff

@ -1,105 +1,131 @@
package com.platform.glusterfs; package com.platform.glusterfs;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator; import org.apache.log4j.PropertyConfigurator;
import org.junit.Test; import org.junit.Test;
import com.platform.utils.Constant; import com.platform.utils.Constant;
public class ShowData { public class ShowData {
public static Logger log = Logger.getLogger ( ShowData.class); public static Logger log = Logger.getLogger ( ShowData.class);
/** /**
* get the data of volumeName Map<string s1,string s2> s1 is data name and s2 is type file or folder * get the data of volumeName Map<string s1,string s2> s1 is data name and s2 is type file or folder
* <> * <>
* @param volumeName * @param volumeName
* @return * @return
* @see [##] * @see [##]
*/ */
public Map<String,String> showVolumeFiles(String volumeName){ public Map<String,String> showVolumeFiles(String volumeName){
log.info("start show the data"); log.info("start show the data");
Map<String,String> data_type=new HashMap<String, String>(); Map<String,String> data_type=new HashMap<String, String>();
/** /**
* get mount point of volumeName * get mount point of volumeName
*/ */
String folderName=volumeName; String folderName=volumeName;
data_type=showFolderData(volumeName); data_type=showFolderData(volumeName);
return data_type; return data_type;
} }
/** /**
* get the data of folder name * get the data of folder name
* Map<String,String> is folder name and type 1 is file and others is folder * Map<String,String> is folder name and type 1 is file and others is folder
* @param FolderName * @param FolderName
* @return * @return
*/ */
public Map<String,String> showFolderData(String folderName){ public Map<String,String> showFolderData(String folderName){
log.info(" start get "+folderName+" data"); log.info(" start get "+folderName+" data");
Map<String,String> data_type=new HashMap<String, String>(); Map<String,String> data_type=new HashMap<String, String>();
String command="ls -l "+folderName; String command="ls -l "+folderName;
/* /*
RunCommand runCommand=new RunCommand(); RunCommand runCommand=new RunCommand();
List<String> reStrings=runCommand.runCommandWait(command); List<String> reStrings=runCommand.runCommandWait(command);
*/ */
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd, Constant.port, command); List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd, Constant.port, command);
if(reStrings==null){ if(reStrings==null){
log.error("2101 command get result is null"); log.error("2101 command get result is null");
return null; return null;
} }
if(reStrings.size()==0){ if(reStrings.size()==0){
log.info("2102 the folder is empty"); log.info("2102 the folder is empty");
return data_type; return data_type;
} }
if(reStrings.get(0).contains("No such file or directory")){ if(reStrings.get(0).contains("No such file or directory")){
log.info("2103 the "+folderName+" is not exists"); log.info("2103 the "+folderName+" is not exists");
return null; return null;
} }
/** /**
* remove first line total number * remove first line total number
*/ */
reStrings.remove(0); reStrings.remove(0);
for(Iterator it2 = reStrings.iterator();it2.hasNext();){ for(Iterator it2 = reStrings.iterator();it2.hasNext();){
String line=(String)it2.next(); String line=(String)it2.next();
line=line.replaceAll(" +", " "); line=line.replaceAll(" +", " ");
String keyValue[]=line.split(" "); String keyValue[]=line.split(" ");
if(keyValue.length<9){ if(keyValue.length<9){
log.error("2104 "+line+" length is short"); log.error("2104 "+line+" length is short");
continue; continue;
} }
data_type.put(keyValue[8], keyValue[1]); data_type.put(keyValue[8], keyValue[1]);
} }
log.info(" get "+folderName+" data successed"); log.info(" get "+folderName+" data successed");
return data_type; return data_type;
} }
/**
/** * folder
* * -2-1folderfolder
* <> * @param folderPath
* <> * @return
* @see [##] * @see [##]
*/ */
@Test public long getFolderSize(String folderPath) {
public void testShowData(){ log.info("get " + folderPath + " Size ");
System.out.println(showFolderData("/home")); String command = "du -k -d 0 "+folderPath+" | grep " + folderPath + "|awk \'{print $1}\'";
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(command);
} if(reStrings==null || reStrings.size()==0){
log.error("get " + folderPath + " Size error!");
return -2;
}
if (reStrings.get(0).contains(Constant.noSuchFile)) {
log.error(folderPath+" is not exists");
return -1;
}
long size = Long.valueOf(reStrings.get(0));
return size;
}
/**
*
* <>
* <>
* @see [##]
*/
@Test
public void testShowData(){
System.out.println(showFolderData("/home"));
}
} }

@ -1,334 +1,422 @@
package com.platform.glusterfs;
package com.platform.glusterfs;
import java.io.File;
import java.util.ArrayList; import java.io.File;
import java.util.HashMap; import java.util.ArrayList;
import java.util.Iterator; import java.util.HashMap;
import java.util.List; import java.util.Iterator;
import java.util.Map; import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator; import org.apache.log4j.Logger;
import org.junit.Test; import org.apache.log4j.PropertyConfigurator;
import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper; import org.junit.Test;
import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper;
import com.platform.utils.Constant;
import com.platform.utils.GanymedSSH; import com.platform.utils.Constant;
import com.platform.utils.GanymedSSH;
import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class VolumeInfo {
public static Logger log = Logger.getLogger(VolumeInfo.class); /**
* volume <>
/** *
* volume * @author liliy
* <> * @version [2016913]
* @return * @see [/]
* @see [##] * @since [/]
*/ */
public List<String> showAllVolumeName() { public class VolumeInfo {
log.info("get volume name"); public static Logger log = Logger.getLogger(VolumeInfo.class);
List<String> volNames = new ArrayList<String>();
/**
/* * volume <>
* String command = "echo \"" + Constant.rootPasswd + *
* "\" |sudo -S gluster volume info|grep ^Volume.Name"; RunCommand * @return
* runCommand = new RunCommand(); List<String> reStrings = * @see [##]
* runCommand.runCommandWait(command); */
*/ public List<String> showAllVolumeName() {
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, log.info("get volume name");
Constant.rootPasswd, Constant.port, Constant.glusterVolumeInfo + "|grep ^Volume.Name"); List<String> volNames = new ArrayList<String>();
// System.out.println(reStrings);
if (reStrings == null) { /*
log.error("1401 get result is null"); * String command = "echo \"" + Constant.rootPasswd +
return null; * "\" |sudo -S gluster volume info|grep ^Volume.Name"; RunCommand
} * runCommand = new RunCommand(); List<String> reStrings =
if (reStrings.size() == 0) { * runCommand.runCommandWait(command);
log.error("1402 get result is nothing"); */
return null; List<String> reStrings = Constant.ganymedSSH
} .execCmdWaitAcquiescent(Constant.glusterVolumeInfo + "|grep ^Volume.Name");
if (reStrings.get(0).contains(Constant.noVolume)) { // System.out.println(reStrings);
reStrings.clear(); if (reStrings == null) {
return reStrings; log.error("1401 get result is null");
} return null;
if (!(reStrings.get(0).split(":")[0].contains("Volume Name"))) { }
log.error("1403 get result string wrong"); if (reStrings.size() == 0) {
return null; log.error("1402 get result is nothing");
} return null;
}
String nameInfo = ""; if (reStrings.get(0).contains(Constant.noVolume)) {
for (Iterator it = reStrings.iterator(); it.hasNext();) { reStrings.clear();
String line = (String) it.next(); return reStrings;
String str[] = line.split(":"); }
volNames.add(str[1].replaceAll(" ", "")); if (!(reStrings.get(0).split(":")[0].contains("Volume Name"))) {
} log.error("1403 get result string wrong");
return volNames; return null;
}
}
String nameInfo = "";
/** for (Iterator it = reStrings.iterator(); it.hasNext();) {
* volumevolume String line = (String) it.next();
* <> String str[] = line.split(":");
* @param volumeName volNames.add(str[1].replaceAll(" ", ""));
* @return }
* @see [##] return volNames;
*/
public String getVolumeType(String volumeName) { }
log.info("get volume type");
String volType = ""; /**
* volumevolume <>
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, *
Constant.rootPasswd, Constant.port, Constant.glusterVolumeInfo + volumeName + "|grep ^Type"); * @param volumeName
// System.out.println(reStrings); * @return
if (reStrings == null) { * @see [##]
log.error("1501 get result is null"); */
return null; public String getVolumeType(String volumeName) {
} log.info("get volume type");
if (reStrings.size() == 0) { String volType = "";
log.error("1502 get result is nothing");
return null; List<String> reStrings = Constant.ganymedSSH
} .execCmdWaitAcquiescent(Constant.glusterVolumeInfo + volumeName + "|grep ^Type");
if (!(reStrings.get(0).split(":")[0].contains("Type"))) { // System.out.println(reStrings);
log.error("1503 get result string wrong"); if (reStrings == null) {
return null; log.error("1501 get result is null");
} return null;
}
// System.out.println(reStrings); if (reStrings.size() == 0) {
log.error("1502 get result is nothing");
for (Iterator it = reStrings.iterator(); it.hasNext();) { return null;
String line = (String) it.next(); }
String str[] = line.split(":"); if (!(reStrings.get(0).split(":")[0].contains("Type"))) {
volType = str[1]; log.error("1503 get result string wrong");
} return null;
volType = volType.replaceAll(" ", ""); }
return volType;
} // System.out.println(reStrings);
public String getVolumeStatus(String volumeName) { for (Iterator it = reStrings.iterator(); it.hasNext();) {
log.info("get volume status"); String line = (String) it.next();
String volStatus = ""; String str[] = line.split(":");
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, volType = str[1];
Constant.rootPasswd, Constant.port, Constant.glusterVolumeInfo + "|grep ^Status"); }
// System.out.println(reStrings); volType = volType.replaceAll(" ", "");
if (reStrings == null) { return volType;
log.error("1701 get result is null"); }
return null;
} /**
if (reStrings.size() == 0) { * volumeName nullvolumeNameVolume volumeName does not
log.error("1702 get result is nothing"); * existStarted,Stopped,Created
return null; *
} * @param volumeName
if (!(reStrings.get(0).split(":")[0].contains("Status"))) { * @return
log.error("1703 get result string wrong"); * @see [##]
return null; */
} public String getVolumeStatus(String volumeName) {
log.info("get volume status");
for (Iterator it = reStrings.iterator(); it.hasNext();) { String volStatus = "";
String line = (String) it.next(); String cmd = Constant.glusterVolumeInfo + " " + volumeName + " |grep ^Status";
String str[] = line.split(":"); List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
volStatus = str[1].replaceAll(" ", ""); // System.out.println(reStrings);
} if (reStrings == null) {
return volStatus; log.error("1701 get result is null");
} return null;
}
public Double getVolumeAllSize(String volumeName) { if (reStrings.size() == 0) {
log.info("get volume allSize"); log.error("1702 get result is nothing");
Double allSize = null; return null;
/* }
* ======= // waiting for testing... public Double
* getVolumeAllSize(String volumeName) { log.info("get volume allSize"); if (reStrings.get(0).contains("does not exist")) {
* Double allSize = null; log.error("1703 " + reStrings.get(0));
* return reStrings.get(0);
* >>>>>>> origin/AlexKie String command = "echo \"" + }
* Constant.rootPasswd + "\" |sudo -S df -h|grep " + volumeName + if (!(reStrings.get(0).split(":")[0].contains("Status"))) {
* "|awk '{print $2}'"; RunCommand runCommand = new RunCommand(); log.error("1704 get result string wrong");
* List<String> reStrings = runCommand.runCommandWait(command); <<<<<<< return null;
* HEAD }
*/ for (Iterator it = reStrings.iterator(); it.hasNext();) {
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd, String line = (String) it.next();
Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $2}'"); String str[] = line.split(":");
// System.out.println(reStrings); volStatus = str[1].replaceAll(" ", "");
if(reStrings==null){ }
log.error("1801 get result is null");
return null; return volStatus;
} }
if(reStrings.size()==0){
log.error("1802 get result is nothing"); /**
return null; * volumeName
} * volumeName-1-2 volumeName
char flag = reStrings.get(0).trim().toCharArray()[0]; * @param volumeName
if (flag < 48 || flag > 57) { * @return
log.error("1803 get result string wrong"); * @see [##]
return null; */
} public Long getVolumeAvailableSize(String volumeName) {
log.info("get volume availableSize");
for (Iterator it = reStrings.iterator(); it.hasNext();) { Long allSize = 0L;
String line = (String) it.next();
String str[] = line.split("[^0-9]"); String cmd = Constant.df + " | grep " + volumeName + "|awk '{print $4}'";
allSize = Double.parseDouble(str[0]); List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
} // System.out.println(reStrings);
if (reStrings == null) {
return allSize; log.error("1802 get result is error");
} return -2L;
}
public Double getVolumeUseSize(String volumeName) { if (reStrings.size() == 0) {
log.info("get volume used size"); log.error("1801 " + volumeName + " is not exists!");
Double usedSize = null; return -1L;
}
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, allSize = Long.parseLong(reStrings.get(0));
Constant.rootPasswd, Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $3}'"); return allSize;
// System.out.println(reStrings); }
if (reStrings == null) {
log.error("1901 get result is null"); /**
return null; * volumeName
} * volumeName-1-2 volumeName
if (reStrings.size() == 0) { * @param volumeName
log.error("1902 get result is nothing"); * @return
return null; * @see [##]
} */
char flag = reStrings.get(0).trim().toCharArray()[0]; public Long getVolumeUseSize(String volumeName) {
if (flag < 48 || flag > 57) { log.info("get volume used size");
log.error("1903 get result string wrong"); Long usedSize = 0L;
return null; if (volumeIsExists(volumeName) == false) {
} log.error("1901 " + volumeName + " is not exists!");
return -1L;
for (Iterator it = reStrings.iterator(); it.hasNext();) {
String line = (String) it.next(); }
String str[] = line.split("[^0-9]");
String cmd = "df | grep " + volumeName + "|awk '{print $3}'";
usedSize = Double.parseDouble(str[0]); List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
} // System.out.println(reStrings);
if (reStrings == null) {
return usedSize; log.error("1901 get result is null");
} return -2L;
}
/** if (reStrings.size() == 0) {
* @param volumeName log.error("1902 " + volumeName + " is not exists!");
* @return String ipAndpath[] = brick.split(":"); return -1L;
String ip = ipAndpath[0]; }
String path = ipAndpath[1]; usedSize = Long.parseLong(reStrings.get(0));
*/ return usedSize;
public List<String> getVolumeBricks(String volumeName) { }
log.info("get volume bricks");
/**
String cmd = "gluster volume info " + volumeName + " |grep ^Brick'[0-9]\\+' |awk '{print $2}'"; * volumeNamebricks
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd); * birckslist ip:path,volumeNamenull
// System.out.println(reStrings); * @param volumeName
if (reStrings == null) { * @return
log.error("1601 get volume bricks wrong"); * @see [##]
return null; */
} public List<String> getVolumeBricks(String volumeName) {
log.info("get volume bricks");
return reStrings;
} String cmd = "gluster volume info " + volumeName + " |grep ^Brick'[0-9]\\+' |awk '{print $2}'";
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
public List<String> getVolumeMountPoint(String volumeName) { // System.out.println(reStrings);
log.info("get volume MountPoint"); if (reStrings == null) {
log.error("1601 get volume bricks wrong");
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd, return null;
Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $6}'"); }
// System.out.println(reStrings); if (reStrings.size()==0) {
if(reStrings==null){ log.error("1602 "+volumeName+" is not exists!");
log.error("11001 get result string wrong"); return null;
return null; }
} return reStrings;
if(reStrings.size()==0){ }
log.error("11002 "+volumeName+" is no mountpoint");
return null; /**
} * volumeName
* <>
char flag = reStrings.get(0).trim().toCharArray()[0]; * @param volumeName
if (flag != '/') { * @return
log.error("11003 get result string wrong"); * @see [##]
return null; */
} public List<String> getVolumeMountPoint(String volumeName) {
List<String> mountPoints = new ArrayList<>(); log.info("get volume MountPoint");
for(String mountPoint:reStrings){ List<String> mountPoints = new ArrayList<>();
mountPoint=mountPoint.replaceAll(" ", ""); String cmd=Constant.df + "|grep " + volumeName + "|awk '{print $6}'";
mountPoints.add(mountPoint); List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
} // System.out.println(reStrings);
return mountPoints; if (reStrings == null) {
} log.error("11001 get result string wrong");
return null;
public Map<String, Double> getVolumebricksDataSize(String volumeName) { }
List<String> bricks = getVolumeBricks(volumeName); if (reStrings.size() == 0) {
Map<String, Double> brick_size = new HashMap<>(); log.error("11002 " + volumeName + " is not exists or no mountpoint");
if (bricks == null) { return null;
return null; }
}
for (String brick : bricks) { // char flag = reStrings.get(0).trim().toCharArray()[0];
String ipAndpath[] = brick.split(":"); // if (flag != '/') {
String ip = ipAndpath[0]; // log.error("11003 get result string wrong");
String path = ipAndpath[1]; // return null;
String cmd = "du -d 0 " + path + "|awk '{print $1}'"; // }
List<String> reStrings = Constant.ganymedSSH.execCmdWait(ip, Constant.rootUser, Constant.rootPasswd,
Constant.port, cmd); for (String mountPoint : reStrings) {
// System.out.println(reStrings); mountPoint = mountPoint.replaceAll(" ", "");
if (reStrings == null) { mountPoints.add(mountPoint);
log.error("1901 get result is null"); }
return null; return mountPoints;
} }
if (reStrings.size() == 0) {
log.error("1902 get result is nothing"); public String getOneVolumeMountPoint(String volumeName) {
return null; log.info("get one volume MountPoint");
}
Pattern pattern = Pattern.compile("[0-9]*"); String mountPoint=null;
Matcher isNum = pattern.matcher(reStrings.get(0)); String cmd=Constant.df + "|grep " + volumeName + "|awk '{print $6}'";
if (!isNum.matches()) { List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
log.error("1903 " + reStrings.get(0) + " is unexpect"); // System.out.println(reStrings);
return null; if (reStrings == null) {
} log.error("11001 get result string wrong");
brick_size.put(brick, Double.parseDouble(reStrings.get(0))); return null;
} }
return brick_size; if (reStrings.size() == 0) {
} log.error("11002 " + volumeName + " is not exists or no mountpoint");
return null;
public Map<String, Double> getVolumebricksAvailableSize(String volumeName) { }
List<String> bricks = getVolumeBricks(volumeName);
Map<String, Double> brick_size = new HashMap<>(); // char flag = reStrings.get(0).trim().toCharArray()[0];
if (bricks == null) { // if (flag != '/') {
return null; // log.error("11003 get result string wrong");
} // return null;
for (String brick : bricks) { // }
String ipAndpath[] = brick.split(":");
String ip = ipAndpath[0]; mountPoint=reStrings.get(0);
String path = ipAndpath[1]; return mountPoint;
String cmd = "df " + path + "|awk '{print $4}'"; }
List<String> reStrings = Constant.ganymedSSH.execCmdWait(ip, Constant.rootUser, Constant.rootPasswd,
Constant.port, cmd); /**
// System.out.println(reStrings); * volumeNamebrick
if (reStrings == null) { * mapbricks <ip:path,data_size>
log.error("1901 get result is null"); * @param volumeName
return null; * @return
} * @see [##]
if (reStrings.size() == 0) { */
log.error("1902 get result is nothing"); public Map<String, Double> getVolumebricksDataSize(String volumeName) {
return null; List<String> bricks = getVolumeBricks(volumeName);
} Map<String, Double> brick_size = new HashMap<>();
Pattern pattern = Pattern.compile("[0-9]*"); if (bricks == null) {
Matcher isNum = pattern.matcher(reStrings.get(1)); return null;
if (!isNum.matches()) { }
log.error("1903 " + reStrings.get(1) + " is unexpect"); for (String brick : bricks) {
return null; String ipAndpath[] = brick.split(":");
} String ip = ipAndpath[0];
brick_size.put(brick, Double.parseDouble(reStrings.get(1))); String path = ipAndpath[1];
} String cmd = "du -d 0 " + path + "|awk '{print $1}'";
return brick_size; List<String> reStrings = Constant.ganymedSSH.execCmdWait(ip, Constant.rootUser, Constant.rootPasswd,
} Constant.port, cmd);
// System.out.println(reStrings);
@Test if (reStrings == null) {
public void test_getVolumebricksDataSize() { log.error("1901 get result is null");
System.out.println(getVolumebricksDataSize("gfs_ftp")); return null;
} }
if (reStrings.size() == 0) {
@Test log.error("1902 "+brick+" is not exits!");
public void test_getVolumebricksAvailableSize() { return null;
System.out.println(getVolumebricksAvailableSize("gfs_ftp")); }
} Pattern pattern = Pattern.compile("[0-9]*");
Matcher isNum = pattern.matcher(reStrings.get(0));
// @Test if (!isNum.matches()) {
public void test_getVolumeBricks() { log.error("1903 " + reStrings.get(0) + " is unexpect");
getVolumeBricks("gfs_ftp"); return null;
} }
} brick_size.put(brick, Double.parseDouble(reStrings.get(0)));
}
return brick_size;
}
/**
* volumeNamebrick
* mapbricks <ip:path,available_size>
* @param volumeName
* @return
* @see [##]
*/
public Map<String, Double> getVolumebricksAvailableSize(String volumeName) {
List<String> bricks = getVolumeBricks(volumeName);
Map<String, Double> brick_size = new HashMap<>();
if (bricks == null) {
return null;
}
for (String brick : bricks) {
String ipAndpath[] = brick.split(":");
String ip = ipAndpath[0];
String path = ipAndpath[1];
String cmd = "df " + path + "|awk '{print $4}'";
List<String> reStrings = Constant.ganymedSSH.execCmdWait(ip, Constant.rootUser, Constant.rootPasswd,
Constant.port, cmd);
// System.out.println(reStrings);
if (reStrings == null) {
log.error("1901 get result is null");
return null;
}
if (reStrings.size() == 0) {
log.error("1902 get result is nothing");
return null;
}
Pattern pattern = Pattern.compile("[0-9]*");
Matcher isNum = pattern.matcher(reStrings.get(1));
if (!isNum.matches()) {
log.error("1903 " + reStrings.get(1) + " is unexpect");
return null;
}
brick_size.put(brick, Double.parseDouble(reStrings.get(1)));
}
return brick_size;
}
/**
* volumeNametruefalse <>
*
* @param volumeName
* @return
* @see [##]
*/
public boolean volumeIsExists(String volumeName) {
List<String> volumes = showAllVolumeName();
if (volumes == null) {
return false;
}
if (volumes.contains(volumeName)) {
return true;
}
return false;
}
// @Test
public void test_getVolumebricksDataSize() {
System.out.println(getVolumebricksDataSize("gfs_ftp"));
}
// @Test
public void test_getVolumebricksAvailableSize() {
System.out.println(getVolumebricksAvailableSize("gfs_ftp"));
}
// @Test
public void test_getVolumeBricks() {
getVolumeBricks("gfs_ftp");
}
@Test
public void test_getVolumeStatus() {
System.out.println(getVolumeStatus("gs_fp"));
}
// @Test
public void test_getVolumeMountPoint() {
System.out.println(getVolumeMountPoint("gfs_ftp"));
System.out.println(getVolumeMountPoint("v1"));
}
}

@ -1,11 +1,16 @@
package com.platform.service; package com.platform.service;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import com.platform.dao.DataInfoDao;
import com.platform.entities.DataInfoEntity;
import com.platform.entities.PagerOptions; import com.platform.entities.PagerOptions;
public interface DataInfoService { public interface DataInfoService {
public ModelMap getPagerTableData(PagerOptions pagerOptions); public ModelMap getPagerTableData(PagerOptions pagerOptions);
void deleteData(String[] id); void deleteData(String[] id) throws Exception;
int save(DataInfoEntity data) throws Exception;
} }

@ -1,5 +1,6 @@
package com.platform.service; package com.platform.service;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -24,7 +25,8 @@ public class DataInfoServiceImp implements DataInfoService {
public ModelMap getPagerTableData(PagerOptions pagerOptions) { public ModelMap getPagerTableData(PagerOptions pagerOptions) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
ModelMap modelMap = new ModelMap(); ModelMap modelMap = new ModelMap();
int count = dfdDao.getLimitedDataCount(pagerOptions); //获取总记录条数 int count = dfdDao.getLimitedDataCount(pagerOptions); //获取总记录条数
System.out.println("total colume " + count);
int offset = 0; int offset = 0;
if (pagerOptions.getCurrentPageNum() > 1) { if (pagerOptions.getCurrentPageNum() > 1) {
pagerOptions.setTotalLimit((pagerOptions.getCurrentPageNum() - 1) pagerOptions.setTotalLimit((pagerOptions.getCurrentPageNum() - 1)
@ -41,19 +43,29 @@ public class DataInfoServiceImp implements DataInfoService {
} }
@Override @Override
public void deleteData(String[] id) { public void deleteData(String[] id) throws Exception {
// TODO Auto-generated method stub // TODO Auto-generated method stub
List<Integer> ids = new ArrayList<Integer>();
for(String idx: id){ for(String idx: id){
ids.add(Integer.parseInt(idx));
}
if (ids.size() > 0) {
//数据在不在? //数据在不在?
List<String> paths = dfdDao.getIdIsExist(Integer.parseInt(idx)); List<String> paths = dfdDao.getIdIsExist(ids);
if(paths.size()>0){ if(paths.size()>0){
//删除文件操作 //删除文件操作
for (int i = 0; i < paths.size(); i++) { for (int i = 0; i < paths.size(); i++) {
System.out.println(paths.get(i)); System.out.println(paths.get(i));
} }
//删除数据库记录 //删除数据库记录
//dfdDao.deleteRow(idx); dfdDao.removes(ids);
} }
} }
} }
@Override
public int save(DataInfoEntity data) throws Exception {
int result = dfdDao.save(data);
return result;
}
} }

@ -10,11 +10,13 @@
*/ */
package com.platform.service; package com.platform.service;
import java.util.List; import java.util.List;
import com.platform.entities.FolderNode; import com.platform.entities.FolderNode;
import com.platform.entities.VolumeEntity; import com.platform.entities.VolumeEntity;
/** /**
* <> * <>
* <> * <>
@ -45,6 +47,7 @@ public interface IGfsService {
* @throws Exception * @throws Exception
* @see [##] * @see [##]
*/ */
public int copyFolder(List<String> srcFolders, String dstFolder, String name) throws Exception; public int copyFolder(List<String> srcFolders, String dstFolder, String name) throws Exception;
/** /**
@ -68,5 +71,6 @@ public interface IGfsService {
public int moveData(String volumeName, String srcPath, String dstPath) throws Exception; public int moveData(String volumeName, String srcPath, String dstPath) throws Exception;
public int deleteData(String volumeName, String srcPath) throws Exception; public int deleteData(String volumeName, String srcPath) throws Exception;
} }

@ -0,0 +1,40 @@
package com.platform.service;
import java.util.List;
import com.platform.entities.DataInfoEntity;
import com.platform.entities.DataInfoEntityMoveTmp;
/**
* @author chen
*
*/
public interface IMoveDataService {
/**
* @param a dataInfo
* @param dstPath volumefoldereg: XXX/320198_16/1,or XXX/320122KFQ_15/1
* @return
* @throws Exception
*/
public boolean moveData(List<DataInfoEntity> data, String dstPath) throws Exception;
/**
* @return
* @throws Exception
*/
public List<DataInfoEntityMoveTmp> findAll() throws Exception;
/**
* @return
* @throws Exception
*/
public int delete(DataInfoEntityMoveTmp dataMove) throws Exception;
public int update(DataInfoEntityMoveTmp data) throws Exception;
public int save(DataInfoEntityMoveTmp data) throws Exception;
public int insertBatch(List<DataInfoEntityMoveTmp> list) throws Exception;
}

@ -40,8 +40,18 @@ public class OracleExtractHelper {
/** /**
* dblink * dblink
* *
<<<<<<< HEAD
<<<<<<< HEAD
* @param conn
* @param oc
=======
* @param conn
* @param oc
>>>>>>> 355b6e47a4fa8d058029ec939fe4fefdaa751275
=======
* @param conn * @param conn
* @param oc * @param oc
>>>>>>> web_backend_develope
* dblink * dblink
*/ */
public void createDBLink(Connection conn, OracleConnectorParams oc) { public void createDBLink(Connection conn, OracleConnectorParams oc) {

@ -1,149 +1,161 @@
/** /**
* : GfsServiceImpl.java * : GfsServiceImpl.java
* : </> * : </>
* : <> * : <>
* @author chen * @author chen
* : <> * : <>
* 201698 * 201698
* <> * <>
*/ */
package com.platform.service.impl; package com.platform.service.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.platform.entities.Brick; import com.platform.entities.Brick;
import com.platform.entities.FolderNode; import com.platform.entities.FolderNode;
import com.platform.entities.VolumeEntity; import com.platform.entities.VolumeEntity;
import com.platform.glusterfs.CopyData; import com.platform.glusterfs.CopyData;
import com.platform.glusterfs.GetTreeData; import com.platform.glusterfs.GetTreeData;
import com.platform.glusterfs.VolumeInfo; import com.platform.glusterfs.VolumeInfo;
import com.platform.service.IGfsService; import com.platform.service.IGfsService;
import com.platform.utils.CacheTreeData; import com.platform.utils.CacheTreeData;
import com.platform.utils.ThreadVolume; import com.platform.utils.ThreadVolume;
import com.platform.utils.getTreeDataByPath; import com.platform.utils.getTreeDataByPath;
/** /**
* <> gfs * <> gfs
* <> * <>
* @author chen * @author chen
* @version [201698] * @version [201698]
* @see [/] * @see [/]
* @since [/] * @since [/]
*/ */
@Service(value = "gfsService") @Service(value = "gfsService")
public class GfsServiceImpl implements IGfsService { public class GfsServiceImpl implements IGfsService {
/** gfs目录树形查询 */ /** gfs目录树形查询 */
private getTreeDataByPath getFolder = new getTreeDataByPath(); private getTreeDataByPath getFolder = new getTreeDataByPath();
/** 数据迁移实现 */ /** 数据迁移实现 */
private CopyData copydata = new CopyData(); private CopyData copydata = new CopyData();
/** Volume信息查询 */ /** Volume信息查询 */
private VolumeInfo volumeInfo = new VolumeInfo(); private VolumeInfo volumeInfo = new VolumeInfo();
@Override @Override
public FolderNode getFolder(String path) { public FolderNode getFolder(String path) {
FolderNode result = getFolder.findByPath(path); FolderNode result = getFolder.findByPath(path);
return result; return result;
} }
@Override @Override
public int copyFolder(List<String> srcFolders, String dstFolder, String name) public int copyFolder(List<String> srcFolders, String dstFolder, String name)
throws Exception { throws Exception {
int status = 0 ; int status = 0 ;
if (null != srcFolders) { if (null != srcFolders) {
for (String string : srcFolders) { for (String string : srcFolders) {
status = copydata.copyFolderFiles(string, dstFolder, name); status = copydata.copyFolderFilesAnyway(string, dstFolder, name);
} }
} }
return status; return status;
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see com.platform.service.IGfsService#getAllVolume() * @see com.platform.service.IGfsService#getAllVolume()
*/ */
@Override @Override
public List<VolumeEntity> getAllVolumes() throws Exception { public List<VolumeEntity> getAllVolumes() throws Exception {
List<VolumeEntity> volumeList = new ArrayList<>(); List<VolumeEntity> volumeList = CacheTreeData.getVolumeList();
List<String> volumeNameList = volumeInfo.showAllVolumeName(); if (null == volumeList) {
if (null == volumeNameList) { return new ArrayList<VolumeEntity>();
return null; }
} for (VolumeEntity volume : volumeList) {
for (String volumeName : volumeNameList) { // VolumeEntity volume = new VolumeEntity();
VolumeEntity volume = new VolumeEntity(); // volume.setName(volumeName);
volume.setName(volumeName); // List<String> path = volumeInfo.getVolumeMountPoint(volumeName);
List<String> path = volumeInfo.getVolumeMountPoint(volumeName); // //默认加载第一个路径
//默认加载第一个路径 // if (null != path && path.size() > 0) {
if (null != path && path.size() > 0) { // volume.setPath(path.get(0));
volume.setPath(path.get(0)); // }
} // volume.setAllSize(volumeInfo.getVolumeAllSize(volumeName));
volume.setAllSize(volumeInfo.getVolumeAllSize(volumeName)); // volume.setUsedSize(volumeInfo.getVolumeUseSize(volumeName));
volume.setUsedSize(volumeInfo.getVolumeUseSize(volumeName)); // //TODO 查询brick--
//TODO 查询brick-- // //返回 ip:path
//返回 ip:path // List<String> brickStrs = volumeInfo.getVolumeBricks(volumeName);
List<String> brickStrs = volumeInfo.getVolumeBricks(volumeName); // //brick已用大小
//brick已用大小 // Map<String, Double> usedSize = volumeInfo.getVolumebricksDataSize(volumeName);
Map<String, Double> usedSize = volumeInfo.getVolumebricksDataSize(volumeName); // Map<String, Double> availableSize = volumeInfo.getVolumebricksAvailableSize(volumeName);
Map<String, Double> availableSize = volumeInfo.getVolumebricksAvailableSize(volumeName); //
List<Brick> brickList = new ArrayList<Brick>(); //
for (String brickIpPath : brickStrs) { // List<Brick> brickList = new ArrayList<Brick>();
Brick b = new Brick(); // for (String brickIpPath : brickStrs) {
String ipAndpath[] = brickIpPath.split(":"); // Brick b = new Brick();
String brickip = ipAndpath[0]; // String ipAndpath[] = brickIpPath.split(":");
String brickpath = ipAndpath[1]; // String brickip = ipAndpath[0];
//iP , path , // String brickpath = ipAndpath[1];
b.setIp(brickip); // //iP , path ,
b.setPath(brickpath); // b.setIp(brickip);
b.setAvailableSize(availableSize.get(brickIpPath)); // b.setPath(brickpath);
b.setUsedSize(usedSize.get(brickIpPath)); // b.setAvailableSize(availableSize.get(brickIpPath));
brickList.add(b); // b.setUsedSize(usedSize.get(brickIpPath));
} // brickList.add(b);
volume.setBrick(brickList); // }
if (null != volume.getPath()) { // volume.setBrick(brickList);
// 获得 folder 目录 if (null != volume.getPath()) {
volume.setFolder(getFolder(volume.getPath())); // 获得 folder 目录
} List<FolderNode> list = new ArrayList<FolderNode>();
volumeList.add(volume); FolderNode currNode = getFolder(volume.getPath());
} if (null != currNode && null != currNode.getChildNodes()) {
return volumeList; list.addAll(currNode.getChildNodes());
} }
volume.setFolder(list);
@Override }
public VolumeEntity getOneVolume(String volumeName) throws Exception { }
VolumeEntity volume = new VolumeEntity(); return volumeList;
volume.setName(volumeName); }
List<String> path = volumeInfo.getVolumeMountPoint(volumeName);
if (null != path && path.size() > 0) { @Override
volume.setPath(path.get(0)); public VolumeEntity getOneVolume(String volumeName) throws Exception {
} VolumeEntity volume = new VolumeEntity();
volume.setAllSize(volumeInfo.getVolumeAllSize(volumeName)); volume.setName(volumeName);
volume.setUsedSize(volumeInfo.getVolumeUseSize(volumeName)); List<String> path = volumeInfo.getVolumeMountPoint(volumeName);
// volume.setBrick(brick); if (null != path && path.size() > 0) {
if (null != volume.getPath()) { volume.setPath(path.get(0));
volume.setFolder(getFolder(path.get(0))); }
} volume.setAllSize(volumeInfo.getVolumeAvailableSize(volumeName));
return volume; volume.setUsedSize(volumeInfo.getVolumeUseSize(volumeName));
} // volume.setBrick(brick);
if (null != volume.getPath()) {
@Override List<FolderNode> list = new ArrayList<FolderNode>();
public int moveData(String volumeName, String srcPath, String dstPath) if (null != path && path.size() > 0) {
throws Exception { FolderNode currNode = getFolder(path.get(0));
if (null != currNode && null != currNode.getChildNodes()) {
int result = copydata.copyFolderFiles(srcPath, dstPath, "app"); list.addAll(currNode.getChildNodes());
return result; }
} }
volume.setFolder(list);
@Override }
public int deleteData(String volumeName, String srcPath) throws Exception { return volume;
// TODO Auto-generated method stub }
return 0;
} @Override
public int moveData(String volumeName, String srcPath, String dstPath)
} throws Exception {
int result = copydata.copyFolderFilesAnyway(srcPath, dstPath, "app");
return result;
}
@Override
public int deleteData(String volumeName, String srcPath) throws Exception {
// TODO Auto-generated method stub
return 0;
}
}

@ -0,0 +1,141 @@
package com.platform.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.Resource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import com.platform.dao.DataInfoDao;
import com.platform.dao.DataInfoMoveTmpDao;
import com.platform.entities.DataInfoEntity;
import com.platform.entities.DataInfoEntityMoveTmp;
import com.platform.glusterfs.CheckoutMD5;
import com.platform.glusterfs.CopyData;
import com.platform.glusterfs.ShowData;
import com.platform.service.IMoveDataService;
import com.platform.utils.Bean2MapUtils;
import com.platform.utils.Constant;
import com.platform.utils.DateForm;
@Component
@Service(value = "moveDataService")
public class MoveDataServiceImpl implements IMoveDataService{
@Resource(name = "dataInfoDao")
private DataInfoDao dataInfoDao;
/**
*
*/
CopyData copy = new CopyData();
/**
* MD5
*/
CheckoutMD5 check = new CheckoutMD5();
@Resource(name = "dataInfoMoveTmpDao")
private DataInfoMoveTmpDao dataInfoMoveTmpDao;
/**
*
*/
ShowData show = new ShowData();
@Override
public boolean moveData(List<DataInfoEntity> data, String dstPath) throws Exception {
boolean isSuccess = false;
String tailPath = "";
if (null != data) {
//XXX/320198_16/1,or XXX/320122KFQ_15/1 ---> /320198_16/1, or /320122KFQ_15/1
List<DataInfoEntityMoveTmp> exist = dataInfoMoveTmpDao.findAll();
List<String> existIds = new ArrayList<String>();
if (null != exist) {
for (DataInfoEntityMoveTmp dataInfoEntityMoveTmp : exist) {
if ("0".equals(dataInfoEntityMoveTmp.getCompleteStatus()) || "1".equals(dataInfoEntityMoveTmp.getCompleteStatus())) {
if (null != dataInfoEntityMoveTmp.getDataPath()) {
existIds.add(dataInfoEntityMoveTmp.getDataPath());
}
}
}
}
Pattern pattern = Pattern.compile("\\/\\d+[a-z]*[A-Z]*_\\d+\\/\\d*\\/*$");
// 末尾 含有 /
Pattern pattern2 = Pattern.compile("\\/$");
Matcher matcher2 = pattern2.matcher(dstPath);
//去掉 最后 的 / 符合
if (matcher2.find()) {
dstPath = dstPath.substring(0, dstPath.length()-1);
}
List<DataInfoEntityMoveTmp> moveList = new ArrayList<DataInfoEntityMoveTmp>();
for (DataInfoEntity dataInfoEntity : data) {
if (existIds.contains(dataInfoEntity.getDataPath())) {
continue;
}
//TODO 正则:取出 data 的后面 的 路径eg: XXX/320198_16/1,or XXX/320122KFQ_15/1
Matcher matcher = pattern.matcher(dataInfoEntity.getDataPath());
// tailPath 第一个字符是 / 符号
if (matcher.find()) {
tailPath = matcher.group();
}
String finalDestPath = dstPath + tailPath;
DataInfoEntityMoveTmp dataMove = new DataInfoEntityMoveTmp();
dataMove.setSystemCode(dataInfoEntity.getSystemCode());
dataMove.setRegionalismCode(dataInfoEntity.getRegionalismCode());
dataMove.setDstPath(finalDestPath);
dataMove.setLastTime(DateForm.date2StringBysecond(new Date()));
moveList.add(dataMove);
}
if (moveList.size() > 0) {
dataInfoMoveTmpDao.insertBatch(moveList);
isSuccess = true;
}
}
return isSuccess;
}
@Override
public List<DataInfoEntityMoveTmp> findAll() throws Exception {
List<DataInfoEntityMoveTmp> result = new ArrayList<DataInfoEntityMoveTmp>();
try {
result = dataInfoMoveTmpDao.findAll();
} catch (Exception e) {
System.err.println(e);
}
return result;
}
@Override
public int delete(DataInfoEntityMoveTmp dataMove) throws Exception {
int result = dataInfoMoveTmpDao.remove(dataMove.getId());
return result;
}
@Override
public int save(DataInfoEntityMoveTmp data) throws Exception {
dataInfoMoveTmpDao.save(data);
return 0;
}
@Override
public int insertBatch(List<DataInfoEntityMoveTmp> list) throws Exception {
// TODO Auto-generated method stub
return 0;
}
@Override
public int update(DataInfoEntityMoveTmp data) throws Exception {
int result = dataInfoMoveTmpDao.update(data);
return result;
}
}

@ -0,0 +1,158 @@
package com.platform.service.thread;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import com.platform.dao.DataInfoDao;
import com.platform.dao.DataInfoMoveTmpDao;
import com.platform.dao.GatherOracleDao;
import com.platform.entities.DataInfoEntity;
import com.platform.entities.DataInfoEntityMoveTmp;
import com.platform.entities.GatherOracleInfo;
import com.platform.glusterfs.CheckoutMD5;
import com.platform.glusterfs.CopyData;
import com.platform.glusterfs.ShowData;
import com.platform.service.DataInfoService;
import com.platform.service.DataInfoServiceImp;
import com.platform.service.IMoveDataService;
import com.platform.service.impl.MoveDataServiceImpl;
import com.platform.utils.Bean2MapUtils;
import com.platform.utils.Constant;
import com.platform.utils.DateForm;
@Component
public class ThreadMoveData{
@Resource(name = "dataInfoDao")
private DataInfoDao dataInfoDao;
/**
*
*/
CopyData copy = new CopyData();
/**
* MD5
*/
CheckoutMD5 check = new CheckoutMD5();
@Resource(name = "dataInfoMoveTmpDao")
private DataInfoMoveTmpDao dataInfoMoveTmpDao;
/**
*
*/
ShowData show = new ShowData();
/**
* : --
*/
public ThreadMoveData() {
}
//5秒
@Scheduled(fixedDelay = 5000)
public void doSomething() {
try {
List<DataInfoEntityMoveTmp> result = null;
//查询 表 move_data_tmp
result = dataInfoMoveTmpDao.findAll();
if (null != result) {
//gfs 获取size
int rsize = result.size();
boolean isNoMove = true;
//该循环必须 循环每个,不能有 break;
// rate:大小:假的,待换成真实比例
double realRate = 0.00;
for (int i = 0; i < rsize; i++) {
DataInfoEntityMoveTmp dataMove = result.get(i);
//如果拷贝进度超过20分钟未进行-- 判断为 迁移失败。
// "1" :正在上传0等待 迁移, 2成功 3失败
if ("1".equals(dataMove.getCompleteStatus())) {
long nowTime = new Date().getTime();
long timelong = nowTime - DateForm.string2DateBysecond(dataMove.getLastTime()).getTime();
if (timelong > 1000*60*20) {
dataMove.setCompleteStatus("3");
dataInfoMoveTmpDao.update(dataMove);
}
isNoMove = false;
// 查询大小:。//gfs 获取size
long srcSize = show.getFolderSize(dataMove.getDataPath());
long dstSize = show.getFolderSize(dataMove.getDstPath());
if (srcSize > 0 && dstSize > 0) {
realRate = dstSize / srcSize * 100;
dataMove.setRate((int) realRate);
dataMove.setLastTime(DateForm.date2StringBysecond(new Date()));
}
}
if("1".equals(dataMove.getCompleteStatus()) &&dataMove.getRate() > 0){
//传输完毕:进行校验
if (realRate == 100) {
//TODO 进行MD5校验
int resl = check.checkoutMD5Folder(dataMove.getDataPath(), dataMove.getDstPath());
//TODO 校验成功--则删除数据库记录
if(resl == 1){
//校验成功--修改 数据库记录--
dataMove.setCompleteStatus("2");
dataMove.setLastTime(DateForm.date2StringBysecond(new Date()));
dataInfoMoveTmpDao.update(dataMove);
//TODO 新增 一条数据-到-dataInfo
DataInfoEntity data = (DataInfoEntity) Bean2MapUtils.convertMap(
DataInfoEntity.class, Bean2MapUtils.convertBean(dataMove));
data.setDataPath(dataMove.getDstPath());
data.setYear(dataMove.getYear()+" (迁移完成时间 " + DateForm.date2StringByMin(new Date())+")");
dataInfoDao.save(data);
}
else {
// 3:表示 迁移失败
dataMove.setCompleteStatus("3");
}
}
dataMove.setLastTime(DateForm.date2StringBysecond(new Date()));
dataInfoMoveTmpDao.update(dataMove);
}
}
//循环 完了, 确定没有上传的 ,没有正在上传的
if (isNoMove) {
//查询 表 move_data_tmp
result = dataInfoMoveTmpDao.findAll();
if (null != result) {
int tmpsize = result.size();
// 上传下一个后
for (int i = 0; i < tmpsize; i++) {
DataInfoEntityMoveTmp next2move = result.get(i);
//如果是 待 迁移状态的
if ("0".equals(next2move.getCompleteStatus())) {
//待迁移的数据 -- 开始迁移
copy.copyFolderFilesAnyway(next2move.getDataPath(), next2move.getDstPath(), "app");
// "1" :正在上传0等待 迁移, 2成功 3失败
next2move.setCompleteStatus("1");
next2move.setLastTime(DateForm.date2StringBysecond(new Date()));
//更新sql
dataInfoMoveTmpDao.update(next2move);
break;
}
}
}
}
}
Thread.sleep(Constant.update_dataInfo_sleep_time);
} catch (Exception e) {
System.err.println(e);
}
}
}

@ -0,0 +1,47 @@
package com.platform.service.thread;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.platform.dao.DataInfoMoveTmpDao;
import com.platform.entities.DataInfoEntityMoveTmp;
import com.platform.service.IMoveDataService;
import com.platform.service.impl.MoveDataServiceImpl;
import com.platform.utils.Constant;
public class TreadMoveData2Start extends Thread{
private IMoveDataService dataInfoMove= new MoveDataServiceImpl();
public TreadMoveData2Start() {
}
@Override
public void run() {
boolean isBreak = false;
while(true){
if (isBreak) {
break;
}
try {
List<DataInfoEntityMoveTmp> resultlist = dataInfoMove.findAll();
for (DataInfoEntityMoveTmp moveEntity : resultlist) {
if ("1".equals(moveEntity.getCompleteStatus())) {
moveEntity.setCompleteStatus("3");
dataInfoMove.update(moveEntity);
}
}
isBreak = true;
Thread.sleep(Constant.update_dataInfo_sleep_time);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}

@ -1,19 +1,39 @@
package com.platform.utils; package com.platform.utils;
import java.util.List; import java.util.List;
import java.util.Map;
import com.platform.entities.FolderNode;
import com.platform.entities.FolderNode;
public class CacheTreeData { import com.platform.entities.VolumeEntity;
private static List<FolderNode> folders = null; public class CacheTreeData {
public static List<FolderNode> getFolders() { private static List<FolderNode> folders = null;
return folders;
} private static List<VolumeEntity> volumeList = null;
public static void setFolders(List<FolderNode> folders) { public static List<FolderNode> getFolders() {
CacheTreeData.folders = folders; return folders;
} }
} public static void setFolders(List<FolderNode> folders) {
CacheTreeData.folders = folders;
}
/**
* @return the volumeList
*/
public static List<VolumeEntity> getVolumeList() {
return volumeList;
}
/**
* @param volumeList the volumeList to set
*/
public static void setVolumeList(List<VolumeEntity> volumeList) {
CacheTreeData.volumeList = volumeList;
}
}

@ -1,74 +1,76 @@
package com.platform.utils; package com.platform.utils;
import java.util.Properties; import java.util.Properties;
import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener; import javax.servlet.ServletContextListener;
public class ConfigsLoader implements ServletContextListener { import com.platform.service.thread.ThreadMoveData;
private static ConfigPropertyReader cReader = null;
public class ConfigsLoader implements ServletContextListener {
@Override private static ConfigPropertyReader cReader = null;
public void contextDestroyed(ServletContextEvent sEvent) {
// TODO Auto-generated method stub @Override
Configs.CONSOLE_LOGGER.info("系统停止.."); public void contextDestroyed(ServletContextEvent sEvent) {
} // TODO Auto-generated method stub
Configs.CONSOLE_LOGGER.info("系统停止..");
@SuppressWarnings("static-access") }
@Override
public void contextInitialized(ServletContextEvent sEvent) { @SuppressWarnings("static-access")
// TODO Auto-generated method stub @Override
Configs.CONSOLE_LOGGER.info("系统初始化.."); public void contextInitialized(ServletContextEvent sEvent) {
String contextPath = sEvent.getServletContext().getRealPath("/") // TODO Auto-generated method stub
+ "WEB-INF/config/config.properties"; Configs.CONSOLE_LOGGER.info("系统初始化..");
this.cReader = ConfigPropertyReader.Builder(contextPath); String contextPath = sEvent.getServletContext().getRealPath("/")
init(); + "WEB-INF/config/config.properties";
new ThreadVolume("").start(); this.cReader = ConfigPropertyReader.Builder(contextPath);
} init();
new ThreadVolume("").start();
public static void init() { }
Properties properties = cReader.getProperties();
public static void init() {
Configs.KUBE_MASTER_URL = properties.getProperty("kubeMasterUrl"); Properties properties = cReader.getProperties();
Configs.COLLECT_USER_NAME = properties.getProperty("collect-user-name"); Configs.KUBE_MASTER_URL = properties.getProperty("kubeMasterUrl");
Configs.COLLECT_PASSWORD = properties.getProperty("collect-password"); Configs.COLLECT_USER_NAME = properties.getProperty("collect-user-name");
Configs.COLLECT_SERVICE_NAME = properties Configs.COLLECT_PASSWORD = properties.getProperty("collect-password");
.getProperty("collect-service-name");
Configs.COLLECT_SERVICE_NAME = properties
Configs.GATHER_USER_NAME = properties.getProperty("gather-user-name"); .getProperty("collect-service-name");
Configs.GATHER_USER_PASSWORD = properties Configs.GATHER_USER_NAME = properties.getProperty("gather-user-name");
.getProperty("gather-user-password");
Configs.GATHER_USER_PASSWORD = properties
Configs.GATHER_PORT = properties.getProperty("gather-port"); .getProperty("gather-user-password");
Configs.GATHER_SERVICE_NAME = properties Configs.GATHER_PORT = properties.getProperty("gather-port");
.getProperty("gather-service-name");
Configs.GATHER_SERVICE_NAME = properties
Configs.TABLE_SUFFIX = properties.getProperty("table-suffix"); .getProperty("gather-service-name");
Configs.EXTRACT_LOG_LOCALTION = properties Configs.TABLE_SUFFIX = properties.getProperty("table-suffix");
.getProperty("extract-log-localtion");
Configs.EXTRACT_LOG_LOCALTION = properties
Configs.GATHER_TABLESPACE_NAME = properties .getProperty("extract-log-localtion");
.getProperty("gather-tablespace-name");
Configs.GATHER_TABLESPACE_NAME = properties
Configs.GATHER_TABLESPACE_PATH = properties .getProperty("gather-tablespace-name");
.getProperty("gather-tablespace-path");
Configs.GATHER_TABLESPACE_PATH = properties
Configs.GATHER_TABLE_PASSWORD=properties.getProperty("gather-table-user-password"); .getProperty("gather-tablespace-path");
}
Configs.GATHER_TABLE_PASSWORD=properties.getProperty("gather-table-user-password");
public ConfigPropertyReader getcReader() { }
return cReader;
} public ConfigPropertyReader getcReader() {
return cReader;
@SuppressWarnings("static-access") }
public void setcReader(ConfigPropertyReader cReader) {
this.cReader = cReader; @SuppressWarnings("static-access")
} public void setcReader(ConfigPropertyReader cReader) {
this.cReader = cReader;
} }
}

@ -1,32 +1,45 @@
package com.platform.utils;
package com.platform.utils;
public class Constant {
public static String rootUser = "root"; public class Constant {
public static String rootPasswd = "root"; public static String rootUser = "root";
public static String hostIp = "192.168.0.110"; public static String rootPasswd = "root";
// public static String hostIp = "192.168.1.105"; public static String hostIp = "192.168.0.116";
public static int port = 22; // public static String hostIp = "192.168.1.105";
public static String glusterPeerStatus = "gluster peer status"; public static int port = 22;
public static String glusterVolumeInfo = "gluster volume info "; public static String glusterPeerStatus = "gluster peer status";
public static String df = "df -k "; public static String glusterVolumeInfo = "gluster volume info ";
public static String peerincluster_connected="PeerinCluster(Connected)"; public static String df = "df -k ";
public static String peerincluster_disconnected="PeerinCluster(Disconnected)"; public static String peerincluster_connected = "PeerinCluster(Connected)";
public static String distributed="distributed"; public static String peerincluster_disconnected = "PeerinCluster(Disconnected)";
public static String replica="replica"; public static String peerNotinCluster = "PeerNotinCluster";
public static String stripe="stripe"; public static String distributed = "distributed";
public static String noVolume="No volumes present"; public static String replica = "replica";
public static GanymedSSH ganymedSSH=new GanymedSSH(hostIp, rootUser, rootPasswd, port); public static String stripe = "stripe";
public static String fileGetTreeData="./WEB-INF/config/getTreedata.sh"; public static String noVolume = "No volumes present";
public static String success = "success";
/** public static String failed = "failed";
* volume 线 public static String noSuchFile = "No such file or directory";
*/ public static GanymedSSH ganymedSSH = new GanymedSSH(hostIp, rootUser, rootPasswd, port);
public final static int get_volume_sleep_time = 300000; public static String fileGetTreeData = "WebContent\\WEB-INF\\config\\getTreedata.sh";
public static String strGetTreeData = "function ergodic(){\n "
/** + "for file in \\`ls \\$1\\`\n do\n if [ \"\\$file\" != \"app\" -a -d \\$1\\\"/\\\"\\$file ]\n "
* volume 线 + "then\n ergodic \\$1\"/\"\\$file\n else\n local path=\\$1\"/\"\\$file\n "
*/ + "echo \\$path \n fi\n done\n}\n\nIFS=\\$\\'\\n\\' "
public final static int update_dataInfo_sleep_time = 3000; + "#这个必须要,否则会在文件名中有空格时出错\nINIT_PATH=\".\";\nergodic \\$1\n";
}
/**
* volume 线
*/
public final static int get_volume_sleep_time = 300000;
/**
* volume 线
*/
public final static int update_dataInfo_sleep_time = 3000;
}

@ -0,0 +1,137 @@
package com.platform.utils;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateForm {
private static final String date_format_second = "yyyy-MM-dd HH:mm:ss";
private static final String date_format_second_non = "yyyy-MM-dd_HH-mm-ss";
private static final String data_format_min = "yyyy-MM-dd HH:mm";
private static final String data_format_day = "yyyy-MM-dd";
private static ThreadLocal<DateFormat> threadLocal_second = new ThreadLocal<DateFormat>();
private static ThreadLocal<DateFormat> threadLocal_second_non = new ThreadLocal<DateFormat>();
private static ThreadLocal<DateFormat> threadLocal_min = new ThreadLocal<DateFormat>();
private static ThreadLocal<DateFormat> threadLocal_day = new ThreadLocal<DateFormat>();
public static String date2StringBysecond(Date date) {
if (date == null) {
return null;
}
DateFormat format = threadLocal_second.get();
if(format == null){
format = new SimpleDateFormat(date_format_second);
threadLocal_second.set(format);
}
return format.format(date);
}
public static String date2StringBysecondNon(Date date) {
if (date == null) {
return null;
}
DateFormat format = threadLocal_second_non.get();
if(format == null){
format = new SimpleDateFormat(date_format_second_non);
threadLocal_second_non.set(format);
}
return format.format(date);
}
public static String date2StringByMin(Date date) {
if (date == null) {
return null;
}
DateFormat format = threadLocal_min.get();
if(format == null){
format = new SimpleDateFormat(data_format_min);
threadLocal_min.set(format);
}
return format.format(date);
}
public static String date2StringByDay(Date date) {
if (date == null) {
return null;
}
DateFormat format = threadLocal_day.get();
if(format == null){
format = new SimpleDateFormat(data_format_day);
threadLocal_day.set(format);
}
return format.format(date);
}
public static Date string2DateBysecond(String date) {
if (date == null) {
return null;
}
date = date.trim();
if (date.isEmpty()) {
return null;
}
DateFormat format = threadLocal_second.get();
try {
if(format == null){
format = new SimpleDateFormat(date_format_second);
threadLocal_second.set(format);
}
return format.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
public static Date string2DateByMin(String date) {
if (date == null) {
return null;
}
date = date.trim();
if (date.isEmpty()) {
return null;
}
DateFormat format = threadLocal_min.get();
try {
if(format == null){
format = new SimpleDateFormat(data_format_min);
threadLocal_min.set(format);
}
return format.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
public static Date string2DateByDay(String date) {
if (date == null) {
return null;
}
date = date.trim();
if (date.isEmpty()) {
return null;
}
DateFormat format = threadLocal_day.get();
try {
if(format == null){
format = new SimpleDateFormat(data_format_day);
threadLocal_day.set(format);
}
return format.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
}

@ -7,6 +7,8 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import org.junit.Test;
/** /**
* *
* *
@ -65,14 +67,18 @@ public class FileOperateHelper {
* @param path * @param path
* @return * @return
*/ */
@SuppressWarnings("resource") @SuppressWarnings("resource")
public static String fileReaderAndendline(String path) { public static String fileReaderAndendline(String path) {
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
String tempString = ""; String tempString = "";
try { try {
File file = new File(path); File file = new File(path);
if (!file.exists()) if (!file.exists())
return ""; return "";
FileInputStream fis = new FileInputStream(file); FileInputStream fis = new FileInputStream(file);
BufferedReader br = new BufferedReader(new InputStreamReader(fis)); BufferedReader br = new BufferedReader(new InputStreamReader(fis));
while ((tempString = br.readLine()) != null) { while ((tempString = br.readLine()) != null) {
@ -83,4 +89,7 @@ public class FileOperateHelper {
} }
return sb.toString(); return sb.toString();
} }
} }

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save