Bringing data print back to artemis_home without instance defined.

This is useful to debug data from tests and user's exports.
This commit is contained in:
Clebert Suconic 2015-09-24 21:27:14 -04:00
parent d58be06c32
commit b0b5ca6896
4 changed files with 12 additions and 6 deletions

View File

@ -108,6 +108,8 @@ public class Artemis {
builder = builder.withCommands(Run.class, Stop.class, Kill.class);
}
else {
builder.withGroup("data").withDescription("data tools group (print) (example ./artemis data print)").
withDefaultCommand(HelpData.class).withCommands(PrintData.class);
builder = builder.withCommand(Create.class);
}

View File

@ -57,10 +57,6 @@ public abstract class ActionAbstract implements Action {
brokerInstance = brokerInstance.replace("\\", "/");
System.setProperty("artemis.instance", brokerInstance);
}
if (brokerInstance == null) {
// if still null we will try to improvise with "."
brokerInstance = ".";
}
}
return brokerInstance;
}

View File

@ -126,6 +126,7 @@ public abstract class Configurable extends ActionAbstract {
fileConfiguration.setJournalDirectory(defaultLocation + "/journal");
fileConfiguration.setLargeMessagesDirectory(defaultLocation + "/largemessages");
fileConfiguration.setPagingDirectory(defaultLocation + "/paging");
fileConfiguration.setBrokerInstance(new File("."));
}
else {
fileConfiguration = new FileConfiguration();
@ -135,10 +136,10 @@ public abstract class Configurable extends ActionAbstract {
FileDeploymentManager fileDeploymentManager = new FileDeploymentManager(serverConfiguration);
fileDeploymentManager.addDeployable(fileConfiguration).addDeployable(jmsConfiguration);
fileDeploymentManager.readConfiguration();
fileConfiguration.setBrokerInstance(new File(getBrokerInstance()));
}
}
fileConfiguration.setBrokerInstance(new File(getBrokerInstance()));
return fileConfiguration;
}

View File

@ -24,7 +24,14 @@ public abstract class LockAbstract extends DataAbstract implements Action {
@Override
public Object execute(ActionContext context) throws Exception {
super.execute(context);
lockCLI(getLockPlace());
if (getBrokerInstance() == null) {
System.err.println("Warning: You are running a data tool outside of any broker instance. Modifying data on a running server might break the server's data");
System.err.println();
}
else {
lockCLI(getLockPlace());
}
return null;
}