Java Code Examples for java.util.Hashtable

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project AlbiteREADER, under directory /src/gnu/zip/.

Source file: ZipFile.java

  19 
vote

/** 
 * Searches for a zip entry in this archive with the given name.
 * @param name the name. May contain directory components separated byslashes ('/').
 * @return the zip entry, or null if no entry with that name exists.
 * @exception IllegalStateException when the ZipFile has already been closed
 */
public ZipEntry getEntry(String name){
  checkClosed();
  try {
    Hashtable entries=getEntries();
    ZipEntry entry=(ZipEntry)entries.get(name);
    if (entry == null && !name.endsWith("/"))     entry=(ZipEntry)entries.get(name + '/');
    return entry != null ? new ZipEntry(entry,name) : null;
  }
 catch (  IOException ioe) {
    return null;
  }
}
 

Example 2

From project android_external_tagsoup, under directory /src/org/ccil/cowan/tagsoup/.

Source file: XMLWriter.java

  18 
vote

/** 
 * Internal initialization method. <p>All of the public constructors invoke this method.
 * @param writer The output destination, or null to usestandard output.
 */
private void init(Writer writer){
  setOutput(writer);
  nsSupport=new NamespaceSupport();
  prefixTable=new Hashtable();
  forcedDeclTable=new Hashtable();
  doneDeclTable=new Hashtable();
  outputProperties=new Properties();
}
 

Example 3

From project ant4eclipse, under directory /org.ant4eclipse.ant.platform/src/org/ant4eclipse/ant/platform/core/delegate/helper/.

Source file: AntReferencesRaper.java

  18 
vote

/** 
 * <p> Removes the value with the given key from the ant project references. </p>
 * @param key the key
 */
@SuppressWarnings("rawtypes") private void removeReference(String key){
  try {
    Hashtable references=(Hashtable)AbstractAntProjectRaper.getValue(getAntProject(),"references");
    if (references != null) {
      references.remove(key);
    }
  }
 catch (  Exception e) {
  }
}
 

Example 4

From project bioclipse.speclipse, under directory /plugins/net.bioclipse.spectrum/src/net/bioclipse/spectrum/contenttypes/.

Source file: CmlSpectrumFileDescriber.java

  18 
vote

/** 
 * Store parameters
 */
@SuppressWarnings("unchecked") public void setInitializationData(final IConfigurationElement config,final String propertyName,final Object data) throws CoreException {
  if (data instanceof String)   count=(String)data;
 else   if (data instanceof Hashtable) {
    Hashtable parameters=(Hashtable)data;
    type=(String)parameters.get(TYPE_TO_FIND);
    count=(String)parameters.get(COUNT_TO_FIND);
  }
  if (count == null) {
    String message=NLS.bind(ContentMessages.content_badInitializationData,CmlSpectrumFileDescriber.class.getName());
    throw new CoreException(new Status(IStatus.ERROR,ContentMessages.OWNER_NAME,0,message,null));
  }
}
 

Example 5

From project blueprint-namespaces, under directory /blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/.

Source file: CmManagedServiceFactory.java

  18 
vote

private void destroy(Object component,ServiceRegistration registration,int code){
  if (listeners != null) {
    ServiceReference ref=registration.getReference();
    for (    ServiceListener listener : listeners) {
      Hashtable props=JavaUtils.getProperties(ref);
      listener.unregister(component,props);
    }
  }
  destroyComponent(component,code);
  AriesFrameworkUtil.safeUnregisterService(registration);
}
 

Example 6

From project caustic, under directory /core/src/net/caustic/database/.

Source file: InMemoryDatabase.java

  18 
vote

/** 
 * Look in a data node for a value.  If it's not there, traverse up the tree.
 */
public String get(Scope scope,String key){
  while (scope != null) {
    Hashtable dataNode=(Hashtable)nodes.get(scope);
    String value=(String)dataNode.get(key);
    if (value != null) {
      return value;
    }
 else {
      scope=(Scope)tree.get(scope);
    }
  }
  return null;
}
 

Example 7

From project agile, under directory /agile-framework/src/main/java/org/apache/naming/.

Source file: NamingContext.java

  17 
vote

/** 
 * Builds a naming context using the given environment.
 */
public NamingContext(Hashtable env,String name) throws NamingException {
  this.bindings=new HashMap();
  this.env=new Hashtable();
  this.name=name;
  if (env != null) {
    Enumeration envEntries=env.keys();
    while (envEntries.hasMoreElements()) {
      String entryName=(String)envEntries.nextElement();
      addToEnvironment(entryName,env.get(entryName));
    }
  }
}
 

Example 8

From project Android_1, under directory /org.eclipse.ecf.android/src/org/eclipse/ecf/android/.

Source file: RegistrySharedObject.java

  17 
vote

/** 
 * @since 3.2
 */
protected void localRegisterService(RemoteServiceRegistrationImpl registration){
  final Object localServiceRegistrationValue=registration.getProperty(Constants.AUTOREGISTER_REMOTE_PROXY);
  if (localServiceRegistrationValue != null) {
    final RemoteServiceImpl remoteServiceImpl=new RemoteServiceImpl(this,registration);
    Object service;
    try {
      service=remoteServiceImpl.getProxy();
    }
 catch (    final ECFException e) {
      e.printStackTrace();
      log("localRegisterService",e);
      return;
    }
    final Hashtable properties=new Hashtable();
    final String[] keys=registration.getPropertyKeys();
    for (int i=0; i < keys.length; i++) {
      final Object value=registration.getProperty(keys[i]);
      if (value != null) {
        properties.put(keys[i],value);
      }
    }
    final ID remoteContainerID=registration.getContainerID();
    properties.put(Constants.SERVICE_CONTAINER_ID,remoteContainerID.getName());
    TCPServerSOContainer container=(TCPServerSOContainer)getSOContext().getContainer();
    container.registerService((ISharedObject)service);
    final RemoteServiceRegistrationImpl serviceRegistration=new RemoteServiceRegistrationImpl();
    addLocalServiceRegistration(remoteContainerID,serviceRegistration);
  }
}
 

Example 9

From project Bitcoin-Wallet-for-Android, under directory /wallet/src/com/google/zxing/.

Source file: Result.java

  17 
vote

public void putMetadata(ResultMetadataType type,Object value){
  if (resultMetadata == null) {
    resultMetadata=new Hashtable(3);
  }
  resultMetadata.put(type,value);
}
 

Example 10

From project blacktie, under directory /jatmibroker-xatmi/src/main/java/org/jboss/narayana/blacktie/jatmibroker/core/tx/.

Source file: TransactionImpl.java

  17 
vote

/** 
 * Add the specified thread to the list of threads associated with this transaction.
 * @return <code>true</code> if successful, <code>false</code> otherwise.
 */
public final boolean addChildThread(Thread t){
  if (t == null)   return false;
synchronized (this) {
    if (active) {
      if (_childThreads == null)       _childThreads=new Hashtable();
      return true;
    }
  }
  return false;
}
 

Example 11

From project brightberry, under directory /src/org/json/me/.

Source file: JSONObject.java

  17 
vote

/** 
 * Construct a JSONObject from a Map.
 * @param map A map object that can be used to initialize the contents ofthe JSONObject.
 */
public JSONObject(Hashtable map){
  if (map == null) {
    this.myHashMap=new Hashtable();
  }
 else {
    this.myHashMap=new Hashtable(map.size());
    Enumeration keys=map.keys();
    while (keys.hasMoreElements()) {
      Object key=keys.nextElement();
      this.myHashMap.put(key,map.get(key));
    }
  }
}
 

Example 12

From project bundlemaker, under directory /main/org.bundlemaker.core.jdt/src/org/bundlemaker/core/jdt/parser/.

