mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 06:22:01 -08:00
* Removed the LogServices (H2 DB file that logs actions).
This commit is contained in:
parent
e1ca3b5cc5
commit
88af59697e
4 changed files with 3 additions and 216 deletions
|
|
@ -3,9 +3,8 @@ package com.xmage.ws.resource;
|
|||
import com.xmage.core.decorators.Decorator;
|
||||
import com.xmage.ws.model.DomainErrors;
|
||||
import com.xmage.ws.representer.Representer;
|
||||
import net.minidev.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import net.minidev.json.JSONObject;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -19,8 +18,8 @@ public abstract class DefaultResource<R> implements Resource<R> {
|
|||
|
||||
protected Representer<R> representer;
|
||||
|
||||
protected java.util.List<Decorator> decorators = new ArrayList<Decorator>();
|
||||
|
||||
protected java.util.List<Decorator> decorators = new ArrayList<>();
|
||||
|
||||
protected int version;
|
||||
|
||||
protected DefaultResource(Representer<R> representer) {
|
||||
|
|
|
|||
|
|
@ -1,51 +0,0 @@
|
|||
package com.xmage.ws.resource;
|
||||
|
||||
import com.xmage.core.entity.model.ServerStats;
|
||||
import com.xmage.core.entity.repositories.XMageStatsRepository;
|
||||
import com.xmage.core.entity.repositories.impl.XMageStatsRepositoryImpl;
|
||||
import com.xmage.ws.model.DomainErrors;
|
||||
import com.xmage.ws.representer.XMageStatsRepresenter;
|
||||
import com.xmage.ws.representer.Representer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class XMageStatsResource extends DefaultResource<ServerStats> {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(XMageStatsResource.class);
|
||||
|
||||
private static XMageStatsRepository xmageStatsRepository = new XMageStatsRepositoryImpl();
|
||||
|
||||
private static final Representer<ServerStats> defaultRepresenter = new XMageStatsRepresenter();
|
||||
|
||||
public XMageStatsResource() {
|
||||
super(defaultRepresenter);
|
||||
}
|
||||
|
||||
public XMageStatsResource(ServerStats event) {
|
||||
super(defaultRepresenter);
|
||||
defaultResource = event;
|
||||
}
|
||||
|
||||
public Resource getAll() {
|
||||
try {
|
||||
ServerStats serverStats = xmageStatsRepository.getServerStats();
|
||||
if (serverStats != null) {
|
||||
defaultResource = serverStats;
|
||||
} else {
|
||||
error = DomainErrors.Errors.STATUS_NOT_FOUND;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Getting server stats error:", e);
|
||||
error = DomainErrors.Errors.STATUS_SERVER_ERROR;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "serverStats";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue