@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof TachyonConf) { Properties props = ((TachyonConf) obj).getInternalProperties(); return mProperties.equals(props); } return false; }
/** * Compares two activation group descriptors for content equality. * * @param obj the Object to compare with * @return true if these Objects are equal; false otherwise. * @see java.util.Hashtable * @since 1.2 */ public boolean equals(Object obj) { if (obj instanceof ActivationGroupDesc) { ActivationGroupDesc desc = (ActivationGroupDesc) obj; return ((className == null ? desc.className == null : className.equals(desc.className)) && (location == null ? desc.location == null : location.equals(desc.location)) && (data == null ? desc.data == null : data.equals(desc.data)) && (env == null ? desc.env == null : env.equals(desc.env)) && (props == null ? desc.props == null : props.equals(desc.props))); } else { return false; } }
/** * Two calculators are equal when have the same configuration. * * @param obj the calculator to compare on * @return true if the calculators are equal, false otherwise */ @Override public boolean equals(Object obj) { if (!(obj instanceof LogicTreeProcessor)) { return false; } LogicTreeProcessor other = (LogicTreeProcessor) obj; Properties thisConfig = ConfigurationConverter.getProperties(config); Properties otherConfig = ConfigurationConverter.getProperties(other.config); return thisConfig.equals(otherConfig); }
@Override public boolean equals(Object obj) { if (!(obj instanceof ComplexPropertiesLink)) { return false; } ComplexPropertiesLink comp = (ComplexPropertiesLink) obj; boolean eq = getComponentBean().getStyle().equals(comp.getComponentBean().getStyle()); eq = eq && getComponentBean().isList() == comp.getComponentBean().isList(); eq = eq && getComponentBean().isRepeat() == comp.getComponentBean().isRepeat(); eq = eq && getComponentBean().getLanguage().equals(comp.getComponentBean().getLanguage()); eq = eq && getComponentBean().getValue().equals(comp.getComponentBean().getValue()); eq = properties.equals(comp.properties); return eq; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof RedisClientInfo)) { return false; } RedisClientInfo other = (RedisClientInfo) obj; if (clientProperties == null) { if (other.clientProperties != null) { return false; } } else if (!clientProperties.equals(other.clientProperties)) { return false; } return true; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GlobalJmxStatisticsConfigurationBuilder that = (GlobalJmxStatisticsConfigurationBuilder) o; if (enabled != that.enabled) return false; if (allowDuplicateDomains != null ? !allowDuplicateDomains.equals(that.allowDuplicateDomains) : that.allowDuplicateDomains != null) return false; if (cacheManagerName != null ? !cacheManagerName.equals(that.cacheManagerName) : that.cacheManagerName != null) return false; if (jmxDomain != null ? !jmxDomain.equals(that.jmxDomain) : that.jmxDomain != null) return false; if (mBeanServerLookupInstance != null ? !mBeanServerLookupInstance.equals(that.mBeanServerLookupInstance) : that.mBeanServerLookupInstance != null) return false; if (properties != null ? !properties.equals(that.properties) : that.properties != null) return false; return true; }
@Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ConfigurationBase)) return false; ConfigurationBase that = (ConfigurationBase) o; if (asyncNumThreads != that.asyncNumThreads) return false; if (debug != that.debug) return false; if (defaultMaxPerRoute != that.defaultMaxPerRoute) return false; if (gzipEnabled != that.gzipEnabled) return false; if (httpConnectionTimeout != that.httpConnectionTimeout) return false; if (httpProxyPort != that.httpProxyPort) return false; if (httpReadTimeout != that.httpReadTimeout) return false; if (httpRetryCount != that.httpRetryCount) return false; if (httpRetryIntervalSeconds != that.httpRetryIntervalSeconds) return false; if (httpStreamingReadTimeout != that.httpStreamingReadTimeout) return false; if (includeEntitiesEnabled != that.includeEntitiesEnabled) return false; if (includeRTsEnabled != that.includeRTsEnabled) return false; if (jsonStoreEnabled != that.jsonStoreEnabled) return false; if (maxTotalConnections != that.maxTotalConnections) return false; if (mbeanEnabled != that.mbeanEnabled) return false; if (prettyDebug != that.prettyDebug) return false; if (useSSL != that.useSSL) return false; if (userStreamRepliesAllEnabled != that.userStreamRepliesAllEnabled) return false; if (clientURL != null ? !clientURL.equals(that.clientURL) : that.clientURL != null) return false; if (clientVersion != null ? !clientVersion.equals(that.clientVersion) : that.clientVersion != null) return false; if (dispatcherImpl != null ? !dispatcherImpl.equals(that.dispatcherImpl) : that.dispatcherImpl != null) return false; if (httpProxyHost != null ? !httpProxyHost.equals(that.httpProxyHost) : that.httpProxyHost != null) return false; if (httpProxyPassword != null ? !httpProxyPassword.equals(that.httpProxyPassword) : that.httpProxyPassword != null) return false; if (httpProxyUser != null ? !httpProxyUser.equals(that.httpProxyUser) : that.httpProxyUser != null) return false; if (mediaProvider != null ? !mediaProvider.equals(that.mediaProvider) : that.mediaProvider != null) return false; if (mediaProviderAPIKey != null ? !mediaProviderAPIKey.equals(that.mediaProviderAPIKey) : that.mediaProviderAPIKey != null) return false; if (mediaProviderParameters != null ? !mediaProviderParameters.equals(that.mediaProviderParameters) : that.mediaProviderParameters != null) return false; if (oAuthAccessToken != null ? !oAuthAccessToken.equals(that.oAuthAccessToken) : that.oAuthAccessToken != null) return false; if (oAuthAccessTokenSecret != null ? !oAuthAccessTokenSecret.equals(that.oAuthAccessTokenSecret) : that.oAuthAccessTokenSecret != null) return false; if (oAuthAccessTokenURL != null ? !oAuthAccessTokenURL.equals(that.oAuthAccessTokenURL) : that.oAuthAccessTokenURL != null) return false; if (oAuthAuthenticationURL != null ? !oAuthAuthenticationURL.equals(that.oAuthAuthenticationURL) : that.oAuthAuthenticationURL != null) return false; if (oAuthAuthorizationURL != null ? !oAuthAuthorizationURL.equals(that.oAuthAuthorizationURL) : that.oAuthAuthorizationURL != null) return false; if (oAuthConsumerKey != null ? !oAuthConsumerKey.equals(that.oAuthConsumerKey) : that.oAuthConsumerKey != null) return false; if (oAuthConsumerSecret != null ? !oAuthConsumerSecret.equals(that.oAuthConsumerSecret) : that.oAuthConsumerSecret != null) return false; if (oAuthRequestTokenURL != null ? !oAuthRequestTokenURL.equals(that.oAuthRequestTokenURL) : that.oAuthRequestTokenURL != null) return false; if (password != null ? !password.equals(that.password) : that.password != null) return false; if (requestHeaders != null ? !requestHeaders.equals(that.requestHeaders) : that.requestHeaders != null) return false; if (restBaseURL != null ? !restBaseURL.equals(that.restBaseURL) : that.restBaseURL != null) return false; if (searchBaseURL != null ? !searchBaseURL.equals(that.searchBaseURL) : that.searchBaseURL != null) return false; if (siteStreamBaseURL != null ? !siteStreamBaseURL.equals(that.siteStreamBaseURL) : that.siteStreamBaseURL != null) return false; if (streamBaseURL != null ? !streamBaseURL.equals(that.streamBaseURL) : that.streamBaseURL != null) return false; if (uploadBaseURL != null ? !uploadBaseURL.equals(that.uploadBaseURL) : that.uploadBaseURL != null) return false; if (user != null ? !user.equals(that.user) : that.user != null) return false; if (userAgent != null ? !userAgent.equals(that.userAgent) : that.userAgent != null) return false; if (userStreamBaseURL != null ? !userStreamBaseURL.equals(that.userStreamBaseURL) : that.userStreamBaseURL != null) return false; return true; }
/** @see org.apache.maven.plugin.eclipse.writers.EclipseWriter#write() */ public void write() throws MojoExecutionException { // check if it's necessary to create project specific settings Properties coreSettings = new Properties(); String source = IdeUtils.getCompilerSourceVersion(config.getProject()); String encoding = IdeUtils.getCompilerSourceEncoding(config.getProject()); String target = IdeUtils.getCompilerTargetVersion(config.getProject()); if (source != null) { coreSettings.put(PROP_JDT_CORE_COMPILER_SOURCE, source); coreSettings.put(PROP_JDT_CORE_COMPILER_COMPLIANCE, source); } if (encoding != null) { File basedir = config.getProject().getBasedir(); List compileSourceRoots = config.getProject().getCompileSourceRoots(); if (compileSourceRoots != null) { for (Object compileSourceRoot : compileSourceRoots) { String sourcePath = (String) compileSourceRoot; String relativePath = IdeUtils.toRelativeAndFixSeparator(basedir, new File(sourcePath), false); coreSettings.put(PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding); } } List testCompileSourceRoots = config.getProject().getTestCompileSourceRoots(); if (testCompileSourceRoots != null) { for (Object testCompileSourceRoot : testCompileSourceRoots) { String sourcePath = (String) testCompileSourceRoot; String relativePath = IdeUtils.toRelativeAndFixSeparator(basedir, new File(sourcePath), false); coreSettings.put(PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding); } } List resources = config.getProject().getResources(); if (resources != null) { for (Object resource1 : resources) { Resource resource = (Resource) resource1; String relativePath = IdeUtils.toRelativeAndFixSeparator(basedir, new File(resource.getDirectory()), false); coreSettings.put(PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding); } } List testResources = config.getProject().getTestResources(); if (testResources != null) { for (Object testResource : testResources) { Resource resource = (Resource) testResource; String relativePath = IdeUtils.toRelativeAndFixSeparator(basedir, new File(resource.getDirectory()), false); coreSettings.put(PROP_JDT_CORE_COMPILER_ENCODING + relativePath, encoding); } } } if (target != null && !JDK_1_2_SOURCES.equals(target)) { coreSettings.put( "org.eclipse.jdt.core.compiler.codegen.targetPlatform", target); // $NON-NLS-1$ } // write the settings, if needed if (!coreSettings.isEmpty()) { File settingsDir = new File( config.getEclipseProjectDirectory(), EclipseWorkspaceWriter.DIR_DOT_SETTINGS); // $NON-NLS-1$ settingsDir.mkdirs(); coreSettings.put(PROP_ECLIPSE_PREFERENCES_VERSION, "1"); // $NON-NLS-1$ try { File oldCoreSettingsFile; File coreSettingsFile = new File(settingsDir, EclipseWorkspaceWriter.ECLIPSE_JDT_CORE_PREFS_FILE); if (coreSettingsFile.exists()) { oldCoreSettingsFile = coreSettingsFile; Properties oldsettings = new Properties(); oldsettings.load(new FileInputStream(oldCoreSettingsFile)); Properties newsettings = (Properties) oldsettings.clone(); newsettings.putAll(coreSettings); if (!oldsettings.equals(newsettings)) { newsettings.store(new FileOutputStream(coreSettingsFile), null); } } else { coreSettings.store(new FileOutputStream(coreSettingsFile), null); log.info( Messages.getString( "EclipseSettingsWriter.wrotesettings", //$NON-NLS-1$ coreSettingsFile.getCanonicalPath())); } } catch (FileNotFoundException e) { throw new MojoExecutionException( Messages.getString("EclipseSettingsWriter.cannotcreatesettings"), e); // $NON-NLS-1$ } catch (IOException e) { throw new MojoExecutionException( Messages.getString("EclipseSettingsWriter.errorwritingsettings"), e); // $NON-NLS-1$ } } else { log.info(Messages.getString("EclipseSettingsWriter.usingdefaults")); // $NON-NLS-1$ } }
public static void prepareLanguage( Log log, MavenProject project, MavenProjectHelper projectHelper, File languageOutDir, File schemaOutDir, BuildContext buildContext) throws MojoExecutionException { File camelMetaDir = new File(languageOutDir, "META-INF/services/org/apache/camel/"); // first we need to setup the output directory because the next check // can stop the build before the end and eclipse always needs to know about that directory if (projectHelper != null) { projectHelper.addResource( project, languageOutDir.getPath(), Collections.singletonList("**/dataformat.properties"), Collections.emptyList()); } if (!PackageHelper.haveResourcesChanged( log, project, buildContext, "META-INF/services/org/apache/camel/language")) { return; } Map<String, String> javaTypes = new HashMap<String, String>(); StringBuilder buffer = new StringBuilder(); int count = 0; for (Resource r : project.getBuild().getResources()) { File f = new File(r.getDirectory()); if (!f.exists()) { f = new File(project.getBasedir(), r.getDirectory()); } f = new File(f, "META-INF/services/org/apache/camel/language"); if (f.exists() && f.isDirectory()) { File[] files = f.listFiles(); if (files != null) { for (File file : files) { String javaType = readClassFromCamelResource(file, buffer, buildContext); if (!file.isDirectory() && file.getName().charAt(0) != '.') { count++; } if (javaType != null) { javaTypes.put(file.getName(), javaType); } } } } } // find camel-core and grab the data format model from there, and enrich this model with // information from this artifact // and create json schema model file for this data format try { if (count > 0) { Artifact camelCore = findCamelCoreArtifact(project); if (camelCore != null) { File core = camelCore.getFile(); if (core != null) { URL url = new URL("file", null, core.getAbsolutePath()); URLClassLoader loader = new URLClassLoader(new URL[] {url}); for (Map.Entry<String, String> entry : javaTypes.entrySet()) { String name = entry.getKey(); String javaType = entry.getValue(); String modelName = asModelName(name); InputStream is = loader.getResourceAsStream( "org/apache/camel/model/language/" + modelName + ".json"); if (is == null) { // use file input stream if we build camel-core itself, and thus do not have a JAR // which can be loaded by URLClassLoader is = new FileInputStream( new File(core, "org/apache/camel/model/language/" + modelName + ".json")); } String json = loadText(is); if (json != null) { LanguageModel languageModel = new LanguageModel(); languageModel.setName(name); languageModel.setTitle(""); languageModel.setModelName(modelName); languageModel.setLabel(""); languageModel.setDescription(""); languageModel.setJavaType(javaType); languageModel.setGroupId(project.getGroupId()); languageModel.setArtifactId(project.getArtifactId()); languageModel.setVersion(project.getVersion()); List<Map<String, String>> rows = JSonSchemaHelper.parseJsonSchema("model", json, false); for (Map<String, String> row : rows) { if (row.containsKey("title")) { languageModel.setTitle(row.get("title")); } if (row.containsKey("description")) { languageModel.setDescription(row.get("description")); } if (row.containsKey("label")) { languageModel.setLabel(row.get("label")); } if (row.containsKey("javaType")) { languageModel.setModelJavaType(row.get("javaType")); } } log.debug("Model " + languageModel); // build json schema for the data format String properties = after(json, " \"properties\": {"); String schema = createParameterJsonSchema(languageModel, properties); log.debug("JSon schema\n" + schema); // write this to the directory File dir = new File(schemaOutDir, schemaSubDirectory(languageModel.getJavaType())); dir.mkdirs(); File out = new File(dir, name + ".json"); OutputStream fos = buildContext.newFileOutputStream(out); fos.write(schema.getBytes()); fos.close(); buildContext.refresh(out); log.debug("Generated " + out + " containing JSon schema for " + name + " language"); } } } } } } catch (Exception e) { throw new MojoExecutionException( "Error loading language model from camel-core. Reason: " + e, e); } if (count > 0) { Properties properties = new Properties(); String names = buffer.toString(); properties.put("languages", names); properties.put("groupId", project.getGroupId()); properties.put("artifactId", project.getArtifactId()); properties.put("version", project.getVersion()); properties.put("projectName", project.getName()); if (project.getDescription() != null) { properties.put("projectDescription", project.getDescription()); } camelMetaDir.mkdirs(); File outFile = new File(camelMetaDir, "language.properties"); // check if the existing file has the same content, and if so then leave it as is so we do not // write any changes // which can cause a re-compile of all the source code if (outFile.exists()) { try { Properties existing = new Properties(); InputStream is = new FileInputStream(outFile); existing.load(is); is.close(); // are the content the same? if (existing.equals(properties)) { log.debug("No language changes detected"); return; } } catch (IOException e) { // ignore } } try { OutputStream os = buildContext.newFileOutputStream(outFile); properties.store(os, "Generated by camel-package-maven-plugin"); os.close(); log.info( "Generated " + outFile + " containing " + count + " Camel " + (count > 1 ? "languages: " : "language: ") + names); if (projectHelper != null) { projectHelper.attachArtifact(project, "properties", "camelLanguage", outFile); } } catch (IOException e) { throw new MojoExecutionException( "Failed to write properties to " + outFile + ". Reason: " + e, e); } } else { log.debug( "No META-INF/services/org/apache/camel/language directory found. Are you sure you have created a Camel language?"); } }
/** * Everything, including Transport, host, port, options, and cost * * @param addr may be null * @since IPv6 */ public boolean deepEquals(RouterAddress addr) { return equals(addr) && _cost == addr._cost && _options.equals(addr._options); }
/** @see org.apache.maven.plugin.eclipse.writers.EclipseWriter#write() */ public void write() throws MojoExecutionException { // check if it's necessary to create project specific settings Properties ajdtSettings = new Properties(); IdeDependency[] deps = config.getDeps(); int ajdtDepCount = 0; int ajdtWeaveDepCount = 0; for (int i = 0; i < deps.length; i++) { if (deps[i].isAjdtDependency()) { addDependency(ajdtSettings, deps[i], ASPECT_DEP_PROP, ++ajdtDepCount); } if (deps[i].isAjdtWeaveDependency()) { addDependency(ajdtSettings, deps[i], WEAVE_DEP_PROP, ++ajdtWeaveDepCount); } } // write the settings, if needed if (!ajdtSettings.isEmpty()) { File settingsDir = new File(config.getEclipseProjectDirectory(), DIR_DOT_SETTINGS); // $NON-NLS-1$ settingsDir.mkdirs(); ajdtSettings.put(PROP_ECLIPSE_PREFERENCES_VERSION, "1"); // $NON-NLS-1$ try { File oldAjdtSettingsFile; File ajdtSettingsFile = new File(settingsDir, FILE_AJDT_PREFS); if (ajdtSettingsFile.exists()) { oldAjdtSettingsFile = ajdtSettingsFile; Properties oldsettings = new Properties(); oldsettings.load(new FileInputStream(oldAjdtSettingsFile)); Properties newsettings = (Properties) oldsettings.clone(); newsettings.putAll(ajdtSettings); if (!oldsettings.equals(newsettings)) { newsettings.store(new FileOutputStream(ajdtSettingsFile), null); } } else { ajdtSettings.store(new FileOutputStream(ajdtSettingsFile), null); log.info( Messages.getString( "EclipseSettingsWriter.wrotesettings", //$NON-NLS-1$ ajdtSettingsFile.getCanonicalPath())); } } catch (FileNotFoundException e) { throw new MojoExecutionException( Messages.getString("EclipseSettingsWriter.cannotcreatesettings"), e); // $NON-NLS-1$ } catch (IOException e) { throw new MojoExecutionException( Messages.getString("EclipseSettingsWriter.errorwritingsettings"), e); // $NON-NLS-1$ } } }