Skip to content

Commit ba65ac4

Browse files
author
Arthur Taylor
committed
Fixed up licenses, formatting
1 parent 92ef6bf commit ba65ac4

File tree

27 files changed

+620
-166
lines changed

27 files changed

+620
-166
lines changed

nonslingtests/bundles/jpatest/src/main/java/org/sakaiproject/kernel2/jpatest/model/Greeting.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Licensed to the Sakai Foundation (SF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The SF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations under the License.
17+
*/
18+
119
package org.sakaiproject.kernel2.jpatest.model;
220

321
import java.io.Serializable;

nonslingtests/bundles/jpatest/src/main/java/org/sakaiproject/kernel2/jpatest/model/Hello.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Licensed to the Sakai Foundation (SF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The SF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations under the License.
17+
*/
18+
119
package org.sakaiproject.kernel2.jpatest.model;
220

321
import org.eclipse.persistence.jpa.PersistenceProvider;
@@ -36,8 +54,7 @@ private void createAndRollback() {
3654

3755
System.out.println("Persisted " + g + ", but the transaction was rolled back.");
3856
Greeting g2 = em.find(Greeting.class, g.getId());
39-
System.out.println("Greeting " + g.getId() + " from db: " + g2); // should
40-
// be null
57+
System.out.println("Greeting " + g.getId() + " from db: " + g2);
4158
}
4259

4360
private void initEntityManager() {

slingtests/osgikernel/bundles/jpaexample/src/main/java/org/sakaiproject/kernel2/osgi/jpaexample/JpaExample.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Licensed to the Sakai Foundation (SF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The SF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations under the License.
17+
*/
18+
119
package org.sakaiproject.kernel2.osgi.jpaexample;
220

321
import org.osgi.framework.BundleActivator;
@@ -21,12 +39,12 @@ public void start(BundleContext arg0) throws Exception {
2139
em.getTransaction().begin();
2240
em.persist(model);
2341
em.getTransaction().commit();
24-
42+
2543
System.out.println("Attempting to read back model from database");
2644
// model should be written to database now.
2745
ExampleModel model2 = em.find(ExampleModel.class, model.getId());
2846
System.out.println("Model " + model.getId() + " from db: " + model2);
29-
47+
3048
SystemUser u = new SystemUser();
3149
u.setName("Some user");
3250
em.getTransaction().begin();

slingtests/osgikernel/bundles/jpaexample/src/main/java/org/sakaiproject/kernel2/osgi/jpaexample/jpa/model/ExampleModel.java

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Licensed to the Sakai Foundation (SF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The SF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations under the License.
17+
*/
18+
119
package org.sakaiproject.kernel2.osgi.jpaexample.jpa.model;
220

321
import java.io.Serializable;
@@ -16,10 +34,9 @@ public class ExampleModel implements Serializable {
1634

1735
@Basic
1836
private String property;
19-
20-
public long getId()
21-
{
22-
return id;
37+
38+
public long getId() {
39+
return id;
2340
}
2441

2542
public void setProperty(String property) {

slingtests/osgikernel/bundles/jpahelloworld/src/main/java/org/sakaiproject/kernel2/osgi/jpahelloworld/model/Greeting.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Licensed to the Sakai Foundation (SF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The SF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations under the License.
17+
*/
18+
119
package org.sakaiproject.kernel2.osgi.jpahelloworld.model;
220

321
import java.io.Serializable;
@@ -40,8 +58,7 @@ public int hashCode() {
4058

4159
@Override
4260
public boolean equals(Object object) {
43-
// TODO: Warning - this method won't work in the case the id fields are not
44-
// set
61+
// TODO: Warning - this method won't work in the case the id fields are not set
4562
if (!(object instanceof Greeting)) {
4663
return false;
4764
}

slingtests/osgikernel/bundles/jpahelloworld/src/main/java/org/sakaiproject/kernel2/osgi/jpahelloworld/model/Hello.java

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Licensed to the Sakai Foundation (SF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The SF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations under the License.
17+
*/
18+
119
package org.sakaiproject.kernel2.osgi.jpahelloworld.model;
220

321
import org.eclipse.persistence.config.PersistenceUnitProperties;
@@ -41,17 +59,16 @@ private void createAndRollback() {
4159

4260
System.out.println("Persisted " + g + ", but the transaction was rolled back.");
4361
Greeting g2 = em.find(Greeting.class, g.getId());
44-
System.out.println("Greeting " + g.getId() + " from db: " + g2); // should
45-
// be null
62+
System.out.println("Greeting " + g.getId() + " from db: " + g2);
4663
}
4764

4865
private void initEntityManager() {
4966
Map<String, Object> properties = new HashMap<String, Object>();
50-
properties.put(PersistenceUnitProperties.DDL_GENERATION, PersistenceUnitProperties.DROP_AND_CREATE);
51-
properties.put(PersistenceUnitProperties.DDL_GENERATION_MODE, PersistenceUnitProperties.DDL_DATABASE_GENERATION);
52-
//properties.put(PersistenceUnitProperties.CLASSLOADER, this.getClass().getClassLoader());
53-
emf = new PersistenceProvider()
54-
.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
67+
properties.put(PersistenceUnitProperties.DDL_GENERATION,
68+
PersistenceUnitProperties.DROP_AND_CREATE);
69+
properties.put(PersistenceUnitProperties.DDL_GENERATION_MODE,
70+
PersistenceUnitProperties.DDL_DATABASE_GENERATION);
71+
emf = new PersistenceProvider().createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
5572
em = emf.createEntityManager();
5673
}
5774

@@ -62,7 +79,5 @@ public void start(BundleContext arg0) throws Exception {
6279
}
6380

6481
public void stop(BundleContext arg0) throws Exception {
65-
// TODO Auto-generated method stub
66-
6782
}
6883
}

slingtests/osgikernel/bundles/jpaprovider/src/main/java/org/sakaiproject/kernel2/osgi/jpaprovider/AmalgamatingClassloader.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Licensed to the Sakai Foundation (SF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The SF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations under the License.
17+
*/
18+
119
package org.sakaiproject.kernel2.osgi.jpaprovider;
220

321
import com.thoughtworks.xstream.XStream;
@@ -48,8 +66,7 @@ public AmalgamatingClassloader(ClassLoader classLoader) {
4866
public Class<?> loadClass(String name) throws ClassNotFoundException {
4967
BundleGatheringResourceFinder finder = PersistenceBundleMonitor.getBundleResourceFinder();
5068
Class<?> result = finder.loadClass(name);
51-
if (result == null)
52-
{
69+
if (result == null) {
5370
return super.loadClass(name);
5471
}
5572
return result;
@@ -125,7 +142,8 @@ private URL constructUrl(XStream xstream, XStreamWritable writable, String filen
125142

126143
// The base directory must be empty since JPA will scan it searching for
127144
// classes.
128-
File file = new File(System.getProperty("java.io.tmpdir") + "/sakai" + System.currentTimeMillis() + "/" + filename);
145+
File file = new File(System.getProperty("java.io.tmpdir") + "/sakai"
146+
+ System.currentTimeMillis() + "/" + filename);
129147
if (file.getParentFile().mkdirs()) {
130148
LOG.debug("Created " + file);
131149
}

slingtests/osgikernel/bundles/jpaprovider/src/main/java/org/sakaiproject/kernel2/osgi/jpaprovider/BundleGatheringResourceFinder.java

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Licensed to the Sakai Foundation (SF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The SF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations under the License.
17+
*/
18+
119
package org.sakaiproject.kernel2.osgi.jpaprovider;
220

321
import org.osgi.framework.Bundle;
@@ -28,15 +46,12 @@ public List<URL> getResources(String string) {
2846
}
2947
return result;
3048
}
31-
49+
3250
public Class<?> loadClass(String name) {
3351
for (Bundle bundle : bundles) {
34-
try
35-
{
52+
try {
3653
return bundle.loadClass(name);
37-
}
38-
catch (Exception e)
39-
{
54+
} catch (Exception e) {
4055
/* Try another bundle */
4156
}
4257
}

0 commit comments

Comments
 (0)