Source file: CoreParserJdt.java

  17 
vote

/** 
 * Returns the default compiler options. The returned map contains at least the source- and binary compliance level for the compiler set to java1.6
 * @param compilerOptions The available compiler options or null
 * @return
 */
@SuppressWarnings({"rawtypes","unchecked"}) public static Map getCompilerOptionsWithComplianceLevel(Map compilerOptions){
  Map result=new Hashtable();
  if (compilerOptions != null) {
    result.putAll(compilerOptions);
  }
  result.put(JavaCore.COMPILER_SOURCE,JavaCore.VERSION_1_6);
  result.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM,JavaCore.VERSION_1_6);
  result.put(JavaCore.COMPILER_COMPLIANCE,JavaCore.VERSION_1_6);
  return result;
}
 

Example 13

From project c3p0, under directory /src/java/com/mchange/v2/c3p0/.

Source file: JndiRefForwardingDataSource.java

  17 
vote

private DataSource dereference() throws SQLException {
  Object jndiName=this.getJndiName();
  Hashtable jndiEnv=this.getJndiEnv();
  try {
    InitialContext ctx;
    if (jndiEnv != null)     ctx=new InitialContext(jndiEnv);
 else     ctx=new InitialContext();
    if (jndiName instanceof String)     return (DataSource)ctx.lookup((String)jndiName);
 else     if (jndiName instanceof Name)     return (DataSource)ctx.lookup((Name)jndiName);
 else     throw new SQLException("Could not find ConnectionPoolDataSource with " + "JNDI name: " + jndiName);
  }
 catch (  NamingException e) {
    if (logger.isLoggable(MLevel.WARNING))     logger.log(MLevel.WARNING,"An Exception occurred while trying to look up a target DataSource via JNDI!",e);
    throw SqlUtils.toSQLException(e);
  }
}
 

Example 14

From project camel-osgi, under directory /component/src/test/java/org/apache/camel/osgi/service/util/.

Source file: OsgiServiceCollectionTest.java

  17 
vote

@Test @SuppressWarnings("unchecked") public void testAdd() throws Exception {
  OsgiServiceCollection collection=createCollection("(a=b)");
  collection.startTracking();
  assertThat(collection.isEmpty(),equalTo(true));
  assertThat(collection.size(),equalTo(0));
  registry.registerService(Collection.class.getName(),new ArrayList<Object>(),new Hashtable(Collections.singletonMap("a","b")));
  assertThat(collection.isEmpty(),equalTo(false));
  assertThat(collection.size(),equalTo(1));
}
 

Example 15

From project Carolina-Digital-Repository, under directory /djatoka-cdr/src/gov/lanl/adore/djatoka/util/.

Source file: ImageProcessingUtils.java

  17 
vote

/** 
 * Populates a BufferedImage from a RenderedImage Source: http://www.jguru.com/faq/view.jsp?EID=114602
 * @param img RenderedImage to be converted to BufferedImage
 * @return BufferedImage with complete raster data
 */
public static BufferedImage convertRenderedImage(RenderedImage img){
  if (img instanceof BufferedImage) {
    return (BufferedImage)img;
  }
  ColorModel cm=img.getColorModel();
  int width=img.getWidth();
  int height=img.getHeight();
  WritableRaster raster=cm.createCompatibleWritableRaster(width,height);
  boolean isAlphaPremultiplied=cm.isAlphaPremultiplied();
  Hashtable properties=new Hashtable();
  String[] keys=img.getPropertyNames();
  if (keys != null) {
    for (int i=0; i < keys.length; i++) {
      properties.put(keys[i],img.getProperty(keys[i]));
    }
  }
  BufferedImage result=new BufferedImage(cm,raster,isAlphaPremultiplied,properties);
  img.copyData(raster);
  return result;
}
 

Example 16

From project 3Dto2DApplet, under directory /src/java/nl/dannyarends/generic/.

