use of org.apache.ofbiz.base.component.ComponentConfig in project ofbiz-framework by apache.
the class LabelManagerFactory method loadComponentNames.
protected static void loadComponentNames() {
componentNamesFound = new TreeSet<String>();
Collection<ComponentConfig> componentConfigs = ComponentConfig.getAllComponents();
for (ComponentConfig componentConfig : componentConfigs) {
componentNamesFound.add(componentConfig.getComponentName());
}
}
use of org.apache.ofbiz.base.component.ComponentConfig in project ofbiz-framework by apache.
the class UtilJavaParse method findRealPathAndFileForClass.
public static String findRealPathAndFileForClass(String fullyQualifiedClassName) {
// search through the component directories, in the src directory for each, using the class path as the path within it
String sourceSubPath = fullyQualifiedClassName.substring(0, fullyQualifiedClassName.lastIndexOf(".")).replace('.', File.separatorChar);
String classFileName = fullyQualifiedClassName.substring(fullyQualifiedClassName.lastIndexOf(".") + 1) + ".java";
Collection<ComponentConfig> allComponentConfigs = ComponentConfig.getAllComponents();
for (ComponentConfig cc : allComponentConfigs) {
String rootDirectory = cc.getRootLocation();
if (!rootDirectory.endsWith(File.separatorChar + "")) {
rootDirectory += File.separatorChar;
}
rootDirectory += "src" + File.separatorChar;
File rootDirFile = new File(rootDirectory);
if (!rootDirFile.exists()) {
// no src directory, move along
continue;
}
String classDir = rootDirectory + sourceSubPath;
File classDirFile = new File(classDir);
if (!classDirFile.exists()) {
// no src class sub-directory, move along
continue;
}
String fullPathAndFile = classDir + File.separatorChar + classFileName;
File classFile = new File(fullPathAndFile);
if (classFile.exists()) {
if (Debug.verboseOn()) {
Debug.logVerbose("In findRealPathAndFileForClass for [" + fullyQualifiedClassName + "]: [" + fullPathAndFile + "]", module);
}
return fullPathAndFile;
}
}
return null;
}
use of org.apache.ofbiz.base.component.ComponentConfig in project ofbiz-framework by apache.
the class ArtifactInfoFactory method prepareAll.
public void prepareAll() throws GeneralException {
Debug.logInfo("Loading artifact info objects...", module);
List<Future<Void>> futures = new ArrayList<Future<Void>>();
Set<String> entityNames = this.getEntityModelReader().getEntityNames();
for (String entityName : entityNames) {
this.getEntityArtifactInfo(entityName);
}
Set<String> serviceNames = this.getDispatchContext().getAllServiceNames();
for (String serviceName : serviceNames) {
futures.add(ExecutionPool.GLOBAL_FORK_JOIN.submit(prepareTaskForServiceAnalysis(serviceName)));
}
// how to get all Service ECAs to prepare? don't worry about it, will be populated from service load, ie all ECAs for each service
Collection<ComponentConfig> componentConfigs = ComponentConfig.getAllComponents();
ExecutionPool.getAllFutures(futures);
futures = new ArrayList<Future<Void>>();
for (ComponentConfig componentConfig : componentConfigs) {
futures.add(ExecutionPool.GLOBAL_FORK_JOIN.submit(prepareTaskForComponentAnalysis(componentConfig)));
}
ExecutionPool.getAllFutures(futures);
Debug.logInfo("Artifact info objects loaded.", module);
}
use of org.apache.ofbiz.base.component.ComponentConfig in project ofbiz-framework by apache.
the class EntityDataLoadContainer method createOrUpdateComponentEntities.
private void createOrUpdateComponentEntities(Delegator baseDelegator, Collection<ComponentConfig> allComponents) {
for (ComponentConfig config : allComponents) {
GenericValue componentEntry = baseDelegator.makeValue("Component");
componentEntry.set("componentName", config.getComponentName());
componentEntry.set("rootLocation", config.getRootLocation());
try {
GenericValue componentCheck = EntityQuery.use(baseDelegator).from("Component").where("componentName", config.getComponentName()).queryOne();
if (UtilValidate.isEmpty(componentCheck)) {
componentEntry.create();
} else {
componentEntry.store();
}
} catch (GenericEntityException e) {
Debug.logError(e.getMessage(), module);
}
}
}
use of org.apache.ofbiz.base.component.ComponentConfig in project ofbiz-framework by apache.
the class EntityDataLoadContainer method loadDataForDelegator.
private void loadDataForDelegator(Map<String, String> loadDataProps, Configuration configuration, Property delegatorNameProp, String overrideDelegator) throws ContainerException {
// prepare command line properties passed by user
boolean createPks = isPropertySet(loadDataProps, CREATE_P_KEYS);
boolean dropPks = isPropertySet(loadDataProps, DROP_P_KEYS);
boolean createConstraints = isPropertySet(loadDataProps, CREATE_CONSTRAINTS);
boolean dropConstraints = isPropertySet(loadDataProps, DROP_CONSTRAINTS);
boolean repairColumns = isPropertySet(loadDataProps, REPAIR_COLUMNS);
String entityGroup = getEntityGroupNameFromConfig(configuration, loadDataProps.get(DATA_GROUP));
// prepare objects needed for the data loading logic
Delegator delegator = getDelegator(delegatorNameProp, overrideDelegator);
Delegator baseDelegator = getBaseDelegator(delegator);
GenericHelperInfo helperInfo = getHelperInfo(delegator, entityGroup);
DatabaseUtil dbUtil = new DatabaseUtil(helperInfo);
Map<String, ModelEntity> modelEntities = getModelEntities(delegator, entityGroup);
TreeSet<String> modelEntityNames = new TreeSet<String>(modelEntities.keySet());
Collection<ComponentConfig> allComponents = ComponentConfig.getAllComponents();
// data loading logic starts here
createOrUpdateComponentEntities(baseDelegator, allComponents);
if (dropConstraints) {
dropDbConstraints(dbUtil, modelEntities, modelEntityNames);
}
if (dropPks) {
dropPrimaryKeys(dbUtil, modelEntities, modelEntityNames);
}
if (repairColumns) {
repairDbColumns(dbUtil, modelEntities);
}
loadData(delegator, baseDelegator, allComponents, helperInfo, loadDataProps);
if (createPks) {
createPrimaryKeys(dbUtil, modelEntities, modelEntityNames);
}
if (createConstraints) {
createDbConstraints(dbUtil, modelEntities, modelEntityNames);
}
}
Aggregations