Added: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/ServiceContextImpl.java URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/ServiceContextImpl.java?rev=1144476&view=auto ============================================================================== --- uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/ServiceContextImpl.java (added) +++ uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/ServiceContextImpl.java Fri Jul 8 20:11:20 2011 @@ -0,0 +1,377 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.uima.resourceSpecifier.factory.impl; + +import org.apache.uima.resourceSpecifier.factory.Action; +import org.apache.uima.resourceSpecifier.factory.ServiceContext; +import org.springframework.util.Assert; + +// TODO: Auto-generated Javadoc +/** + * The Class ServiceContextImpl. + */ +public class ServiceContextImpl implements ServiceContext { + + /** The name. */ + private String name=""; + + /** The async. */ + private boolean async; + + /** The description. */ + private String description=""; + + /** The descriptor. */ + private String descriptor=""; + + /** The protocol. */ + private String protocol="jms"; + + /** The provider. */ + private String provider="activemq"; + + /** The endpoint. */ + private String endpoint=""; + + /** The broker url. */ + private String brokerURL="${DefaultBrokerURL}"; + + /** The scale up. */ + private int scaleUp=1; + + /** The cas multiplier. */ + private boolean casMultiplier=false; + + /** The aggregate. */ + private boolean aggregate=false; + + /** The prefetch. */ + private int prefetch=0; + + /** The cas pool size. */ + private int casPoolSize=1; + + /** The initial heap size. */ + private int initialHeapSize=2000000; + + /** The process parent last. */ + private boolean processParentLast=false; + + /** The process error threshold count. */ + private int processErrorThresholdCount=0; + + /** The process error threshold window. */ + private int processErrorThresholdWindow=0; + + /** The process error threshold action. */ + private Action processErrorThresholdAction = Action.Terminate; + + /** The cpc additional action. */ + private Action cpcAdditionalAction = Action.Terminate; + /** + * This class describes UIMA AS service. The minimal information needed is the service name, description, the AnalysisEngine + * descriptor and the queue name. If not provided, the class uses defaults to fully describe the service. + * + * @param name - service name + * @param description - service description + * @param descriptor - analysis engine descriptor + * @param endpoint - the name of of the service input queue + */ + public ServiceContextImpl(String name, String description, String descriptor, String endpoint) { + this(name,description, descriptor,endpoint,null); + } + + public ServiceContextImpl(String name, String description, String descriptor, String endpoint, String brokerURL) { + setName(name); + setDescription(description); + Assert.notNull(descriptor); + setDescriptor(descriptor); + Assert.notNull(endpoint); + setEndpoint(endpoint); + if ( brokerURL != null ) { + setBrokerURL(brokerURL); + } + } + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setName(java.lang.String) + */ + public void setName(String name) { + this.name = name; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#getName() + */ + public String getName() { + return name; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setDescription(java.lang.String) + */ + public void setDescription(String description) { + this.description = description; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#getDescription() + */ + public String getDescription() { + return description; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setDescriptor(java.lang.String) + */ + public void setDescriptor(String descriptor) { + this.descriptor = descriptor; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#getDescriptor() + */ + public String getDescriptor() { + return descriptor; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setProtocol(java.lang.String) + */ + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#getProtocol() + */ + public String getProtocol() { + return protocol; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setProvider(java.lang.String) + */ + public void setProvider(String provider) { + this.provider = provider; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#getProvider() + */ + public String getProvider() { + return provider; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setEndpoint(java.lang.String) + */ + public void setEndpoint(String endpoint) { + this.endpoint = endpoint; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#getEndpoint() + */ + public String getEndpoint() { + return endpoint; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setBrokerURL(java.lang.String) + */ + public void setBrokerURL(String brokerURL) { + this.brokerURL = brokerURL; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#getBrokerURL() + */ + public String getBrokerURL() { + return brokerURL; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setPrefetch(int) + */ + public void setPrefetch(int prefetch) { + this.prefetch = prefetch; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#getPrefetch() + */ + public int getPrefetch() { + return prefetch; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setScaleup(int) + */ + public void setScaleup(int scaleUp) { + this.scaleUp = scaleUp; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#getScaleup() + */ + public int getScaleup() { + return scaleUp; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setCasMultiplier(boolean) + */ + public void setCasMultiplier(boolean casMultiplier) { + this.casMultiplier = casMultiplier; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#isCasMultiplier() + */ + public boolean isCasMultiplier() { + return casMultiplier; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setAggregate(boolean) + */ + public void setAggregate(boolean aggregate) { + this.aggregate = aggregate; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#isAggregate() + */ + public boolean isAggregate() { + return aggregate; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setCasPoolSize(int) + */ + public void setCasPoolSize(int casPoolSize) { + this.casPoolSize = casPoolSize; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#getCasPoolSize() + */ + public int getCasPoolSize() { + return casPoolSize; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setInitialHeapSize(int) + */ + public void setInitialHeapSize(int initialHeapSize) { + this.initialHeapSize = initialHeapSize; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#getInitialHeapSize() + */ + public int getInitialHeapSize() { + return initialHeapSize; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setProcessParentLast(boolean) + */ + public void setProcessParentLast(boolean processParentLast) { + this.processParentLast = processParentLast; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#processParentLast() + */ + public boolean processParentLast() { + return processParentLast; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setProcessErrorThresholdCount(int) + */ + public void setProcessErrorThresholdCount(int thresholdCount) { + this.processErrorThresholdCount = thresholdCount; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#getProcessErrorThresholdCount() + */ + public int getProcessErrorThresholdCount() { + return processErrorThresholdCount; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setProcessErrorThresholdWindow(int) + */ + public void setProcessErrorThresholdWindow(int thresholdWindow) { + this.processErrorThresholdWindow = thresholdWindow; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#getProcessErrorThresholdWindow() + */ + public int getProcessErrorThresholdWindow() { + return processErrorThresholdWindow; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setProcessErrorThresholdAction(org.apache.uima.resourceSpecifier.factory.Action) + */ + public void setProcessErrorThresholdAction(Action action) { + this.processErrorThresholdAction = action; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#getProcessErrorThresholdAction() + */ + public Action getProcessErrorThresholdAction() { + return processErrorThresholdAction; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setCpCAdditionalAction(org.apache.uima.resourceSpecifier.factory.Action) + */ + public void setCpCAdditionalAction(Action action) { + this.cpcAdditionalAction = action; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#getCpCAdditionalAction() + */ + public Action getCpCAdditionalAction() { + return cpcAdditionalAction; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#setAsync(boolean) + */ + public void setAsync(boolean async) { + this.async = async; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.ServiceContext#isAsync() + */ + public boolean isAsync() { + return async; + } + +}
Propchange: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/ServiceContextImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Added: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/ServiceImpl.java URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/ServiceImpl.java?rev=1144476&view=auto ============================================================================== --- uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/ServiceImpl.java (added) +++ uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/ServiceImpl.java Fri Jul 8 20:11:20 2011 @@ -0,0 +1,89 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.uima.resourceSpecifier.factory.impl; + +import org.apache.uima.resourceSpecifier.ServiceType; +import org.apache.uima.resourceSpecifier.factory.DelegateConfiguration; +import org.apache.uima.resourceSpecifier.factory.InputQueue; +import org.apache.uima.resourceSpecifier.factory.Service; +import org.apache.uima.resourceSpecifier.factory.ServiceContext; +import org.apache.uima.resourceSpecifier.factory.TopDescriptor; +import org.apache.uima.resourceSpecifier.factory.TopLevelAnalysisEngine; +import org.springframework.util.Assert; + +// TODO: Auto-generated Javadoc +/** + * The Class ServiceImpl. + */ +public class ServiceImpl implements Service { + + /** The iq. */ + private InputQueue iq = null; + + /** The td. */ + private TopDescriptor td = null; + + /** The tlae. */ + private TopLevelAnalysisEngine tlae = null; + + /** The st. */ + private ServiceType st; + + /** + * Instantiates a new service impl. + * + * @param st the st + * @param context the context + * @param delegateConfigurations the delegate configurations + */ + protected ServiceImpl(ServiceType st, ServiceContext context, DelegateConfiguration ... delegateConfigurations) { + Assert.notNull(st); + this.st = st; + iq = new InputQueueImpl(st.addNewInputQueue(), context); + td = new TopDescriptorImpl(st.addNewTopDescriptor(), context); + tlae = new TopLevelAnalysisEngineImpl(st.addNewAnalysisEngine(), context, delegateConfigurations); + + } + + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.Service#getInputQueue() + */ + public InputQueue getInputQueue() { + Assert.notNull(iq); + return iq; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.Service#getTopDescriptor() + */ + public TopDescriptor getTopDescriptor() { + Assert.notNull(td); + return td; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.Service#getTopLevelAnalysisEngine() + */ + public TopLevelAnalysisEngine getTopLevelAnalysisEngine() { + Assert.notNull(tlae); + return tlae; + } + +} Propchange: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/ServiceImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Added: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/TopDescriptorImpl.java URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/TopDescriptorImpl.java?rev=1144476&view=auto ============================================================================== --- uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/TopDescriptorImpl.java (added) +++ uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/TopDescriptorImpl.java Fri Jul 8 20:11:20 2011 @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.uima.resourceSpecifier.factory.impl; + +import org.apache.uima.resourceSpecifier.TopDescriptorType; +import org.apache.uima.resourceSpecifier.factory.Import; +import org.apache.uima.resourceSpecifier.factory.ServiceContext; +import org.apache.uima.resourceSpecifier.factory.TopDescriptor; +import org.springframework.util.Assert; + +// TODO: Auto-generated Javadoc +/** + * The Class TopDescriptorImpl. + */ +public class TopDescriptorImpl implements TopDescriptor { + + /** The tdt. */ + private TopDescriptorType tdt; + + /** The resource import. */ + private Import resourceImport; + /* + * !!!!!!!!!!! Modify to support import by name + */ + /** + * Instantiates a new top descriptor impl. + * + * @param tdt the tdt + * @param context the context + */ + public TopDescriptorImpl(TopDescriptorType tdt, ServiceContext context) { + this.tdt = tdt; + getImport().setLocation(context.getDescriptor()); + + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.TopDescriptor#getImport() + */ + public Import getImport() { + Assert.notNull(tdt); + if ( resourceImport == null ) { + resourceImport = new ImportImpl(tdt.addNewImport()); + } + return resourceImport; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.TopDescriptor#setImport(org.apache.uima.resourceSpecifier.factory.Import) + */ + public void setImport(Import imprt) { + resourceImport = imprt; + getImport().setLocation(imprt.getLocation()); + } + +} Propchange: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/TopDescriptorImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Added: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/TopLevelAnalysisEngineImpl.java URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/TopLevelAnalysisEngineImpl.java?rev=1144476&view=auto ============================================================================== --- uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/TopLevelAnalysisEngineImpl.java (added) +++ uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/TopLevelAnalysisEngineImpl.java Fri Jul 8 20:11:20 2011 @@ -0,0 +1,198 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.uima.resourceSpecifier.factory.impl; + +import org.apache.uima.resourceSpecifier.TopLevelAnalysisEngineType; +import org.apache.uima.resourceSpecifier.factory.AggregateDelegateEngine; +import org.apache.uima.resourceSpecifier.factory.AsyncPrimitiveErrorConfiguration; +import org.apache.uima.resourceSpecifier.factory.CasMultiplier; +import org.apache.uima.resourceSpecifier.factory.DelegateConfiguration; +import org.apache.uima.resourceSpecifier.factory.Delegates; +import org.apache.uima.resourceSpecifier.factory.Scaleout; +import org.apache.uima.resourceSpecifier.factory.ServiceContext; +import org.apache.uima.resourceSpecifier.factory.TopLevelAnalysisEngine; +import org.springframework.util.Assert; + +// TODO: Auto-generated Javadoc +/** + * The Class TopLevelAnalysisEngineImpl. + */ +public class TopLevelAnalysisEngineImpl implements TopLevelAnalysisEngine { + + /** The tlea. */ + private TopLevelAnalysisEngineType tlea; + + /** The input queue scaleout. */ + private Scaleout inputQueueScaleout = null; + + /** The reply queue scaleout. */ + private Scaleout replyQueueScaleout = null; + + /** The delegates. */ + private Delegates delegates = null; + + /** The ec. */ + private AsyncPrimitiveErrorConfiguration ec = null; + + /** The cm. */ + private CasMultiplier cm = null; + + /** + * Instantiates a new top level analysis engine impl. + * + * @param tlea the tlea + * @param context the context + * @param delegateConfigurations the delegate configurations + */ + protected TopLevelAnalysisEngineImpl( TopLevelAnalysisEngineType tlea, ServiceContext context, DelegateConfiguration ... delegateConfigurations) { + this.tlea = tlea; + if ( context.isCasMultiplier()) { + cm = new CasMultiplierImpl(tlea.addNewCasMultiplier(),context); + } + if ( delegateConfigurations != null && delegateConfigurations.length > 0) { + tlea.setAsync("true"); + //DelegateColocatedAnalysisEngineType dcaet = dt.addNewAnalysisEngine(); + AggregateDelegateEngine aggregateDelegateEngine = new AggregateDelegateEngineImpl( tlea, "", context, delegateConfigurations); + + delegates = new DelegatesImpl(tlea.addNewDelegates(),aggregateDelegateEngine, context, delegateConfigurations); + } else { + tlea.setAsync(String.valueOf(context.isAsync())); + ec = new AsyncPrimitiveErrorConfigurationImpl(tlea.addNewAsyncPrimitiveErrorConfiguration(),context,true); + inputQueueScaleout = new ScaleoutImpl(tlea.addNewScaleout(), context); + } + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.AnalysisEngine#getInputQueueScaleout() + */ + public Scaleout getInputQueueScaleout() { + Assert.notNull(inputQueueScaleout); + return inputQueueScaleout; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.AnalysisEngine#setInputQueueScaleout(org.apache.uima.resourceSpecifier.factory.Scaleout) + */ + public void setInputQueueScaleout(Scaleout scaleup) { + Assert.notNull(tlea); + if ( inputQueueScaleout == null ) { + getInputQueueScaleout().setNumberOfInstances(scaleup.getNumberOfInstances()); + } + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.AnalysisEngine#getReplyQueueScaleout() + */ + public Scaleout getReplyQueueScaleout() { + Assert.notNull(tlea); + if ( replyQueueScaleout == null ) { + //replyQueueScaleout = new ScaleoutImpl(tlea.addNewScaleout()); + } + return replyQueueScaleout; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.AnalysisEngine#setReplyQueueScaleout(org.apache.uima.resourceSpecifier.factory.Scaleout) + */ + public void setReplyQueueScaleout(Scaleout replyQueueScaleout) { + Assert.notNull(tlea); + tlea.setInternalReplyQueueScaleout(String.valueOf(replyQueueScaleout)); + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.AnalysisEngine#getDelegates() + */ + public Delegates getDelegates() { + Assert.notNull(delegates); + return delegates; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.AnalysisEngine#setDelegates(org.apache.uima.resourceSpecifier.factory.Delegates) + */ + public void setDelegates(Delegates delegates) { + Assert.notNull(tlea); + + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.AnalysisEngine#getCasMultiplier() + */ + public CasMultiplier getCasMultiplier() { + Assert.notNull(tlea); + return null; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.TopLevelAnalysisEngine#getPrimitiveErrorConfiguration() + */ + public AsyncPrimitiveErrorConfiguration getPrimitiveErrorConfiguration() { + Assert.notNull(ec); + return ec; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.TopLevelAnalysisEngine#setPrimitiveErrorConfiguration(org.apache.uima.resourceSpecifier.factory.AsyncPrimitiveErrorConfiguration) + */ + public void setPrimitiveErrorConfiguration(AsyncPrimitiveErrorConfiguration ec) { + Assert.notNull(tlea); + + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.AnalysisEngine#getKey() + */ + public String getKey() { + Assert.notNull(tlea); + return null; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.AnalysisEngine#setKey(java.lang.String) + */ + public void setKey(String key) { + Assert.notNull(tlea); + + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.AnalysisEngine#isAsync() + */ + public boolean isAsync() { + Assert.notNull(tlea); + return false; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.AnalysisEngine#setIsAsync() + */ + public void setIsAsync() { + Assert.notNull(tlea); + + } + + /** + * Sets the reply queue scaleout. + */ + public void setReplyQueueScaleout() { + // TODO Auto-generated method stub + + } + +} Propchange: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/TopLevelAnalysisEngineImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Added: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/UimaASAggregateDeploymentDescriptorImpl.java URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/UimaASAggregateDeploymentDescriptorImpl.java?rev=1144476&view=auto ============================================================================== --- uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/UimaASAggregateDeploymentDescriptorImpl.java (added) +++ uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/UimaASAggregateDeploymentDescriptorImpl.java Fri Jul 8 20:11:20 2011 @@ -0,0 +1,107 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.uima.resourceSpecifier.factory.impl; + +import java.util.List; + +import org.apache.uima.resourceSpecifier.AnalysisEngineDeploymentDescriptionDocument; +import org.apache.uima.resourceSpecifier.AnalysisEngineDeploymentDescriptionType; +import org.apache.uima.resourceSpecifier.factory.DelegateAnalysisEngine; +import org.apache.uima.resourceSpecifier.factory.DelegateConfiguration; +import org.apache.uima.resourceSpecifier.factory.Delegates; +import org.apache.uima.resourceSpecifier.factory.Deployment; +import org.apache.uima.resourceSpecifier.factory.ServiceContext; +import org.apache.uima.resourceSpecifier.factory.UimaASAggregateDeploymentDescriptor; +import org.apache.uima.resourceSpecifier.factory.impl.DeploymentDescriptorImpl; +import org.apache.uima.resourceSpecifier.factory.impl.DeploymentImpl; +import org.apache.uima.resourceSpecifier.factory.impl.UimaASDeploymentDescriptorImpl; +import org.springframework.util.Assert; + +// TODO: Auto-generated Javadoc +/** + * The Class UimaASAggregateDeploymentDescriptorImpl. + */ +public class UimaASAggregateDeploymentDescriptorImpl extends DeploymentDescriptorImpl +implements UimaASAggregateDeploymentDescriptor { + //private AnalysisEngineDeploymentDescriptionDocument dd; + //private AnalysisEngineDeploymentDescriptionType dt; + //private Deployment deployment; + + /** + * Instantiates a new uima as aggregate deployment descriptor impl. + * + * @param dd the dd + * @param context the context + * @param delegateConfigurations the delegate configurations + */ + public UimaASAggregateDeploymentDescriptorImpl(AnalysisEngineDeploymentDescriptionDocument dd, + ServiceContext context, DelegateConfiguration ... delegateConfigurations) { + super(new UimaASDeploymentDescriptorImpl(dd,context,delegateConfigurations)); + //this.dd = dd; + //Assert.notNull(dd); +// dt = dd.addNewAnalysisEngineDeploymentDescription(); + //setName(context.getName()); + //setDescription(context.getDescription()); + //deployment = new DeploymentImpl(dt.addNewDeployment(),context,delegateConfigurations); + } +/* + public List<DelegateConfiguration> getDelegates() { + List<DelegateConfiguration> delegateList = new ArrayList<DelegateConfiguration>(); + Delegates delegates = + super.deploymentDescriptor.getDeployment().getService().getTopLevelAnalysisEngine().getDelegates(); + DelegateConfiguration dc = null; + for( DelegateAnalysisEngine delegate : delegates.getDelegates()) { + if ( delegate instanceof RemoteDelegateEngine ) { + RemoteDelegateEngine rde = (RemoteDelegateEngine)delegate; + dc = new RemoteDelegateConfigurationImpl(rde.getKey(), + rde.getInputQueue().getBroker(), + rde.getInputQueue().getEndpoint(), + rde.getSerializationStrategy(), + rde.getErrorConfiguration().getGetMetaErrorHandlingSettings(), + rde.getErrorConfiguration().getProcessErrorHandlingSettings()); + } else if ( delegate instanceof ColocatedDelegateEngine) { + ColocatedDelegateEngine cdc = (ColocatedDelegateEngine)delegate; + DelegateConfiguration[] delegateConfigurations = new DelegateConfiguration[cdc.getDelegates().size()]; + int indx=0; + for( DelegateAnalysisEngine nestedDelegate : cdc.getDelegates() ) { + delegateConfigurations[indx++] = nestedDelegate. + } + dc = new ColocatedDelegateConfigurationImpl(cdc.getKey(), delegateConfigurations); + } else { + // ???????? + // Log + //throw new Exception("Invalid Delegate Type"); + continue; + } + delegateList.add(dc); + } + return delegateList; + } +*/ + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.UimaASAggregateDeploymentDescriptor#getDelegates() + */ +public List<DelegateAnalysisEngine> getDelegates() { +// List<DelegateConfiguration> delegateList = new ArrayList<DelegateConfiguration>(); + Delegates delegates = super.getDeploymentDescriptor().getDeployment().getService().getTopLevelAnalysisEngine().getDelegates(); +// super.deploymentDescriptor.getDeployment().getService().getTopLevelAnalysisEngine().getDelegates(); + return delegates.getDelegates(); + } + +} Propchange: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/UimaASAggregateDeploymentDescriptorImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Added: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/UimaASDeploymentDescriptorImpl.java URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/UimaASDeploymentDescriptorImpl.java?rev=1144476&view=auto ============================================================================== --- uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/UimaASDeploymentDescriptorImpl.java (added) +++ uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/UimaASDeploymentDescriptorImpl.java Fri Jul 8 20:11:20 2011 @@ -0,0 +1,164 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.uima.resourceSpecifier.factory.impl; + +import java.io.File; +import java.util.Properties; + +import org.apache.uima.resourceSpecifier.AnalysisEngineDeploymentDescriptionDocument; +import org.apache.uima.resourceSpecifier.AnalysisEngineDeploymentDescriptionType; +import org.apache.uima.resourceSpecifier.DeploymentType; +import org.apache.uima.resourceSpecifier.factory.DelegateConfiguration; +import org.apache.uima.resourceSpecifier.factory.Deployment; +import org.apache.uima.resourceSpecifier.factory.ServiceContext; +import org.apache.uima.resourceSpecifier.factory.UimaASDeploymentDescriptor; +import org.apache.xmlbeans.XmlOptions; +import org.springframework.util.Assert; + +// TODO: Auto-generated Javadoc +/** + * The Class UimaASDeploymentDescriptorImpl. + */ +public class UimaASDeploymentDescriptorImpl implements UimaASDeploymentDescriptor { + + /** The dd. */ + protected AnalysisEngineDeploymentDescriptionDocument dd; + + /** The dt. */ + protected AnalysisEngineDeploymentDescriptionType dt; + + /** The deployment. */ + protected Deployment deployment; + + /** + * Instantiates a new uima as deployment descriptor impl. + * + * @param dd the dd + * @param context the context + * @param delegateConfigurations the delegate configurations + */ + public UimaASDeploymentDescriptorImpl(AnalysisEngineDeploymentDescriptionDocument dd, ServiceContext context, DelegateConfiguration ... delegateConfigurations) { + this.dd = dd; + Assert.notNull(dd); + dt = dd.addNewAnalysisEngineDeploymentDescription(); + setName(context.getName()); + setDescription(context.getDescription()); + deployment = new DeploymentImpl(dt.addNewDeployment(),context,delegateConfigurations); + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.UimaASDeploymentDescriptor#setName(java.lang.String) + */ + public void setName(String name) { + Assert.notNull(dt); + dt.setName(name); + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.UimaASDeploymentDescriptor#getName() + */ + public String getName() { + Assert.notNull(dt); + return dt.getName(); + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.UimaASDeploymentDescriptor#setDescription(java.lang.String) + */ + public void setDescription(String description) { + Assert.notNull(dt); + dt.setDescription(description); + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.UimaASDeploymentDescriptor#getDescription() + */ + public String getDescription() { + Assert.notNull(dt); + return dt.getDescription(); + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.UimaASDeploymentDescriptor#getDeployment() + */ + public Deployment getDeployment() { + Assert.notNull(deployment); + return deployment; + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.UimaASDeploymentDescriptor#save(java.io.File) + */ + public void save(File file) throws Exception { + Assert.notNull(dd); + XmlOptions opts = new XmlOptions(); + opts.setSavePrettyPrint(); + //opts.s + opts.setSavePrettyPrintIndent(4); + opts.setUseDefaultNamespace(); + dd.save(file,opts); + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.UimaASDeploymentDescriptor#toXML() + */ + public String toXML() { + Assert.notNull(dd); + XmlOptions opts = new XmlOptions(); + opts.setSavePrettyPrint(); + //opts.s + opts.setSavePrettyPrintIndent(4); + opts.setUseDefaultNamespace(); + return dd.xmlText(opts); + //return dd.toString(); + } + + /** + * The Class DeploymentContext. + */ + protected static class DeploymentContext { + + /** The context properties. */ + private static Properties contextProperties=null; + + /** + * Gets the context. + * + * @return the context + */ + protected static Properties getContext() { + if ( contextProperties == null ) { + contextProperties = new Properties(); + } + return contextProperties; + } + + /** + * Sets the context. + * + * @param props the new context + */ + protected static void setContext(Properties props) { + contextProperties = props; + } + } + + + +} Propchange: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/UimaASDeploymentDescriptorImpl.java ------------------------------------------------------------------------------ svn:eol-style = native Added: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/UimaASPrimitiveDeploymentDescriptorImpl.java URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/UimaASPrimitiveDeploymentDescriptorImpl.java?rev=1144476&view=auto ============================================================================== --- uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/UimaASPrimitiveDeploymentDescriptorImpl.java (added) +++ uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/UimaASPrimitiveDeploymentDescriptorImpl.java Fri Jul 8 20:11:20 2011 @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.uima.resourceSpecifier.factory.impl; + +import org.apache.uima.resourceSpecifier.AnalysisEngineDeploymentDescriptionDocument; +import org.apache.uima.resourceSpecifier.factory.CollectionProcessCompleteErrorHandlingSettings; +import org.apache.uima.resourceSpecifier.factory.CollectionProcessCompleteErrors; +import org.apache.uima.resourceSpecifier.factory.GetMetaErrorHandlingSettings; +import org.apache.uima.resourceSpecifier.factory.ProcessCasErrors; +import org.apache.uima.resourceSpecifier.factory.ProcessErrorHandlingSettings; +import org.apache.uima.resourceSpecifier.factory.ServiceContext; +import org.apache.uima.resourceSpecifier.factory.UimaASPrimitiveDeploymentDescriptor; +import org.apache.uima.resourceSpecifier.factory.impl.DeploymentDescriptorImpl; +import org.apache.uima.resourceSpecifier.factory.impl.UimaASDeploymentDescriptorImpl; + +// TODO: Auto-generated Javadoc +/** + * The Class UimaASPrimitiveDeploymentDescriptorImpl. + */ +public class UimaASPrimitiveDeploymentDescriptorImpl extends DeploymentDescriptorImpl +implements UimaASPrimitiveDeploymentDescriptor { + + /** + * Instantiates a new uima as primitive deployment descriptor impl. + * + * @param dd the dd + * @param context the context + */ + public UimaASPrimitiveDeploymentDescriptorImpl(AnalysisEngineDeploymentDescriptionDocument dd, + ServiceContext context ) { + super(new UimaASDeploymentDescriptorImpl(dd,context)); + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.UimaASPrimitiveDeploymentDescriptor#setScaleup(int) + */ + public void setScaleup(int scaleup) { + super.deploymentDescriptor.getDeployment().getService().getTopLevelAnalysisEngine().getInputQueueScaleout().setNumberOfInstances(scaleup); + } + + /* (non-Javadoc) + * @see org.apache.uima.resourceSpecifier.factory.UimaASPrimitiveDeploymentDescriptor#getScaleup() + */ + public int getScaleup() { + return super.deploymentDescriptor.getDeployment().getService().getTopLevelAnalysisEngine().getInputQueueScaleout().getNumberOfInstances(); + } + + public ProcessCasErrors getProcessErrorHandlingSettings() { + return super.deploymentDescriptor.getDeployment().getService().getTopLevelAnalysisEngine().getPrimitiveErrorConfiguration().getProcessCasErrors(); + } + + public GetMetaErrorHandlingSettings getGetMetaErrorHandlingSettings() { + // TODO Auto-generated method stub + return null; + } + + public CollectionProcessCompleteErrors getCollectionProcessCompleteErrorHandlingSettings() { + return null; + //return super.deploymentDescriptor.getDeployment().getService().getTopLevelAnalysisEngine().getPrimitiveErrorConfiguration().getCollectionProcessCompleteErrors(); + } + +} Propchange: uima/uima-as/trunk/uimaj-as-core/src/main/java/org/apache/uima/resourceSpecifier/factory/impl/UimaASPrimitiveDeploymentDescriptorImpl.java ------------------------------------------------------------------------------ svn:eol-style = native