Source file: Utils.java

  15 
vote

public static Hashtable<String,Object> parseQueryString(String query,String encoding){
  Hashtable<String,Object> result=new Hashtable<String,Object>();
  if (encoding == null)   encoding="UTF-8";
  StringTokenizer st=new StringTokenizer(query,"&");
  while (st.hasMoreTokens()) {
    String pair=st.nextToken();
    int ep=pair.indexOf('=');
    String key=ep > 0 ? pair.substring(0,ep) : pair;
    String value=ep > 0 ? pair.substring(ep + 1) : "";
    try {
      key=decode(key,encoding);
      if (value != null)       value=decode(value,encoding);
    }
 catch (    UnsupportedEncodingException uee) {
    }
    String[] values=(String[])result.get(key);
    String[] newValues;
    if (values == null) {
      newValues=new String[1];
      newValues[0]=value;
    }
 else {
      newValues=new String[values.length + 1];
      System.arraycopy(values,0,newValues,0,values.length);
      newValues[values.length]=value;
    }
    result.put(key,newValues);
  }
  return result;
}
 

Example 17

From project advanced, under directory /management/src/main/java/org/neo4j/management/impl/.

Source file: KernelProxy.java

  15 
vote

private static ObjectName createObjectName(String domain,Hashtable<String,String> properties,String beanName,boolean query,String... extraNaming){
  properties.put("name",beanName);
  for (int i=0; i < extraNaming.length; i++) {
    properties.put("name" + i,extraNaming[i]);
  }
  ObjectName result;
  try {
    result=new ObjectName(domain,properties);
    if (query)     result=ObjectName.getInstance(result.toString() + ",*");
  }
 catch (  MalformedObjectNameException e) {
    return null;
  }
  return result;
}
 

Example 18

From project agraph-java-client, under directory /src/com/franz/agraph/pool/.

Source file: AGConnPoolJndiFactory.java

  15 
vote

/** 
 * From the obj  {@link Reference}, gets the  {@link RefAddr}names and values, converts to Maps and returns  {@link AGConnPool#create(Object)}.
 */
@Override public Object getObjectInstance(Object obj,Name name,Context nameCtx,Hashtable<?,?> environment) throws Exception {
  if (!(obj instanceof Reference)) {
    return null;
  }
  Reference ref=(Reference)obj;
  if (!AGConnPool.class.getName().equals(ref.getClassName())) {
    return null;
  }
  Map<AGConnProp,String> connProps=(Map<AGConnProp,String>)refToMap(ref,AGConnProp.values());
  Map<AGPoolProp,String> poolProps=(Map<AGPoolProp,String>)refToMap(ref,AGPoolProp.values());
  return AGConnPool.create(connProps,poolProps);
}
 

Example 19

From project aksunai, under directory /src/org/androidnerds/app/aksunai/data/.

Source file: ServerDbAdapter.java

  15 
vote

public Hashtable<Long,String> getAutoConnectServers(){
  SQLiteDatabase db=getReadableDatabase();
  Hashtable<Long,String> servers=new Hashtable<Long,String>();
  Cursor c=db.query(DB_TABLE,null,null,null,null,null,null);
  while (c.moveToNext()) {
    servers.put(new Long(c.getLong(8)),c.getString(1));
  }
  c.close();
  db.close();
  return servers;
}
 

Example 20

From project android-client, under directory /xwiki-android-core/src/org/xwiki/android/context/.

Source file: XWikiApplicationContext.java

  15 
vote

@Override public void onCreate(){
  super.onCreate();
  currContext=this;
  if (!initialized) {
    Log.d(tag,"Context Class got loaded. Did your process get killed?");
    store=new Hashtable<String,Object>(10);
  }
  startBGServices();
}
 

Example 21

From project Android-DB-Editor, under directory /src/com/troido/dbeditor/.

Source file: Device.java

  15 
vote

