[Minor] code cleanup

This commit is contained in:
Robert von Burg 2014-09-14 12:20:38 +02:00
parent bf1db41f52
commit 97aa9117ec
14 changed files with 28 additions and 31 deletions

View File

@ -63,9 +63,8 @@ public class AgentVersion extends AbstractVersion {
@SuppressWarnings("nls")
@Override
public String toString() {
return "AgentVersion [agentName=" + this.agentName + ", groupId=" + this.getGroupId() + ", artifactId="
+ this.getArtifactId() + ", artifactVersion=" + this.getArtifactVersion() + ", scmRevision="
+ this.getScmRevision() + ", scmBranch=" + this.getScmBranch() + ", buildTimestamp="
+ this.getBuildTimestamp() + "]";
return "AgentVersion [agentName=" + this.agentName + ", groupId=" + getGroupId() + ", artifactId="
+ getArtifactId() + ", artifactVersion=" + getArtifactVersion() + ", scmRevision=" + getScmRevision()
+ ", scmBranch=" + getScmBranch() + ", buildTimestamp=" + getBuildTimestamp() + "]";
}
}

View File

@ -63,9 +63,8 @@ public class ComponentVersion extends AbstractVersion {
@SuppressWarnings("nls")
@Override
public String toString() {
return "ComponentVersion [componentName=" + this.componentName + ", groupId=" + this.getGroupId()
+ ", artifactId=" + this.getArtifactId() + ", artifactVersion=" + this.getArtifactVersion()
+ ", scmRevision=" + this.getScmRevision() + ", scmBranch=" + this.getScmBranch() + ", buildTimestamp="
+ this.getBuildTimestamp() + "]";
return "ComponentVersion [componentName=" + this.componentName + ", groupId=" + getGroupId() + ", artifactId="
+ getArtifactId() + ", artifactVersion=" + getArtifactVersion() + ", scmRevision=" + getScmRevision()
+ ", scmBranch=" + getScmBranch() + ", buildTimestamp=" + getBuildTimestamp() + "]";
}
}

View File

@ -306,8 +306,8 @@ public class ComponentContainerImpl implements ComponentContainer {
this.state = this.state.validateStateChange(ComponentState.STARTED);
String msg = "All {0} Strolch Components started. {1}:{2} is now ready to be used. Have fun =))"; //$NON-NLS-1$
logger.info(MessageFormat.format(msg, this.controllerMap.size(), getAgent().getApplicationName(), this
.getAgent().getStrolchConfiguration().getRuntimeConfiguration().getEnvironment()));
logger.info(MessageFormat.format(msg, this.controllerMap.size(), getAgent().getApplicationName(), getAgent()
.getStrolchConfiguration().getRuntimeConfiguration().getEnvironment()));
logger.info(MessageFormat.format("System: {0}", SystemHelper.asString())); //$NON-NLS-1$
logger.info(MessageFormat.format("Memory: {0}", SystemHelper.getMemorySummary())); //$NON-NLS-1$
}

View File

