package com.teamcenter.rac.kernel; import java.awt.GraphicsEnvironment; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.log4j.Logger; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.jobs.IJobChangeEvent; import org.eclipse.core.runtime.jobs.JobChangeAdapter; import com.teamcenter.rac.aif.AIFShell; import com.teamcenter.rac.aif.kernel.AbstractAIFSession; import com.teamcenter.rac.aif.kernel.InterfaceAIFSessionLogoutListener; import com.teamcenter.rac.kernel.tcservices.TcStatefulnessUtil; import com.teamcenter.rac.util.Instancer; import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.Registry; import com.teamcenter.rac.util.Shell; public class AEShell extends JobChangeAdapter { private static final Logger logger = Logger.getLogger(AEShell.class); private static final int AE_tool_not_found = 9008; private static final String ACTION_OBJECT_SUFFIX = ".ACTION_OBJECT"; private final TCComponentDatasetContext m_datasetContext; private long[] m_lastModifiedDate; private long m_newFileCreatedTime = -9223372036854775808L; private final boolean m_userDefinedDir; private final String m_workingDirName; private final int m_selectedAction; private TCComponentDataset m_selectedDataset; private TCComponentDataset m_version0; private TCComponent m_selectedTool; private String m_selectedFileName; private String m_selectedNamedRef; private String m_selectedMimeType; private String m_searchBy; private File[] m_exportedFiles; private int m_checkedOutState; private boolean m_fileSaved; private int m_statefulnessReg; private final TCSession m_session; private boolean m_readOnly = false; private boolean m_removeFilesAtComplete = true; public AEShell(TCComponentDatasetContext paramTCComponentDatasetContext, String paramString, boolean paramBoolean, int paramInt) { this(paramTCComponentDatasetContext.getDatasetComponent().getSession(), paramTCComponentDatasetContext, paramString, paramBoolean, paramInt); System.out.println("aaaaaaaaaaaaaaaaaaaaaaaa\n"); } public AEShell(TCSession paramTCSession, TCComponentDatasetContext paramTCComponentDatasetContext, String paramString, boolean paramBoolean, int paramInt) { this.m_session = paramTCSession; this.m_datasetContext = paramTCComponentDatasetContext; this.m_workingDirName = paramString; this.m_userDefinedDir = paramBoolean; this.m_selectedAction = paramInt; setAppShellActiveVerdict(true); if (this.m_datasetContext != null) { File[] arrayOfFile = this.m_datasetContext.getFiles(); if (arrayOfFile != null) { this.m_lastModifiedDate = new long[arrayOfFile.length]; for (int i = 0; i < arrayOfFile.length; i++) { this.m_lastModifiedDate[i] = arrayOfFile[i].lastModified(); } } } System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaaa\n"); } private boolean isExtensionMatched(String paramString1, String paramString2) { System.out.println("isExtensionMatched >>>"); boolean bool = false; if ((paramString1.equalsIgnoreCase("*")) || (paramString1.equalsIgnoreCase(".*")) || (paramString1.equalsIgnoreCase("*.*"))) { bool = true; } else { int i = paramString1.indexOf("."); String str1 = i >= 0 ? paramString1.substring(i) : paramString1; int j = str1.lastIndexOf("*"); if (j > 0) { str1 = str1.substring(0, j); } i = paramString2.indexOf("."); if (i > 0) { String str2 = paramString2.substring(i); if (str2.equalsIgnoreCase(str1)) { bool = true; } else if ((j > 0) && (str2.toLowerCase().indexOf(str1.toLowerCase()) != -1)) { bool = true; } } } return bool; } private void processNewFiles() throws Exception { System.out.println("processNewFiles >>>"); String str1 = this.m_datasetContext.getDatasetComponent().getType(); if (str1.equalsIgnoreCase("ValidationResultLog")) { return; } File localFile1 = new File(this.m_workingDirName); String[] arrayOfString11 = localFile1.list(); List fileNameList = new ArrayList<>(); fileNameList.clear(); for (String fileName : arrayOfString11) { if (fileName == null || fileName.isEmpty() || fileName.endsWith(".dwl") || fileName.endsWith(".dwl2") || fileName.endsWith(".dak")) { continue; } fileNameList.add(fileName); } String[] arrayOfString1 = fileNameList.toArray(new String[fileNameList .size()]); System.out.println(" arrayOfString1.len =" + arrayOfString1.length); System.out.println(" arrayOfString1 = " + Arrays.toString(arrayOfString1)); int i = arrayOfString1.length; Registry localRegistry = Registry.getRegistry(AEShell.class); // if (logger.isDebugEnabled()) { if (true) { System.out.println("New File Count = " + Integer.toString(i) + '\n' + "newFileCreatedTime = " + Long.toString(this.m_newFileCreatedTime)); } if (i == 0) { return; } File localFile2 = new File(this.m_selectedFileName); String str2 = localFile2.getName(); String str3 = str2 + "%"; String str4 = str2 + "~"; String str5 = "~" + str2; File localFile3 = null; for (int j = 0; j < i; j++) { if (str2.equals(arrayOfString1[j])) { localFile3 = new File(localFile1, arrayOfString1[j]); long l = localFile3.lastModified(); if ((l == this.m_newFileCreatedTime) || (this.m_newFileCreatedTime == -9223372036854775808L)) { if (true) { System.out.println("Deleting (new) file: " + localFile3.toString()); } // if (!localFile3.getPath().endsWith("dwg")) localFile3.delete(); } } else if ((this.m_selectedMimeType.equals("text/plain")) && ((arrayOfString1[j].equals(str3)) || (arrayOfString1[j].equals(str4)) || (arrayOfString1[j] .equals(str5)))) { localFile3 = new File(localFile1, arrayOfString1[j]); System.out.println("xxxxxxxxxxx"); // if (!localFile3.getPath().endsWith("dwg")) localFile3.delete(); } } arrayOfString11 = localFile1.list(); fileNameList.clear(); for (String fileName : arrayOfString11) { if (fileName == null || fileName.isEmpty() || fileName.endsWith(".dwl") || fileName.endsWith(".dwl2") || fileName.endsWith(".dak")) { continue; } fileNameList.add(fileName); } arrayOfString1 = fileNameList.toArray(new String[fileNameList.size()]); i = arrayOfString1.length; if (i == 0) { return; } TCComponentDataset localTCComponentDataset = this.m_datasetContext .getDatasetComponent(); TCComponentDatasetDefinition localTCComponentDatasetDefinition = localTCComponentDataset .getDatasetDefinitionComponent(); NamedReferenceContext[] arrayOfNamedReferenceContext = localTCComponentDatasetDefinition .getNamedReferenceContexts(); String[] arrayOfString2 = new String[i]; String[] arrayOfString3 = new String[i]; String[] arrayOfString4 = new String[i]; String[] arrayOfString5 = new String[i]; File[] arrayOfFile1 = new File[i]; int k = 0; int m = 0; if ((Platform.getOS().equals("win32")) && (localTCComponentDataset.getTypeComponent().toString() .equals("XMLAuditLog"))) { for (int n = 0; n < i; n++) { localFile3 = new File(localFile1, arrayOfString1[n]); if (localFile3.isDirectory()) { File[] arrayOfFile3 = localFile3.listFiles(); for (File localFile4 : arrayOfFile3) { // if (!localFile4.getPath().endsWith("dwg")) localFile4.delete(); } // if (!localFile3.getPath().endsWith("dwg")) if (!localFile3.delete()) { logger.info("Unable to delete file: " + localFile3.getAbsoluteFile()); } } } return; } File[] arrayOfFile2 = this.m_datasetContext.getFiles(); for (int i1 = 0; i1 < i; i1++) { m = 0; localFile3 = new File(localFile1, arrayOfString1[i1]); if ((!arrayOfString1[i1].startsWith("~$")) || ((!str2.substring(2).equals( arrayOfString1[i1].substring(2))) && (!str2.substring(1).equals( arrayOfString1[i1].substring(2))) && (!str2 .equals(arrayOfString1[i1].substring(2))))) { // Object localObject1; if ((arrayOfFile2 != null) && (arrayOfFile2.length > 0)) { int i2 = 0; for (File localObject1 : arrayOfFile2) { if (localFile3.equals(localObject1)) { i2 = 1; break; } } if (i2 != 0) { if (!logger.isDebugEnabled()) { continue; } logger.debug("excluding exported file= " + localFile3.toString()); continue; } } String str6 = localFile3.getName(); if (arrayOfNamedReferenceContext != null) { String str8; for (NamedReferenceContext localObject1 : arrayOfNamedReferenceContext) { str8 = ((NamedReferenceContext) localObject1) .getFileTemplate(); int i6 = str8.indexOf("."); if (i6 > -1) { str8 = str8.substring(i6); } if (str6.endsWith(str8)) { arrayOfString2[k] = ((NamedReferenceContext) localObject1) .getNamedReference(); arrayOfString3[k] = ((NamedReferenceContext) localObject1) .getFileFormat(); arrayOfString5[k] = localFile3.getPath(); arrayOfString4[k] = null; arrayOfFile1[k] = localFile3; k++; m = 1; break; } } if (m == 0) { for (NamedReferenceContext localObject1 : arrayOfNamedReferenceContext) { str8 = ((NamedReferenceContext) localObject1) .getFileTemplate(); if (isExtensionMatched(str8, str6)) { arrayOfString2[k] = ((NamedReferenceContext) localObject1) .getNamedReference(); arrayOfString3[k] = ((NamedReferenceContext) localObject1) .getFileFormat(); arrayOfString5[k] = localFile3.getPath(); arrayOfString4[k] = null; arrayOfFile1[k] = localFile3; k++; m = 1; break; } } } } if (m == 0) { String localObject1 = null; int i3 = str6.lastIndexOf("."); if (i3 > 0) { localObject1 = str6.substring(i3); } else { localObject1 = "*"; } String str7 = localRegistry .getString("unableImportFile.MSG1") + " " + localFile3.getPath(); String str8 = localRegistry .getString("unableImportFile.MSG2") + " '" + (String) localObject1 + "'. " + localFile3.getPath() + " " + localRegistry.getString("unableImportFile.MSG3"); if (GraphicsEnvironment.isHeadless()) { logger.error(str7 + ": " + str8); } else { MessageBox.post(str7, str8, localRegistry .getString("unableImportFile.TITLE"), 1); } } } } if (k > 0) { if (m_version0 == null) { m_version0 = localTCComponentDataset; System.out.println(" m_version0 === null "); } if (arrayOfString5 == null) { System.out.println(" arrayOfString5 == null"); } else { System.out.println("arrayOfString5.len = " + arrayOfString5.length); System.out.println(Arrays.toString(arrayOfString5)); } if (arrayOfString3 == null) { System.out.println(" arrayOfString3 == null"); } else { System.out.println("arrayOfString3.len = " + arrayOfString3.length); System.out.println(Arrays.toString(arrayOfString3)); } if (arrayOfString4 == null) { System.out.println(" arrayOfString4 == null"); } else { System.out.println("arrayOfString4.len = " + arrayOfString4.length); System.out.println(Arrays.toString(arrayOfString4)); } if (arrayOfString2 == null) { System.out.println(" arrayOfString2 == null"); } else { System.out.println("arrayOfString2.len = " + arrayOfString2.length); System.out.println(Arrays.toString(arrayOfString2)); } this.m_version0.setFiles(arrayOfString5, arrayOfString3, arrayOfString4, arrayOfString2); this.m_fileSaved = true; for (int i1 = 0; i1 < k; i1++) { // if (!arrayOfFile1[i1].getPath().endsWith("dwg")) if (!arrayOfFile1[i1].delete()) { logger.info("File " + arrayOfFile1[i1].getAbsoluteFile() + " not deleted."); } } } } private void removeFiles() { System.out.println("removeFiles >>>"); if (this.m_removeFilesAtComplete) { File localFile1 = new File(this.m_workingDirName); if (logger.isDebugEnabled()) { logger.debug(this + ".removeFiles(): WorkingDir [" + localFile1 + "]"); } // String[] arrayOfString = localFile1.list(); String[] arrayOfString11 = localFile1.list(); List fileNameList = new ArrayList<>(); fileNameList.clear(); for (String fileName : arrayOfString11) { if (fileName == null || fileName.isEmpty() || fileName.endsWith(".dwl") || fileName.endsWith(".dwl2") || fileName.endsWith(".dak")) { continue; } fileNameList.add(fileName); } String[] arrayOfString = fileNameList .toArray(new String[fileNameList.size()]); int i = arrayOfString == null ? 0 : arrayOfString.length; if (logger.isDebugEnabled()) { logger.debug("WorkingDir [" + localFile1 + "] contains " + i + " files"); } for (int j = 0; j < i; j = (short) (j + 1)) { File localFile2 = new File(localFile1, arrayOfString[j]); try { if (logger.isDebugEnabled()) { logger.debug("Deleting file [" + localFile2 + "] from WorkingDir [" + localFile1 + "]"); } // if (!localFile2.getPath().endsWith("dwg")) if (!localFile2.delete()) { logger.info("Unable to delete file :" + localFile2.getAbsolutePath()); } } catch (SecurityException localSecurityException) { if (logger.isDebugEnabled()) { logger.debug("Unable to delete file [" + localFile2 + "] from WorkingDir [" + localFile1 + "], error ignored..."); } } } // if (!localFile1.getPath().endsWith("dwg")) if ((!this.m_userDefinedDir) && (!localFile1.delete())) { logger.info("Failed to delete directory " + localFile1.getAbsolutePath()); } } } public void done(IJobChangeEvent paramIJobChangeEvent) { System.out.println("done >>>"); TCComponentDataset localTCComponentDataset = this.m_datasetContext .getDatasetComponent(); boolean bool1 = false; try { bool1 = localTCComponentDataset.isValidUid(); } catch (Exception localException1) { this.m_session.getAEShellManager().removeShell(this); if (GraphicsEnvironment.isHeadless()) { logger.error(localException1.getLocalizedMessage(), localException1); } else { MessageBox.post(localException1); } return; } if (!bool1) { logger.error("Dataset is no longer a valid object. It might have been purged."); if (logger.isDebugEnabled()) { logger.debug("Dataset in AEShell [" + this + "] is no longer a valid object"); } return; } setAppShellActiveVerdict(false); Shell localShell = (Shell) paramIJobChangeEvent.getJob(); if (logger.isDebugEnabled()) { logger.debug("exitCode = " + Integer.toString(localShell.getExitValue())); } try { if (localShell.getExitValue() == 9008) { if (this.m_checkedOutState == 1) { try { this.m_session.getReservationService() .cancelReservation(localTCComponentDataset); } catch (TCException localTCException2) { } } removeFiles(); deleteAliasXMLFile(); this.m_session.getAEShellManager().removeShell(this); throw new TCException(Registry.getRegistry(AEShell.class) .getString("toolNotFound")); } System.out.println("此处添加空指针判断"); if (localTCComponentDataset == null) { localTCComponentDataset = this.m_datasetContext .getDatasetComponent(); } String str1 = localTCComponentDataset.getType(); Registry localRegistry = Registry.getRegistry(AEShell.class); String str2 = null; TCComponent localTCComponent1 = localTCComponentDataset .getDefaultTool(); if (localTCComponent1 != null) { str2 = localTCComponent1.toString(); } String str3 = null; String str4 = askSelectedTool().toString(); if (str4.equals(str2)) { String localObject1 = getApplRegKey(str1, this.m_session); if (localObject1 != null) { str3 = localObject1 + ".ACTION_OBJECT"; } } if (str3 == null) { str3 = str1 + ".ACTION_OBJECT"; } String[] localObject1 = localRegistry.getStringArray(str3, null, null); if (localObject1 == null) { str3 = localTCComponentDataset.getTCClass().toString() + ".ACTION_OBJECT"; localObject1 = localRegistry.getStringArray(str3, null, null); } if (localObject1 != null) { boolean bool2 = false; int i = localObject1.length; for (int j = 0; j < i; j++) { InterfaceDatasetAction localObject2 = (InterfaceDatasetAction) Instancer .newInstance(localObject1[j]); if (localObject2 != null) { bool2 = ((InterfaceDatasetAction) localObject2) .postProcess(localTCComponentDataset, this.m_workingDirName, localShell.getExitValue()); if (!bool2) { j = i; } } localObject2 = null; } } TCComponentDatasetDefinition localTCComponentDatasetDefinition = localTCComponentDataset .getDatasetDefinitionComponent(); TCComponent localTCComponent2 = askSelectedTool(); Object localObject2 = localTCComponentDatasetDefinition .getPostAction(localTCComponent2, this.m_selectedAction); String str5 = null; if (localObject2 != null) { str5 = localTCComponentDatasetDefinition .getToolMimeType((TCComponent) localObject2); } if ((localObject2 != null) && (str5 != null) && (str5.length() > 0)) { String[] arrayOfString1 = localTCComponentDatasetDefinition .getPostActionParameters(localTCComponent2, this.m_selectedAction); String[] arrayOfString2 = localTCComponentDataset .buildInputParams(askSelectedFileName(), arrayOfString1, askSelectedNamedRef(), this.m_selectedAction); AIFShell localAIFShell = new AIFShell(""); if ((arrayOfString2 != null) && (arrayOfString2.length > 0)) { localAIFShell.setCommand(arrayOfString2); } localAIFShell.setMimeType(str5); localAIFShell.addJobChangeListener(new PostActionShell(this)); if ((this.m_selectedAction == 3) || (this.m_selectedAction == 4)) { localAIFShell.setAction("O"); } else if ((this.m_selectedAction == 2) || (this.m_selectedAction == 9)) { localAIFShell.setAction("P"); } logger.debug("starting PostActionShell"); localAIFShell.start(); } else { cleanupAESession(); } } catch (TCException localTCException1) { if (this.m_checkedOutState == 1) { try { this.m_session.getReservationService().cancelReservation( localTCComponentDataset); } catch (TCException localTCException3) { } } removeFiles(); deleteAliasXMLFile(); this.m_session.getAEShellManager().removeShell(this); MessageBox.post(localTCException1); } catch (Exception localException2) { MessageBox.post(localException2); } } void cleanupAESession() throws Exception { System.out.println("cleanupAESession >>"); final File[] arrayOfFile = this.m_datasetContext.getFiles(); String[] arrayOfString1 = this.m_datasetContext.getRemoteFileNames(); String[] arrayOfString2 = this.m_datasetContext.getFileTypes(); String[] arrayOfString3 = this.m_datasetContext.namedRefrences(); int i = this.m_datasetContext.performedAction(); this.m_fileSaved = false; TCComponentDataset localTCComponentDataset = this.m_datasetContext .getDatasetComponent(); // Object localObject2; if ((i == 3) || (i == 4)) { if (logger.isDebugEnabled()) { logger.debug("actionCode = " + Integer.toString(i)); } localTCComponentDataset.setUploadingFlag(true); ArrayList localObject1 = new ArrayList(); ArrayList localObject2 = new ArrayList(); ArrayList localArrayList1 = new ArrayList(); ArrayList localArrayList2 = new ArrayList(); if (arrayOfFile != null) { Object localObject3; for (int k = 0; k < arrayOfFile.length; k++) { localObject3 = arrayOfFile[k]; if (logger.isDebugEnabled()) { logger.debug("Processing Exported File= " + ((File) localObject3).toString()); } if (((File) localObject3).exists()) { long l = ((File) localObject3).lastModified(); if (l != this.m_lastModifiedDate[k]) { if (logger.isDebugEnabled()) { logger.debug("Modified File= " + ((File) localObject3).toString()); } ((ArrayList) localObject1).add(localObject3); ((ArrayList) localObject2).add(arrayOfString1[k]); localArrayList1.add(arrayOfString2[k]); localArrayList2.add(arrayOfString3[k]); } } } if (!((ArrayList) localObject1).isEmpty()) { try { boolean bool1 = this.m_session.getReservationService() .isReserved(localTCComponentDataset); if (!bool1) { localObject3 = Registry.getRegistry(AEShell.class); StringBuilder localObject4 = new StringBuilder(); ((StringBuilder) localObject4) .append(((Registry) localObject3) .getString("notReserved.MSG1")); ((StringBuilder) localObject4).append('\n'); ((StringBuilder) localObject4) .append(this.m_workingDirName); if (GraphicsEnvironment.isHeadless()) { logger.error(((StringBuilder) localObject4) .toString()); } else { MessageBox.post(((StringBuilder) localObject4) .toString(), ((Registry) localObject3) .getString("notReserved.TITLE"), 1); } localTCComponentDataset.setUploadingFlag(false); this.m_session.getAEShellManager() .removeShell(this); return; } File[] localObject5 = (File[]) ((ArrayList) localObject1) .toArray(new File[((ArrayList) localObject1) .size()]); String[] localObject4 = (String[]) ((ArrayList) localObject2) .toArray(new String[((ArrayList) localObject2) .size()]); String[] arrayOfString4 = (String[]) localArrayList1 .toArray(new String[localArrayList1.size()]); String[] arrayOfString5 = (String[]) localArrayList2 .toArray(new String[localArrayList2.size()]); localTCComponentDataset.validateFiles( localTCComponentDataset, (File[]) localObject5); localTCComponentDataset.replaceFiles( (File[]) localObject5, (String[]) localObject4, arrayOfString4, arrayOfString5); this.m_fileSaved = true; } catch (TCException localTCException1) { localTCComponentDataset.setUploadingFlag(false); this.m_session.getAEShellManager().removeShell(this); if (this.m_checkedOutState == 1) { try { this.m_session.getReservationService() .cancelReservation( localTCComponentDataset); } catch (TCException localTCException3) { } } localObject3 = Registry.getRegistry(AEShell.class); Object localObject4 = new StringBuilder(); ((StringBuilder) localObject4) .append(((Registry) localObject3) .getString("unableUploadFile.MSG1")); ((StringBuilder) localObject4).append(localTCException1 .getLocalizedMessage()); ((StringBuilder) localObject4).append('\n'); ((StringBuilder) localObject4).append('\n'); ((StringBuilder) localObject4) .append(this.m_workingDirName); ((StringBuilder) localObject4).append('\n'); ((StringBuilder) localObject4) .append(((Registry) localObject3) .getString("unableUploadFile.MSG2")); if (GraphicsEnvironment.isHeadless()) { logger.error( ((StringBuilder) localObject4).toString(), localTCException1); } else { MessageBox .post(localTCException1.getError(), localObject4, ((Registry) localObject3) .getString("unableUploadFile.TITLE"), 1); } return; } } if (this.m_removeFilesAtComplete) { System.out.println("--------------哈哈哈哈哈我要干掉你------------"); for (int m = 0; m < arrayOfFile.length; m = (short) (m + 1)) { localObject3 = arrayOfFile[m]; System.out.println("--------我要干掉==>>" + ((File) localObject3).getPath()); System.out.println("-------文件是否存在 = " + ((File) localObject3).exists()); boolean bool2 = true; // if (!((File) localObject3).getPath().endsWith("dwg")) // { bool2 = ((File) localObject3).delete(); // } System.out.println("-------是否会干掉 [" + bool2 + "]"); System.out.println("-------文件是否存在 = " + ((File) localObject3).exists()); if (!bool2) { logger.error("Exported File [" + ((File) localObject3).toString() + "] Delete Failed"); } else if (logger.isDebugEnabled()) { logger.debug("Exported File [" + ((File) localObject3).toString() + "] Removed"); } } } deleteAliasXMLFile(); } if (!localTCComponentDataset.isValidUid()) { localTCComponentDataset = this.m_version0; } try { processNewFiles(); if (localTCComponentDataset.isCheckedOut()) { if (!((ArrayList) localObject1).isEmpty()) { if (this.m_checkedOutState == 1) { this.m_session.getReservationService().unreserve( localTCComponentDataset); } } else { if (!localTCComponentDataset.isValidUid()) { localTCComponentDataset = this.m_version0; } if ((this.m_checkedOutState == 1) && (!this.m_readOnly)) { this.m_session.getReservationService() .cancelReservation(localTCComponentDataset); } } if (this.m_checkedOutState == 1) { localTCComponentDataset.getAllVersions(); } } } catch (TCException localTCException2) { if (GraphicsEnvironment.isHeadless()) { logger.error(localTCException2.getLocalizedMessage(), localTCException2); } else { MessageBox.post(localTCException2); } } catch (IOException localIOException) { logger.error(localIOException.getLocalizedMessage(), localIOException); } localTCComponentDataset.setUploadingFlag(false); } final File localObject1 = new File(this.m_workingDirName); if (this.m_removeFilesAtComplete) { if ((this.m_checkedOutState == 0) && ((this.m_selectedAction == 2) || (this.m_selectedAction == 9)) && (arrayOfFile != null)) { this.m_session .addSessionLogoutListener(new InterfaceAIFSessionLogoutListener() { public void sessionLogout( AbstractAIFSession paramAnonymousAbstractAIFSession) { for (int i = 0; i < arrayOfFile.length; i = (short) (i + 1)) { File localFile = arrayOfFile[i]; // if (!localFile.getPath().endsWith("dwg")) if (!localFile.delete()) { AEShell.logger.info("Unable to delete file: " + localFile.getAbsolutePath()); } } String[] arrayOfString = localObject1.list(); // if (!localObject1.getPath().endsWith("dwg")) if (((arrayOfString == null) || (arrayOfString.length == 0)) && (!localObject1.delete())) { AEShell.logger .info("Unable to delete directory" + localObject1 .getAbsolutePath()); } } }); } String[] localObject2 = ((File) localObject1).list(); int j = localObject2.length; // if (!localObject1.getPath().endsWith("dwg")) if ((j == 0) && (!this.m_userDefinedDir) && (!((File) localObject1).delete())) { logger.info("Unable to delete directory" + ((File) localObject1).getAbsolutePath()); } deleteAliasXMLFile(); } this.m_session.getAEShellManager().removeShell(this); if ((this.m_fileSaved) && (this.m_selectedAction == 4)) { try { this.m_selectedDataset.setDefaultTool(this.m_selectedTool); } catch (Exception localException) { } } localTCComponentDataset.resetInIcContext(); } public void setSelectedFileName(String paramString) { this.m_selectedFileName = paramString; System.out.println("setSelectedFileName >> " + paramString); } void setSelectedNamedRef(String paramString) { System.out.println("setSelectedNamedRef >>" + paramString); this.m_selectedNamedRef = paramString; } public void setSelectedDataset(TCComponentDataset paramTCComponentDataset) { System.out.println("setSelectedDataset >>" + paramTCComponentDataset.toString()); this.m_selectedDataset = paramTCComponentDataset; } void setExportedFiles(File[] paramArrayOfFile) { System.out.println("setExportedFiles >>" + Arrays.toString(paramArrayOfFile)); this.m_exportedFiles = paramArrayOfFile; } void setSelectedMimeType(String paramString) { System.out.println("setSelectedMimeType >>" + paramString); this.m_selectedMimeType = paramString; } public void setSelectedTool(TCComponent paramTCComponent) { System.out.println("setSelectedTool >>" + paramTCComponent.toString()); this.m_selectedTool = paramTCComponent; } void setSearchBy(String paramString) { System.out.println("setSearchBy >>" + paramString); this.m_searchBy = paramString; } void setRev0DS(TCComponentDataset paramTCComponentDataset) { System.out.println("setRev0DS >>" + paramTCComponentDataset.toString()); this.m_version0 = paramTCComponentDataset; } void setReserveOption(int paramInt) { System.out.println("setReserveOption >>" + paramInt); this.m_checkedOutState = paramInt; } void setNewFileCreatedTime(File paramFile) { System.out.println("setNewFileCreatedTime >>" + paramFile.getName()); this.m_newFileCreatedTime = paramFile.lastModified(); } String askSelectedFileName() { System.out.println("askSelectedFileName >>" + this.m_selectedFileName); return this.m_selectedFileName; } String askSelectedNamedRef() { System.out.println("askSelectedNamedRef >> " + m_selectedNamedRef); return this.m_selectedNamedRef; } TCComponentDataset askSelectedDataset() { System.out.println("askSelectedDataset >>" + m_selectedDataset.toString()); return this.m_selectedDataset; } File[] askExportedFiles() { System.out.println("askExportedFiles >>" + Arrays.toString(m_exportedFiles)); return this.m_exportedFiles; } String askSelectedMimeType() { System.out.println("askSelectedMimeType >> " + m_selectedMimeType); return this.m_selectedMimeType; } TCComponent askSelectedTool() { System.out.println("askSelectedTool >>" + m_selectedTool.toString()); return this.m_selectedTool; } String askSearchBy() { System.out.println("askSearchBy >>" + m_searchBy); return this.m_searchBy; } protected void setAppShellActiveVerdict(boolean paramBoolean) { System.out.println("setAppShellActiveVerdict >>" + paramBoolean); synchronized (this) { if (paramBoolean) { if (this.m_statefulnessReg == 0) { this.m_statefulnessReg = TcStatefulnessUtil.registerState( this.m_session, "Edit"); } } else if (this.m_statefulnessReg > 0) { TcStatefulnessUtil.unregister(this.m_session, this.m_statefulnessReg); this.m_statefulnessReg = 0; } } } private String getApplRegKey(String paramString, TCSession paramTCSession) { System.out.println("getApplRegKey >>" + paramString); TCPreferenceService localTCPreferenceService = paramTCSession .getPreferenceService(); String[] arrayOfString1 = localTCPreferenceService .getStringValues("TC_encapsulation_application_key"); String[] arrayOfString2 = localTCPreferenceService .getStringValues("CAE_analysis_tools"); if ((arrayOfString1 != null) && (arrayOfString2 != null)) { for (String str1 : arrayOfString1) { if (str1.equals("CAE")) { for (String str2 : arrayOfString2) { if (paramString.equals(str2)) { return "CAE"; } } } } } return null; } public String toString() { System.out.println("toString >>"); StringBuilder localStringBuilder = new StringBuilder(super.toString()); if (logger.isDebugEnabled()) { try { localStringBuilder.delete(0, localStringBuilder.length()); localStringBuilder .append(getClass().getName()) .append("\n DatasetContext [") .append(this.m_datasetContext == null ? "" : this.m_datasetContext.toString()) .append("]\n"); localStringBuilder.append(" userDefinedDir [") .append(this.m_userDefinedDir).append("]\n"); localStringBuilder.append(" workingDirName [") .append(this.m_workingDirName).append("]\n"); localStringBuilder .append(" selectedAction ") .append(TCComponentDataset .getAction(this.m_selectedAction)).append("\n"); if (this.m_selectedDataset == null) { localStringBuilder.append(" TCComponentDataset [") .append(this.m_selectedDataset).append("]\n"); } else { localStringBuilder.append(" TCComponentDataset [") .append(this.m_selectedDataset).append("] uid ") .append(this.m_selectedDataset.getUid()) .append(", type [") .append(this.m_selectedDataset.getType()) .append("]\n"); } if (this.m_version0 == null) { localStringBuilder.append(" version0Dataset [") .append(this.m_version0).append("]\n"); } else { localStringBuilder.append(" version0Dataset [") .append(this.m_version0).append("] uid ") .append(this.m_version0.getUid()) .append(", type [") .append(this.m_version0.getType()).append("]\n"); } localStringBuilder.append(" TCComponentDataset [") .append(this.m_selectedDataset).append("]\n"); localStringBuilder.append(" version0Dataset [") .append(this.m_version0).append("]\n"); localStringBuilder.append(" Tool [") .append(this.m_selectedTool).append("]\n"); localStringBuilder.append(" selectedFileName [") .append(this.m_selectedFileName).append("]\n"); localStringBuilder.append(" selectedNamedRef [") .append(this.m_selectedNamedRef).append("]\n"); localStringBuilder.append(" selectedMimeType [") .append(this.m_selectedMimeType).append("]\n"); localStringBuilder.append(" searchBy [") .append(this.m_searchBy).append("]\n"); int i = this.m_exportedFiles == null ? 0 : this.m_exportedFiles.length; localStringBuilder.append(i).append(" exported files:\n"); for (int j = 0; j < i; j++) { localStringBuilder.append(" [") .append(this.m_exportedFiles[j].toString()) .append("]\n"); } localStringBuilder.append(" checkedOutState ") .append(this.m_checkedOutState).append("]\n"); localStringBuilder.append(" fileSaved [") .append(this.m_fileSaved).append("]\n"); localStringBuilder.append(" removeFilesAtComplete [") .append(this.m_removeFilesAtComplete).append("]\n"); } catch (Exception localException) { logger.error(localException.getLocalizedMessage(), localException); } } return localStringBuilder.toString(); } private void deleteAliasXMLFile() { System.out.println("deleteAliasXMLFile >>"); try { CheckTcAEGMOLicense localCheckTcAEGMOLicense = new CheckTcAEGMOLicense(); if (localCheckTcAEGMOLicense.checkGMOLicense()) { String str = AliasOpenAction.ouputXMLFilePath; if (str != null) { File localFile = new File(str); // if (!localFile.getPath().endsWith("dwg")) if ((localFile.exists()) && (!localFile.delete())) { logger.info("Unable to delete file: " + localFile.getAbsolutePath()); } } } } catch (Exception localException) { logger.error(localException.getLocalizedMessage(), localException); } } public void setReadOnly(boolean paramBoolean) { System.out.println("setReadOnly >>" + paramBoolean); this.m_readOnly = paramBoolean; } }