Search in sources :

Example 1 with LabeledString

use of com.evolveum.midpoint.schema.LabeledString in project midpoint by Evolveum.

the class PageAbout method initLayout.

private void initLayout() {
    Label branch = new Label(ID_BRANCH, createStringResource("midpoint.system.branch"));
    branch.setRenderBodyOnly(true);
    add(branch);
    Label revision = new Label(ID_BUILD, createStringResource("midpoint.system.build"));
    revision.setRenderBodyOnly(true);
    add(revision);
    Label build = new Label(ID_BUILD_TIMESTAMP, createStringResource("midpoint.system.buildTimestamp"));
    build.setRenderBodyOnly(true);
    add(build);
    ListView<SystemItem> listSystemItems = new ListView<SystemItem>(ID_LIST_SYSTEM_ITEMS, getItems()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<SystemItem> item) {
            SystemItem systemItem = item.getModelObject();
            Label property = new Label(ID_PROPERTY, systemItem.getProperty());
            property.setRenderBodyOnly(true);
            item.add(property);
            Label value = new Label(ID_VALUE, systemItem.getValue());
            value.setRenderBodyOnly(true);
            item.add(value);
        }
    };
    add(listSystemItems);
    addLabel(ID_IMPLEMENTATION_SHORT_NAME, "implementationShortName");
    addLabel(ID_IMPLEMENTATION_DESCRIPTION, "implementationDescription");
    addLabel(ID_IS_EMBEDDED, "isEmbedded");
    addLabel(ID_DRIVER_SHORT_NAME, "driverShortName");
    addLabel(ID_DRIVER_VERSION, "driverVersion");
    addLabel(ID_REPOSITORY_URL, "repositoryUrl");
    ListView<LabeledString> additionalDetails = new ListView<LabeledString>(ID_ADDITIONAL_DETAILS, new PropertyModel<>(repoDiagModel, "additionalDetails")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<LabeledString> item) {
            LabeledString labeledString = item.getModelObject();
            Label property = new Label(ID_DETAIL_NAME, labeledString.getLabel());
            property.setRenderBodyOnly(true);
            item.add(property);
            Label value = new Label(ID_DETAIL_VALUE, labeledString.getData());
            value.setRenderBodyOnly(true);
            item.add(value);
        }
    };
    add(additionalDetails);
    ListView<LabeledString> provisioningAdditionalDetails = new ListView<LabeledString>(ID_PROVISIONING_ADDITIONAL_DETAILS, new PropertyModel<>(provisioningDiagModel, "additionalDetails")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void populateItem(ListItem<LabeledString> item) {
            LabeledString labeledString = item.getModelObject();
            Label property = new Label(ID_PROVISIONING_DETAIL_NAME, labeledString.getLabel());
            property.setRenderBodyOnly(true);
            item.add(property);
            Label value = new Label(ID_PROVISIONING_DETAIL_VALUE, labeledString.getData());
            value.setRenderBodyOnly(true);
            item.add(value);
        }
    };
    add(provisioningAdditionalDetails);
    String nodeId = getTaskManager().getNodeId();
    OperationResult result = new OperationResult(OPERATION_LOAD_NODE);
    List<PrismObject<NodeType>> nodes = WebModelServiceUtils.searchObjects(NodeType.class, getPrismContext().queryFor(NodeType.class).item(NodeType.F_NODE_IDENTIFIER).eq(nodeId).build(), result, PageAbout.this);
    if (nodes.isEmpty()) {
        throw new IllegalArgumentException("Couldn't find NodeType with identifier '" + nodeId + "'");
    }
    if (nodes.size() > 1) {
        throw new IllegalArgumentException("Found more as one NodeType with identifier '" + nodeId + "'");
    }
    PrismObject<NodeType> node = nodes.get(0);
    if (node == null) {
        throw new IllegalArgumentException("Found NodeType with identifier '" + nodeId + "' is null");
    }
    NodeType nodeType = node.asObjectable();
    Label nodeName = new Label(ID_NODE_NAME, nodeType.getName() != null ? nodeType.getName() : "");
    nodeName.setRenderBodyOnly(true);
    add(nodeName);
    Label nodeIdValue = new Label(ID_NODE_ID, nodeType.getNodeIdentifier());
    nodeIdValue.setRenderBodyOnly(true);
    add(nodeIdValue);
    Label nodeUrl = new Label(ID_NODE_URL, nodeType.getUrl() != null ? nodeType.getUrl() : "");
    nodeUrl.setRenderBodyOnly(true);
    add(nodeUrl);
    Label jvmProperties = new Label(ID_JVM_PROPERTIES, new LoadableModel<String>(false) {

        private static final long serialVersionUID = 1L;

        @Override
        protected String load() {
            try {
                RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
                List<String> arguments = runtimeMxBean.getInputArguments();
                return StringUtils.join(arguments, "<br/>");
            } catch (Exception ex) {
                return PageAbout.this.getString("PageAbout.message.couldntObtainJvmParams");
            }
        }
    });
    jvmProperties.setEscapeModelStrings(false);
    add(jvmProperties);
    initButtons();
}
Also used : Label(org.apache.wicket.markup.html.basic.Label) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) LabeledString(com.evolveum.midpoint.schema.LabeledString) RuntimeMXBean(java.lang.management.RuntimeMXBean) RestartResponseException(org.apache.wicket.RestartResponseException) PrismObject(com.evolveum.midpoint.prism.PrismObject) ListView(org.apache.wicket.markup.html.list.ListView) NodeType(com.evolveum.midpoint.xml.ns._public.common.common_3.NodeType) List(java.util.List) ArrayList(java.util.ArrayList) ListItem(org.apache.wicket.markup.html.list.ListItem) LabeledString(com.evolveum.midpoint.schema.LabeledString)

