Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 167366 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseOsgiProjectizer.java (-27 / +31 lines)
Lines 78-84 Link Here
78
			MetadataDescriptor rmd = _metadatas[i];
78
			MetadataDescriptor rmd = _metadatas[i];
79
			createRMDFile(rmd, wsdl, wsdldir);
79
			createRMDFile(rmd, wsdl, wsdldir);
80
			createWSDLFile(wsdl, wsdldir);			
80
			createWSDLFile(wsdl, wsdldir);			
81
			createRouterEntries(routerEntriesDir, WsdlUtils.getServiceName(wsdl.getDocumentElement()), _capabilitiesList[i]);
81
			if(_instances == null) {
82
				createRouterEntries(routerEntriesDir, WsdlUtils.getServiceName(wsdl.getDocumentElement()), _capabilitiesList[i]);
83
			}
84
		}
85
		
86
		if(_instances != null) {
87
			createRouterEntries(routerEntriesDir, _instances);
82
		}
88
		}
83
		
89
		
84
		createBuildProperties(_targetDirectory, EclipseOsgiProjectizerConstants.BUILD_PROPERTIES_FILE_RESOURCE, EclipseOsgiProjectizerConstants.BUILD_PROPERTIES_FILE);
90
		createBuildProperties(_targetDirectory, EclipseOsgiProjectizerConstants.BUILD_PROPERTIES_FILE_RESOURCE, EclipseOsgiProjectizerConstants.BUILD_PROPERTIES_FILE);
Lines 86-117 Link Here
86
		helper.refreshProject();
92
		helper.refreshProject();
87
	}
93
	}
88
		
94
		
89
	protected void createRouterEntries(File routerEntriesDir, String serviceName, Map capabilitiesMap)
95
	protected void createRouterEntries(File routerEntriesDir, Object[][] instances)
90
			throws Exception {
96
			throws Exception {
91
		
97
		
92
		if(_instances == null) {
98
		routerEntriesDir.mkdirs();
93
			super.createRouterEntries(routerEntriesDir, serviceName, capabilitiesMap);
99
		
94
		} else {
100
		for(int i=0; i < _instances.length; i++) {
101
			Object[] instancePair = _instances[i];
95
			
102
			
96
			for(int i=0; i < _instances.length; i++) {
103
			//
97
				Object[] instancePair = _instances[i];
104
			//This is really tacky, but it's the only real way to do this
98
				
105
			// since there are no pairs. The File use is to get the last element
99
				//
106
			// of the path in a nice, non-hack way. 
100
				//This is really tacky, but it's the only real way to do this
107
			//
101
				// since there are no pairs. The File use is to get the last element
108
			String path = (String) instancePair[0];
102
				// of the path in a nice, non-hack way. 
109
			String resourcePathName = new File(path).getName();
103
				//
110
			
104
				String path = (String) instancePair[0];
111
			Element instanceElement = (Element) instancePair[1];
105
				String resourcePathName = new File(path).getName();
112
			
106
				
113
			File serviceDir = new File(routerEntriesDir, resourcePathName);				
107
				Element instanceElement = (Element) instancePair[1];
114
			File routerEntryFile = new File(serviceDir, getResourceFileName());
108
				
115
			
109
				File serviceDir = new File(routerEntriesDir, resourcePathName);				
116
			writeToFileCheck(instanceElement, routerEntryFile);				
110
				File routerEntryFile = new File(serviceDir, getResourceFileName());
111
				
112
				writeToFileCheck(instanceElement, routerEntryFile);				
113
			}
114
115
		}
117
		}
116
	}
118
	}
117
	
119
	
Lines 160-168 Link Here
160
					throw new RuntimeException();
162
					throw new RuntimeException();
161
				}
163
				}
162
			}
164
			}
163
			for(int i=0; i < _additionalJars.length; i++) {
165
			if(_additionalJars != null) {
164
				bundleClassPath = bundleClassPath + "," + EclipseOsgiProjectizerConstants.LIB_DIR + "/" + _additionalJars[i].getName();
166
				for(int i=0; i < _additionalJars.length; i++) {
165
				FileUtils.copy(_additionalJars[i], libDirectory);
167
					bundleClassPath = bundleClassPath + "," + EclipseOsgiProjectizerConstants.LIB_DIR + "/" + _additionalJars[i].getName();
168
					FileUtils.copy(_additionalJars[i], libDirectory);
169
				}
166
			}
170
			}
167
			
171
			
168
			Attributes.Name name = new Attributes.Name(BUNDLE_CLASSPATH_ATTR);
172
			Attributes.Name name = new Attributes.Name(BUNDLE_CLASSPATH_ATTR);
