resin jms 配置
resin.jar
<!--
- JMS MemoryQueue
The Memory Queue and Topic are non-persistent. If the server restarts or even if the Queue's environment restarts, the messaging data will be lost. Applications needing persistent messaging should use the JDBC Queues.
-->
<resource jndi-name="jms/statusReplyQueue" type="com.caucho.jms.memory.MemoryQueue">
<init>
<queue-name>statusReplyQueue</queue-name>
</init>
</resource>
<!-- configures jms jndi name
The ConnectionFactory resource defines the JMS factory for creating JMS connections -->
<resource jndi-name="jms/statusReplyQueueConnectionFactory" type="com.caucho.jms.ConnectionFactoryImpl">
</resource>
The JDBC Queues and Topics provide a persistent messaging store. The Memory Queues and Topics provide a low-overhead memory-based store.
参考:
http://www.caucho.com/resin-3.0/jms/config.xtp
http://activemq.apache.org/tomcat.html
如何实现添加快捷图标?
Launcher为了让其他应用程序能够定制自己的快捷图标,就注册了一个BroadcastReceiver专门接收其他应用程序发来的快捷图标定制信息。所以只需要根据该BroadcastReceiver构造出相对应的Intent并装入我们的定制信息,最后调用sendBroadcast方法就可以创建一个快捷图标了。那么,要构造怎样一个Intent才会被Launcher的BroadcastReceiver接收呢?我们还是先来看看这个BroadcastReceiver的注册信息吧。
下面是Launcher的AndroidManifest.xml文件中Install-ShortcutReceiver的注册信息。
<!– Intent received used to install shortcuts from other applications –>
<receiver
android:name=”.InstallShortcutReceiver”
android:permission= “com.android.launcher.permission.INSTALL_SHORTCUT”>
<intent-filter>
<action android:name=”com.android.launcher.action.INSTALL_SHORTCUT” />
</intent-filter>
</receiver>
而快捷图标的信息则是以附加信息的形式存储在广播出去的Intent对象中的,包括有图标、显示的名称以及用来启动目标组件的Intent这三种信息。我们可以通过putExtra的重载方法,通过指定相应的键值,将这些信息放到附加信息的Bundle对象中。
列出了各种快捷图标信息相对应的键值和数据类型: 下面举些具体的例子,如下:private final String ACTION_ADD_SHORTCUT =
“com.android.launcher.action.INSTALL_SHORTCUT”;
Intent addShortcut =new Intent(ACTION_ADD_SHORTCUT);
String numToDial = null;
Parcelable icon = null;
numToDial = “110″;
icon = Intent.ShortcutIconResource.fromContext(this,R.drawable.jing);
//numToDial = “119″;
//icon = Intent.ShortcutIconResource.fromContext(this,R.drawable.huo);
//图标
addShortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,icon);
//名称
addShortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME,numToDial);
//启动目标组件的Intent
Intent directCall;
directCall.setData(Uri.parse(“tel://”+numToDial));
addShortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT,directCall);
sendBroadcast(addShortcut);
上面的程序运行后的界面如下:
只要知道这些信息后,你就可以轻而易举的为应用程序添加快捷图标。
rootViewController.m文件
- (void)viewDidLoad
{
self.title = @"First Page";
NSMutableArray *array = [[NSMutableArray alloc] init];
DisclosureButtonController *buttonController = [[DisclosureButtonController alloc] initWithStyle:UITableViewStylePlain];
buttonController.title = @"Button View";
buttonController.image = [UIImage imageNamed:@"apple.png"];
[array addObject:buttonController];
self.listData = array;
[array release];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"主页" style:UIBarButtonItemStyleBordered target:self action:@selector(leftButtonPressed)];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"下一页" style:UIBarButtonItemStyleBordered target:self action:@selector(rightButtonPressed)];
[super viewDidLoad];
}
- (void)leftButtonPressed
{
NSLog(@"Lefl Button");
}
- (void)rightButtonPressed
{
NSLog(@"Right Button");
}
#pragma mark -
#pragma mark Table View Data Source Methods
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.listData count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *thekey = @"thekey";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:thekey];
if(cell == nil){
cell = [[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:thekey
];
}
NSUInteger row = [indexPath row];
secondLevelViewController *nextController = [listData objectAtIndex:row];
cell.textLabel.text = nextController.title;
cell.imageView.image = nextController.image;
return cell;
}
#pragma mark -
#pragma mark Table Delegate Methods
- (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellAccessoryDisclosureIndicator;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger row = [indexPath row];
secondLevelViewController *nextController = [listData objectAtIndex:row];
[self.navigationController pushViewController:nextController animated:YES];
}
DisclosureDetailController.m文件
- (void)viewDidLoad
{
label.text = message;
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"添加" style:UIBarButtonItemStyleBordered target:self action:@selector(rightMethods)];
}
- (void)rightMethods
{
NSLog(@"...........");
}
DisclosureButtonController文件
- (void)viewDidLoad
{
NSArray *array = [[NSArray alloc]initWithObjects:@"The First One",@"The Second One",@"The Thr One",@"The Fou One", nil];
self.list = array;
[array release];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"last Page" style:UIBarButtonItemStyleBordered target:self action:@selector(uppage)];
}
- (void)uppage
{
[self.navigationController popToRootViewControllerAnimated:YES];
}
- (void)dealloc
{
[list release];
[super dealloc];
}
#pragma mark -
#pragma mark Table View Data Source Methods
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.list count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *theNewKey = @"theNewKey";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:theNewKey];
if(cell == nil){
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:theNewKey] autorelease];
}
NSUInteger row = [indexPath row];
NSString *theString = [list objectAtIndex:row];
cell.textLabel.text = theString;
return cell;
}
#pragma mark -
#pragma mark Table Delegate Methods
- (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellAccessoryDetailDisclosureButton;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Waring" message:@"You Pressed" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];
[alert show];
[alert release];
}
- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath
{
if(detailController == nil){
detailController = [[DisclosureDetailController alloc] initWithNibName:@"DisclosureDetail" bundle:nil];
}
detailController.title = @"The Detail View";
NSUInteger row = [indexPath row];
NSString *warItem = [list objectAtIndex:row];
NSString *detailSelect = [[NSString alloc] initWithFormat:@"You Pressed Is %@",warItem];
detailController.message = detailSelect;
[detailSelect release];
[self.navigationController pushViewController:detailController animated:YES];
}