Methods Summary |
---|
private void | createProfilePool()
if (LOG.isInfoEnabled())
LOG.info("Create ExtensionProfile pool with pool size:"
+ this.poolSize + " for service " + this.serviceName);
this.profilPool = new SimpleObjectPool<ExtensionProfile>(this.poolSize,
new ExtensionProfileFactory<ExtensionProfile>(
this.extensionProfile.getClass(),this.entryType,this.feedType));
|
public void | destroy()
if (this.profilPool != null)
this.profilPool.destroy();
if (LOG.isInfoEnabled())
LOG.info("Destroy Service " + this.serviceName
+ " -- release all resources");
this.feedType = null;
this.entryType = null;
this.extensionProfile = null;
|
public java.lang.Class | getEntryType()
return this.entryType;
|
public com.google.gdata.data.ExtensionProfile | getExtensionProfile()
ExtensionProfile ext = this.extProfThreadLocal.get();
if (ext != null) {
return ext;
}
if(this.extensionProfile == null)
return null;
if (this.profilPool == null)
createProfilePool();
ext = this.profilPool.aquire();
this.extProfThreadLocal.set(ext);
return ext;
|
public java.lang.Class | getFeedType()
return this.feedType;
|
public org.apache.lucene.gdata.search.config.IndexSchema | getIndexSchema()
return this.indexSchema;
|
public java.lang.String | getName()
return this.serviceName;
|
public int | getPoolSize()
return this.poolSize;
|
public javax.xml.transform.Templates | getTransformTemplate()
return this.transformerTemplate;
|
public void | setEntryType(java.lang.Class entryType)
this.entryType = entryType;
|
public void | setExtensionProfile(com.google.gdata.data.ExtensionProfile extensionProfil)
if (extensionProfil == null)
throw new IllegalArgumentException(
"ExtensionProfile must not be null");
if (this.extensionProfile != null)
return;
this.extensionProfile = extensionProfil;
|
public void | setExtensionProfileClass(java.lang.Class extensionProfileClass)TODO add comment
if (extensionProfileClass == null)
throw new IllegalArgumentException(
"ExtensionProfile class must not be null");
setExtensionProfile(extensionProfileClass.newInstance());
|
public void | setFeedType(java.lang.Class feedType)
this.feedType = feedType;
|
public void | setIndexSchema(org.apache.lucene.gdata.search.config.IndexSchema indexSchema)
this.indexSchema = indexSchema;
if(this.indexSchema != null)
this.indexSchema.setName(this.serviceName);
|
public void | setName(java.lang.String serviceName)
this.serviceName = serviceName;
|
public void | setPoolSize(int poolSize)
this.poolSize = poolSize >= DEFAULT_POOL_SIZE ? poolSize
: DEFAULT_POOL_SIZE;
|
public void | setXsltStylesheet(java.lang.String filename)Sets and creates the preview transformer xslt template to provide a html formate for feeds and entries.
The given file name must be available in the classpath.
if(filename == null || filename.length() == 0){
LOG.info("No preview stylesheet configured for service "+this.serviceName);
return;
}
TransformerFactory factory = TransformerFactory.newInstance();
try {
this.transformerTemplate = factory.newTemplates(new StreamSource(ProvidedServiceConfig.class.getResourceAsStream(filename.startsWith("/")?filename:"/"+filename)));
} catch (TransformerConfigurationException e) {
throw new RuntimeException("Can not compile xslt stylesheet path: "+filename,e);
}
|
public void | visiteDestroy()
/*
* Check every thread after request destroyed to release all profiles to
* the pool
*/
ExtensionProfile ext = this.extProfThreadLocal.get();
if (ext == null) {
if(LOG.isDebugEnabled())
LOG.debug("ThreadLocal owns no ExtensionProfile in requestDestroy for service "
+ this.serviceName);
return;
}
this.extProfThreadLocal.set(null);
this.profilPool.release(ext);
|
public void | visiteInitialize()
if(this.profilPool == null)
createProfilePool();
/*
* don't set a extension profile for each thread. The current thread
* might use another service and does not need the extension profile of
* this service
*/
|