(-)src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/DescriptorHelper.java (-4 / +24 lines)
Lines 25-30 Link Here
25
25
26
import org.apache.muse.core.descriptor.DescriptorConstants;
26
import org.apache.muse.core.descriptor.DescriptorConstants;
27
import org.apache.muse.util.xml.XmlUtils;
27
import org.apache.muse.util.xml.XmlUtils;
28
import org.apache.muse.ws.addressing.WsaConstants;
28
import org.apache.muse.ws.resource.metadata.MetadataDescriptor;
29
import org.apache.muse.ws.resource.metadata.MetadataDescriptor;
29
import org.apache.muse.ws.resource.metadata.OpenMetadataDescriptor;
30
import org.apache.muse.ws.resource.metadata.OpenMetadataDescriptor;
30
import org.eclipse.core.resources.IFile;
31
import org.eclipse.core.resources.IFile;
Lines 155-161 Link Here
155
	 * @param mrtObjectMap - The map of MRTLocation-MRTObject pair, can be null.
156
	 * @param mrtObjectMap - The map of MRTLocation-MRTObject pair, can be null.
156
	 * @throws Exception - If anything goes wrong.
157
	 * @throws Exception - If anything goes wrong.
157
	 */
158
	 */
158
	public DescriptorHelper(CodeGenerationDelegate codeGenerationDelegate, InputStream inputStream, Map mrtObjectMap) throws Exception
159
	public DescriptorHelper(CodeGenerationDelegate codeGenerationDelegate, InputStream inputStream, Map mrtObjectMap, boolean extractExtraInfo) throws Exception
159
	{
160
	{
160
		if(mrtObjectMap!=null)
161
		if(mrtObjectMap!=null)
161
			_mrtObjectMap = mrtObjectMap;
162
			_mrtObjectMap = mrtObjectMap;
Lines 164-171 Link Here
164
		Document rootDocument = XmlUtils.createDocument(inputStream);
165
		Document rootDocument = XmlUtils.createDocument(inputStream);
165
166
166
		_descriptorDocument = extractDescriptorDocument(rootDocument);
167
		_descriptorDocument = extractDescriptorDocument(rootDocument);
167
		_instances = extractInstances(rootDocument);
168
		
168
		_jarFiles = extractJarFiles(rootDocument);
169
		if(extractExtraInfo) {
170
			_instances = extractInstances(rootDocument);
171
			_jarFiles = extractJarFiles(rootDocument);
172
		} else {
173
			_instances = null;
174
			_jarFiles = null;
175
		}
176
	}
177
	
178
	public DescriptorHelper(CodeGenerationDelegate codeGenerationDelegate, InputStream inputStream, Map mrtObjectMap) throws Exception {
179
		this(codeGenerationDelegate, inputStream, mrtObjectMap, true);
169
	}
180
	}
