Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Дмитрий Корытько
/
hware
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
6b37c21e
...
6b37c21e433b57fcf27b37e163fbd5b3abaa06e1
authored
2015-08-04 17:13:31 +0300
by
root
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
save
1 parent
d7c44780
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
344 additions
and
87 deletions
DevTools/pom.xml
DevTools/repo/org/emercit/utilstools/1.22/utilstools-1.22.jar
DevTools/repo/org/emercit/utilstools/1.22/utilstools-1.22.jar.md5
DevTools/repo/org/emercit/utilstools/1.22/utilstools-1.22.jar.sha1
DevTools/repo/org/emercit/utilstools/1.22/utilstools-1.22.pom
DevTools/repo/org/emercit/utilstools/1.22/utilstools-1.22.pom.md5
DevTools/repo/org/emercit/utilstools/1.22/utilstools-1.22.pom.sha1
DevTools/repo/org/emercit/utilstools/maven-metadata.xml
DevTools/repo/org/emercit/utilstools/maven-metadata.xml.md5
DevTools/repo/org/emercit/utilstools/maven-metadata.xml.sha1
DevTools/src/main/java/org/emercit/devtools/app/DownloadFileController.java
DevTools/src/main/java/org/emercit/devtools/app/FileUploadController.java
DevTools/src/main/java/org/emercit/devtools/model/ExtJSFormResult.java
DevTools/src/main/java/org/emercit/devtools/model/FileUploadBean.java
DevTools/src/main/java/org/emercit/devtools/service/SvService.java
DevTools/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml
DevTools/src/main/webapp/WEB-INF/spring/root-context.xml
DevTools/src/main/webapp/resources/js/app.js
DevTools/src/main/webapp/resources/js/app/controller/Gprs.js
DevTools/src/main/webapp/resources/js/app/view/ToolsXml.js
UtilsTools/src/main/java/org/emercit/utilstools/App.java
UtilsTools/src/main/java/org/emercit/utilstools/model/SettingsBean.java
UtilsTools/src/main/java/org/emercit/utilstools/service/Settings.java
DevTools/pom.xml
View file @
6b37c21
...
...
@@ -16,6 +16,19 @@
<dependencies>
<!-- Spring -->
<dependency>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
<version>
2.4
</version>
</dependency>
<dependency>
<groupId>
commons-fileupload
</groupId>
<artifactId>
commons-fileupload
</artifactId>
<version>
1.2.1
</version>
<!-- makesure correct version here -->
</dependency>
<dependency>
<groupId>
org.codehaus.jackson
</groupId>
<artifactId>
jackson-mapper-asl
</artifactId>
...
...
@@ -135,7 +148,7 @@
<dependency>
<groupId>
org.emercit
</groupId>
<artifactId>
utilstools
</artifactId>
<version>
1.2
1
</version>
<version>
1.2
2
</version>
</dependency>
<dependency>
...
...
@@ -315,28 +328,3 @@ http://repo.maven.apache.org/maven2
</build>
</project>
...
...
DevTools/repo/org/emercit/utilstools/1.22/utilstools-1.22.jar
0 → 100644
View file @
6b37c21
No preview for this file type
DevTools/repo/org/emercit/utilstools/1.22/utilstools-1.22.jar.md5
0 → 100644
View file @
6b37c21
25d332fbd0c12163ad293b4bc5f77d53
\ No newline at end of file
DevTools/repo/org/emercit/utilstools/1.22/utilstools-1.22.jar.sha1
0 → 100644
View file @
6b37c21
d94a29af148beaaf24bcb8de9e1caa741bf84082
\ No newline at end of file
DevTools/repo/org/emercit/utilstools/1.22/utilstools-1.22.pom
0 → 100644
View file @
6b37c21
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.emercit
</groupId>
<artifactId>
utilstools
</artifactId>
<version>
1.22
</version>
</project>
DevTools/repo/org/emercit/utilstools/1.22/utilstools-1.22.pom.md5
0 → 100644
View file @
6b37c21
7082734e826fce32e566331beb798e51
\ No newline at end of file
DevTools/repo/org/emercit/utilstools/1.22/utilstools-1.22.pom.sha1
0 → 100644
View file @
6b37c21
5168382b2c0c0305c3b491de7877f66ebb11c269
\ No newline at end of file
DevTools/repo/org/emercit/utilstools/maven-metadata.xml
View file @
6b37c21
...
...
@@ -3,7 +3,7 @@
<groupId>
org.emercit
</groupId>
<artifactId>
utilstools
</artifactId>
<versioning>
<release>
1.2
1
</release>
<release>
1.2
2
</release>
<versions>
<version>
1.0
</version>
<version>
1.1
</version>
...
...
@@ -27,7 +27,8 @@
<version>
1.19
</version>
<version>
1.20
</version>
<version>
1.21
</version>
<version>
1.22
</version>
</versions>
<lastUpdated>
201508040
23457
</lastUpdated>
<lastUpdated>
201508040
90803
</lastUpdated>
</versioning>
</metadata>
...
...
DevTools/repo/org/emercit/utilstools/maven-metadata.xml.md5
View file @
6b37c21
c9b18dea54a893e48d929c6b566329b1
\ No newline at end of file
d3cc127db852d356f6369653233badc8
\ No newline at end of file
...
...
DevTools/repo/org/emercit/utilstools/maven-metadata.xml.sha1
View file @
6b37c21
68228ae65b16d9fbc4558423f27c44a7e54d4b93
\ No newline at end of file
3a98161da9ae3de4390b837d2853af35cd5c60c2
\ No newline at end of file
...
...
DevTools/src/main/java/org/emercit/devtools/app/DownloadFileController.java
0 → 100644
View file @
6b37c21
package
org
.
emercit
.
devtools
.
app
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.util.Vector
;
import
javax.servlet.ServletContext
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.xml.bind.JAXBContext
;
import
javax.xml.bind.JAXBException
;
import
org.apache.commons.io.IOUtils
;
import
org.emercit.devtools.service.DnsService
;
import
org.emercit.dnsmanager.model.DnsBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.ModelMap
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.emercit.utilstools.service.Settings
;
import
org.emercit.utilstools.model.SettingsBean
;
@Controller
public
class
DownloadFileController
{
private
Settings
settings
=
new
Settings
();
private
SettingsBean
bean
;
@ResponseBody
@RequestMapping
(
value
=
"/settings"
,
//produces={"application/json", "application/xml"},
produces
={
"application/xml"
},
method
=
RequestMethod
.
GET
)
public
SettingsBean
getStudent
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
bean
=
settings
.
make
();
return
bean
;
}
}
DevTools/src/main/java/org/emercit/devtools/app/FileUploadController.java
0 → 100644
View file @
6b37c21
package
org
.
emercit
.
devtools
.
app
;
import
java.beans.XMLDecoder
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedOutputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.ObjectInputStream
;
import
java.io.ObjectOutputStream
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.ObjectError
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.apache.log4j.Logger
;
import
org.codehaus.jackson.map.ObjectMapper
;
import
org.emercit.devtools.model.ExtJSFormResult
;
import
org.emercit.devtools.model.FileUploadBean
;
import
org.emercit.devtools.service.SvService
;
import
org.emercit.utilstools.model.SettingsBean
;
import
org.emercit.utilstools.service.Settings
;
@Controller
@RequestMapping
(
value
=
"/upload.action"
)
public
class
FileUploadController
{
private
static
final
Logger
log
=
Logger
.
getLogger
(
FileUploadController
.
class
);
@RequestMapping
(
method
=
RequestMethod
.
POST
)
public
@ResponseBody
String
create
(
FileUploadBean
uploadItem
,
BindingResult
result
){
ExtJSFormResult
extjsFormResult
=
new
ExtJSFormResult
();
if
(
result
.
hasErrors
()){
for
(
ObjectError
error
:
result
.
getAllErrors
()){
log
.
error
(
"Error: "
+
error
.
getCode
()
+
" - "
+
error
.
getDefaultMessage
());
}
extjsFormResult
.
setSuccess
(
false
);
return
extjsFormResult
.
toString
();
}
log
.
info
(
"-------------------------------------------"
);
log
.
info
(
" "
+
uploadItem
.
getFileSettings
().
getOriginalFilename
());
log
.
info
(
"-------------------------------------------"
);
FileOutputStream
outputStream
=
null
;
String
filePath
=
System
.
getProperty
(
"java.io.tmpdir"
)
+
"/"
+
uploadItem
.
getFileSettings
().
getOriginalFilename
();
try
{
outputStream
=
new
FileOutputStream
(
new
File
(
filePath
));
outputStream
.
write
(
uploadItem
.
getFileSettings
().
getBytes
());
outputStream
.
close
();
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Error while saving file"
);
return
"FileUploadForm"
;
}
try
{
//XMLDecoder d = new XMLDecoder(
// new BufferedInputStream(
// new FileInputStream(filePath)));
//Object obj=(Object)d.readObject();
ObjectMapper
mapper
=
new
ObjectMapper
();
SettingsBean
settingsBean
=
mapper
.
readValue
(
new
File
(
filePath
),
SettingsBean
.
class
);
Settings
setting
=
new
Settings
();
setting
.
configuring
(
settingsBean
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
());
}
extjsFormResult
.
setSuccess
(
true
);
return
extjsFormResult
.
toString
();
}
}
DevTools/src/main/java/org/emercit/devtools/model/ExtJSFormResult.java
0 → 100644
View file @
6b37c21
package
org
.
emercit
.
devtools
.
model
;
public
class
ExtJSFormResult
{
private
boolean
success
;
public
boolean
isSuccess
()
{
return
success
;
}
public
void
setSuccess
(
boolean
success
)
{
this
.
success
=
success
;
}
public
String
toString
(){
return
"{success:"
+
this
.
success
+
"}"
;
}
}
DevTools/src/main/java/org/emercit/devtools/model/FileUploadBean.java
0 → 100644
View file @
6b37c21
package
org
.
emercit
.
devtools
.
model
;
import
org.springframework.web.multipart.commons.CommonsMultipartFile
;
public
class
FileUploadBean
{
private
CommonsMultipartFile
fileSettings
;
public
CommonsMultipartFile
getFileSettings
()
{
return
fileSettings
;
}
public
void
setFileSettings
(
CommonsMultipartFile
fileSettings
)
{
this
.
fileSettings
=
fileSettings
;
}
}
DevTools/src/main/java/org/emercit/devtools/service/SvService.java
View file @
6b37c21
...
...
@@ -19,9 +19,6 @@ import org.emercit.pckutils.checkservice.STService;
public
enum
SvService
{
INSTANCE
;
...
...
DevTools/src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml
View file @
6b37c21
...
...
@@ -22,10 +22,10 @@
<beans:property
name=
"prefix"
value=
"/WEB-INF/views/"
/>
<beans:property
name=
"suffix"
value=
".jsp"
/>
</beans:bean>
<context:component-scan
base-package=
"org.emercit.devtools.app"
/>
<!-- Transporting JSON - Data -->
<beans:bean
class=
"org.springframework.web.servlet.view.ContentNegotiatingViewResolver"
>
<beans:property
name=
"mediaTypes"
>
<beans:map>
...
...
@@ -41,4 +41,12 @@
</beans:property>
</beans:bean>
</beans:beans>
<!-- Configure the multipart resolver -->
<beans:bean
id=
"multipartResolver"
class=
"org.springframework.web.multipart.commons.CommonsMultipartResolver"
>
<!-- one of the properties available; the maximum file size in bytes -->
<beans:property
name=
"maxUploadSize"
value=
"500000"
/>
</beans:bean>
</beans:beans>
\ No newline at end of file
...
...
DevTools/src/main/webapp/WEB-INF/spring/root-context.xml
View file @
6b37c21
...
...
@@ -4,5 +4,7 @@
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"
>
</beans>
\ No newline at end of file
...
...
DevTools/src/main/webapp/resources/js/app.js
View file @
6b37c21
...
...
@@ -21,7 +21,8 @@ Ext.application({
'RemoteServer'
,
'DeviceControl'
,
'Log'
,
'Sv'
'Sv'
,
'ToolsXml'
...
...
@@ -233,34 +234,25 @@ Ext.application({
},
{
title
:
'НАСТРОЙКИ В
XML
'
,
title
:
'НАСТРОЙКИ В
JSON
'
,
items
:[
{
region
:
'center'
,
xtype
:
'tabpanel'
,
items
:
[
]
}
{
xtype
:
'mvvm-ToolsXmlView'
,
id
:
'formtoolsxml'
,
width
:
600
}
]
},
{
title
:
'ЖУРНАЛ'
,
items
:[
{
region
:
'center'
,
xtype
:
'tabpanel'
,
items
:
[{
xtype
:
'mvvm-LogView'
,
id
:
'formlog'
}
]
}
{
xtype
:
'mvvm-LogView'
,
id
:
'formlog'
}
]
},
...
...
DevTools/src/main/webapp/resources/js/app/controller/Gprs.js
View file @
6b37c21
...
...
@@ -23,9 +23,7 @@ Ext.define('App.controller.Gprs', {
var
selected
=
Ext
.
getCmp
(
'internetGprs'
).
getValue
();
var
data
=
Ext
.
util
.
JSON
.
encode
(
selected
);
var
data
=
Ext
.
util
.
JSON
.
encode
(
selected
);
Ext
.
Ajax
.
request
({
method
:
"POST"
,
...
...
DevTools/src/main/webapp/resources/js/app/view/ToolsXml.js
0 → 100644
View file @
6b37c21
Ext
.
define
(
'App.view.ToolsXml'
,
{
extend
:
'Ext.form.Panel'
,
xtype
:
'mvvm-ToolsXmlView'
,
frame
:
true
,
width
:
600
,
padding
:
10
,
viewModel
:
{
type
:
'toolsxmlform'
},
items
:[{
xtype
:
'filefield'
,
name
:
'fileSettings'
,
fieldLabel
:
'Конфиг'
,
labelWidth
:
50
,
width
:
575
,
msgTarget
:
'side'
,
allowBlank
:
false
,
//anchor: '100%',
buttonText
:
'Выберите файл...'
}],
buttons
:
[
{
text
:
'Применить'
,
handler
:
function
()
{
var
form
=
this
.
up
(
'form'
).
getForm
();
if
(
form
.
isValid
())
{
form
.
submit
({
url
:
'upload.action'
,
waitMsg
:
'Загрузка файла и применение конфигурации...'
,
success
:
function
(
fp
,
o
)
{
Ext
.
Msg
.
alert
(
'Успешно'
,
'Настройки применены'
);
}
});
}
}
}
]
});
\ No newline at end of file
UtilsTools/src/main/java/org/emercit/utilstools/App.java
View file @
6b37c21
package
org
.
emercit
.
utilstools
;
import
org.emercit.
ethmanager.model.Eth
Bean
;
import
org.emercit.
ethmanager.service.EthLinux
;
import
org.emercit.
utilstools.model.Settings
Bean
;
import
org.emercit.
utilstools.service.Settings
;
import
java.util.Vector
;
...
...
@@ -13,15 +13,22 @@ public class App
private
static
final
Logger
log
=
Logger
.
getLogger
(
App
.
class
);
private
static
EthLinux
ethlinux
=
new
EthLinux
();
public
static
void
main
(
String
[]
args
)
{
Vector
<
EthBean
>
neans
=
ethlinux
.
getEthBeans
();
EthBean
bb
=
ethlinux
.
getEthByName
(
"eth0"
);
Settings
remserv
=
new
Settings
();
remserv
.
init
();
SettingsBean
settingsbean
=
remserv
.
make
();
remserv
.
set
(
settingsbean
);
System
.
out
.
println
(
""
);
...
...
UtilsTools/src/main/java/org/emercit/utilstools/model/SettingsBean.java
View file @
6b37c21
...
...
@@ -37,7 +37,7 @@ public class SettingsBean implements Serializable {
}
//Set
public
void
setDev
InfoB
ean
(
DevInfoBean
model
){
public
void
setDev
infob
ean
(
DevInfoBean
model
){
this
.
devinfobean
=
model
;
}
...
...
@@ -47,22 +47,22 @@ public class SettingsBean implements Serializable {
this
.
dnsbeans
=
models
;
}
public
void
setDate
I
nfo
(
DateInfo
model
)
{
public
void
setDate
i
nfo
(
DateInfo
model
)
{
this
.
dateinfobean
=
model
;
}
public
void
setG
SMB
ean
(
GSMBean
model
)
{
public
void
setG
smb
ean
(
GSMBean
model
)
{
this
.
gsmbean
=
model
;
}
public
void
setEth
B
eans
(
Vector
<
EthBean
>
models
)
{
public
void
setEth
b
eans
(
Vector
<
EthBean
>
models
)
{
this
.
ethbeans
=
models
;
}
public
void
setProxy
B
eans
(
Vector
<
ProxyBean
>
models
)
{
public
void
setProxy
b
eans
(
Vector
<
ProxyBean
>
models
)
{
this
.
proxybeans
=
models
;
}
...
...
@@ -80,7 +80,7 @@ public class SettingsBean implements Serializable {
//Get
public
DevInfoBean
getDev
InfoB
ean
(){
public
DevInfoBean
getDev
infob
ean
(){
return
devinfobean
;
}
...
...
@@ -90,22 +90,22 @@ public class SettingsBean implements Serializable {
return
dnsbeans
;
}
public
DateInfo
getDate
I
nfo
()
{
public
DateInfo
getDate
i
nfo
()
{
return
dateinfobean
;
}
public
GSMBean
getG
SMB
ean
()
{
public
GSMBean
getG
smb
ean
()
{
return
gsmbean
;
}
public
Vector
<
EthBean
>
getEth
B
eans
()
{
public
Vector
<
EthBean
>
getEth
b
eans
()
{
return
ethbeans
;
}
public
Vector
<
ProxyBean
>
getProxy
B
eans
()
{
public
Vector
<
ProxyBean
>
getProxy
b
eans
()
{
return
proxybeans
;
}
...
...
UtilsTools/src/main/java/org/emercit/utilstools/service/Settings.java
View file @
6b37c21
...
...
@@ -63,20 +63,20 @@ public class Settings implements ISettings {
*/
public
void
configuring
(
SettingsBean
model
)
{
devinfo
.
set
(
model
.
getDev
InfoB
ean
());
devinfo
.
set
(
model
.
getDev
infob
ean
());
dnslinux
.
Config
(
model
.
getDnsbeans
());
DateInfo
dateinfo
=
model
.
getDate
I
nfo
();
DateInfo
dateinfo
=
model
.
getDate
i
nfo
();
ntplinux
.
setUsNtpServer
(
dateinfo
.
getNtp
());
gsm
.
set
(
model
.
getG
SMB
ean
());
gsm
.
set
(
model
.
getG
smb
ean
());
for
(
EthBean
eb:
model
.
getEth
B
eans
())
{
for
(
EthBean
eb:
model
.
getEth
b
eans
())
{
ethlinux
.
Update
(
eb
);
}
proxylinux
.
Config
(
model
.
getProxy
B
eans
());
proxylinux
.
Config
(
model
.
getProxy
b
eans
());
remserv
.
set
(
model
.
getRserverbeans
());
}
...
...
@@ -86,7 +86,7 @@ public class Settings implements ISettings {
sb
=
new
SettingsBean
();
sb
.
setDev
InfoB
ean
(
devinfo
.
get
());
sb
.
setDev
infob
ean
(
devinfo
.
get
());
sb
.
setDnsbeans
(
dnslinux
.
getAllDns
());
...
...
@@ -94,12 +94,13 @@ public class Settings implements ISettings {
dateInfo
.
setDt
(
""
);
dateInfo
.
setNtp
(
ntplinux
.
getUseNtpServer
());
sb
.
setDate
I
nfo
(
dateInfo
);
sb
.
setDate
i
nfo
(
dateInfo
);
sb
.
setG
SMB
ean
(
gsm
.
get
());
sb
.
setEth
B
eans
(
ethlinux
.
getEthBeans
());
sb
.
setProxy
B
eans
(
proxylinux
.
getProxyBeans
());
sb
.
setG
smb
ean
(
gsm
.
get
());
sb
.
setEth
b
eans
(
ethlinux
.
getEthBeans
());
sb
.
setProxy
b
eans
(
proxylinux
.
getProxyBeans
());
sb
.
setRserverbeans
(
remserv
.
get
());
sb
.
setSvbeans
(
sv
.
get
());
return
sb
;
}
...
...
@@ -114,6 +115,7 @@ public class Settings implements ISettings {
ethlinux
.
setDefaults
();
proxylinux
.
init
();
remserv
.
init
();
sv
.
init
();
sb
=
new
SettingsBean
();
...
...
Please
register
or
sign in
to post a comment