public void initialize(String args[]) { Configuration.getInstance().initialize(); // Set default locale String strLocale = (String) Configuration.getInstance().getConfig().getProperty("default_locale"); if (strLocale != null && !strLocale.isEmpty()) { Locale locale = null; String[] result = strLocale.split("_"); if (result.length == 3) { locale = new Locale(result[0], result[1], result[2]); } else if (result.length == 2) { locale = new Locale(result[0], result[1]); } else if (result.length == 1) { locale = new Locale(result[0]); } Locale.setDefault(locale); } // Is this the first run ever? boolean tempFirstRun = false; if (Configuration.getInstance().getConfig().getProperty("first_run").equals("true")) { tempFirstRun = true; } final boolean firstRun = tempFirstRun; // Launch the main window java.awt.EventQueue.invokeLater( new Runnable() { public void run() { MainFrame form = new MainFrame(firstRun); form.showFrame(); } }); }
private void alreadyDonated() { Configuration.getInstance().setDonationStatus(Configuration.DonationStatus.DONATED); JOptionPane.showMessageDialog( this, "Thank you very much for donating!", "Thank You", JOptionPane.INFORMATION_MESSAGE); cancelled = false; Configuration.getInstance() .logEvent(new EventVO(Constants.EVENT_KEY_DONATION_ALREADY_DONATED).addTimestamp()); dispose(); }
public static void main(String[] args) { try { Configuration.getInstance().parseArguments(args); IOperationMode mode = Configuration.getInstance().getMode(); mode.execute(); } catch (IOException e) { logger.error("An error occured", e); } }
private Database() throws ClassNotFoundException, SQLException, JAXBException, IOException { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection( "jdbc:mysql://" + Configuration.getInstance().databaseConfiguration.hostname + "/" + Configuration.getInstance().databaseConfiguration.database, Configuration.getInstance().databaseConfiguration.username, Configuration.getInstance().databaseConfiguration.password); }
private void noThanks() { Configuration.getInstance().setDonationStatus(Configuration.DonationStatus.NO_THANK_YOU); JOptionPane.showMessageDialog( this, "Alright, no problem. We will not ask you again.\nIf you ever change your mind, you can donate from the About screen!", "No Problem", JOptionPane.INFORMATION_MESSAGE); cancelled = false; Configuration.getInstance() .logEvent(new EventVO(Constants.EVENT_KEY_DONATION_NO_THANKS).addTimestamp()); dispose(); }
/* * private method to invoke the xbel network exporter */ private void exportNetwork() throws Exception { this.taskStatus = Status.PROCESSING; this.startTask(); String exportFilename = this.resolveFilename( Configuration.getInstance().getNdexRoot() + "/exported-networks/", this.XBEL_FILE_EXTENSION); ODatabaseDocumentTx db = null; try { db = NdexDatabase.getInstance().getAConnection(); NdexTaskModelService modelService = new NdexJVMDataModelService(db); XbelNetworkExporter exporter = new XbelNetworkExporter( this.getTask().getTaskOwnerId().toString(), this.networkId, modelService, exportFilename); exporter.exportNetwork(); this.taskStatus = Status.COMPLETED; this.updateTaskStatus(this.taskStatus); } finally { if (db != null) db.close(); } }
private void createNetworkCache() throws NdexException { String networkIdStr = this.getTask().getResource(); try (NetworkDAO dao = new NetworkDAO(NdexDatabase.getInstance().getAConnection())) { Long taskCommitId = (Long) getTask().getAttribute(TaskAttribute.readOnlyCommitId); String fullpath = Configuration.getInstance().getNdexNetworkCachePath() + taskCommitId + ".gz"; ODocument d = dao.getNetworkDocByUUIDString(networkIdStr); d.reload(); Long actId = d.field(NdexClasses.Network_P_readOnlyCommitId); if (!actId.equals(taskCommitId)) { // stop task getTask() .setMessage( "Network cache not created. readOnlyCommitId=" + actId + " in db, but in task we have commitId=" + taskCommitId); return; } // create cache. Network n = dao.getNetworkById(UUID.fromString(networkIdStr)); try (GZIPOutputStream w = new GZIPOutputStream(new FileOutputStream(fullpath), 16384)) { // String s = mapper.writeValueAsString( original); ObjectMapper mapper = new ObjectMapper(); mapper.writeValue(w, n); } catch (FileNotFoundException e) { throw new NdexException("Can't create network cache file in server: " + fullpath); } catch (IOException e) { throw new NdexException( "IO Error when writing cache file: " + fullpath + ". Cause: " + e.getMessage()); } // check again. d.reload(); actId = d.field(NdexClasses.Network_P_readOnlyCommitId); if (!actId.equals(taskCommitId)) { // stop task getTask() .setMessage( "Network cache not created. Second check found network readOnlyCommitId is" + actId + ", task has commitId " + taskCommitId); return; } d.field(NdexClasses.Network_P_cacheId, taskCommitId).save(); logger.info("Cache " + actId + " created."); dao.commit(); } }
/** Constructeur par défaut */ public NetWatcher() { id = buildId(); String server = Configuration.getInstance().getProperty("ircserver"); connection = new IRCNetConnection(server, 6667, id, id); connection.addIRCEventListener(this); connection.setPong(true); connection.start(); }
@BeforeClass public static void setUpHttp() { queryPort = Configuration.getInstance().getIntegerProperty(HttpConfig.HTTP_METRIC_DATA_QUERY_PORT); httpQueryService = new HttpQueryService(); httpQueryService.startService(); vendor = new HttpClientVendor(); client = vendor.getClient(); }
/* (non-Javadoc) * @see org.masukomi.aspirin.core.MailWatcher#deliverySuccess(javax.mail.internet.MimeMessage, org.apache.mailet.MailAddress) */ public void deliverySuccess(MailQue que, MimeMessage message, MailAddress recepient) { Configuration.getInstance() .getLog() .debug( getClass().getSimpleName() + ".deliverySuccess(): recipient=" + recepient + "; msg=" + message); }
private void donate() { try { DesktopUtils.open( new URL( "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VZ7WNQVPXDZHY")); Configuration.getInstance().setDonationStatus(Configuration.DonationStatus.DONATED); JOptionPane.showMessageDialog( this, "The donation PayPal page has been opened in your browser.\n\nThank you very much for donating!", "Thank You", JOptionPane.INFORMATION_MESSAGE); cancelled = false; Configuration.getInstance() .logEvent(new EventVO(Constants.EVENT_KEY_DONATION_DONATE).addTimestamp()); dispose(); } catch (MalformedURLException e) { throw new RuntimeException(e); } }
/** * @brief This is the onCreate method * @param savedInstanceState * @details The onCreate method adds two switches to control the remember exit, and the show of * the cursor */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.configuration); Switch checkBox = (Switch) findViewById(R.id.checkbox_remember); Switch checkBoxHide = (Switch) findViewById(R.id.checkbox_hidemouse); checkBox.setChecked((Configuration.getInstance()).isRememberExit()); checkBoxHide.setChecked((Configuration.getInstance()).isHideMouse()); // efectos del actionBar final ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions( ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP); }
public static void maybeShowDonationDialog(Frame parent) { Configuration config = Configuration.getInstance(); if ((config.getLaunchCount() >= 5) && (config.getDonationStatus() == null)) { DonationDialog dialog = new DonationDialog(parent, true); dialog.setLocationRelativeTo(parent); dialog.setVisible(true); if (dialog.isCancelled()) { config.logEvent(new EventVO(Constants.EVENT_KEY_DONATION_CLOSED).addTimestamp()); } } }
/** * Created with IntelliJ IDEA. User: root Date: 1/15/14 Time: 10:15 AM To change this template use * File | Settings | File Templates. */ public class ProcDisplayImage extends HttpServlet { Configuration applicationConfig = Configuration.getInstance(Constants.APPLICATION_PROP); private static final Logger appLogging = LoggerFactory.getLogger(Constants.APPLICATION_LOG); /** * @see HttpServlet#doPost(javax.servlet.http.HttpServletRequest request, * javax.servlet.http.HttpServletResponse response) */ @SuppressWarnings("unchecked") @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String sImageID = ParseUtil.checkNull(request.getParameter("img")); if (!Utility.isNullOrEmpty(sImageID)) { UploadRequestBean uploadRequestBean = new UploadRequestBean(); uploadRequestBean.setUploadId(sImageID); UploadFile uploadFile = new UploadFile(); UploadResponseBean uploadResponseBean = uploadFile.getUploadFileInfo(uploadRequestBean); if (uploadResponseBean != null) {} } } private String getMimeType(File file) { String mimetype = ""; if (file.exists()) { if (getSuffix(file.getName()).equalsIgnoreCase("png")) { mimetype = "image/png"; } else if (getSuffix(file.getName()).equalsIgnoreCase("jpg")) { mimetype = "image/jpg"; } else if (getSuffix(file.getName()).equalsIgnoreCase("jpeg")) { mimetype = "image/jpeg"; } else if (getSuffix(file.getName()).equalsIgnoreCase("gif")) { mimetype = "image/gif"; } else { javax.activation.MimetypesFileTypeMap mtMap = new javax.activation.MimetypesFileTypeMap(); mimetype = mtMap.getContentType(file); } } return mimetype; } private String getSuffix(String filename) { String suffix = ""; int pos = filename.lastIndexOf('.'); if (pos > 0 && pos < filename.length() - 1) { suffix = filename.substring(pos + 1); } return suffix; } }
public void save() { Configuration config = Configuration.getInstance(); Properties props = config.props; props.setProperty("mx", maxMemory.tf.getText().trim()); props.setProperty("ms", initMemory.tf.getText().trim()); props.setProperty("ss", stackSize.tf.getText().trim()); props.setProperty("ext", extDirs.tf.getText().trim()); props.setProperty("clr", (clearLogs.cb.isSelected() ? "yes" : "no")); props.setProperty("ssl", (debugSSL.cb.isSelected() ? "yes" : "no")); props.setProperty("mon", (javaMonitor.cb.isSelected() ? "yes" : "no")); config.save(); }
public boolean fileChooser(boolean open, boolean onlyFiles, boolean newProject, boolean primero) { int option, var = 0; if (primero == true) { filechooser = new JFileChooser(Configuration.getPropiedades().getProperty("ULTIMOPATH")); } else { filechooser = new JFileChooser(FileChooserSelector.getPathSelected()); } if (onlyFiles == false) { filechooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); } else { filechooser.addChoosableFileFilter(new TypeFilter()); filechooser.setAcceptAllFileFilterUsed(false); filechooser.setFileSelectionMode(JFileChooser.FILES_ONLY); } if (open == true) { option = filechooser.showOpenDialog(MainApplicationJFrame.getInstance()); } else { option = filechooser.showSaveDialog(MainApplicationJFrame.getInstance()); } if (option == JFileChooser.APPROVE_OPTION) { File selectedFile = filechooser.getSelectedFile(); if (primero == true) { Configuration.getInstance().cambiarPath(selectedFile.getParent()); } FileChooserSelector.setPathDirectorioProyecto(selectedFile.getParentFile()); setNombreProyecto(selectedFile.getName()); if (newProject == true) { BufferedReader bf = null; try { bf = new BufferedReader(new FileReader(selectedFile.getAbsolutePath())); while ((linea = bf.readLine()) != null && var == 0) { if (linea.contains("xmlns=\"")) { int indexBegin = linea.indexOf("xmlns=\""); int indexEnd = linea.indexOf("#", indexBegin); setNsDefecto(linea.substring(indexBegin + 7, indexEnd).concat("#")); var = 1; } else { setNsDefecto("http://www.owl-ontologies.com/unnamed.owl"); } } try { bf.close(); } catch (IOException ex) { System.out.println("No se pudo cerrar el fichero"); } } catch (FileNotFoundException ex) { } catch (IOException ex) { } } FileChooserSelector.setPathSelected(selectedFile.getAbsolutePath()); return true; } else return false; }
/* (non-Javadoc) * @see org.masukomi.aspirin.core.MailWatcher#deliveryFailure(javax.mail.internet.MimeMessage, org.apache.mailet.MailAddress) */ public void deliveryFailure( MailQue que, MimeMessage message, MailAddress recepient, MessagingException mex) { Configuration.getInstance() .getLog() .debug( getClass().getSimpleName() + ".deliveryFailure(): recipient=" + recepient + "; msg=" + message, mex); }
// menu llamado al haber evento sobre el switch de la activity public void onToggleClicked(View view) { boolean checked = ((Switch) view).isChecked(); // Check which switch was clicked switch (view.getId()) { case R.id.checkbox_remember: if (checked) { (Configuration.getInstance()).setRememberExit(true); } else { (Configuration.getInstance()).setRememberExit(false); } break; case R.id.checkbox_hidemouse: if (checked) { (Configuration.getInstance()).setHideMouse(true); } else { (Configuration.getInstance()).setHideMouse(false); } break; } }
public void actionPerformed(ActionEvent event) { if (event.getSource().equals(launchBrowser)) { Configuration config = Configuration.getInstance(); String ip = Util.getIPAddress(); String protocol = "http" + (config.ssl ? "s" : ""); String url = protocol + "://" + ip + ":" + config.port; Util.openURL(url); } else if (event.getSource().equals(stop)) { Util.shutdown(); running = Util.isRunning(); setStatus(); } else if (event.getSource().equals(start)) { clearLogsDir(); run(); launchBrowser.requestFocusInWindow(); } }
/** * 获取access_token * * @param appId 开发者id * @param secret 开发者密码 * @return access_token */ public static String getAccessToken(String appId, String secret) { if (StringUtils.isEmpty(appId) || StringUtils.isEmpty(secret)) { throw new IllegalArgumentException("获取access_token时,必须指定appid和secret!"); } AccessToken at = pool.get(appId); // 如果不存在或者已过期,则重新获取 if (at == null || new Date().getTime() - at.getExpiresIn() >= expire) { pool.remove(appId); // 发起请求获得新的token String tokenUrl = Configuration.getInstance().getProperty("wechat.url.accessToken"); if (StringUtils.isEmpty(tokenUrl)) throw new WeChatConfigException( "\u6CA1\u6709\u83B7\u5F97AccessToken\u7684\u8BBF\u95EE\u5730\u5740" + "!"); String url = PlaceholderFormat.format(tokenUrl, new String[] {appId, secret}); String json = SimpleRequest.doGet(url); Gson gson = new Gson(); at = (AccessToken) gson.fromJson(json, AccessToken.class); pool.put(appId, at); } return at.getAccessToken(); }
public boolean isMatrikelNoAvailableToTutors() { return Configuration.getInstance().isMatrikelNoAvailableToTutors(); }
/** * Returns the path to the servlets * * @return the path */ public String getAdminMail() { return Configuration.getInstance().getAdminMail(); }
/** * Returns the path to the servlets * * @return the path */ public String getServletsPath() { return Configuration.getInstance().getServletsPath(); }
/** * Returns the path to the submissions * * @return the path */ public File getDataPath() { return Configuration.getInstance().getDataPath(); }
/** * Support method for main program. This support method can also be invoked from subclasses that * support the same command line interface * * @param args the command-line arguments * @param name name of the class, to be used in error messages */ protected void doQuery(String args[], String name) { boolean showTime = false; int repeat = 1; String sourceFileName = null; String queryFileName = null; File sourceFile; File outputFile; boolean useURLs = false; String outputFileName = null; boolean explain = false; boolean wrap = false; boolean pullMode = false; boolean schemaAware = false; for (int i = 0; i < args.length; i++) { if (args[i].equals("-sa")) { schemaAware = true; } else if (args[i].equals("-val")) { schemaAware = true; } else if (args[i].equals("-vlax")) { schemaAware = true; } else if (args[i].equals("-p")) { schemaAware = true; } } config = makeConfiguration(schemaAware); config.setHostLanguage(Configuration.XQUERY); StaticQueryContext staticEnv = new StaticQueryContext(config); DynamicQueryContext dynamicEnv = new DynamicQueryContext(config); Properties outputProps = new Properties(); // Check the command-line arguments. try { int i = 0; while (i < args.length) { if (args[i].charAt(0) == '-') { if (args[i].equals("-cr")) { i++; if (args.length < i + 1) { badUsage(name, "No output file name"); } String crclass = args[i++]; Object resolver = config.getInstance(crclass, null); if (!(resolver instanceof CollectionURIResolver)) { quit(crclass + " is not a CollectionURIResolver", 2); } config.setCollectionURIResolver((CollectionURIResolver) resolver); } else if (args[i].equals("-ds")) { config.setTreeModel(Builder.LINKED_TREE); i++; } else if (args[i].equals("-dt")) { config.setTreeModel(Builder.TINY_TREE); i++; } else if (args[i].equals("-e")) { explain = true; i++; } else if (args[i].equals("-l")) { config.setLineNumbering(true); i++; } else if (args[i].equals("-3")) { // undocumented option: do it thrice i++; repeat = 3; } else if (args[i].equals("-9")) { // undocumented option: do it nine times i++; repeat = 9; } else if (args[i].equals("-mr")) { i++; if (args.length < i + 1) { badUsage(name, "No ModuleURIResolver class"); } String r = args[i++]; config.setModuleURIResolver(r); } else if (args[i].equals("-noext")) { i++; config.setAllowExternalFunctions(false); } else if (args[i].equals("-o")) { i++; if (args.length < i + 1) { badUsage(name, "No output file name"); } outputFileName = args[i++]; } else if (args[i].equals("-p")) { i++; setPOption(config); useURLs = true; } else if (args[i].equals("-pull")) { i++; pullMode = true; } else if (args[i].equals("-r")) { i++; if (args.length < i + 1) { badUsage(name, "No URIResolver class"); } String r = args[i++]; config.setURIResolver(config.makeURIResolver(r)); dynamicEnv.setURIResolver(config.makeURIResolver(r)); } else if (args[i].equals("-s")) { i++; if (args.length < i + 1) { badUsage(name, "No source file name"); } sourceFileName = args[i++]; } else if (args[i].equals("-sa")) { // already handled i++; } else if (args[i].equals("-snone")) { config.setStripsWhiteSpace(Whitespace.NONE); i++; } else if (args[i].equals("-sall")) { config.setStripsWhiteSpace(Whitespace.ALL); i++; } else if (args[i].equals("-signorable")) { config.setStripsWhiteSpace(Whitespace.IGNORABLE); i++; } else if (args[i].equals("-strip")) { // retained for compatibility config.setStripsWhiteSpace(Whitespace.ALL); i++; } else if (args[i].equals("-t")) { System.err.println(config.getProductTitle()); // System.err.println("Java version " + System.getProperty("java.version")); System.err.println(config.getPlatform().getPlatformVersion()); config.setTiming(true); showTime = true; i++; } else if (args[i].equals("-T")) { config.setTraceListener(new XQueryTraceListener()); i++; } else if (args[i].equals("-TJ")) { i++; config.setTraceExternalFunctions(true); } else if (args[i].equals("-TL")) { if (args.length < i + 2) { badUsage(name, "No TraceListener class specified"); } TraceListener traceListener = config.makeTraceListener(args[++i]); config.setTraceListener(traceListener); config.setLineNumbering(true); i++; } else if (args[i].equals("-u")) { useURLs = true; i++; } else if (args[i].equals("-untyped")) { // TODO: this is an experimental undocumented option. It should be checked for // consistency config.setAllNodesUntyped(true); i++; } else if (args[i].equals("-v")) { config.setValidation(true); i++; } else if (args[i].equals("-val")) { if (schemaAware) { config.setSchemaValidationMode(Validation.STRICT); } else { quit("The -val option requires a schema-aware processor", 2); } i++; } else if (args[i].equals("-vlax")) { if (schemaAware) { config.setSchemaValidationMode(Validation.LAX); } else { quit("The -vlax option requires a schema-aware processor", 2); } i++; } else if (args[i].equals("-vw")) { if (schemaAware) { config.setValidationWarnings(true); } else { quit("The -vw option requires a schema-aware processor", 2); } i++; } else if (args[i].equals("-wrap")) { wrap = true; i++; } else if (args[i].equals("-1.1")) { config.setXMLVersion(Configuration.XML11); i++; } else if (args[i].equals("-?")) { badUsage(name, ""); } else if (args[i].equals("-")) { queryFileName = "-"; i++; } else { badUsage(name, "Unknown option " + args[i]); } } else { break; } } if (!("-".equals(queryFileName))) { if (args.length < i + 1) { badUsage(name, "No query file name"); } queryFileName = args[i++]; } for (int p = i; p < args.length; p++) { String arg = args[p]; int eq = arg.indexOf("="); if (eq < 1 || eq >= arg.length() - 1) { badUsage(name, "Bad param=value pair on command line: " + arg); } String argname = arg.substring(0, eq); if (argname.startsWith("!")) { // parameters starting with "!" are taken as output properties outputProps.setProperty(argname.substring(1), arg.substring(eq + 1)); } else if (argname.startsWith("+")) { // parameters starting with "+" are taken as input documents Object sources = Transform.loadDocuments(arg.substring(eq + 1), useURLs, config, true); dynamicEnv.setParameter(argname.substring(1), sources); } else { dynamicEnv.setParameter(argname, new UntypedAtomicValue(arg.substring(eq + 1))); } } config.displayLicenseMessage(); if (pullMode) { config.setLazyConstructionMode(true); } Source sourceInput = null; if (sourceFileName != null) { if (useURLs || sourceFileName.startsWith("http:") || sourceFileName.startsWith("file:")) { sourceInput = config.getURIResolver().resolve(sourceFileName, null); if (sourceInput == null) { sourceInput = config.getSystemURIResolver().resolve(sourceFileName, null); } } else if (sourceFileName.equals("-")) { // take input from stdin sourceInput = new StreamSource(System.in); } else { sourceFile = new File(sourceFileName); if (!sourceFile.exists()) { quit("Source file " + sourceFile + " does not exist", 2); } if (config.getPlatform() instanceof JavaPlatform) { InputSource eis = new InputSource(sourceFile.toURI().toString()); sourceInput = new SAXSource(eis); } else { sourceInput = new StreamSource(sourceFile.toURI().toString()); } } } long startTime = (new Date()).getTime(); if (showTime) { System.err.println("Compiling query from " + queryFileName); } XQueryExpression exp; try { if (queryFileName.equals("-")) { Reader queryReader = new InputStreamReader(System.in); exp = staticEnv.compileQuery(queryReader); } else if (queryFileName.startsWith("{") && queryFileName.endsWith("}")) { // query is inline on the command line String q = queryFileName.substring(1, queryFileName.length() - 1); exp = staticEnv.compileQuery(q); } else if (useURLs || queryFileName.startsWith("http:") || queryFileName.startsWith("file:")) { ModuleURIResolver resolver = config.getModuleURIResolver(); String[] locations = {queryFileName}; Source[] sources = resolver.resolve(null, null, locations); if (sources.length != 1 || !(sources[0] instanceof StreamSource)) { quit("Module URI Resolver must return a single StreamSource", 2); } String queryText = QueryReader.readSourceQuery((StreamSource) sources[0], config.getNameChecker()); exp = staticEnv.compileQuery(queryText); } else { InputStream queryStream = new FileInputStream(queryFileName); staticEnv.setBaseURI(new File(queryFileName).toURI().toString()); exp = staticEnv.compileQuery(queryStream, null); } staticEnv = exp.getStaticContext(); // the original staticContext is copied if (showTime) { long endTime = (new Date()).getTime(); System.err.println("Compilation time: " + (endTime - startTime) + " milliseconds"); startTime = endTime; } } catch (XPathException err) { int line = -1; String module = null; if (err.getLocator() != null) { line = err.getLocator().getLineNumber(); module = err.getLocator().getSystemId(); } if (err.hasBeenReported()) { quit("Failed to compile query", 2); } else { if (line == -1) { System.err.println("Failed to compile query: " + err.getMessage()); } else { System.err.println("Static error at line " + line + " of " + module + ':'); System.err.println(err.getMessage()); } } exp = null; System.exit(2); } if (explain) { staticEnv.getExecutable().getKeyManager().explainKeys(config); staticEnv.explainGlobalVariables(); staticEnv.explainGlobalFunctions(); exp.explain(staticEnv.getConfiguration()); } OutputStream destination; if (outputFileName != null) { outputFile = new File(outputFileName); if (outputFile.isDirectory()) { quit("Output is a directory", 2); } destination = new FileOutputStream(outputFile); } else { destination = System.out; } for (int r = 0; r < repeat; r++) { // repeat is for internal testing/timing if (sourceInput != null) { if (showTime) { System.err.println("Processing " + sourceInput.getSystemId()); } DocumentInfo doc = staticEnv.buildDocument(sourceInput); dynamicEnv.setContextItem(doc); } try { if (wrap) { SequenceIterator results = exp.iterator(dynamicEnv); DocumentInfo resultDoc = QueryResult.wrap(results, config); QueryResult.serialize(resultDoc, new StreamResult(destination), outputProps, config); destination.close(); } else if (pullMode) { if (wrap) { outputProps.setProperty(SaxonOutputKeys.WRAP, "yes"); } try { exp.pull(dynamicEnv, new StreamResult(destination), outputProps); } catch (XPathException err) { config.reportFatalError(err); throw err; } } else { exp.run(dynamicEnv, new StreamResult(destination), outputProps); } } catch (TerminationException err) { throw err; } catch (XPathException err) { if (err.hasBeenReported()) { throw new DynamicError("Run-time errors were reported"); } else { throw err; } } if (showTime) { long endTime = (new Date()).getTime(); System.err.println("Execution time: " + (endTime - startTime) + " milliseconds"); startTime = endTime; } } } catch (TerminationException err) { quit(err.getMessage(), 1); } catch (XPathException err) { quit("Query processing failed: " + err.getMessage(), 2); } catch (TransformerFactoryConfigurationError err) { err.printStackTrace(); quit("Query processing failed", 2); } catch (Exception err2) { err2.printStackTrace(); quit("Fatal error during transformation: " + err2.getMessage(), 2); } }
private Document<Feed> getFeedDocument(RequestContext context) throws ResponseContextException { Target target = context.getTarget(); String collection = target.getParameter("collection"); LOG.debug("Feed for collection:" + collection); // String priority = target.getParameter("priority"); // String deadline = target.getParameter("deadline"); // Locale preferredLocale = context.getPreferredLocale(); String user = target.getParameter("user"); String password = target.getParameter("password"); String token = target.getParameter("token"); Feed feed = createFeedBase(context); TokenClient tokenClient = Configuration.getInstance().getTokenClient(); try { if (token != null) { Property[] props = tokenClient.getTokenProperties(token); user = (String) PropertyUtils.getProperty(props, AuthenticationConstants.PROPERTY_USER).getValue(); } else if (user != null && password != null) { token = tokenClient.authenticateUser(user, password); } else throw new Exception("No credentials"); feed.setSubtitle("This is a feed for the following user:"******"Credential exception", e1); throw new ResponseContextException(500, e1); } feed.setId("IntalioFEEDID"); feed.setMustPreserveWhitespace(true); feed.setUpdated(new Date()); try { ITaskManagementService client = new RemoteTMSFactory(Configuration.getInstance().getTmsService(), token).getService(); if (collection.equalsIgnoreCase(IntalioFeeds.PROCESSES.name())) { feed.setTitle("Intalio Processes"); addTasksToFeed( context, feed, client.getAvailableTasks(PIPATask.class.getSimpleName(), null), token, user); } else if (collection.equalsIgnoreCase(IntalioFeeds.TASKS.name())) { feed.setTitle("Intalio Tasks"); addTasksToFeed( context, feed, client.getAvailableTasks( PATask.class.getSimpleName(), "T._state <> TaskState.COMPLETED"), token, user); addTasksToFeed( context, feed, client.getAvailableTasks( Notification.class.getSimpleName(), "T._state <> TaskState.COMPLETED"), token, user); } else if (collection.equalsIgnoreCase(IntalioFeeds.ALL.name())) { feed.setTitle("Full Intalio Feeds"); addTasksToFeed(context, feed, client.getTaskList(), token, user); } else throw new Exception("Invalid collection requestsed"); feed.addCategory(collection); } catch (Exception e) { LOG.error("Feed exception", e); throw new ResponseContextException(500, e); } if (LOG.isDebugEnabled()) try { feed.writeTo(System.out); } catch (IOException e) { } return feed.getDocument(); }
/** Reading and writing of Blu-Ray captions demuxed from M2TS transport streams (BD-SUP). */ public class SupBD implements SubtitleStream { private static final Configuration configuration = Configuration.getInstance(); private static final Logger logger = Logger.getInstance(); private FileBuffer buffer; private List<SubPictureBD> subPictures = new ArrayList<SubPictureBD>(); private int forcedFrameCount; /** color palette of the last decoded caption */ private Palette palette; /** bitmap of the last decoded caption */ private Bitmap bitmap; /** index of dominant color for the current caption */ private int primaryColorIndex; public SupBD(String filename) throws CoreException { SupBDParser parser = new SupBDParser(filename); buffer = parser.getBuffer(); subPictures = parser.getSubPictures(); forcedFrameCount = parser.getForcedFrameCount(); } /** * Decode caption from the input stream. * * @param subPictureBD SubPicture object containing info about the caption * @param transparentColorIndex index of the transparent color * @return bitmap of the decoded caption * @throws CoreException */ private Bitmap decodeImage(SubPictureBD subPictureBD, int transparentColorIndex) throws CoreException { int width = subPictureBD.getImageWidth(); int height = subPictureBD.getImageHeight(); // always decode image obj 0, start with first entry in fragment list ImageObjectFragment imageObjectFragment = subPictureBD.getImageObject().getFragmentList().get(0); long startOfs = imageObjectFragment.getImageBufferOfs(); if (width > subPictureBD.getWidth() || height > subPictureBD.getHeight()) { throw new CoreException( "Subpicture too large: " + width + "x" + height + " at offset " + ToolBox.toHexLeftZeroPadded(startOfs, 8)); } Bitmap bm = new Bitmap(width, height, (byte) transparentColorIndex); int b; int index = 0; int ofs = 0; int size; int xpos = 0; try { // just for multi-packet support, copy all of the image data in one common buffer byte[] buffer = new byte[subPictureBD.getImageObject().getBufferSize()]; index = 0; for (ImageObjectFragment fragment : subPictureBD.getImageObject().getFragmentList()) { // copy data of all packet to one common buffer imageObjectFragment = fragment; for (int i = 0; i < imageObjectFragment.getImagePacketSize(); i++) { buffer[index + i] = (byte) this.buffer.getByte(imageObjectFragment.getImageBufferOfs() + i); } index += imageObjectFragment.getImagePacketSize(); } index = 0; do { b = buffer[index++] & 0xff; if (b == 0) { b = buffer[index++] & 0xff; if (b == 0) { // next line ofs = (ofs / width) * width; if (xpos < width) { ofs += width; } xpos = 0; } else { if ((b & 0xC0) == 0x40) { // 00 4x xx -> xxx zeroes size = ((b - 0x40) << 8) + (buffer[index++] & 0xff); for (int i = 0; i < size; i++) { bm.getInternalBuffer()[ofs++] = 0; /*(byte)b;*/ } xpos += size; } else if ((b & 0xC0) == 0x80) { // 00 8x yy -> x times value y size = (b - 0x80); b = buffer[index++] & 0xff; for (int i = 0; i < size; i++) { bm.getInternalBuffer()[ofs++] = (byte) b; } xpos += size; } else if ((b & 0xC0) != 0) { // 00 cx yy zz -> xyy times value z size = ((b - 0xC0) << 8) + (buffer[index++] & 0xff); b = buffer[index++] & 0xff; for (int i = 0; i < size; i++) { bm.getInternalBuffer()[ofs++] = (byte) b; } xpos += size; } else { // 00 xx -> xx times 0 for (int i = 0; i < b; i++) { bm.getInternalBuffer()[ofs++] = 0; } xpos += b; } } } else { bm.getInternalBuffer()[ofs++] = (byte) b; xpos++; } } while (index < buffer.length); return bm; } catch (FileBufferException ex) { throw new CoreException(ex.getMessage()); } catch (ArrayIndexOutOfBoundsException ex) { logger.warn( "Problems during RLE decoding of picture OBJ at offset " + ToolBox.toHexLeftZeroPadded(startOfs + index, 8) + "\n"); return bm; } } /** * decode palette from the input stream * * @param pic SubPicture object containing info about the current caption * @return * @throws CoreException */ private Palette decodePalette(SubPictureBD pic) throws CoreException { boolean fadeOut = false; int paletteIndex; List<PaletteInfo> paletteInfos = pic.getPalettes().get(pic.getImageObject().getPaletteID()); if (paletteInfos == null) { throw new CoreException("Palette ID out of bounds."); } Palette palette = new Palette(256, Core.usesBT601()); // by definition, index 0xff is always completely transparent // also all entries must be fully transparent after initialization try { for (PaletteInfo paletteInfo : paletteInfos) { int index = paletteInfo.getPaletteOffset(); for (int i = 0; i < paletteInfo.getPaletteSize(); i++) { // each palette entry consists of 5 bytes paletteIndex = buffer.getByte(index); int y = buffer.getByte(++index); int cr, cb; if (configuration.isSwapCrCb()) { cb = buffer.getByte(++index); cr = buffer.getByte(++index); } else { cr = buffer.getByte(++index); cb = buffer.getByte(++index); } int alpha = buffer.getByte(++index); int alphaOld = palette.getAlpha(paletteIndex); // avoid fading out if (alpha >= alphaOld) { if (alpha < configuration .getAlphaCrop()) { // to not mess with scaling algorithms, make transparent // color black y = 16; cr = 128; cb = 128; } palette.setAlpha(paletteIndex, alpha); } else { fadeOut = true; } palette.setYCbCr(paletteIndex, y, cb, cr); index++; } } if (fadeOut) { logger.warn("fade out detected -> patched palette\n"); } return palette; } catch (FileBufferException ex) { throw new CoreException(ex.getMessage()); } } /** * decode given picture * * @param pic SubPicture object containing info about caption * @throws CoreException */ private void decode(SubPictureBD pic) throws CoreException { palette = decodePalette(pic); bitmap = decodeImage(pic, palette.getIndexOfMostTransparentPaletteEntry()); primaryColorIndex = bitmap.getPrimaryColorIndex( palette.getAlpha(), configuration.getAlphaThreshold(), palette.getY()); } /* (non-Javadoc) * @see SubtitleStream#decode(int) */ public void decode(int index) throws CoreException { if (index < subPictures.size()) { decode(subPictures.get(index)); } else { throw new CoreException("Index " + index + " out of bounds\n"); } } /* (non-Javadoc) * @see SubtitleStream#getPalette() */ public Palette getPalette() { return palette; } /* (non-Javadoc) * @see SubtitleStream#getBitmap() */ public Bitmap getBitmap() { return bitmap; } /* (non-Javadoc) * @see SubtitleStream#getImage() */ public BufferedImage getImage() { return bitmap.getImage(palette.getColorModel()); } /* (non-Javadoc) * @see SubtitleStream#getImage(Bitmap) */ public BufferedImage getImage(Bitmap bm) { return bm.getImage(palette.getColorModel()); } /* (non-Javadoc) * @see SubtitleStream#getPrimaryColorIndex() */ public int getPrimaryColorIndex() { return primaryColorIndex; } /* (non-Javadoc) * @see SubtitleStream#getSubPicture(int) */ public SubPicture getSubPicture(int index) { return subPictures.get(index); } /* (non-Javadoc) * @see SubtitleStream#getNumFrames() */ public int getFrameCount() { return subPictures.size(); } /* (non-Javadoc) * @see SubtitleStream#getForcedFrameCount() */ public int getForcedFrameCount() { return forcedFrameCount; } /* (non-Javadoc) * @see SubtitleStream#close() */ public void close() { if (buffer != null) { buffer.close(); } } /* (non-Javadoc) * @see SubtitleStream#getEndTime(int) */ public long getEndTime(int index) { return subPictures.get(index).getEndTime(); } /* (non-Javadoc) * @see SubtitleStream#getStartTime(int) */ public long getStartTime(int index) { return subPictures.get(index).getStartTime(); } /* (non-Javadoc) * @see SubtitleStream#isForced(int) */ public boolean isForced(int index) { return subPictures.get(index).isForced(); } /* (non-Javadoc) * @see SubtitleStream#getStartOffset(int) */ public long getStartOffset(int index) { SubPictureBD pic = subPictures.get(index); return pic.getImageObject().getFragmentList().get(0).getImageBufferOfs(); } /** * Get frame rate for given caption * * @param index index of caption * @return frame rate */ public double getFps(int index) { return Framerate.valueForId(subPictures.get(index).getType()); } }
private void askLater() { cancelled = false; Configuration.getInstance() .logEvent(new EventVO(Constants.EVENT_KEY_DONATION_ASK_LATER).addTimestamp()); dispose(); }
public JavaPanel() { super(); setLayout(new BorderLayout()); config = Configuration.getInstance(); Properties props = config.props; running = false; Util.isRunning(); JPanel main = new JPanel(); main.setLayout(new BorderLayout()); main.setBackground(bgColor); // North Panel JPanel np = new JPanel(); np.setBackground(bgColor); JLabel title = new JLabel(config.programName); title.setFont(new Font("SansSerif", Font.BOLD, 24)); title.setForeground(Color.BLUE); np.add(title); np.setBorder(BorderFactory.createEmptyBorder(10, 0, 20, 0)); main.add(np, BorderLayout.NORTH); // Center Panel RowPanel javaPanel = new RowPanel("Java Parameters"); javaPanel.setBackground(bgColor); javaPanel.addRow(initMemory = new Row("Initial memory pool:", props.getProperty("ms", ""))); javaPanel.addRow(maxMemory = new Row("Maximum memory pool:", props.getProperty("mx", ""))); javaPanel.addRow(stackSize = new Row("Thread stack size:", props.getProperty("ss", ""))); javaPanel.addRow(extDirs = new Row("Extensions directory:", props.getProperty("ext", ""))); javaPanel.addRow( debugSSL = new CBRow("Enable SSL debugging:", props.getProperty("ssl", "").equals("yes"))); javaPanel.addRow( javaMonitor = new CBRow("Enable Java monitoring:", props.getProperty("mon", "").equals("yes"))); RowPanel serverPanel = new RowPanel("Server Parameters"); serverPanel.setBackground(bgColor); serverPanel.addRow(serverPort = new Row("Server port:", Integer.toString(config.port))); serverPanel.addRow( clearLogs = new CBRow("Clear logs on start:", props.getProperty("clr", "").equals("yes"))); JPanel cp = new JPanel(); cp.setLayout(new RowLayout()); cp.setBackground(bgColor); cp.add(serverPanel); cp.add(RowLayout.crlf()); cp.add(Box.createVerticalStrut(20)); cp.add(RowLayout.crlf()); cp.add(javaPanel); cp.add(RowLayout.crlf()); JPanel ccp = new JPanel(new FlowLayout()); ccp.setBackground(bgColor); ccp.add(cp); main.add(ccp, BorderLayout.CENTER); // South Panel JPanel sp = new JPanel(); sp.setBorder(BorderFactory.createEmptyBorder(10, 0, 20, 0)); sp.setBackground(bgColor); start = new JButton("Start"); sp.add(start); start.addActionListener(this); sp.add(Box.createHorizontalStrut(15)); stop = new JButton("Stop"); sp.add(stop); stop.addActionListener(this); sp.add(Box.createHorizontalStrut(70)); launchBrowser = new JButton(config.browserButtonName + " Home Page"); sp.add(launchBrowser); launchBrowser.addActionListener(this); main.add(sp, BorderLayout.SOUTH); this.add(main, BorderLayout.CENTER); this.add(new StatusPanel(status), BorderLayout.SOUTH); running = Util.isRunning(); setStatus(); }
public class PaymentForOnlineService { private static Log log = LogFactory.getLog(PaymentForOnlineService.class); private static String p1_MerId = Configuration.getInstance().getValue("p1_MerId"); // 商家ID private static String queryRefundReqURL = Configuration.getInstance().getValue("queryRefundReqURL"); // 请求地址 private static String keyValue = Configuration.getInstance().getValue("keyValue"); // 商家密钥 private static String query_Cmd = "QueryOrdDetail"; // 订单查询请求,固定值” QueryOrdDetail” private static String buy_Cmd = "Buy"; // 订单查询请求,固定值” Buy” private static String refund_Cmd = "RefundOrd"; // 退款请求,固定值 ” RefundOrd” private static String decodeCharset = "GBK"; // 定义编码格式 private static String EMPTY = ""; /** * 生成hmac方法 业务类型 * * @param p0_Cmd 商户编号 * @param p1_MerId 商户订单号 * @param p2_Order 支付金额 * @param p3_Amt 交易币种 * @param p4_Cur 商品名称 * @param p5_Pid 商品种类 * @param p6_Pcat 商品描述 * @param p7_Pdesc 商户接收支付成功数据的地址 * @param p8_Url 送货地址 * @param p9_SAF 商户扩展信息 * @param pa_MP 银行编码 * @param pd_FrpId 应答机制 * @param pr_NeedResponse 商户密钥 * @param keyValue * @return */ public static String getReqMd5HmacForOnlinePayment( String p0_Cmd, String p1_MerId, String p2_Order, String p3_Amt, String p4_Cur, String p5_Pid, String p6_Pcat, String p7_Pdesc, String p8_Url, String p9_SAF, String pa_MP, String pd_FrpId, String pr_NeedResponse, String keyValue) { StringBuffer sValue = new StringBuffer(); // 业务类型 sValue.append(p0_Cmd); // 商户编号 sValue.append(p1_MerId); // 商户订单号 sValue.append(p2_Order); // 支付金额 sValue.append(p3_Amt); // 交易币种 sValue.append(p4_Cur); // 商品名称 sValue.append(p5_Pid); // 商品种类 sValue.append(p6_Pcat); // 商品描述 sValue.append(p7_Pdesc); // 商户接收支付成功数据的地址 sValue.append(p8_Url); // 送货地址 sValue.append(p9_SAF); // 商户扩展信息 sValue.append(pa_MP); // 银行编码 sValue.append(pd_FrpId); // 应答机制 sValue.append(pr_NeedResponse); String sNewString = null; sNewString = DigestUtil.hmacSign(sValue.toString(), keyValue); return (sNewString); } /** * 订单查询请求参数 该方法是根据《易宝支付产品通用接口(HTML版)文档 v3.0》怎样查询订单进行的封装 具体参数含义请仔细阅读《易宝支付产品通用接口(HTML版)文档 v3.0》 * 商户订单号 * * @param p2_Order * @return queryResult */ public static QueryResult queryByOrder(String p2_Order) { QueryResult qr = null; String hmac = DigestUtil.getHmac(new String[] {query_Cmd, p1_MerId, p2_Order}, keyValue); Map reParams = new HashMap(); reParams.put("p0_Cmd", query_Cmd); reParams.put("p1_MerId", p1_MerId); reParams.put("p2_Order", p2_Order); reParams.put("hmac", hmac); List responseStr = null; try { log.debug("Begin http communications.data[" + reParams + "]"); responseStr = HttpUtils.URLGet(queryRefundReqURL, reParams); log.debug("End http communications.responseStr.data[" + responseStr + "]"); } catch (Exception e) { throw new RuntimeException(e.getMessage()); } if (responseStr.size() == 0) { throw new RuntimeException("No response."); } qr = new QueryResult(); for (int t = 0; t < responseStr.size(); t++) { String currentResult = (String) responseStr.get(t); if (currentResult == null || currentResult.equals("")) { continue; } int i = currentResult.indexOf("="); int j = currentResult.length(); if (i >= 0) { String sKey = currentResult.substring(0, i); String sValue = currentResult.substring(i + 1); try { sValue = URLDecoder.decode(sValue, decodeCharset); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e.getMessage()); } if (sKey.equals("r0_Cmd")) { qr.setR0_Cmd(sValue); } else if (sKey.equals("r1_Code")) { qr.setR1_Code(sValue); } else if (sKey.equals("r2_TrxId")) { qr.setR2_TrxId(sValue); } else if (sKey.equals("r3_Amt")) { qr.setR3_Amt(sValue); } else if (sKey.equals("r4_Cur")) { qr.setR4_Cur(sValue); } else if (sKey.equals("r5_Pid")) { qr.setR5_Pid(sValue); } else if (sKey.equals("r6_Order")) { qr.setR6_Order(sValue); } else if (sKey.equals("r8_MP")) { qr.setR8_MP(sValue); } else if (sKey.equals("rb_PayStatus")) { qr.setRb_PayStatus(sValue); } else if (sKey.equals("rc_RefundCount")) { qr.setRc_RefundCount(sValue); } else if (sKey.equals("rd_RefundAmt")) { qr.setRd_RefundAmt(sValue); } else if (sKey.equals("hmac")) { qr.setHmac(sValue); } } } if (!qr.getR1_Code().equals("1")) { throw new RuntimeException("Query fail.Error code:" + qr.getR1_Code()); } String newHmac = ""; newHmac = DigestUtil.getHmac( new String[] { qr.getR0_Cmd(), qr.getR1_Code(), qr.getR2_TrxId(), qr.getR3_Amt(), qr.getR4_Cur(), qr.getR5_Pid(), qr.getR6_Order(), qr.getR8_MP(), qr.getRb_PayStatus(), qr.getRc_RefundCount(), qr.getRd_RefundAmt() }, keyValue); if (!newHmac.equals(qr.getHmac())) { throw new RuntimeException("Hmac error."); } return (qr); } /** * 订单退款请求参数 方法是根据《易宝支付产品通用接口(HTML版)文档 v3.0》退款如何操作进行的封装 具体参数含义请仔细阅读《易宝支付产品通用接口(HTML版)文档 v3.0》 * 易宝支付交易流水号 * * @param pb_TrxId 退款金额 * @param p3_Amt 交易币种 * @param p4_Cur 退款说明 * @param p5_Desc * @return refundResult */ public static RefundResult refundByTrxId( String pb_TrxId, String p3_Amt, String p4_Cur, String p5_Desc) { RefundResult rr = null; String hmac = DigestUtil.getHmac( new String[] {refund_Cmd, p1_MerId, pb_TrxId, p3_Amt, p4_Cur, p5_Desc}, keyValue); Map reParams = new HashMap(); reParams.put("p0_Cmd", refund_Cmd); reParams.put("p1_MerId", p1_MerId); reParams.put("pb_TrxId", pb_TrxId); reParams.put("p3_Amt", p3_Amt); reParams.put("p4_Cur", p4_Cur); reParams.put("p5_Desc", p5_Desc); reParams.put("hmac", hmac); List responseStr = null; try { log.debug("Begin http communications.data[" + reParams + "]"); responseStr = HttpUtils.URLGet(queryRefundReqURL, reParams); log.debug("End http communications.responseStr.data[" + responseStr + "]"); } catch (Exception e) { throw new RuntimeException(e.getMessage()); } if (responseStr.size() == 0) { throw new RuntimeException("No response."); } rr = new RefundResult(); for (int t = 0; t < responseStr.size(); t++) { String currentResult = (String) responseStr.get(t); if (currentResult == null || currentResult.equals("")) { continue; } try { URLDecoder.decode(currentResult, decodeCharset); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e.getMessage()); } int i = currentResult.indexOf("="); int j = currentResult.length(); if (i >= 0) { String sKey = currentResult.substring(0, i); String sValue = currentResult.substring(i + 1); if (sKey.equals("r0_Cmd")) { rr.setR0_Cmd(sValue); } else if (sKey.equals("r1_Code")) { rr.setR1_Code(sValue); } else if (sKey.equals("r2_TrxId")) { rr.setR2_TrxId(sValue); } else if (sKey.equals("r3_Amt")) { rr.setR3_Amt(sValue); } else if (sKey.equals("r4_Cur")) { rr.setR4_Cur(sValue); } else if (sKey.equals("hmac")) { rr.setHmac(sValue); } } } if (!rr.getR1_Code().equals("1")) { throw new RuntimeException("Query fail.Error code:" + rr.getR1_Code()); } String newHmac = ""; newHmac = DigestUtil.getHmac( new String[] { rr.getR0_Cmd(), rr.getR1_Code(), rr.getR2_TrxId(), rr.getR3_Amt(), rr.getR4_Cur() }, keyValue); if (!newHmac.equals(rr.getHmac())) { throw new RuntimeException("Hmac error."); } return (rr); } /** * 返回校验hmac方法 * * @param hmac 商户编号 * @param p1_MerId 业务类型 * @param r0_Cmd 支付结果 * @param r1_Code 易宝支付交易流水号 * @param r2_TrxId 支付金额 * @param r3_Amt 交易币种 * @param r4_Cur 商品名称 * @param r5_Pid 商户订单号 * @param r6_Order 易宝支付会员ID * @param r7_Uid 商户扩展信息 * @param r8_MP 交易结果返回类型 * @param r9_BType 交易结果返回类型 * @param keyValue * @return */ public static boolean verifyCallback( String hmac, String p1_MerId, String r0_Cmd, String r1_Code, String r2_TrxId, String r3_Amt, String r4_Cur, String r5_Pid, String r6_Order, String r7_Uid, String r8_MP, String r9_BType, String keyValue) { StringBuffer sValue = new StringBuffer(); // 商户编号 sValue.append(p1_MerId); // 业务类型 sValue.append(r0_Cmd); // 支付结果 sValue.append(r1_Code); // 易宝支付交易流水号 sValue.append(r2_TrxId); // 支付金额 sValue.append(r3_Amt); // 交易币种 sValue.append(r4_Cur); // 商品名称 sValue.append(r5_Pid); // 商户订单号 sValue.append(r6_Order); // 易宝支付会员ID sValue.append(r7_Uid); // 商户扩展信息 sValue.append(r8_MP); // 交易结果返回类型 sValue.append(r9_BType); String sNewString = null; sNewString = DigestUtil.hmacSign(sValue.toString(), keyValue); if (hmac.equals(sNewString)) { return (true); } return (false); } }