rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
this.unsatisfiedConditions = unsatisfiedConditions;
this.unsatisfiedConditions = Collections.unmodifiableSet(unsatisfiedConditions);
public ForcedStopException(ServiceName serviceName, Set unsatisfiedConditions) { super("Forced stop and ignored unsatisfied conditons:" + " serviceName=" + serviceName + ", unsatisfiedConditions=" + unsatisfiedConditions); this.serviceName = serviceName; this.unsatisfiedConditions = unsatisfiedConditions; }
this.unsatisfiedConditions = unsatisfiedConditions;
this.unsatisfiedConditions = Collections.unmodifiableSet(unsatisfiedConditions);
public UnsatisfiedConditionsException(String message, ServiceName serviceName, Set unsatisfiedConditions) { super(message + ": serviceName=" + serviceName + ": unsatisfiedConditions=" + unsatisfiedConditions); this.serviceName = serviceName; this.unsatisfiedConditions = unsatisfiedConditions; }
for( Iterator cIt = Scene.v().getClasses().iterator(); cIt.hasNext(); ) { final SootClass c = (SootClass) cIt.next(); handleClass( c ); } Stmt s = null; while(callEdges.hasNext()) { Edge e = (Edge) callEdges.next(); }
public void build() { }
Copyright.print(System.out);
Header.print(System.out);
public Main(String[] args) throws IOException { Copyright.print(System.out); System.out.println("Cobertura coverage check"); LongOpt[] longOpts = new LongOpt[4]; longOpts[0] = new LongOpt("branch", LongOpt.REQUIRED_ARGUMENT, null, 'b'); longOpts[1] = new LongOpt("line", LongOpt.REQUIRED_ARGUMENT, null, 'l'); longOpts[2] = new LongOpt("directory", LongOpt.REQUIRED_ARGUMENT, null, 'd'); longOpts[3] = new LongOpt("regex", LongOpt.REQUIRED_ARGUMENT, null, 'r'); Getopt g = new Getopt(getClass().getName(), args, ":b:l:d:r:", longOpts); int c; double branchCoverageRate = 0.8; double lineCoverageRate = 0.7; while ((c = g.getopt()) != -1) { switch (c) { case 'b': branchCoverageRate = inRangeAndDivideByOneHundred(g .getOptarg()); break; case 'l': lineCoverageRate = inRangeAndDivideByOneHundred(g .getOptarg()); break; case 'd': setInstrumentationDirectory(new File(g.getOptarg())); break; case 'r': setMinimumCoverageRate(g.getOptarg()); break; } } minimumCoverageRate = new CoverageRate(lineCoverageRate, branchCoverageRate); if (logger.isInfoEnabled()) { logger.info("instrumentation directory: " + instrumentationDirectory); } merge(loadInstrumentation(new FileInputStream(new File( instrumentationDirectory, InstrumentationPersistence.FILE_NAME)))); if (logger.isInfoEnabled()) { logger .info("instrumentation has " + keySet().size() + " entries"); } Iterator i = keySet().iterator(); while (i.hasNext()) { String key = (String)i.next(); CoverageRate coverageRate = findMinimumCoverageRate(key); CoverageData instrumentation = getInstrumentation(key); if (logger.isInfoEnabled()) { StringBuffer sb = new StringBuffer(); sb.append(key); sb.append(", line: "); sb.append(percentage(instrumentation.getLineCoverageRate())); sb.append("% ("); sb.append(percentage(coverageRate.getLineCoverageRate())); sb.append("%), branch: "); sb .append(percentage(instrumentation .getBranchCoverageRate())); sb.append("% ("); sb.append(percentage(coverageRate.getBranchCoverageRate())); sb.append("%)"); logger.info(sb.toString()); } if (instrumentation.getLineCoverageRate() < coverageRate .getLineCoverageRate()) { StringBuffer sb = new StringBuffer(); sb.append(key); sb.append(" line coverage rate of: "); sb.append(percentage(instrumentation.getLineCoverageRate())); sb.append("% (required: "); sb.append(percentage(coverageRate.getLineCoverageRate())); sb.append("%)"); System.out.println(sb.toString()); } if (instrumentation.getBranchCoverageRate() < coverageRate .getBranchCoverageRate()) { StringBuffer sb = new StringBuffer(); sb.append(key); sb.append(" branch coverage rate of: "); sb .append(percentage(instrumentation .getBranchCoverageRate())); sb.append("% (required: "); sb.append(percentage(coverageRate.getBranchCoverageRate())); sb.append("%)"); System.out.println(sb.toString()); } } }
extractDependencies(beanDefinition);
dependencies = SpringUtil.extractDependencies(beanDefinition, objectNameMap);
public SpringServiceFactory(RootBeanDefinition beanDefinition, Map objectNameMap) throws Exception { this.beanDefinition = beanDefinition; this.objectNameMap = objectNameMap; extractDependencies(beanDefinition); }
objectName = getObjectName(name);
objectName = SpringUtil.getObjectName(objectNameMap, name);
public Object createService(final ServiceContext serviceContext) throws Exception { Object service = null; try { ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); ServiceContext oldServiceContext = ServiceContextThreadLocal.get(); try { Thread.currentThread().setContextClassLoader(serviceContext.getClassLoader()); ServiceContextThreadLocal.set(serviceContext); ApplicationContext parent = new ApplicationContext() { public ApplicationContext getParent() { throw new UnsupportedOperationException(); } public String getDisplayName() { throw new UnsupportedOperationException(); } public long getStartupDate() { throw new UnsupportedOperationException(); } public void publishEvent(ApplicationEvent event) {// throw new UnsupportedOperationException(); } public boolean containsBeanDefinition(String beanName) { throw new UnsupportedOperationException(); } public int getBeanDefinitionCount() { throw new UnsupportedOperationException(); } public String[] getBeanDefinitionNames() { throw new UnsupportedOperationException(); } public String[] getBeanDefinitionNames(Class type) { throw new UnsupportedOperationException(); } public String[] getBeanNamesForType(Class type) { throw new UnsupportedOperationException(); } public String[] getBeanNamesForType(Class type, boolean includePrototypes, boolean includeFactoryBeans) { throw new UnsupportedOperationException(); } public Map getBeansOfType(Class type) throws BeansException { throw new UnsupportedOperationException(); } public Map getBeansOfType(Class type, boolean includePrototypes, boolean includeFactoryBeans) throws BeansException { throw new UnsupportedOperationException(); } public Object getBean(String name) throws BeansException { throw new UnsupportedOperationException(); } public Object getBean(String name, Class requiredType) throws BeansException { ObjectName objectName = null; try { objectName = getObjectName(name); } catch (MalformedObjectNameException e) { throw (NoSuchBeanDefinitionException) new NoSuchBeanDefinitionException(name, "Could not create an objectname for the specified name").initCause(e); } try { Object service = serviceContext.getKernel().getService(objectName); return service; } catch (Exception e) { throw (NoSuchBeanDefinitionException) new NoSuchBeanDefinitionException(name, "Kernel threw an exception").initCause(e); } } public boolean containsBean(String name) { throw new UnsupportedOperationException(); } public boolean isSingleton(String name) throws NoSuchBeanDefinitionException { throw new UnsupportedOperationException(); } public Class getType(String name) throws NoSuchBeanDefinitionException { throw new UnsupportedOperationException(); } public String[] getAliases(String name) throws NoSuchBeanDefinitionException { throw new UnsupportedOperationException(); } public BeanFactory getParentBeanFactory() { throw new UnsupportedOperationException(); } public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) { throw new UnsupportedOperationException(); } public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException { throw new UnsupportedOperationException(); } public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException { throw new UnsupportedOperationException(); } public Resource[] getResources(String locationPattern) { throw new UnsupportedOperationException(); } public Resource getResource(String location) { throw new UnsupportedOperationException(); } }; applicationContext = new GenericApplicationContext(parent); applicationContext.registerBeanDefinition(serviceContext.getObjectName(), beanDefinition); applicationContext.refresh(); service = applicationContext.getBean(serviceContext.getObjectName()); } finally { Thread.currentThread().setContextClassLoader(oldClassLoader); ServiceContextThreadLocal.set(oldServiceContext); } } catch (Throwable t) { applicationContext = null; if (t instanceof Exception) { throw (Exception) t; } else if (t instanceof Error) { throw (Error) t; } else { throw new Error(t); } } return service; }
void visitBeanDefinition(BeanDefinition beanDefinition) throws BeansException;
void visitBeanDefinition(String beanName, BeanDefinition beanDefinition, Object data) throws BeansException;
void visitBeanDefinition(BeanDefinition beanDefinition) throws BeansException;
public void visitBeanDefinition(BeanDefinition beanDefinition) throws BeansException { visitConstructorArgumentValues(beanDefinition.getConstructorArgumentValues()); visitMutablePropertyValues(beanDefinition.getPropertyValues());
public void visitBeanDefinition(String beanName, BeanDefinition beanDefinition, Object data) throws BeansException { visitBeanDefinition(beanDefinition, data);
public void visitBeanDefinition(BeanDefinition beanDefinition) throws BeansException { visitConstructorArgumentValues(beanDefinition.getConstructorArgumentValues()); visitMutablePropertyValues(beanDefinition.getPropertyValues()); }
public void visitRuntimeBeanReference(RuntimeBeanReference beanReference) throws BeansException {
public void visitRuntimeBeanReference(RuntimeBeanReference beanReference, Object data) throws BeansException {
public void visitRuntimeBeanReference(RuntimeBeanReference beanReference) throws BeansException { }
checkRoomsForTimeout();
private void createFrameIfNeeded() { if (chatFrame != null) { return; } chatFrame = new ChatFrame(); chatFrame.addWindowListener(new WindowAdapter() { public void windowActivated(WindowEvent windowEvent) { stopFlashing(); int sel = getSelectedIndex(); if (sel == -1) { return; } final ChatRoom room; try { room = getChatRoom(sel); focusChat(); // Set the title of the room. chatFrame.setTitle(room.getRoomTitle()); } catch (ChatRoomNotFoundException e1) { } } public void windowDeactivated(WindowEvent windowEvent) { } }); }
try { ChatRoom activeChatRoom = getActiveChatRoom(); if (activeChatRoom == chatRoom) { continue; } } catch (ChatRoomNotFoundException e) { }
public Collection<ChatRoom> getStaleChatRooms() { final List<ChatRoom> staleRooms = new ArrayList<ChatRoom>(); for (ChatRoom chatRoom : getChatRooms()) { long lastActivity = chatRoom.getLastActivity(); long currentTime = System.currentTimeMillis(); long diff = currentTime - lastActivity; int minutes = (int)(diff / (60 * 1000F)); LocalPreferences pref = SettingsManager.getLocalPreferences(); int timeoutMinutes = pref.getChatLengthDefaultTimeout(); try { ChatRoom activeChatRoom = getActiveChatRoom(); if (activeChatRoom == chatRoom) { continue; } } catch (ChatRoomNotFoundException e) { } if (timeoutMinutes <= minutes) { staleRooms.add(chatRoom); } } return staleRooms; }
useTabDefault(room);
public void messageSent(ChatRoom room, Message message) { }
Font font = titleLabel.getFont();
public void useTabDefault(final ChatRoom room) { final int index = indexOfComponent(room); if (index != -1) { SparkTab tab = getTabAt(index); final JLabel titleLabel = tab.getTitleLabel(); Font font = titleLabel.getFont(); titleLabel.setForeground(Color.black); Font newFont = font.deriveFont(Font.PLAIN); titleLabel.setFont(newFont); titleLabel.validate(); titleLabel.repaint(); } }
Font newFont = font.deriveFont(Font.PLAIN); titleLabel.setFont(newFont); titleLabel.validate(); titleLabel.repaint();
titleLabel.setFont(defaultFont);
public void useTabDefault(final ChatRoom room) { final int index = indexOfComponent(room); if (index != -1) { SparkTab tab = getTabAt(index); final JLabel titleLabel = tab.getTitleLabel(); Font font = titleLabel.getFont(); titleLabel.setForeground(Color.black); Font newFont = font.deriveFont(Font.PLAIN); titleLabel.setFont(newFont); titleLabel.validate(); titleLabel.repaint(); } }
assert errors != null : "errors is null"; assert !errors.isEmpty() : "errors is empty"; assert assertAllErrors(errors);
if (errors == null) throw new NullPointerException("errors is null"); if (errors.isEmpty()) throw new IllegalArgumentException("errors is empty"); for (ListIterator iterator = errors.listIterator(); iterator.hasNext();) { Object error = iterator.next(); if (error == null) { throw new IllegalArgumentException("Errors element " + iterator.previousIndex() + " is null"); } if (!(error instanceof Error)) { throw new IllegalArgumentException("Errors element " + iterator.previousIndex() + " is not an instance of java.lang.Error " + error.getClass() + ": " + error); } }
public KernelErrorsError(List errors) { assert errors != null : "errors is null"; assert !errors.isEmpty() : "errors is empty"; assert assertAllErrors(errors); this.errors = Collections.unmodifiableList(errors); }
_broker.stopClient();
final public void destroy() { if (_alive) { _alive = false; _webContext = null; _log.info("shutdown " + this); } }
String classpath = earls[i].getFile();
String classpath = (new File(earls[i].getFile())).getAbsolutePath();
protected Java getJava() { if (java == null) { java = (Java)getProject().createTask("java"); java.setTaskName(getTaskName()); java.setClassname(getClassName()); java.setFork(true); java.setDir(getProject().getBaseDir()); /** * We replace %20 with a space character because, for some * reason, when we call Cobertura from within CruiseControl, * the classpath here contains %20's instead of spaces. I * don't know if this is our problem, or CruiseControl, or * ant, but this seems to fix it. --Mark */ if (getClass().getClassLoader() instanceof AntClassLoader) { String classpath = ((AntClassLoader)getClass() .getClassLoader()).getClasspath(); createClasspath().setPath( StringUtil.replaceAll(classpath, "%20", " ")); } else if (getClass().getClassLoader() instanceof URLClassLoader) { URL[] earls = ((URLClassLoader)getClass().getClassLoader()) .getURLs(); for (int i = 0; i < earls.length; i++) { String classpath = earls[i].getFile(); createClasspath().setPath( StringUtil.replaceAll(classpath, "%20", " ")); } } } return java; }
_variables.clear();
public void clear() { Iterator i = _initializedTools.entrySet().iterator(); while (i.hasNext()) { Map.Entry m = (Map.Entry) i.next(); ContextTool ct = (ContextTool) m.getKey(); ct.destroy(m.getValue()); } _initializedTools.clear(); if (_prof != null) { stopTiming(); _prof.destroy(); } }
public ComponentMap(Settings initProps) { _config = initProps;
public ComponentMap() { _config = new Settings();
public ComponentMap(Settings initProps) { _config = initProps; }
public void load(String namelist, String suffix) { load(tokenize(namelist), suffix);
public void load(String namelist) { load(tokenize(namelist), "");
public void load(String namelist, String suffix) { load(tokenize(namelist), suffix); }
EncodingCache ec = new EncodingCache("UTF8", 11, 3);
EncodingCache ec = new EncodingCache("UTF16-LE", 11, 3);
public static void main(String arg[]) { try { EncodingCache ec = new EncodingCache("UTF8", 11, 3); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String s; while ((s = in.readLine()) != null) { s = s.intern(); System.out.print("Encoding string: " + s + " --> ["); System.out.write( ec.getEncoding(s) ); System.out.println("]"); } } catch (Exception e) { e.printStackTrace(); } }
s = s.intern(); System.out.print("Encoding string: " + s + " --> ["); System.out.write( ec.getEncoding(s) );
String s1 = s.intern(); byte b[] = ec.getEncoding(s1); String s2 = new String(b, "UTF16-LE"); System.out.print("Encoding string: " + s1 + " --> ["); System.out.print( s2 );
public static void main(String arg[]) { try { EncodingCache ec = new EncodingCache("UTF8", 11, 3); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String s; while ((s = in.readLine()) != null) { s = s.intern(); System.out.print("Encoding string: " + s + " --> ["); System.out.write( ec.getEncoding(s) ); System.out.println("]"); } } catch (Exception e) { e.printStackTrace(); } }
public TreeContextMenuController(DisplayedDocument displayedDocument) { super(displayedDocument);
public TreeContextMenuController(NoteTree tree) { this.tree = tree;
public TreeContextMenuController(DisplayedDocument displayedDocument) { super(displayedDocument); }
String className = getClass().getCanonicalName(); if (!methodDescriptor.startsWith(className)) return null; int separator = className.length();
String controllerSignature = getControllerSignature(); if (!methodDescriptor.startsWith(controllerSignature)) return null; int separator = controllerSignature.length();
protected Method getMethod(String methodDescriptor) { String className = getClass().getCanonicalName(); if (!methodDescriptor.startsWith(className)) return null; int separator = className.length(); try { return getClass().getMethod(methodDescriptor.substring(separator + 1), METHOD_ARGS); } catch (NoSuchMethodException ex) { return null; } }
IncludeDirective(Object fileName) {
IncludeDirective(Macro fileName) {
IncludeDirective(Object fileName) { _fileName = fileName; }
public static Object build(BuildContext rc, Object target)
public static Object build(BuildContext rc, Object target) throws BuildException
public static Object build(BuildContext rc, Object target) { IncludeDirective id = new IncludeDirective(target); if (! (target instanceof Macro)) { try { return (id.evaluate(null)); } catch (Exception e) { // try again at runtime } } return id; }
IncludeDirective id = new IncludeDirective(target); if (! (target instanceof Macro)) {
if (target instanceof Macro) { return new IncludeDirective((Macro) target); } else { if (target == null) { throw new BuildException("Cannot #include null filename"); }
public static Object build(BuildContext rc, Object target) { IncludeDirective id = new IncludeDirective(target); if (! (target instanceof Macro)) { try { return (id.evaluate(null)); } catch (Exception e) { // try again at runtime } } return id; }
return (id.evaluate(null)); } catch (Exception e) {
return getFile(rc,target.toString()); } catch(GetFileException e) { throw new BuildException(e.getMessage());
public static Object build(BuildContext rc, Object target) { IncludeDirective id = new IncludeDirective(target); if (! (target instanceof Macro)) { try { return (id.evaluate(null)); } catch (Exception e) { // try again at runtime } } return id; }
} return id;
}
public static Object build(BuildContext rc, Object target) { IncludeDirective id = new IncludeDirective(target); if (! (target instanceof Macro)) { try { return (id.evaluate(null)); } catch (Exception e) { // try again at runtime } } return id; }
Object fname = null;
Object fname = _fileName.evaluate(context); if (fname == null) { throw new InvalidContextException( "#include could not resolve filename: " + "target argument resolved to a null."); }
final public Object evaluate(Context context) throws InvalidContextException { Object fname = null; try { fname = (_fileName instanceof Macro) ? ((Macro) _fileName).evaluate(context) : _fileName; if (fname == null) { throw new InvalidContextException("Attempt to include " + _fileName + " which evaluates to null"); } return context.getBroker().getValue("url",fname.toString()); } catch (NotFoundException e) { throw new InvalidContextException("Attempt to include " + _fileName + " which evaluates to the non-existant " + fname + ": " + e); } catch (InvalidTypeException e) { throw new InvalidContextException("Attempt to load URLs failed " + " broker does not have a URL provider:" + e); } }
fname = (_fileName instanceof Macro) ? ((Macro) _fileName).evaluate(context) : _fileName; if (fname == null) { throw new InvalidContextException("Attempt to include " + _fileName + " which evaluates to null"); } return context.getBroker().getValue("url",fname.toString()); } catch (NotFoundException e) { throw new InvalidContextException("Attempt to include " + _fileName + " which evaluates to the non-existant " + fname + ": " + e); } catch (InvalidTypeException e) { throw new InvalidContextException("Attempt to load URLs failed " + " broker does not have a URL provider:" + e);
return getFile(context, fname.toString()); } catch (GetFileException e) { throw new InvalidContextException(e.getMessage());
final public Object evaluate(Context context) throws InvalidContextException { Object fname = null; try { fname = (_fileName instanceof Macro) ? ((Macro) _fileName).evaluate(context) : _fileName; if (fname == null) { throw new InvalidContextException("Attempt to include " + _fileName + " which evaluates to null"); } return context.getBroker().getValue("url",fname.toString()); } catch (NotFoundException e) { throw new InvalidContextException("Attempt to include " + _fileName + " which evaluates to the non-existant " + fname + ": " + e); } catch (InvalidTypeException e) { throw new InvalidContextException("Attempt to load URLs failed " + " broker does not have a URL provider:" + e); } }
pref.setSpellCheckerEnabled(!panel.isSpellCheckerOn()); pref.setChatRoomNotifications(!panel.isGroupChatNotificationsOn());
pref.setSpellCheckerEnabled(panel.isSpellCheckerOn()); pref.setChatRoomNotifications(panel.isGroupChatNotificationsOn());
public void commit() { LocalPreferences pref = SettingsManager.getLocalPreferences(); pref.setTimeDisplayedInChat(panel.getShowTime()); pref.setSpellCheckerEnabled(!panel.isSpellCheckerOn()); pref.setChatRoomNotifications(!panel.isGroupChatNotificationsOn()); pref.setHideChatHistory(panel.isChatHistoryHidden()); SettingsManager.saveSettings(); // Do not commit if not changed. if (ModelUtil.hasLength(panel.getPassword()) && ModelUtil.hasLength(panel.getConfirmationPassword())) { try { SparkManager.getConnection().getAccountManager().changePassword(panel.getPassword()); } catch (XMPPException passwordEx) { JOptionPane.showMessageDialog(SparkManager.getMainWindow(), "Unable to change password. Please see your server admin.", "Password Change Error", JOptionPane.ERROR_MESSAGE); Log.error("Unable to change password", passwordEx); } } }
public RubyFile(IRuby runtime, String path, final Reader reader) { this(runtime, path, new InputStream() { public int read() throws IOException { return reader.read(); } });
public RubyFile(IRuby runtime, RubyClass type) { super(runtime, type);
public RubyFile(IRuby runtime, String path, final Reader reader) { this(runtime, path, new InputStream() { public int read() throws IOException { return reader.read(); } }); }
addArg("-d");
addArg("--destination");
public void execute() throws BuildException { initArgs(); if (toDir != null) { addArg("-d"); addArg(toDir.toString()); } // TODO: ignoreRegex.setRegex() is never called if (ignoreRegex != null) { addArg("-ignore"); addArg(ignoreRegex.getRegex()); } Set filenames = new HashSet(); Iterator i = fileSets.iterator(); while (i.hasNext()) { FileSet fileSet = (FileSet)i.next(); addArg("-basedir"); addArg(baseDir(fileSet)); filenames.addAll(Arrays.asList(getFilenames(fileSet))); } coverage((String[])filenames.toArray(new String[filenames.size()])); unInitArgs(); }
addArg("-ignore");
addArg("--ignore");
public void execute() throws BuildException { initArgs(); if (toDir != null) { addArg("-d"); addArg(toDir.toString()); } // TODO: ignoreRegex.setRegex() is never called if (ignoreRegex != null) { addArg("-ignore"); addArg(ignoreRegex.getRegex()); } Set filenames = new HashSet(); Iterator i = fileSets.iterator(); while (i.hasNext()) { FileSet fileSet = (FileSet)i.next(); addArg("-basedir"); addArg(baseDir(fileSet)); filenames.addAll(Arrays.asList(getFilenames(fileSet))); } coverage((String[])filenames.toArray(new String[filenames.size()])); unInitArgs(); }
addArg("-basedir");
addArg("--basedir");
public void execute() throws BuildException { initArgs(); if (toDir != null) { addArg("-d"); addArg(toDir.toString()); } // TODO: ignoreRegex.setRegex() is never called if (ignoreRegex != null) { addArg("-ignore"); addArg(ignoreRegex.getRegex()); } Set filenames = new HashSet(); Iterator i = fileSets.iterator(); while (i.hasNext()) { FileSet fileSet = (FileSet)i.next(); addArg("-basedir"); addArg(baseDir(fileSet)); filenames.addAll(Arrays.asList(getFilenames(fileSet))); } coverage((String[])filenames.toArray(new String[filenames.size()])); unInitArgs(); }
Object nodeKey;
public Object get(Object key) { int hash = (System.identityHashCode(key) & 0x7FFFFFFF) % tab.length; Node last = null; Object nodeKey; synchronized (locks[hash]) { Node node = tab[hash]; while (node != null) { if (node.get() == key) { if (last != null) { last.next = node.next; node.next = tab[hash]; tab[hash] = node; } return node.value; } last = node; node = node.next; } } return null; }
boolean found = false;
public void put(Object key, Object value) { processQueue(); if (key == null) { return; } if (value == null) { remove(key); return; } int hash = (System.identityHashCode(key) & 0x7FFFFFFF) % tab.length; boolean found = false; synchronized (locks[hash]) { Node node = tab[hash]; while (node != null) { if (node.get() == key) { node.value = value; return; } node = node.next; } node = new Node(key, queue); node.value = value; node.next = tab[hash]; tab[hash] = node; } }
if (directory == null) {
if (baseDir == null) {
public void afterPropertiesSet() throws Exception { if (classLoader == null) { classLoader = getClass().getClassLoader(); } if (directory == null) { log.warn("No directory specified so using current directory"); directory = new File("."); } directory = directory.getAbsoluteFile(); log.info("Starting to load components from: " + directory); // lets load the deployment processDirectory(classLoader, "", directory); }
directory = new File(".");
baseDir = new File(".");
public void afterPropertiesSet() throws Exception { if (classLoader == null) { classLoader = getClass().getClassLoader(); } if (directory == null) { log.warn("No directory specified so using current directory"); directory = new File("."); } directory = directory.getAbsoluteFile(); log.info("Starting to load components from: " + directory); // lets load the deployment processDirectory(classLoader, "", directory); }
directory = directory.getAbsoluteFile(); log.info("Starting to load components from: " + directory);
baseDir = baseDir.getAbsoluteFile(); log.info("Starting to load components from: " + baseDir);
public void afterPropertiesSet() throws Exception { if (classLoader == null) { classLoader = getClass().getClassLoader(); } if (directory == null) { log.warn("No directory specified so using current directory"); directory = new File("."); } directory = directory.getAbsoluteFile(); log.info("Starting to load components from: " + directory); // lets load the deployment processDirectory(classLoader, "", directory); }
processDirectory(classLoader, "", directory);
processDirectory("", classLoader, applicationContext, baseDir);
public void afterPropertiesSet() throws Exception { if (classLoader == null) { classLoader = getClass().getClassLoader(); } if (directory == null) { log.warn("No directory specified so using current directory"); directory = new File("."); } directory = directory.getAbsoluteFile(); log.info("Starting to load components from: " + directory); // lets load the deployment processDirectory(classLoader, "", directory); }
protected void createServiceForFile(String name, File file, ClassLoader classLoader) throws ServiceAlreadyExistsException, ServiceRegistrationException, BeansException, IOException { String fileName = file.getName(); ServiceFactory serviceFactory = null; if (fileName.equalsIgnoreCase("spring.xml") || fileName.equalsIgnoreCase("xbean.xml")) { serviceFactory = createSpringService(name, file, classLoader);
protected void createServiceForFile(String name, File file, ClassLoader classLoader, ApplicationContext parentContext) throws ServiceAlreadyExistsException, ServiceRegistrationException, BeansException, IOException { if (isSpringConfigFile(file)) { System.setProperty("xbean.current.dir", file.getAbsolutePath()); ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(classLoader); log.debug("Loading file: " + file + " using classLoader: " + classLoader); try { SpringApplicationContext applicationContext = new ResourceXmlApplicationContext(new FileSystemResource(file), xmlPreprocessors, parentContext); applicationContext.setDisplayName(name); addBeanPostProcessors(applicationContext); ServiceFactory serviceFactory = new SpringConfigurationServiceFactory(applicationContext); log.info("Registering spring services service: " + name + " from: " + file.getAbsolutePath() + " into the Kernel"); kernel.registerService(new StringServiceName(name), serviceFactory, classLoader); } finally { Thread.currentThread().setContextClassLoader(oldClassLoader); }
protected void createServiceForFile(String name, File file, ClassLoader classLoader) throws ServiceAlreadyExistsException, ServiceRegistrationException, BeansException, IOException { String fileName = file.getName(); ServiceFactory serviceFactory = null; if (fileName.equalsIgnoreCase("spring.xml") || fileName.equalsIgnoreCase("xbean.xml")) { serviceFactory = createSpringService(name, file, classLoader); } else { log.info("Ignoring file: " + fileName + " in directory: " + file.getParent()); } if (serviceFactory != null) { log.info("Registering spring services service: " + name + " from: " + file.getAbsolutePath() + " into the Kernel"); kernel.registerService(new StringServiceName(name), serviceFactory, classLoader); } }
log.info("Ignoring file: " + fileName + " in directory: " + file.getParent()); } if (serviceFactory != null) { log.info("Registering spring services service: " + name + " from: " + file.getAbsolutePath() + " into the Kernel"); kernel.registerService(new StringServiceName(name), serviceFactory, classLoader);
if (showIgnoredFiles) { log.info("Ignoring file: " + file.getName() + " in directory: " + file.getParent()); }
protected void createServiceForFile(String name, File file, ClassLoader classLoader) throws ServiceAlreadyExistsException, ServiceRegistrationException, BeansException, IOException { String fileName = file.getName(); ServiceFactory serviceFactory = null; if (fileName.equalsIgnoreCase("spring.xml") || fileName.equalsIgnoreCase("xbean.xml")) { serviceFactory = createSpringService(name, file, classLoader); } else { log.info("Ignoring file: " + fileName + " in directory: " + file.getParent()); } if (serviceFactory != null) { log.info("Registering spring services service: " + name + " from: " + file.getAbsolutePath() + " into the Kernel"); kernel.registerService(new StringServiceName(name), serviceFactory, classLoader); } }
protected void processDirectory(ClassLoader classLoader, String parentName, File directory) throws ServiceAlreadyExistsException, ServiceRegistrationException, BeansException, IOException {
protected void processDirectory(String parentName, ClassLoader classLoader, ApplicationContext parentContext, File directory) throws ServiceAlreadyExistsException, ServiceRegistrationException, BeansException, IOException { log.debug("Processing directory: " + directory);
protected void processDirectory(ClassLoader classLoader, String parentName, File directory) throws ServiceAlreadyExistsException, ServiceRegistrationException, BeansException, IOException { File[] files = directory.listFiles(); if (files == null) { return; } // lets create a new classloader... for (int i = 0; i < files.length; i++) { File file = files[i]; if (isClassLoaderDirectory(file)) { classLoader = createChildClassLoader(parentName, file, classLoader); } } // now lets recurse through files or directories for (int i = 0; i < files.length; i++) { File file = files[i]; if (isClassLoaderDirectory(file)) { continue; } String name = getChildName(parentName, file); if (file.isDirectory()) { processDirectory(classLoader, name, file); } else { createServiceForFile(name, file, classLoader); } } }
if (isClassLoaderDirectory(file)) { continue;
if (!isClassLoaderDirectory(file) && !file.isDirectory()) { String name = getChildName(parentName, file); createServiceForFile(name, file, classLoader, parentContext);
protected void processDirectory(ClassLoader classLoader, String parentName, File directory) throws ServiceAlreadyExistsException, ServiceRegistrationException, BeansException, IOException { File[] files = directory.listFiles(); if (files == null) { return; } // lets create a new classloader... for (int i = 0; i < files.length; i++) { File file = files[i]; if (isClassLoaderDirectory(file)) { classLoader = createChildClassLoader(parentName, file, classLoader); } } // now lets recurse through files or directories for (int i = 0; i < files.length; i++) { File file = files[i]; if (isClassLoaderDirectory(file)) { continue; } String name = getChildName(parentName, file); if (file.isDirectory()) { processDirectory(classLoader, name, file); } else { createServiceForFile(name, file, classLoader); } } }
String name = getChildName(parentName, file); if (file.isDirectory()) { processDirectory(classLoader, name, file); } else { createServiceForFile(name, file, classLoader);
} for (int i = 0; i < files.length; i++) { File file = files[i]; if (!isClassLoaderDirectory(file) && file.isDirectory()) { String name = getChildName(parentName, file); processDirectory(name, classLoader, parentContext, file);
protected void processDirectory(ClassLoader classLoader, String parentName, File directory) throws ServiceAlreadyExistsException, ServiceRegistrationException, BeansException, IOException { File[] files = directory.listFiles(); if (files == null) { return; } // lets create a new classloader... for (int i = 0; i < files.length; i++) { File file = files[i]; if (isClassLoaderDirectory(file)) { classLoader = createChildClassLoader(parentName, file, classLoader); } } // now lets recurse through files or directories for (int i = 0; i < files.length; i++) { File file = files[i]; if (isClassLoaderDirectory(file)) { continue; } String name = getChildName(parentName, file); if (file.isDirectory()) { processDirectory(classLoader, name, file); } else { createServiceForFile(name, file, classLoader); } } }
processDirectory(classLoader, "", directory);
String name = ""; if (applicationContext != null) { name = applicationContext.getDisplayName(); } processDirectory(name, classLoader, applicationContext, baseDir);
public void run() { try { processDirectory(classLoader, "", directory); } catch (Exception e) { log.error("Failed to deploy services: " + e, e); } }
public Wiki(String propertiesFilename) throws Exception { if (propertiesFilename == null) propertiesFilename = DEFAULT_PROPERTIES; create(propertiesFilename); _dateStarted = new Date();
public Wiki() throws Exception { this (DEFAULT_PROPERTIES);
public Wiki(String propertiesFilename) throws Exception { if (propertiesFilename == null) propertiesFilename = DEFAULT_PROPERTIES; create(propertiesFilename); _dateStarted = new Date(); }
JUnitXMLHelper.validate(new File(PATH_TO_XML_REPORT));
JUnitXMLHelper.readXmlFile(new File(PATH_TO_XML_REPORT), true);
public void testXMLReportValidity() throws Exception { String[] args; // Serialize the current coverage data to disk ProjectData.saveGlobalProjectData(); String dataFileName = CoverageDataFileHandler.getDefaultDataFile().getAbsolutePath(); // Then we need to generate the XML report args = new String[] { "--format", "xml", "--datafile", dataFileName, "--destination", PATH_TO_TEST_OUTPUT, PATH_TO_SOURCE_CODE }; net.sourceforge.cobertura.reporting.Main.main(args); JUnitXMLHelper.validate(new File(PATH_TO_XML_REPORT)); }
JUnitXMLHelper.validate(coverageFile);
JUnitXMLHelper.readXmlFile(coverageFile, true);
public void testXMLReportWithNonSourceLines() throws Exception { ProjectData projectData = new ProjectData(); // Adding line to the project data that hasn't been yet marked as source line ClassData cd = projectData.getOrCreateClassData(XMLReport.class.getName()); cd.touch(7777); File reportDir = File.createTempFile("XMLReportTest", ""); reportDir.delete(); reportDir.mkdir(); FileFinder fileFinder = new FileFinder(); ComplexityCalculator complexity = new ComplexityCalculator(fileFinder); new XMLReport(projectData, reportDir, fileFinder, complexity); File coverageFile = new File(reportDir, "coverage.xml"); JUnitXMLHelper.validate(coverageFile); coverageFile.delete(); reportDir.delete(); }
boolean done = fullClassNames.contains(name); ClassData classData = new ClassData(name); if (!done) {
ClassData classData = (ClassData)this.classes.get(name); if (classData == null) { classData = new ClassData(name);
public ClassData getOrCreateClassData(String name) { boolean done = fullClassNames.contains(name); ClassData classData = new ClassData(name); if (!done) { addClassData(classData); fullClassNames.add(name); } else { classData = getClassData(name); } return classData; }
fullClassNames.add(name); } else { classData = getClassData(name);
public ClassData getOrCreateClassData(String name) { boolean done = fullClassNames.contains(name); ClassData classData = new ClassData(name); if (!done) { addClassData(classData); fullClassNames.add(name); } else { classData = getClassData(name); } return classData; }
public XMLReport(Coverage coverage, File outputDir, File sourceDirectory)
public XMLReport(CoverageReport coverage, File outputDir, File sourceDirectory)
public XMLReport(Coverage coverage, File outputDir, File sourceDirectory) throws IOException { pw = new PrintWriter(new FileWriter(new File(outputDir, "coverage.xml"))); try { println("<?xml version=\"1.0\"?>"); if (sourceDirectory == null) { println("<coverage>"); } else { println("<coverage src=\"" + sourceDirectory + "\">"); } increaseIndentation(); dumpPackages(coverage); decreaseIndentation(); println("</coverage>"); } finally { pw.close(); } }
&& (obj.getClass().isAssignableFrom( context.getBroker().classForName(className)));
&& (context.getBroker().classForName(className).isAssignableFrom( obj.getClass()));
public boolean isInstanceOf(Object obj, String className) { try { return (obj != null && className != null) && (obj.getClass().isAssignableFrom( context.getBroker().classForName(className))); } catch (ClassNotFoundException cnfe) { context.getBroker().getLog("VariableTool") .error ("VariableTool could not locate the class: /" + className + "/"); } catch (Exception e) { context.getBroker().getLog("VariableTool") .error ("An unexpected exception occured", e); } return false; }
return jjStartNfaWithStates_3(0, 23, 0);
jjmatchedKind = 23; return jjMoveStringLiteralDfa1_3(0x4000L);
private final int jjMoveStringLiteralDfa0_3(){ switch(curChar) { case 34: return jjStopAtPos(0, 24); case 35: return jjStartNfaWithStates_3(0, 23, 0); case 36: return jjStopAtPos(0, 20); case 39: return jjStopAtPos(0, 25); case 40: return jjStopAtPos(0, 31); case 41: return jjStopAtPos(0, 32); case 42: return jjStopAtPos(0, 45); case 43: return jjStopAtPos(0, 43); case 44: return jjStopAtPos(0, 50); case 45: return jjStopAtPos(0, 44); case 46: return jjStopAtPos(0, 35); case 47: return jjStopAtPos(0, 46); case 59: return jjStopAtPos(0, 51); case 60: jjmatchedKind = 36; return jjMoveStringLiteralDfa1_3(0x2000000000L); case 61: jjmatchedKind = 41; return jjMoveStringLiteralDfa1_3(0x10000000000L); case 62: jjmatchedKind = 38; return jjMoveStringLiteralDfa1_3(0x8000000000L); case 91: return jjStopAtPos(0, 33); case 92: return jjStartNfaWithStates_3(0, 22, 4); case 93: return jjStopAtPos(0, 34); case 102: return jjMoveStringLiteralDfa1_3(0x10000000L); case 110: return jjMoveStringLiteralDfa1_3(0x4000000L); case 116: return jjMoveStringLiteralDfa1_3(0x8000000L); default : return jjMoveNfa_3(2, 0); }}
case 123: return jjStopAtPos(0, 15);
private final int jjMoveStringLiteralDfa0_3(){ switch(curChar) { case 34: return jjStopAtPos(0, 24); case 35: return jjStartNfaWithStates_3(0, 23, 0); case 36: return jjStopAtPos(0, 20); case 39: return jjStopAtPos(0, 25); case 40: return jjStopAtPos(0, 31); case 41: return jjStopAtPos(0, 32); case 42: return jjStopAtPos(0, 45); case 43: return jjStopAtPos(0, 43); case 44: return jjStopAtPos(0, 50); case 45: return jjStopAtPos(0, 44); case 46: return jjStopAtPos(0, 35); case 47: return jjStopAtPos(0, 46); case 59: return jjStopAtPos(0, 51); case 60: jjmatchedKind = 36; return jjMoveStringLiteralDfa1_3(0x2000000000L); case 61: jjmatchedKind = 41; return jjMoveStringLiteralDfa1_3(0x10000000000L); case 62: jjmatchedKind = 38; return jjMoveStringLiteralDfa1_3(0x8000000000L); case 91: return jjStopAtPos(0, 33); case 92: return jjStartNfaWithStates_3(0, 22, 4); case 93: return jjStopAtPos(0, 34); case 102: return jjMoveStringLiteralDfa1_3(0x10000000L); case 110: return jjMoveStringLiteralDfa1_3(0x4000000L); case 116: return jjMoveStringLiteralDfa1_3(0x8000000L); default : return jjMoveNfa_3(2, 0); }}
return jjMoveStringLiteralDfa1_4(0x23000L);
return jjMoveStringLiteralDfa1_4(0x26000L);
private final int jjMoveStringLiteralDfa0_4(){ switch(curChar) { case 35: jjmatchedKind = 23; return jjMoveStringLiteralDfa1_4(0x23000L); case 36: return jjStopAtPos(0, 20); case 92: return jjStartNfaWithStates_4(0, 22, 2); case 123: return jjStopAtPos(0, 14); case 125: return jjStopAtPos(0, 15); default : return jjMoveNfa_4(1, 0); }}
return jjStopAtPos(0, 14);
return jjStopAtPos(0, 15);
private final int jjMoveStringLiteralDfa0_4(){ switch(curChar) { case 35: jjmatchedKind = 23; return jjMoveStringLiteralDfa1_4(0x23000L); case 36: return jjStopAtPos(0, 20); case 92: return jjStartNfaWithStates_4(0, 22, 2); case 123: return jjStopAtPos(0, 14); case 125: return jjStopAtPos(0, 15); default : return jjMoveNfa_4(1, 0); }}
return jjStopAtPos(0, 15);
return jjStopAtPos(0, 12);
private final int jjMoveStringLiteralDfa0_4(){ switch(curChar) { case 35: jjmatchedKind = 23; return jjMoveStringLiteralDfa1_4(0x23000L); case 36: return jjStopAtPos(0, 20); case 92: return jjStartNfaWithStates_4(0, 22, 2); case 123: return jjStopAtPos(0, 14); case 125: return jjStopAtPos(0, 15); default : return jjMoveNfa_4(1, 0); }}
case 98: return jjMoveStringLiteralDfa2_3(active0, 0x4000L);
private final int jjMoveStringLiteralDfa1_3(long active0){ try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_3(0, active0); return 1; } switch(curChar) { case 61: if ((active0 & 0x2000000000L) != 0L) return jjStopAtPos(1, 37); else if ((active0 & 0x8000000000L) != 0L) return jjStopAtPos(1, 39); else if ((active0 & 0x10000000000L) != 0L) return jjStopAtPos(1, 40); break; case 97: return jjMoveStringLiteralDfa2_3(active0, 0x10000000L); case 114: return jjMoveStringLiteralDfa2_3(active0, 0x8000000L); case 117: return jjMoveStringLiteralDfa2_3(active0, 0x4000000L); default : break; } return jjStartNfa_3(0, active0);}
return jjMoveStringLiteralDfa2_4(active0, 0x1000L);
return jjMoveStringLiteralDfa2_4(active0, 0x4000L);
private final int jjMoveStringLiteralDfa1_4(long active0){ try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_4(0, active0); return 1; } switch(curChar) { case 35: if ((active0 & 0x20000L) != 0L) return jjStopAtPos(1, 17); break; case 98: return jjMoveStringLiteralDfa2_4(active0, 0x1000L); case 101: return jjMoveStringLiteralDfa2_4(active0, 0x2000L); default : break; } return jjStartNfa_4(0, active0);}
case 101: return jjMoveStringLiteralDfa3_3(active0, 0x4000L);
private final int jjMoveStringLiteralDfa2_3(long old0, long active0){ if (((active0 &= old0)) == 0L) return jjStartNfa_3(0, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_3(1, active0); return 2; } switch(curChar) { case 108: return jjMoveStringLiteralDfa3_3(active0, 0x14000000L); case 117: return jjMoveStringLiteralDfa3_3(active0, 0x8000000L); default : break; } return jjStartNfa_3(1, active0);}
return jjMoveStringLiteralDfa3_4(active0, 0x1000L);
return jjMoveStringLiteralDfa3_4(active0, 0x4000L);
private final int jjMoveStringLiteralDfa2_4(long old0, long active0){ if (((active0 &= old0)) == 0L) return jjStartNfa_4(0, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_4(1, active0); return 2; } switch(curChar) { case 101: return jjMoveStringLiteralDfa3_4(active0, 0x1000L); case 110: return jjMoveStringLiteralDfa3_4(active0, 0x2000L); default : break; } return jjStartNfa_4(1, active0);}
case 103: return jjMoveStringLiteralDfa4_3(active0, 0x4000L);
private final int jjMoveStringLiteralDfa3_3(long old0, long active0){ if (((active0 &= old0)) == 0L) return jjStartNfa_3(1, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_3(2, active0); return 3; } switch(curChar) { case 101: if ((active0 & 0x8000000L) != 0L) return jjStartNfaWithStates_3(3, 27, 29); break; case 108: if ((active0 & 0x4000000L) != 0L) return jjStartNfaWithStates_3(3, 26, 29); break; case 115: return jjMoveStringLiteralDfa4_3(active0, 0x10000000L); default : break; } return jjStartNfa_3(2, active0);}
return jjMoveStringLiteralDfa4_4(active0, 0x1000L);
return jjMoveStringLiteralDfa4_4(active0, 0x4000L);
private final int jjMoveStringLiteralDfa3_4(long old0, long active0){ if (((active0 &= old0)) == 0L) return jjStartNfa_4(1, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_4(2, active0); return 3; } switch(curChar) { case 100: if ((active0 & 0x2000L) != 0L) return jjStopAtPos(3, 13); break; case 103: return jjMoveStringLiteralDfa4_4(active0, 0x1000L); default : break; } return jjStartNfa_4(2, active0);}
case 105: return jjMoveStringLiteralDfa5_3(active0, 0x4000L);
private final int jjMoveStringLiteralDfa4_3(long old0, long active0){ if (((active0 &= old0)) == 0L) return jjStartNfa_3(2, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_3(3, active0); return 4; } switch(curChar) { case 101: if ((active0 & 0x10000000L) != 0L) return jjStartNfaWithStates_3(4, 28, 29); break; default : break; } return jjStartNfa_3(3, active0);}
return jjMoveStringLiteralDfa5_4(active0, 0x1000L);
return jjMoveStringLiteralDfa5_4(active0, 0x4000L);
private final int jjMoveStringLiteralDfa4_4(long old0, long active0){ if (((active0 &= old0)) == 0L) return jjStartNfa_4(2, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_4(3, active0); return 4; } switch(curChar) { case 105: return jjMoveStringLiteralDfa5_4(active0, 0x1000L); default : break; } return jjStartNfa_4(3, active0);}
if ((active0 & 0x1000L) != 0L) return jjStopAtPos(5, 12);
if ((active0 & 0x4000L) != 0L) return jjStopAtPos(5, 14);
private final int jjMoveStringLiteralDfa5_4(long old0, long active0){ if (((active0 &= old0)) == 0L) return jjStartNfa_4(3, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_4(4, active0); return 5; } switch(curChar) { case 110: if ((active0 & 0x1000L) != 0L) return jjStopAtPos(5, 12); break; default : break; } return jjStartNfa_4(4, active0);}
if ((active0 & 0x800000L) != 0L)
if ((active0 & 0x804000L) != 0L)
private final int jjStopStringLiteralDfa_3(int pos, long active0){ switch (pos) { case 0: if ((active0 & 0x800000L) != 0L) return 0; if ((active0 & 0x1c000000L) != 0L) { jjmatchedKind = 52; return 29; } if ((active0 & 0x3000000000L) != 0L) return 13; if ((active0 & 0x400000L) != 0L) return 4; return -1; case 1: if ((active0 & 0x1c000000L) != 0L) { jjmatchedKind = 52; jjmatchedPos = 1; return 29; } return -1; case 2: if ((active0 & 0x1c000000L) != 0L) { jjmatchedKind = 52; jjmatchedPos = 2; return 29; } return -1; case 3: if ((active0 & 0xc000000L) != 0L) return 29; if ((active0 & 0x10000000L) != 0L) { jjmatchedKind = 52; jjmatchedPos = 3; return 29; } return -1; default : return -1; }}
case 4: if ((active0 & 0x10000000L) != 0L) return 29; return -1;
private final int jjStopStringLiteralDfa_3(int pos, long active0){ switch (pos) { case 0: if ((active0 & 0x800000L) != 0L) return 0; if ((active0 & 0x1c000000L) != 0L) { jjmatchedKind = 52; return 29; } if ((active0 & 0x3000000000L) != 0L) return 13; if ((active0 & 0x400000L) != 0L) return 4; return -1; case 1: if ((active0 & 0x1c000000L) != 0L) { jjmatchedKind = 52; jjmatchedPos = 1; return 29; } return -1; case 2: if ((active0 & 0x1c000000L) != 0L) { jjmatchedKind = 52; jjmatchedPos = 2; return 29; } return -1; case 3: if ((active0 & 0xc000000L) != 0L) return 29; if ((active0 & 0x10000000L) != 0L) { jjmatchedKind = 52; jjmatchedPos = 3; return 29; } return -1; default : return -1; }}
displayedNote.setTab(this);
public NoteTab(final CTabFolder parent, Listener l, DisplayedNote displayedNote) { this.displayedNote = displayedNote; tabItem = new CTabItem(parent, SWT.NONE); tabItem.setText(displayedNote.getName()); tabItem.setData(this); tabItem.addDisposeListener(this); text = new Text(parent, SWT.MULTI | SWT.WRAP); text.setText(displayedNote.getNote().getText()); tabItem.setControl(text); displayedNote.setTab(this); select(); }
displayedNote.setTab(null);
displayedNote.tabDisposed();
public void widgetDisposed(DisposeEvent e) { text.dispose(); displayedNote.setTab(null); }
ResourceUtils.resLabel(usernameLabel, usernameField, SparkRes.getString(SparkRes.LOGIN_DIALOG_USERNAME)); ResourceUtils.resLabel(passwordLabel, passwordField, SparkRes.getString(SparkRes.LOGIN_DIALOG_PASSWORD));
ResourceUtils.resLabel(usernameLabel, usernameField, Res.getString("label.username")); ResourceUtils.resLabel(passwordLabel, passwordField, Res.getString("label.password"));
LoginPanel() { //setBorder(BorderFactory.createTitledBorder("Sign In Now")); ResourceUtils.resButton(savePasswordBox, Res.getString("checkbox.save.password")); ResourceUtils.resButton(autoLoginBox, Res.getString("checkbox.auto.login")); ResourceUtils.resLabel(serverLabel, serverField, Res.getString("label.server")); ResourceUtils.resButton(createAccountButton, Res.getString("label.accounts")); savePasswordBox.setOpaque(false); autoLoginBox.setOpaque(false); setLayout(GRIDBAGLAYOUT); add(usernameLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 5, 5), 0, 0)); add(usernameField, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(15, 5, 5, 5), 0, 0)); add(passwordField, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0)); add(passwordLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 5, 0)); // Add Server Field Properties add(serverField, new GridBagConstraints(1, 4, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0)); add(serverLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 5, 0)); add(savePasswordBox, new GridBagConstraints(1, 5, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0)); add(autoLoginBox, new GridBagConstraints(1, 6, 2, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0)); // Add button but disable the login button initially savePasswordBox.addActionListener(this); autoLoginBox.addActionListener(this); buttonPanel.add(quitButton, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 0), 0, 0)); if (!"true".equals(Default.getString(Default.ACCOUNT_DISABLED))) { buttonPanel.add(createAccountButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0)); } buttonPanel.add(connectionButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0)); buttonPanel.add(loginButton, new GridBagConstraints(3, 0, 4, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 0), 0, 0)); cardPanel.add(buttonPanel, BUTTON_PANEL); cardPanel.setOpaque(false); buttonPanel.setOpaque(false); progressBar.setHorizontalAlignment(JLabel.CENTER); cardPanel.add(progressBar, PROGRESS_BAR); add(cardPanel, new GridBagConstraints(0, 7, 4, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); loginButton.setEnabled(false); // Add KeyListener usernameField.addKeyListener(this); passwordField.addKeyListener(this); serverField.addKeyListener(this); passwordField.addFocusListener(this); usernameField.addFocusListener(this); serverField.addFocusListener(this); // Add ActionListener quitButton.addActionListener(this); loginButton.addActionListener(this); connectionButton.addActionListener(this); // Make same size GraphicUtils.makeSameSize(new JComponent[]{usernameField, passwordField}); // Set progress bar description progressBar.setText(SparkRes.getString(SparkRes.LOGIN_DIALOG_AUTHENTICATING)); //progressBar.setStringPainted(true); // Set Resources ResourceUtils.resLabel(usernameLabel, usernameField, SparkRes.getString(SparkRes.LOGIN_DIALOG_USERNAME)); ResourceUtils.resLabel(passwordLabel, passwordField, SparkRes.getString(SparkRes.LOGIN_DIALOG_PASSWORD)); ResourceUtils.resButton(quitButton, SparkRes.getString(SparkRes.LOGIN_DIALOG_QUIT)); ResourceUtils.resButton(loginButton, SparkRes.getString(SparkRes.LOGIN_DIALOG_LOGIN)); ResourceUtils.resButton(connectionButton, Res.getString("button.advanced")); // Load previous instances String userProp = localPref.getUsername(); String serverProp = localPref.getServer(); if (userProp != null && serverProp != null) { usernameField.setText(userProp); serverField.setText(serverProp); } // Check Settings if (localPref.isSavePassword()) { String encryptedPassword = localPref.getPassword(); if (encryptedPassword != null) { String password = Encryptor.decrypt(encryptedPassword); passwordField.setText(password); } savePasswordBox.setSelected(true); loginButton.setEnabled(true); } autoLoginBox.setSelected(localPref.isAutoLogin()); if (autoLoginBox.isSelected()) { savePasswordBox.setEnabled(false); autoLoginBox.setEnabled(false); validateLogin(); return; } // Handle arguments String username = Spark.getArgumentValue("username"); String password = Spark.getArgumentValue("password"); String server = Spark.getArgumentValue("server"); if (username != null) { usernameField.setText(username); } if (password != null) { passwordField.setText(password); } if (server != null) { serverField.setText(server); } if (username != null && server != null && password != null) { savePasswordBox.setEnabled(false); autoLoginBox.setEnabled(false); validateLogin(); } createAccountButton.addActionListener(this); final String lockedDownURL = Default.getString(Default.HOST_NAME); if (ModelUtil.hasLength(lockedDownURL)) { serverField.setEnabled(false); serverField.setText(lockedDownURL); } }
ResourceUtils.resButton(loginButton, SparkRes.getString(SparkRes.LOGIN_DIALOG_LOGIN));
ResourceUtils.resButton(loginButton, Res.getString("title.login"));
LoginPanel() { //setBorder(BorderFactory.createTitledBorder("Sign In Now")); ResourceUtils.resButton(savePasswordBox, Res.getString("checkbox.save.password")); ResourceUtils.resButton(autoLoginBox, Res.getString("checkbox.auto.login")); ResourceUtils.resLabel(serverLabel, serverField, Res.getString("label.server")); ResourceUtils.resButton(createAccountButton, Res.getString("label.accounts")); savePasswordBox.setOpaque(false); autoLoginBox.setOpaque(false); setLayout(GRIDBAGLAYOUT); add(usernameLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(15, 5, 5, 5), 0, 0)); add(usernameField, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(15, 5, 5, 5), 0, 0)); add(passwordField, new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0)); add(passwordLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 5, 0)); // Add Server Field Properties add(serverField, new GridBagConstraints(1, 4, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0)); add(serverLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 5, 5), 5, 0)); add(savePasswordBox, new GridBagConstraints(1, 5, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0)); add(autoLoginBox, new GridBagConstraints(1, 6, 2, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0)); // Add button but disable the login button initially savePasswordBox.addActionListener(this); autoLoginBox.addActionListener(this); buttonPanel.add(quitButton, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 0), 0, 0)); if (!"true".equals(Default.getString(Default.ACCOUNT_DISABLED))) { buttonPanel.add(createAccountButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0)); } buttonPanel.add(connectionButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0)); buttonPanel.add(loginButton, new GridBagConstraints(3, 0, 4, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 0), 0, 0)); cardPanel.add(buttonPanel, BUTTON_PANEL); cardPanel.setOpaque(false); buttonPanel.setOpaque(false); progressBar.setHorizontalAlignment(JLabel.CENTER); cardPanel.add(progressBar, PROGRESS_BAR); add(cardPanel, new GridBagConstraints(0, 7, 4, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); loginButton.setEnabled(false); // Add KeyListener usernameField.addKeyListener(this); passwordField.addKeyListener(this); serverField.addKeyListener(this); passwordField.addFocusListener(this); usernameField.addFocusListener(this); serverField.addFocusListener(this); // Add ActionListener quitButton.addActionListener(this); loginButton.addActionListener(this); connectionButton.addActionListener(this); // Make same size GraphicUtils.makeSameSize(new JComponent[]{usernameField, passwordField}); // Set progress bar description progressBar.setText(SparkRes.getString(SparkRes.LOGIN_DIALOG_AUTHENTICATING)); //progressBar.setStringPainted(true); // Set Resources ResourceUtils.resLabel(usernameLabel, usernameField, SparkRes.getString(SparkRes.LOGIN_DIALOG_USERNAME)); ResourceUtils.resLabel(passwordLabel, passwordField, SparkRes.getString(SparkRes.LOGIN_DIALOG_PASSWORD)); ResourceUtils.resButton(quitButton, SparkRes.getString(SparkRes.LOGIN_DIALOG_QUIT)); ResourceUtils.resButton(loginButton, SparkRes.getString(SparkRes.LOGIN_DIALOG_LOGIN)); ResourceUtils.resButton(connectionButton, Res.getString("button.advanced")); // Load previous instances String userProp = localPref.getUsername(); String serverProp = localPref.getServer(); if (userProp != null && serverProp != null) { usernameField.setText(userProp); serverField.setText(serverProp); } // Check Settings if (localPref.isSavePassword()) { String encryptedPassword = localPref.getPassword(); if (encryptedPassword != null) { String password = Encryptor.decrypt(encryptedPassword); passwordField.setText(password); } savePasswordBox.setSelected(true); loginButton.setEnabled(true); } autoLoginBox.setSelected(localPref.isAutoLogin()); if (autoLoginBox.isSelected()) { savePasswordBox.setEnabled(false); autoLoginBox.setEnabled(false); validateLogin(); return; } // Handle arguments String username = Spark.getArgumentValue("username"); String password = Spark.getArgumentValue("password"); String server = Spark.getArgumentValue("server"); if (username != null) { usernameField.setText(username); } if (password != null) { passwordField.setText(password); } if (server != null) { serverField.setText(server); } if (username != null && server != null && password != null) { savePasswordBox.setEnabled(false); autoLoginBox.setEnabled(false); validateLogin(); } createAccountButton.addActionListener(this); final String lockedDownURL = Default.getString(Default.HOST_NAME); if (ModelUtil.hasLength(lockedDownURL)) { serverField.setEnabled(false); serverField.setText(lockedDownURL); } }
return usernameField.getText();
return StringUtils.escapeNode(usernameField.getText().toLowerCase());
public String getUsername() { return usernameField.getText(); }
throw new BuildException("dependent: " + e);
Engine.log.exception(t); throw new BuildException("failure during build: " + t);
public final Object build(BuildContext rc) throws BuildException { // collect the arguments Object args[] = new Object[_buildArgs]; { int i = 0; args[i++] = rc; if ( hasCondition() ) { Object cond = (_condition instanceof Builder) ? ((Builder) _condition).build(rc) : _condition; if (cond instanceof Condition) { args[i++] = cond; } else { args[i++] = new ConstantCondition(cond); } } if ( hasTarget() ) { args[i++] = _target; } if ( hasArguments() ) { args[i++] = getArguments(rc); } if ( isContainer() ) { args[i++] = _contents; } if ( isParser() ) { args[i++] = _text; } if ( isMulti() ) { args[i++] = _dependent; } } // build the arguments for (int i = 0; i < args.length; i++) { Object arg = args[i]; if ((arg != null) && (arg instanceof Builder)) { args[i] = ((Builder) arg).build(rc); } } // build the directive Object self; try { self = _build.invoke(null,args); } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); if (t instanceof BuildException) { throw (BuildException) t; } else { throw new BuildException("dependent: " + e); } } catch (Exception e) { throw new BuildException("dependent: " + e); } return self; }
throw new BuildException("dependent: " + e);
throw new BuildException("failed to build: " + e);
public final Object build(BuildContext rc) throws BuildException { // collect the arguments Object args[] = new Object[_buildArgs]; { int i = 0; args[i++] = rc; if ( hasCondition() ) { Object cond = (_condition instanceof Builder) ? ((Builder) _condition).build(rc) : _condition; if (cond instanceof Condition) { args[i++] = cond; } else { args[i++] = new ConstantCondition(cond); } } if ( hasTarget() ) { args[i++] = _target; } if ( hasArguments() ) { args[i++] = getArguments(rc); } if ( isContainer() ) { args[i++] = _contents; } if ( isParser() ) { args[i++] = _text; } if ( isMulti() ) { args[i++] = _dependent; } } // build the arguments for (int i = 0; i < args.length; i++) { Object arg = args[i]; if ((arg != null) && (arg instanceof Builder)) { args[i] = ((Builder) arg).build(rc); } } // build the directive Object self; try { self = _build.invoke(null,args); } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); if (t instanceof BuildException) { throw (BuildException) t; } else { throw new BuildException("dependent: " + e); } } catch (Exception e) { throw new BuildException("dependent: " + e); } return self; }
Iterator it = sourceFileData.getChildren().iterator();
Iterator it = sourceFileData.getClasses().iterator();
private void dumpClasses(SourceFileData sourceFileData) { Iterator it = sourceFileData.getChildren().iterator(); while (it.hasNext()) { dumpClass((ClassData)it.next()); } }
dumpLines(classData.getChildren());
dumpLines(classData.getLines());
private void dumpLines(ClassData classData) { dumpLines(classData.getChildren()); }
Iterator it = projectData.getChildren().iterator();
Iterator it = projectData.getPackages().iterator();
private void dumpPackages(ProjectData projectData) { println("<packages>"); increaseIndentation(); Iterator it = projectData.getChildren().iterator(); while (it.hasNext()) { dumpPackage((PackageData)it.next()); } decreaseIndentation(); println("</packages>"); }
Iterator it = packageData.getChildren().iterator();
Iterator it = packageData.getSourceFiles().iterator();
private void dumpSourceFiles(PackageData packageData) { println("<classes>"); increaseIndentation(); Iterator it = packageData.getChildren().iterator(); while (it.hasNext()) { dumpClasses((SourceFileData)it.next()); } decreaseIndentation(); println("</classes>"); }
metadataManagerName = ServiceName.createName(":j2eeType=MetadataManager"); List metadataProviders = new ArrayList(2); metadataProviders.add(new GeronimoMetadataProvider()); metadataProviders.add(new PropertiesMetadataProvider()); metadataManager = new SimpleMetadataManager(metadataProviders); kernel.loadService(metadataManagerName, new StaticServiceFactory(metadataManager), classLoader); kernel.startService(metadataManagerName);
public KernelBridge(String kernelName) { try { ClassLoader classLoader = getClass().getClassLoader(); // normally we would use the KernelFactory, but geronimo will only work with the simple kernel kernel = new SimpleKernel(kernelName); dependencyManagerBridge = new DependencyManagerBridge(kernel.getDependencyManager()); serviceInvokerManagerName = ServiceName.createName(":j2eeType=ServiceInvokerManager,name=default"); serviceInvokerManager = new ServiceInvokerManager(kernel); serviceInvokerManager.start(); kernel.loadService(serviceInvokerManagerName, new StaticServiceFactory(serviceInvokerManager), classLoader); kernel.startService(serviceInvokerManagerName); proxyManagerName = ServiceName.createName(":j2eeType=ProxyManager,name=default"); proxyManager = new ProxyManager(serviceInvokerManager); kernel.loadService(proxyManagerName, new StaticServiceFactory(proxyManager), classLoader); kernel.startService(proxyManagerName); lifecycleMonitorBridge = new LifecycleMonitorBridge(kernel); this.proxyManagerBridge = new ProxyManagerBridge(proxyManager); } catch (Exception e) { throw new org.apache.geronimo.kernel.InternalKernelException(e); } }
public org.apache.geronimo.gbean.GBeanData getGBeanData(ObjectName name) throws org.apache.geronimo.kernel.GBeanNotFoundException{ ServiceFactory serviceFactory = getServiceFactory(name);
public org.apache.geronimo.gbean.GBeanData getGBeanData(ObjectName objectName) throws org.apache.geronimo.kernel.GBeanNotFoundException{ ServiceFactory serviceFactory = getServiceFactory(objectName);
public org.apache.geronimo.gbean.GBeanData getGBeanData(ObjectName name) throws org.apache.geronimo.kernel.GBeanNotFoundException{ ServiceFactory serviceFactory = getServiceFactory(name); if (serviceFactory instanceof GeronimoServiceFactory) { GeronimoServiceFactory geronimoServiceFactory = null; geronimoServiceFactory = (GeronimoServiceFactory) serviceFactory; return GeronimoUtil.createGBeanData(geronimoServiceFactory.getGBeanDefinition()); } return createGBeanData(name); }
return GeronimoUtil.createGBeanData(geronimoServiceFactory.getGBeanDefinition());
return GeronimoUtil.createGBeanData(objectName, geronimoServiceFactory);
public org.apache.geronimo.gbean.GBeanData getGBeanData(ObjectName name) throws org.apache.geronimo.kernel.GBeanNotFoundException{ ServiceFactory serviceFactory = getServiceFactory(name); if (serviceFactory instanceof GeronimoServiceFactory) { GeronimoServiceFactory geronimoServiceFactory = null; geronimoServiceFactory = (GeronimoServiceFactory) serviceFactory; return GeronimoUtil.createGBeanData(geronimoServiceFactory.getGBeanDefinition()); } return createGBeanData(name); }
return createGBeanData(name);
return createGBeanData(objectName);
public org.apache.geronimo.gbean.GBeanData getGBeanData(ObjectName name) throws org.apache.geronimo.kernel.GBeanNotFoundException{ ServiceFactory serviceFactory = getServiceFactory(name); if (serviceFactory instanceof GeronimoServiceFactory) { GeronimoServiceFactory geronimoServiceFactory = null; geronimoServiceFactory = (GeronimoServiceFactory) serviceFactory; return GeronimoUtil.createGBeanData(geronimoServiceFactory.getGBeanDefinition()); } return createGBeanData(name); }
return GeronimoUtil.createGBeanInfo(geronimoServiceFactory.getGBeanDefinition());
return GeronimoUtil.createGBeanInfo(geronimoServiceFactory);
public org.apache.geronimo.gbean.GBeanInfo getGBeanInfo(ObjectName name) throws org.apache.geronimo.kernel.GBeanNotFoundException { ServiceFactory serviceFactory = getServiceFactory(name); if (serviceFactory instanceof GeronimoServiceFactory) { GeronimoServiceFactory geronimoServiceFactory = (GeronimoServiceFactory) serviceFactory; return GeronimoUtil.createGBeanInfo(geronimoServiceFactory.getGBeanDefinition()); } return createGBeanInfo(name); }
GBeanDefinition geronimoBeanDefinition = GeronimoUtil.createGeronimoBeanDefinition(gbeanData, classLoader); GeronimoServiceFactory geronimoServiceFactory = new GeronimoServiceFactory(proxyManager, geronimoBeanDefinition);
GeronimoServiceFactory geronimoServiceFactory = null; try { geronimoServiceFactory =GeronimoUtil.createGeronimoServiceFactory(gbeanData, classLoader, metadataManager, proxyManager); } catch (Exception e) { throw new org.apache.geronimo.kernel.InternalKernelException(e); }
public void loadGBean(org.apache.geronimo.gbean.GBeanData gbeanData, ClassLoader classLoader) throws org.apache.geronimo.kernel.GBeanAlreadyExistsException { ObjectName objectName = gbeanData.getName(); GBeanDefinition geronimoBeanDefinition = GeronimoUtil.createGeronimoBeanDefinition(gbeanData, classLoader); GeronimoServiceFactory geronimoServiceFactory = new GeronimoServiceFactory(proxyManager, geronimoBeanDefinition); try { kernel.loadService(objectName, geronimoServiceFactory, classLoader); } catch (ServiceAlreadyExistsException e) { throw new org.apache.geronimo.kernel.GBeanAlreadyExistsException(e); } }
try { kernel.stopService(metadataManagerName); kernel.unloadService(metadataManagerName); } catch (ServiceNotFoundException e) { }
public void shutdown() { try { kernel.stopService(proxyManagerName); kernel.unloadService(proxyManagerName); } catch (ServiceNotFoundException e) { // igore service has already been removed } try { kernel.stopService(serviceInvokerManagerName); kernel.unloadService(serviceInvokerManagerName); serviceInvokerManager.stop(); } catch (ServiceNotFoundException e) { // igore service has already been removed } kernel.shutdown(); synchronized (this) { notify(); } org.apache.geronimo.kernel.KernelRegistry.unregisterKernel(this); }
public static GBeanData createGBeanData(GBeanDefinition gBeanDefinition) { GBeanData gbeanData = new GBeanData(gBeanDefinition.getObjectName(), createGBeanInfo(gBeanDefinition)); gbeanData.setAttribute("gbeanEnabled", Boolean.valueOf(gBeanDefinition.isEnabled()));
public static GBeanData createGBeanData(ObjectName objectName, GeronimoServiceFactory serviceFactory) { RootBeanDefinition beanDefinition = serviceFactory.getBeanDefinition(); Set persistentProperties = serviceFactory.getPersistentProperties(); GBeanData gbeanData = new GBeanData(objectName, createGBeanInfo(serviceFactory)); gbeanData.setAttribute("gbeanEnabled", Boolean.valueOf(serviceFactory.isEnabled()));
public static GBeanData createGBeanData(GBeanDefinition gBeanDefinition) { GBeanData gbeanData = new GBeanData(gBeanDefinition.getObjectName(), createGBeanInfo(gBeanDefinition)); gbeanData.setAttribute("gbeanEnabled", Boolean.valueOf(gBeanDefinition.isEnabled())); // add the normal properties PropertyValue[] properties = gBeanDefinition.getPropertyValues().getPropertyValues(); for (int i = 0; i < properties.length; i++) { PropertyValue propertyValue = properties[i]; gbeanData.setAttribute(propertyValue.getName(), propertyValue.getValue()); } // add the dynamic properties PropertyValue[] dynamicProperties = gBeanDefinition.getDynamicPropertyValues().getPropertyValues(); for (int i = 0; i < dynamicProperties.length; i++) { PropertyValue dynamicPropertyValue = dynamicProperties[i]; gbeanData.setAttribute(dynamicPropertyValue.getName(), dynamicPropertyValue.getValue()); } // add the constructor arguments for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); ConstructorArgumentValues.ValueHolder valueHolder = (ConstructorArgumentValues.ValueHolder) entry.getValue(); String constructorArgName; if (valueHolder instanceof NamedValueHolder) { NamedValueHolder namedValueHolder = (NamedValueHolder) valueHolder; constructorArgName = namedValueHolder.getName(); } else { int index = ((Integer) entry.getKey()).intValue(); constructorArgName = "constructor-argument-" + index; } gbeanData.setAttribute(constructorArgName, valueHolder.getValue()); } // add the dependencies String[] dependsOn = gBeanDefinition.getDependsOn(); for (int i = 0; i < dependsOn.length; i++) { String dependencyString = dependsOn[i]; Map map = stringToDependency(dependencyString); Map.Entry entry = ((Map.Entry) map.entrySet().iterator().next()); String dependencyName = (String) entry.getKey(); Set patterns = (Set) entry.getValue(); gbeanData.setReferencePatterns(dependencyName, patterns); } return gbeanData; }
PropertyValue[] properties = gBeanDefinition.getPropertyValues().getPropertyValues();
PropertyValue[] properties = beanDefinition.getPropertyValues().getPropertyValues();
public static GBeanData createGBeanData(GBeanDefinition gBeanDefinition) { GBeanData gbeanData = new GBeanData(gBeanDefinition.getObjectName(), createGBeanInfo(gBeanDefinition)); gbeanData.setAttribute("gbeanEnabled", Boolean.valueOf(gBeanDefinition.isEnabled())); // add the normal properties PropertyValue[] properties = gBeanDefinition.getPropertyValues().getPropertyValues(); for (int i = 0; i < properties.length; i++) { PropertyValue propertyValue = properties[i]; gbeanData.setAttribute(propertyValue.getName(), propertyValue.getValue()); } // add the dynamic properties PropertyValue[] dynamicProperties = gBeanDefinition.getDynamicPropertyValues().getPropertyValues(); for (int i = 0; i < dynamicProperties.length; i++) { PropertyValue dynamicPropertyValue = dynamicProperties[i]; gbeanData.setAttribute(dynamicPropertyValue.getName(), dynamicPropertyValue.getValue()); } // add the constructor arguments for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); ConstructorArgumentValues.ValueHolder valueHolder = (ConstructorArgumentValues.ValueHolder) entry.getValue(); String constructorArgName; if (valueHolder instanceof NamedValueHolder) { NamedValueHolder namedValueHolder = (NamedValueHolder) valueHolder; constructorArgName = namedValueHolder.getName(); } else { int index = ((Integer) entry.getKey()).intValue(); constructorArgName = "constructor-argument-" + index; } gbeanData.setAttribute(constructorArgName, valueHolder.getValue()); } // add the dependencies String[] dependsOn = gBeanDefinition.getDependsOn(); for (int i = 0; i < dependsOn.length; i++) { String dependencyString = dependsOn[i]; Map map = stringToDependency(dependencyString); Map.Entry entry = ((Map.Entry) map.entrySet().iterator().next()); String dependencyName = (String) entry.getKey(); Set patterns = (Set) entry.getValue(); gbeanData.setReferencePatterns(dependencyName, patterns); } return gbeanData; }
gbeanData.setAttribute(propertyValue.getName(), propertyValue.getValue());
if (persistentProperties.contains(propertyValue.getName())) { gbeanData.setAttribute(propertyValue.getName(), propertyValue.getValue()); }
public static GBeanData createGBeanData(GBeanDefinition gBeanDefinition) { GBeanData gbeanData = new GBeanData(gBeanDefinition.getObjectName(), createGBeanInfo(gBeanDefinition)); gbeanData.setAttribute("gbeanEnabled", Boolean.valueOf(gBeanDefinition.isEnabled())); // add the normal properties PropertyValue[] properties = gBeanDefinition.getPropertyValues().getPropertyValues(); for (int i = 0; i < properties.length; i++) { PropertyValue propertyValue = properties[i]; gbeanData.setAttribute(propertyValue.getName(), propertyValue.getValue()); } // add the dynamic properties PropertyValue[] dynamicProperties = gBeanDefinition.getDynamicPropertyValues().getPropertyValues(); for (int i = 0; i < dynamicProperties.length; i++) { PropertyValue dynamicPropertyValue = dynamicProperties[i]; gbeanData.setAttribute(dynamicPropertyValue.getName(), dynamicPropertyValue.getValue()); } // add the constructor arguments for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); ConstructorArgumentValues.ValueHolder valueHolder = (ConstructorArgumentValues.ValueHolder) entry.getValue(); String constructorArgName; if (valueHolder instanceof NamedValueHolder) { NamedValueHolder namedValueHolder = (NamedValueHolder) valueHolder; constructorArgName = namedValueHolder.getName(); } else { int index = ((Integer) entry.getKey()).intValue(); constructorArgName = "constructor-argument-" + index; } gbeanData.setAttribute(constructorArgName, valueHolder.getValue()); } // add the dependencies String[] dependsOn = gBeanDefinition.getDependsOn(); for (int i = 0; i < dependsOn.length; i++) { String dependencyString = dependsOn[i]; Map map = stringToDependency(dependencyString); Map.Entry entry = ((Map.Entry) map.entrySet().iterator().next()); String dependencyName = (String) entry.getKey(); Set patterns = (Set) entry.getValue(); gbeanData.setReferencePatterns(dependencyName, patterns); } return gbeanData; }
PropertyValue[] dynamicProperties = gBeanDefinition.getDynamicPropertyValues().getPropertyValues(); for (int i = 0; i < dynamicProperties.length; i++) { PropertyValue dynamicPropertyValue = dynamicProperties[i]; gbeanData.setAttribute(dynamicPropertyValue.getName(), dynamicPropertyValue.getValue()); } for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().entrySet().iterator(); iterator.hasNext();) {
for (Iterator iterator = serviceFactory.getDynamicProperties().entrySet().iterator(); iterator.hasNext();) {
public static GBeanData createGBeanData(GBeanDefinition gBeanDefinition) { GBeanData gbeanData = new GBeanData(gBeanDefinition.getObjectName(), createGBeanInfo(gBeanDefinition)); gbeanData.setAttribute("gbeanEnabled", Boolean.valueOf(gBeanDefinition.isEnabled())); // add the normal properties PropertyValue[] properties = gBeanDefinition.getPropertyValues().getPropertyValues(); for (int i = 0; i < properties.length; i++) { PropertyValue propertyValue = properties[i]; gbeanData.setAttribute(propertyValue.getName(), propertyValue.getValue()); } // add the dynamic properties PropertyValue[] dynamicProperties = gBeanDefinition.getDynamicPropertyValues().getPropertyValues(); for (int i = 0; i < dynamicProperties.length; i++) { PropertyValue dynamicPropertyValue = dynamicProperties[i]; gbeanData.setAttribute(dynamicPropertyValue.getName(), dynamicPropertyValue.getValue()); } // add the constructor arguments for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); ConstructorArgumentValues.ValueHolder valueHolder = (ConstructorArgumentValues.ValueHolder) entry.getValue(); String constructorArgName; if (valueHolder instanceof NamedValueHolder) { NamedValueHolder namedValueHolder = (NamedValueHolder) valueHolder; constructorArgName = namedValueHolder.getName(); } else { int index = ((Integer) entry.getKey()).intValue(); constructorArgName = "constructor-argument-" + index; } gbeanData.setAttribute(constructorArgName, valueHolder.getValue()); } // add the dependencies String[] dependsOn = gBeanDefinition.getDependsOn(); for (int i = 0; i < dependsOn.length; i++) { String dependencyString = dependsOn[i]; Map map = stringToDependency(dependencyString); Map.Entry entry = ((Map.Entry) map.entrySet().iterator().next()); String dependencyName = (String) entry.getKey(); Set patterns = (Set) entry.getValue(); gbeanData.setReferencePatterns(dependencyName, patterns); } return gbeanData; }
ConstructorArgumentValues.ValueHolder valueHolder = (ConstructorArgumentValues.ValueHolder) entry.getValue(); String constructorArgName; if (valueHolder instanceof NamedValueHolder) { NamedValueHolder namedValueHolder = (NamedValueHolder) valueHolder; constructorArgName = namedValueHolder.getName(); } else { int index = ((Integer) entry.getKey()).intValue(); constructorArgName = "constructor-argument-" + index; } gbeanData.setAttribute(constructorArgName, valueHolder.getValue()); } String[] dependsOn = gBeanDefinition.getDependsOn(); for (int i = 0; i < dependsOn.length; i++) { String dependencyString = dependsOn[i]; Map map = stringToDependency(dependencyString); Map.Entry entry = ((Map.Entry) map.entrySet().iterator().next()); String dependencyName = (String) entry.getKey(); Set patterns = (Set) entry.getValue(); gbeanData.setReferencePatterns(dependencyName, patterns);
String propertyName = (String) entry.getKey(); Object propertyValue = entry.getValue(); gbeanData.setAttribute(propertyName, propertyValue);
public static GBeanData createGBeanData(GBeanDefinition gBeanDefinition) { GBeanData gbeanData = new GBeanData(gBeanDefinition.getObjectName(), createGBeanInfo(gBeanDefinition)); gbeanData.setAttribute("gbeanEnabled", Boolean.valueOf(gBeanDefinition.isEnabled())); // add the normal properties PropertyValue[] properties = gBeanDefinition.getPropertyValues().getPropertyValues(); for (int i = 0; i < properties.length; i++) { PropertyValue propertyValue = properties[i]; gbeanData.setAttribute(propertyValue.getName(), propertyValue.getValue()); } // add the dynamic properties PropertyValue[] dynamicProperties = gBeanDefinition.getDynamicPropertyValues().getPropertyValues(); for (int i = 0; i < dynamicProperties.length; i++) { PropertyValue dynamicPropertyValue = dynamicProperties[i]; gbeanData.setAttribute(dynamicPropertyValue.getName(), dynamicPropertyValue.getValue()); } // add the constructor arguments for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); ConstructorArgumentValues.ValueHolder valueHolder = (ConstructorArgumentValues.ValueHolder) entry.getValue(); String constructorArgName; if (valueHolder instanceof NamedValueHolder) { NamedValueHolder namedValueHolder = (NamedValueHolder) valueHolder; constructorArgName = namedValueHolder.getName(); } else { int index = ((Integer) entry.getKey()).intValue(); constructorArgName = "constructor-argument-" + index; } gbeanData.setAttribute(constructorArgName, valueHolder.getValue()); } // add the dependencies String[] dependsOn = gBeanDefinition.getDependsOn(); for (int i = 0; i < dependsOn.length; i++) { String dependencyString = dependsOn[i]; Map map = stringToDependency(dependencyString); Map.Entry entry = ((Map.Entry) map.entrySet().iterator().next()); String dependencyName = (String) entry.getKey(); Set patterns = (Set) entry.getValue(); gbeanData.setReferencePatterns(dependencyName, patterns); } return gbeanData; }
public static GBeanInfo createGBeanInfo(GBeanDefinition gBeanDefinition) {
public static GBeanInfo createGBeanInfo(GeronimoServiceFactory serviceFactory) { RootBeanDefinition beanDefinition = serviceFactory.getBeanDefinition(); Set persistentProperties = serviceFactory.getPersistentProperties();
public static GBeanInfo createGBeanInfo(GBeanDefinition gBeanDefinition) { // add the normal properties Set attributeInfos = new HashSet(); PropertyValue[] properties = gBeanDefinition.getPropertyValues().getPropertyValues(); for (int i = 0; i < properties.length; i++) { PropertyValue propertyValue = properties[i]; attributeInfos.add(new GAttributeInfo(propertyValue.getName(), "java.lang.Object", true, null, null)); } // add the dynamic properties PropertyValue[] dynamicProperties = gBeanDefinition.getDynamicPropertyValues().getPropertyValues(); for (int i = 0; i < dynamicProperties.length; i++) { PropertyValue dynamicPropertyValue = dynamicProperties[i]; attributeInfos.add(new DynamicGAttributeInfo(dynamicPropertyValue.getName(), "java.lang.Object", true, true, true)); } // add the constructor arguments int maxIndex = -1; for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().keySet().iterator(); iterator.hasNext();) { int index = ((Integer) iterator.next()).intValue(); if (index > maxIndex) maxIndex = index; } String[] constructorArgs = new String[maxIndex + 1]; for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); int index = ((Integer) entry.getKey()).intValue(); ConstructorArgumentValues.ValueHolder valueHolder = (ConstructorArgumentValues.ValueHolder) entry.getValue(); String constructorArgName; if (valueHolder instanceof NamedValueHolder) { NamedValueHolder namedValueHolder = (NamedValueHolder) valueHolder; constructorArgName = namedValueHolder.getName(); } else { constructorArgName = "constructor-argument-" + index; } attributeInfos.add(new GAttributeInfo(constructorArgName, valueHolder.getType(), true, null, null)); constructorArgs[index] = constructorArgName; } // add the dependencies Set referenceInfos = new HashSet(); String[] dependsOn = gBeanDefinition.getDependsOn(); for (int i = 0; i < dependsOn.length; i++) { Map map = stringToDependency(dependsOn[i]); String dependencyName = (String) map.keySet().iterator().next(); referenceInfos.add(new GReferenceInfo("@" + dependencyName, DependencyOnly.class.getName(), DependencyOnly.class.getName(), null, null)); } return new GBeanInfo(gBeanDefinition.getBeanClassName(), "GBean", attributeInfos, new GConstructorInfo(constructorArgs), Collections.EMPTY_SET, referenceInfos); }
PropertyValue[] properties = gBeanDefinition.getPropertyValues().getPropertyValues();
PropertyValue[] properties = beanDefinition.getPropertyValues().getPropertyValues();
public static GBeanInfo createGBeanInfo(GBeanDefinition gBeanDefinition) { // add the normal properties Set attributeInfos = new HashSet(); PropertyValue[] properties = gBeanDefinition.getPropertyValues().getPropertyValues(); for (int i = 0; i < properties.length; i++) { PropertyValue propertyValue = properties[i]; attributeInfos.add(new GAttributeInfo(propertyValue.getName(), "java.lang.Object", true, null, null)); } // add the dynamic properties PropertyValue[] dynamicProperties = gBeanDefinition.getDynamicPropertyValues().getPropertyValues(); for (int i = 0; i < dynamicProperties.length; i++) { PropertyValue dynamicPropertyValue = dynamicProperties[i]; attributeInfos.add(new DynamicGAttributeInfo(dynamicPropertyValue.getName(), "java.lang.Object", true, true, true)); } // add the constructor arguments int maxIndex = -1; for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().keySet().iterator(); iterator.hasNext();) { int index = ((Integer) iterator.next()).intValue(); if (index > maxIndex) maxIndex = index; } String[] constructorArgs = new String[maxIndex + 1]; for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); int index = ((Integer) entry.getKey()).intValue(); ConstructorArgumentValues.ValueHolder valueHolder = (ConstructorArgumentValues.ValueHolder) entry.getValue(); String constructorArgName; if (valueHolder instanceof NamedValueHolder) { NamedValueHolder namedValueHolder = (NamedValueHolder) valueHolder; constructorArgName = namedValueHolder.getName(); } else { constructorArgName = "constructor-argument-" + index; } attributeInfos.add(new GAttributeInfo(constructorArgName, valueHolder.getType(), true, null, null)); constructorArgs[index] = constructorArgName; } // add the dependencies Set referenceInfos = new HashSet(); String[] dependsOn = gBeanDefinition.getDependsOn(); for (int i = 0; i < dependsOn.length; i++) { Map map = stringToDependency(dependsOn[i]); String dependencyName = (String) map.keySet().iterator().next(); referenceInfos.add(new GReferenceInfo("@" + dependencyName, DependencyOnly.class.getName(), DependencyOnly.class.getName(), null, null)); } return new GBeanInfo(gBeanDefinition.getBeanClassName(), "GBean", attributeInfos, new GConstructorInfo(constructorArgs), Collections.EMPTY_SET, referenceInfos); }
attributeInfos.add(new GAttributeInfo(propertyValue.getName(),
String propertyName = propertyValue.getName(); attributeInfos.add(new GAttributeInfo(propertyName,
public static GBeanInfo createGBeanInfo(GBeanDefinition gBeanDefinition) { // add the normal properties Set attributeInfos = new HashSet(); PropertyValue[] properties = gBeanDefinition.getPropertyValues().getPropertyValues(); for (int i = 0; i < properties.length; i++) { PropertyValue propertyValue = properties[i]; attributeInfos.add(new GAttributeInfo(propertyValue.getName(), "java.lang.Object", true, null, null)); } // add the dynamic properties PropertyValue[] dynamicProperties = gBeanDefinition.getDynamicPropertyValues().getPropertyValues(); for (int i = 0; i < dynamicProperties.length; i++) { PropertyValue dynamicPropertyValue = dynamicProperties[i]; attributeInfos.add(new DynamicGAttributeInfo(dynamicPropertyValue.getName(), "java.lang.Object", true, true, true)); } // add the constructor arguments int maxIndex = -1; for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().keySet().iterator(); iterator.hasNext();) { int index = ((Integer) iterator.next()).intValue(); if (index > maxIndex) maxIndex = index; } String[] constructorArgs = new String[maxIndex + 1]; for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); int index = ((Integer) entry.getKey()).intValue(); ConstructorArgumentValues.ValueHolder valueHolder = (ConstructorArgumentValues.ValueHolder) entry.getValue(); String constructorArgName; if (valueHolder instanceof NamedValueHolder) { NamedValueHolder namedValueHolder = (NamedValueHolder) valueHolder; constructorArgName = namedValueHolder.getName(); } else { constructorArgName = "constructor-argument-" + index; } attributeInfos.add(new GAttributeInfo(constructorArgName, valueHolder.getType(), true, null, null)); constructorArgs[index] = constructorArgName; } // add the dependencies Set referenceInfos = new HashSet(); String[] dependsOn = gBeanDefinition.getDependsOn(); for (int i = 0; i < dependsOn.length; i++) { Map map = stringToDependency(dependsOn[i]); String dependencyName = (String) map.keySet().iterator().next(); referenceInfos.add(new GReferenceInfo("@" + dependencyName, DependencyOnly.class.getName(), DependencyOnly.class.getName(), null, null)); } return new GBeanInfo(gBeanDefinition.getBeanClassName(), "GBean", attributeInfos, new GConstructorInfo(constructorArgs), Collections.EMPTY_SET, referenceInfos); }
true,
persistentProperties.contains(propertyName),
public static GBeanInfo createGBeanInfo(GBeanDefinition gBeanDefinition) { // add the normal properties Set attributeInfos = new HashSet(); PropertyValue[] properties = gBeanDefinition.getPropertyValues().getPropertyValues(); for (int i = 0; i < properties.length; i++) { PropertyValue propertyValue = properties[i]; attributeInfos.add(new GAttributeInfo(propertyValue.getName(), "java.lang.Object", true, null, null)); } // add the dynamic properties PropertyValue[] dynamicProperties = gBeanDefinition.getDynamicPropertyValues().getPropertyValues(); for (int i = 0; i < dynamicProperties.length; i++) { PropertyValue dynamicPropertyValue = dynamicProperties[i]; attributeInfos.add(new DynamicGAttributeInfo(dynamicPropertyValue.getName(), "java.lang.Object", true, true, true)); } // add the constructor arguments int maxIndex = -1; for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().keySet().iterator(); iterator.hasNext();) { int index = ((Integer) iterator.next()).intValue(); if (index > maxIndex) maxIndex = index; } String[] constructorArgs = new String[maxIndex + 1]; for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); int index = ((Integer) entry.getKey()).intValue(); ConstructorArgumentValues.ValueHolder valueHolder = (ConstructorArgumentValues.ValueHolder) entry.getValue(); String constructorArgName; if (valueHolder instanceof NamedValueHolder) { NamedValueHolder namedValueHolder = (NamedValueHolder) valueHolder; constructorArgName = namedValueHolder.getName(); } else { constructorArgName = "constructor-argument-" + index; } attributeInfos.add(new GAttributeInfo(constructorArgName, valueHolder.getType(), true, null, null)); constructorArgs[index] = constructorArgName; } // add the dependencies Set referenceInfos = new HashSet(); String[] dependsOn = gBeanDefinition.getDependsOn(); for (int i = 0; i < dependsOn.length; i++) { Map map = stringToDependency(dependsOn[i]); String dependencyName = (String) map.keySet().iterator().next(); referenceInfos.add(new GReferenceInfo("@" + dependencyName, DependencyOnly.class.getName(), DependencyOnly.class.getName(), null, null)); } return new GBeanInfo(gBeanDefinition.getBeanClassName(), "GBean", attributeInfos, new GConstructorInfo(constructorArgs), Collections.EMPTY_SET, referenceInfos); }
PropertyValue[] dynamicProperties = gBeanDefinition.getDynamicPropertyValues().getPropertyValues(); for (int i = 0; i < dynamicProperties.length; i++) { PropertyValue dynamicPropertyValue = dynamicProperties[i]; attributeInfos.add(new DynamicGAttributeInfo(dynamicPropertyValue.getName(),
for (Iterator iterator = serviceFactory.getDynamicProperties().keySet().iterator(); iterator.hasNext();) { String propertyName = (String) iterator.next(); attributeInfos.add(new DynamicGAttributeInfo(propertyName,
public static GBeanInfo createGBeanInfo(GBeanDefinition gBeanDefinition) { // add the normal properties Set attributeInfos = new HashSet(); PropertyValue[] properties = gBeanDefinition.getPropertyValues().getPropertyValues(); for (int i = 0; i < properties.length; i++) { PropertyValue propertyValue = properties[i]; attributeInfos.add(new GAttributeInfo(propertyValue.getName(), "java.lang.Object", true, null, null)); } // add the dynamic properties PropertyValue[] dynamicProperties = gBeanDefinition.getDynamicPropertyValues().getPropertyValues(); for (int i = 0; i < dynamicProperties.length; i++) { PropertyValue dynamicPropertyValue = dynamicProperties[i]; attributeInfos.add(new DynamicGAttributeInfo(dynamicPropertyValue.getName(), "java.lang.Object", true, true, true)); } // add the constructor arguments int maxIndex = -1; for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().keySet().iterator(); iterator.hasNext();) { int index = ((Integer) iterator.next()).intValue(); if (index > maxIndex) maxIndex = index; } String[] constructorArgs = new String[maxIndex + 1]; for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); int index = ((Integer) entry.getKey()).intValue(); ConstructorArgumentValues.ValueHolder valueHolder = (ConstructorArgumentValues.ValueHolder) entry.getValue(); String constructorArgName; if (valueHolder instanceof NamedValueHolder) { NamedValueHolder namedValueHolder = (NamedValueHolder) valueHolder; constructorArgName = namedValueHolder.getName(); } else { constructorArgName = "constructor-argument-" + index; } attributeInfos.add(new GAttributeInfo(constructorArgName, valueHolder.getType(), true, null, null)); constructorArgs[index] = constructorArgName; } // add the dependencies Set referenceInfos = new HashSet(); String[] dependsOn = gBeanDefinition.getDependsOn(); for (int i = 0; i < dependsOn.length; i++) { Map map = stringToDependency(dependsOn[i]); String dependencyName = (String) map.keySet().iterator().next(); referenceInfos.add(new GReferenceInfo("@" + dependencyName, DependencyOnly.class.getName(), DependencyOnly.class.getName(), null, null)); } return new GBeanInfo(gBeanDefinition.getBeanClassName(), "GBean", attributeInfos, new GConstructorInfo(constructorArgs), Collections.EMPTY_SET, referenceInfos); }
int maxIndex = -1; for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().keySet().iterator(); iterator.hasNext();) { int index = ((Integer) iterator.next()).intValue(); if (index > maxIndex) maxIndex = index; } String[] constructorArgs = new String[maxIndex + 1]; for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); int index = ((Integer) entry.getKey()).intValue(); ConstructorArgumentValues.ValueHolder valueHolder = (ConstructorArgumentValues.ValueHolder) entry.getValue(); String constructorArgName; if (valueHolder instanceof NamedValueHolder) { NamedValueHolder namedValueHolder = (NamedValueHolder) valueHolder; constructorArgName = namedValueHolder.getName(); } else { constructorArgName = "constructor-argument-" + index; } attributeInfos.add(new GAttributeInfo(constructorArgName, valueHolder.getType(), true, null, null)); constructorArgs[index] = constructorArgName; } Set referenceInfos = new HashSet(); String[] dependsOn = gBeanDefinition.getDependsOn(); for (int i = 0; i < dependsOn.length; i++) { Map map = stringToDependency(dependsOn[i]); String dependencyName = (String) map.keySet().iterator().next(); referenceInfos.add(new GReferenceInfo("@" + dependencyName, DependencyOnly.class.getName(), DependencyOnly.class.getName(), null, null)); } return new GBeanInfo(gBeanDefinition.getBeanClassName(),
return new GBeanInfo(beanDefinition.getBeanClassName(),
public static GBeanInfo createGBeanInfo(GBeanDefinition gBeanDefinition) { // add the normal properties Set attributeInfos = new HashSet(); PropertyValue[] properties = gBeanDefinition.getPropertyValues().getPropertyValues(); for (int i = 0; i < properties.length; i++) { PropertyValue propertyValue = properties[i]; attributeInfos.add(new GAttributeInfo(propertyValue.getName(), "java.lang.Object", true, null, null)); } // add the dynamic properties PropertyValue[] dynamicProperties = gBeanDefinition.getDynamicPropertyValues().getPropertyValues(); for (int i = 0; i < dynamicProperties.length; i++) { PropertyValue dynamicPropertyValue = dynamicProperties[i]; attributeInfos.add(new DynamicGAttributeInfo(dynamicPropertyValue.getName(), "java.lang.Object", true, true, true)); } // add the constructor arguments int maxIndex = -1; for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().keySet().iterator(); iterator.hasNext();) { int index = ((Integer) iterator.next()).intValue(); if (index > maxIndex) maxIndex = index; } String[] constructorArgs = new String[maxIndex + 1]; for (Iterator iterator = gBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); int index = ((Integer) entry.getKey()).intValue(); ConstructorArgumentValues.ValueHolder valueHolder = (ConstructorArgumentValues.ValueHolder) entry.getValue(); String constructorArgName; if (valueHolder instanceof NamedValueHolder) { NamedValueHolder namedValueHolder = (NamedValueHolder) valueHolder; constructorArgName = namedValueHolder.getName(); } else { constructorArgName = "constructor-argument-" + index; } attributeInfos.add(new GAttributeInfo(constructorArgName, valueHolder.getType(), true, null, null)); constructorArgs[index] = constructorArgName; } // add the dependencies Set referenceInfos = new HashSet(); String[] dependsOn = gBeanDefinition.getDependsOn(); for (int i = 0; i < dependsOn.length; i++) { Map map = stringToDependency(dependsOn[i]); String dependencyName = (String) map.keySet().iterator().next(); referenceInfos.add(new GReferenceInfo("@" + dependencyName, DependencyOnly.class.getName(), DependencyOnly.class.getName(), null, null)); } return new GBeanInfo(gBeanDefinition.getBeanClassName(), "GBean", attributeInfos, new GConstructorInfo(constructorArgs), Collections.EMPTY_SET, referenceInfos); }