private void createPackages(List<Database> databases){
  Hashtable<String,Package> packageMap=new Hashtable<String,Package>();
  for (  Database db : databases) {
    Package p=packageMap.get(db.getPackageName());
    if (p == null) {
      p=new Package(db.getPackageName());
      packageMap.put(db.getPackageName(),p);
    }
    p.addDatabase(db);
  }
  packages=packageMap.values().toArray(new Package[0]);
  Arrays.sort(packages,new Comparator<Package>(){
    @Override public int compare(    Package o1,    Package o2){
      return o1.compareTo(o2);
    }
  }
);
}
 

Example 22

From project android-tether, under directory /src/og/android/tether/.

Source file: AccessControlActivity.java

  15 
vote

private ArrayList<ClientData> getCurrentClientData(){
  ArrayList<ClientData> clientDataList=new ArrayList<ClientData>();
  Hashtable<String,ClientData> leases=null;
  try {
    leases=application.coretask.getLeases();
  }
 catch (  Exception e) {
    AccessControlActivity.this.application.displayToastMessage(getString(R.string.accesscontrol_activity_error_read_leasefile));
  }
  if (whitelist != null) {
    for (    String macAddress : whitelist.get()) {
      ClientData clientData=new ClientData();
      clientData.setConnected(false);
      clientData.setIpAddress(getString(R.string.accesscontrol_activity_not_connected));
      if (leases.containsKey(macAddress)) {
        clientData=leases.get(macAddress);
        Log.d(MSG_TAG,clientData.isConnected() + " - " + clientData.getIpAddress());
        leases.remove(macAddress);
      }
      clientData.setAccessAllowed(true);
      clientData.setMacAddress(macAddress);
      clientDataList.add(clientData);
    }
  }
  if (leases != null) {
    Enumeration<String> enumLeases=leases.keys();
    while (enumLeases.hasMoreElements()) {
      String macAddress=enumLeases.nextElement();
      clientDataList.add(leases.get(macAddress));
    }
  }
  this.application.resetClientMacLists();
  return clientDataList;
}
 

Example 23

From project androidTileMapEditor_1, under directory /src/it/sineo/android/tileMapEditor/.

Source file: ImageAdapter.java

  15 
vote

public ImageAdapter(Context ctx){
  this.ctx=ctx;
  this.images=new ArrayList<String>();
  this.htImages=new Hashtable<String,BitmapDrawable>();
  this.rand=new Random(System.currentTimeMillis());
  Log.d(TAG,"initialized random generator");
}
 

Example 24

From project arkadiko, under directory /src/com/liferay/arkadiko/.

Source file: AKBeanPostProcessor.java

  15 
vote

/** 
 * Adds the extra bean properties.
 * @param properties the properties
 */
protected void addExtraBeanProperties(Hashtable<String,Object> properties){
  if ((_extraBeanProperties == null) || _extraBeanProperties.isEmpty()) {
    return;
  }
  for (  Map.Entry<String,Object> entry : _extraBeanProperties.entrySet()) {
    properties.put(entry.getKey(),entry.getValue());
  }
}
 

Example 25

From project Armageddon, under directory /src/main/java/com/iminurnetz/bukkit/plugin/armageddon/.

Source file: ArmageddonPlugin.java

  15 
vote

@Override public void enablePlugin() throws Exception {
  grenadesFired=new Hashtable<Integer,Grenade>();
  trackedEntities=new TrackedEntityList<TrackedLivingEntity>(this);
  waterTrackers=new WaterTrackerMap<Integer,WaterTracker>(this);
  spiderWebs=new HashSet<Block>();
  nuclearExplosions=new ArrayList<Location>();
  bulletsFired=new Hashtable<Integer,Integer>();
  blockShotAt=new Hashtable<Integer,Block>();
  config=new ArmageddonConfiguration(this);
  permissionHandler=new ArmageddonPermissionHandler(this);
  loadCannonsFile();
  PluginManager pm=getServer().getPluginManager();
  pm.registerEvents(new ArmageddonBlockListener(this),this);
  pm.registerEvents(new ArmageddonPlayerListener(this),this);
  pm.registerEvents(new ArmageddonEntityListener(this),this);
  log("enabled.");
}
 

