List of usage examples for java.util.concurrent ConcurrentHashMap get
public V get(Object key)
From source file:io.pravega.controller.eventProcessor.impl.SerializedRequestHandlerTest.java
@Test(timeout = 10000) public void testProcessEvent() throws InterruptedException, ExecutionException { final ConcurrentHashMap<String, List<Integer>> orderOfProcessing = new ConcurrentHashMap<>(); SerializedRequestHandler<TestEvent> requestHandler = new SerializedRequestHandler<TestEvent>( executorService()) {// w ww. j av a 2 s .c om @Override public CompletableFuture<Void> processEvent(TestEvent event) { orderOfProcessing.compute(event.getKey(), (x, y) -> { if (y == null) { y = new ArrayList<>(); } y.add(event.getNumber()); return y; }); return event.getFuture(); } }; List<Pair<TestEvent, CompletableFuture<Void>>> stream1Queue = requestHandler .getEventQueueForKey(getKeyForStream("scope", "stream1")); assertNull(stream1Queue); // post 3 work for stream1 TestEvent s1e1 = new TestEvent("scope", "stream1", 1); CompletableFuture<Void> s1p1 = requestHandler.process(s1e1); TestEvent s1e2 = new TestEvent("scope", "stream1", 2); CompletableFuture<Void> s1p2 = requestHandler.process(s1e2); TestEvent s1e3 = new TestEvent("scope", "stream1", 3); CompletableFuture<Void> s1p3 = requestHandler.process(s1e3); stream1Queue = requestHandler.getEventQueueForKey(getKeyForStream("scope", "stream1")); assertTrue(stream1Queue.size() >= 2); assertTrue(stream1Queue.stream().noneMatch(x -> x.getRight().isDone())); List<Integer> collect = stream1Queue.stream().map(x -> x.getLeft().getNumber()) .collect(Collectors.toList()); assertTrue(collect.indexOf(2) < collect.indexOf(3)); s1e3.complete(); stream1Queue = requestHandler.getEventQueueForKey(getKeyForStream("scope", "stream1")); // verify that no processing is complete assertTrue(stream1Queue.size() >= 2); assertTrue(stream1Queue.stream().noneMatch(x -> x.getRight().isDone())); collect = stream1Queue.stream().map(x -> x.getLeft().getNumber()).collect(Collectors.toList()); assertTrue(collect.indexOf(2) < collect.indexOf(3)); // post 3 work for stream2 TestEvent s2e1 = new TestEvent("scope", "stream2", 1); CompletableFuture<Void> s2p1 = requestHandler.process(s2e1); TestEvent s2e2 = new TestEvent("scope", "stream2", 2); CompletableFuture<Void> s2p2 = requestHandler.process(s2e2); TestEvent s2e3 = new TestEvent("scope", "stream2", 3); CompletableFuture<Void> s2p3 = requestHandler.process(s2e3); List<Pair<TestEvent, CompletableFuture<Void>>> stream2Queue = requestHandler .getEventQueueForKey(getKeyForStream("scope", "stream1")); assertTrue(stream2Queue.size() >= 2); assertTrue(stream2Queue.stream().noneMatch(x -> x.getRight().isDone())); collect = stream2Queue.stream().map(x -> x.getLeft().getNumber()).collect(Collectors.toList()); assertTrue(collect.indexOf(2) < collect.indexOf(3)); s1e1.complete(); Futures.await(s1p1); stream1Queue = requestHandler.getEventQueueForKey(getKeyForStream("scope", "stream1")); assertTrue(stream1Queue.size() >= 1); assertTrue(stream1Queue.stream().noneMatch(x -> x.getRight().isDone())); collect = stream1Queue.stream().map(x -> x.getLeft().getNumber()).collect(Collectors.toList()); assertTrue(collect.contains(3)); // now make sure that we have concurrently run for two streams s2e1.complete(); Futures.await(s2p1); stream2Queue = requestHandler.getEventQueueForKey(getKeyForStream("scope", "stream2")); assertTrue(stream2Queue.size() >= 1); assertTrue(stream2Queue.stream().noneMatch(x -> x.getRight().isDone())); collect = stream2Queue.stream().map(x -> x.getLeft().getNumber()).collect(Collectors.toList()); assertTrue(collect.contains(3)); // now complete all processing s2e2.complete(); Futures.await(s2p2); s2e3.complete(); s1e2.complete(); Futures.await(s1p2); Futures.await(s1p3); Futures.await(s2p3); assertTrue( orderOfProcessing.get(s1e1.getKey()).get(0) == 1 && orderOfProcessing.get(s1e1.getKey()).get(1) == 2 && orderOfProcessing.get(s1e1.getKey()).get(2) == 3); assertTrue( orderOfProcessing.get(s2e1.getKey()).get(0) == 1 && orderOfProcessing.get(s2e1.getKey()).get(1) == 2 && orderOfProcessing.get(s2e1.getKey()).get(2) == 3); Futures.loop(() -> requestHandler.getEventQueueForKey(getKeyForStream("scope", "stream1")) == null, () -> CompletableFuture.completedFuture(null), executorService()); Futures.loop(() -> requestHandler.getEventQueueForKey(getKeyForStream("scope", "stream2")) == null, () -> CompletableFuture.completedFuture(null), executorService()); // now that we have drained all the work from the processor. // let's post new work for stream 1 TestEvent s1e4 = new TestEvent("scope", "stream1", 4); CompletableFuture<Void> s1p4 = requestHandler.process(s1e4); stream1Queue = requestHandler.getEventQueueForKey(getKeyForStream("scope", "stream1")); assertNotNull(stream1Queue); s1e4.complete(); Futures.await(s1p4); assertTrue(orderOfProcessing.get(s1e1.getKey()).get(3) == 4); }
From source file:com.web.server.WarDeployer.java
/** * This method deploys the war in exploded form and configures it. * @param file/*from w w w .ja v a2s. c o m*/ * @param customClassLoader * @param warDirectoryPath */ public void extractWar(File file, WebClassLoader customClassLoader) { StringBuffer classPath = new StringBuffer(); int numBytes; try { ConcurrentHashMap jspMap = new ConcurrentHashMap(); ZipFile zip = new ZipFile(file); ZipEntry ze = null; //String fileName=file.getName(); String directoryName = file.getName(); directoryName = directoryName.substring(0, directoryName.indexOf('.')); try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); //logger.info("file://"+warDirectoryPath+"/WEB-INF/classes/"); new WebServer().addURL(new URL("file:" + scanDirectory + "/" + directoryName + "/WEB-INF/classes/"), customClassLoader); //new WebServer().addURL(new URL("file://"+warDirectoryPath+"/"),customClassLoader); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } String fileDirectory; Enumeration<? extends ZipEntry> entries = zip.entries(); while (entries.hasMoreElements()) { ze = entries.nextElement(); // //System.out.println("Unzipping " + ze.getName()); String filePath = scanDirectory + "/" + directoryName + "/" + ze.getName(); if (!ze.isDirectory()) { fileDirectory = filePath.substring(0, filePath.lastIndexOf('/')); } else { fileDirectory = filePath; } // //System.out.println(fileDirectory); createDirectory(fileDirectory); if (!ze.isDirectory()) { FileOutputStream fout = new FileOutputStream(filePath); byte[] inputbyt = new byte[8192]; InputStream istream = zip.getInputStream(ze); while ((numBytes = istream.read(inputbyt, 0, inputbyt.length)) >= 0) { fout.write(inputbyt, 0, numBytes); } fout.close(); istream.close(); if (ze.getName().endsWith(".jsp")) { jspMap.put(ze.getName(), filePath); } else if (ze.getName().endsWith(".jar")) { new WebServer().addURL( new URL("file:///" + scanDirectory + "/" + directoryName + "/" + ze.getName()), customClassLoader); classPath.append(filePath); classPath.append(";"); } } } zip.close(); Set jsps = jspMap.keySet(); Iterator jspIterator = jsps.iterator(); classPath.append(scanDirectory + "/" + directoryName + "/WEB-INF/classes/;"); ArrayList<String> jspFiles = new ArrayList(); //System.out.println(classPath.toString()); if (jspIterator.hasNext()) new WebServer().addURL(new URL("file:" + scanDirectory + "/temp/" + directoryName + "/"), customClassLoader); while (jspIterator.hasNext()) { String filepackageInternal = (String) jspIterator.next(); String filepackageInternalTmp = filepackageInternal; if (filepackageInternal.lastIndexOf('/') == -1) { filepackageInternal = ""; } else { filepackageInternal = filepackageInternal.substring(0, filepackageInternal.lastIndexOf('/')) .replace("/", "."); filepackageInternal = "." + filepackageInternal; } createDirectory(scanDirectory + "/temp/" + directoryName); File jspFile = new File((String) jspMap.get(filepackageInternalTmp)); String fName = jspFile.getName(); String fileNameWithoutExtension = fName.substring(0, fName.lastIndexOf(".jsp")) + "_jsp"; //String fileCreated=new JspCompiler().compileJsp((String) jspMap.get(filepackageInternalTmp), scanDirectory+"/temp/"+fileName, "com.web.server"+filepackageInternal,classPath.toString()); synchronized (customClassLoader) { String fileNameInWar = filepackageInternalTmp; jspFiles.add(fileNameInWar.replace("/", "\\")); if (fileNameInWar.contains("/") || fileNameInWar.contains("\\")) { customClassLoader.addURL("/" + fileNameInWar.replace("\\", "/"), "com.web.server" + filepackageInternal + "." + fileNameWithoutExtension); } else { customClassLoader.addURL("/" + fileNameInWar, "com.web.server" + filepackageInternal + "." + fileNameWithoutExtension); } } } if (jspFiles.size() > 0) { ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(customClassLoader); try { JspC jspc = new JspC(); jspc.setUriroot(scanDirectory + "/" + directoryName + "/"); jspc.setAddWebXmlMappings(false); jspc.setCompile(true); jspc.setOutputDir(scanDirectory + "/temp/" + directoryName + "/"); jspc.setPackage("com.web.server"); StringBuffer buffer = new StringBuffer(); for (String jspFile : jspFiles) { buffer.append(","); buffer.append(jspFile); } String jsp = buffer.toString(); jsp = jsp.substring(1, jsp.length()); System.out.println(jsp); jspc.setJspFiles(jsp); jspc.execute(); } catch (Throwable je) { je.printStackTrace(); } finally { Thread.currentThread().setContextClassLoader(oldCL); } Thread.currentThread().setContextClassLoader(customClassLoader); } try { new ExecutorServicesConstruct().getExecutorServices(serverdigester, executorServiceMap, new File(scanDirectory + "/" + directoryName + "/WEB-INF/" + "executorservices.xml"), customClassLoader); } catch (Exception e) { // TODO Auto-generated catch block //e.printStackTrace(); } try { new MessagingClassConstruct().getMessagingClass(messagedigester, new File(scanDirectory + "/" + directoryName + "/WEB-INF/" + "messagingclass.xml"), customClassLoader, messagingClassMap); } catch (Exception e) { // TODO Auto-generated catch block //e.printStackTrace(); } webxmldigester.setNamespaceAware(true); webxmldigester.setValidating(true); //digester.setRules(null); FileInputStream webxml = new FileInputStream( scanDirectory + "/" + directoryName + "/WEB-INF/" + "web.xml"); InputSource is = new InputSource(webxml); try { System.out.println("SCHEMA"); synchronized (webxmldigester) { //webxmldigester.set("config/web-app_2_4.xsd"); WebAppConfig webappConfig = (WebAppConfig) webxmldigester.parse(is); servletMapping.put(scanDirectory + "/" + directoryName.replace("\\", "/"), webappConfig); } webxml.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } //ClassLoaderUtil.closeClassLoader(customClassLoader); } catch (FileNotFoundException e) { // TODO Auto-generated catch block //e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block //e.printStackTrace(); } catch (Exception ex) { } }
From source file:sqs_dwh.filter_049_0_1.filter_049.java
public void tFileInputLDIF_2Process(final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tFileInputLDIF_2_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; try {//from w w w .j a v a 2s .c o m String currentMethodName = new java.lang.Exception().getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; decode_pwStruct decode_pw = new decode_pwStruct(); out_decode_pwStruct out_decode_pw = new out_decode_pwStruct(); row1Struct row1 = new row1Struct(); /** * [tFileOutputLDIF_1 begin ] start */ ok_Hash.put("tFileOutputLDIF_1", false); start_Hash.put("tFileOutputLDIF_1", System.currentTimeMillis()); currentComponent = "tFileOutputLDIF_1"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_row1 = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_row1.putIfAbsent("row1" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_row1 = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_row1 .get("row1" + iterateLoop); runStat.updateStatOnConnection("row1" + iterateId, stats_row1.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tFileOutputLDIF_1 = 0; java.io.File file_tFileOutputLDIF_1 = new java.io.File( "D:/projects/spectos/sqs/trunk/etl/SQS_DWH/data/scout2/file4_prod2.ldif"); // create directory only if not exists java.io.File parentFile_tFileOutputLDIF_1 = file_tFileOutputLDIF_1.getParentFile(); if (parentFile_tFileOutputLDIF_1 != null && !parentFile_tFileOutputLDIF_1.exists()) { parentFile_tFileOutputLDIF_1.mkdirs(); } class Util_tFileOutputLDIF_1 { public void breakString(StringBuilder pw, String value, int max) { int leftToGo = value.length(); int written = 0; int maxChars = max; while (leftToGo > 0) { int toWrite = Math.min(maxChars, leftToGo); String s = value.substring(written, written + toWrite); if (written != 0) { pw.append(" " + s); } else { pw.append(s); maxChars -= 1; } written += toWrite; leftToGo -= toWrite; pw.append('\n'); } } public String getBase64StringOrNot(boolean encodingBase64, String srcData, String encoding) { String returnValue = ""; try { if (encodingBase64 && !netscape.ldap.util.LDIF.isPrintable(srcData.getBytes(encoding))) { returnValue = org.apache.commons.codec.binary.Base64 .encodeBase64String(srcData.getBytes(encoding)); } else { returnValue = srcData; } } catch (java.lang.Exception e) { e.printStackTrace(); } return returnValue; } } Util_tFileOutputLDIF_1 util_tFileOutputLDIF_1 = new Util_tFileOutputLDIF_1(); int nb_line_tFileOutputLDIF_1 = 0; final String dn_tFileOutputLDIF_1 = "dn: "; final String changetype_tFileOutputLDIF_1 = "changetype: "; final int wrap_tFileOutputLDIF_1 = 78; java.io.PrintWriter pw_tFileOutputLDIF_1 = new java.io.PrintWriter(file_tFileOutputLDIF_1, "ISO-8859-15"); if (file_tFileOutputLDIF_1.length() == 0) { pw_tFileOutputLDIF_1.write("version: 1\n"); } /** * [tFileOutputLDIF_1 begin ] stop */ /** * [tFilterRow_1 begin ] start */ ok_Hash.put("tFilterRow_1", false); start_Hash.put("tFilterRow_1", System.currentTimeMillis()); currentComponent = "tFilterRow_1"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_out_decode_pw = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_out_decode_pw.putIfAbsent("out_decode_pw" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_out_decode_pw = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_out_decode_pw .get("out_decode_pw" + iterateLoop); runStat.updateStatOnConnection("out_decode_pw" + iterateId, stats_out_decode_pw.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tFilterRow_1 = 0; int nb_line_tFilterRow_1 = 0; int nb_line_ok_tFilterRow_1 = 0; int nb_line_reject_tFilterRow_1 = 0; class Operator_tFilterRow_1 { private String sErrorMsg = ""; private boolean bMatchFlag = true; private String sUnionFlag = "&&"; public Operator_tFilterRow_1(String unionFlag) { sUnionFlag = unionFlag; bMatchFlag = "||".equals(unionFlag) ? false : true; } public String getErrorMsg() { if (sErrorMsg != null && sErrorMsg.length() > 1) return sErrorMsg.substring(1); else return null; } public boolean getMatchFlag() { return bMatchFlag; } public void matches(boolean partMatched, String reason) { // no need to care about the next judgement if ("||".equals(sUnionFlag) && bMatchFlag) { return; } if (!partMatched) { sErrorMsg += "|" + reason; } if ("||".equals(sUnionFlag)) bMatchFlag = bMatchFlag || partMatched; else bMatchFlag = bMatchFlag && partMatched; } } /** * [tFilterRow_1 begin ] stop */ /** * [tMap_1 begin ] start */ ok_Hash.put("tMap_1", false); start_Hash.put("tMap_1", System.currentTimeMillis()); currentComponent = "tMap_1"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_decode_pw = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_decode_pw.putIfAbsent("decode_pw" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_decode_pw = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_decode_pw .get("decode_pw" + iterateLoop); runStat.updateStatOnConnection("decode_pw" + iterateId, stats_decode_pw.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tMap_1 = 0; // ############################### // # Lookup's keys initialization // ############################### // ############################### // # Vars initialization class Var__tMap_1__Struct { } Var__tMap_1__Struct Var__tMap_1 = new Var__tMap_1__Struct(); // ############################### // ############################### // # Outputs initialization out_decode_pwStruct out_decode_pw_tmp = new out_decode_pwStruct(); // ############################### /** * [tMap_1 begin ] stop */ /** * [tFileInputLDIF_2 begin ] start */ ok_Hash.put("tFileInputLDIF_2", false); start_Hash.put("tFileInputLDIF_2", System.currentTimeMillis()); currentComponent = "tFileInputLDIF_2"; int tos_count_tFileInputLDIF_2 = 0; // ///////////////////////////////// netscape.ldap.util.LDIF ldif_tFileInputLDIF_2 = new netscape.ldap.util.LDIF( "D:/projects/spectos/sqs/trunk/etl/SQS_DWH/data/scout2/file4_prod1.ldif"); String[] filters_tFileInputLDIF_2 = new String[] { "dn", "objectClass", "uid", "spectos_loginName", "cn", "sn", "email", "preferredLanguage", "userPassword", "zupId", "userEnabled", }; String[] filters_binary_tFileInputLDIF_2 = new String[] { "dn;binary", "objectClass;binary", "uid;binary", "spectos_loginName;binary", "cn;binary", "sn;binary", "email;binary", "preferredLanguage;binary", "userPassword;binary", "zupId;binary", "userEnabled;binary", }; String[] results_tFileInputLDIF_2 = null; List<List<byte[]>> resultsBinary_tFileInputLDIF_2 = null; int nb_line_tFileInputLDIF_2 = 0; // ///////////////////////////////// for (netscape.ldap.util.LDIFRecord record_tFileInputLDIF_2 = ldif_tFileInputLDIF_2 .nextRecord(); record_tFileInputLDIF_2 != null; record_tFileInputLDIF_2 = ldif_tFileInputLDIF_2 .nextRecord()) { results_tFileInputLDIF_2 = new String[11]; resultsBinary_tFileInputLDIF_2 = new java.util.ArrayList<List<byte[]>>(); netscape.ldap.util.LDIFContent content_tFileInputLDIF_2 = record_tFileInputLDIF_2.getContent(); netscape.ldap.LDAPAttribute[] attributes_tFileInputLDIF_2 = null; switch (content_tFileInputLDIF_2.getType()) { case netscape.ldap.util.LDIFContent.ATTRIBUTE_CONTENT: netscape.ldap.util.LDIFAttributeContent attrContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFAttributeContent) content_tFileInputLDIF_2; attributes_tFileInputLDIF_2 = attrContent_tFileInputLDIF_2.getAttributes(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (int j_tFileInputLDIF_2 = 0; j_tFileInputLDIF_2 < attributes_tFileInputLDIF_2.length; j_tFileInputLDIF_2++) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = attributes_tFileInputLDIF_2[j_tFileInputLDIF_2]; if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } } } } } break; case netscape.ldap.util.LDIFContent.ADD_CONTENT: netscape.ldap.util.LDIFAddContent addContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFAddContent) content_tFileInputLDIF_2; attributes_tFileInputLDIF_2 = addContent_tFileInputLDIF_2.getAttributes(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (int j_tFileInputLDIF_2 = 0; j_tFileInputLDIF_2 < attributes_tFileInputLDIF_2.length; j_tFileInputLDIF_2++) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = attributes_tFileInputLDIF_2[j_tFileInputLDIF_2]; if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "add"; } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } } } } } break; case netscape.ldap.util.LDIFContent.MODIFICATION_CONTENT: netscape.ldap.util.LDIFModifyContent modifyContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFModifyContent) content_tFileInputLDIF_2; netscape.ldap.LDAPModification[] modifications_tFileInputLDIF_2 = modifyContent_tFileInputLDIF_2 .getModifications(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (netscape.ldap.LDAPModification modification_tFileInputLDIF_2 : modifications_tFileInputLDIF_2) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = modification_tFileInputLDIF_2 .getAttribute(); if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "modify"; } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); boolean firstLoop_tFileInputLDIF_2 = true; for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); if (firstLoop_tFileInputLDIF_2) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + ":" + value_tFileInputLDIF_2; } else { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } firstLoop_tFileInputLDIF_2 = false; } } } } } break; case netscape.ldap.util.LDIFContent.DELETE_CONTENT: // netscape.ldap.util.LDIFDeleteContent // deleteContent_tFileInputLDIF_2 = // (netscape.ldap.util.LDIFDeleteContent) // content_tFileInputLDIF_2; for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "delete"; } } break; case netscape.ldap.util.LDIFContent.MODDN_CONTENT: netscape.ldap.util.LDIFModDNContent moddnContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFModDNContent) content_tFileInputLDIF_2; for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "modrdn"; } else if ("newrdn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = moddnContent_tFileInputLDIF_2 .getRDN(); } else if ("deleteoldrdn" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = Boolean .toString(moddnContent_tFileInputLDIF_2.getDeleteOldRDN()); } else if ("newsuperior" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = moddnContent_tFileInputLDIF_2 .getNewParent(); } } break; default: } nb_line_tFileInputLDIF_2++; // for output decode_pw = null; boolean whetherReject_tFileInputLDIF_2 = false; decode_pw = new decode_pwStruct(); try { if (0 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[0] != null) { decode_pw.dn = results_tFileInputLDIF_2[0]; } else { decode_pw.dn = null; } if (1 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[1] != null) { decode_pw.objectClass = results_tFileInputLDIF_2[1]; } else { decode_pw.objectClass = null; } if (2 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[2] != null) { decode_pw.uid = results_tFileInputLDIF_2[2]; } else { decode_pw.uid = null; } if (3 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[3] != null) { decode_pw.spectos_loginName = results_tFileInputLDIF_2[3]; } else { decode_pw.spectos_loginName = null; } if (4 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[4] != null) { decode_pw.cn = results_tFileInputLDIF_2[4]; } else { decode_pw.cn = null; } if (5 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[5] != null) { decode_pw.sn = results_tFileInputLDIF_2[5]; } else { decode_pw.sn = null; } if (6 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[6] != null) { decode_pw.email = results_tFileInputLDIF_2[6]; } else { decode_pw.email = null; } if (7 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[7] != null) { decode_pw.preferredLanguage = results_tFileInputLDIF_2[7]; } else { decode_pw.preferredLanguage = null; } if (8 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[8] != null) { decode_pw.userPassword = results_tFileInputLDIF_2[8]; } else { decode_pw.userPassword = null; } if (9 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[9] != null) { decode_pw.zupId = results_tFileInputLDIF_2[9]; } else { decode_pw.zupId = null; } if (10 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[10] != null) { decode_pw.userEnabled = results_tFileInputLDIF_2[10]; } else { decode_pw.userEnabled = null; } } catch (java.lang.Exception e) { whetherReject_tFileInputLDIF_2 = true; System.err.println(e.getMessage()); decode_pw = null; } // ///////////////////////////////// /** * [tFileInputLDIF_2 begin ] stop */ /** * [tFileInputLDIF_2 main ] start */ currentComponent = "tFileInputLDIF_2"; tos_count_tFileInputLDIF_2++; /** * [tFileInputLDIF_2 main ] stop */ // Start of branch "decode_pw" if (decode_pw != null) { /** * [tMap_1 main ] start */ currentComponent = "tMap_1"; // decode_pw // decode_pw if (execStat) { runStat.updateStatOnConnection("decode_pw" + iterateId, 1, 1); } boolean hasCasePrimitiveKeyWithNull_tMap_1 = false; // ############################### // # Input tables (lookups) boolean rejectedInnerJoin_tMap_1 = false; boolean mainRowRejected_tMap_1 = false; // ############################### { // start of Var scope // ############################### // # Vars tables Var__tMap_1__Struct Var = Var__tMap_1;// ############################### // ############################### // # Output tables out_decode_pw = null; // # Output table : 'out_decode_pw' out_decode_pw_tmp.dn = decode_pw.dn; out_decode_pw_tmp.objectClass = decode_pw.objectClass; out_decode_pw_tmp.uid = decode_pw.uid; out_decode_pw_tmp.spectos_loginName = decode_pw.spectos_loginName; out_decode_pw_tmp.cn = decode_pw.cn; out_decode_pw_tmp.sn = decode_pw.sn; out_decode_pw_tmp.spectos_email = decode_pw.email; out_decode_pw_tmp.preferredLanguage = decode_pw.preferredLanguage; out_decode_pw_tmp.userPassword = decode_pw.userPassword; out_decode_pw = out_decode_pw_tmp; // ############################### } // end of Var scope rejectedInnerJoin_tMap_1 = false; tos_count_tMap_1++; /** * [tMap_1 main ] stop */ // Start of branch "out_decode_pw" if (out_decode_pw != null) { /** * [tFilterRow_1 main ] start */ currentComponent = "tFilterRow_1"; // out_decode_pw // out_decode_pw if (execStat) { runStat.updateStatOnConnection("out_decode_pw" + iterateId, 1, 1); } row1 = null; Operator_tFilterRow_1 ope_tFilterRow_1 = new Operator_tFilterRow_1("&&"); ope_tFilterRow_1.matches((out_decode_pw.cn.startsWith("049") == true ), "advanced condition failed"); if (ope_tFilterRow_1.getMatchFlag()) { if (row1 == null) { row1 = new row1Struct(); } row1.dn = out_decode_pw.dn; row1.objectClass = out_decode_pw.objectClass; row1.uid = out_decode_pw.uid; row1.spectos_loginName = out_decode_pw.spectos_loginName; row1.cn = out_decode_pw.cn; row1.sn = out_decode_pw.sn; row1.spectos_email = out_decode_pw.spectos_email; row1.preferredLanguage = out_decode_pw.preferredLanguage; row1.userPassword = out_decode_pw.userPassword; nb_line_ok_tFilterRow_1++; } else { nb_line_reject_tFilterRow_1++; } nb_line_tFilterRow_1++; tos_count_tFilterRow_1++; /** * [tFilterRow_1 main ] stop */ // Start of branch "row1" if (row1 != null) { /** * [tFileOutputLDIF_1 main ] start */ currentComponent = "tFileOutputLDIF_1"; // row1 // row1 if (execStat) { runStat.updateStatOnConnection("row1" + iterateId, 1, 1); } // //////////////////////// boolean encodingBase64 = false; StringBuilder sb_tFileOutputLDIF_1 = new StringBuilder(); boolean needSeparator_tFileOutputLDIF_1 = false; boolean canOutput_tFileOutputLDIF_1 = false; boolean isPrintable_tFileOutputLDIF_1 = false; encodingBase64 = false; String value_dn_tFileOutputLDIF_1 = ""; if (row1.dn != null && !("").equals(row1.dn)) { value_dn_tFileOutputLDIF_1 = row1.dn; util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, dn_tFileOutputLDIF_1 + value_dn_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); } encodingBase64 = false; String value_objectClass_tFileOutputLDIF_1 = ""; if (row1.objectClass != null && !("").equals(row1.objectClass)) { value_objectClass_tFileOutputLDIF_1 = row1.objectClass; String[] values_objectClass_tFileOutputLDIF_1 = value_objectClass_tFileOutputLDIF_1 .split(","); for (String item_tFileOutputLDIF_1 : values_objectClass_tFileOutputLDIF_1) { // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(item_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, // it must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } else { encodingBase64 = false; } // Add ":" to comply with base64 ldif // syntax item_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, item_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "objectClass: " + item_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); } canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_uid_tFileOutputLDIF_1 = ""; if (row1.uid != null && !("").equals(row1.uid)) { value_uid_tFileOutputLDIF_1 = row1.uid; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(value_uid_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_uid_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, value_uid_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "uid: " + value_uid_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_spectos_loginName_tFileOutputLDIF_1 = ""; if (row1.spectos_loginName != null && !("").equals(row1.spectos_loginName)) { value_spectos_loginName_tFileOutputLDIF_1 = row1.spectos_loginName; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_spectos_loginName_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_spectos_loginName_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_spectos_loginName_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "spectos_loginName: " + value_spectos_loginName_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_cn_tFileOutputLDIF_1 = ""; if (row1.cn != null && !("").equals(row1.cn)) { value_cn_tFileOutputLDIF_1 = row1.cn; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(value_cn_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_cn_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, value_cn_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "cn: " + value_cn_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_sn_tFileOutputLDIF_1 = ""; if (row1.sn != null && !("").equals(row1.sn)) { value_sn_tFileOutputLDIF_1 = row1.sn; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(value_sn_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_sn_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, value_sn_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "sn: " + value_sn_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_spectos_email_tFileOutputLDIF_1 = ""; if (row1.spectos_email != null && !("").equals(row1.spectos_email)) { value_spectos_email_tFileOutputLDIF_1 = row1.spectos_email; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_spectos_email_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_spectos_email_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_spectos_email_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "spectos_email: " + value_spectos_email_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_preferredLanguage_tFileOutputLDIF_1 = ""; if (row1.preferredLanguage != null && !("").equals(row1.preferredLanguage)) { value_preferredLanguage_tFileOutputLDIF_1 = row1.preferredLanguage; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_preferredLanguage_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_preferredLanguage_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_preferredLanguage_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "preferredLanguage: " + value_preferredLanguage_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_userPassword_tFileOutputLDIF_1 = ""; if (row1.userPassword != null && !("").equals(row1.userPassword)) { value_userPassword_tFileOutputLDIF_1 = row1.userPassword; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_userPassword_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_userPassword_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_userPassword_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "userPassword: " + value_userPassword_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } sb_tFileOutputLDIF_1.append('\n'); if (canOutput_tFileOutputLDIF_1) { pw_tFileOutputLDIF_1.write(sb_tFileOutputLDIF_1.toString()); nb_line_tFileOutputLDIF_1++; } // //////////////////////// tos_count_tFileOutputLDIF_1++; /** * [tFileOutputLDIF_1 main ] stop */ } // End of branch "row1" } // End of branch "out_decode_pw" } // End of branch "decode_pw" /** * [tFileInputLDIF_2 end ] start */ currentComponent = "tFileInputLDIF_2"; } globalMap.put("tFileInputLDIF_2_NB_LINE", nb_line_tFileInputLDIF_2); ok_Hash.put("tFileInputLDIF_2", true); end_Hash.put("tFileInputLDIF_2", System.currentTimeMillis()); /** * [tFileInputLDIF_2 end ] stop */ /** * [tMap_1 end ] start */ currentComponent = "tMap_1"; // ############################### // # Lookup hashes releasing // ############################### if (execStat) { runStat.updateStatOnConnection("decode_pw" + iterateId, 2, 0); } ok_Hash.put("tMap_1", true); end_Hash.put("tMap_1", System.currentTimeMillis()); /** * [tMap_1 end ] stop */ /** * [tFilterRow_1 end ] start */ currentComponent = "tFilterRow_1"; globalMap.put("tFilterRow_1_NB_LINE", nb_line_tFilterRow_1); globalMap.put("tFilterRow_1_NB_LINE_OK", nb_line_ok_tFilterRow_1); globalMap.put("tFilterRow_1_NB_LINE_REJECT", nb_line_reject_tFilterRow_1); if (execStat) { runStat.updateStatOnConnection("out_decode_pw" + iterateId, 2, 0); } ok_Hash.put("tFilterRow_1", true); end_Hash.put("tFilterRow_1", System.currentTimeMillis()); /** * [tFilterRow_1 end ] stop */ /** * [tFileOutputLDIF_1 end ] start */ currentComponent = "tFileOutputLDIF_1"; pw_tFileOutputLDIF_1.flush(); pw_tFileOutputLDIF_1.close(); globalMap.put("tFileOutputLDIF_1_NB_LINE", nb_line_tFileOutputLDIF_1); if (execStat) { runStat.updateStatOnConnection("row1" + iterateId, 2, 0); } ok_Hash.put("tFileOutputLDIF_1", true); end_Hash.put("tFileOutputLDIF_1", System.currentTimeMillis()); /** * [tFileOutputLDIF_1 end ] stop */ } // end the resume } catch (java.lang.Exception e) { throw new TalendException(e, currentComponent, globalMap); } catch (java.lang.Error error) { runStat.stopThreadStat(); throw new java.lang.Error(error); } globalMap.put("tFileInputLDIF_2_SUBPROCESS_STATE", 1); }
From source file:com.dbmojo.DBMojoServer.java
private static DBMojoServer getMojoServerFromConfig(String[] args) { DBMojoServer server = null;/*from w w w . j av a2 s . c om*/ try { String configFilePath = null; String json = null; JSONObject jObj = null; parseJson: { //If a command line argument is passed then assume it is the config file. //Otherwise use the default location if (args.length > 0) { configFilePath = args[0]; } else { configFilePath = DBMojoServer.defaultConfigPath; } try { json = Util.fileToString(configFilePath); } catch (Exception fileEx) { throw new Exception( "the specified config file, '" + configFilePath + "', could not be found and/or read"); } if (json == null || json.equals("")) { throw new Exception("the specified config file, '" + configFilePath + "', is empty"); } try { jObj = new JSONObject(json); } catch (Exception je) { throw new Exception( "the specified config file, '" + configFilePath + "', does not contain valid JSON"); } } //Load basic config data short serverPort = (short) jObj.optInt("serverPort"); boolean useGzip = jObj.optBoolean("useGzip"); short maxConcReq = (short) jObj.optInt("maxConcurrentRequests"); String accessLogPath = jObj.optString("accessLogPath"); String errorLogPath = jObj.optString("errorLogPath"); String debugLogPath = jObj.optString("debugLogPath"); checkMaxConcurrentReqeusts: { if (maxConcReq <= 0) { throw new Exception("please set the max concurrent requests to " + "a resonable number"); } } checkServerPort: { //Make sure serverPort was specified if (serverPort <= 0) { throw new Exception("the server port was not specified"); } //Make sure serverPort is not in use ServerSocket tSocket = null; try { tSocket = new ServerSocket(serverPort); } catch (Exception se) { tSocket = null; throw new Exception("the server port specified is already in use"); } finally { if (tSocket != null) { tSocket.close(); } tSocket = null; } } startLogs: { if (!accessLogPath.equals("")) { //Make sure accessLogPath exists Util.pathExists(accessLogPath, true); //Start logging AccessLog.start(accessLogPath); } if (!errorLogPath.equals("")) { //Make sure errorLogPath exists Util.pathExists(errorLogPath, true); //Start logging ErrorLog.start(errorLogPath); } if (!debugLogPath.equals("")) { //Make sure debugLogPath exists Util.pathExists(debugLogPath, true); //Start logging DebugLog.start(debugLogPath); } } ConcurrentHashMap<String, ConnectionPool> dbPools = new ConcurrentHashMap<String, ConnectionPool>(); loadDbAlaises: { ClassLoader classLoader = ClassLoader.getSystemClassLoader(); final JSONArray dbAliases = jObj.getJSONArray("dbAliases"); for (int i = 0; i < dbAliases.length(); i++) { final JSONObject tObj = dbAliases.getJSONObject(i); final String tAlias = tObj.getString("alias"); final String tDriver = tObj.getString("driver"); final String tDsn = tObj.getString("dsn"); final String tUsername = tObj.getString("username"); final String tPassword = tObj.getString("password"); int tMaxConnections = tObj.getInt("maxConnections"); //Seconds int tExpirationTime = tObj.getInt("expirationTime") * 1000; //Seconds int tConnectTimeout = tObj.getInt("connectTimeout"); //Make sure each alias is named if (tAlias.equals("")) { throw new Exception("alias #" + i + " is missing a name"); } //Attempt to load each JDBC driver to ensure they are on the class path try { Class aClass = classLoader.loadClass(tDriver); } catch (ClassNotFoundException cnf) { throw new Exception("JDBC Driver '" + tDriver + "' is not on the class path"); } //Make sure each alias has a JDBC connection string if (tDsn.equals("")) { throw new Exception("JDBC URL, 'dsn', is missing for alias '" + tAlias + "'"); } //Attempt to create a JDBC Connection ConnectionPool tPool; try { tPool = new JDBCConnectionPool(tDriver, tDsn, tUsername, tPassword, 1, 1, 1, tAlias); tPool.checkOut(false); } catch (Exception e) { throw new Exception( "JDBC Connection cannot be established " + "for database '" + tAlias + "'"); } finally { tPool = null; } //If the max connections option is not set for this alias //then set it to 25 if (tMaxConnections <= 0) { tMaxConnections = 25; System.out.println("DBMojoServer: Warning, 'maxConnections' " + "not set for alias '" + tAlias + "' using 25"); } //If the connection expiration time is not set for this alias then //set it to 30 seconds if (tExpirationTime <= 0) { tExpirationTime = 30; System.out.println("DBMojoServer: Warning, 'expirationTime' not " + "set for alias '" + tAlias + "' using 30 seconds"); } //If the connection timeout is not set for this alias then //set it to 10 seconds if (tConnectTimeout <= 0) { tConnectTimeout = 10; System.out.println("DBMojoServer Warning, 'connectTimeout' not " + "set for alias '" + tAlias + "' using 10 seconds"); } //Make sure another alias with the same name is not already //defined in the config if (dbPools.containsKey(tAlias)) { throw new Exception( "the alias '" + tAlias + "' is already defined in " + " the provided config file"); } //Everything is nicely set! Lets add a connection pool to the //dbPool Hashtable keyed by this alias name dbPools.put(tAlias, new JDBCConnectionPool(tDriver, tDsn, tUsername, tPassword, tMaxConnections, tExpirationTime, tConnectTimeout, tAlias)); } } loadClusters: { final JSONArray tClusters = jObj.optJSONArray("clusters"); if (tClusters != null) { for (int c = 0; c < tClusters.length(); c++) { final JSONObject tObj = tClusters.getJSONObject(c); final String tAlias = tObj.getString("alias"); final String tWriteTo = tObj.getString("writeTo"); if (dbPools.containsKey(tAlias)) { throw new Exception("the alias '" + tAlias + "' is already defined."); } if (!dbPools.containsKey(tWriteTo)) { throw new Exception( "the alias '" + tWriteTo + "' is not present in the valid dbAliases. " + "This alias cannot be used for a cluster."); } //Add the dbAlias to the cluster writeTo list ConnectionPool writeTo = dbPools.get(tWriteTo); final JSONArray tReadFrom = tObj.getJSONArray("readFrom"); ArrayList<ConnectionPool> readFromList = new ArrayList<ConnectionPool>(); for (int r = 0; r < tReadFrom.length(); r++) { final String tRead = tReadFrom.getString(r); if (!dbPools.containsKey(tRead)) { throw new Exception( "the alias '" + tRead + "' is not present in the valid dbAliases. " + "This alias cannot be used for a cluster."); } //Add the dbAlias to the cluster readFrom list readFromList.add(dbPools.get(tRead)); } dbPools.put(tAlias, new JDBCClusteredConnectionPool(tAlias, writeTo, readFromList)); } } } server = new DBMojoServer(useGzip, serverPort, maxConcReq, dbPools); } catch (Exception jsonEx) { System.out.println("DBMojoServer: Config error, " + jsonEx); System.exit(-1); } return server; }
From source file:sqs_dwh.encode_ldap_sqs_0_1.encode_ldap_sqs.java
public void tFileInputLDIF_2Process(final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tFileInputLDIF_2_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; try {//from w w w.ja v a 2 s . co m String currentMethodName = new java.lang.Exception().getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; decode_pwStruct decode_pw = new decode_pwStruct(); out_decode_pwStruct out_decode_pw = new out_decode_pwStruct(); row1Struct row1 = new row1Struct(); /** * [tFileOutputLDIF_1 begin ] start */ ok_Hash.put("tFileOutputLDIF_1", false); start_Hash.put("tFileOutputLDIF_1", System.currentTimeMillis()); currentComponent = "tFileOutputLDIF_1"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_row1 = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_row1.putIfAbsent("row1" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_row1 = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_row1 .get("row1" + iterateLoop); runStat.updateStatOnConnection("row1" + iterateId, stats_row1.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tFileOutputLDIF_1 = 0; java.io.File file_tFileOutputLDIF_1 = new java.io.File( "D:/projects/spectos/sqs/trunk/etl/SQS_DWH/data/scout2/file4_new.ldif"); // create directory only if not exists java.io.File parentFile_tFileOutputLDIF_1 = file_tFileOutputLDIF_1.getParentFile(); if (parentFile_tFileOutputLDIF_1 != null && !parentFile_tFileOutputLDIF_1.exists()) { parentFile_tFileOutputLDIF_1.mkdirs(); } class Util_tFileOutputLDIF_1 { public void breakString(StringBuilder pw, String value, int max) { int leftToGo = value.length(); int written = 0; int maxChars = max; while (leftToGo > 0) { int toWrite = Math.min(maxChars, leftToGo); String s = value.substring(written, written + toWrite); if (written != 0) { pw.append(" " + s); } else { pw.append(s); maxChars -= 1; } written += toWrite; leftToGo -= toWrite; pw.append('\n'); } } public String getBase64StringOrNot(boolean encodingBase64, String srcData, String encoding) { String returnValue = ""; try { if (encodingBase64 && !netscape.ldap.util.LDIF.isPrintable(srcData.getBytes(encoding))) { returnValue = org.apache.commons.codec.binary.Base64 .encodeBase64String(srcData.getBytes(encoding)); } else { returnValue = srcData; } } catch (java.lang.Exception e) { e.printStackTrace(); } return returnValue; } } Util_tFileOutputLDIF_1 util_tFileOutputLDIF_1 = new Util_tFileOutputLDIF_1(); int nb_line_tFileOutputLDIF_1 = 0; final String dn_tFileOutputLDIF_1 = "dn: "; final String changetype_tFileOutputLDIF_1 = "changetype: "; final int wrap_tFileOutputLDIF_1 = 78; java.io.PrintWriter pw_tFileOutputLDIF_1 = new java.io.PrintWriter(file_tFileOutputLDIF_1, "ISO-8859-15"); if (file_tFileOutputLDIF_1.length() == 0) { pw_tFileOutputLDIF_1.write("version: 1\n"); } /** * [tFileOutputLDIF_1 begin ] stop */ /** * [tFilterRow_1 begin ] start */ ok_Hash.put("tFilterRow_1", false); start_Hash.put("tFilterRow_1", System.currentTimeMillis()); currentComponent = "tFilterRow_1"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_out_decode_pw = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_out_decode_pw.putIfAbsent("out_decode_pw" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_out_decode_pw = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_out_decode_pw .get("out_decode_pw" + iterateLoop); runStat.updateStatOnConnection("out_decode_pw" + iterateId, stats_out_decode_pw.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tFilterRow_1 = 0; int nb_line_tFilterRow_1 = 0; int nb_line_ok_tFilterRow_1 = 0; int nb_line_reject_tFilterRow_1 = 0; class Operator_tFilterRow_1 { private String sErrorMsg = ""; private boolean bMatchFlag = true; private String sUnionFlag = "&&"; public Operator_tFilterRow_1(String unionFlag) { sUnionFlag = unionFlag; bMatchFlag = "||".equals(unionFlag) ? false : true; } public String getErrorMsg() { if (sErrorMsg != null && sErrorMsg.length() > 1) return sErrorMsg.substring(1); else return null; } public boolean getMatchFlag() { return bMatchFlag; } public void matches(boolean partMatched, String reason) { // no need to care about the next judgement if ("||".equals(sUnionFlag) && bMatchFlag) { return; } if (!partMatched) { sErrorMsg += "|" + reason; } if ("||".equals(sUnionFlag)) bMatchFlag = bMatchFlag || partMatched; else bMatchFlag = bMatchFlag && partMatched; } } /** * [tFilterRow_1 begin ] stop */ /** * [tMap_1 begin ] start */ ok_Hash.put("tMap_1", false); start_Hash.put("tMap_1", System.currentTimeMillis()); currentComponent = "tMap_1"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_decode_pw = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_decode_pw.putIfAbsent("decode_pw" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_decode_pw = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_decode_pw .get("decode_pw" + iterateLoop); runStat.updateStatOnConnection("decode_pw" + iterateId, stats_decode_pw.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tMap_1 = 0; // ############################### // # Lookup's keys initialization // ############################### // ############################### // # Vars initialization class Var__tMap_1__Struct { String var1; String var2; } Var__tMap_1__Struct Var__tMap_1 = new Var__tMap_1__Struct(); // ############################### // ############################### // # Outputs initialization out_decode_pwStruct out_decode_pw_tmp = new out_decode_pwStruct(); // ############################### /** * [tMap_1 begin ] stop */ /** * [tFileInputLDIF_2 begin ] start */ ok_Hash.put("tFileInputLDIF_2", false); start_Hash.put("tFileInputLDIF_2", System.currentTimeMillis()); currentComponent = "tFileInputLDIF_2"; int tos_count_tFileInputLDIF_2 = 0; // ///////////////////////////////// netscape.ldap.util.LDIF ldif_tFileInputLDIF_2 = new netscape.ldap.util.LDIF( "D:/projects/spectos/sqs/trunk/etl/SQS_DWH/data/scout2/file3.ldif"); String[] filters_tFileInputLDIF_2 = new String[] { "dn", "objectClass", "cn", "sn", "email", "givenName", "preferredLanguage", "userPassword", "zupId", "userEnabled", "debitorId", }; String[] filters_binary_tFileInputLDIF_2 = new String[] { "dn;binary", "objectClass;binary", "cn;binary", "sn;binary", "email;binary", "givenName;binary", "preferredLanguage;binary", "userPassword;binary", "zupId;binary", "userEnabled;binary", "debitorId;binary", }; String[] results_tFileInputLDIF_2 = null; List<List<byte[]>> resultsBinary_tFileInputLDIF_2 = null; int nb_line_tFileInputLDIF_2 = 0; // ///////////////////////////////// for (netscape.ldap.util.LDIFRecord record_tFileInputLDIF_2 = ldif_tFileInputLDIF_2 .nextRecord(); record_tFileInputLDIF_2 != null; record_tFileInputLDIF_2 = ldif_tFileInputLDIF_2 .nextRecord()) { results_tFileInputLDIF_2 = new String[11]; resultsBinary_tFileInputLDIF_2 = new java.util.ArrayList<List<byte[]>>(); netscape.ldap.util.LDIFContent content_tFileInputLDIF_2 = record_tFileInputLDIF_2.getContent(); netscape.ldap.LDAPAttribute[] attributes_tFileInputLDIF_2 = null; switch (content_tFileInputLDIF_2.getType()) { case netscape.ldap.util.LDIFContent.ATTRIBUTE_CONTENT: netscape.ldap.util.LDIFAttributeContent attrContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFAttributeContent) content_tFileInputLDIF_2; attributes_tFileInputLDIF_2 = attrContent_tFileInputLDIF_2.getAttributes(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (int j_tFileInputLDIF_2 = 0; j_tFileInputLDIF_2 < attributes_tFileInputLDIF_2.length; j_tFileInputLDIF_2++) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = attributes_tFileInputLDIF_2[j_tFileInputLDIF_2]; if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } } } } } break; case netscape.ldap.util.LDIFContent.ADD_CONTENT: netscape.ldap.util.LDIFAddContent addContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFAddContent) content_tFileInputLDIF_2; attributes_tFileInputLDIF_2 = addContent_tFileInputLDIF_2.getAttributes(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (int j_tFileInputLDIF_2 = 0; j_tFileInputLDIF_2 < attributes_tFileInputLDIF_2.length; j_tFileInputLDIF_2++) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = attributes_tFileInputLDIF_2[j_tFileInputLDIF_2]; if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "add"; } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } } } } } break; case netscape.ldap.util.LDIFContent.MODIFICATION_CONTENT: netscape.ldap.util.LDIFModifyContent modifyContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFModifyContent) content_tFileInputLDIF_2; netscape.ldap.LDAPModification[] modifications_tFileInputLDIF_2 = modifyContent_tFileInputLDIF_2 .getModifications(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (netscape.ldap.LDAPModification modification_tFileInputLDIF_2 : modifications_tFileInputLDIF_2) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = modification_tFileInputLDIF_2 .getAttribute(); if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "modify"; } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); boolean firstLoop_tFileInputLDIF_2 = true; for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); if (firstLoop_tFileInputLDIF_2) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + ":" + value_tFileInputLDIF_2; } else { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } firstLoop_tFileInputLDIF_2 = false; } } } } } break; case netscape.ldap.util.LDIFContent.DELETE_CONTENT: // netscape.ldap.util.LDIFDeleteContent // deleteContent_tFileInputLDIF_2 = // (netscape.ldap.util.LDIFDeleteContent) // content_tFileInputLDIF_2; for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "delete"; } } break; case netscape.ldap.util.LDIFContent.MODDN_CONTENT: netscape.ldap.util.LDIFModDNContent moddnContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFModDNContent) content_tFileInputLDIF_2; for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "modrdn"; } else if ("newrdn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = moddnContent_tFileInputLDIF_2 .getRDN(); } else if ("deleteoldrdn" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = Boolean .toString(moddnContent_tFileInputLDIF_2.getDeleteOldRDN()); } else if ("newsuperior" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = moddnContent_tFileInputLDIF_2 .getNewParent(); } } break; default: } nb_line_tFileInputLDIF_2++; // for output decode_pw = null; boolean whetherReject_tFileInputLDIF_2 = false; decode_pw = new decode_pwStruct(); try { if (0 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[0] != null) { decode_pw.dn = results_tFileInputLDIF_2[0]; } else { decode_pw.dn = null; } if (1 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[1] != null) { decode_pw.objectClass = results_tFileInputLDIF_2[1]; } else { decode_pw.objectClass = null; } if (2 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[2] != null) { decode_pw.cn = results_tFileInputLDIF_2[2]; } else { decode_pw.cn = null; } if (3 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[3] != null) { decode_pw.sn = results_tFileInputLDIF_2[3]; } else { decode_pw.sn = null; } if (4 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[4] != null) { decode_pw.email = results_tFileInputLDIF_2[4]; } else { decode_pw.email = null; } if (5 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[5] != null) { decode_pw.givenName = results_tFileInputLDIF_2[5]; } else { decode_pw.givenName = null; } if (6 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[6] != null) { decode_pw.preferredLanguage = results_tFileInputLDIF_2[6]; } else { decode_pw.preferredLanguage = null; } if (7 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[7] != null) { decode_pw.userPassword = results_tFileInputLDIF_2[7]; } else { decode_pw.userPassword = null; } if (8 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[8] != null) { decode_pw.zupId = results_tFileInputLDIF_2[8]; } else { decode_pw.zupId = null; } if (9 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[9] != null) { decode_pw.userEnabled = results_tFileInputLDIF_2[9]; } else { decode_pw.userEnabled = null; } if (10 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[10] != null) { decode_pw.debitorId = results_tFileInputLDIF_2[10]; } else { decode_pw.debitorId = null; } } catch (java.lang.Exception e) { whetherReject_tFileInputLDIF_2 = true; System.err.println(e.getMessage()); decode_pw = null; } // ///////////////////////////////// /** * [tFileInputLDIF_2 begin ] stop */ /** * [tFileInputLDIF_2 main ] start */ currentComponent = "tFileInputLDIF_2"; tos_count_tFileInputLDIF_2++; /** * [tFileInputLDIF_2 main ] stop */ // Start of branch "decode_pw" if (decode_pw != null) { /** * [tMap_1 main ] start */ currentComponent = "tMap_1"; // decode_pw // decode_pw if (execStat) { runStat.updateStatOnConnection("decode_pw" + iterateId, 1, 1); } boolean hasCasePrimitiveKeyWithNull_tMap_1 = false; // ############################### // # Input tables (lookups) boolean rejectedInnerJoin_tMap_1 = false; boolean mainRowRejected_tMap_1 = false; // ############################### { // start of Var scope // ############################### // # Vars tables Var__tMap_1__Struct Var = Var__tMap_1; Var.var1 = java.util.UUID.randomUUID().toString(); Var.var2 = decode_pw.dn.substring(decode_pw.dn.indexOf(","));// ############################### // ############################### // # Output tables out_decode_pw = null; // # Output table : 'out_decode_pw' out_decode_pw_tmp.dn = "uid=" + Var.var1 + Var.var2; out_decode_pw_tmp.objectClass = decode_pw.objectClass; out_decode_pw_tmp.uid = Var.var1; out_decode_pw_tmp.spectos_loginName = decode_pw.cn; out_decode_pw_tmp.cn = decode_pw.cn; out_decode_pw_tmp.sn = decode_pw.sn; out_decode_pw_tmp.spectos_email = decode_pw.email; out_decode_pw_tmp.preferredLanguage = decode_pw.preferredLanguage; out_decode_pw_tmp.userPassword = new String(org.apache.commons.codec.binary.Base64 .encodeBase64(decode_pw.userPassword.getBytes())); out_decode_pw_tmp.zupId = decode_pw.zupId; out_decode_pw_tmp.userEnabled = decode_pw.userEnabled; out_decode_pw_tmp.debitorId = decode_pw.debitorId; out_decode_pw = out_decode_pw_tmp; // ############################### } // end of Var scope rejectedInnerJoin_tMap_1 = false; tos_count_tMap_1++; /** * [tMap_1 main ] stop */ // Start of branch "out_decode_pw" if (out_decode_pw != null) { /** * [tFilterRow_1 main ] start */ currentComponent = "tFilterRow_1"; // out_decode_pw // out_decode_pw if (execStat) { runStat.updateStatOnConnection("out_decode_pw" + iterateId, 1, 1); } row1 = null; Operator_tFilterRow_1 ope_tFilterRow_1 = new Operator_tFilterRow_1("&&"); ope_tFilterRow_1.matches((out_decode_pw.cn.startsWith("049") == true ), "advanced condition failed"); if (ope_tFilterRow_1.getMatchFlag()) { if (row1 == null) { row1 = new row1Struct(); } row1.dn = out_decode_pw.dn; row1.objectClass = out_decode_pw.objectClass; row1.uid = out_decode_pw.uid; row1.spectos_loginName = out_decode_pw.spectos_loginName; row1.cn = out_decode_pw.cn; row1.sn = out_decode_pw.sn; row1.spectos_email = out_decode_pw.spectos_email; row1.preferredLanguage = out_decode_pw.preferredLanguage; row1.userPassword = out_decode_pw.userPassword; row1.zupId = out_decode_pw.zupId; row1.userEnabled = out_decode_pw.userEnabled; row1.debitorId = out_decode_pw.debitorId; nb_line_ok_tFilterRow_1++; } else { nb_line_reject_tFilterRow_1++; } nb_line_tFilterRow_1++; tos_count_tFilterRow_1++; /** * [tFilterRow_1 main ] stop */ // Start of branch "row1" if (row1 != null) { /** * [tFileOutputLDIF_1 main ] start */ currentComponent = "tFileOutputLDIF_1"; // row1 // row1 if (execStat) { runStat.updateStatOnConnection("row1" + iterateId, 1, 1); } // //////////////////////// boolean encodingBase64 = false; StringBuilder sb_tFileOutputLDIF_1 = new StringBuilder(); boolean needSeparator_tFileOutputLDIF_1 = false; boolean canOutput_tFileOutputLDIF_1 = false; boolean isPrintable_tFileOutputLDIF_1 = false; encodingBase64 = false; String value_dn_tFileOutputLDIF_1 = ""; if (row1.dn != null && !("").equals(row1.dn)) { value_dn_tFileOutputLDIF_1 = row1.dn; util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, dn_tFileOutputLDIF_1 + value_dn_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); } encodingBase64 = false; String value_objectClass_tFileOutputLDIF_1 = ""; if (row1.objectClass != null && !("").equals(row1.objectClass)) { value_objectClass_tFileOutputLDIF_1 = row1.objectClass; String[] values_objectClass_tFileOutputLDIF_1 = value_objectClass_tFileOutputLDIF_1 .split(","); for (String item_tFileOutputLDIF_1 : values_objectClass_tFileOutputLDIF_1) { // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(item_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, // it must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } else { encodingBase64 = false; } // Add ":" to comply with base64 ldif // syntax item_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, item_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "objectClass: " + item_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); } canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_uid_tFileOutputLDIF_1 = ""; if (row1.uid != null && !("").equals(row1.uid)) { value_uid_tFileOutputLDIF_1 = row1.uid; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(value_uid_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_uid_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, value_uid_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "uid: " + value_uid_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_spectos_loginName_tFileOutputLDIF_1 = ""; if (row1.spectos_loginName != null && !("").equals(row1.spectos_loginName)) { value_spectos_loginName_tFileOutputLDIF_1 = row1.spectos_loginName; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_spectos_loginName_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_spectos_loginName_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_spectos_loginName_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "spectos_loginName: " + value_spectos_loginName_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_cn_tFileOutputLDIF_1 = ""; if (row1.cn != null && !("").equals(row1.cn)) { value_cn_tFileOutputLDIF_1 = row1.cn; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(value_cn_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_cn_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, value_cn_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "cn: " + value_cn_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_sn_tFileOutputLDIF_1 = ""; if (row1.sn != null && !("").equals(row1.sn)) { value_sn_tFileOutputLDIF_1 = row1.sn; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(value_sn_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_sn_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, value_sn_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "sn: " + value_sn_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_spectos_email_tFileOutputLDIF_1 = ""; if (row1.spectos_email != null && !("").equals(row1.spectos_email)) { value_spectos_email_tFileOutputLDIF_1 = row1.spectos_email; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_spectos_email_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_spectos_email_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_spectos_email_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "spectos_email: " + value_spectos_email_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_preferredLanguage_tFileOutputLDIF_1 = ""; if (row1.preferredLanguage != null && !("").equals(row1.preferredLanguage)) { value_preferredLanguage_tFileOutputLDIF_1 = row1.preferredLanguage; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_preferredLanguage_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_preferredLanguage_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_preferredLanguage_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "preferredLanguage: " + value_preferredLanguage_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_userPassword_tFileOutputLDIF_1 = ""; if (row1.userPassword != null && !("").equals(row1.userPassword)) { value_userPassword_tFileOutputLDIF_1 = row1.userPassword; // Convert binary or Base64 value to Base64 // encoded string encodingBase64 = true; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_userPassword_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // Add ":" to comply with base64 ldif syntax value_userPassword_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_userPassword_tFileOutputLDIF_1, "ISO-8859-15"); if (!isPrintable_tFileOutputLDIF_1) { util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "userPassword:: " + value_userPassword_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); } else { util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "userPassword: " + value_userPassword_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); } canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_zupId_tFileOutputLDIF_1 = ""; if (row1.zupId != null && !("").equals(row1.zupId)) { value_zupId_tFileOutputLDIF_1 = row1.zupId; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(value_zupId_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_zupId_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, value_zupId_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "zupId: " + value_zupId_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_userEnabled_tFileOutputLDIF_1 = ""; if (row1.userEnabled != null && !("").equals(row1.userEnabled)) { value_userEnabled_tFileOutputLDIF_1 = row1.userEnabled; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF.isPrintable( value_userEnabled_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_userEnabled_tFileOutputLDIF_1 = util_tFileOutputLDIF_1 .getBase64StringOrNot(encodingBase64, value_userEnabled_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "userEnabled: " + value_userEnabled_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } encodingBase64 = false; String value_debitorId_tFileOutputLDIF_1 = ""; if (row1.debitorId != null && !("").equals(row1.debitorId)) { value_debitorId_tFileOutputLDIF_1 = row1.debitorId; // follow LDIF rules or not isPrintable_tFileOutputLDIF_1 = netscape.ldap.util.LDIF .isPrintable(value_debitorId_tFileOutputLDIF_1.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_1) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_debitorId_tFileOutputLDIF_1 = util_tFileOutputLDIF_1.getBase64StringOrNot( encodingBase64, value_debitorId_tFileOutputLDIF_1, "ISO-8859-15"); util_tFileOutputLDIF_1.breakString(sb_tFileOutputLDIF_1, "debitorId: " + value_debitorId_tFileOutputLDIF_1, wrap_tFileOutputLDIF_1); canOutput_tFileOutputLDIF_1 = true; } sb_tFileOutputLDIF_1.append('\n'); if (canOutput_tFileOutputLDIF_1) { pw_tFileOutputLDIF_1.write(sb_tFileOutputLDIF_1.toString()); nb_line_tFileOutputLDIF_1++; } // //////////////////////// tos_count_tFileOutputLDIF_1++; /** * [tFileOutputLDIF_1 main ] stop */ } // End of branch "row1" } // End of branch "out_decode_pw" } // End of branch "decode_pw" /** * [tFileInputLDIF_2 end ] start */ currentComponent = "tFileInputLDIF_2"; } globalMap.put("tFileInputLDIF_2_NB_LINE", nb_line_tFileInputLDIF_2); ok_Hash.put("tFileInputLDIF_2", true); end_Hash.put("tFileInputLDIF_2", System.currentTimeMillis()); /** * [tFileInputLDIF_2 end ] stop */ /** * [tMap_1 end ] start */ currentComponent = "tMap_1"; // ############################### // # Lookup hashes releasing // ############################### if (execStat) { runStat.updateStatOnConnection("decode_pw" + iterateId, 2, 0); } ok_Hash.put("tMap_1", true); end_Hash.put("tMap_1", System.currentTimeMillis()); /** * [tMap_1 end ] stop */ /** * [tFilterRow_1 end ] start */ currentComponent = "tFilterRow_1"; globalMap.put("tFilterRow_1_NB_LINE", nb_line_tFilterRow_1); globalMap.put("tFilterRow_1_NB_LINE_OK", nb_line_ok_tFilterRow_1); globalMap.put("tFilterRow_1_NB_LINE_REJECT", nb_line_reject_tFilterRow_1); if (execStat) { runStat.updateStatOnConnection("out_decode_pw" + iterateId, 2, 0); } ok_Hash.put("tFilterRow_1", true); end_Hash.put("tFilterRow_1", System.currentTimeMillis()); /** * [tFilterRow_1 end ] stop */ /** * [tFileOutputLDIF_1 end ] start */ currentComponent = "tFileOutputLDIF_1"; pw_tFileOutputLDIF_1.flush(); pw_tFileOutputLDIF_1.close(); globalMap.put("tFileOutputLDIF_1_NB_LINE", nb_line_tFileOutputLDIF_1); if (execStat) { runStat.updateStatOnConnection("row1" + iterateId, 2, 0); } ok_Hash.put("tFileOutputLDIF_1", true); end_Hash.put("tFileOutputLDIF_1", System.currentTimeMillis()); /** * [tFileOutputLDIF_1 end ] stop */ } // end the resume } catch (java.lang.Exception e) { throw new TalendException(e, currentComponent, globalMap); } catch (java.lang.Error error) { runStat.stopThreadStat(); throw new java.lang.Error(error); } globalMap.put("tFileInputLDIF_2_SUBPROCESS_STATE", 1); }
From source file:com.web.server.EJBDeployer.java
@Override public void run() { EJBJarFileListener jarFileListener = new EJBJarFileListener(registry, this.servicesRegistryPort, jarEJBMap, jarMDBMap, jms, connectionFactory); DefaultFileMonitor fm = new DefaultFileMonitor(jarFileListener); FileObject listendir = null;/*from ww w . ja v a 2 s.c o m*/ StandardFileSystemManager fsManager = new StandardFileSystemManager(); String[] dirsToScan = scanDirectory.split(";"); EJBContext ejbContext; try { File scanDirFile = new File(dirsToScan[0]); File[] scanJarFiles = scanDirFile.listFiles(); System.out.println("SCANDIRECTORY=" + scanDirectory); if (scanJarFiles != null) { for (File scanJarFile : scanJarFiles) { if (scanJarFile.isFile() && scanJarFile.getAbsolutePath().endsWith(".jar")) { URLClassLoader classLoader = new URLClassLoader( new URL[] { new URL("file:///" + scanJarFile.getAbsolutePath()) }, Thread.currentThread().getContextClassLoader()); ConfigurationBuilder config = new ConfigurationBuilder(); config.addUrls(ClasspathHelper.forClassLoader(classLoader)); config.addClassLoader(classLoader); org.reflections.Reflections reflections = new org.reflections.Reflections(config); EJBContainer container = EJBContainer .getInstance("file:///" + scanJarFile.getAbsolutePath(), config); container.inject(); Set<Class<?>> cls = reflections.getTypesAnnotatedWith(Stateless.class); Set<Class<?>> clsMessageDriven = reflections.getTypesAnnotatedWith(MessageDriven.class); Object obj; System.gc(); if (cls.size() > 0) { ejbContext = new EJBContext(); ejbContext.setJarPath(scanJarFile.getAbsolutePath()); ejbContext.setJarDeployed(scanJarFile.getName()); for (Class<?> ejbInterface : cls) { //BeanPool.getInstance().create(ejbInterface); obj = BeanPool.getInstance().get(ejbInterface); System.out.println(obj); ProxyFactory factory = new ProxyFactory(); obj = UnicastRemoteObject.exportObject((Remote) factory.createWithBean(obj), servicesRegistryPort); String remoteBinding = container.getRemoteBinding(ejbInterface); System.out.println(remoteBinding + " for EJB" + obj); if (remoteBinding != null) { //registry.unbind(remoteBinding); registry.rebind(remoteBinding, (Remote) obj); ejbContext.put(remoteBinding, obj.getClass()); } //registry.rebind("name", (Remote) obj); } jarEJBMap.put("file:///" + scanJarFile.getAbsolutePath().replace("\\", "/"), ejbContext); } System.out.println("Class Message Driven" + clsMessageDriven); if (clsMessageDriven.size() > 0) { System.out.println("Class Message Driven"); MDBContext mdbContext; ConcurrentHashMap<String, MDBContext> mdbContexts; if (jarMDBMap.get(scanJarFile.getAbsolutePath()) != null) { mdbContexts = jarMDBMap.get(scanJarFile.getAbsolutePath()); } else { mdbContexts = new ConcurrentHashMap<String, MDBContext>(); } jarMDBMap.put("file:///" + scanJarFile.getAbsolutePath().replace("\\", "/"), mdbContexts); MDBContext mdbContextOld; for (Class<?> mdbBean : clsMessageDriven) { String classwithpackage = mdbBean.getName(); System.out.println("class package" + classwithpackage); classwithpackage = classwithpackage.replace("/", "."); System.out.println("classList:" + classwithpackage.replace("/", ".")); try { if (!classwithpackage.contains("$")) { //System.out.println("executor class in ExecutorServicesConstruct"+executorServiceClass); //System.out.println(); if (!mdbBean.isInterface()) { Annotation[] classServicesAnnot = mdbBean.getDeclaredAnnotations(); if (classServicesAnnot != null) { for (int annotcount = 0; annotcount < classServicesAnnot.length; annotcount++) { if (classServicesAnnot[annotcount] instanceof MessageDriven) { MessageDriven messageDrivenAnnot = (MessageDriven) classServicesAnnot[annotcount]; ActivationConfigProperty[] activationConfigProperties = messageDrivenAnnot .activationConfig(); mdbContext = new MDBContext(); mdbContext.setMdbName(messageDrivenAnnot.name()); for (ActivationConfigProperty activationConfigProperty : activationConfigProperties) { if (activationConfigProperty.propertyName() .equals(MDBContext.DESTINATIONTYPE)) { mdbContext.setDestinationType( activationConfigProperty.propertyValue()); } else if (activationConfigProperty.propertyName() .equals(MDBContext.DESTINATION)) { mdbContext.setDestination( activationConfigProperty.propertyValue()); } else if (activationConfigProperty.propertyName() .equals(MDBContext.ACKNOWLEDGEMODE)) { mdbContext.setAcknowledgeMode( activationConfigProperty.propertyValue()); } } if (mdbContext.getDestinationType() .equals(Queue.class.getName())) { mdbContextOld = null; if (mdbContexts.get(mdbContext.getMdbName()) != null) { mdbContextOld = mdbContexts .get(mdbContext.getMdbName()); if (mdbContextOld != null && mdbContext.getDestination().equals( mdbContextOld.getDestination())) { throw new Exception( "Only one MDB can listen to destination:" + mdbContextOld .getDestination()); } } mdbContexts.put(mdbContext.getMdbName(), mdbContext); Queue queue = (Queue) jms .lookup(mdbContext.getDestination()); Connection connection = connectionFactory .createConnection("guest", "guest"); connection.start(); Session session; if (mdbContext.getAcknowledgeMode() != null && mdbContext.getAcknowledgeMode() .equals("Auto-Acknowledge")) { session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); } else { session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); } MessageConsumer consumer = session .createConsumer(queue); consumer.setMessageListener( (MessageListener) mdbBean.newInstance()); mdbContext.setConnection(connection); mdbContext.setSession(session); mdbContext.setConsumer(consumer); System.out.println("Queue=" + queue); } else if (mdbContext.getDestinationType() .equals(Topic.class.getName())) { if (mdbContexts.get(mdbContext.getMdbName()) != null) { mdbContextOld = mdbContexts .get(mdbContext.getMdbName()); if (mdbContextOld.getConsumer() != null) mdbContextOld.getConsumer() .setMessageListener(null); if (mdbContextOld.getSession() != null) mdbContextOld.getSession().close(); if (mdbContextOld.getConnection() != null) mdbContextOld.getConnection().close(); } mdbContexts.put(mdbContext.getMdbName(), mdbContext); Topic topic = (Topic) jms .lookup(mdbContext.getDestination()); Connection connection = connectionFactory .createConnection("guest", "guest"); connection.start(); Session session; if (mdbContext.getAcknowledgeMode() != null && mdbContext.getAcknowledgeMode() .equals("Auto-Acknowledge")) { session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); } else { session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); } MessageConsumer consumer = session .createConsumer(topic); consumer.setMessageListener( (MessageListener) mdbBean.newInstance()); mdbContext.setConnection(connection); mdbContext.setSession(session); mdbContext.setConsumer(consumer); System.out.println("Topic=" + topic); } } } } } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } classLoader.close(); System.out.println(scanJarFile.getAbsolutePath() + " Deployed"); } } } FileSystemOptions opts = new FileSystemOptions(); FtpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, true); fsManager.init(); for (String dir : dirsToScan) { if (dir.startsWith("ftp://")) { listendir = fsManager.resolveFile(dir, opts); } else { listendir = fsManager.resolveFile(dir); } fm.addFile(listendir); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } fm.setRecursive(true); fm.setDelay(1000); fm.start(); }
From source file:com.app.server.WarDeployer.java
/** * This method deploys the war in exploded form and configures it. * //from www . j a v a 2 s .com * @param file * @param customClassLoader * @param warDirectoryPath */ public void extractWar(File file, ClassLoader classLoader) { StringBuffer classPath = new StringBuffer(); int numBytes; WebClassLoader customClassLoader = null; CopyOnWriteArrayList<URL> jarUrls = new CopyOnWriteArrayList<URL>(); try { ConcurrentHashMap jspMap = new ConcurrentHashMap(); ZipFile zip = new ZipFile(file); ZipEntry ze = null; // String fileName=file.getName(); String directoryName = file.getName(); directoryName = directoryName.substring(0, directoryName.indexOf('.')); try { /*ClassLoader classLoader = Thread.currentThread() .getContextClassLoader();*/ // log.info("file://"+warDirectoryPath+"/WEB-INF/classes/"); jarUrls.add(new URL("file:" + scanDirectory + "/" + directoryName + "/WEB-INF/classes/")); // new WebServer().addURL(new // URL("file://"+warDirectoryPath+"/"),customClassLoader); } catch (Exception e) { log.error("syntax of the URL is incorrect", e); //e1.printStackTrace(); } String fileDirectory; Enumeration<? extends ZipEntry> entries = zip.entries(); while (entries.hasMoreElements()) { ze = entries.nextElement(); // //log.info("Unzipping " + ze.getName()); String filePath = scanDirectory + "/" + directoryName + "/" + ze.getName(); if (!ze.isDirectory()) { fileDirectory = filePath.substring(0, filePath.lastIndexOf('/')); } else { fileDirectory = filePath; } // //log.info(fileDirectory); createDirectory(fileDirectory); if (!ze.isDirectory()) { FileOutputStream fout = new FileOutputStream(filePath); byte[] inputbyt = new byte[8192]; InputStream istream = zip.getInputStream(ze); while ((numBytes = istream.read(inputbyt, 0, inputbyt.length)) >= 0) { fout.write(inputbyt, 0, numBytes); } fout.close(); istream.close(); if (ze.getName().endsWith(".jsp")) { jspMap.put(ze.getName(), filePath); } else if (ze.getName().endsWith(".jar")) { jarUrls.add(new URL("file:///" + scanDirectory + "/" + directoryName + "/" + ze.getName())); classPath.append(filePath); classPath.append(";"); } } } zip.close(); Set jsps = jspMap.keySet(); Iterator jspIterator = jsps.iterator(); classPath.append(scanDirectory + "/" + directoryName + "/WEB-INF/classes;"); jarUrls.add(new URL("file:" + scanDirectory + "/" + directoryName + "/WEB-INF/classes/;")); ArrayList<String> jspFiles = new ArrayList(); // log.info(classPath.toString()); if (jspIterator.hasNext()) { jarUrls.add(new URL("file:" + scanDirectory + "/temp/" + directoryName + "/")); customClassLoader = new WebClassLoader(jarUrls.toArray(new URL[jarUrls.size()]), classLoader); while (jspIterator.hasNext()) { String filepackageInternal = (String) jspIterator.next(); String filepackageInternalTmp = filepackageInternal; if (filepackageInternal.lastIndexOf('/') == -1) { filepackageInternal = ""; } else { filepackageInternal = filepackageInternal.substring(0, filepackageInternal.lastIndexOf('/')) .replace("/", "."); filepackageInternal = "." + filepackageInternal; } createDirectory(scanDirectory + "/temp/" + directoryName); File jspFile = new File((String) jspMap.get(filepackageInternalTmp)); String fName = jspFile.getName(); String fileNameWithoutExtension = fName.substring(0, fName.lastIndexOf(".jsp")) + "_jsp"; // String fileCreated=new JspCompiler().compileJsp((String) // jspMap.get(filepackageInternalTmp), // scanDirectory+"/temp/"+fileName, // "com.app.server"+filepackageInternal,classPath.toString()); synchronized (customClassLoader) { String fileNameInWar = filepackageInternalTmp; jspFiles.add(fileNameInWar.replace("/", "\\")); if (fileNameInWar.contains("/") || fileNameInWar.contains("\\")) { customClassLoader.addURL("/" + fileNameInWar.replace("\\", "/"), "com.app.server" + filepackageInternal.replace("WEB-INF", "WEB_002dINF") + "." + fileNameWithoutExtension); } else { customClassLoader.addURL("/" + fileNameInWar, "com.app.server" + filepackageInternal.replace("WEB-INF", "WEB_002dINF") + "." + fileNameWithoutExtension); } } } } else { customClassLoader = new WebClassLoader(jarUrls.toArray(new URL[jarUrls.size()]), classLoader); } String filePath = file.getAbsolutePath(); // log.info("filePath"+filePath); filePath = filePath.substring(0, filePath.toLowerCase().lastIndexOf(".war")); urlClassLoaderMap.put(filePath.replace("\\", "/"), customClassLoader); if (jspFiles.size() > 0) { ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); //Thread.currentThread().setContextClassLoader(customClassLoader); String classPathBefore = ""; try { JspCompiler jspc = new JspCompiler(); jspc.setUriroot(scanDirectory + "/" + directoryName); jspc.setAddWebXmlMappings(false); jspc.setListErrors(false); jspc.setCompile(true); jspc.setOutputDir(scanDirectory + "/temp/" + directoryName + "/"); jspc.setPackage("com.app.server"); StringBuffer buffer = new StringBuffer(); for (String jspFile : jspFiles) { buffer.append(","); buffer.append(jspFile); } String jsp = buffer.toString(); jsp = jsp.substring(1, jsp.length()); //log.info(jsp); classPathBefore = System.getProperty("java.class.path"); System.setProperty("java.class.path", System.getProperty("java.class.path") + ";" + classPath.toString().replace("/", "\\")); //jspc.setClassPath(System.getProperty("java.class.path")+";"+classPath.toString().replace("/", "\\")); jspc.setJspFiles(jsp); jspc.initCL(customClassLoader); jspc.execute(); //jspc.closeClassLoader(); //jspc.closeClassLoader(); } catch (Throwable je) { log.error("Error in compiling the jsp page", je); //je.printStackTrace(); } finally { System.setProperty("java.class.path", classPathBefore); //Thread.currentThread().setContextClassLoader(oldCL); } //Thread.currentThread().setContextClassLoader(customClassLoader); } try { File execxml = new File(scanDirectory + "/" + directoryName + "/WEB-INF/" + "executorservices.xml"); if (execxml.exists()) { new ExecutorServicesConstruct().getExecutorServices(serverdigester, executorServiceMap, execxml, customClassLoader); } } catch (Exception e) { log.error("error in getting executor services ", e); // e.printStackTrace(); } try { File messagingxml = new File( scanDirectory + "/" + directoryName + "/WEB-INF/" + "messagingclass.xml"); if (messagingxml.exists()) { new MessagingClassConstruct().getMessagingClass(messagedigester, messagingxml, customClassLoader, messagingClassMap); } } catch (Exception e) { log.error("Error in getting the messaging classes ", e); // e.printStackTrace(); } webxmldigester.setNamespaceAware(true); webxmldigester.setValidating(true); // digester.setRules(null); FileInputStream webxml = new FileInputStream( scanDirectory + "/" + directoryName + "/WEB-INF/" + "web.xml"); InputSource is = new InputSource(webxml); try { //log.info("SCHEMA"); synchronized (webxmldigester) { // webxmldigester.set("config/web-app_2_4.xsd"); WebAppConfig webappConfig = (WebAppConfig) webxmldigester.parse(is); servletMapping.put(scanDirectory + "/" + directoryName.replace("\\", "/"), webappConfig); } webxml.close(); } catch (Exception e) { log.error("Error in pasrsing the web.xml", e); //e.printStackTrace(); } //customClassLoader.close(); // ClassLoaderUtil.closeClassLoader(customClassLoader); } catch (Exception ex) { log.error("Error in Deploying war " + file.getAbsolutePath(), ex); } }
From source file:sqs_dwh.get_origin_password_0_1.get_origin_password.java
public void tFileInputLDIF_2Process(final java.util.Map<String, Object> globalMap) throws TalendException { globalMap.put("tFileInputLDIF_2_SUBPROCESS_STATE", 0); final boolean execStat = this.execStat; String iterateId = ""; int iterateLoop = 0; String currentComponent = ""; try {//from w w w .j a v a 2 s . com String currentMethodName = new java.lang.Exception().getStackTrace()[0].getMethodName(); boolean resumeIt = currentMethodName.equals(resumeEntryMethodName); if (resumeEntryMethodName == null || resumeIt || globalResumeTicket) {// start // the // resume globalResumeTicket = true; get_origin_pwStruct get_origin_pw = new get_origin_pwStruct(); output_origin_pwStruct output_origin_pw = new output_origin_pwStruct(); outputStruct output = new outputStruct(); /** * [tFileOutputLDIF_2 begin ] start */ ok_Hash.put("tFileOutputLDIF_2", false); start_Hash.put("tFileOutputLDIF_2", System.currentTimeMillis()); currentComponent = "tFileOutputLDIF_2"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_output = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_output.putIfAbsent("output" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_output = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_output .get("output" + iterateLoop); runStat.updateStatOnConnection("output" + iterateId, stats_output.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tFileOutputLDIF_2 = 0; java.io.File file_tFileOutputLDIF_2 = new java.io.File( "D:/projects/spectos/sqs/trunk/etl/SQS_DWH/data/scout2/scout_after_get_original_pw.ldif"); // create directory only if not exists java.io.File parentFile_tFileOutputLDIF_2 = file_tFileOutputLDIF_2.getParentFile(); if (parentFile_tFileOutputLDIF_2 != null && !parentFile_tFileOutputLDIF_2.exists()) { parentFile_tFileOutputLDIF_2.mkdirs(); } class Util_tFileOutputLDIF_2 { public void breakString(StringBuilder pw, String value, int max) { int leftToGo = value.length(); int written = 0; int maxChars = max; while (leftToGo > 0) { int toWrite = Math.min(maxChars, leftToGo); String s = value.substring(written, written + toWrite); if (written != 0) { pw.append(" " + s); } else { pw.append(s); maxChars -= 1; } written += toWrite; leftToGo -= toWrite; pw.append('\n'); } } public String getBase64StringOrNot(boolean encodingBase64, String srcData, String encoding) { String returnValue = ""; try { if (encodingBase64 && !netscape.ldap.util.LDIF.isPrintable(srcData.getBytes(encoding))) { returnValue = org.apache.commons.codec.binary.Base64 .encodeBase64String(srcData.getBytes(encoding)); } else { returnValue = srcData; } } catch (java.lang.Exception e) { e.printStackTrace(); } return returnValue; } } Util_tFileOutputLDIF_2 util_tFileOutputLDIF_2 = new Util_tFileOutputLDIF_2(); int nb_line_tFileOutputLDIF_2 = 0; final String dn_tFileOutputLDIF_2 = "dn: "; final String changetype_tFileOutputLDIF_2 = "changetype: "; final int wrap_tFileOutputLDIF_2 = 78; java.io.PrintWriter pw_tFileOutputLDIF_2 = new java.io.PrintWriter(file_tFileOutputLDIF_2, "ISO-8859-15"); if (file_tFileOutputLDIF_2.length() == 0) { pw_tFileOutputLDIF_2.write("version: 1\n"); } /** * [tFileOutputLDIF_2 begin ] stop */ /** * [tMap_2 begin ] start */ ok_Hash.put("tMap_2", false); start_Hash.put("tMap_2", System.currentTimeMillis()); currentComponent = "tMap_2"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_output_origin_pw = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_output_origin_pw.putIfAbsent("output_origin_pw" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_output_origin_pw = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_output_origin_pw .get("output_origin_pw" + iterateLoop); runStat.updateStatOnConnection("output_origin_pw" + iterateId, stats_output_origin_pw.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tMap_2 = 0; // ############################### // # Lookup's keys initialization // ############################### // ############################### // # Vars initialization class Var__tMap_2__Struct { } Var__tMap_2__Struct Var__tMap_2 = new Var__tMap_2__Struct(); // ############################### // ############################### // # Outputs initialization outputStruct output_tmp = new outputStruct(); // ############################### /** * [tMap_2 begin ] stop */ /** * [tJavaRow_1 begin ] start */ ok_Hash.put("tJavaRow_1", false); start_Hash.put("tJavaRow_1", System.currentTimeMillis()); currentComponent = "tJavaRow_1"; if (execStat) { java.util.concurrent.ConcurrentHashMap<Object, Object> concurrentHashMap_get_origin_pw = (java.util.concurrent.ConcurrentHashMap) globalMap .get("concurrentHashMap"); concurrentHashMap_get_origin_pw.putIfAbsent("get_origin_pw" + iterateLoop, new java.util.concurrent.atomic.AtomicInteger(0)); java.util.concurrent.atomic.AtomicInteger stats_get_origin_pw = (java.util.concurrent.atomic.AtomicInteger) concurrentHashMap_get_origin_pw .get("get_origin_pw" + iterateLoop); runStat.updateStatOnConnection("get_origin_pw" + iterateId, stats_get_origin_pw.incrementAndGet() <= 1 ? 0 : 1, 0); } int tos_count_tJavaRow_1 = 0; int nb_line_tJavaRow_1 = 0; /** * [tJavaRow_1 begin ] stop */ /** * [tFileInputLDIF_2 begin ] start */ ok_Hash.put("tFileInputLDIF_2", false); start_Hash.put("tFileInputLDIF_2", System.currentTimeMillis()); currentComponent = "tFileInputLDIF_2"; int tos_count_tFileInputLDIF_2 = 0; // ///////////////////////////////// netscape.ldap.util.LDIF ldif_tFileInputLDIF_2 = new netscape.ldap.util.LDIF( "D:/projects/spectos/sqs/trunk/etl/SQS_DWH/data/scout2/scout_after_decode.ldif"); String[] filters_tFileInputLDIF_2 = new String[] { "dn", "objectClass", "cn", "sn", "email", "givenName", "preferredLanguage", "userPassword", "zupId", "userEnabled", "debitorId", }; String[] filters_binary_tFileInputLDIF_2 = new String[] { "dn;binary", "objectClass;binary", "cn;binary", "sn;binary", "email;binary", "givenName;binary", "preferredLanguage;binary", "userPassword;binary", "zupId;binary", "userEnabled;binary", "debitorId;binary", }; String[] results_tFileInputLDIF_2 = null; List<List<byte[]>> resultsBinary_tFileInputLDIF_2 = null; int nb_line_tFileInputLDIF_2 = 0; // ///////////////////////////////// for (netscape.ldap.util.LDIFRecord record_tFileInputLDIF_2 = ldif_tFileInputLDIF_2 .nextRecord(); record_tFileInputLDIF_2 != null; record_tFileInputLDIF_2 = ldif_tFileInputLDIF_2 .nextRecord()) { results_tFileInputLDIF_2 = new String[11]; resultsBinary_tFileInputLDIF_2 = new java.util.ArrayList<List<byte[]>>(); netscape.ldap.util.LDIFContent content_tFileInputLDIF_2 = record_tFileInputLDIF_2.getContent(); netscape.ldap.LDAPAttribute[] attributes_tFileInputLDIF_2 = null; switch (content_tFileInputLDIF_2.getType()) { case netscape.ldap.util.LDIFContent.ATTRIBUTE_CONTENT: netscape.ldap.util.LDIFAttributeContent attrContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFAttributeContent) content_tFileInputLDIF_2; attributes_tFileInputLDIF_2 = attrContent_tFileInputLDIF_2.getAttributes(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (int j_tFileInputLDIF_2 = 0; j_tFileInputLDIF_2 < attributes_tFileInputLDIF_2.length; j_tFileInputLDIF_2++) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = attributes_tFileInputLDIF_2[j_tFileInputLDIF_2]; if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } } } } } break; case netscape.ldap.util.LDIFContent.ADD_CONTENT: netscape.ldap.util.LDIFAddContent addContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFAddContent) content_tFileInputLDIF_2; attributes_tFileInputLDIF_2 = addContent_tFileInputLDIF_2.getAttributes(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (int j_tFileInputLDIF_2 = 0; j_tFileInputLDIF_2 < attributes_tFileInputLDIF_2.length; j_tFileInputLDIF_2++) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = attributes_tFileInputLDIF_2[j_tFileInputLDIF_2]; if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "add"; } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } } } } } break; case netscape.ldap.util.LDIFContent.MODIFICATION_CONTENT: netscape.ldap.util.LDIFModifyContent modifyContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFModifyContent) content_tFileInputLDIF_2; netscape.ldap.LDAPModification[] modifications_tFileInputLDIF_2 = modifyContent_tFileInputLDIF_2 .getModifications(); for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { resultsBinary_tFileInputLDIF_2.add(new java.util.ArrayList<byte[]>()); for (netscape.ldap.LDAPModification modification_tFileInputLDIF_2 : modifications_tFileInputLDIF_2) { netscape.ldap.LDAPAttribute attribute_tFileInputLDIF_2 = modification_tFileInputLDIF_2 .getAttribute(); if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "modify"; } else { if (filters_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName()) || filters_binary_tFileInputLDIF_2[i_tFileInputLDIF_2] .equalsIgnoreCase(attribute_tFileInputLDIF_2.getName())) { byte[][] values_tFileInputLDIF_2 = attribute_tFileInputLDIF_2 .getByteValueArray(); boolean firstLoop_tFileInputLDIF_2 = true; for (byte[] byteValue_tFileInputLDIF_2 : values_tFileInputLDIF_2) { String value_tFileInputLDIF_2 = netscape.ldap.util.LDIF .toPrintableString(byteValue_tFileInputLDIF_2); resultsBinary_tFileInputLDIF_2.get(i_tFileInputLDIF_2) .add(value_tFileInputLDIF_2.getBytes("ISO-8859-15")); if (firstLoop_tFileInputLDIF_2) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] == null ? value_tFileInputLDIF_2 : results_tFileInputLDIF_2[i_tFileInputLDIF_2] + ":" + value_tFileInputLDIF_2; } else { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = results_tFileInputLDIF_2[i_tFileInputLDIF_2] + "," + value_tFileInputLDIF_2; } firstLoop_tFileInputLDIF_2 = false; } } } } } break; case netscape.ldap.util.LDIFContent.DELETE_CONTENT: // netscape.ldap.util.LDIFDeleteContent // deleteContent_tFileInputLDIF_2 = // (netscape.ldap.util.LDIFDeleteContent) // content_tFileInputLDIF_2; for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "delete"; } } break; case netscape.ldap.util.LDIFContent.MODDN_CONTENT: netscape.ldap.util.LDIFModDNContent moddnContent_tFileInputLDIF_2 = (netscape.ldap.util.LDIFModDNContent) content_tFileInputLDIF_2; for (int i_tFileInputLDIF_2 = 0; i_tFileInputLDIF_2 < filters_tFileInputLDIF_2.length; i_tFileInputLDIF_2++) { if ("dn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = record_tFileInputLDIF_2.getDN(); } else if ("changetype" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = "modrdn"; } else if ("newrdn".equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = moddnContent_tFileInputLDIF_2 .getRDN(); } else if ("deleteoldrdn" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = Boolean .toString(moddnContent_tFileInputLDIF_2.getDeleteOldRDN()); } else if ("newsuperior" .equalsIgnoreCase(filters_tFileInputLDIF_2[i_tFileInputLDIF_2])) { results_tFileInputLDIF_2[i_tFileInputLDIF_2] = moddnContent_tFileInputLDIF_2 .getNewParent(); } } break; default: } nb_line_tFileInputLDIF_2++; // for output get_origin_pw = null; boolean whetherReject_tFileInputLDIF_2 = false; get_origin_pw = new get_origin_pwStruct(); try { if (0 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[0] != null) { get_origin_pw.dn = results_tFileInputLDIF_2[0]; } else { get_origin_pw.dn = null; } if (1 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[1] != null) { get_origin_pw.objectClass = results_tFileInputLDIF_2[1]; } else { get_origin_pw.objectClass = null; } if (2 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[2] != null) { get_origin_pw.cn = results_tFileInputLDIF_2[2]; } else { get_origin_pw.cn = null; } if (3 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[3] != null) { get_origin_pw.sn = results_tFileInputLDIF_2[3]; } else { get_origin_pw.sn = null; } if (4 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[4] != null) { get_origin_pw.email = results_tFileInputLDIF_2[4]; } else { get_origin_pw.email = null; } if (5 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[5] != null) { get_origin_pw.givenName = results_tFileInputLDIF_2[5]; } else { get_origin_pw.givenName = null; } if (6 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[6] != null) { get_origin_pw.preferredLanguage = results_tFileInputLDIF_2[6]; } else { get_origin_pw.preferredLanguage = null; } if (7 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[7] != null) { get_origin_pw.userPassword = results_tFileInputLDIF_2[7]; } else { get_origin_pw.userPassword = null; } if (8 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[8] != null) { get_origin_pw.zupId = results_tFileInputLDIF_2[8]; } else { get_origin_pw.zupId = null; } if (9 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[9] != null) { get_origin_pw.userEnabled = results_tFileInputLDIF_2[9]; } else { get_origin_pw.userEnabled = null; } if (10 < results_tFileInputLDIF_2.length && results_tFileInputLDIF_2[10] != null) { get_origin_pw.debitorId = results_tFileInputLDIF_2[10]; } else { get_origin_pw.debitorId = null; } } catch (java.lang.Exception e) { whetherReject_tFileInputLDIF_2 = true; System.err.println(e.getMessage()); get_origin_pw = null; } // ///////////////////////////////// /** * [tFileInputLDIF_2 begin ] stop */ /** * [tFileInputLDIF_2 main ] start */ currentComponent = "tFileInputLDIF_2"; tos_count_tFileInputLDIF_2++; /** * [tFileInputLDIF_2 main ] stop */ // Start of branch "get_origin_pw" if (get_origin_pw != null) { /** * [tJavaRow_1 main ] start */ currentComponent = "tJavaRow_1"; // get_origin_pw // get_origin_pw if (execStat) { runStat.updateStatOnConnection("get_origin_pw" + iterateId, 1, 1); } routines.MD5Service tMD5Service = new routines.MD5Service(); // System.out.println("Store_id =" + // get_origin_pw.userPassword); // System.out.println("value =" + // tMD5Service.getStringfromMD5(get_origin_pw.userPassword)); String sValue = tMD5Service.getStringfromMD5(get_origin_pw.userPassword); String sValue1 = "tnt123456"; if (sValue.indexOf("<error>") > 0) { sValue1 = "tnt123456"; } else { sValue1 = sValue.substring(sValue.indexOf("<string><![CDATA[") + 17, sValue.indexOf("]]></string>")); } sValue = sValue.trim(); if (sValue1 == "") sValue1 = "tnt123456"; output_origin_pw.dn = get_origin_pw.dn; output_origin_pw.objectClass = get_origin_pw.objectClass; output_origin_pw.cn = get_origin_pw.cn; output_origin_pw.sn = get_origin_pw.sn; output_origin_pw.email = get_origin_pw.email; output_origin_pw.givenName = get_origin_pw.givenName; output_origin_pw.preferredLanguage = get_origin_pw.preferredLanguage; output_origin_pw.userPassword = sValue1; output_origin_pw.zupId = get_origin_pw.zupId; output_origin_pw.userEnabled = get_origin_pw.userEnabled; output_origin_pw.debitorId = get_origin_pw.debitorId; // System.out.println("sValue =" + // get_origin_pw.userPassword + " *** sValue1: " + // sValue1); /* * * String longtitude = * tDirectionService.getLongitude(row1.street + ", " + * row1.city + ", Germany"); * * row2.longtitude = longtitude; * * String latitude = * tDirectionService.getLatitude(row1.street + ", " + * row1.city + ", Germany"); * * row2.latitude = latitude; row2.store_id = * row1.store_id; */ nb_line_tJavaRow_1++; tos_count_tJavaRow_1++; /** * [tJavaRow_1 main ] stop */ /** * [tMap_2 main ] start */ currentComponent = "tMap_2"; // output_origin_pw // output_origin_pw if (execStat) { runStat.updateStatOnConnection("output_origin_pw" + iterateId, 1, 1); } boolean hasCasePrimitiveKeyWithNull_tMap_2 = false; // ############################### // # Input tables (lookups) boolean rejectedInnerJoin_tMap_2 = false; boolean mainRowRejected_tMap_2 = false; // ############################### { // start of Var scope // ############################### // # Vars tables Var__tMap_2__Struct Var = Var__tMap_2;// ############################### // ############################### // # Output tables output = null; // # Output table : 'output' output_tmp.dn = output_origin_pw.dn; output_tmp.objectClass = output_origin_pw.objectClass; output_tmp.cn = output_origin_pw.cn; output_tmp.sn = output_origin_pw.sn; output_tmp.email = output_origin_pw.email; output_tmp.givenName = output_origin_pw.givenName; output_tmp.preferredLanguage = output_origin_pw.preferredLanguage; output_tmp.userPassword = output_origin_pw.userPassword; output_tmp.zupId = output_origin_pw.zupId; output_tmp.userEnabled = output_origin_pw.userEnabled; output_tmp.debitorId = output_origin_pw.debitorId; output = output_tmp; // ############################### } // end of Var scope rejectedInnerJoin_tMap_2 = false; tos_count_tMap_2++; /** * [tMap_2 main ] stop */ // Start of branch "output" if (output != null) { /** * [tFileOutputLDIF_2 main ] start */ currentComponent = "tFileOutputLDIF_2"; // output // output if (execStat) { runStat.updateStatOnConnection("output" + iterateId, 1, 1); } // //////////////////////// boolean encodingBase64 = false; StringBuilder sb_tFileOutputLDIF_2 = new StringBuilder(); boolean needSeparator_tFileOutputLDIF_2 = false; boolean canOutput_tFileOutputLDIF_2 = false; boolean isPrintable_tFileOutputLDIF_2 = false; encodingBase64 = false; String value_dn_tFileOutputLDIF_2 = ""; if (output.dn != null && !("").equals(output.dn)) { value_dn_tFileOutputLDIF_2 = output.dn; util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, dn_tFileOutputLDIF_2 + value_dn_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); } encodingBase64 = false; String value_objectClass_tFileOutputLDIF_2 = ""; if (output.objectClass != null && !("").equals(output.objectClass)) { value_objectClass_tFileOutputLDIF_2 = output.objectClass; String[] values_objectClass_tFileOutputLDIF_2 = value_objectClass_tFileOutputLDIF_2 .split(","); for (String item_tFileOutputLDIF_2 : values_objectClass_tFileOutputLDIF_2) { // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(item_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it // must be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } else { encodingBase64 = false; } // Add ":" to comply with base64 ldif syntax item_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, item_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "objectClass: " + item_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); } canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_cn_tFileOutputLDIF_2 = ""; if (output.cn != null && !("").equals(output.cn)) { value_cn_tFileOutputLDIF_2 = output.cn; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(value_cn_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it must // be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_cn_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, value_cn_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "cn: " + value_cn_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_sn_tFileOutputLDIF_2 = ""; if (output.sn != null && !("").equals(output.sn)) { value_sn_tFileOutputLDIF_2 = output.sn; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(value_sn_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it must // be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_sn_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, value_sn_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "sn: " + value_sn_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_email_tFileOutputLDIF_2 = ""; if (output.email != null && !("").equals(output.email)) { value_email_tFileOutputLDIF_2 = output.email; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(value_email_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it must // be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_email_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, value_email_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "email: " + value_email_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_givenName_tFileOutputLDIF_2 = ""; if (output.givenName != null && !("").equals(output.givenName)) { value_givenName_tFileOutputLDIF_2 = output.givenName; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(value_givenName_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it must // be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_givenName_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, value_givenName_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "givenName: " + value_givenName_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_preferredLanguage_tFileOutputLDIF_2 = ""; if (output.preferredLanguage != null && !("").equals(output.preferredLanguage)) { value_preferredLanguage_tFileOutputLDIF_2 = output.preferredLanguage; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF.isPrintable( value_preferredLanguage_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it must // be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_preferredLanguage_tFileOutputLDIF_2 = util_tFileOutputLDIF_2 .getBase64StringOrNot(encodingBase64, value_preferredLanguage_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "preferredLanguage: " + value_preferredLanguage_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_userPassword_tFileOutputLDIF_2 = ""; if (output.userPassword != null && !("").equals(output.userPassword)) { value_userPassword_tFileOutputLDIF_2 = output.userPassword; // Convert binary or Base64 value to Base64 // encoded string encodingBase64 = true; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(value_userPassword_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // Add ":" to comply with base64 ldif syntax value_userPassword_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, value_userPassword_tFileOutputLDIF_2, "ISO-8859-15"); if (!isPrintable_tFileOutputLDIF_2) { util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "userPassword:: " + value_userPassword_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); } else { util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "userPassword: " + value_userPassword_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); } canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_zupId_tFileOutputLDIF_2 = ""; if (output.zupId != null && !("").equals(output.zupId)) { value_zupId_tFileOutputLDIF_2 = output.zupId; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(value_zupId_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it must // be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_zupId_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, value_zupId_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "zupId: " + value_zupId_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_userEnabled_tFileOutputLDIF_2 = ""; if (output.userEnabled != null && !("").equals(output.userEnabled)) { value_userEnabled_tFileOutputLDIF_2 = output.userEnabled; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(value_userEnabled_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it must // be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_userEnabled_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, value_userEnabled_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "userEnabled: " + value_userEnabled_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); canOutput_tFileOutputLDIF_2 = true; } encodingBase64 = false; String value_debitorId_tFileOutputLDIF_2 = ""; if (output.debitorId != null && !("").equals(output.debitorId)) { value_debitorId_tFileOutputLDIF_2 = output.debitorId; // follow LDIF rules or not isPrintable_tFileOutputLDIF_2 = netscape.ldap.util.LDIF .isPrintable(value_debitorId_tFileOutputLDIF_2.getBytes("ISO-8859-15")); // If content doesn't follow LDIF rules, it must // be base64 encoded if (!isPrintable_tFileOutputLDIF_2) { encodingBase64 = true; } // Add ":" to comply with base64 ldif syntax value_debitorId_tFileOutputLDIF_2 = util_tFileOutputLDIF_2.getBase64StringOrNot( encodingBase64, value_debitorId_tFileOutputLDIF_2, "ISO-8859-15"); util_tFileOutputLDIF_2.breakString(sb_tFileOutputLDIF_2, "debitorId: " + value_debitorId_tFileOutputLDIF_2, wrap_tFileOutputLDIF_2); canOutput_tFileOutputLDIF_2 = true; } sb_tFileOutputLDIF_2.append('\n'); if (canOutput_tFileOutputLDIF_2) { pw_tFileOutputLDIF_2.write(sb_tFileOutputLDIF_2.toString()); nb_line_tFileOutputLDIF_2++; } // //////////////////////// tos_count_tFileOutputLDIF_2++; /** * [tFileOutputLDIF_2 main ] stop */ } // End of branch "output" } // End of branch "get_origin_pw" /** * [tFileInputLDIF_2 end ] start */ currentComponent = "tFileInputLDIF_2"; } globalMap.put("tFileInputLDIF_2_NB_LINE", nb_line_tFileInputLDIF_2); ok_Hash.put("tFileInputLDIF_2", true); end_Hash.put("tFileInputLDIF_2", System.currentTimeMillis()); /** * [tFileInputLDIF_2 end ] stop */ /** * [tJavaRow_1 end ] start */ currentComponent = "tJavaRow_1"; globalMap.put("tJavaRow_1_NB_LINE", nb_line_tJavaRow_1); if (execStat) { runStat.updateStatOnConnection("get_origin_pw" + iterateId, 2, 0); } ok_Hash.put("tJavaRow_1", true); end_Hash.put("tJavaRow_1", System.currentTimeMillis()); if (execStat) { runStat.updateStatOnConnection("OnComponentOk2", 0, "ok"); } tLibraryLoad_1Process(globalMap); if (execStat) { runStat.updateStatOnConnection("OnComponentOk3", 0, "ok"); } tLibraryLoad_2Process(globalMap); if (execStat) { runStat.updateStatOnConnection("OnComponentOk4", 0, "ok"); } tLibraryLoad_3Process(globalMap); if (execStat) { runStat.updateStatOnConnection("OnComponentOk5", 0, "ok"); } tLibraryLoad_4Process(globalMap); /** * [tJavaRow_1 end ] stop */ /** * [tMap_2 end ] start */ currentComponent = "tMap_2"; // ############################### // # Lookup hashes releasing // ############################### if (execStat) { runStat.updateStatOnConnection("output_origin_pw" + iterateId, 2, 0); } ok_Hash.put("tMap_2", true); end_Hash.put("tMap_2", System.currentTimeMillis()); /** * [tMap_2 end ] stop */ /** * [tFileOutputLDIF_2 end ] start */ currentComponent = "tFileOutputLDIF_2"; pw_tFileOutputLDIF_2.flush(); pw_tFileOutputLDIF_2.close(); globalMap.put("tFileOutputLDIF_2_NB_LINE", nb_line_tFileOutputLDIF_2); if (execStat) { runStat.updateStatOnConnection("output" + iterateId, 2, 0); } ok_Hash.put("tFileOutputLDIF_2", true); end_Hash.put("tFileOutputLDIF_2", System.currentTimeMillis()); /** * [tFileOutputLDIF_2 end ] stop */ } // end the resume } catch (java.lang.Exception e) { throw new TalendException(e, currentComponent, globalMap); } catch (java.lang.Error error) { runStat.stopThreadStat(); throw new java.lang.Error(error); } globalMap.put("tFileInputLDIF_2_SUBPROCESS_STATE", 1); }
From source file:structuredPredictionNLG.SFX.java
/** * Infers the feature/cost vectors for the content and word actions. * @return The feature/cost vectors for the content and word actions *//*from ww w . j a v a2 s. co m*/ public Object[] inferFeatureAndCostVectors() { ConcurrentHashMap<DatasetInstance, HashMap<String, ArrayList<Instance>>> contentTrainingData = new ConcurrentHashMap<>(); ConcurrentHashMap<DatasetInstance, HashMap<String, HashMap<String, ArrayList<Instance>>>> wordTrainingData = new ConcurrentHashMap<>(); if (!getAvailableWordActions().isEmpty() && !getPredicates().isEmpty()) { // Initialize collections getTrainingData().stream().map((di) -> { contentTrainingData.put(di, new HashMap<String, ArrayList<Instance>>()); return di; }).map((di) -> { wordTrainingData.put(di, new HashMap<String, HashMap<String, ArrayList<Instance>>>()); return di; }).forEachOrdered((di) -> { getPredicates().stream().map((predicate) -> { contentTrainingData.get(di).put(predicate, new ArrayList<Instance>()); return predicate; }).map((predicate) -> { wordTrainingData.get(di).put(predicate, new HashMap<String, ArrayList<Instance>>()); return predicate; }).forEachOrdered((predicate) -> { getAttributes().get(predicate).stream().filter( (attribute) -> (!wordTrainingData.get(di).get(predicate).containsKey(attribute))) .forEachOrdered((attribute) -> { wordTrainingData.get(di).get(predicate).put(attribute, new ArrayList<Instance>()); }); }); }); // Infer the vectors in parallel processes to save time ExecutorService executor = Executors.newFixedThreadPool(THREAD_COUNT); getTrainingData().forEach((di) -> { executor.execute(new InferSFXVectorsThread(di, this, contentTrainingData, wordTrainingData)); }); executor.shutdown(); while (!executor.isTerminated()) { } } Object[] results = new Object[2]; results[0] = contentTrainingData; results[1] = wordTrainingData; return results; }
From source file:com.app.server.WarDeployer.java
public void extractWar(FileObject fileObject, WebClassLoader customClassLoader, StandardFileSystemManager fsManager) { int numBytes; try {/*from w w w .j a v a2 s . co m*/ String directoryName = fileObject.getName().getBaseName(); fileObject = fsManager.resolveFile("jar:" + fileObject.toString() + "!/"); StringBuffer classPath = new StringBuffer(); ConcurrentHashMap<String, String> jspMap = new ConcurrentHashMap<String, String>(); ArrayList<String> libs = new ArrayList<String>(); // String fileName=file.getName(); directoryName = directoryName.substring(0, directoryName.indexOf('.')); /*try { ((VFSClassLoader)customClassLoader.getParent()). // log.info("file://"+warDirectoryPath+"/WEB-INF/classes/"); customClassLoader.addURL(new URL("file:" + scanDirectory + "/" + directoryName + "/WEB-INF/classes/") ); // new WebServer().addURL(new // URL("file://"+warDirectoryPath+"/"),customClassLoader); } catch (Exception e) { log.error("syntax of the URL is incorrect", e); //e1.printStackTrace(); }*/ Vector<URL> libVec = unpack(fileObject, new File(scanDirectory + "/" + directoryName), fsManager, jspMap); //FileObject[] libraries=((VFSClassLoader)customClassLoader.getParent()).getFileObjects(); libVec.add(new URL("file:" + scanDirectory + "/" + directoryName + "/WEB-INF/classes/")); //URL[] liburl=new URL[libraries.length]; for (URL lib : libVec) { customClassLoader.addURL(lib); } //WebClassLoader web=new WebClassLoader(libVec.toArray(new URL[libVec.size()]),getClass().getClassLoader()); System.out.println(jspMap); System.out.println(libs); /*customClassLoader.addURL(new URL("file:" + scanDirectory + "/" + directoryName + "/WEB-INF/classes/") );*/ /*String fileDirectory; Enumeration<? extends ZipEntry> entries = zip.entries(); while (entries.hasMoreElements()) { ze = entries.nextElement(); // //log.info("Unzipping " + ze.getName()); String filePath = scanDirectory + "/" + directoryName + "/" + ze.getName(); if (!ze.isDirectory()) { fileDirectory = filePath.substring(0, filePath.lastIndexOf('/')); } else { fileDirectory = filePath; } // //log.info(fileDirectory); createDirectory(fileDirectory); if (!ze.isDirectory()) { FileOutputStream fout = new FileOutputStream(filePath); byte[] inputbyt = new byte[8192]; InputStream istream = zip.getInputStream(ze); while ((numBytes = istream.read(inputbyt, 0, inputbyt.length)) >= 0) { fout.write(inputbyt, 0, numBytes); } fout.close(); istream.close(); if (ze.getName().endsWith(".jsp")) { jspMap.put(ze.getName(), filePath); } else if (ze.getName().endsWith(".jar")) { customClassLoader.addURL(new URL("file:///" + scanDirectory + "/" + directoryName + "/" + ze.getName())); classPath.append(filePath); classPath.append(";"); } } } zip.close();*/ Set jsps = jspMap.keySet(); Iterator jspIterator = jsps.iterator(); /*classPath.append(scanDirectory + "/" + directoryName + "/WEB-INF/classes/;");*/ ArrayList<String> jspFiles = new ArrayList(); // log.info(classPath.toString()); if (jspIterator.hasNext()) { /*customClassLoader=new WebClassLoader(new URL[]{new URL("file:" + scanDirectory + "/temp/" + directoryName + "/")},customClassLoader);*/ customClassLoader.addURL(new URL("file:" + scanDirectory + "/temp/" + directoryName + "/")); urlClassLoaderMap.put(serverConfig.getDeploydirectory() + "/" + directoryName, customClassLoader); } else { urlClassLoaderMap.put(serverConfig.getDeploydirectory() + "/" + directoryName, customClassLoader); } while (jspIterator.hasNext()) { String filepackageInternal = (String) jspIterator.next(); String filepackageInternalTmp = filepackageInternal; if (filepackageInternal.lastIndexOf('/') == -1) { filepackageInternal = ""; } else { filepackageInternal = filepackageInternal.substring(0, filepackageInternal.lastIndexOf('/')) .replace("/", "."); filepackageInternal = "." + filepackageInternal; } createDirectory(scanDirectory + "/temp/" + directoryName); File jspFile = new File((String) jspMap.get(filepackageInternalTmp)); String fName = jspFile.getName(); String fileNameWithoutExtension = fName.substring(0, fName.lastIndexOf(".jsp")) + "_jsp"; // String fileCreated=new JspCompiler().compileJsp((String) // jspMap.get(filepackageInternalTmp), // scanDirectory+"/temp/"+fileName, // "com.app.server"+filepackageInternal,classPath.toString()); synchronized (customClassLoader) { String fileNameInWar = filepackageInternalTmp; jspFiles.add(fileNameInWar.replace("/", "\\")); if (fileNameInWar.contains("/") || fileNameInWar.contains("\\")) { customClassLoader.addURL("/" + fileNameInWar.replace("\\", "/"), "com.app.server" + filepackageInternal.replace("WEB-INF", "WEB_002dINF") + "." + fileNameWithoutExtension); } else { customClassLoader.addURL("/" + fileNameInWar, "com.app.server" + filepackageInternal.replace("WEB-INF", "WEB_002dINF") + "." + fileNameWithoutExtension); } } } if (jspFiles.size() > 0) { ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); //Thread.currentThread().setContextClassLoader(customClassLoader); JspCompiler jspc = null; try { jspc = new JspCompiler(); jspc.setUriroot(scanDirectory + "/" + directoryName); jspc.setAddWebXmlMappings(false); jspc.setCompile(true); //jspc.setClassPath("d:/deploy/StrutsProj/WEB-INF/classes/"); jspc.setOutputDir(scanDirectory + "/temp/" + directoryName + "/"); jspc.setPackage("com.app.server"); StringBuffer buffer = new StringBuffer(); for (String jspFile : jspFiles) { buffer.append(","); buffer.append(jspFile); } String jsp = buffer.toString(); jsp = jsp.substring(1, jsp.length()); //log.info(jsp); jspc.setJspFiles(jsp); //jspc.init(); jspc.initCL(customClassLoader); jspc.execute(); //jspc.closeClassLoader(); } catch (Throwable je) { log.error("Error in compiling the jsp page", je); //je.printStackTrace(); } finally { //jspc.closeClassLoader(); //Thread.currentThread().setContextClassLoader(oldCL); } //Thread.currentThread().setContextClassLoader(customClassLoader); } //System.out.println(customClassLoader.loadClass("org.apache.struts.action.ActionForm")); try { File execxml = new File(scanDirectory + "/" + directoryName + "/WEB-INF/" + "executorservices.xml"); if (execxml.exists()) { new ExecutorServicesConstruct().getExecutorServices(serverdigester, executorServiceMap, execxml, customClassLoader); } } catch (Exception e) { log.error("error in getting executor services ", e); // e.printStackTrace(); } try { File messagingxml = new File( scanDirectory + "/" + directoryName + "/WEB-INF/" + "messagingclass.xml"); if (messagingxml.exists()) { new MessagingClassConstruct().getMessagingClass(messagedigester, messagingxml, customClassLoader, messagingClassMap); } } catch (Exception e) { log.error("Error in getting the messaging classes ", e); // e.printStackTrace(); } webxmldigester.setNamespaceAware(true); webxmldigester.setValidating(true); // digester.setRules(null); FileInputStream webxml = new FileInputStream( scanDirectory + "/" + directoryName + "/WEB-INF/" + "web.xml"); InputSource is = new InputSource(webxml); try { //log.info("SCHEMA"); synchronized (webxmldigester) { // webxmldigester.set("config/web-app_2_4.xsd"); WebAppConfig webappConfig = (WebAppConfig) webxmldigester.parse(is); servletMapping.put(scanDirectory + "/" + directoryName.replace("\\", "/"), webappConfig); } webxml.close(); } catch (Exception e) { log.error("Error in pasrsing the web.xml", e); //e.printStackTrace(); } // ClassLoaderUtil.closeClassLoader(customClassLoader); } catch (Exception ex) { log.error("Error in Deploying war " + fileObject.getName().getURI(), ex); } }