合并-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>
</buildCommand>
<buildCommand>
<name>com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<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
encoding//WebContent/WEB-INF/config/config.properties=UTF-8
<<<<<<< HEAD
encoding//src/com/platform/controller/DataModelController.java=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
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.methodParameters=do not generate
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.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.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.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

@ -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"?>
<faceted-project>
<runtime name="Apache Tomcat v7.0"/>
<runtime name="MyEclipse Tomcat v7.0"/>
<fixed facet="java"/>
<fixed facet="wst.jsdt.web"/>
<fixed facet="jst.web"/>
<installed facet="java" version="1.7"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="jpt.jpa" version="2.1"/>
</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">
<param name="Threshold" value="info"></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>
<layout class="org.apache.log4j.PatternLayout">
<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">
<param name="File" value="d:/logs/railyFile.log"></param>
<param name="File" value="logs/railyFile.log"></param>
<param name="ImmediateFlush" value="true" />
<param name="Threshold" value="info"></param>
<param name="Append" value="true"></param>

@ -8,9 +8,11 @@
<typeAlias alias="DataInfoEntity" type="com.platform.entities.DataInfoEntity" />
<typeAlias alias="PagerOptions" type="com.platform.entities.PagerOptions"/>
<typeAlias alias="GatherOracleInfo" type="com.platform.entities.GatherOracleInfo"/>
<typeAlias alias="DataInfoEntityMoveTmp" type="com.platform.entities.DataInfoEntityMoveTmp"/>
</typeAliases>
<mappers>
<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>
</configuration>

@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<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:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
@ -12,7 +15,12 @@
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
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中的属性值 -->
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
@ -78,4 +86,8 @@
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</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>

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

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

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

@ -79,6 +79,7 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
</otherwise>
</choose>
</where>
ORDER BY data_details.id
<if test="PagerOptions.limit > 0">
LIMIT #{PagerOptions.limit}
@ -101,8 +102,107 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
<!-- 获取数据查询的起始di -->
<select id="getLimitedBeginId" resultType="java.lang.Integer"
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
</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>