Example 2 with LabeledString

use of com.evolveum.midpoint.schema.LabeledString in project midpoint by Evolveum.

the class InfoRepositoryAction method execute.

@Override
public void execute() {
    MidpointConfiguration config = context.getMidpointConfiguration();
    System.out.println("MidPoint home: " + config.getMidpointHome());
    System.out.println("Java home: " + System.getProperty("java.home"));
    RepositoryService repository = context.getRepository();
    OperationResult repoTestResult = new OperationResult("repo.test");
    repository.repositorySelfTest(repoTestResult);
    repoTestResult.close();
    System.out.println("Repository test: " + repoTestResult.getStatus());
    try {
        RepositoryDiag repositoryDiag = repository.getRepositoryDiag();
        System.out.println("Repository diag:" + "\n Type: " + repositoryDiag.getImplementationShortName() + "\n Description: " + repositoryDiag.getImplementationDescription() + "\n JDBC URL: " + repositoryDiag.getRepositoryUrl() + "\n Driver type: " + repositoryDiag.getDriverShortName() + "\n Driver version: " + repositoryDiag.getDriverVersion() + "\n Additional details:");
        for (LabeledString detail : repositoryDiag.getAdditionalDetails()) {
            System.out.println(" - " + detail.getLabel() + ": " + detail.getData());
        }
    } catch (Exception e) {
        // Fatal crash during Ninja start is more likely than this, but just to be sure...
        System.err.println("Unexpected problem during repo diag: " + e);
    }
}
Also used : MidpointConfiguration(com.evolveum.midpoint.common.configuration.api.MidpointConfiguration) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RepositoryDiag(com.evolveum.midpoint.schema.RepositoryDiag) LabeledString(com.evolveum.midpoint.schema.LabeledString) RepositoryService(com.evolveum.midpoint.repo.api.RepositoryService)

Example 3 with LabeledString

use of com.evolveum.midpoint.schema.LabeledString in project midpoint by Evolveum.

the class ProvisioningServiceImpl method getProvisioningDiag.

@Override
public ProvisioningDiag getProvisioningDiag() {
    ProvisioningDiag provisioningDiag = new ProvisioningDiag();
    String frameworkVersion = connectorManager.getFrameworkVersion();
    if (frameworkVersion == null) {
        frameworkVersion = "unknown";
    }
    provisioningDiag.getAdditionalDetails().add(new LabeledString(DETAILS_CONNECTOR_FRAMEWORK_VERSION, frameworkVersion));
    return provisioningDiag;
}
Also used : ProvisioningDiag(com.evolveum.midpoint.schema.ProvisioningDiag) LabeledString(com.evolveum.midpoint.schema.LabeledString) LabeledString(com.evolveum.midpoint.schema.LabeledString)

Aggregations

LabeledString (com.evolveum.midpoint.schema.LabeledString)3 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 MidpointConfiguration (com.evolveum.midpoint.common.configuration.api.MidpointConfiguration)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 RepositoryService (com.evolveum.midpoint.repo.api.RepositoryService)1 ProvisioningDiag (com.evolveum.midpoint.schema.ProvisioningDiag)1 RepositoryDiag (com.evolveum.midpoint.schema.RepositoryDiag)1 NodeType (com.evolveum.midpoint.xml.ns._public.common.common_3.NodeType)1 RuntimeMXBean (java.lang.management.RuntimeMXBean)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 RestartResponseException (org.apache.wicket.RestartResponseException)1 Label (org.apache.wicket.markup.html.basic.Label)1 ListItem (org.apache.wicket.markup.html.list.ListItem)1 ListView (org.apache.wicket.markup.html.list.ListView)1