@ -63,7 +63,7 @@ public class ComponentController {
public void addUpstreamDependency(ComponentController controller) {
if (this.equals(controller)) {
if (equals(controller)) {
String msg = "{0} can not depend on itself!"; //$NON-NLS-1$
msg = MessageFormat.format(msg, controller);
throw new StrolchConfigurationException(msg);

View File

@ -90,11 +90,11 @@ public class DefaultLockHandler implements LockHandler {
if (!lock.tryLock(tryLockTime, timeUnit)) {
String msg = "Failed to acquire lock after {0}s for {1}"; //$NON-NLS-1$
msg = MessageFormat.format(msg, timeUnit.toSeconds(tryLockTime), this.toString());
msg = MessageFormat.format(msg, timeUnit.toSeconds(tryLockTime), toString());
throw new StrolchException(msg);
}
if (logger.isDebugEnabled())
logger.debug("locked " + this.toString()); //$NON-NLS-1$
logger.debug("locked " + toString()); //$NON-NLS-1$
} catch (InterruptedException e) {
throw new StrolchException("Thread interrupted: " + e.getMessage(), e); //$NON-NLS-1$
}
@ -106,6 +106,6 @@ public class DefaultLockHandler implements LockHandler {
private void unlock(ReentrantLock lock) {
lock.unlock();
if (logger.isDebugEnabled())
logger.debug("unlocking " + this.toString()); //$NON-NLS-1$
logger.debug("unlocking " + toString()); //$NON-NLS-1$
}
}

View File

@ -52,7 +52,7 @@ public class TransactionalAuditTrail implements AuditTrail {
public long querySize(StrolchTransaction tx, String type, DateRange dateRange) {
return getDao(tx).querySize(type, dateRange);
}
@Override
public Set<String> getTypes(StrolchTransaction tx) {
return getDao(tx).queryTypes();

View File

@ -54,8 +54,8 @@ public interface StrolchDao<T extends StrolchElement> {
public void remove(T element);
public void removeAll(List<T> elements);
public long removeAll();
public long removeAllBy(String type);
}

View File

@ -31,7 +31,8 @@ public class ConfigurationParser {
public static StrolchConfiguration parseConfiguration(String environment, File rootPathF) {
DBC.PRE.assertNotEmpty("environment value must be set!", environment); //$NON-NLS-1$
DBC.PRE.assertNotNull("roothPath must be set!", rootPathF); //$NON-NLS-1$
DBC.PRE.assertNotEquals("environment must be a value other than 'global'!", ConfigurationTags.ENV_GLOBAL, environment); //$NON-NLS-1$
DBC.PRE.assertNotEquals(
"environment must be a value other than 'global'!", ConfigurationTags.ENV_GLOBAL, environment); //$NON-NLS-1$
if (!rootPathF.isDirectory() || !rootPathF.canRead()) {
String msg = "Root path is not readable at {0}"; //$NON-NLS-1$

View File

@ -114,7 +114,7 @@ public class RuntimeConfiguration extends AbstractionConfiguration {
File configFile = new File(getDataPath(), fileName);
if (checkExists && !configFile.isFile() || !configFile.canRead()) {
String msg = "[{0}] requires config file which does not exist with name: {1}"; //$NON-NLS-1$
msg = MessageFormat.format(msg, this.getName(), context, fileName);
msg = MessageFormat.format(msg, getName(), context, fileName);
throw new StrolchConfigurationException(msg);
}
return configFile;
@ -136,7 +136,7 @@ public class RuntimeConfiguration extends AbstractionConfiguration {
File dataFile = new File(getDataPath(), fileName);
if (checkExists && !dataFile.isFile() || !dataFile.canRead()) {
String msg = "[{0}] requires data file which does not exist with name: {1}"; //$NON-NLS-1$
msg = MessageFormat.format(msg, this.getName(), context, fileName);
msg = MessageFormat.format(msg, getName(), context, fileName);
throw new StrolchConfigurationException(msg);
}
return dataFile;
@ -158,7 +158,7 @@ public class RuntimeConfiguration extends AbstractionConfiguration {
File dataDir = new File(getDataPath(), dirName);
if (checkExists && !dataDir.isDirectory() || !dataDir.canRead()) {
String msg = "[{0}] requires data directory which does not exist with name: {1}"; //$NON-NLS-1$
msg = MessageFormat.format(msg, this.getName(), context, dirName);
msg = MessageFormat.format(msg, getName(), context, dirName);
throw new StrolchConfigurationException(msg);
}
return dataDir;

View File

@ -86,10 +86,10 @@ public class MainStarter {
}
logger.info("Starting Agent...");
this.setAgent(new StrolchAgent());
this.getAgent().setup(env, pathF);
this.getAgent().initialize();
this.getAgent().start();
setAgent(new StrolchAgent());
getAgent().setup(env, pathF);
getAgent().initialize();
getAgent().start();
final AtomicBoolean atomicBoolean = new AtomicBoolean();
@ -113,7 +113,7 @@ public class MainStarter {
});
logger.info("");
logger.info("Strolch application " + this.getAgent().getApplicationName() + " started ");
logger.info("Strolch application " + getAgent().getApplicationName() + " started ");
while (!atomicBoolean.get()) {
synchronized (MainStarter.class) {
try {

View File

@ -85,8 +85,7 @@ public class DefaultEnumHandler extends StrolchComponent implements EnumHandler
if (enumLocator == null)
throw new StrolchException(MessageFormat.format("No enumeration is configured for the name {0}", name)); //$NON-NLS-1$
try (StrolchTransaction tx = getContainer().getRealm(this.realm).openTx(certificate,
EnumHandler.class)) {
try (StrolchTransaction tx = getContainer().getRealm(this.realm).openTx(certificate, EnumHandler.class)) {
Resource enumeration = tx.findElement(enumLocator);
ParameterBag enumValuesByLanguage = findParameterBagByLanguage(enumeration, locale);

View File

@ -18,7 +18,7 @@ package li.strolch.service.api;
import ch.eitchnet.privilege.model.Certificate;
public interface ServiceHandler {
public <T extends ServiceArgument, U extends ServiceResult> U doService(Certificate certificate,
Service<T, U> service, T argument);

View File

@ -15,7 +15,6 @@
*/
package li.strolch.runtime.configuration.model;
public interface ServiceHandlerTest {
public ServiceResultTest doService();

View File

@ -174,7 +174,7 @@ public class InMemoryQueryTest {
List<Resource> result = dao.doQuery(ballQuery, new NoStrategyResourceVisitor());
assertEquals(1, result.size());
}
@Test
public void shouldQueryByNullParameter3() {
List<Resource> resources = getResources();