170
181
171
	/**
182
	/**
Lines 195-202 Link Here
195
					initialInstancesElements[i],
206
					initialInstancesElements[i],
196
					DescriptorConstants.CONTEXT_PATH_QNAME);
207
					DescriptorConstants.CONTEXT_PATH_QNAME);
197
			instances[i][0] = XmlUtils.extractText(contextElement);
208
			instances[i][0] = XmlUtils.extractText(contextElement);
198
			instances[i][1] = XmlUtils.findFirstInSubTree(
209
			Element instancesElement = XmlUtils.findFirstInSubTree(
199
					initialInstancesElements[i], REFERENCE_PARAMETERS_QNAME);
210
					initialInstancesElements[i], REFERENCE_PARAMETERS_QNAME);
211
			
212
			Element referenceParametersElement = XmlUtils.createElement(WsaConstants.PARAMETERS_QNAME);
213
			
214
			Element[] referenceParameters = XmlUtils.getAllElements(instancesElement);
215
			Document owner = referenceParametersElement.getOwnerDocument();
216
			for(int j=0; j < referenceParameters.length; j++) {
217
				referenceParametersElement.appendChild(owner.importNode(referenceParameters[j], true));
218
			}
219
			instances[i][1] = referenceParametersElement;	
200
		}
220
		}
201
221
202
		return instances;
222
		return instances;
(-)src/org/eclipse/tptp/wsdm/tooling/codegen/mrt/provisional/MRTCodeGenerationDelegate.java (-1 / +1 lines)
Lines 79-85 Link Here
79
	{
79
	{
80
		byte[] serializedDD = createDD();
80
		byte[] serializedDD = createDD();
81
		Map mrtObjectMap = _mrtPreProcessor.getMrtObjectMap();
81
		Map mrtObjectMap = _mrtPreProcessor.getMrtObjectMap();
82
		return new DescriptorHelper(this, new ByteArrayInputStream(serializedDD), mrtObjectMap);
82
		return new DescriptorHelper(this, new ByteArrayInputStream(serializedDD), mrtObjectMap, false);
83
	}
83
	}
84
	
84
	
85
	private byte[] createDD()
85
	private byte[] createDD()
(-)src/org/eclipse/tptp/wsdm/tooling/internal/projectizer/EclipseAxis2Projectizer.java (-30 / +35 lines)
Lines 106-114 Link Here
106
			MetadataDescriptor rmd = _metadatas[i];
106
			MetadataDescriptor rmd = _metadatas[i];
107
			createRMDFile(rmd, wsdl, wsdldir);
107
			createRMDFile(rmd, wsdl, wsdldir);
108
			createWSDLFile(wsdl, wsdldir);
108
			createWSDLFile(wsdl, wsdldir);
109
			createRouterEntries(routerEntriesDir, WsdlUtils.getServiceName(wsdl.getDocumentElement()), capabilities);
109
			if(_instances == null) {
110
				createRouterEntries(routerEntriesDir, WsdlUtils.getServiceName(wsdl.getDocumentElement()), _capabilitiesList[i]);
111
			}
110
			updateServicesDescriptor(servicesHelper, wsdl, capabilities);
112
			updateServicesDescriptor(servicesHelper, wsdl, capabilities);
111
		}				
113
		}		
114
					
115
		if(_instances != null) {
116
			createRouterEntries(routerEntriesDir, _instances);
117
		}
112
		recordProgress(_progressMonitor, 4);
118
		recordProgress(_progressMonitor, 4);
113
		
119
		
114
		File servicesFile = new File(webContentDir, Axis2ProjectizerConstants.SERVICES_FILE);
120
		File servicesFile = new File(webContentDir, Axis2ProjectizerConstants.SERVICES_FILE);
Lines 157-184 Link Here
157
		return helper;
163
		return helper;
158
	}
164
	}
159
	
165
	
160
	protected void createRouterEntries(File routerEntriesDir, String serviceName, Map capabilitiesMap) throws Exception {
166
	protected void createRouterEntries(File routerEntriesDir,Object[][] instances) throws Exception {
161
		if(_instances == null) {
167
		routerEntriesDir.mkdirs();
162
			super.createRouterEntries(routerEntriesDir, serviceName, capabilitiesMap);
168
		
163
		} else {
169
		for (int i = 0; i < _instances.length; i++) {
164
			for(int i=0; i < _instances.length; i++) {
170
			Object[] instancePair = _instances[i];
165
				Object[] instancePair = _instances[i];
171
166
				
172
			//
167
				//
173
			// This is really tacky, but it's the only real way to do this
168
				//This is really tacky, but it's the only real way to do this
174
			// since there are no pairs. The File use is to get the last element
169
				// since there are no pairs. The File use is to get the last element
175
			// of the path in a nice, non-hack way.
170
				// of the path in a nice, non-hack way. 
176
			//
171
				//
177
			String path = (String) instancePair[0];
172
				String path = (String) instancePair[0];
178
			String resourcePathName = new File(path).getName();
173
				String resourcePathName = new File(path).getName();
179
174
				
180
			Element instanceElement = (Element) instancePair[1];
175
				Element instanceElement = (Element) instancePair[1];
181
176
				
182
			File serviceDir = new File(routerEntriesDir, resourcePathName);
177
				File serviceDir = new File(routerEntriesDir, resourcePathName);				
183
			File routerEntryFile = new File(serviceDir, getResourceFileName());
178
				File routerEntryFile = new File(serviceDir, getResourceFileName());
184
179
				
185
			writeToFileCheck(instanceElement, routerEntryFile);
180
				writeToFileCheck(instanceElement, routerEntryFile);				
181
			}
182
		}
186
		}
183
	}
187
	}
184
	
188
	
Lines 225-237 Link Here
225
		
229
		
226
		File libDestination = new File(webContentDestination, "lib");
230
		File libDestination = new File(webContentDestination, "lib");
227
		
231
		
228
		
232
		if(_additionalJars != null) {
229
		for (int i=0; i < _additionalJars.length; i++) {
233
			for (int i=0; i < _additionalJars.length; i++) {
230
			if(!_additionalJars[i].exists()) {
234
				if(!_additionalJars[i].exists()) {
231
				throw new FileNotFoundException(_additionalJars[i].getAbsolutePath());
235
					throw new FileNotFoundException(_additionalJars[i].getAbsolutePath());
236
				}
237
				
238
				FileUtils.copyFile(_additionalJars[i], libDestination);
232
			}
239
			}
233
			
234
			FileUtils.copyFile(_additionalJars[i], libDestination);
235
		}
240
		}
236
		
241
		
237
		for (int i=0; i < _filesToCopy.length; i++) {
242
		for (int i=0; i < _filesToCopy.length; i++) {

Return to bug 167366