@ -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" />
<result property="rate" column="rate" javaType="int"
jdbcType="INTEGER" />
<result property="lastTime" column="lasttime"
javaType="string" jdbcType="VARCHAR" />
</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
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,
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.id id,a.regionalism_code regionalismCode,b.city_name cityName,b.district_name districtName,
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
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>
<update id="update" parameterType="com.platform.entities.DataInfoEntityMoveTmp">
@ -58,19 +68,18 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
move_data_tmp
<set >
<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 != ''">
dst_path= #{dstPath},
</if>
<if test="completeStatus != null and completeStatus != ''">
complete_status= #{completeStatus},
</if>
rate= #{rate}
<if test="rate > 0">
rate= #{rate},
</if>
<if test="lastTime != null and lastTime != ''">
lasttime= #{lastTime},
</if>
</trim>
</set>
<where>
@ -78,7 +87,7 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
</where>
</update>
<insert id="save" parameterType="">
<insert id="save" parameterType="com.platform.entities.DataInfoEntityMoveTmp">
INSERT INTO
move_data_tmp(
<trim suffixOverrides=",">
@ -88,7 +97,7 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
<if test="regionalismCode != null and regionalismCode != ''">
regionalism_code,
</if>
<if test="systemCode != null and systemCode != ''">
<if test="systemCode != null">
system_code,
</if>
<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 != ''">
complete_status,
</if>
rate
<if test="rate > 0">
rate,
</if>
<if test="lastTime != null and lastTime != ''">
lasttime,
</if>
</trim>
)
VALUES(
@ -117,19 +131,32 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
<if test="completeStatus != null and completeStatus != ''">
#{completeStatus},
</if>
#{rate}
<if test="rate > 0">
#{rate}
</if>
<if test="lastTime != null and lastTime != ''">
#{lastTime},
</if>
</trim>
)
</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
move_data_tmp
WHERE
id = #{id}
</delete>
<!-- 获取数据符合筛选条件的总记录条数 -->
<!-- 获取数据符合筛选条件的总记录条数 -->
<!--
<select id="getLimitedDataCount" resultType="java.lang.Integer"
parameterType="PagerOptions">
SELECT COUNT(id) FROM move_data_tmp
@ -141,11 +168,11 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
</select>
<!-- 获取数据查询的起始di -->
获取数据查询的起始di
<select id="getLimitedBeginId" resultType="java.lang.Integer"
parameterType="PagerOptions">
SELECT MAX(idx) FROM (SELECT id idx FROM move_data_tmp
ORDER BY id LIMIT 0,#{PagerOptions.totalLimit}) AS TEMP
</select>
</select> -->
</mapper>

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

@ -1,6 +1,7 @@
package com.platform.controller;
import java.util.Date;
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.RequestMethod;
import com.base.BaseController;
import com.base.CustomException;
import com.platform.entities.GfsFolderEntity;
import com.platform.entities.VolumeEntity;
import com.platform.glusterfs.VolumeInfo;
import com.platform.entities.VolumeEntity;
import com.platform.glusterfs.VolumeInfo;
import com.platform.service.IGfsService;
@ -30,13 +39,19 @@ import com.platform.service.IGfsService;
* @since [/]
*/
@Controller
@RequestMapping("")
public class FolderController extends BaseController {
@Resource(name = "gfsService")
private IGfsService gfsService;
@RequestMapping(value="/getAllSubPathByPath", method= RequestMethod.POST)
public Object getAllSubPathByPath(String path) throws Exception {
System.out.println(path);
Object result = null;
@ -47,6 +62,22 @@ public class FolderController extends BaseController {
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 及其 信息
// * <功能详细描述>
@ -77,6 +108,7 @@ public class FolderController extends BaseController {
public Object getVolumByName(String volumeName) throws Exception{
VolumeEntity result = gfsService.getOneVolume(volumeName);
return result;
}
}

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

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

@ -3,10 +3,12 @@ package com.platform.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.platform.entities.DataInfoEntity;
import com.platform.entities.PagerOptions;
@Repository(value = "dataInfoDao")
public interface DataInfoDao {
int getLimitedDataCount(@Param("PagerOptions")PagerOptions pagerOptions);
@ -15,6 +17,10 @@ public interface DataInfoDao {
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 remove(DataInfoEntityMoveTmp data) throws Exception;
void insertBatch(List<DataInfoEntityMoveTmp> list) throws Exception;
int remove(int id) throws Exception;
}

@ -1,93 +1,110 @@
/**
* : Brick.java
* : </>
* : <>
* @author chen
* : <>
* 201699
* <>
*/
package com.platform.entities;
/**
* <> volume
* <>
* @author chen
* @version [201699]
* @see [/]
* @since [/]
*/
public class Brick {
/** volume总大小 */
private double availableSize;
/** volume已使用大小 */
private double usedSize;
/** ip */
private String ip;
/** 路径 */
private String path;
/**
* @return the availableSize
*/
public double getAvailableSize() {
return availableSize;
}
/**
* @param availableSize the availableSize to set
*/
public void setAvailableSize(double availableSize) {
this.availableSize = availableSize;
}
/**
* @return the usedSize
*/
public double getUsedSize() {
return usedSize;
}
/**
* @param usedSize the usedSize to set
*/
public void setUsedSize(double usedSize) {
this.usedSize = usedSize;
}
/**
* @return the ip
*/
public String getIp() {
return ip;
}
/**
* @param ip the ip to set
*/
public void setIp(String ip) {
this.ip = ip;
}
/**
* @return the path
*/
public String getPath() {
return path;
}
/**
* @param path the path to set
*/
public void setPath(String path) {
this.path = path;
}
}
/**
* : Brick.java
* : </>
* : <>
* @author chen
* : <>
* 201699
* <>
*/
package com.platform.entities;
/**
* <> volume
* <>
* @author chen
* @version [201699]
* @see [/]
* @since [/]
*/
public class Brick {
/** volume总大小 */
private double availableSize;
/** volume已使用大小 */
private double usedSize;
/** ip */
private String ip;
/** 路径 */
private String path;
/**
* true false
*/
private boolean status;
/**
* @return the availableSize
*/
public double getAvailableSize() {
return availableSize;
}
/**
* @param availableSize the availableSize to set
*/
public void setAvailableSize(double availableSize) {
this.availableSize = availableSize;
}
/**
* @return the usedSize
*/
public double getUsedSize() {
return usedSize;
}
/**
* @param usedSize the usedSize to set
*/
public void setUsedSize(double usedSize) {
this.usedSize = usedSize;
}
/**
* @return the ip
*/
public String getIp() {
return ip;
}
/**
* @param ip the ip to set
*/
public void setIp(String ip) {
this.ip = ip;
}
/**
* @return the path
*/
public String getPath() {
return 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 int rate;
private String lastTime; // 采集时间
public DataInfoEntityMoveTmp() {
// TODO Auto-generated constructor stub
}
/**
* @return the dstPath
@ -49,6 +55,19 @@ public class DataInfoEntityMoveTmp extends DataInfoEntity {
public void setRate(int 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;
import java.util.ArrayList;
import java.util.List;
public class FolderNode {
private String name;
private int isFolder; // 1 is file and other integer is folder show children number
private String path;
private List<FolderNode> childNodes;
private List<FolderNode> childNodes = new ArrayList<FolderNode>();
public FolderNode() {
// TODO Auto-generated constructor stub
}
public FolderNode(String name) {
this.name = name;

@ -37,7 +37,7 @@ public class VolumeEntity {
private String path;
/** volume树形目录 */
private FolderNode folder;
private List<FolderNode> folder = new ArrayList<FolderNode>();
/** volume的 块 */
private List<Brick> brick = new ArrayList<Brick>();
@ -101,14 +101,14 @@ public class VolumeEntity {
/**
* @return the folder
*/
public FolderNode getFolder() {
public List<FolderNode> getFolder() {
return folder;
}
/**
* @param folder the folder to set
*/
public void setFolder(FolderNode folder) {
public void setFolder(List<FolderNode> 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;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import com.platform.utils.Constant;
/**
*
* nullmapipip
* ipPeerinCluster(Connected)
* ipPeerinCluster(Disconnected)
* @author liliy
* @version [2016912]
* @see [/]
* @since [/]
*/
public class ClusterInfo {
public static Logger log = Logger.getLogger(ClusterInfo.class);
public Map<String, String> showClusterInfo() {
log.info("get cluster info");
Map<String, String> peerIps = new HashMap<String, String>();
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd, Constant.port, Constant.glusterPeerStatus);
if (reStrings == null) {
log.error("1101 command get result is null");
return null;
}
if (reStrings.size() == 0) {
log.error("1102 command get result is nothing");
return null;
}
if (!(reStrings.get(0).split(":")[0].contains("Number of Peers"))) {
log.error("1103 get result string wrong");
return null;
}
// System.out.print(reStrings.get(0));
int flag = 0;
String ipString = "";
String state = "";
for (Iterator it2 = reStrings.iterator(); it2.hasNext();) {
String line = (String) it2.next();
line=line.replaceAll(" +", " ");
String keyValue[] = line.split(":");
if (keyValue[0].equals("Hostname")) {
if (keyValue.length < 2) {
log.error("1105 command get result is wrong");
continue;
}
ipString = keyValue[1].replaceAll(" ", "");
flag = 1;
} else if (flag == 1 && keyValue[0].equals("State")) {
if (keyValue.length < 2) {
log.error("1106 command get result is wrong");
continue;
}
state = keyValue[1].replaceAll(" ", "");
flag = 0;
peerIps.put(ipString, state);
}
}
return peerIps;
}
/**
* ipip
* ipnull
* ipPeerinCluster(Connected)
* ipPeerinCluster(Disconnected)
* @param peerip
* @return
* @see [##]
*/
public String getPeerStatus(String peerip){
Map<String, String> peerIps=showClusterInfo();
if(peerIps==null || peerIps.size()==0){
return null;
}
if(!peerIps.containsKey(peerip)){
return Constant.peerincluster_disconnected;
}
return peerIps.get(peerip);
}
public static void main(String[] args) {
PropertyConfigurator.configure("log4j.properties");
System.out.println(new ClusterInfo().showClusterInfo());
}
}
package com.platform.glusterfs;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import com.platform.utils.Constant;
/**
*
* @author liliy
* @version [2016912]
* @see [/]
* @since [/]
*/
public class ClusterInfo {
public static Logger log = Logger.getLogger(ClusterInfo.class);
/**
*
* nullmapipip
* ipPeerinCluster(Connected)
* ipPeerinCluster(Disconnected)
* @return
* @see [##]
*/
public Map<String, String> showClusterInfo() {
log.info("get cluster info");
Map<String, String> peerIps = new HashMap<String, String>();
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(Constant.glusterPeerStatus);
if (reStrings == null) {
log.error("1101 command get result is null");
return null;
}
if (reStrings.size() == 0) {
log.error("1102 command get result is nothing");
return null;
}
if (!(reStrings.get(0).split(":")[0].contains("Number of Peers"))) {
log.error("1103 get result string wrong");
return null;
}
// System.out.print(reStrings.get(0));
int flag = 0;
String ipString = "";
String state = "";
for (Iterator it2 = reStrings.iterator(); it2.hasNext();) {
String line = (String) it2.next();
line=line.replaceAll(" +", " ");
String keyValue[] = line.split(":");
if (keyValue[0].equals("Hostname")) {
if (keyValue.length < 2) {
log.error("1105 command get result is wrong");
continue;
}
ipString = keyValue[1].replaceAll(" ", "");
flag = 1;
} else if (flag == 1 && keyValue[0].equals("State")) {
if (keyValue.length < 2) {
log.error("1106 command get result is wrong");
continue;
}
state = keyValue[1].replaceAll(" ", "");
flag = 0;
peerIps.put(ipString, state);
}
}
return peerIps;
}
/**
* ipip
* ipnull
* ipPeerinCluster(Connected)
* ipPeerinCluster(Disconnected)
* @param peerip
* @return
* @see [##]
*/
public String getPeerStatus(String peerip){
Map<String, String> peerIps=showClusterInfo();
if(peerIps==null || peerIps.size()==0){
return null;
}
if(peerip.equals(Constant.hostIp)){
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;
import java.util.List;
@ -32,7 +33,7 @@ public class CopyData {
String sourceFolderName = sourceVolumeName;
String destFolderName = destVolumeName;
status = copyFolderFiles(sourceFolderName, destFolderName, fileName);
status = copyFolderFilesAnyway(sourceFolderName, destFolderName, fileName);
return status;
}
@ -54,7 +55,7 @@ public class CopyData {
return -3;
}
reStrings=showData.showFolderData(sourceFolderName+"/"+fileName);
reStrings=showData.showFolderData(sourceFolderName+"/"+fileName);
if(reStrings==null){
log.info("3202 "+sourceFolderName+"/"+fileName+" is not exists");
return -2;
@ -71,10 +72,40 @@ public class CopyData {
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
public void testcreateFolders() {
createFolders("/aaa/vvv/ddd/www/rrrr");
}
//@Test
public void testCopyFolderFiles() {
PropertyConfigurator.configure("log4j.properties");
copyFolderFiles("/home", "/home/ubuntu", "system_data");
}
}

@ -1,120 +1,125 @@
package com.platform.glusterfs;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import com.platform.entities.FolderNode;
import com.platform.utils.Constant;
import com.platform.utils.FileOperateHelper;
/**
* <> GFS
* <>
* @author chen
* @version [201698]
* @see [/]
* @since [/]
*/
public class GetTreeData {
ShowData showData = new ShowData();
/**
* <>
* <>
* @param name
* @return
* @see [##]
*/
public FolderNode getDatas(String name) {
String names[]=name.split("/");
String only_name=names[names.length-1];
FolderNode fileNode = new FolderNode(only_name);
fileNode.setPath(name);
Map<String, String> files = showData.showFolderData(name);
if(files==null || files.size()==0){
return fileNode;
}
fileNode.setIsFolder(files.size());
List<FolderNode> list = new ArrayList<FolderNode>();
fileNode.setChildNodes(list);
for (Map.Entry<String, String> entry : files.entrySet()) {
if(entry.getKey().equals("app")){
continue;
}
int number = Integer.parseInt(entry.getValue());
if (number == 1) {
fileNode.getChildNodes().add(new FolderNode(entry.getKey(), number));
}
if (number > 1) {
FolderNode temp=getDatas(name+"/"+entry.getKey());
fileNode.getChildNodes().add(temp);
}
}
return fileNode;
}
/**
* <>
* <>
* @param name
* @return
* @see [##]
*/
public FolderNode getDatasWithShell(String name) {
if(name.endsWith("/")){
name=name.substring(0, name.length());
}
String names[]=name.split("/");
String only_name=names[names.length-1];
FolderNode fileNode = new FolderNode(name);
fileNode.setPath(name);
String shellComment=new FileOperateHelper().fileReaderAndendline(Constant.fileGetTreeData);
String sh_path="/getTreedata.sh";
String cmd="echo -e "+shellComment+" > "+sh_path+" & chmod +x "+sh_path;
Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
// Map<String, String> files = showData.showFolderData(name);
List<String> files=Constant.ganymedSSH.execCmdWaitAcquiescent(sh_path+" "+name);
if(files==null){
return null;
}
if(files.size()==0){
return fileNode;
}
for(String file:files){
}
return fileNode;
}
@Test
public void test_getTreeData() {
GetTreeData getTreeData=new GetTreeData();
FolderNode fileOrFolder=getTreeData.getDatas("/home");
System.out.println(fileOrFolder);
}
}
/*
class FileOrFolder {
String name;
int isFolder; // 1 is file and other integer is folder show children number
List<FileOrFolder> children;
public FileOrFolder(String name) {
// TODO Auto-generated constructor stub
this.name = name;
}
public FileOrFolder(String name, int isFolder) {
// TODO Auto-generated constructor stub
this.name = name;
this.isFolder = isFolder;
}
}
*/
package com.platform.glusterfs;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.junit.Test;
import com.platform.entities.FolderNode;
import com.platform.utils.Constant;
import com.platform.utils.FileOperateHelper;
import com.platform.utils.GanymedSSH;
/**
* <> GFS
* <>
* @author chen
* @version [201698]
* @see [/]
* @since [/]
*/
public class GetTreeData {
ShowData showData = new ShowData();
/**
* <>
* <>
* @param name
* @return
* @see [##]
*/
public FolderNode getDatas(String name) {
String names[]=name.split("/");
String only_name=names[names.length-1];
FolderNode fileNode = new FolderNode(only_name);
fileNode.setPath(name);
Map<String, String> files = showData.showFolderData(name);
if(files==null || files.size()==0){
return fileNode;
}
fileNode.setIsFolder(files.size());
List<FolderNode> list = new ArrayList<FolderNode>();
fileNode.setChildNodes(list);
for (Map.Entry<String, String> entry : files.entrySet()) {
if(entry.getKey().equals("app")){
continue;
}
int number = Integer.parseInt(entry.getValue());
if (number == 1) {
fileNode.getChildNodes().add(new FolderNode(entry.getKey(), number));
}
if (number > 1) {
FolderNode temp=getDatas(name+"/"+entry.getKey());
fileNode.getChildNodes().add(temp);
}
}
return fileNode;
}
/**
* <>
* <>
* @param name
* @return
* @see [##]
*/
public FolderNode getDatasWithShell(String name) {
if(name.endsWith("/")){
name=name.substring(0, name.length()-1);
}
// String names[]=name.split("/");
// String only_name=names[names.length-1];
FolderNode fileNode = new FolderNode(name);
fileNode.setPath(name);
// String shellComment= new FileOperateHelper().fileReaderAndendline(Constant.fileGetTreeData);
String shellComment= Constant.strGetTreeData;
String sh_path="/getTreedata.sh";
String cmd="echo -e \""+shellComment+"\" > "+sh_path+" & chmod +x "+sh_path;
Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
// Map<String, String> files = showData.showFolderData(name);
List<String> files=Constant.ganymedSSH.execCmdWaitAcquiescent(sh_path+" "+name);
if(files==null){
return null;
}
if(files.size()==0){
return fileNode;
}
for(String file:files){
}
return fileNode;
}
@Test
public void test_getTreeData() {
GetTreeData getTreeData=new GetTreeData();
// FolderNode fileOrFolder=getTreeData.getDatas("/home/gfs_ftp_point");
FolderNode fileOrFolder=getTreeData.getDatasWithShell("/home/gfs_ftp_point/");
System.out.println(fileOrFolder);
}
}
/*
class FileOrFolder {
String name;
int isFolder; // 1 is file and other integer is folder show children number
List<FileOrFolder> children;
public FileOrFolder(String name) {
// TODO Auto-generated constructor stub
this.name = name;
}
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 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
@ -34,65 +24,33 @@ public class RemoveData {
* @param fileName
* @return
*/
public int deleteFolderFiles(String folderName,String fileName){
log.info("start delete "+folderName+"/"+fileName);
public int deleteFolder(String folderName){
log.info("start delete "+folderName);
ShowData showData=new ShowData();
Map<String,String> reStrings=showData.showFolderData(folderName+"/"+fileName);
Map<String,String> reStrings=showData.showFolderData(folderName);
if(reStrings==null){
log.error("3301 "+folderName+"/"+fileName+" is not exists");
log.error("3301 "+folderName+" is not exists");
return -1;
}
String command="rm -r "+folderName+"/"+fileName;
String command="rm -r "+folderName;
// int status=runCommand.runCommand(command);
Constant.ganymedSSH.execCmdNoWaitAcquiescent(command);
log.info("delete "+folderName+" "+fileName+" running");
log.info("delete "+folderName+" running");
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
public void testDeleteFolderFiles() {
PropertyConfigurator.configure("log4j.properties");
deleteFolderFiles("/home/ubuntu","system_data");
deleteFolder("/home/ubuntu");
}
}

@ -1,11 +1,67 @@
package com.platform.glusterfs;
import org.apache.log4j.Logger;
public class SetCluster {
public static Logger log = Logger.getLogger ( SetCluster.class);
public int addPeer(String peerip){
return 0;
}
}
package com.platform.glusterfs;
import java.util.List;
import org.apache.log4j.Logger;
import org.hamcrest.core.Is;
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;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.junit.Test;
import com.platform.utils.Constant;
public class ShowData {
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
* <>
* @param volumeName
* @return
* @see [##]
*/
public Map<String,String> showVolumeFiles(String volumeName){
log.info("start show the data");
Map<String,String> data_type=new HashMap<String, String>();
/**
* get mount point of volumeName
*/
String folderName=volumeName;
data_type=showFolderData(volumeName);
return data_type;
}
/**
* get the data of folder name
* Map<String,String> is folder name and type 1 is file and others is folder
* @param FolderName
* @return
*/
public Map<String,String> showFolderData(String folderName){
log.info(" start get "+folderName+" data");
Map<String,String> data_type=new HashMap<String, String>();
String command="ls -l "+folderName;
/*
RunCommand runCommand=new RunCommand();
List<String> reStrings=runCommand.runCommandWait(command);
*/
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd, Constant.port, command);
if(reStrings==null){
log.error("2101 command get result is null");
return null;
}
if(reStrings.size()==0){
log.info("2102 the folder is empty");
return data_type;
}
if(reStrings.get(0).contains("No such file or directory")){
log.info("2103 the "+folderName+" is not exists");
return null;
}
/**
* remove first line total number
*/
reStrings.remove(0);
for(Iterator it2 = reStrings.iterator();it2.hasNext();){
String line=(String)it2.next();
line=line.replaceAll(" +", " ");
String keyValue[]=line.split(" ");
if(keyValue.length<9){
log.error("2104 "+line+" length is short");
continue;
}
data_type.put(keyValue[8], keyValue[1]);
}
log.info(" get "+folderName+" data successed");
return data_type;
}
/**
*
* <>
* <>
* @see [##]
*/
@Test
public void testShowData(){
System.out.println(showFolderData("/home"));
}
package com.platform.glusterfs;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.junit.Test;
import com.platform.utils.Constant;
public class ShowData {
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
* <>
* @param volumeName
* @return
* @see [##]
*/
public Map<String,String> showVolumeFiles(String volumeName){
log.info("start show the data");
Map<String,String> data_type=new HashMap<String, String>();
/**
* get mount point of volumeName
*/
String folderName=volumeName;
data_type=showFolderData(volumeName);
return data_type;
}
/**
* get the data of folder name
* Map<String,String> is folder name and type 1 is file and others is folder
* @param FolderName
* @return
*/
public Map<String,String> showFolderData(String folderName){
log.info(" start get "+folderName+" data");
Map<String,String> data_type=new HashMap<String, String>();
String command="ls -l "+folderName;
/*
RunCommand runCommand=new RunCommand();
List<String> reStrings=runCommand.runCommandWait(command);
*/
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd, Constant.port, command);
if(reStrings==null){
log.error("2101 command get result is null");
return null;
}
if(reStrings.size()==0){
log.info("2102 the folder is empty");
return data_type;
}
if(reStrings.get(0).contains("No such file or directory")){
log.info("2103 the "+folderName+" is not exists");
return null;
}
/**
* remove first line total number
*/
reStrings.remove(0);
for(Iterator it2 = reStrings.iterator();it2.hasNext();){
String line=(String)it2.next();
line=line.replaceAll(" +", " ");
String keyValue[]=line.split(" ");
if(keyValue.length<9){
log.error("2104 "+line+" length is short");
continue;
}
data_type.put(keyValue[8], keyValue[1]);
}
log.info(" get "+folderName+" data successed");
return data_type;
}
/**
* folder
* -2-1folderfolder
* @param folderPath
* @return
* @see [##]
*/
public long getFolderSize(String folderPath) {
log.info("get " + folderPath + " Size ");
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;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.junit.Test;
import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper;
import com.platform.utils.Constant;
import com.platform.utils.GanymedSSH;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class VolumeInfo {
public static Logger log = Logger.getLogger(VolumeInfo.class);
/**
* volume
* <>
* @return
* @see [##]
*/
public List<String> showAllVolumeName() {
log.info("get volume name");
List<String> volNames = new ArrayList<String>();
/*
* String command = "echo \"" + Constant.rootPasswd +
* "\" |sudo -S gluster volume info|grep ^Volume.Name"; RunCommand
* runCommand = new RunCommand(); List<String> reStrings =
* runCommand.runCommandWait(command);
*/
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser,
Constant.rootPasswd, Constant.port, Constant.glusterVolumeInfo + "|grep ^Volume.Name");
// System.out.println(reStrings);
if (reStrings == null) {
log.error("1401 get result is null");
return null;
}
if (reStrings.size() == 0) {
log.error("1402 get result is nothing");
return null;
}
if (reStrings.get(0).contains(Constant.noVolume)) {
reStrings.clear();
return reStrings;
}
if (!(reStrings.get(0).split(":")[0].contains("Volume Name"))) {
log.error("1403 get result string wrong");
return null;
}
String nameInfo = "";
for (Iterator it = reStrings.iterator(); it.hasNext();) {
String line = (String) it.next();
String str[] = line.split(":");
volNames.add(str[1].replaceAll(" ", ""));
}
return volNames;
}
/**
* volumevolume
* <>
* @param volumeName
* @return
* @see [##]
*/
public String getVolumeType(String volumeName) {
log.info("get volume type");
String volType = "";
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser,
Constant.rootPasswd, Constant.port, Constant.glusterVolumeInfo + volumeName + "|grep ^Type");
// System.out.println(reStrings);
if (reStrings == null) {
log.error("1501 get result is null");
return null;
}
if (reStrings.size() == 0) {
log.error("1502 get result is nothing");
return null;
}
if (!(reStrings.get(0).split(":")[0].contains("Type"))) {
log.error("1503 get result string wrong");
return null;
}
// System.out.println(reStrings);
for (Iterator it = reStrings.iterator(); it.hasNext();) {
String line = (String) it.next();
String str[] = line.split(":");
volType = str[1];
}
volType = volType.replaceAll(" ", "");
return volType;
}
public String getVolumeStatus(String volumeName) {
log.info("get volume status");
String volStatus = "";
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser,
Constant.rootPasswd, Constant.port, Constant.glusterVolumeInfo + "|grep ^Status");
// System.out.println(reStrings);
if (reStrings == null) {
log.error("1701 get result is null");
return null;
}
if (reStrings.size() == 0) {
log.error("1702 get result is nothing");
return null;
}
if (!(reStrings.get(0).split(":")[0].contains("Status"))) {
log.error("1703 get result string wrong");
return null;
}
for (Iterator it = reStrings.iterator(); it.hasNext();) {
String line = (String) it.next();
String str[] = line.split(":");
volStatus = str[1].replaceAll(" ", "");
}
return volStatus;
}
public Double getVolumeAllSize(String volumeName) {
log.info("get volume allSize");
Double allSize = null;
/*
* ======= // waiting for testing... public Double
* getVolumeAllSize(String volumeName) { log.info("get volume allSize");
* Double allSize = null;
*
* >>>>>>> origin/AlexKie String command = "echo \"" +
* Constant.rootPasswd + "\" |sudo -S df -h|grep " + volumeName +
* "|awk '{print $2}'"; RunCommand runCommand = new RunCommand();
* List<String> reStrings = runCommand.runCommandWait(command); <<<<<<<
* HEAD
*/
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $2}'");
// System.out.println(reStrings);
if(reStrings==null){
log.error("1801 get result is null");
return null;
}
if(reStrings.size()==0){
log.error("1802 get result is nothing");
return null;
}
char flag = reStrings.get(0).trim().toCharArray()[0];
if (flag < 48 || flag > 57) {
log.error("1803 get result string wrong");
return null;
}
for (Iterator it = reStrings.iterator(); it.hasNext();) {
String line = (String) it.next();
String str[] = line.split("[^0-9]");
allSize = Double.parseDouble(str[0]);
}
return allSize;
}
public Double getVolumeUseSize(String volumeName) {
log.info("get volume used size");
Double usedSize = null;
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser,
Constant.rootPasswd, Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $3}'");
// 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;
}
char flag = reStrings.get(0).trim().toCharArray()[0];
if (flag < 48 || flag > 57) {
log.error("1903 get result string wrong");
return null;
}
for (Iterator it = reStrings.iterator(); it.hasNext();) {
String line = (String) it.next();
String str[] = line.split("[^0-9]");
usedSize = Double.parseDouble(str[0]);
}
return usedSize;
}
/**
* @param volumeName
* @return String ipAndpath[] = brick.split(":");
String ip = ipAndpath[0];
String path = ipAndpath[1];
*/
public List<String> getVolumeBricks(String volumeName) {
log.info("get volume bricks");
String cmd = "gluster volume info " + volumeName + " |grep ^Brick'[0-9]\\+' |awk '{print $2}'";
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
// System.out.println(reStrings);
if (reStrings == null) {
log.error("1601 get volume bricks wrong");
return null;
}
return reStrings;
}
public List<String> getVolumeMountPoint(String volumeName) {
log.info("get volume MountPoint");
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $6}'");
// System.out.println(reStrings);
if(reStrings==null){
log.error("11001 get result string wrong");
return null;
}
if(reStrings.size()==0){
log.error("11002 "+volumeName+" is no mountpoint");
return null;
}
char flag = reStrings.get(0).trim().toCharArray()[0];
if (flag != '/') {
log.error("11003 get result string wrong");
return null;
}
List<String> mountPoints = new ArrayList<>();
for(String mountPoint:reStrings){
mountPoint=mountPoint.replaceAll(" ", "");
mountPoints.add(mountPoint);
}
return mountPoints;
}
public Map<String, Double> getVolumebricksDataSize(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 = "du -d 0 " + path + "|awk '{print $1}'";
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(0));
if (!isNum.matches()) {
log.error("1903 " + reStrings.get(0) + " is unexpect");
return null;
}
brick_size.put(brick, Double.parseDouble(reStrings.get(0)));
}
return brick_size;
}
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;
}
@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");
}
}
package com.platform.glusterfs;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.junit.Test;
import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper;
import com.platform.utils.Constant;
import com.platform.utils.GanymedSSH;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* volume <>
*
* @author liliy
* @version [2016913]
* @see [/]
* @since [/]
*/
public class VolumeInfo {
public static Logger log = Logger.getLogger(VolumeInfo.class);
/**
* volume <>
*
* @return
* @see [##]
*/
public List<String> showAllVolumeName() {
log.info("get volume name");
List<String> volNames = new ArrayList<String>();
/*
* String command = "echo \"" + Constant.rootPasswd +
* "\" |sudo -S gluster volume info|grep ^Volume.Name"; RunCommand
* runCommand = new RunCommand(); List<String> reStrings =
* runCommand.runCommandWait(command);
*/
List<String> reStrings = Constant.ganymedSSH
.execCmdWaitAcquiescent(Constant.glusterVolumeInfo + "|grep ^Volume.Name");
// System.out.println(reStrings);
if (reStrings == null) {
log.error("1401 get result is null");
return null;
}
if (reStrings.size() == 0) {
log.error("1402 get result is nothing");
return null;
}
if (reStrings.get(0).contains(Constant.noVolume)) {
reStrings.clear();
return reStrings;
}
if (!(reStrings.get(0).split(":")[0].contains("Volume Name"))) {
log.error("1403 get result string wrong");
return null;
}
String nameInfo = "";
for (Iterator it = reStrings.iterator(); it.hasNext();) {
String line = (String) it.next();
String str[] = line.split(":");
volNames.add(str[1].replaceAll(" ", ""));
}
return volNames;
}
/**
* volumevolume <>
*
* @param volumeName
* @return
* @see [##]
*/
public String getVolumeType(String volumeName) {
log.info("get volume type");
String volType = "";
List<String> reStrings = Constant.ganymedSSH
.execCmdWaitAcquiescent(Constant.glusterVolumeInfo + volumeName + "|grep ^Type");
// System.out.println(reStrings);
if (reStrings == null) {
log.error("1501 get result is null");
return null;
}
if (reStrings.size() == 0) {
log.error("1502 get result is nothing");
return null;
}
if (!(reStrings.get(0).split(":")[0].contains("Type"))) {
log.error("1503 get result string wrong");
return null;
}
// System.out.println(reStrings);
for (Iterator it = reStrings.iterator(); it.hasNext();) {
String line = (String) it.next();
String str[] = line.split(":");
volType = str[1];
}
volType = volType.replaceAll(" ", "");
return volType;
}
/**
* volumeName nullvolumeNameVolume volumeName does not
* existStarted,Stopped,Created
*
* @param volumeName
* @return
* @see [##]
*/
public String getVolumeStatus(String volumeName) {
log.info("get volume status");
String volStatus = "";
String cmd = Constant.glusterVolumeInfo + " " + volumeName + " |grep ^Status";
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
// System.out.println(reStrings);
if (reStrings == null) {
log.error("1701 get result is null");
return null;
}
if (reStrings.size() == 0) {
log.error("1702 get result is nothing");
return null;
}
if (reStrings.get(0).contains("does not exist")) {
log.error("1703 " + reStrings.get(0));
return reStrings.get(0);
}
if (!(reStrings.get(0).split(":")[0].contains("Status"))) {
log.error("1704 get result string wrong");
return null;
}
for (Iterator it = reStrings.iterator(); it.hasNext();) {
String line = (String) it.next();
String str[] = line.split(":");
volStatus = str[1].replaceAll(" ", "");
}
return volStatus;
}
/**
* volumeName
* volumeName-1-2 volumeName
* @param volumeName
* @return
* @see [##]
*/
public Long getVolumeAvailableSize(String volumeName) {
log.info("get volume availableSize");
Long allSize = 0L;
String cmd = Constant.df + " | grep " + volumeName + "|awk '{print $4}'";
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
// System.out.println(reStrings);
if (reStrings == null) {
log.error("1802 get result is error");
return -2L;
}
if (reStrings.size() == 0) {
log.error("1801 " + volumeName + " is not exists!");
return -1L;
}
allSize = Long.parseLong(reStrings.get(0));
return allSize;
}
/**
* volumeName
* volumeName-1-2 volumeName
* @param volumeName
* @return
* @see [##]
*/
public Long getVolumeUseSize(String volumeName) {
log.info("get volume used size");
Long usedSize = 0L;
if (volumeIsExists(volumeName) == false) {
log.error("1901 " + volumeName + " is not exists!");
return -1L;
}
String cmd = "df | grep " + volumeName + "|awk '{print $3}'";
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
// System.out.println(reStrings);
if (reStrings == null) {
log.error("1901 get result is null");
return -2L;
}
if (reStrings.size() == 0) {
log.error("1902 " + volumeName + " is not exists!");
return -1L;
}
usedSize = Long.parseLong(reStrings.get(0));
return usedSize;
}
/**
* volumeNamebricks
* birckslist ip:path,volumeNamenull
* @param volumeName
* @return
* @see [##]
*/
public List<String> getVolumeBricks(String volumeName) {
log.info("get volume bricks");
String cmd = "gluster volume info " + volumeName + " |grep ^Brick'[0-9]\\+' |awk '{print $2}'";
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
// System.out.println(reStrings);
if (reStrings == null) {
log.error("1601 get volume bricks wrong");
return null;
}
if (reStrings.size()==0) {
log.error("1602 "+volumeName+" is not exists!");
return null;
}
return reStrings;
}
/**
* volumeName
* <>
* @param volumeName
* @return
* @see [##]
*/
public List<String> getVolumeMountPoint(String volumeName) {
log.info("get volume MountPoint");
List<String> mountPoints = new ArrayList<>();
String cmd=Constant.df + "|grep " + volumeName + "|awk '{print $6}'";
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
// System.out.println(reStrings);
if (reStrings == null) {
log.error("11001 get result string wrong");
return null;
}
if (reStrings.size() == 0) {
log.error("11002 " + volumeName + " is not exists or no mountpoint");
return null;
}
// char flag = reStrings.get(0).trim().toCharArray()[0];
// if (flag != '/') {
// log.error("11003 get result string wrong");
// return null;
// }
for (String mountPoint : reStrings) {
mountPoint = mountPoint.replaceAll(" ", "");
mountPoints.add(mountPoint);
}
return mountPoints;
}
public String getOneVolumeMountPoint(String volumeName) {
log.info("get one volume MountPoint");
String mountPoint=null;
String cmd=Constant.df + "|grep " + volumeName + "|awk '{print $6}'";
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
// System.out.println(reStrings);
if (reStrings == null) {
log.error("11001 get result string wrong");
return null;
}
if (reStrings.size() == 0) {
log.error("11002 " + volumeName + " is not exists or no mountpoint");
return null;
}
// char flag = reStrings.get(0).trim().toCharArray()[0];
// if (flag != '/') {
// log.error("11003 get result string wrong");
// return null;
// }
mountPoint=reStrings.get(0);
return mountPoint;
}
/**
* volumeNamebrick
* mapbricks <ip:path,data_size>
* @param volumeName
* @return
* @see [##]
*/
public Map<String, Double> getVolumebricksDataSize(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 = "du -d 0 " + path + "|awk '{print $1}'";
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 "+brick+" is not exits!");
return null;
}
Pattern pattern = Pattern.compile("[0-9]*");
Matcher isNum = pattern.matcher(reStrings.get(0));
if (!isNum.matches()) {
log.error("1903 " + reStrings.get(0) + " is unexpect");
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;
import org.springframework.ui.ModelMap;
import com.platform.dao.DataInfoDao;
import com.platform.entities.DataInfoEntity;
import com.platform.entities.PagerOptions;
public interface DataInfoService {
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;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
@ -24,7 +25,8 @@ public class DataInfoServiceImp implements DataInfoService {
public ModelMap getPagerTableData(PagerOptions pagerOptions) {
// TODO Auto-generated method stub
ModelMap modelMap = new ModelMap();
int count = dfdDao.getLimitedDataCount(pagerOptions); //获取总记录条数
int count = dfdDao.getLimitedDataCount(pagerOptions); //获取总记录条数
System.out.println("total colume " + count);
int offset = 0;
if (pagerOptions.getCurrentPageNum() > 1) {
pagerOptions.setTotalLimit((pagerOptions.getCurrentPageNum() - 1)
@ -41,19 +43,29 @@ public class DataInfoServiceImp implements DataInfoService {
}
@Override
public void deleteData(String[] id) {
public void deleteData(String[] id) throws Exception {
// TODO Auto-generated method stub
List<Integer> ids = new ArrayList<Integer>();
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){
//删除文件操作
for (int i = 0; i < paths.size(); 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;
import java.util.List;
import com.platform.entities.FolderNode;
import com.platform.entities.VolumeEntity;
/**
* <>
* <>
@ -45,6 +47,7 @@ public interface IGfsService {
* @throws Exception
* @see [##]
*/
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 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
*
<<<<<<< HEAD
<<<<<<< HEAD
* @param conn
* @param oc
=======
* @param conn
* @param oc
>>>>>>> 355b6e47a4fa8d058029ec939fe4fefdaa751275
=======
* @param conn
* @param oc
>>>>>>> web_backend_develope
* dblink
*/
public void createDBLink(Connection conn, OracleConnectorParams oc) {

@ -1,149 +1,161 @@
/**
* : GfsServiceImpl.java
* : </>
* : <>
* @author chen
* : <>
* 201698
* <>
*/
package com.platform.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.platform.entities.Brick;
import com.platform.entities.FolderNode;
import com.platform.entities.VolumeEntity;
import com.platform.glusterfs.CopyData;
import com.platform.glusterfs.GetTreeData;
import com.platform.glusterfs.VolumeInfo;
import com.platform.service.IGfsService;
import com.platform.utils.CacheTreeData;
import com.platform.utils.ThreadVolume;
import com.platform.utils.getTreeDataByPath;
/**
* <> gfs
* <>
* @author chen
* @version [201698]
* @see [/]
* @since [/]
*/
@Service(value = "gfsService")
public class GfsServiceImpl implements IGfsService {
/** gfs目录树形查询 */
private getTreeDataByPath getFolder = new getTreeDataByPath();
/** 数据迁移实现 */
private CopyData copydata = new CopyData();
/** Volume信息查询 */
private VolumeInfo volumeInfo = new VolumeInfo();
@Override
public FolderNode getFolder(String path) {
FolderNode result = getFolder.findByPath(path);
return result;
}
@Override
public int copyFolder(List<String> srcFolders, String dstFolder, String name)
throws Exception {
int status = 0 ;
if (null != srcFolders) {
for (String string : srcFolders) {
status = copydata.copyFolderFiles(string, dstFolder, name);
}
}
return status;
}
/* (non-Javadoc)
* @see com.platform.service.IGfsService#getAllVolume()
*/
@Override
public List<VolumeEntity> getAllVolumes() throws Exception {
List<VolumeEntity> volumeList = new ArrayList<>();
List<String> volumeNameList = volumeInfo.showAllVolumeName();
if (null == volumeNameList) {
return null;
}
for (String volumeName : volumeNameList) {
VolumeEntity volume = new VolumeEntity();
volume.setName(volumeName);
List<String> path = volumeInfo.getVolumeMountPoint(volumeName);
//默认加载第一个路径
if (null != path && path.size() > 0) {
volume.setPath(path.get(0));
}
volume.setAllSize(volumeInfo.getVolumeAllSize(volumeName));
volume.setUsedSize(volumeInfo.getVolumeUseSize(volumeName));
//TODO 查询brick--
//返回 ip:path
List<String> brickStrs = volumeInfo.getVolumeBricks(volumeName);
//brick已用大小
Map<String, Double> usedSize = volumeInfo.getVolumebricksDataSize(volumeName);
Map<String, Double> availableSize = volumeInfo.getVolumebricksAvailableSize(volumeName);
List<Brick> brickList = new ArrayList<Brick>();
for (String brickIpPath : brickStrs) {
Brick b = new Brick();
String ipAndpath[] = brickIpPath.split(":");
String brickip = ipAndpath[0];
String brickpath = ipAndpath[1];
//iP , path ,
b.setIp(brickip);
b.setPath(brickpath);
b.setAvailableSize(availableSize.get(brickIpPath));
b.setUsedSize(usedSize.get(brickIpPath));
brickList.add(b);
}
volume.setBrick(brickList);
if (null != volume.getPath()) {
// 获得 folder 目录
volume.setFolder(getFolder(volume.getPath()));
}
volumeList.add(volume);
}
return volumeList;
}
@Override
public VolumeEntity getOneVolume(String volumeName) throws Exception {
VolumeEntity volume = new VolumeEntity();
volume.setName(volumeName);
List<String> path = volumeInfo.getVolumeMountPoint(volumeName);
if (null != path && path.size() > 0) {
volume.setPath(path.get(0));
}
volume.setAllSize(volumeInfo.getVolumeAllSize(volumeName));
volume.setUsedSize(volumeInfo.getVolumeUseSize(volumeName));
// volume.setBrick(brick);
if (null != volume.getPath()) {
volume.setFolder(getFolder(path.get(0)));
}
return volume;
}
@Override
public int moveData(String volumeName, String srcPath, String dstPath)
throws Exception {
int result = copydata.copyFolderFiles(srcPath, dstPath, "app");
return result;
}
@Override
public int deleteData(String volumeName, String srcPath) throws Exception {
// TODO Auto-generated method stub
return 0;
}
}
/**
* : GfsServiceImpl.java
* : </>
* : <>
* @author chen
* : <>
* 201698
* <>
*/
package com.platform.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.platform.entities.Brick;
import com.platform.entities.FolderNode;
import com.platform.entities.VolumeEntity;
import com.platform.glusterfs.CopyData;
import com.platform.glusterfs.GetTreeData;
import com.platform.glusterfs.VolumeInfo;
import com.platform.service.IGfsService;
import com.platform.utils.CacheTreeData;
import com.platform.utils.ThreadVolume;
import com.platform.utils.getTreeDataByPath;
/**
* <> gfs
* <>
* @author chen
* @version [201698]
* @see [/]
* @since [/]
*/
@Service(value = "gfsService")
public class GfsServiceImpl implements IGfsService {
/** gfs目录树形查询 */
private getTreeDataByPath getFolder = new getTreeDataByPath();
/** 数据迁移实现 */
private CopyData copydata = new CopyData();
/** Volume信息查询 */
private VolumeInfo volumeInfo = new VolumeInfo();
@Override
public FolderNode getFolder(String path) {
FolderNode result = getFolder.findByPath(path);
return result;
}
@Override
public int copyFolder(List<String> srcFolders, String dstFolder, String name)
throws Exception {
int status = 0 ;
if (null != srcFolders) {
for (String string : srcFolders) {
status = copydata.copyFolderFilesAnyway(string, dstFolder, name);
}
}
return status;
}
/* (non-Javadoc)
* @see com.platform.service.IGfsService#getAllVolume()
*/
@Override
public List<VolumeEntity> getAllVolumes() throws Exception {
List<VolumeEntity> volumeList = CacheTreeData.getVolumeList();
if (null == volumeList) {
return new ArrayList<VolumeEntity>();
}
for (VolumeEntity volume : volumeList) {
// VolumeEntity volume = new VolumeEntity();
// volume.setName(volumeName);
// List<String> path = volumeInfo.getVolumeMountPoint(volumeName);
// //默认加载第一个路径
// if (null != path && path.size() > 0) {
// volume.setPath(path.get(0));
// }
// volume.setAllSize(volumeInfo.getVolumeAllSize(volumeName));
// volume.setUsedSize(volumeInfo.getVolumeUseSize(volumeName));
// //TODO 查询brick--
// //返回 ip:path
// List<String> brickStrs = volumeInfo.getVolumeBricks(volumeName);
// //brick已用大小
// Map<String, Double> usedSize = volumeInfo.getVolumebricksDataSize(volumeName);
// Map<String, Double> availableSize = volumeInfo.getVolumebricksAvailableSize(volumeName);
//
//
// List<Brick> brickList = new ArrayList<Brick>();
// for (String brickIpPath : brickStrs) {
// Brick b = new Brick();
// String ipAndpath[] = brickIpPath.split(":");
// String brickip = ipAndpath[0];
// String brickpath = ipAndpath[1];
// //iP , path ,
// b.setIp(brickip);
// b.setPath(brickpath);
// b.setAvailableSize(availableSize.get(brickIpPath));
// b.setUsedSize(usedSize.get(brickIpPath));
// brickList.add(b);
// }
// volume.setBrick(brickList);
if (null != volume.getPath()) {
// 获得 folder 目录
List<FolderNode> list = new ArrayList<FolderNode>();
FolderNode currNode = getFolder(volume.getPath());
if (null != currNode && null != currNode.getChildNodes()) {
list.addAll(currNode.getChildNodes());
}
volume.setFolder(list);
}
}
return volumeList;
}
@Override
public VolumeEntity getOneVolume(String volumeName) throws Exception {
VolumeEntity volume = new VolumeEntity();
volume.setName(volumeName);
List<String> path = volumeInfo.getVolumeMountPoint(volumeName);
if (null != path && path.size() > 0) {
volume.setPath(path.get(0));
}
volume.setAllSize(volumeInfo.getVolumeAvailableSize(volumeName));
volume.setUsedSize(volumeInfo.getVolumeUseSize(volumeName));
// volume.setBrick(brick);
if (null != volume.getPath()) {
List<FolderNode> list = new ArrayList<FolderNode>();
if (null != path && path.size() > 0) {
FolderNode currNode = getFolder(path.get(0));
if (null != currNode && null != currNode.getChildNodes()) {
list.addAll(currNode.getChildNodes());
}
}
volume.setFolder(list);
}
return volume;
}
@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;
import java.util.List;
import com.platform.entities.FolderNode;
public class CacheTreeData {
private static List<FolderNode> folders = null;
public static List<FolderNode> getFolders() {
return folders;
}
public static void setFolders(List<FolderNode> folders) {
CacheTreeData.folders = folders;
}
}
package com.platform.utils;
import java.util.List;
import java.util.Map;
import com.platform.entities.FolderNode;
import com.platform.entities.VolumeEntity;
public class CacheTreeData {
private static List<FolderNode> folders = null;
private static List<VolumeEntity> volumeList = null;
public static List<FolderNode> getFolders() {
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;
import java.util.Properties;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
public class ConfigsLoader implements ServletContextListener {
private static ConfigPropertyReader cReader = null;
@Override
public void contextDestroyed(ServletContextEvent sEvent) {
// TODO Auto-generated method stub
Configs.CONSOLE_LOGGER.info("系统停止..");
}
@SuppressWarnings("static-access")
@Override
public void contextInitialized(ServletContextEvent sEvent) {
// TODO Auto-generated method stub
Configs.CONSOLE_LOGGER.info("系统初始化..");
String contextPath = sEvent.getServletContext().getRealPath("/")
+ "WEB-INF/config/config.properties";
this.cReader = ConfigPropertyReader.Builder(contextPath);
init();
new ThreadVolume("").start();
}
public static void init() {
Properties properties = cReader.getProperties();
Configs.KUBE_MASTER_URL = properties.getProperty("kubeMasterUrl");
Configs.COLLECT_USER_NAME = properties.getProperty("collect-user-name");
Configs.COLLECT_PASSWORD = properties.getProperty("collect-password");
Configs.COLLECT_SERVICE_NAME = properties
.getProperty("collect-service-name");
Configs.GATHER_USER_NAME = properties.getProperty("gather-user-name");
Configs.GATHER_USER_PASSWORD = properties
.getProperty("gather-user-password");
Configs.GATHER_PORT = properties.getProperty("gather-port");
Configs.GATHER_SERVICE_NAME = properties
.getProperty("gather-service-name");
Configs.TABLE_SUFFIX = properties.getProperty("table-suffix");
Configs.EXTRACT_LOG_LOCALTION = properties
.getProperty("extract-log-localtion");
Configs.GATHER_TABLESPACE_NAME = properties
.getProperty("gather-tablespace-name");
Configs.GATHER_TABLESPACE_PATH = properties
.getProperty("gather-tablespace-path");
Configs.GATHER_TABLE_PASSWORD=properties.getProperty("gather-table-user-password");
}
public ConfigPropertyReader getcReader() {
return cReader;
}
@SuppressWarnings("static-access")
public void setcReader(ConfigPropertyReader cReader) {
this.cReader = cReader;
}
}
package com.platform.utils;
import java.util.Properties;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import com.platform.service.thread.ThreadMoveData;
public class ConfigsLoader implements ServletContextListener {
private static ConfigPropertyReader cReader = null;
@Override
public void contextDestroyed(ServletContextEvent sEvent) {
// TODO Auto-generated method stub
Configs.CONSOLE_LOGGER.info("系统停止..");
}
@SuppressWarnings("static-access")
@Override
public void contextInitialized(ServletContextEvent sEvent) {
// TODO Auto-generated method stub
Configs.CONSOLE_LOGGER.info("系统初始化..");
String contextPath = sEvent.getServletContext().getRealPath("/")
+ "WEB-INF/config/config.properties";
this.cReader = ConfigPropertyReader.Builder(contextPath);
init();
new ThreadVolume("").start();
}
public static void init() {
Properties properties = cReader.getProperties();
Configs.KUBE_MASTER_URL = properties.getProperty("kubeMasterUrl");
Configs.COLLECT_USER_NAME = properties.getProperty("collect-user-name");
Configs.COLLECT_PASSWORD = properties.getProperty("collect-password");
Configs.COLLECT_SERVICE_NAME = properties
.getProperty("collect-service-name");
Configs.GATHER_USER_NAME = properties.getProperty("gather-user-name");
Configs.GATHER_USER_PASSWORD = properties
.getProperty("gather-user-password");
Configs.GATHER_PORT = properties.getProperty("gather-port");
Configs.GATHER_SERVICE_NAME = properties
.getProperty("gather-service-name");
Configs.TABLE_SUFFIX = properties.getProperty("table-suffix");
Configs.EXTRACT_LOG_LOCALTION = properties
.getProperty("extract-log-localtion");
Configs.GATHER_TABLESPACE_NAME = properties
.getProperty("gather-tablespace-name");
Configs.GATHER_TABLESPACE_PATH = properties
.getProperty("gather-tablespace-path");
Configs.GATHER_TABLE_PASSWORD=properties.getProperty("gather-table-user-password");
}
public ConfigPropertyReader getcReader() {
return cReader;
}
@SuppressWarnings("static-access")
public void setcReader(ConfigPropertyReader cReader) {
this.cReader = cReader;
}
}

@ -1,32 +1,45 @@
package com.platform.utils;
public class Constant {
public static String rootUser = "root";
public static String rootPasswd = "root";
public static String hostIp = "192.168.0.110";
// public static String hostIp = "192.168.1.105";
public static int port = 22;
public static String glusterPeerStatus = "gluster peer status";
public static String glusterVolumeInfo = "gluster volume info ";
public static String df = "df -k ";
public static String peerincluster_connected="PeerinCluster(Connected)";
public static String peerincluster_disconnected="PeerinCluster(Disconnected)";
public static String distributed="distributed";
public static String replica="replica";
public static String stripe="stripe";
public static String noVolume="No volumes present";
public static GanymedSSH ganymedSSH=new GanymedSSH(hostIp, rootUser, rootPasswd, port);
public static String fileGetTreeData="./WEB-INF/config/getTreedata.sh";
/**
* volume 线
*/
public final static int get_volume_sleep_time = 300000;
/**
* volume 线
*/
public final static int update_dataInfo_sleep_time = 3000;
}
package com.platform.utils;
public class Constant {
public static String rootUser = "root";
public static String rootPasswd = "root";
public static String hostIp = "192.168.0.116";
// public static String hostIp = "192.168.1.105";
public static int port = 22;
public static String glusterPeerStatus = "gluster peer status";
public static String glusterVolumeInfo = "gluster volume info ";
public static String df = "df -k ";
public static String peerincluster_connected = "PeerinCluster(Connected)";
public static String peerincluster_disconnected = "PeerinCluster(Disconnected)";
public static String peerNotinCluster = "PeerNotinCluster";
public static String distributed = "distributed";
public static String replica = "replica";
public static String stripe = "stripe";
public static String noVolume = "No volumes present";
public static String success = "success";
public static String failed = "failed";
public static String noSuchFile = "No such file or directory";
public static GanymedSSH ganymedSSH = new GanymedSSH(hostIp, rootUser, rootPasswd, port);
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 "
+ "then\n ergodic \\$1\"/\"\\$file\n else\n local path=\\$1\"/\"\\$file\n "
+ "echo \\$path \n fi\n done\n}\n\nIFS=\\$\\'\\n\\' "
+ "#这个必须要,否则会在文件名中有空格时出错\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.InputStreamReader;
import org.junit.Test;
/**
*
*
@ -65,14 +67,18 @@ public class FileOperateHelper {
* @param path
* @return
*/
@SuppressWarnings("resource")
public static String fileReaderAndendline(String path) {
StringBuffer sb = new StringBuffer();
String tempString = "";
try {
File file = new File(path);
if (!file.exists())
return "";
FileInputStream fis = new FileInputStream(file);
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
while ((tempString = br.readLine()) != null) {
@ -83,4 +89,7 @@ public class FileOperateHelper {
}
return sb.toString();
}
}

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

Loading…
Cancel
Save