Example 26

From project arquillian-container-was, under directory /was-remote-7/src/main/java/org/jboss/arquillian/container/was/remote_7/.

Source file: WebSphereRemoteContainer.java

  15 
vote

public void undeploy(final Archive<?> archive) throws DeploymentException {
  if (log.isLoggable(Level.FINER)) {
    log.entering(className,"undeploy");
  }
  String appName=createDeploymentName(archive.getName());
  try {
    Hashtable<Object,Object> prefs=new Hashtable<Object,Object>();
    NotificationFilterSupport filterSupport=new NotificationFilterSupport();
    filterSupport.enableType(AppConstants.NotificationType);
    DeploymentNotificationListener listener=new DeploymentNotificationListener(adminClient,filterSupport,"Uninstall " + appName,AppNotification.UNINSTALL);
    AppManagement appManagementProxy=AppManagementProxy.getJMXProxyForClient(adminClient);
    appManagementProxy.uninstallApplication(appName,prefs,null);
synchronized (listener) {
      listener.wait();
    }
    if (listener.isSuccessful()) {
    }
 else {
      throw new IllegalStateException("Application not sucessfully undeployed: " + listener.getMessage());
    }
  }
 catch (  Exception e) {
    throw new DeploymentException("Could not undeploy application",e);
  }
  if (log.isLoggable(Level.FINER)) {
    log.exiting(className,"undeploy");
  }
}
 

Example 27

From project Baseform-Epanet-Java-Library, under directory /src/org/addition/epanet/msx/.

Source file: Project.java

  15 
vote

int createHashTables(){
  int j;
  Htable=new Map[ObjectTypes.MAX_OBJECTS.id];
  for (j=0; j < ObjectTypes.MAX_OBJECTS.id; j++) {
    Htable[j]=new Hashtable<String,Integer>();
  }
  return 0;
}
 

Example 28

From project BDSup2Sub, under directory /src/main/java/bdsup2sub/tools/.

Source file: JFileFilter.java

  15 
vote

/** 
 * Adds a file type "dot" extension to filter against. For example: the following code will create a filter that filters out all files except those that end in ".jpg" and ".tif": JFileFilter filter = new JFileFilter(); filter.addExtension("jpg"); filter.addExtension("tif"); Note that the "." before the extension is not needed and will be ignored.
 * @param extension file extension (e.g. '.sup')
 */
public void addExtension(String extension){
  if (filters == null) {
    filters=new Hashtable<String,JFileFilter>(5);
  }
  filters.put(extension.toLowerCase(),this);
  fullDescription=null;
}
 

Example 29

From project Bit4Tat, under directory /Bit4Tat/src/com/Bit4Tat/.

Source file: Bit4Tat.java

  15 
vote

public static void main(String[] args){
  SchedulerGateway simpleScheduler=new DefaultScheduler();
  WalletFileIO f=new WalletFileIO("wallet.csv");
  f.openReader();
  StringTokenizer tokenizer=f.getTokenizer(",");
  userpass=new Hashtable<String,String[]>();
  String service="";
  String[] account=new String[2];
  try {
    if (tokenizer.countTokens() == 0)     throw (new Exception("empty"));
    while (tokenizer.hasMoreTokens()) {
      service=tokenizer.nextToken();
      if ((service.equals("mtgox")) && (service.equals("tradehill")))       throw (new Exception("unknown service"));
      account[0]=tokenizer.nextToken();
      account[1]=tokenizer.nextToken();
      userpass.put(service,account);
    }
  }
 catch (  Exception e) {
    if (e.getMessage().equals("empty"))     System.err.println("Wallet file is empty!");
 else     if (e.getMessage().equals("unknown service")) {
      System.err.println("Unknown service!");
      System.err.println(service);
    }
 else {
      System.err.println(e.getMessage());
      System.err.println(e);
    }
  }
  Wallet coinPurse=new Wallet(userpass);
  BitFrame frame=new BitFrame(coinPurse);
  frame.setTitle("Bit4Tat " + version);
  frame.setVisible(true);
}
 

Example 30

From project bitfluids, under directory /src/main/java/at/bitcoin_austria/bitfluids/.

Source file: Utils.java

  15 
vote

public static Bitmap getQRCodeBitmap(final String url,final int size){
  try {
    final Hashtable<EncodeHintType,Object> hints=new Hashtable<EncodeHintType,Object>();
    hints.put(EncodeHintType.ERROR_CORRECTION,ErrorCorrectionLevel.M);
    final BitMatrix result=QR_CODE_WRITER.encode(url,BarcodeFormat.QR_CODE,size,size,hints);
    final int width=result.getWidth();
    final int height=result.getHeight();
    final int[] pixels=new int[width * height];
    for (int y=0; y < height; y++) {
      final int offset=y * width;
      for (int x=0; x < width; x++) {
        pixels[offset + x]=result.get(x,y) ? Color.BLACK : Color.WHITE;
      }
    }
    final Bitmap bitmap=Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888);
    bitmap.setPixels(pixels,0,width,0,0,width,height);
    return bitmap;
  }
 catch (  final WriterException x) {
    x.printStackTrace();
    return null;
  }
}
 

Example 31

From project bndtools, under directory /bndtools.core/src/bndtools/.

Source file: Activator.java

  15 
vote

@Override public void start(BundleContext context) throws Exception {
  super.start(context);
  instance=this;
  this.context=context;
  Hashtable<String,Object> p=new Hashtable<String,Object>();
  context.registerService(Action.class.getName(),new ReflectAction(""),p);
  repoListenerTracker=new RepositoryListenerPluginTracker(context);
  repoListenerTracker.open();
}
 

Example 32

From project bonecp, under directory /bonecp/src/main/java/com/jolbox/bonecp/.

Source file: BoneCPDataSource.java

  15 
vote

public Object getObjectInstance(Object object,Name name,Context context,Hashtable<?,?> table) throws Exception {
  Reference ref=(Reference)object;
  Enumeration<RefAddr> addrs=ref.getAll();
  Properties props=new Properties();
  while (addrs.hasMoreElements()) {
    RefAddr addr=addrs.nextElement();
    if (addr.getType().equals("driverClassName")) {
      Class.forName((String)addr.getContent());
    }
 else {
      props.put(addr.getType(),addr.getContent());
    }
  }
  BoneCPConfig config=new BoneCPConfig(props);
  return new BoneCPDataSource(config);
}
 

Example 33

From project Book-Catalogue, under directory /src/com/eleybourn/bookcatalogue/.

Source file: BookISBNSearch.java

  15 
vote

/** 
 * Ensure the TaskManager is saved.
 */
@Override public void onRetainNonConfigurationInstance(Hashtable<String,Object> store){
  if (mSearchManager != null) {
    store.put("SearchManager",mSearchManager);
    mSearchManager.disconnect();
    mSearchManager=null;
  }
}
 

Example 34

From project bpelunit, under directory /net.bpelunit.framework/src/main/java/net/bpelunit/framework/coverage/annotation/tools/bpelxmltools/.

Source file: BasicActivities.java

  15 
vote

/** 
 * Legt die Aktivit?ten fest, abh?ngig von der BPEL-Version (1.1 oder 2.0)
 */
