ENTAXY-480 release version 1.8.3
This commit is contained in:
@ -0,0 +1,38 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-producing-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.core.producer.shell;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
@Service
|
||||
@Command(scope = EntaxyProducerServiceSupport.SCOPE, name = "factory-configuration")
|
||||
public class FactoryConfiguration extends FactoryAwareCommand {
|
||||
|
||||
@Override
|
||||
protected Object doExecute() throws Exception {
|
||||
|
||||
// OUTPUT TO SHELL
|
||||
System.out.println(entaxyFactory.getJsonConfiguration());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-producing-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.core.producer.shell;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Action;
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Reference;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import org.apache.karaf.shell.support.table.ShellTable;
|
||||
import ru.entaxy.platform.base.objects.factory.tracker.TrackedFactoryManager;
|
||||
import ru.entaxy.platform.base.objects.factory.tracker.TrackedFactoryManager.TrackedManagedFactory;
|
||||
|
||||
@Service
|
||||
@Command(scope = EntaxyProducerServiceSupport.SCOPE, name = "factory-manager-status")
|
||||
public class FactoryManagerStatus implements Action {
|
||||
|
||||
@Reference
|
||||
TrackedFactoryManager factoryManager;
|
||||
|
||||
@Override
|
||||
public Object execute() throws Exception {
|
||||
|
||||
ShellTable table = new ShellTable();
|
||||
table.column("ID");
|
||||
table.column("Active");
|
||||
table.column("Consistent");
|
||||
table.column("Up2date");
|
||||
table.column("Parent");
|
||||
table.column("Requires");
|
||||
|
||||
for (TrackedManagedFactory tmf: factoryManager.getManagedFactories()) {
|
||||
final List<String> waiting = tmf.waitingFor;
|
||||
table.addRow().addContent(
|
||||
tmf.factoryId
|
||||
, tmf.isActive?"*":""
|
||||
, tmf.isConsistent()?"*":""
|
||||
, tmf.isUpToDate?"*":""
|
||||
, decorate(tmf.parent, waiting)
|
||||
, tmf.requirements.stream().map(s -> decorate(s, waiting))
|
||||
.collect(Collectors.joining(","))
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
// OUTPUT TO SHELL
|
||||
table.print(System.out);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String decorate(String test, List<String> values) {
|
||||
if (values.contains(test))
|
||||
return "*" + test;
|
||||
return test;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-producing-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.core.producer.shell;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import org.apache.karaf.shell.support.table.ShellTable;
|
||||
|
||||
@Service
|
||||
@Command(scope = EntaxyProducerServiceSupport.SCOPE, name = "factory-type-info")
|
||||
public class FactoryTypeInfo extends FactoryAwareCommand {
|
||||
|
||||
@Override
|
||||
protected Object doExecute() throws Exception {
|
||||
|
||||
ShellTable table = new ShellTable();
|
||||
table.column("Name");
|
||||
table.column("Value");
|
||||
|
||||
Map<String, Object> typeInfo = entaxyFactory.getTypeInfo();
|
||||
|
||||
for (Entry<String, Object> entry: typeInfo.entrySet()) {
|
||||
table.addRow().addContent(
|
||||
entry.getKey(),
|
||||
entry.getValue()==null?"":entry.getValue().toString()
|
||||
);
|
||||
}
|
||||
|
||||
table.print(System.out);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user