use of org.talend.core.ICoreService in project tdi-studio-se by Talend.
the class Log4jSettingPage method performOk.
@Override
public boolean performOk() {
boolean ok = super.performOk();
if (templateTxt != null && !templateTxt.isDisposed()) {
IRunProcessService service = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
service = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
}
if (reset) {
if (service != null) {
Log4jPrefsSettingManager.getInstance().saveLog4jNodeIntoPref(Log4jPrefsConstants.LOG4J_ENABLE_NODE, String.valueOf(false));
Log4jPrefsSettingManager.getInstance().saveLog4jNodeIntoPref(Log4jPrefsConstants.LOG4J_CONTENT_NODE, service.getLogTemplate(Log4jPrefsConstants.LOG4JFILEPATH));
}
} else {
if (log4jBtn != null && !log4jBtn.isDisposed()) {
Log4jPrefsSettingManager.getInstance().saveLog4jNodeIntoPref(Log4jPrefsConstants.LOG4J_ENABLE_NODE, String.valueOf(log4jBtn.getSelection()));
}
Log4jPrefsSettingManager.getInstance().saveLog4jNodeIntoPref(Log4jPrefsConstants.LOG4J_CONTENT_NODE, templateTxt.getText());
}
reset = false;
}
// updat the log4j file for code project
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
ICoreService service = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
if (service != null) {
service.syncLog4jSettings();
}
}
return ok;
}
use of org.talend.core.ICoreService in project tesb-studio-se by Talend.
the class ServiceMetadataAction method isLocked.
private static boolean isLocked(IRepositoryViewObject object) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
ICoreService coreService = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
boolean isOpened = coreService.isOpenedItemInEditor(object);
if (isOpened) {
return true;
}
}
ServiceItem serviceItem = (ServiceItem) object.getProperty().getItem();
return serviceItem.getState().isLocked();
}
use of org.talend.core.ICoreService in project tdi-studio-se by Talend.
the class JobJavaScriptsManager method addXmlMapping.
protected void addXmlMapping(ExportFileResource resource, boolean needSource) {
try {
boolean hasDynamicMetadata = false;
if (resource.getItem() instanceof ProcessItem) {
List<JobInfo> list = new ArrayList<JobInfo>();
hasDynamicMetadata = LastGenerationInfo.getInstance().isUseDynamic(resource.getItem().getProperty().getId(), resource.getItem().getProperty().getVersion());
}
if (hasDynamicMetadata) {
needMappingInSystemRoutine = true;
if (needSource) {
IRunProcessService service = CorePlugin.getDefault().getRunProcessService();
ITalendProcessJavaProject talendProcessJavaProject = service.getTalendProcessJavaProject();
if (talendProcessJavaProject == null) {
return;
}
// for db mapping xml
IFolder xmlMappingFolder = talendProcessJavaProject.getResourcesFolder().getFolder(JavaUtils.JAVA_XML_MAPPING);
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
ICoreService coreService = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
coreService.synchronizeMapptingXML();
coreService.syncLog4jSettings();
}
List<URL> xmlMappingFileUrls = new ArrayList<URL>();
if (xmlMappingFolder.exists()) {
for (IResource fileResource : xmlMappingFolder.members()) {
if (XmlUtil.isXMLFile(fileResource.getName())) {
xmlMappingFileUrls.add(fileResource.getLocationURI().toURL());
}
}
resource.addResources(JOB_SOURCE_FOLDER_NAME + PATH_SEPARATOR + JavaUtils.JAVA_XML_MAPPING, xmlMappingFileUrls);
}
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
use of org.talend.core.ICoreService in project tdi-studio-se by Talend.
the class AbstractBuildJobHandler method getProfileArgs.
protected StringBuffer getProfileArgs() {
StringBuffer profileBuffer = new StringBuffer();
profileBuffer.append(TalendMavenConstants.PREFIX_THREAD);
profileBuffer.append(SPACE);
profileBuffer.append(TalendMavenConstants.PREFIX_THREAD_VALUE);
profileBuffer.append(SPACE);
profileBuffer.append(TalendMavenConstants.PREFIX_PROFILE);
profileBuffer.append(SPACE);
// should add the default settings always.
addArg(profileBuffer, true, true, TalendMavenConstants.PROFILE_DEFAULT_SETTING);
addArg(profileBuffer, isOptionChoosed(ExportChoice.needSourceCode), TalendMavenConstants.PROFILE_INCLUDE_JAVA_SOURCES);
// if not binaries, need add maven resources
boolean isBinaries = isOptionChoosed(ExportChoice.binaries);
addArg(profileBuffer, !isBinaries, TalendMavenConstants.PROFILE_INCLUDE_MAVEN_RESOURCES);
// DQ survivorship rules when items not exported.
if (needDQSurvivorshipRules()) {
addArg(profileBuffer, true, TalendMavenConstants.PROFILE_INCLUDE_SURVIVORSHIP_RULES);
}
addArg(profileBuffer, isOptionChoosed(ExportChoice.needJobItem) || itemDependencies, TalendMavenConstants.PROFILE_INCLUDE_ITEMS);
// for binaries
addArg(profileBuffer, isOptionChoosed(ExportChoice.includeLibs), TalendMavenConstants.PROFILE_INCLUDE_LIBS);
addArg(profileBuffer, isBinaries, TalendMavenConstants.PROFILE_INCLUDE_BINARIES);
// add log4j to running.
addArg(profileBuffer, isLog4jEnable() && isBinaries, TalendMavenConstants.PROFILE_INCLUDE_RUNNING_LOG4J);
// add log4j for resources.
addArg(profileBuffer, isLog4jEnable() && !isBinaries, TalendMavenConstants.PROFILE_INCLUDE_LOG4J);
// the running context is only useful, when binaries
addArg(profileBuffer, isBinaries && isOptionChoosed(ExportChoice.needContext), TalendMavenConstants.PROFILE_INCLUDE_CONTEXTS, ProcessUtils.jarNeedsToContainContext());
// for test
addArg(profileBuffer, isOptionChoosed(ExportChoice.includeTestSource), TalendMavenConstants.PROFILE_INCLUDE_TEST_SOURCES);
addArg(profileBuffer, isOptionChoosed(ExportChoice.executeTests), TalendMavenConstants.PROFILE_INCLUDE_TEST_REPORTS);
// xmlMappings folders
addArg(profileBuffer, needXmlMappings(), TalendMavenConstants.PROFILE_INCLUDE_XMLMAPPINGS);
addArg(profileBuffer, needXmlMappings() && isBinaries, TalendMavenConstants.PROFILE_INCLUDE_RUNNING_XMLMAPPINGS);
if (needXmlMappings()) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
ICoreService coreService = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
coreService.synchronizeMapptingXML();
coreService.syncLog4jSettings();
}
}
// If the map doesn't contain the assembly key, then take the default value activation from the POM.
boolean isAssemblyNeeded = exportChoice.get(ExportChoice.needAssembly) == null || isOptionChoosed(ExportChoice.needAssembly);
addArg(profileBuffer, isAssemblyNeeded, TalendMavenConstants.PROFILE_PACKAGING_AND_ASSEMBLY);
// rules
if (needRules()) {
addArg(profileBuffer, true, TalendMavenConstants.PROFILE_INCLUDE_RULES);
}
// pigudfs
if (needPigUDFs()) {
addArg(profileBuffer, isBinaries, TalendMavenConstants.PROFILE_INCLUDE_PIGUDFS_BINARIES);
addArg(profileBuffer, !isBinaries, TalendMavenConstants.PROFILE_INCLUDE_PIGUDFS_JAVA_SOURCES);
}
return profileBuffer;
}
use of org.talend.core.ICoreService in project tdi-studio-se by Talend.
the class ChangeMappingFileMigrationTask method execute.
@Override
public ExecutionResult execute(Project project) {
try {
URL s = MetadataTalendType.getSystemForderURLOfMappingsFile();
changeSAPHanaMappingFile(s);
//$NON-NLS-1$
String dirPath = "/" + MetadataTalendType.INTERNAL_MAPPINGS_FOLDER;
IProject _project = ResourceUtils.getProject(project);
File projectMappingFolder = new ProjectScope(_project).getLocation().append(dirPath).toFile();
if (projectMappingFolder.exists()) {
URL p = MetadataTalendType.getProjectForderURLOfMappingsFile();
changeSAPHanaMappingFile(p);
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
ICoreService service = (ICoreService) GlobalServiceRegister.getDefault().getService(ICoreService.class);
service.synchronizeMapptingXML();
}
}
return ExecutionResult.SUCCESS_NO_ALERT;
} catch (Exception e) {
ExceptionHandler.process(e);
return ExecutionResult.FAILURE;
}
}
Aggregations