public static void initialize(){
  Namespace bpelNamespace=BpelXMLTools.getProcessNamespace();
  if (bpelNamespace.equals(NAMESPACE_BPEL_2_0)) {
    basisActivities=new Hashtable<String,String>();
    basisActivities.put(INVOKE_ACTIVITY,INVOKE_ACTIVITY);
    basisActivities.put(EXIT_ACTIVITY,EXIT_ACTIVITY);
    basisActivities.put(RECEIVE_ACTIVITY,RECEIVE_ACTIVITY);
    basisActivities.put(REPLY_ACTIVITY,REPLY_ACTIVITY);
    basisActivities.put(THROW_ACTIVITY,THROW_ACTIVITY);
    basisActivities.put(RETHROW_ACTIVITY,RETHROW_ACTIVITY);
    basisActivities.put(WAIT_ACTIVITY,WAIT_ACTIVITY);
    basisActivities.put(ASSIGN_ACTIVITY,ASSIGN_ACTIVITY);
    basisActivities.put(EMPTY_ACTIVITY,EMPTY_ACTIVITY);
    basisActivities.put(COMPENSATE_ACTIVITY,COMPENSATE_ACTIVITY);
    basisActivities.put(VALIDATE_ACTIVITY,VALIDATE_ACTIVITY);
    basisActivities.put(COMPENSATESCOPE_ACTIVITY,COMPENSATESCOPE_ACTIVITY);
  }
 else   if (bpelNamespace.equals(NAMESPACE_BPEL_1_1)) {
    basisActivities=new Hashtable<String,String>();
    basisActivities.put(INVOKE_ACTIVITY,INVOKE_ACTIVITY);
    basisActivities.put(RECEIVE_ACTIVITY,RECEIVE_ACTIVITY);
    basisActivities.put(REPLY_ACTIVITY,REPLY_ACTIVITY);
    basisActivities.put(THROW_ACTIVITY,THROW_ACTIVITY);
    basisActivities.put(WAIT_ACTIVITY,WAIT_ACTIVITY);
    basisActivities.put(ASSIGN_ACTIVITY,ASSIGN_ACTIVITY);
    basisActivities.put(EMPTY_ACTIVITY,EMPTY_ACTIVITY);
    basisActivities.put(COMPENSATE_ACTIVITY,COMPENSATE_ACTIVITY);
    basisActivities.put(TERMINATE_ACTIVITY,TERMINATE_ACTIVITY);
  }
}
 

Example 35

From project BPMN2-Editor-for-Eclipse, under directory /org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/.

Source file: ModelUtil.java

  15 
vote

/** 
 * Generate an ID string for a given BPMN2 object that will (eventually!) be added to the given Resource. CAUTION: IDs for objects that have already been deleted WILL be reused.
 * @param obj - the BPMN2 object
 * @param res - the Resource to which the object will be added
 * @return the ID string
 */
public static String generateID(EObject obj,Resource res){
  Object key=(res == null ? getKey(obj) : getKey(res));
  if (key != null) {
    Hashtable<String,EObject> tab=ids.get(key);
    if (tab == null) {
      tab=new Hashtable<String,EObject>();
      ids.put(key,tab);
    }
    String name=getObjectName(obj);
    for (int i=1; ; ++i) {
      String id=name + "_" + i;
      if (tab.get(id) == null) {
        tab.put(id,obj);
        return id;
      }
    }
  }
  return generateDefaultID(obj);
}
 

Example 36

From project Carnivore, under directory /org/rsg/carnivore/cache/.

Source file: ExampleFileFilter.java

  15 
vote

/** 
 * Adds a filetype "dot" extension to filter against. For example: the following code will create a filter that filters out all files except those that end in ".jpg" and ".tif": ExampleFileFilter filter = new ExampleFileFilter(); filter.addExtension("jpg"); filter.addExtension("tif"); Note that the "." before the extension is not needed and will be ignored.
 */
public void addExtension(String extension){
  if (filters == null) {
    filters=new Hashtable<String,ExampleFileFilter>(5);
  }
  filters.put(extension.toLowerCase(),this);
  fullDescription=null;
}