Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
ec6a488a
Commit
ec6a488a
authored
Nov 18, 2013
by
Christian Dupuis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgrade to crash-1.3.0-beta11
parent
e16e2323
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
182 deletions
+19
-182
pom.xml
spring-boot-dependencies/pom.xml
+11
-1
pom.xml
...ng-boot-starters/spring-boot-starter-shell-remote/pom.xml
+8
-0
help.groovy
...hell-remote/src/main/resources/commands/crash/help.groovy
+0
-58
jmx.groovy
...shell-remote/src/main/resources/commands/crash/jmx.groovy
+0
-123
No files found.
spring-boot-dependencies/pom.xml
View file @
ec6a488a
...
...
@@ -49,7 +49,7 @@
<thymeleaf-extras-springsecurity3.version>
2.0.1
</thymeleaf-extras-springsecurity3.version>
<thymeleaf-layout-dialect.version>
1.1.3
</thymeleaf-layout-dialect.version>
<tomcat.version>
7.0.42
</tomcat.version>
<crashub.version>
1.3.0-beta
8
</crashub.version>
<crashub.version>
1.3.0-beta
11
</crashub.version>
</properties>
<dependencyManagement>
<dependencies>
...
...
@@ -514,6 +514,16 @@
<artifactId>
crash.embed.spring
</artifactId>
<version>
${crashub.version}
</version>
</dependency>
<dependency>
<groupId>
org.crashub
</groupId>
<artifactId>
crash.plugins.cron
</artifactId>
<version>
${crashub.version}
</version>
</dependency>
<dependency>
<groupId>
org.crashub
</groupId>
<artifactId>
crash.plugins.mail
</artifactId>
<version>
${crashub.version}
</version>
</dependency>
<dependency>
<groupId>
org.crashub
</groupId>
<artifactId>
crash.shell
</artifactId>
...
...
spring-boot-starters/spring-boot-starter-shell-remote/pom.xml
View file @
ec6a488a
...
...
@@ -59,6 +59,14 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.crashub
</groupId>
<artifactId>
crash.plugins.cron
</artifactId>
</dependency>
<dependency>
<groupId>
org.crashub
</groupId>
<artifactId>
crash.plugins.mail
</artifactId>
</dependency>
<dependency>
<groupId>
org.crashub
</groupId>
<artifactId>
crash.shell
</artifactId>
...
...
spring-boot-starters/spring-boot-starter-shell-remote/src/main/resources/commands/crash/help.groovy
deleted
100644 → 0
View file @
e16e2323
package
crash.commands.base
;
import
org.crsh.cli.Command
;
import
org.crsh.cli.Usage
;
import
org.crsh.command.BaseCommand
;
import
org.crsh.command.DescriptionFormat
;
import
org.crsh.command.InvocationContext
;
import
org.crsh.command.ShellCommand
;
import
org.crsh.shell.impl.command.CRaSH
;
import
org.crsh.text.Color
;
import
org.crsh.text.Decoration
;
import
org.crsh.text.Style
;
import
org.crsh.text.ui.LabelElement
;
import
org.crsh.text.ui.RowElement
;
import
org.crsh.text.ui.TableElement
;
import
java.io.IOException
;
/** @author Julien Viet */
public
class
help
extends
BaseCommand
{
@Usage
(
"provides basic help"
)
@Command
public
void
main
(
InvocationContext
<
Object
>
context
)
throws
IOException
{
//
TableElement
table
=
new
TableElement
().
rightCellPadding
(
1
);
table
.
add
(
new
RowElement
().
add
(
new
LabelElement
(
"NAME"
).
style
(
Style
.
style
(
Decoration
.
bold
))).
add
(
new
LabelElement
(
"DESCRIPTION"
)));
//
CRaSH
crash
=
(
CRaSH
)
context
.
getSession
().
get
(
"crash"
);
Iterable
<
String
>
names
=
crash
.
getCommandNames
();
for
(
String
name
:
names
)
{
try
{
ShellCommand
cmd
=
crash
.
getCommand
(
name
);
if
(
cmd
!=
null
)
{
String
desc
=
cmd
.
describe
(
name
,
DescriptionFormat
.
DESCRIBE
);
if
(
desc
==
null
)
{
desc
=
""
;
}
table
.
add
(
new
RowElement
().
add
(
new
LabelElement
(
name
).
style
(
Style
.
style
(
Color
.
red
))).
add
(
new
LabelElement
(
desc
)));
}
}
catch
(
Exception
ignore
)
{
//
}
}
//
context
.
provide
(
new
LabelElement
(
"Try one of these commands with the -h or --help switch:\n"
));
context
.
provide
(
table
);
}
}
spring-boot-starters/spring-boot-starter-shell-remote/src/main/resources/commands/crash/jmx.groovy
deleted
100644 → 0
View file @
e16e2323
package
crash.commands.base
;
import
org.crsh.cli.Argument
;
import
org.crsh.cli.Command
;
import
org.crsh.cli.Option
;
import
org.crsh.cli.Usage
;
import
org.crsh.command.BaseCommand
;
import
org.crsh.command.InvocationContext
;
import
org.crsh.command.PipeCommand
;
import
org.crsh.command.ScriptException
;
import
javax.management.JMException
;
import
javax.management.MBeanAttributeInfo
;
import
javax.management.MBeanInfo
;
import
javax.management.MBeanServer
;
import
javax.management.ObjectInstance
;
import
javax.management.ObjectName
;
import
java.io.IOException
;
import
java.lang.management.ManagementFactory
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
/** @author Julien Viet */
@Usage
(
"Java Management Extensions"
)
public
class
jmx
extends
BaseCommand
{
@Usage
(
"find mbeans"
)
@Command
public
void
find
(
InvocationContext
<
ObjectName
>
context
,
@Usage
(
"The object name pattern"
)
@Option
(
names
=[
"p"
,
"pattern"
])
String
pattern
)
throws
Exception
{
//
ObjectName
patternName
=
pattern
!=
null
?
ObjectName
.
getInstance
(
pattern
)
:
null
;
MBeanServer
server
=
ManagementFactory
.
getPlatformMBeanServer
();
Set
<
ObjectInstance
>
instances
=
server
.
queryMBeans
(
patternName
,
null
);
for
(
ObjectInstance
instance
:
instances
)
{
context
.
provide
(
instance
.
getObjectName
());
}
/*
if (context.piped) {
} else {
UIBuilder ui = new UIBuilder()
ui.table(columns: [1,3]) {
row(bold: true, fg: black, bg: white) {
label("CLASS NAME"); label("OBJECT NAME")
}
instances.each { instance ->
row() {
label(foreground: red, instance.getClassName()); label(instance.objectName)
}
}
}
out << ui;
}
*/
}
@Command
@Usage
(
"return the attributes info of an MBean"
)
public
void
attributes
(
InvocationContext
<
Map
>
context
,
@Argument
ObjectName
name
)
throws
IOException
{
MBeanServer
server
=
ManagementFactory
.
getPlatformMBeanServer
();
try
{
MBeanInfo
info
=
server
.
getMBeanInfo
(
name
);
for
(
MBeanAttributeInfo
attributeInfo
:
info
.
getAttributes
())
{
HashMap
<
String
,
Object
>
tuple
=
new
HashMap
<
String
,
Object
>();
tuple
.
put
(
"name"
,
attributeInfo
.
getName
());
tuple
.
put
(
"type"
,
attributeInfo
.
getType
());
tuple
.
put
(
"description"
,
attributeInfo
.
getDescription
());
context
.
provide
(
tuple
);
}
}
catch
(
JMException
e
)
{
throw
new
ScriptException
(
"Could not access MBean meta data"
,
e
);
}
}
@Usage
(
"get attributes of an MBean"
)
@Command
public
PipeCommand
<
ObjectName
,
Map
>
get
(
@Argument
final
List
<
String
>
attributes
)
{
// Determine common attributes from all names
if
(
attributes
==
null
||
attributes
.
isEmpty
())
{
throw
new
ScriptException
(
"Must provide JMX attributes"
);
}
//
return
new
PipeCommand
<
ObjectName
,
Map
>()
{
/** . */
private
MBeanServer
server
;
@Override
public
void
open
()
throws
ScriptException
{
server
=
ManagementFactory
.
getPlatformMBeanServer
();
}
@Override
public
void
provide
(
ObjectName
name
)
throws
IOException
{
try
{
HashMap
<
String
,
Object
>
tuple
=
new
HashMap
<
String
,
Object
>();
for
(
String
attribute
:
attributes
)
{
String
prop
=
name
.
getKeyProperty
(
attribute
);
if
(
prop
!=
null
)
{
tuple
.
put
(
attribute
,
prop
);
}
else
{
tuple
.
put
(
attribute
,
server
.
getAttribute
(
name
,
attribute
));
}
}
context
.
provide
(
tuple
);
}
catch
(
JMException
ignore
)
{
//
}
}
};
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment